Commit 76b91be3 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] em28xx: PCTV 461e use I2C client for demod and SEC

Use I2C client binding for demod and SEC.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 478932b1
...@@ -1521,64 +1521,94 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -1521,64 +1521,94 @@ static int em28xx_dvb_init(struct em28xx *dev)
} }
} }
break; break;
case EM28178_BOARD_PCTV_461E: case EM28178_BOARD_PCTV_461E: {
{ struct i2c_client *client;
/* demod I2C adapter */ struct i2c_adapter *i2c_adapter;
struct i2c_adapter *i2c_adapter; struct i2c_board_info board_info;
struct i2c_client *client; struct m88ds3103_platform_data m88ds3103_pdata = {};
struct i2c_board_info info; struct ts2020_config ts2020_config = {};
struct ts2020_config ts2020_config = { struct a8293_platform_data a8293_pdata = {};
};
memset(&info, 0, sizeof(struct i2c_board_info));
/* attach demod */
dvb->fe[0] = dvb_attach(m88ds3103_attach,
&pctv_461e_m88ds3103_config,
&dev->i2c_adap[dev->def_i2c_bus],
&i2c_adapter);
if (dvb->fe[0] == NULL) {
result = -ENODEV;
goto out_free;
}
/* attach tuner */
ts2020_config.fe = dvb->fe[0];
strlcpy(info.type, "ts2022", I2C_NAME_SIZE);
info.addr = 0x60;
info.platform_data = &ts2020_config;
request_module("ts2020");
client = i2c_new_device(i2c_adapter, &info);
if (client == NULL || client->dev.driver == NULL) {
dvb_frontend_detach(dvb->fe[0]);
result = -ENODEV;
goto out_free;
}
if (!try_module_get(client->dev.driver->owner)) {
i2c_unregister_device(client);
dvb_frontend_detach(dvb->fe[0]);
result = -ENODEV;
goto out_free;
}
/* delegate signal strength measurement to tuner */ /* attach demod */
dvb->fe[0]->ops.read_signal_strength = m88ds3103_pdata.clk = 27000000;
dvb->fe[0]->ops.tuner_ops.get_rf_strength; m88ds3103_pdata.i2c_wr_max = 33;
m88ds3103_pdata.ts_mode = M88DS3103_TS_PARALLEL;
m88ds3103_pdata.ts_clk = 16000;
m88ds3103_pdata.ts_clk_pol = 1;
m88ds3103_pdata.agc = 0x99;
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(&dev->i2c_adap[dev->def_i2c_bus], &board_info);
if (client == NULL || client->dev.driver == NULL) {
result = -ENODEV;
goto out_free;
}
if (!try_module_get(client->dev.driver->owner)) {
i2c_unregister_device(client);
result = -ENODEV;
goto out_free;
}
dvb->fe[0] = m88ds3103_pdata.get_dvb_frontend(client);
i2c_adapter = m88ds3103_pdata.get_i2c_adapter(client);
dvb->i2c_client_demod = client;
/* attach SEC */ /* attach tuner */
if (!dvb_attach(a8293_attach, dvb->fe[0], ts2020_config.fe = dvb->fe[0];
&dev->i2c_adap[dev->def_i2c_bus], memset(&board_info, 0, sizeof(board_info));
&em28xx_a8293_config)) { strlcpy(board_info.type, "ts2022", I2C_NAME_SIZE);
module_put(client->dev.driver->owner); board_info.addr = 0x60;
i2c_unregister_device(client); board_info.platform_data = &ts2020_config;
dvb_frontend_detach(dvb->fe[0]); request_module("ts2020");
result = -ENODEV; client = i2c_new_device(i2c_adapter, &board_info);
goto out_free; if (client == NULL || client->dev.driver == NULL) {
} module_put(dvb->i2c_client_demod->dev.driver->owner);
i2c_unregister_device(dvb->i2c_client_demod);
result = -ENODEV;
goto out_free;
}
if (!try_module_get(client->dev.driver->owner)) {
i2c_unregister_device(client);
module_put(dvb->i2c_client_demod->dev.driver->owner);
i2c_unregister_device(dvb->i2c_client_demod);
result = -ENODEV;
goto out_free;
}
dvb->i2c_client_tuner = client;
/* delegate signal strength measurement to tuner */
dvb->fe[0]->ops.read_signal_strength =
dvb->fe[0]->ops.tuner_ops.get_rf_strength;
dvb->i2c_client_tuner = client; /* attach SEC */
a8293_pdata.dvb_frontend = dvb->fe[0];
memset(&board_info, 0, sizeof(board_info));
strlcpy(board_info.type, "a8293", I2C_NAME_SIZE);
board_info.addr = 0x08;
board_info.platform_data = &a8293_pdata;
request_module("a8293");
client = i2c_new_device(&dev->i2c_adap[dev->def_i2c_bus], &board_info);
if (client == NULL || client->dev.driver == NULL) {
module_put(dvb->i2c_client_tuner->dev.driver->owner);
i2c_unregister_device(dvb->i2c_client_tuner);
module_put(dvb->i2c_client_demod->dev.driver->owner);
i2c_unregister_device(dvb->i2c_client_demod);
result = -ENODEV;
goto out_free;
}
if (!try_module_get(client->dev.driver->owner)) {
i2c_unregister_device(client);
module_put(dvb->i2c_client_tuner->dev.driver->owner);
i2c_unregister_device(dvb->i2c_client_tuner);
module_put(dvb->i2c_client_demod->dev.driver->owner);
i2c_unregister_device(dvb->i2c_client_demod);
result = -ENODEV;
goto out_free;
} }
dvb->i2c_client_sec = client;
break; break;
}
case EM28178_BOARD_PCTV_292E: case EM28178_BOARD_PCTV_292E:
{ {
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
......
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