aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-08-12 21:27:08 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-13 15:00:38 -0400
commit991452a21b76e5e1bba2fcf9c024ab69067f5656 (patch)
treec38405e57166963f592f5e7f37a5a1f99e8137a8 /drivers/media/dvb/dvb-usb-v2/rtl28xxu.c
parentc01a35955fc6cbf4b36fd87c4af5691a81fcda5a (diff)
[media] rtl28xxu: generalize streaming control
Move rtl2831u LED from streaming control to power control. It changes LED behavior slightly but who cares :) After that same streaming control can be used for both rtl2831u and rtl2832u. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb-v2/rtl28xxu.c')
-rw-r--r--drivers/media/dvb/dvb-usb-v2/rtl28xxu.c44
1 files changed, 5 insertions, 39 deletions
diff --git a/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c b/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c
index 493d531109af..a2d1e5b9d9d4 100644
--- a/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/dvb/dvb-usb-v2/rtl28xxu.c
@@ -823,43 +823,7 @@ err:
823 return ret; 823 return ret;
824} 824}
825 825
826static int rtl2831u_streaming_ctrl(struct dvb_frontend *fe , int onoff) 826static int rtl28xxu_streaming_ctrl(struct dvb_frontend *fe , int onoff)
827{
828 int ret;
829 u8 buf[2], gpio;
830 struct dvb_usb_device *d = fe_to_d(fe);
831
832 dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
833
834 ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
835 if (ret)
836 goto err;
837
838 if (onoff) {
839 buf[0] = 0x00;
840 buf[1] = 0x00;
841 gpio |= 0x04; /* LED on */
842 } else {
843 buf[0] = 0x10; /* stall EPA */
844 buf[1] = 0x02; /* reset EPA */
845 gpio &= (~0x04); /* LED off */
846 }
847
848 ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
849 if (ret)
850 goto err;
851
852 ret = rtl28xx_wr_regs(d, USB_EPA_CTL, buf, 2);
853 if (ret)
854 goto err;
855
856 return ret;
857err:
858 dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
859 return ret;
860}
861
862static int rtl2832u_streaming_ctrl(struct dvb_frontend *fe , int onoff)
863{ 827{
864 int ret; 828 int ret;
865 u8 buf[2]; 829 u8 buf[2];
@@ -908,11 +872,13 @@ static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
908 if (onoff) { 872 if (onoff) {
909 gpio |= 0x01; /* GPIO0 = 1 */ 873 gpio |= 0x01; /* GPIO0 = 1 */
910 gpio &= (~0x10); /* GPIO4 = 0 */ 874 gpio &= (~0x10); /* GPIO4 = 0 */
875 gpio |= 0x04; /* GPIO2 = 1, LED on */
911 sys0 = sys0 & 0x0f; 876 sys0 = sys0 & 0x0f;
912 sys0 |= 0xe0; 877 sys0 |= 0xe0;
913 } else { 878 } else {
914 gpio &= (~0x01); /* GPIO0 = 0 */ 879 gpio &= (~0x01); /* GPIO0 = 0 */
915 gpio |= 0x10; /* GPIO4 = 1 */ 880 gpio |= 0x10; /* GPIO4 = 1 */
881 gpio &= (~0x04); /* GPIO2 = 1, LED off */
916 sys0 = sys0 & (~0xc0); 882 sys0 = sys0 & (~0xc0);
917 } 883 }
918 884
@@ -1224,7 +1190,7 @@ static const struct dvb_usb_device_properties rtl2831u_props = {
1224 .tuner_attach = rtl2831u_tuner_attach, 1190 .tuner_attach = rtl2831u_tuner_attach,
1225 .init = rtl28xxu_init, 1191 .init = rtl28xxu_init,
1226 .get_rc_config = rtl2831u_get_rc_config, 1192 .get_rc_config = rtl2831u_get_rc_config,
1227 .streaming_ctrl = rtl2831u_streaming_ctrl, 1193 .streaming_ctrl = rtl28xxu_streaming_ctrl,
1228 1194
1229 .num_adapters = 1, 1195 .num_adapters = 1,
1230 .adapter = { 1196 .adapter = {
@@ -1246,7 +1212,7 @@ static const struct dvb_usb_device_properties rtl2832u_props = {
1246 .tuner_attach = rtl2832u_tuner_attach, 1212 .tuner_attach = rtl2832u_tuner_attach,
1247 .init = rtl28xxu_init, 1213 .init = rtl28xxu_init,
1248 .get_rc_config = rtl2832u_get_rc_config, 1214 .get_rc_config = rtl2832u_get_rc_config,
1249 .streaming_ctrl = rtl2832u_streaming_ctrl, 1215 .streaming_ctrl = rtl28xxu_streaming_ctrl,
1250 1216
1251 .num_adapters = 1, 1217 .num_adapters = 1,
1252 .adapter = { 1218 .adapter = {