Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * HTC simple EGPIO irq and gpio extender
0004  */
0005 
0006 #ifndef __HTC_EGPIO_H__
0007 #define __HTC_EGPIO_H__
0008 
0009 /* Descriptive values for all-in or all-out htc_egpio_chip descriptors. */
0010 #define HTC_EGPIO_OUTPUT (~0)
0011 #define HTC_EGPIO_INPUT  0
0012 
0013 /**
0014  * struct htc_egpio_chip - descriptor to create gpio_chip for register range
0015  * @reg_start: index of first register
0016  * @gpio_base: gpio number of first pin in this register range
0017  * @num_gpios: number of gpios in this register range, max BITS_PER_LONG
0018  *    (number of registers = DIV_ROUND_UP(num_gpios, reg_width))
0019  * @direction: bitfield, '0' = input, '1' = output,
0020  */
0021 struct htc_egpio_chip {
0022     int           reg_start;
0023     int           gpio_base;
0024     int           num_gpios;
0025     unsigned long direction;
0026     unsigned long initial_values;
0027 };
0028 
0029 /**
0030  * struct htc_egpio_platform_data - description provided by the arch
0031  * @irq_base: beginning of available IRQs (eg, IRQ_BOARD_START)
0032  * @num_irqs: number of irqs
0033  * @reg_width: number of bits per register, either 8 or 16 bit
0034  * @bus_width: alignment of the registers, either 16 or 32 bit
0035  * @invert_acks: set if chip requires writing '0' to ack an irq, instead of '1'
0036  * @ack_register: location of the irq/ack register
0037  * @chip: pointer to array of htc_egpio_chip descriptors
0038  * @num_chips: number of egpio chip descriptors
0039  */
0040 struct htc_egpio_platform_data {
0041     int                   bus_width;
0042     int                   reg_width;
0043 
0044     int                   irq_base;
0045     int                   num_irqs;
0046     int                   invert_acks;
0047     int                   ack_register;
0048 
0049     struct htc_egpio_chip *chip;
0050     int                   num_chips;
0051 };
0052 
0053 #endif