static int em28xx_pctv_292e_set_lna(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv; struct em28xx *dev = i2c_bus->dev; u8 lna; if (c->lna == 1) lna = 0x01; else lna = 0x00; return em28xx_write_reg_bits(dev, EM2874_R80_GPIO_P0_CTRL, lna, 0x01); }
int em28xx_ir_init(struct em28xx *dev) { struct em28xx_IR *ir; struct input_dev *input_dev; u8 ir_config; int err = -ENOMEM; if (dev->board.ir_codes == NULL) { /* No remote control support */ return 0; } ir = kzalloc(sizeof(*ir), GFP_KERNEL); input_dev = input_allocate_device(); if (!ir || !input_dev) goto err_out_free; ir->input = input_dev; ir_config = EM2874_IR_RC5; /* Adjust xclk based o IR table for RC5/NEC tables */ if (dev->board.ir_codes->ir_type == IR_TYPE_RC5) { dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; ir->full_code = 1; } else if (dev->board.ir_codes->ir_type == IR_TYPE_NEC) { dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; ir_config = EM2874_IR_NEC; ir->full_code = 1; } em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, EM28XX_XCLK_IR_RC5_MODE); /* Setup the proper handler based on the chip */ switch (dev->chip_id) { case CHIP_ID_EM2860: case CHIP_ID_EM2883: ir->get_key = default_polling_getkey; break; case CHIP_ID_EM2874: ir->get_key = em2874_polling_getkey; em28xx_write_regs(dev, EM2874_R50_IR_CONFIG, &ir_config, 1); break; default: printk("Unrecognized em28xx chip id: IR not supported\n"); goto err_out_free; } /* This is how often we ask the chip for IR information */ ir->polling = 100; /* ms */ /* init input device */ snprintf(ir->name, sizeof(ir->name), "em28xx IR (%s)", dev->name); usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); strlcat(ir->phys, "/input0", sizeof(ir->phys)); err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER); if (err < 0) goto err_out_free; input_dev->name = ir->name; input_dev->phys = ir->phys; input_dev->id.bustype = BUS_USB; input_dev->id.version = 1; input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct); input_dev->dev.parent = &dev->udev->dev; /* record handles to ourself */ ir->dev = dev; dev->ir = ir; em28xx_ir_start(ir); /* all done */ err = ir_input_register(ir->input, dev->board.ir_codes); if (err) goto err_out_stop; return 0; err_out_stop: em28xx_ir_stop(ir); dev->ir = NULL; err_out_free: kfree(ir); return err; }