diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2016-07-26 04:09:06 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-22 12:55:49 -0300 |
commit | 81fd533a972a28f43b080fe7fdc473dac3e988c6 (patch) | |
tree | 9eef607c2ad86f49f4d8370c99bc9b1531e23b12 /drivers/media | |
parent | 773028fefcede683f68d138e5ead3d2e96b32387 (diff) | |
download | linux-81fd533a972a28f43b080fe7fdc473dac3e988c6.tar.bz2 |
[media] si2165: Remove legacy attach
Now that all users of legacy attach are converted it can be removed.
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb-frontends/si2165.c | 117 | ||||
-rw-r--r-- | drivers/media/dvb-frontends/si2165.h | 31 | ||||
-rw-r--r-- | drivers/media/dvb-frontends/si2165_priv.h | 17 |
3 files changed, 17 insertions, 148 deletions
diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 55127d4cb747..5f8081c222b9 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -1011,14 +1011,6 @@ static int si2165_set_frontend(struct dvb_frontend *fe) return 0; } -static void si2165_release(struct dvb_frontend *fe) -{ - struct si2165_state *state = fe->demodulator_priv; - - dprintk("%s: called\n", __func__); - kfree(state); -} - static struct dvb_frontend_ops si2165_ops = { .info = { .name = "Silicon Labs ", @@ -1054,117 +1046,8 @@ static struct dvb_frontend_ops si2165_ops = { .set_frontend = si2165_set_frontend, .read_status = si2165_read_status, - - .release = si2165_release, }; -struct dvb_frontend *si2165_attach(const struct si2165_config *config, - struct i2c_adapter *i2c) -{ - struct si2165_state *state = NULL; - int n; - int io_ret; - u8 val; - char rev_char; - const char *chip_name; - - if (config == NULL || i2c == NULL) - goto error; - - /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct si2165_state), GFP_KERNEL); - if (state == NULL) - goto error; - - /* setup the state */ - state->i2c = i2c; - state->config = *config; - - if (state->config.ref_freq_Hz < 4000000 - || state->config.ref_freq_Hz > 27000000) { - dev_err(&state->i2c->dev, "%s: ref_freq of %d Hz not supported by this driver\n", - KBUILD_MODNAME, state->config.ref_freq_Hz); - goto error; - } - - /* create dvb_frontend */ - memcpy(&state->fe.ops, &si2165_ops, - sizeof(struct dvb_frontend_ops)); - state->fe.demodulator_priv = state; - - /* powerup */ - io_ret = si2165_writereg8(state, 0x0000, state->config.chip_mode); - if (io_ret < 0) - goto error; - - io_ret = si2165_readreg8(state, 0x0000, &val); - if (io_ret < 0) - goto error; - if (val != state->config.chip_mode) - goto error; - - io_ret = si2165_readreg8(state, 0x0023, &state->chip_revcode); - if (io_ret < 0) - goto error; - - io_ret = si2165_readreg8(state, 0x0118, &state->chip_type); - if (io_ret < 0) - goto error; - - /* powerdown */ - io_ret = si2165_writereg8(state, 0x0000, SI2165_MODE_OFF); - if (io_ret < 0) - goto error; - - if (state->chip_revcode < 26) - rev_char = 'A' + state->chip_revcode; - else - rev_char = '?'; - - switch (state->chip_type) { - case 0x06: - chip_name = "Si2161"; - state->has_dvbt = true; - break; - case 0x07: - chip_name = "Si2165"; - state->has_dvbt = true; - state->has_dvbc = true; - break; - default: - dev_err(&state->i2c->dev, "%s: Unsupported Silicon Labs chip (type %d, rev %d)\n", - KBUILD_MODNAME, state->chip_type, state->chip_revcode); - goto error; - } - - dev_info(&state->i2c->dev, - "%s: Detected Silicon Labs %s-%c (type %d, rev %d)\n", - KBUILD_MODNAME, chip_name, rev_char, state->chip_type, - state->chip_revcode); - - strlcat(state->fe.ops.info.name, chip_name, - sizeof(state->fe.ops.info.name)); - - n = 0; - if (state->has_dvbt) { - state->fe.ops.delsys[n++] = SYS_DVBT; - strlcat(state->fe.ops.info.name, " DVB-T", - sizeof(state->fe.ops.info.name)); - } - if (state->has_dvbc) { - state->fe.ops.delsys[n++] = SYS_DVBC_ANNEX_A; - strlcat(state->fe.ops.info.name, " DVB-C", - sizeof(state->fe.ops.info.name)); - } - - return &state->fe; - -error: - kfree(state); - return NULL; -} -EXPORT_SYMBOL(si2165_attach); - static int si2165_probe(struct i2c_client *client, const struct i2c_device_id *id) { diff --git a/drivers/media/dvb-frontends/si2165.h b/drivers/media/dvb-frontends/si2165.h index abbebc9edf0c..76c2ca7d7edb 100644 --- a/drivers/media/dvb-frontends/si2165.h +++ b/drivers/media/dvb-frontends/si2165.h @@ -50,35 +50,4 @@ struct si2165_platform_data { bool inversion; }; -struct si2165_config { - /* i2c addr - * possible values: 0x64,0x65,0x66,0x67 */ - u8 i2c_addr; - - /* external clock or XTAL */ - u8 chip_mode; - - /* frequency of external clock or xtal in Hz - * possible values: 4000000, 16000000, 20000000, 240000000, 27000000 - */ - u32 ref_freq_Hz; - - /* invert the spectrum */ - bool inversion; -}; - -#if IS_REACHABLE(CONFIG_DVB_SI2165) -struct dvb_frontend *si2165_attach( - const struct si2165_config *config, - struct i2c_adapter *i2c); -#else -static inline struct dvb_frontend *si2165_attach( - const struct si2165_config *config, - struct i2c_adapter *i2c) -{ - pr_warn("%s: driver disabled by Kconfig\n", __func__); - return NULL; -} -#endif /* CONFIG_DVB_SI2165 */ - #endif /* _DVB_SI2165_H */ diff --git a/drivers/media/dvb-frontends/si2165_priv.h b/drivers/media/dvb-frontends/si2165_priv.h index 2b70cf12cd79..e5932118834b 100644 --- a/drivers/media/dvb-frontends/si2165_priv.h +++ b/drivers/media/dvb-frontends/si2165_priv.h @@ -20,4 +20,21 @@ #define SI2165_FIRMWARE_REV_D "dvb-demod-si2165.fw" +struct si2165_config { + /* i2c addr + * possible values: 0x64,0x65,0x66,0x67 */ + u8 i2c_addr; + + /* external clock or XTAL */ + u8 chip_mode; + + /* frequency of external clock or xtal in Hz + * possible values: 4000000, 16000000, 20000000, 240000000, 27000000 + */ + u32 ref_freq_Hz; + + /* invert the spectrum */ + bool inversion; +}; + #endif /* _DVB_SI2165_PRIV */ |