i2c: mux-core: add deselect property on child node
Laxman Dewangan [Fri, 10 Jan 2014 13:18:19 +0000 (18:18 +0530)]
Add deselect enable property on the child node of the
mux bus.

If child node of mux device have this property then deselect
option will be enabled.

Change-Id: I7907429e1937c8af608970c8680fe2fcea90da5a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/354255
GVS: Gerrit_Virtual_Submit

drivers/i2c/i2c-mux.c

index 7409ebb..abd7fb0 100644 (file)
@@ -122,7 +122,6 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
        priv->mux_priv = mux_priv;
        priv->chan_id = chan_id;
        priv->select = select;
-       priv->deselect = deselect;
 
        /* Need to do algo dynamically because we don't know ahead
         * of time what sort of physical adapter we'll be dealing with.
@@ -155,6 +154,7 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
         */
        if (mux_dev->of_node) {
                struct device_node *child;
+               bool enable_deselect;
                u32 reg;
 
                for_each_child_of_node(mux_dev->of_node, child) {
@@ -163,9 +163,15 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
                                continue;
                        if (chan_id == reg) {
                                priv->adap.dev.of_node = child;
+                               enable_deselect = of_property_read_bool(child,
+                                               "i2c-mux,deselect-on-exit");
+                               if (enable_deselect) 
+                                       priv->deselect = deselect;
                                break;
                        }
                }
+       } else {
+               priv->deselect = deselect;
        }
 
        if (force_nr) {