diff options
author | Antti Palosaari <crope@iki.fi> | 2014-09-27 00:22:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-11-14 14:35:47 -0500 |
commit | 698f6260b886291e14706c57daec2e1560d59af5 (patch) | |
tree | 93f9176f9f5a641dc49282afda1c7ee14f7eec0b /drivers/media/usb/dvb-usb-v2 | |
parent | b936d166080cf29ca300116add30826fbfd8c0e7 (diff) |
[media] rtl28xxu: enable demod ADC only when needed
Enable integrated demod ADC only when demod is used. Keep integrated
demod ADC disabled when external demod is used. This fixes corrupted
stream in a case external demod was used.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/dvb-usb-v2')
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index 27b1e0397e71..5ea52c7616f1 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
@@ -1201,13 +1201,6 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
1201 | if (ret) | 1201 | if (ret) |
1202 | goto err; | 1202 | goto err; |
1203 | 1203 | ||
1204 | mdelay(5); | ||
1205 | |||
1206 | /* enable ADC */ | ||
1207 | ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x48, 0x48); | ||
1208 | if (ret) | ||
1209 | goto err; | ||
1210 | |||
1211 | /* streaming EP: clear stall & reset */ | 1204 | /* streaming EP: clear stall & reset */ |
1212 | ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x00\x00", 2); | 1205 | ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x00\x00", 2); |
1213 | if (ret) | 1206 | if (ret) |
@@ -1222,11 +1215,6 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
1222 | if (ret) | 1215 | if (ret) |
1223 | goto err; | 1216 | goto err; |
1224 | 1217 | ||
1225 | /* disable ADC */ | ||
1226 | ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x48); | ||
1227 | if (ret) | ||
1228 | goto err; | ||
1229 | |||
1230 | /* disable PLL */ | 1218 | /* disable PLL */ |
1231 | ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80); | 1219 | ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80); |
1232 | if (ret) | 1220 | if (ret) |
@@ -1244,6 +1232,30 @@ err: | |||
1244 | return ret; | 1232 | return ret; |
1245 | } | 1233 | } |
1246 | 1234 | ||
1235 | static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff) | ||
1236 | { | ||
1237 | struct dvb_usb_device *d = fe_to_d(fe); | ||
1238 | int ret; | ||
1239 | u8 val; | ||
1240 | |||
1241 | dev_dbg(&d->udev->dev, "%s: fe=%d onoff=%d\n", __func__, fe->id, onoff); | ||
1242 | |||
1243 | /* control internal demod ADC */ | ||
1244 | if (fe->id == 0 && onoff) | ||
1245 | val = 0x48; /* enable ADC */ | ||
1246 | else | ||
1247 | val = 0x00; /* disable ADC */ | ||
1248 | |||
1249 | ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, val, 0x48); | ||
1250 | if (ret) | ||
1251 | goto err; | ||
1252 | |||
1253 | return 0; | ||
1254 | err: | ||
1255 | dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret); | ||
1256 | return ret; | ||
1257 | } | ||
1258 | |||
1247 | #if IS_ENABLED(CONFIG_RC_CORE) | 1259 | #if IS_ENABLED(CONFIG_RC_CORE) |
1248 | static int rtl2831u_rc_query(struct dvb_usb_device *d) | 1260 | static int rtl2831u_rc_query(struct dvb_usb_device *d) |
1249 | { | 1261 | { |
@@ -1467,6 +1479,7 @@ static const struct dvb_usb_device_properties rtl2832u_props = { | |||
1467 | .size_of_priv = sizeof(struct rtl28xxu_priv), | 1479 | .size_of_priv = sizeof(struct rtl28xxu_priv), |
1468 | 1480 | ||
1469 | .power_ctrl = rtl2832u_power_ctrl, | 1481 | .power_ctrl = rtl2832u_power_ctrl, |
1482 | .frontend_ctrl = rtl2832u_frontend_ctrl, | ||
1470 | .i2c_algo = &rtl28xxu_i2c_algo, | 1483 | .i2c_algo = &rtl28xxu_i2c_algo, |
1471 | .read_config = rtl2832u_read_config, | 1484 | .read_config = rtl2832u_read_config, |
1472 | .frontend_attach = rtl2832u_frontend_attach, | 1485 | .frontend_attach = rtl2832u_frontend_attach, |