1
0
Fork 0

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>
5.4-rM2-2.2.x-imx-squashed
Fugang Duan 2019-06-26 10:25:35 +08:00 committed by Dong Aisheng
parent 01f989853e
commit 5d8768625f
2 changed files with 18 additions and 0 deletions

View File

@ -31,6 +31,7 @@ Optional properties:
- first cell is the pin number - first cell is the pin number
- second cell is used to specify flags - second cell is used to specify flags
- interrupts: Interrupt specifier for the controllers interrupt. - 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 Please refer to gpio.txt in this directory for details of the common GPIO
bindings used by client devices. bindings used by client devices.

View File

@ -77,6 +77,12 @@
#define INT_CAPS(x) (((uint64_t)(x)) << 32) #define INT_CAPS(x) (((uint64_t)(x)) << 32)
enum {
OUTPUT_MASK,
OUTPUT_VAL,
OUTPUT_NUM,
};
enum { enum {
MAX7319, MAX7319,
MAX7320, MAX7320,
@ -623,6 +629,8 @@ static int max732x_probe(struct i2c_client *client,
struct i2c_client *c; struct i2c_client *c;
uint16_t addr_a, addr_b; uint16_t addr_a, addr_b;
int ret, nr_port; int ret, nr_port;
u16 out_set[OUTPUT_NUM];
unsigned long mask, val;
pdata = dev_get_platdata(&client->dev); pdata = dev_get_platdata(&client->dev);
node = client->dev.of_node; node = client->dev.of_node;
@ -716,6 +724,15 @@ static int max732x_probe(struct i2c_client *client,
} }
i2c_set_clientdata(client, chip); 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; return 0;
} }