Commit 0d117901 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] rtl2832: remove internal mux I2C adapter

There was 2 muxed I2C adapters, one for demod tuner bus and one for
internal use. Idea of internal I2C adapter was to force I2C repeater
close when demod access its registers. Driver has also delayed work
queue based method to close I2C repeater.

After regmap conversion internal I2C adapter based repeater close
left unused - only work queue method was in use. We could not use
internal mux adapter method with regmap as it makes recursive regmap
call, which causes deadlock as regmap has own locking. Due to that
remove whole method totally.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent d5eec231
...@@ -868,15 +868,10 @@ static int rtl2832_select(struct i2c_adapter *adap, void *mux_priv, u32 chan_id) ...@@ -868,15 +868,10 @@ static int rtl2832_select(struct i2c_adapter *adap, void *mux_priv, u32 chan_id)
cancel_delayed_work(&dev->i2c_gate_work); cancel_delayed_work(&dev->i2c_gate_work);
/* /*
* chan_id 1 is muxed adapter demod provides and chan_id 0 is demod
* itself. We need open gate when request is for chan_id 1. On that case
* I2C adapter lock is already taken and due to that we will use * I2C adapter lock is already taken and due to that we will use
* regmap_update_bits() which does not lock again I2C adapter. * regmap_update_bits() which does not lock again I2C adapter.
*/ */
if (chan_id == 1) ret = regmap_update_bits(dev->regmap, 0x101, 0x08, 0x08);
ret = regmap_update_bits(dev->regmap, 0x101, 0x08, 0x08);
else
ret = rtl2832_update_bits(dev->client, 0x101, 0x08, 0x00);
if (ret) if (ret)
goto err; goto err;
...@@ -1224,25 +1219,18 @@ static int rtl2832_probe(struct i2c_client *client, ...@@ -1224,25 +1219,18 @@ static int rtl2832_probe(struct i2c_client *client,
ret = PTR_ERR(dev->regmap); ret = PTR_ERR(dev->regmap);
goto err_kfree; goto err_kfree;
} }
/* create muxed i2c adapter for demod itself */
dev->i2c_adapter = i2c_add_mux_adapter(i2c, &i2c->dev, dev, 0, 0, 0,
rtl2832_select, NULL);
if (dev->i2c_adapter == NULL) {
ret = -ENODEV;
goto err_regmap_exit;
}
/* check if the demod is there */ /* check if the demod is there */
ret = rtl2832_bulk_read(client, 0x000, &tmp, 1); ret = rtl2832_bulk_read(client, 0x000, &tmp, 1);
if (ret) if (ret)
goto err_i2c_del_mux_adapter; goto err_regmap_exit;
/* create muxed i2c adapter for demod tuner bus */ /* create muxed i2c adapter for demod tuner bus */
dev->i2c_adapter_tuner = i2c_add_mux_adapter(i2c, &i2c->dev, dev, dev->i2c_adapter_tuner = i2c_add_mux_adapter(i2c, &i2c->dev, dev,
0, 1, 0, rtl2832_select, rtl2832_deselect); 0, 0, 0, rtl2832_select, rtl2832_deselect);
if (dev->i2c_adapter_tuner == NULL) { if (dev->i2c_adapter_tuner == NULL) {
ret = -ENODEV; ret = -ENODEV;
goto err_i2c_del_mux_adapter; goto err_regmap_exit;
} }
/* create dvb_frontend */ /* create dvb_frontend */
...@@ -1261,8 +1249,6 @@ static int rtl2832_probe(struct i2c_client *client, ...@@ -1261,8 +1249,6 @@ static int rtl2832_probe(struct i2c_client *client,
dev_info(&client->dev, "Realtek RTL2832 successfully attached\n"); dev_info(&client->dev, "Realtek RTL2832 successfully attached\n");
return 0; return 0;
err_i2c_del_mux_adapter:
i2c_del_mux_adapter(dev->i2c_adapter);
err_regmap_exit: err_regmap_exit:
regmap_exit(dev->regmap); regmap_exit(dev->regmap);
err_kfree: err_kfree:
...@@ -1282,8 +1268,6 @@ static int rtl2832_remove(struct i2c_client *client) ...@@ -1282,8 +1268,6 @@ static int rtl2832_remove(struct i2c_client *client)
i2c_del_mux_adapter(dev->i2c_adapter_tuner); i2c_del_mux_adapter(dev->i2c_adapter_tuner);
i2c_del_mux_adapter(dev->i2c_adapter);
regmap_exit(dev->regmap); regmap_exit(dev->regmap);
kfree(dev); kfree(dev);
......
...@@ -34,7 +34,6 @@ struct rtl2832_dev { ...@@ -34,7 +34,6 @@ struct rtl2832_dev {
struct rtl2832_platform_data *pdata; struct rtl2832_platform_data *pdata;
struct i2c_client *client; struct i2c_client *client;
struct regmap *regmap; struct regmap *regmap;
struct i2c_adapter *i2c_adapter;
struct i2c_adapter *i2c_adapter_tuner; struct i2c_adapter *i2c_adapter_tuner;
struct dvb_frontend fe; struct dvb_frontend fe;
struct delayed_work stat_work; struct delayed_work stat_work;
......
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