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
parent
01f989853e
commit
5d8768625f
|
@ -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.
|
||||
|
|
|
@ -77,6 +77,12 @@
|
|||
|
||||
#define INT_CAPS(x) (((uint64_t)(x)) << 32)
|
||||
|
||||
enum {
|
||||
OUTPUT_MASK,
|
||||
OUTPUT_VAL,
|
||||
OUTPUT_NUM,
|
||||
};
|
||||
|
||||
enum {
|
||||
MAX7319,
|
||||
MAX7320,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue