diff options
| author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2016-11-06 15:20:32 -0500 |
|---|---|---|
| committer | Wolfram Sang <wsa@the-dreams.de> | 2016-11-10 15:12:47 -0500 |
| commit | d052db11c153cfb469f13a4121966f30ecb57c66 (patch) | |
| tree | ca66cefbf2c0327de78e4ca8dd3dad1b545b7074 | |
| parent | bc33b0ca11e3df467777a4fa7639ba488c9d4911 (diff) | |
i2c: mux: demux-pinctrl: make drivers with no pinctrl work again
Some drivers like i2c-gpio do not have dedicated pinctrl states. They
broke when error checking for pinctrl was added. Detect them now, and in
their case, simply skip over pinctrl configuration.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| -rw-r--r-- | drivers/i2c/muxes/i2c-demux-pinctrl.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c index b3893f6282ba..3e6fe1760d82 100644 --- a/drivers/i2c/muxes/i2c-demux-pinctrl.c +++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c | |||
| @@ -69,10 +69,28 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne | |||
| 69 | goto err_with_revert; | 69 | goto err_with_revert; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | p = devm_pinctrl_get_select(adap->dev.parent, priv->bus_name); | 72 | /* |
| 73 | * Check if there are pinctrl states at all. Note: we cant' use | ||
| 74 | * devm_pinctrl_get_select() because we need to distinguish between | ||
| 75 | * the -ENODEV from devm_pinctrl_get() and pinctrl_lookup_state(). | ||
| 76 | */ | ||
| 77 | p = devm_pinctrl_get(adap->dev.parent); | ||
| 73 | if (IS_ERR(p)) { | 78 | if (IS_ERR(p)) { |
| 74 | ret = PTR_ERR(p); | 79 | ret = PTR_ERR(p); |
| 75 | goto err_with_put; | 80 | /* continue if just no pinctrl states (e.g. i2c-gpio), otherwise exit */ |
| 81 | if (ret != -ENODEV) | ||
| 82 | goto err_with_put; | ||
| 83 | } else { | ||
| 84 | /* there are states. check and use them */ | ||
| 85 | struct pinctrl_state *s = pinctrl_lookup_state(p, priv->bus_name); | ||
| 86 | |||
| 87 | if (IS_ERR(s)) { | ||
| 88 | ret = PTR_ERR(s); | ||
| 89 | goto err_with_put; | ||
| 90 | } | ||
| 91 | ret = pinctrl_select_state(p, s); | ||
| 92 | if (ret < 0) | ||
| 93 | goto err_with_put; | ||
| 76 | } | 94 | } |
| 77 | 95 | ||
| 78 | priv->chan[new_chan].parent_adap = adap; | 96 | priv->chan[new_chan].parent_adap = adap; |
