PC954X Deselect patch.

This commit is contained in:
Jeffrey Townsend
2017-01-04 20:54:45 +00:00
parent a5b67853f0
commit 365ae2dcb9
2 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
diff -urpN a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig
--- a/drivers/i2c/muxes/Kconfig 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/i2c/muxes/Kconfig 2017-01-04 19:39:46.292811921 +0000
@@ -48,6 +48,13 @@ config I2C_MUX_PCA954x
This driver can also be built as a module. If so, the module
will be called i2c-mux-pca954x.
+config I2C_MUX_PCA954X_DESELECT_ON_EXIT
+ bool "Enable deselect-on-exit feature for PCA954X devices."
+ depends on I2C_MUX_PCA954x
+ help
+ If you say yes here you enable the deselect-on-exit feature in
+ the pca954x i2c driver.
+
config I2C_MUX_PINCTRL
tristate "pinctrl-based I2C multiplexer"
depends on PINCTRL
diff -urpN a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c 2016-11-20 01:17:41.000000000 +0000
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c 2017-01-04 19:41:03.832813604 +0000
@@ -189,6 +189,7 @@ static int pca954x_probe(struct i2c_clie
int num, force, class;
struct pca954x *data;
int ret;
+ int deselect_on_exit = 0;
if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE))
return -ENODEV;
@@ -213,6 +214,20 @@ static int pca954x_probe(struct i2c_clie
return -ENODEV;
}
+ /*
+ * Check whether we want to deselect the mux after the
+ * transaction. This can be specified in one of two ways:
+ *
+ * 1. using platform data: pdata->modes[num].deselect_on_exit
+ * 2. using the device tree property deselect_on_exit
+ */
+ if (of_find_property(client->dev.of_node, "deselect-on-exit", NULL)) {
+ deselect_on_exit = 1;
+ }
+
+#ifdef CONFIG_I2C_MUX_PCA954X_DESELECT_ON_EXIT
+ deselect_on_exit = 1;
+#endif
data->type = id->driver_data;
data->last_chan = 0; /* force the first selection */
@@ -233,7 +248,7 @@ static int pca954x_probe(struct i2c_clie
data->virt_adaps[num] =
i2c_add_mux_adapter(adap, &client->dev, client,
force, num, class, pca954x_select_chan,
- (pdata && pdata->modes[num].deselect_on_exit)
+ (pdata && pdata->modes[num].deselect_on_exit) || deselect_on_exit
? pca954x_deselect_mux : NULL);
if (data->virt_adaps[num] == NULL) {

View File

@@ -15,3 +15,4 @@ driver-igb-version-5.3.54.patch
driver-support-intel-igb-bcm5461X-phy.patch
driver-i2c-bus-intel-ismt-enable-param.patch
drivers-i2c-busses-i2c-isch-probe-param.patch
drivers-i2c-muxes-pca954x-deselect-on-exit.patch