diff options
author | Fugang Duan <fugang.duan@nxp.com> | 2019-06-26 10:25:35 +0800 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2021-11-02 16:55:06 +0800 |
commit | 601a3be14406fb8ebec1c8bed53fc2b31ad1b977 (patch) | |
tree | 7d132c356edfd232e06fe7c2d671ad83ecfb7161 | |
parent | acf94e752e8dd655de7de24b5ce9f462b599673f (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>
[ Aisheng: move dt binding changes to gpio-pca95xx.yaml.
Need further fine tune the property schema ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
-rw-r--r-- | Documentation/devicetree/bindings/gpio/gpio-pca95xx.yaml | 4 | ||||
-rw-r--r-- | drivers/gpio/gpio-max732x.c | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio-pca95xx.yaml b/Documentation/devicetree/bindings/gpio/gpio-pca95xx.yaml index b6a6e742b66d..ba30fb1d6d6f 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-pca95xx.yaml +++ b/Documentation/devicetree/bindings/gpio/gpio-pca95xx.yaml @@ -94,6 +94,10 @@ properties: wakeup-source: $ref: /schemas/types.yaml#/definitions/flag + out-default: + description: + set the output IO default voltage. Exp: out-default = /bits/ 16 <mask val>; + patternProperties: "^(hog-[0-9]+|.+-hog(-[0-9]+)?)$": type: object diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 373d0ea639b1..4af7ea075fb5 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; } |