diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-02-16 00:38:44 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-03-04 14:40:10 -0300 |
commit | ea8f3c2c60f98ba1177f200574711abbb518024a (patch) | |
tree | e12b72784dfff2ba72364852cfa7fd298d329830 /drivers | |
parent | 244c0e06bfd4e5bce46914bb11b0aac7de73831e (diff) | |
download | linux-ea8f3c2c60f98ba1177f200574711abbb518024a.tar.bz2 |
[media] drx-j: Allow userspace control of LNA
Instead of just disabling the LNA every time, allow to control it from
userspace.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb-frontends/drx39xyj/drxj.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 7a28c20d2594..f48f320d7bf3 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -20683,6 +20683,46 @@ static int drx39xxj_init(struct dvb_frontend *fe) return 0; } +static int drx39xxj_set_lna(struct dvb_frontend *fe) +{ + int result; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + struct drx39xxj_state *state = fe->demodulator_priv; + struct drx_demod_instance *demod = state->demod; + struct drxj_data *ext_attr = demod->my_ext_attr; + struct drxuio_cfg uio_cfg; + struct drxuio_data uio_data; + + if (c->lna) { + if (!ext_attr->has_lna) { + pr_err("LNA is not supported on this device!\n"); + return -EINVAL; + + } + } + + /* Turn off the LNA */ + uio_cfg.uio = DRX_UIO1; + uio_cfg.mode = DRX_UIO_MODE_READWRITE; + /* Configure user-I/O #3: enable read/write */ + result = ctrl_set_uio_cfg(demod, &uio_cfg); + if (result) { + pr_err("Failed to setup LNA GPIO!\n"); + return result; + } + + uio_data.uio = DRX_UIO1; + uio_data.value = c->lna; + result = ctrl_uio_write(demod, &uio_data); + if (result != 0) { + pr_err("Failed to %sable LNA!\n", + c->lna ? "en" : "dis"); + return result; + } + + return 0; +} + static int drx39xxj_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune) { @@ -20824,6 +20864,7 @@ static struct dvb_frontend_ops drx39xxj_ops = { .read_snr = drx39xxj_read_snr, .read_ucblocks = drx39xxj_read_ucblocks, .release = drx39xxj_release, + .set_lna = drx39xxj_set_lna, }; MODULE_DESCRIPTION("Micronas DRX39xxj Frontend"); |