diff options
author | Igor M. Liplianin <liplianin@me.by> | 2011-02-25 16:41:22 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:32:26 -0400 |
commit | fa8bae102fbbabe9ecc4381ace3b74a199684594 (patch) | |
tree | 33bb9b680e4f1920a7f15dcfdb5a4457fceb1e71 | |
parent | 2adc591fb7764bf70f65a5923ff50c1c1b671c20 (diff) |
[media] dw2102: Prof 7500: Lock LED implemented
Code changed for dw2102, stv0900 in order to achieve that.
Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/dvb-usb/dw2102.c | 29 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0900.h | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0900_core.c | 23 |
3 files changed, 53 insertions, 1 deletions
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c index 57af4c17d54f..4ae4fb02164d 100644 --- a/drivers/media/dvb/dvb-usb/dw2102.c +++ b/drivers/media/dvb/dvb-usb/dw2102.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #define DW2102_VOLTAGE_CTRL (0x1800) | 70 | #define DW2102_VOLTAGE_CTRL (0x1800) |
71 | #define SU3000_STREAM_CTRL (0x1900) | 71 | #define SU3000_STREAM_CTRL (0x1900) |
72 | #define DW2102_RC_QUERY (0x1a00) | 72 | #define DW2102_RC_QUERY (0x1a00) |
73 | #define DW2102_LED_CTRL (0x1b00) | ||
73 | 74 | ||
74 | #define err_str "did not find the firmware file. (%s) " \ | 75 | #define err_str "did not find the firmware file. (%s) " \ |
75 | "Please see linux/Documentation/dvb/ for more details " \ | 76 | "Please see linux/Documentation/dvb/ for more details " \ |
@@ -509,6 +510,15 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
509 | obuf, 2, DW210X_WRITE_MSG); | 510 | obuf, 2, DW210X_WRITE_MSG); |
510 | break; | 511 | break; |
511 | } | 512 | } |
513 | case (DW2102_LED_CTRL): { | ||
514 | u8 obuf[2]; | ||
515 | |||
516 | obuf[0] = 5; | ||
517 | obuf[1] = msg[j].buf[0]; | ||
518 | ret = dw210x_op_rw(d->udev, 0x8a, 0, 0, | ||
519 | obuf, 2, DW210X_WRITE_MSG); | ||
520 | break; | ||
521 | } | ||
512 | /*case 0x55: cx24116 | 522 | /*case 0x55: cx24116 |
513 | case 0x6a: stv0903 | 523 | case 0x6a: stv0903 |
514 | case 0x68: ds3000, stv0903 | 524 | case 0x68: ds3000, stv0903 |
@@ -844,6 +854,24 @@ static int dw210x_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | |||
844 | return 0; | 854 | return 0; |
845 | } | 855 | } |
846 | 856 | ||
857 | static void dw210x_led_ctrl(struct dvb_frontend *fe, int offon) | ||
858 | { | ||
859 | static u8 led_off[] = { 0 }; | ||
860 | static u8 led_on[] = { 1 }; | ||
861 | struct i2c_msg msg = { | ||
862 | .addr = DW2102_LED_CTRL, | ||
863 | .flags = 0, | ||
864 | .buf = led_off, | ||
865 | .len = 1 | ||
866 | }; | ||
867 | struct dvb_usb_adapter *udev_adap = | ||
868 | (struct dvb_usb_adapter *)(fe->dvb->priv); | ||
869 | |||
870 | if (offon) | ||
871 | msg.buf = led_on; | ||
872 | i2c_transfer(&udev_adap->dev->i2c_adap, &msg, 1); | ||
873 | } | ||
874 | |||
847 | static struct stv0299_config sharp_z0194a_config = { | 875 | static struct stv0299_config sharp_z0194a_config = { |
848 | .demod_address = 0x68, | 876 | .demod_address = 0x68, |
849 | .inittab = sharp_z0194a_inittab, | 877 | .inittab = sharp_z0194a_inittab, |
@@ -923,6 +951,7 @@ static struct stv0900_config prof_7500_stv0900_config = { | |||
923 | .tun1_adc = 0,/* 2 Vpp */ | 951 | .tun1_adc = 0,/* 2 Vpp */ |
924 | .path1_mode = 3, | 952 | .path1_mode = 3, |
925 | .tun1_type = 3, | 953 | .tun1_type = 3, |
954 | .set_lock_led = dw210x_led_ctrl, | ||
926 | }; | 955 | }; |
927 | 956 | ||
928 | static struct ds3000_config su3000_ds3000_config = { | 957 | static struct ds3000_config su3000_ds3000_config = { |
diff --git a/drivers/media/dvb/frontends/stv0900.h b/drivers/media/dvb/frontends/stv0900.h index e3e35d1ce838..91c7ee8b2313 100644 --- a/drivers/media/dvb/frontends/stv0900.h +++ b/drivers/media/dvb/frontends/stv0900.h | |||
@@ -53,6 +53,8 @@ struct stv0900_config { | |||
53 | u8 tun2_type; | 53 | u8 tun2_type; |
54 | /* Set device param to start dma */ | 54 | /* Set device param to start dma */ |
55 | int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured); | 55 | int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured); |
56 | /* Hook for Lock LED */ | ||
57 | void (*set_lock_led)(struct dvb_frontend *fe, int offon); | ||
56 | }; | 58 | }; |
57 | 59 | ||
58 | #if defined(CONFIG_DVB_STV0900) || (defined(CONFIG_DVB_STV0900_MODULE) \ | 60 | #if defined(CONFIG_DVB_STV0900) || (defined(CONFIG_DVB_STV0900_MODULE) \ |
diff --git a/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c index 4f5e7d3a0e61..1ca1c835048f 100644 --- a/drivers/media/dvb/frontends/stv0900_core.c +++ b/drivers/media/dvb/frontends/stv0900_core.c | |||
@@ -1660,8 +1660,13 @@ static int stv0900_read_status(struct dvb_frontend *fe, enum fe_status *status) | |||
1660 | | FE_HAS_VITERBI | 1660 | | FE_HAS_VITERBI |
1661 | | FE_HAS_SYNC | 1661 | | FE_HAS_SYNC |
1662 | | FE_HAS_LOCK; | 1662 | | FE_HAS_LOCK; |
1663 | } else | 1663 | if (state->config->set_lock_led) |
1664 | state->config->set_lock_led(fe, 1); | ||
1665 | } else { | ||
1666 | if (state->config->set_lock_led) | ||
1667 | state->config->set_lock_led(fe, 0); | ||
1664 | dprintk("DEMOD LOCK FAIL\n"); | 1668 | dprintk("DEMOD LOCK FAIL\n"); |
1669 | } | ||
1665 | 1670 | ||
1666 | return 0; | 1671 | return 0; |
1667 | } | 1672 | } |
@@ -1831,6 +1836,9 @@ static void stv0900_release(struct dvb_frontend *fe) | |||
1831 | 1836 | ||
1832 | dprintk("%s\n", __func__); | 1837 | dprintk("%s\n", __func__); |
1833 | 1838 | ||
1839 | if (state->config->set_lock_led) | ||
1840 | state->config->set_lock_led(fe, 0); | ||
1841 | |||
1834 | if ((--(state->internal->dmds_used)) <= 0) { | 1842 | if ((--(state->internal->dmds_used)) <= 0) { |
1835 | 1843 | ||
1836 | dprintk("%s: Actually removing\n", __func__); | 1844 | dprintk("%s: Actually removing\n", __func__); |
@@ -1842,6 +1850,18 @@ static void stv0900_release(struct dvb_frontend *fe) | |||
1842 | kfree(state); | 1850 | kfree(state); |
1843 | } | 1851 | } |
1844 | 1852 | ||
1853 | static int stv0900_sleep(struct dvb_frontend *fe) | ||
1854 | { | ||
1855 | struct stv0900_state *state = fe->demodulator_priv; | ||
1856 | |||
1857 | dprintk("%s\n", __func__); | ||
1858 | |||
1859 | if (state->config->set_lock_led) | ||
1860 | state->config->set_lock_led(fe, 0); | ||
1861 | |||
1862 | return 0; | ||
1863 | } | ||
1864 | |||
1845 | static int stv0900_get_frontend(struct dvb_frontend *fe, | 1865 | static int stv0900_get_frontend(struct dvb_frontend *fe, |
1846 | struct dvb_frontend_parameters *p) | 1866 | struct dvb_frontend_parameters *p) |
1847 | { | 1867 | { |
@@ -1876,6 +1896,7 @@ static struct dvb_frontend_ops stv0900_ops = { | |||
1876 | .release = stv0900_release, | 1896 | .release = stv0900_release, |
1877 | .init = stv0900_init, | 1897 | .init = stv0900_init, |
1878 | .get_frontend = stv0900_get_frontend, | 1898 | .get_frontend = stv0900_get_frontend, |
1899 | .sleep = stv0900_sleep, | ||
1879 | .get_frontend_algo = stv0900_frontend_algo, | 1900 | .get_frontend_algo = stv0900_frontend_algo, |
1880 | .i2c_gate_ctrl = stv0900_i2c_gate_ctrl, | 1901 | .i2c_gate_ctrl = stv0900_i2c_gate_ctrl, |
1881 | .diseqc_send_master_cmd = stv0900_send_master_cmd, | 1902 | .diseqc_send_master_cmd = stv0900_send_master_cmd, |