diff options
author | Andy Duan <fugang.duan@nxp.com> | 2018-08-17 17:07:06 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:33:28 +0800 |
commit | e579c94b307b3dd9dfd604b559445085e19f2acd (patch) | |
tree | 42aaa256ec803e8c732f18334079863b06b1531e /drivers/gpio | |
parent | 8212a03fcd09bc78cd3699efef2e89f76b6dc4d4 (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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-max732x.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 1f32e3f0a688..288217991d63 100644 --- a/drivers/gpio/gpio-max732x.c +++ b/drivers/gpio/gpio-max732x.c @@ -81,6 +81,12 @@ #define INT_CAPS(x) (((uint64_t)(x)) << 32) enum { + OUTPUT_MASK, + OUTPUT_VAL, + OUTPUT_NUM, +}; + +enum { MAX7319, MAX7320, MAX7321, @@ -626,6 +632,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; @@ -711,6 +719,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; out_failed: |