]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
[media] si2168: convert to use an explicit i2c mux core
authorPeter Rosin <peda@axentia.se>
Wed, 20 Apr 2016 06:41:36 +0000 (08:41 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Fri, 22 Apr 2016 13:00:16 +0000 (15:00 +0200)
Allocate an explicit i2c mux core to handle parent and child adapters
etc. Update the select/deselect ops to be in terms of the i2c mux core
instead of the child adapter.

Tested-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/media/dvb-frontends/si2168.c
drivers/media/dvb-frontends/si2168_priv.h

index 821a8f481507a14ec3857c66cd7c4744a6ac3efd..5583827c386e863ad151e8464de212368a4d4d31 100644 (file)
@@ -615,9 +615,9 @@ static int si2168_get_tune_settings(struct dvb_frontend *fe,
  * We must use unlocked I2C I/O because I2C adapter lock is already taken
  * by the caller (usually tuner driver).
  */
-static int si2168_select(struct i2c_adapter *adap, void *mux_priv, u32 chan)
+static int si2168_select(struct i2c_mux_core *muxc, u32 chan)
 {
-       struct i2c_client *client = mux_priv;
+       struct i2c_client *client = i2c_mux_priv(muxc);
        int ret;
        struct si2168_cmd cmd;
 
@@ -635,9 +635,9 @@ err:
        return ret;
 }
 
-static int si2168_deselect(struct i2c_adapter *adap, void *mux_priv, u32 chan)
+static int si2168_deselect(struct i2c_mux_core *muxc, u32 chan)
 {
-       struct i2c_client *client = mux_priv;
+       struct i2c_client *client = i2c_mux_priv(muxc);
        int ret;
        struct si2168_cmd cmd;
 
@@ -709,17 +709,22 @@ static int si2168_probe(struct i2c_client *client,
        }
 
        /* create mux i2c adapter for tuner */
-       dev->adapter = i2c_add_mux_adapter(client->adapter, &client->dev,
-                       client, 0, 0, 0, si2168_select, si2168_deselect);
-       if (dev->adapter == NULL) {
-               ret = -ENODEV;
+       dev->muxc = i2c_mux_alloc(client->adapter, &client->dev,
+                                 1, 0, 0,
+                                 si2168_select, si2168_deselect);
+       if (!dev->muxc) {
+               ret = -ENOMEM;
                goto err_kfree;
        }
+       dev->muxc->priv = client;
+       ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0);
+       if (ret)
+               goto err_kfree;
 
        /* create dvb_frontend */
        memcpy(&dev->fe.ops, &si2168_ops, sizeof(struct dvb_frontend_ops));
        dev->fe.demodulator_priv = client;
-       *config->i2c_adapter = dev->adapter;
+       *config->i2c_adapter = dev->muxc->adapter[0];
        *config->fe = &dev->fe;
        dev->ts_mode = config->ts_mode;
        dev->ts_clock_inv = config->ts_clock_inv;
@@ -743,7 +748,7 @@ static int si2168_remove(struct i2c_client *client)
 
        dev_dbg(&client->dev, "\n");
 
-       i2c_del_mux_adapter(dev->adapter);
+       i2c_mux_del_adapters(dev->muxc);
 
        dev->fe.ops.release = NULL;
        dev->fe.demodulator_priv = NULL;
index c07e6fe2cb1018c3baa71dd5e7100679744e01c5..165bf141206304102cac2b45b3a849be72c2a1c6 100644 (file)
@@ -29,7 +29,7 @@
 
 /* state struct */
 struct si2168_dev {
-       struct i2c_adapter *adapter;
+       struct i2c_mux_core *muxc;
        struct dvb_frontend fe;
        enum fe_delivery_system delivery_system;
        enum fe_status fe_status;