Commit 77a2e76b authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] rtl28xxu: use rtl2832 demod callbacks accessing its resources

Switch demod resource use from exported symbols to callbacks its
provides.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 6f5f6ee2
...@@ -782,36 +782,35 @@ static int rtl2832u_frontend_callback(void *adapter_priv, int component, ...@@ -782,36 +782,35 @@ static int rtl2832u_frontend_callback(void *adapter_priv, int component,
static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
{ {
int ret;
struct dvb_usb_device *d = adap_to_d(adap); struct dvb_usb_device *d = adap_to_d(adap);
struct rtl28xxu_priv *priv = d_to_priv(d); struct rtl28xxu_priv *priv = d_to_priv(d);
struct rtl2832_platform_data platform_data; struct rtl2832_platform_data *pdata = &priv->rtl2832_platform_data;
const struct rtl2832_config *rtl2832_config; struct i2c_board_info board_info;
struct i2c_board_info board_info = {};
struct i2c_client *client; struct i2c_client *client;
int ret;
dev_dbg(&d->udev->dev, "%s:\n", __func__); dev_dbg(&d->udev->dev, "%s:\n", __func__);
switch (priv->tuner) { switch (priv->tuner) {
case TUNER_RTL2832_FC0012: case TUNER_RTL2832_FC0012:
rtl2832_config = &rtl28xxu_rtl2832_fc0012_config; pdata->config = &rtl28xxu_rtl2832_fc0012_config;
break; break;
case TUNER_RTL2832_FC0013: case TUNER_RTL2832_FC0013:
rtl2832_config = &rtl28xxu_rtl2832_fc0013_config; pdata->config = &rtl28xxu_rtl2832_fc0013_config;
break; break;
case TUNER_RTL2832_FC2580: case TUNER_RTL2832_FC2580:
/* FIXME: do not abuse fc0012 settings */ /* FIXME: do not abuse fc0012 settings */
rtl2832_config = &rtl28xxu_rtl2832_fc0012_config; pdata->config = &rtl28xxu_rtl2832_fc0012_config;
break; break;
case TUNER_RTL2832_TUA9001: case TUNER_RTL2832_TUA9001:
rtl2832_config = &rtl28xxu_rtl2832_tua9001_config; pdata->config = &rtl28xxu_rtl2832_tua9001_config;
break; break;
case TUNER_RTL2832_E4000: case TUNER_RTL2832_E4000:
rtl2832_config = &rtl28xxu_rtl2832_e4000_config; pdata->config = &rtl28xxu_rtl2832_e4000_config;
break; break;
case TUNER_RTL2832_R820T: case TUNER_RTL2832_R820T:
case TUNER_RTL2832_R828D: case TUNER_RTL2832_R828D:
rtl2832_config = &rtl28xxu_rtl2832_r820t_config; pdata->config = &rtl28xxu_rtl2832_r820t_config;
break; break;
default: default:
dev_err(&d->udev->dev, "%s: unknown tuner=%s\n", dev_err(&d->udev->dev, "%s: unknown tuner=%s\n",
...@@ -821,11 +820,10 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -821,11 +820,10 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
} }
/* attach demodulator */ /* attach demodulator */
platform_data.config = rtl2832_config; memset(&board_info, 0, sizeof(board_info));
platform_data.dvb_frontend = &adap->fe[0];
strlcpy(board_info.type, "rtl2832", I2C_NAME_SIZE); strlcpy(board_info.type, "rtl2832", I2C_NAME_SIZE);
board_info.addr = 0x10; board_info.addr = 0x10;
board_info.platform_data = &platform_data; board_info.platform_data = pdata;
request_module("%s", board_info.type); request_module("%s", board_info.type);
client = i2c_new_device(&d->i2c_adap, &board_info); client = i2c_new_device(&d->i2c_adap, &board_info);
if (client == NULL || client->dev.driver == NULL) { if (client == NULL || client->dev.driver == NULL) {
...@@ -839,10 +837,10 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -839,10 +837,10 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
goto err; 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->i2c_client_demod = client;
priv->demod_i2c_adapter = rtl2832_get_i2c_adapter(adap->fe[0]);
/* set fe callback */ /* set fe callback */
adap->fe[0]->callback = rtl2832u_frontend_callback; adap->fe[0]->callback = rtl2832u_frontend_callback;
...@@ -1038,6 +1036,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -1038,6 +1036,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
int ret; int ret;
struct dvb_usb_device *d = adap_to_d(adap); struct dvb_usb_device *d = adap_to_d(adap);
struct rtl28xxu_priv *priv = d_to_priv(d); struct rtl28xxu_priv *priv = d_to_priv(d);
struct rtl2832_platform_data *pdata = &priv->rtl2832_platform_data;
struct dvb_frontend *fe = NULL; struct dvb_frontend *fe = NULL;
struct i2c_board_info info; struct i2c_board_info info;
struct i2c_client *client; struct i2c_client *client;
...@@ -1075,7 +1074,8 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -1075,7 +1074,8 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
case TUNER_RTL2832_E4000: { case TUNER_RTL2832_E4000: {
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
struct i2c_adapter *i2c_adap_internal = 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 = { struct e4000_config e4000_config = {
.fe = adap->fe[0], .fe = adap->fe[0],
.clock = 28800000, .clock = 28800000,
...@@ -1346,7 +1346,8 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff) ...@@ -1346,7 +1346,8 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff) static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff)
{ {
struct dvb_usb_device *d = fe_to_d(fe); 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; int ret;
u8 val; u8 val;
...@@ -1364,7 +1365,7 @@ static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff) ...@@ -1364,7 +1365,7 @@ static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff)
/* bypass slave demod TS through master demod */ /* bypass slave demod TS through master demod */
if (fe->id == 1 && onoff) { 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) if (ret)
goto err; goto err;
} }
......
...@@ -80,7 +80,10 @@ struct rtl28xxu_priv { ...@@ -80,7 +80,10 @@ struct rtl28xxu_priv {
#define SLAVE_DEMOD_MN88472 1 #define SLAVE_DEMOD_MN88472 1
#define SLAVE_DEMOD_MN88473 2 #define SLAVE_DEMOD_MN88473 2
unsigned int slave_demod:2; unsigned int slave_demod:2;
struct rtl2830_platform_data rtl2830_platform_data; union {
struct rtl2830_platform_data rtl2830_platform_data;
struct rtl2832_platform_data rtl2832_platform_data;
};
}; };
enum rtl28xxu_chip_id { enum rtl28xxu_chip_id {
......
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