[PATCH v1] drivers/gpio: add support for MAX7320 i2c i/o expander

Hannes Schmelzer hannes at schmelzer.or.at
Fri Oct 1 21:15:16 CEST 2021


Am 01.10.2021 um 15:52 schrieb Tom Rini:
> On Fri, Oct 01, 2021 at 01:37:57PM +0200, Hannes Schmelzer wrote:
>
>> This commit adds support for the MAX7320 (and clones) gpio expander.
>>
>> Signed-off-by: Hannes Schmelzer <hannes.schmelzer at br-automation.com>
>> ---
>>
>>   doc/device-tree-bindings/gpio/gpio-max7320.txt |  36 ++++++++
>>   drivers/gpio/Kconfig                           |   8 ++
>>   drivers/gpio/Makefile                          |   1 +
>>   drivers/gpio/max7320_gpio.c                    | 113 +++++++++++++++++++++++++
>>   4 files changed, 158 insertions(+)
>>   create mode 100644 doc/device-tree-bindings/gpio/gpio-max7320.txt
>>   create mode 100644 drivers/gpio/max7320_gpio.c
>>
>> diff --git a/doc/device-tree-bindings/gpio/gpio-max7320.txt b/doc/device-tree-bindings/gpio/gpio-max7320.txt
>> new file mode 100644
>> index 0000000..87b703b
>> --- /dev/null
>> +++ b/doc/device-tree-bindings/gpio/gpio-max7320.txt
>> @@ -0,0 +1,36 @@
>> +* MAX7320 I/O expanders
>> +
>> +The original maxim 7320 i/o expander offers 8 bit push/pull outputs.
>> +There exists some clones which offers 16 bit.
>> +
>> +Required Properties:
>> +
>> +  - compatible: should be one of the following.
>> +    - "maxim,max7320"
>> +
>> +  - reg: I2C slave address.
>> +
>> +  - gpio-controller: Marks the device node as a gpio controller.
>> +  - #gpio-cells: Should be 2. The first cell is the GPIO number and the second
>> +    cell specifies GPIO flags, as defined in <dt-bindings/gpio/gpio.h>. Only the
>> +    GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported.
>> +
>> +Optional Properties:
>> +
>> +   - ngpios: tell the driver how many gpios the device offers.
>> +     if the property is omitted, 8bit (original maxim) is assumed.
>> +
>> +Please refer to gpio.txt in this directory for details of the common GPIO
>> +bindings used by client devices.
>> +
>> +Example: MAX7320 I/O expander node
>> +
>> +	ledgpio: max7320 at 5d {
>> +		status = "okay";
>> +		compatible = "maxim,max7320";
>> +		reg = <0x5d>;
>> +		#gpio-cells = <2>;
>> +		gpio-controller;
>> +		ngpios = <16>;
>> +	};
>> +
> Where does this binding come from?  Thanks!
>
Hi Tom,

i took it from 'doc/device-tree-bindings/gpio/gpio-pcf857x.txt'  and 
adapted it for my needs.

cheers,
Hannes



More information about the U-Boot mailing list