提交 a2f8445d 编写于 作者: M Mike Looijmans 提交者: Peter Rosin

i2c: mux: pca954x: force reset on probe if available

Instead of just hogging the reset GPIO into deactivated state, activate and
then de-activate the reset. This allows for better recovery if the CPU was
reset halfway through an I2C transaction for example.
Signed-off-by: NMike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: NPeter Rosin <peda@axentia.se>
上级 fca700d6
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
*/ */
#include <linux/device.h> #include <linux/device.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-mux.h> #include <linux/i2c-mux.h>
...@@ -389,10 +390,16 @@ static int pca954x_probe(struct i2c_client *client, ...@@ -389,10 +390,16 @@ static int pca954x_probe(struct i2c_client *client,
i2c_set_clientdata(client, muxc); i2c_set_clientdata(client, muxc);
data->client = client; data->client = client;
/* Get the mux out of reset if a reset GPIO is specified. */ /* Reset the mux if a reset GPIO is specified. */
gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(gpio)) if (IS_ERR(gpio))
return PTR_ERR(gpio); return PTR_ERR(gpio);
if (gpio) {
udelay(1);
gpiod_set_value_cansleep(gpio, 0);
/* Give the chip some time to recover. */
udelay(1);
}
match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev); match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev);
if (match) if (match)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册