summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFugang Duan <fugang.duan@nxp.com>2019-06-26 10:25:35 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:46:28 +0800
commit5d8768625f9dc1ee1b122de7b0bea2aea1be0ff5 (patch)
tree5490f8119daea68f7acc2ec8ed38500ce8146784
parent01f989853efe31ceb9182ad2d794d72e73e65b2f (diff)
MLK-19251-01 gpio: max732x: add output IO default voltage set
Add output IOs defalut voltage set in device tree by add property like: out-default = /bits/ 16 <mask val>; Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-max732x.txt1
-rw-r--r--drivers/gpio/gpio-max732x.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio-max732x.txt b/Documentation/devicetree/bindings/gpio/gpio-max732x.txt
index b3a9c0c32823..7f09979c047f 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-max732x.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-max732x.txt
@@ -31,6 +31,7 @@ Optional properties:
- first cell is the pin number
- second cell is used to specify flags
- interrupts: Interrupt specifier for the controllers interrupt.
+ - out-default: set the output IO default voltage. Exp: out-default = /bits/ 16 <mask val>;
Please refer to gpio.txt in this directory for details of the common GPIO
bindings used by client devices.
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 9d2e9258a7c1..3c72ae0bcec9 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -78,6 +78,12 @@
#define INT_CAPS(x) (((uint64_t)(x)) << 32)
enum {
+ OUTPUT_MASK,
+ OUTPUT_VAL,
+ OUTPUT_NUM,
+};
+
+enum {
MAX7319,
MAX7320,
MAX7321,
@@ -623,6 +629,8 @@ static int max732x_probe(struct i2c_client *client,
struct i2c_client *c;
uint16_t addr_a, addr_b;
int ret, nr_port;
+ u16 out_set[OUTPUT_NUM];
+ unsigned long mask, val;
pdata = dev_get_platdata(&client->dev);
node = client->dev.of_node;
@@ -716,6 +724,15 @@ static int max732x_probe(struct i2c_client *client,
}
i2c_set_clientdata(client, chip);
+
+ /* set the output IO default voltage */
+ if (!of_property_read_u16_array(node, "out-default", out_set,
+ ARRAY_SIZE(out_set))) {
+ mask = out_set[OUTPUT_MASK] & chip->dir_output;
+ val = out_set[OUTPUT_VAL];
+ max732x_gpio_set_multiple(&chip->gpio_chip, &mask, &val);
+ }
+
return 0;
}