static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
{
- int ret;
struct dvb_usb_device *d = adap_to_d(adap);
struct rtl28xxu_priv *priv = d_to_priv(d);
- struct rtl2832_platform_data platform_data;
- const struct rtl2832_config *rtl2832_config;
- struct i2c_board_info board_info = {};
+ struct rtl2832_platform_data *pdata = &priv->rtl2832_platform_data;
+ struct i2c_board_info board_info;
struct i2c_client *client;
+ int ret;
dev_dbg(&d->udev->dev, "%s:\n", __func__);
switch (priv->tuner) {
case TUNER_RTL2832_FC0012:
- rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
+ pdata->config = &rtl28xxu_rtl2832_fc0012_config;
break;
case TUNER_RTL2832_FC0013:
- rtl2832_config = &rtl28xxu_rtl2832_fc0013_config;
+ pdata->config = &rtl28xxu_rtl2832_fc0013_config;
break;
case TUNER_RTL2832_FC2580:
/* FIXME: do not abuse fc0012 settings */
- rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
+ pdata->config = &rtl28xxu_rtl2832_fc0012_config;
break;
case TUNER_RTL2832_TUA9001:
- rtl2832_config = &rtl28xxu_rtl2832_tua9001_config;
+ pdata->config = &rtl28xxu_rtl2832_tua9001_config;
break;
case TUNER_RTL2832_E4000:
- rtl2832_config = &rtl28xxu_rtl2832_e4000_config;
+ pdata->config = &rtl28xxu_rtl2832_e4000_config;
break;
case TUNER_RTL2832_R820T:
case TUNER_RTL2832_R828D:
- rtl2832_config = &rtl28xxu_rtl2832_r820t_config;
+ pdata->config = &rtl28xxu_rtl2832_r820t_config;
break;
default:
dev_err(&d->udev->dev, "%s: unknown tuner=%s\n",
}
/* attach demodulator */
- platform_data.config = rtl2832_config;
- platform_data.dvb_frontend = &adap->fe[0];
+ memset(&board_info, 0, sizeof(board_info));
strlcpy(board_info.type, "rtl2832", I2C_NAME_SIZE);
board_info.addr = 0x10;
- board_info.platform_data = &platform_data;
+ board_info.platform_data = pdata;
request_module("%s", board_info.type);
client = i2c_new_device(&d->i2c_adap, &board_info);
if (client == NULL || client->dev.driver == NULL) {
goto err;
}
- priv->i2c_client_demod = client;
+ adap->fe[0] = pdata->get_dvb_frontend(client);
+ priv->demod_i2c_adapter = pdata->get_i2c_adapter(client);
- /* RTL2832 I2C repeater */
- priv->demod_i2c_adapter = rtl2832_get_i2c_adapter(adap->fe[0]);
+ priv->i2c_client_demod = client;
/* set fe callback */
adap->fe[0]->callback = rtl2832u_frontend_callback;
int ret;
struct dvb_usb_device *d = adap_to_d(adap);
struct rtl28xxu_priv *priv = d_to_priv(d);
+ struct rtl2832_platform_data *pdata = &priv->rtl2832_platform_data;
struct dvb_frontend *fe = NULL;
struct i2c_board_info info;
struct i2c_client *client;
case TUNER_RTL2832_E4000: {
struct v4l2_subdev *sd;
struct i2c_adapter *i2c_adap_internal =
- rtl2832_get_private_i2c_adapter(adap->fe[0]);
+ pdata->get_private_i2c_adapter(priv->i2c_client_demod);
+
struct e4000_config e4000_config = {
.fe = adap->fe[0],
.clock = 28800000,
static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff)
{
struct dvb_usb_device *d = fe_to_d(fe);
- struct dvb_usb_adapter *adap = fe_to_adap(fe);
+ struct rtl28xxu_priv *priv = fe_to_priv(fe);
+ struct rtl2832_platform_data *pdata = &priv->rtl2832_platform_data;
int ret;
u8 val;
/* bypass slave demod TS through master demod */
if (fe->id == 1 && onoff) {
- ret = rtl2832_enable_external_ts_if(adap->fe[0]);
+ ret = pdata->enable_slave_ts(priv->i2c_client_demod);
if (ret)
goto err;
}