diff options
author | Andrew de Quincy <devnull@localhost> | 2005-06-12 01:46:29 +0000 |
---|---|---|
committer | Andrew de Quincy <devnull@localhost> | 2005-06-12 01:46:29 +0000 |
commit | 9063d41450ed6d9925a8e36d89bc3eb1c4ce71aa (patch) | |
tree | 1bc6b9c48ecf5325f9df9a2b3e050dd2c93fdabc /linux/drivers/media/dvb/ttpci/budget.c | |
parent | af9281ddbde97a47a1476d7fb2a60eaf4781d738 (diff) | |
download | mediapointer-dvb-s2-9063d41450ed6d9925a8e36d89bc3eb1c4ce71aa.tar.gz mediapointer-dvb-s2-9063d41450ed6d9925a8e36d89bc3eb1c4ce71aa.tar.bz2 |
Implement voltage controls
Diffstat (limited to 'linux/drivers/media/dvb/ttpci/budget.c')
-rw-r--r-- | linux/drivers/media/dvb/ttpci/budget.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/ttpci/budget.c b/linux/drivers/media/dvb/ttpci/budget.c index 125f06aa0..2fe501120 100644 --- a/linux/drivers/media/dvb/ttpci/budget.c +++ b/linux/drivers/media/dvb/ttpci/budget.c @@ -181,8 +181,47 @@ static int budget_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t m static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) { struct budget* budget = (struct budget*) fe->dvb->priv; + u8 buf; + struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) }; - // FIXME: implement + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; + + switch(voltage) { + case SEC_VOLTAGE_13: + buf = (buf & 0xf7) | 0x04; + break; + + case SEC_VOLTAGE_18: + buf = (buf & 0xf7) | 0x0c; + break; + + case SEC_VOLTAGE_OFF: + buf = buf & 0xf0; + break; + } + + msg.flags = 0; + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; + + return 0; +} + +static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, int arg) +{ + struct budget* budget = (struct budget*) fe->dvb->priv; + u8 buf; + struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) }; + + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; + + if (arg) { + buf = buf | 0x10; + } else { + buf = buf & 0xef; + } + + msg.flags = 0; + if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; return 0; } @@ -505,8 +544,8 @@ static void frontend_init(struct budget *budget) case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); if (budget->dvb_frontend) { - // FIXME: need to setup LNB hardware? budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; + budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; break; } */ @@ -518,14 +557,21 @@ static void frontend_init(struct budget *budget) budget->dev->pci->device, budget->dev->pci->subsystem_vendor, budget->dev->pci->subsystem_device); + return; } else { if (dvb_register_frontend(&budget->dvb_adapter, budget->dvb_frontend)) { printk("budget: Frontend registration failed!\n"); if (budget->dvb_frontend->ops->release) budget->dvb_frontend->ops->release(budget->dvb_frontend); budget->dvb_frontend = NULL; + return; } } + + if (budget->dev->pci->subsystem_device == 0x1016) { + lnbp21_set_voltage(budget->dvb_frontend, SEC_VOLTAGE_OFF); + lnbp21_enable_high_lnb_voltage(budget->dvb_frontend, 0); + } } static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) |