Commit f3c6abca authored by Olli Salonen's avatar Olli Salonen Committed by Mauro Carvalho Chehab

[media] dw2102: convert TechnoTrend S2-4600 to use I2C binding for demod

Convert the TT S2-4600 USB tuner to use the I2C binding for attaching
the demodulator instead of the old m88ds3103_attach method.
Signed-off-by: default avatarOlli Salonen <olli.salonen@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 2899d35d
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
struct dw2102_state { struct dw2102_state {
u8 initialized; u8 initialized;
u8 last_lock; u8 last_lock;
struct i2c_client *i2c_client_demod;
struct i2c_client *i2c_client_tuner; struct i2c_client *i2c_client_tuner;
/* fe hook functions*/ /* fe hook functions*/
...@@ -1141,22 +1142,6 @@ static struct tda18271_config tda18271_config = { ...@@ -1141,22 +1142,6 @@ static struct tda18271_config tda18271_config = {
.gate = TDA18271_GATE_DIGITAL, .gate = TDA18271_GATE_DIGITAL,
}; };
static const struct m88ds3103_config tt_s2_4600_m88ds3103_config = {
.i2c_addr = 0x68,
.clock = 27000000,
.i2c_wr_max = 33,
.ts_mode = M88DS3103_TS_CI,
.ts_clk = 16000,
.ts_clk_pol = 0,
.spec_inv = 0,
.agc_inv = 0,
.clock_out = M88DS3103_CLOCK_OUT_ENABLED,
.envelope_mode = 0,
.agc = 0x99,
.lnb_hv_pol = 1,
.lnb_en_pol = 0,
};
static u8 m88rs2000_inittab[] = { static u8 m88rs2000_inittab[] = {
DEMOD_WRITE, 0x9a, 0x30, DEMOD_WRITE, 0x9a, 0x30,
DEMOD_WRITE, 0x00, 0x01, DEMOD_WRITE, 0x00, 0x01,
...@@ -1509,7 +1494,8 @@ static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -1509,7 +1494,8 @@ static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap)
u8 ibuf[] = { 0 }; u8 ibuf[] = { 0 };
struct i2c_adapter *i2c_adapter; struct i2c_adapter *i2c_adapter;
struct i2c_client *client; struct i2c_client *client;
struct i2c_board_info info; struct i2c_board_info board_info;
struct m88ds3103_platform_data m88ds3103_pdata = {};
struct ts2020_config ts2020_config = {}; struct ts2020_config ts2020_config = {};
if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
...@@ -1542,22 +1528,44 @@ static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -1542,22 +1528,44 @@ static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap)
if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 1, 0) < 0) if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 1, 0) < 0)
err("command 0x51 transfer failed."); err("command 0x51 transfer failed.");
memset(&info, 0, sizeof(struct i2c_board_info)); /* attach demod */
m88ds3103_pdata.clk = 27000000;
adap->fe_adap[0].fe = dvb_attach(m88ds3103_attach, m88ds3103_pdata.i2c_wr_max = 33;
&tt_s2_4600_m88ds3103_config, m88ds3103_pdata.ts_mode = M88DS3103_TS_CI;
&d->i2c_adap, m88ds3103_pdata.ts_clk = 16000;
&i2c_adapter); m88ds3103_pdata.ts_clk_pol = 0;
if (adap->fe_adap[0].fe == NULL) m88ds3103_pdata.spec_inv = 0;
m88ds3103_pdata.agc = 0x99;
m88ds3103_pdata.agc_inv = 0;
m88ds3103_pdata.clk_out = M88DS3103_CLOCK_OUT_ENABLED;
m88ds3103_pdata.envelope_mode = 0;
m88ds3103_pdata.lnb_hv_pol = 1;
m88ds3103_pdata.lnb_en_pol = 0;
memset(&board_info, 0, sizeof(board_info));
strlcpy(board_info.type, "m88ds3103", I2C_NAME_SIZE);
board_info.addr = 0x68;
board_info.platform_data = &m88ds3103_pdata;
request_module("m88ds3103");
client = i2c_new_device(&d->i2c_adap, &board_info);
if (client == NULL || client->dev.driver == NULL)
return -ENODEV; return -ENODEV;
if (!try_module_get(client->dev.driver->owner)) {
i2c_unregister_device(client);
return -ENODEV;
}
adap->fe_adap[0].fe = m88ds3103_pdata.get_dvb_frontend(client);
i2c_adapter = m88ds3103_pdata.get_i2c_adapter(client);
state->i2c_client_demod = client;
/* attach tuner */ /* attach tuner */
ts2020_config.fe = adap->fe_adap[0].fe; ts2020_config.fe = adap->fe_adap[0].fe;
strlcpy(info.type, "ts2022", I2C_NAME_SIZE); memset(&board_info, 0, sizeof(board_info));
info.addr = 0x60; strlcpy(board_info.type, "ts2022", I2C_NAME_SIZE);
info.platform_data = &ts2020_config; board_info.addr = 0x60;
board_info.platform_data = &ts2020_config;
request_module("ts2020"); request_module("ts2020");
client = i2c_new_device(i2c_adapter, &info); client = i2c_new_device(i2c_adapter, &board_info);
if (client == NULL || client->dev.driver == NULL) { if (client == NULL || client->dev.driver == NULL) {
dvb_frontend_detach(adap->fe_adap[0].fe); dvb_frontend_detach(adap->fe_adap[0].fe);
...@@ -2350,6 +2358,13 @@ static void dw2102_disconnect(struct usb_interface *intf) ...@@ -2350,6 +2358,13 @@ static void dw2102_disconnect(struct usb_interface *intf)
i2c_unregister_device(client); i2c_unregister_device(client);
} }
/* remove I2C client for demodulator */
client = st->i2c_client_demod;
if (client) {
module_put(client->dev.driver->owner);
i2c_unregister_device(client);
}
dvb_usb_device_exit(intf); dvb_usb_device_exit(intf);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment