diff options
author | Antti Palosaari <crope@iki.fi> | 2014-08-28 02:07:08 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-21 18:25:44 -0300 |
commit | 3d2f18d34692a413fcd75f5e83fc1dcb7afac13c (patch) | |
tree | ce81e32d0cce9f29c08f0c7ec2dfe3d7920b2157 /drivers/media/tuners/it913x.c | |
parent | b7413c800fa7566696f1209207a90d014f548dac (diff) |
[media] it913x: get rid of script loader and and private header file
Used script loader is quite useless and hides register numbers
making code hard to understand. Get rid of it and use standard
RegMap register write functions directly.
it913x_priv.h file leaves empty after that change and is also
removed.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/tuners/it913x.c')
-rw-r--r-- | drivers/media/tuners/it913x.c | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/drivers/media/tuners/it913x.c b/drivers/media/tuners/it913x.c index ab386bf01daf..924f18d95ba4 100644 --- a/drivers/media/tuners/it913x.c +++ b/drivers/media/tuners/it913x.c @@ -20,7 +20,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.= */ -#include "it913x_priv.h" +#include "it913x.h" +#include <linux/regmap.h> struct it913x_dev { struct i2c_client *client; @@ -34,25 +35,6 @@ struct it913x_dev { u32 tun_fn_min; }; -static int it913x_script_loader(struct it913x_dev *dev, - struct it913xset *loadscript) -{ - int ret, i; - - if (loadscript == NULL) - return -EINVAL; - - for (i = 0; i < 1000; ++i) { - if (loadscript[i].address == 0x000000) - break; - ret = regmap_bulk_write(dev->regmap, loadscript[i].address, - loadscript[i].reg, loadscript[i].count); - if (ret < 0) - return -ENODEV; - } - return 0; -} - static int it913x_init(struct dvb_frontend *fe) { struct it913x_dev *dev = fe->tuner_priv; @@ -181,7 +163,6 @@ err: static int it9137_set_params(struct dvb_frontend *fe) { struct it913x_dev *dev = fe->tuner_priv; - struct it913xset *set_tuner = set_it9135_template; struct dtv_frontend_properties *p = &fe->dtv_property_cache; u32 bandwidth = p->bandwidth_hz; u32 frequency_m = p->frequency; @@ -231,7 +212,10 @@ static int it9137_set_params(struct dvb_frontend *fe) lna_band = 1; } else return -EINVAL; - set_tuner[0].reg[0] = lna_band; + + ret = regmap_write(dev->regmap, 0x80ee06, lna_band); + if (ret) + goto err; switch (bandwidth) { case 5000000: @@ -249,8 +233,13 @@ static int it9137_set_params(struct dvb_frontend *fe) break; } - set_tuner[1].reg[0] = bw; - set_tuner[2].reg[0] = 0xa0 | (l_band << 3); + ret = regmap_write(dev->regmap, 0x80ec56, bw); + if (ret) + goto err; + + ret = regmap_write(dev->regmap, 0x80ec4c, 0xa0 | (l_band << 3)); + if (ret) + goto err; if (frequency > 53000 && frequency <= 74000) { n_div = 48; @@ -309,20 +298,30 @@ static int it9137_set_params(struct dvb_frontend *fe) /* Frequency OMEGA_IQIK_M_CAL_MID*/ temp_f = freq + (u32)iqik_m_cal; - set_tuner[3].reg[0] = temp_f & 0xff; - set_tuner[4].reg[0] = (temp_f >> 8) & 0xff; + ret = regmap_write(dev->regmap, 0x80ec4d, temp_f & 0xff); + if (ret) + goto err; + + ret = regmap_write(dev->regmap, 0x80ec4e, (temp_f >> 8) & 0xff); + if (ret) + goto err; dev_dbg(&dev->client->dev, "High Frequency = %04x\n", temp_f); /* Lower frequency */ - set_tuner[5].reg[0] = freq & 0xff; - set_tuner[6].reg[0] = (freq >> 8) & 0xff; - - dev_dbg(&dev->client->dev, "low Frequency = %04x\n", freq); + ret = regmap_write(dev->regmap, 0x80011e, freq & 0xff); + if (ret) + goto err; - ret = it913x_script_loader(dev, set_tuner); + ret = regmap_write(dev->regmap, 0x80011f, (freq >> 8) & 0xff); + if (ret) + goto err; - return (ret < 0) ? -ENODEV : 0; + dev_dbg(&dev->client->dev, "low Frequency = %04x\n", freq); + return 0; +err: + dev_dbg(&dev->client->dev, "failed %d\n", ret); + return ret; } static const struct dvb_tuner_ops it913x_tuner_ops = { |