Commit graph

4 commits

Author SHA1 Message Date
Srinivas Kandagatla
dbec64b11c gpio: wcd934x: Fix shift-out-of-bounds error
bit-mask for pins 0 to 4 is BIT(0) to BIT(4) however we ended up with BIT(n - 1)
which is not right, and this was caught by below usban check

UBSAN: shift-out-of-bounds in drivers/gpio/gpio-wcd934x.c:34:14

Fixes: 59c3246834 ("gpio: wcd934x: Add support to wcd934x gpio controller")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2021-05-27 09:51:35 +02:00
Axel Lin
47203198ed gpio: wcd934x: Fix logic of wcd_gpio_get
The check with register value and mask should be & rather than &&.
While at it, also use "unsigned int" for value variable because
regmap_read() takes unsigned int *val argument.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-02-10 10:50:58 +01:00
Axel Lin
47d7d11666 gpio: wcd934x: Don't change gpio direction in wcd_gpio_set
The .set callback should just set output value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-02-10 10:50:58 +01:00
Srinivas Kandagatla
59c3246834 gpio: wcd934x: Add support to wcd934x gpio controller
This patch adds support to wcd934x gpio block found in
WCD9340/WC9341 Audio codecs.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200107130844.20763-3-srinivas.kandagatla@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-01-15 14:42:34 +01:00