aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-01-21 20:40:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-02-28 16:44:25 -0500
commita8567cf22e0efb9faafa6cf33b607ca5aee3c2fa (patch)
tree158208995684ed035053db50970530b3f8c47299
parent9935eea5ac300b84036192af1bd98940a64650de (diff)
[media] rtl2830: prevent .read_status() when sleeping
Hardware is not accessible when device is sleeping. Preventing such IOCTLs when sleep should be job of DVB CORE... Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb/dvb-usb/rtl28xxu.c5
-rw-r--r--drivers/media/dvb/frontends/rtl2830.c15
-rw-r--r--drivers/media/dvb/frontends/rtl2830_priv.h2
3 files changed, 17 insertions, 5 deletions
diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c b/drivers/media/dvb/dvb-usb/rtl28xxu.c
index b5785fa36220..07597c53d07b 100644
--- a/drivers/media/dvb/dvb-usb/rtl28xxu.c
+++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c
@@ -608,11 +608,6 @@ static int rtl28xxu_power_ctrl(struct dvb_usb_device *d, int onoff)
608 sys0 = sys0 & 0x0f; 608 sys0 = sys0 & 0x0f;
609 sys0 |= 0xe0; 609 sys0 |= 0xe0;
610 } else { 610 } else {
611 /*
612 * FIXME: Use .fe_ioctl_override() to prevent demod
613 * IOCTLs in case of device is powered off. Or change
614 * RTL2830 demod not perform requestesd IOCTL & IO when sleep.
615 */
616 gpio &= (~0x01); /* GPIO0 = 0 */ 611 gpio &= (~0x01); /* GPIO0 = 0 */
617 gpio |= 0x10; /* GPIO4 = 1 */ 612 gpio |= 0x10; /* GPIO4 = 1 */
618 sys0 = sys0 & (~0xc0); 613 sys0 = sys0 & (~0xc0);
diff --git a/drivers/media/dvb/frontends/rtl2830.c b/drivers/media/dvb/frontends/rtl2830.c
index f036701c12ee..f971d949b2af 100644
--- a/drivers/media/dvb/frontends/rtl2830.c
+++ b/drivers/media/dvb/frontends/rtl2830.c
@@ -273,12 +273,21 @@ static int rtl2830_init(struct dvb_frontend *fe)
273 if (ret) 273 if (ret)
274 goto err; 274 goto err;
275 275
276 priv->sleeping = false;
277
276 return ret; 278 return ret;
277err: 279err:
278 dbg("%s: failed=%d", __func__, ret); 280 dbg("%s: failed=%d", __func__, ret);
279 return ret; 281 return ret;
280} 282}
281 283
284static int rtl2830_sleep(struct dvb_frontend *fe)
285{
286 struct rtl2830_priv *priv = fe->demodulator_priv;
287 priv->sleeping = true;
288 return 0;
289}
290
282int rtl2830_get_tune_settings(struct dvb_frontend *fe, 291int rtl2830_get_tune_settings(struct dvb_frontend *fe,
283 struct dvb_frontend_tune_settings *s) 292 struct dvb_frontend_tune_settings *s)
284{ 293{
@@ -372,6 +381,9 @@ static int rtl2830_read_status(struct dvb_frontend *fe, fe_status_t *status)
372 u8 tmp; 381 u8 tmp;
373 *status = 0; 382 *status = 0;
374 383
384 if (priv->sleeping)
385 return 0;
386
375 ret = rtl2830_rd_reg_mask(priv, 0x351, &tmp, 0x78); /* [6:3] */ 387 ret = rtl2830_rd_reg_mask(priv, 0x351, &tmp, 0x78); /* [6:3] */
376 if (ret) 388 if (ret)
377 goto err; 389 goto err;
@@ -498,6 +510,8 @@ struct dvb_frontend *rtl2830_attach(const struct rtl2830_config *cfg,
498 goto err; 510 goto err;
499 } 511 }
500 512
513 priv->sleeping = true;
514
501 return &priv->fe; 515 return &priv->fe;
502err: 516err:
503 dbg("%s: failed=%d", __func__, ret); 517 dbg("%s: failed=%d", __func__, ret);
@@ -530,6 +544,7 @@ static struct dvb_frontend_ops rtl2830_ops = {
530 .release = rtl2830_release, 544 .release = rtl2830_release,
531 545
532 .init = rtl2830_init, 546 .init = rtl2830_init,
547 .sleep = rtl2830_sleep,
533 548
534 .get_tune_settings = rtl2830_get_tune_settings, 549 .get_tune_settings = rtl2830_get_tune_settings,
535 550
diff --git a/drivers/media/dvb/frontends/rtl2830_priv.h b/drivers/media/dvb/frontends/rtl2830_priv.h
index 49de01dd5e83..4a464761b5b8 100644
--- a/drivers/media/dvb/frontends/rtl2830_priv.h
+++ b/drivers/media/dvb/frontends/rtl2830_priv.h
@@ -43,6 +43,8 @@ struct rtl2830_priv {
43 struct rtl2830_config cfg; 43 struct rtl2830_config cfg;
44 struct i2c_adapter tuner_i2c_adapter; 44 struct i2c_adapter tuner_i2c_adapter;
45 45
46 bool sleeping;
47
46 u8 page; /* active register page */ 48 u8 page; /* active register page */
47}; 49};
48 50