Commit 29eb6b7d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gpio-v5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
 "Some GPIO fixes I've collected with the help of Bartosz.

  Nothing special about them: all are driver and kbuild fixes + some
  documentation fixes:

   - Tidy up a missed function call in the designware driver when
     converting to gpiolib irqchip

   - Fix some bitmasks in the Aspeed driver

   - Fix some kerneldoc warnings and minor bugs in the improved
     userspace API documentation

   - Revert the revert of the OMAP fix for lost edge wakeup interrupts:
     the fix needs to stay in

   - Fix a compile error when deselecting the character device

   - A bunch of IRQ fixes on the idio GPIO drivers

   - Fix an off-by-one error in the SiFive GPIO driver"

* tag 'gpio-v5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpio: sifive: Fix SiFive gpio probe
  gpio: pcie-idio-24: Enable PEX8311 interrupts
  gpio: pcie-idio-24: Fix IRQ Enable Register value
  gpio: pcie-idio-24: Fix irq mask when masking
  gpiolib: fix sysfs when cdev is not selected
  Revert "Revert "gpio: omap: Fix lost edge wake-up interrupts""
  gpio: uapi: clarify the meaning of 'empty' char arrays
  gpio: uapi: remove whitespace
  gpio: uapi: kernel-doc formatting improvements
  gpio: uapi: comment consistency
  gpio: uapi: fix kernel-doc warnings
  gpio: aspeed: fix ast2600 bank properties
  gpio: dwapb: Fix missing conversion to GPIO-lib-based IRQ-chip
parents 673cb932 b72de3ff
...@@ -1114,6 +1114,7 @@ static const struct aspeed_gpio_config ast2500_config = ...@@ -1114,6 +1114,7 @@ static const struct aspeed_gpio_config ast2500_config =
static const struct aspeed_bank_props ast2600_bank_props[] = { static const struct aspeed_bank_props ast2600_bank_props[] = {
/* input output */ /* input output */
{4, 0xffffffff, 0x00ffffff}, /* Q/R/S/T */
{5, 0xffffffff, 0xffffff00}, /* U/V/W/X */ {5, 0xffffffff, 0xffffff00}, /* U/V/W/X */
{6, 0x0000ffff, 0x0000ffff}, /* Y/Z */ {6, 0x0000ffff, 0x0000ffff}, /* Y/Z */
{ }, { },
......
...@@ -343,8 +343,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type) ...@@ -343,8 +343,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable) static int dwapb_irq_set_wake(struct irq_data *d, unsigned int enable)
{ {
struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct dwapb_gpio *gpio = igc->private; struct dwapb_gpio *gpio = to_dwapb_gpio(gc);
struct dwapb_context *ctx = gpio->ports[0].ctx; struct dwapb_context *ctx = gpio->ports[0].ctx;
irq_hw_number_t bit = irqd_to_hwirq(d); irq_hw_number_t bit = irqd_to_hwirq(d);
......
...@@ -1114,13 +1114,23 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context) ...@@ -1114,13 +1114,23 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context)
{ {
struct device *dev = bank->chip.parent; struct device *dev = bank->chip.parent;
void __iomem *base = bank->base; void __iomem *base = bank->base;
u32 nowake; u32 mask, nowake;
bank->saved_datain = readl_relaxed(base + bank->regs->datain); bank->saved_datain = readl_relaxed(base + bank->regs->datain);
if (!bank->enabled_non_wakeup_gpios) if (!bank->enabled_non_wakeup_gpios)
goto update_gpio_context_count; goto update_gpio_context_count;
/* Check for pending EDGE_FALLING, ignore EDGE_BOTH */
mask = bank->enabled_non_wakeup_gpios & bank->context.fallingdetect;
mask &= ~bank->context.risingdetect;
bank->saved_datain |= mask;
/* Check for pending EDGE_RISING, ignore EDGE_BOTH */
mask = bank->enabled_non_wakeup_gpios & bank->context.risingdetect;
mask &= ~bank->context.fallingdetect;
bank->saved_datain &= ~mask;
if (!may_lose_context) if (!may_lose_context)
goto update_gpio_context_count; goto update_gpio_context_count;
......
...@@ -28,6 +28,47 @@ ...@@ -28,6 +28,47 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/types.h> #include <linux/types.h>
/*
* PLX PEX8311 PCI LCS_INTCSR Interrupt Control/Status
*
* Bit: Description
* 0: Enable Interrupt Sources (Bit 0)
* 1: Enable Interrupt Sources (Bit 1)
* 2: Generate Internal PCI Bus Internal SERR# Interrupt
* 3: Mailbox Interrupt Enable
* 4: Power Management Interrupt Enable
* 5: Power Management Interrupt
* 6: Slave Read Local Data Parity Check Error Enable
* 7: Slave Read Local Data Parity Check Error Status
* 8: Internal PCI Wire Interrupt Enable
* 9: PCI Express Doorbell Interrupt Enable
* 10: PCI Abort Interrupt Enable
* 11: Local Interrupt Input Enable
* 12: Retry Abort Enable
* 13: PCI Express Doorbell Interrupt Active
* 14: PCI Abort Interrupt Active
* 15: Local Interrupt Input Active
* 16: Local Interrupt Output Enable
* 17: Local Doorbell Interrupt Enable
* 18: DMA Channel 0 Interrupt Enable
* 19: DMA Channel 1 Interrupt Enable
* 20: Local Doorbell Interrupt Active
* 21: DMA Channel 0 Interrupt Active
* 22: DMA Channel 1 Interrupt Active
* 23: Built-In Self-Test (BIST) Interrupt Active
* 24: Direct Master was the Bus Master during a Master or Target Abort
* 25: DMA Channel 0 was the Bus Master during a Master or Target Abort
* 26: DMA Channel 1 was the Bus Master during a Master or Target Abort
* 27: Target Abort after internal 256 consecutive Master Retrys
* 28: PCI Bus wrote data to LCS_MBOX0
* 29: PCI Bus wrote data to LCS_MBOX1
* 30: PCI Bus wrote data to LCS_MBOX2
* 31: PCI Bus wrote data to LCS_MBOX3
*/
#define PLX_PEX8311_PCI_LCS_INTCSR 0x68
#define INTCSR_INTERNAL_PCI_WIRE BIT(8)
#define INTCSR_LOCAL_INPUT BIT(11)
/** /**
* struct idio_24_gpio_reg - GPIO device registers structure * struct idio_24_gpio_reg - GPIO device registers structure
* @out0_7: Read: FET Outputs 0-7 * @out0_7: Read: FET Outputs 0-7
...@@ -92,6 +133,7 @@ struct idio_24_gpio_reg { ...@@ -92,6 +133,7 @@ struct idio_24_gpio_reg {
struct idio_24_gpio { struct idio_24_gpio {
struct gpio_chip chip; struct gpio_chip chip;
raw_spinlock_t lock; raw_spinlock_t lock;
__u8 __iomem *plx;
struct idio_24_gpio_reg __iomem *reg; struct idio_24_gpio_reg __iomem *reg;
unsigned long irq_mask; unsigned long irq_mask;
}; };
...@@ -334,13 +376,13 @@ static void idio_24_irq_mask(struct irq_data *data) ...@@ -334,13 +376,13 @@ static void idio_24_irq_mask(struct irq_data *data)
unsigned long flags; unsigned long flags;
const unsigned long bit_offset = irqd_to_hwirq(data) - 24; const unsigned long bit_offset = irqd_to_hwirq(data) - 24;
unsigned char new_irq_mask; unsigned char new_irq_mask;
const unsigned long bank_offset = bit_offset/8 * 8; const unsigned long bank_offset = bit_offset / 8;
unsigned char cos_enable_state; unsigned char cos_enable_state;
raw_spin_lock_irqsave(&idio24gpio->lock, flags); raw_spin_lock_irqsave(&idio24gpio->lock, flags);
idio24gpio->irq_mask &= BIT(bit_offset); idio24gpio->irq_mask &= ~BIT(bit_offset);
new_irq_mask = idio24gpio->irq_mask >> bank_offset; new_irq_mask = idio24gpio->irq_mask >> bank_offset * 8;
if (!new_irq_mask) { if (!new_irq_mask) {
cos_enable_state = ioread8(&idio24gpio->reg->cos_enable); cos_enable_state = ioread8(&idio24gpio->reg->cos_enable);
...@@ -363,12 +405,12 @@ static void idio_24_irq_unmask(struct irq_data *data) ...@@ -363,12 +405,12 @@ static void idio_24_irq_unmask(struct irq_data *data)
unsigned long flags; unsigned long flags;
unsigned char prev_irq_mask; unsigned char prev_irq_mask;
const unsigned long bit_offset = irqd_to_hwirq(data) - 24; const unsigned long bit_offset = irqd_to_hwirq(data) - 24;
const unsigned long bank_offset = bit_offset/8 * 8; const unsigned long bank_offset = bit_offset / 8;
unsigned char cos_enable_state; unsigned char cos_enable_state;
raw_spin_lock_irqsave(&idio24gpio->lock, flags); raw_spin_lock_irqsave(&idio24gpio->lock, flags);
prev_irq_mask = idio24gpio->irq_mask >> bank_offset; prev_irq_mask = idio24gpio->irq_mask >> bank_offset * 8;
idio24gpio->irq_mask |= BIT(bit_offset); idio24gpio->irq_mask |= BIT(bit_offset);
if (!prev_irq_mask) { if (!prev_irq_mask) {
...@@ -455,6 +497,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -455,6 +497,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct device *const dev = &pdev->dev; struct device *const dev = &pdev->dev;
struct idio_24_gpio *idio24gpio; struct idio_24_gpio *idio24gpio;
int err; int err;
const size_t pci_plx_bar_index = 1;
const size_t pci_bar_index = 2; const size_t pci_bar_index = 2;
const char *const name = pci_name(pdev); const char *const name = pci_name(pdev);
struct gpio_irq_chip *girq; struct gpio_irq_chip *girq;
...@@ -469,12 +512,13 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -469,12 +512,13 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return err; return err;
} }
err = pcim_iomap_regions(pdev, BIT(pci_bar_index), name); err = pcim_iomap_regions(pdev, BIT(pci_plx_bar_index) | BIT(pci_bar_index), name);
if (err) { if (err) {
dev_err(dev, "Unable to map PCI I/O addresses (%d)\n", err); dev_err(dev, "Unable to map PCI I/O addresses (%d)\n", err);
return err; return err;
} }
idio24gpio->plx = pcim_iomap_table(pdev)[pci_plx_bar_index];
idio24gpio->reg = pcim_iomap_table(pdev)[pci_bar_index]; idio24gpio->reg = pcim_iomap_table(pdev)[pci_bar_index];
idio24gpio->chip.label = name; idio24gpio->chip.label = name;
...@@ -504,6 +548,12 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -504,6 +548,12 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Software board reset */ /* Software board reset */
iowrite8(0, &idio24gpio->reg->soft_reset); iowrite8(0, &idio24gpio->reg->soft_reset);
/*
* enable PLX PEX8311 internal PCI wire interrupt and local interrupt
* input
*/
iowrite8((INTCSR_INTERNAL_PCI_WIRE | INTCSR_LOCAL_INPUT) >> 8,
idio24gpio->plx + PLX_PEX8311_PCI_LCS_INTCSR + 1);
err = devm_gpiochip_add_data(dev, &idio24gpio->chip, idio24gpio); err = devm_gpiochip_add_data(dev, &idio24gpio->chip, idio24gpio);
if (err) { if (err) {
......
...@@ -183,7 +183,7 @@ static int sifive_gpio_probe(struct platform_device *pdev) ...@@ -183,7 +183,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)
return PTR_ERR(chip->regs); return PTR_ERR(chip->regs);
ngpio = of_irq_count(node); ngpio = of_irq_count(node);
if (ngpio >= SIFIVE_GPIO_MAX) { if (ngpio > SIFIVE_GPIO_MAX) {
dev_err(dev, "Too many GPIO interrupts (max=%d)\n", dev_err(dev, "Too many GPIO interrupts (max=%d)\n",
SIFIVE_GPIO_MAX); SIFIVE_GPIO_MAX);
return -ENXIO; return -ENXIO;
......
...@@ -7,22 +7,7 @@ ...@@ -7,22 +7,7 @@
struct gpio_device; struct gpio_device;
#ifdef CONFIG_GPIO_CDEV
int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt); int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt);
void gpiolib_cdev_unregister(struct gpio_device *gdev); void gpiolib_cdev_unregister(struct gpio_device *gdev);
#else
static inline int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt)
{
return 0;
}
static inline void gpiolib_cdev_unregister(struct gpio_device *gdev)
{
}
#endif /* CONFIG_GPIO_CDEV */
#endif /* GPIOLIB_CDEV_H */ #endif /* GPIOLIB_CDEV_H */
...@@ -480,11 +480,23 @@ static void gpiodevice_release(struct device *dev) ...@@ -480,11 +480,23 @@ static void gpiodevice_release(struct device *dev)
kfree(gdev); kfree(gdev);
} }
#ifdef CONFIG_GPIO_CDEV
#define gcdev_register(gdev, devt) gpiolib_cdev_register((gdev), (devt))
#define gcdev_unregister(gdev) gpiolib_cdev_unregister((gdev))
#else
/*
* gpiolib_cdev_register() indirectly calls device_add(), which is still
* required even when cdev is not selected.
*/
#define gcdev_register(gdev, devt) device_add(&(gdev)->dev)
#define gcdev_unregister(gdev) device_del(&(gdev)->dev)
#endif
static int gpiochip_setup_dev(struct gpio_device *gdev) static int gpiochip_setup_dev(struct gpio_device *gdev)
{ {
int ret; int ret;
ret = gpiolib_cdev_register(gdev, gpio_devt); ret = gcdev_register(gdev, gpio_devt);
if (ret) if (ret)
return ret; return ret;
...@@ -500,7 +512,7 @@ static int gpiochip_setup_dev(struct gpio_device *gdev) ...@@ -500,7 +512,7 @@ static int gpiochip_setup_dev(struct gpio_device *gdev)
return 0; return 0;
err_remove_device: err_remove_device:
gpiolib_cdev_unregister(gdev); gcdev_unregister(gdev);
return ret; return ret;
} }
...@@ -825,7 +837,7 @@ void gpiochip_remove(struct gpio_chip *gc) ...@@ -825,7 +837,7 @@ void gpiochip_remove(struct gpio_chip *gc)
* be removed, else it will be dangling until the last user is * be removed, else it will be dangling until the last user is
* gone. * gone.
*/ */
gpiolib_cdev_unregister(gdev); gcdev_unregister(gdev);
put_device(&gdev->dev); put_device(&gdev->dev);
} }
EXPORT_SYMBOL_GPL(gpiochip_remove); EXPORT_SYMBOL_GPL(gpiochip_remove);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* struct gpiochip_info - Information about a certain GPIO chip * struct gpiochip_info - Information about a certain GPIO chip
* @name: the Linux kernel name of this GPIO chip * @name: the Linux kernel name of this GPIO chip
* @label: a functional name for this GPIO chip, such as a product * @label: a functional name for this GPIO chip, such as a product
* number, may be empty * number, may be empty (i.e. label[0] == '\0')
* @lines: number of GPIO lines on this chip * @lines: number of GPIO lines on this chip
*/ */
struct gpiochip_info { struct gpiochip_info {
...@@ -98,7 +98,7 @@ struct gpio_v2_line_values { ...@@ -98,7 +98,7 @@ struct gpio_v2_line_values {
* identifying which field of the attribute union is in use. * identifying which field of the attribute union is in use.
* @GPIO_V2_LINE_ATTR_ID_FLAGS: flags field is in use * @GPIO_V2_LINE_ATTR_ID_FLAGS: flags field is in use
* @GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES: values field is in use * @GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES: values field is in use
* @GPIO_V2_LINE_ATTR_ID_DEBOUNCE: debounce_period_us is in use * @GPIO_V2_LINE_ATTR_ID_DEBOUNCE: debounce_period_us field is in use
*/ */
enum gpio_v2_line_attr_id { enum gpio_v2_line_attr_id {
GPIO_V2_LINE_ATTR_ID_FLAGS = 1, GPIO_V2_LINE_ATTR_ID_FLAGS = 1,
...@@ -110,17 +110,17 @@ enum gpio_v2_line_attr_id { ...@@ -110,17 +110,17 @@ enum gpio_v2_line_attr_id {
* struct gpio_v2_line_attribute - a configurable attribute of a line * struct gpio_v2_line_attribute - a configurable attribute of a line
* @id: attribute identifier with value from &enum gpio_v2_line_attr_id * @id: attribute identifier with value from &enum gpio_v2_line_attr_id
* @padding: reserved for future use and must be zero filled * @padding: reserved for future use and must be zero filled
* @flags: if id is GPIO_V2_LINE_ATTR_ID_FLAGS, the flags for the GPIO * @flags: if id is %GPIO_V2_LINE_ATTR_ID_FLAGS, the flags for the GPIO
* line, with values from enum gpio_v2_line_flag, such as * line, with values from &enum gpio_v2_line_flag, such as
* GPIO_V2_LINE_FLAG_ACTIVE_LOW, GPIO_V2_LINE_FLAG_OUTPUT etc, OR:ed * %GPIO_V2_LINE_FLAG_ACTIVE_LOW, %GPIO_V2_LINE_FLAG_OUTPUT etc, added
* together. This overrides the default flags contained in the &struct * together. This overrides the default flags contained in the &struct
* gpio_v2_line_config for the associated line. * gpio_v2_line_config for the associated line.
* @values: if id is GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES, a bitmap * @values: if id is %GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES, a bitmap
* containing the values to which the lines will be set, with each bit * containing the values to which the lines will be set, with each bit
* number corresponding to the index into &struct * number corresponding to the index into &struct
* gpio_v2_line_request.offsets. * gpio_v2_line_request.offsets.
* @debounce_period_us: if id is GPIO_V2_LINE_ATTR_ID_DEBOUNCE, the desired * @debounce_period_us: if id is %GPIO_V2_LINE_ATTR_ID_DEBOUNCE, the
* debounce period, in microseconds * desired debounce period, in microseconds
*/ */
struct gpio_v2_line_attribute { struct gpio_v2_line_attribute {
__u32 id; __u32 id;
...@@ -147,12 +147,12 @@ struct gpio_v2_line_config_attribute { ...@@ -147,12 +147,12 @@ struct gpio_v2_line_config_attribute {
/** /**
* struct gpio_v2_line_config - Configuration for GPIO lines * struct gpio_v2_line_config - Configuration for GPIO lines
* @flags: flags for the GPIO lines, with values from enum * @flags: flags for the GPIO lines, with values from &enum
* gpio_v2_line_flag, such as GPIO_V2_LINE_FLAG_ACTIVE_LOW, * gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
* GPIO_V2_LINE_FLAG_OUTPUT etc, OR:ed together. This is the default for * %GPIO_V2_LINE_FLAG_OUTPUT etc, added together. This is the default for
* all requested lines but may be overridden for particular lines using * all requested lines but may be overridden for particular lines using
* attrs. * @attrs.
* @num_attrs: the number of attributes in attrs * @num_attrs: the number of attributes in @attrs
* @padding: reserved for future use and must be zero filled * @padding: reserved for future use and must be zero filled
* @attrs: the configuration attributes associated with the requested * @attrs: the configuration attributes associated with the requested
* lines. Any attribute should only be associated with a particular line * lines. Any attribute should only be associated with a particular line
...@@ -175,17 +175,17 @@ struct gpio_v2_line_config { ...@@ -175,17 +175,17 @@ struct gpio_v2_line_config {
* "my-bitbanged-relay" * "my-bitbanged-relay"
* @config: requested configuration for the lines. * @config: requested configuration for the lines.
* @num_lines: number of lines requested in this request, i.e. the number * @num_lines: number of lines requested in this request, i.e. the number
* of valid fields in the GPIO_V2_LINES_MAX sized arrays, set to 1 to * of valid fields in the %GPIO_V2_LINES_MAX sized arrays, set to 1 to
* request a single line * request a single line
* @event_buffer_size: a suggested minimum number of line events that the * @event_buffer_size: a suggested minimum number of line events that the
* kernel should buffer. This is only relevant if edge detection is * kernel should buffer. This is only relevant if edge detection is
* enabled in the configuration. Note that this is only a suggested value * enabled in the configuration. Note that this is only a suggested value
* and the kernel may allocate a larger buffer or cap the size of the * and the kernel may allocate a larger buffer or cap the size of the
* buffer. If this field is zero then the buffer size defaults to a minimum * buffer. If this field is zero then the buffer size defaults to a minimum
* of num_lines*16. * of @num_lines * 16.
* @padding: reserved for future use and must be zero filled * @padding: reserved for future use and must be zero filled
* @fd: if successful this field will contain a valid anonymous file handle * @fd: if successful this field will contain a valid anonymous file handle
* after a GPIO_GET_LINE_IOCTL operation, zero or negative value means * after a %GPIO_GET_LINE_IOCTL operation, zero or negative value means
* error * error
*/ */
struct gpio_v2_line_request { struct gpio_v2_line_request {
...@@ -203,15 +203,16 @@ struct gpio_v2_line_request { ...@@ -203,15 +203,16 @@ struct gpio_v2_line_request {
* struct gpio_v2_line_info - Information about a certain GPIO line * struct gpio_v2_line_info - Information about a certain GPIO line
* @name: the name of this GPIO line, such as the output pin of the line on * @name: the name of this GPIO line, such as the output pin of the line on
* the chip, a rail or a pin header name on a board, as specified by the * the chip, a rail or a pin header name on a board, as specified by the
* GPIO chip, may be empty * GPIO chip, may be empty (i.e. name[0] == '\0')
* @consumer: a functional name for the consumer of this GPIO line as set * @consumer: a functional name for the consumer of this GPIO line as set
* by whatever is using it, will be empty if there is no current user but * by whatever is using it, will be empty if there is no current user but
* may also be empty if the consumer doesn't set this up * may also be empty if the consumer doesn't set this up
* @flags: flags for the GPIO line, such as GPIO_V2_LINE_FLAG_ACTIVE_LOW,
* GPIO_V2_LINE_FLAG_OUTPUT etc, OR:ed together
* @offset: the local offset on this GPIO chip, fill this in when * @offset: the local offset on this GPIO chip, fill this in when
* requesting the line information from the kernel * requesting the line information from the kernel
* @num_attrs: the number of attributes in attrs * @num_attrs: the number of attributes in @attrs
* @flags: flags for the GPIO lines, with values from &enum
* gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
* %GPIO_V2_LINE_FLAG_OUTPUT etc, added together.
* @attrs: the configuration attributes associated with the line * @attrs: the configuration attributes associated with the line
* @padding: reserved for future use * @padding: reserved for future use
*/ */
...@@ -244,7 +245,7 @@ enum gpio_v2_line_changed_type { ...@@ -244,7 +245,7 @@ enum gpio_v2_line_changed_type {
* of a GPIO line * of a GPIO line
* @info: updated line information * @info: updated line information
* @timestamp_ns: estimate of time of status change occurrence, in nanoseconds * @timestamp_ns: estimate of time of status change occurrence, in nanoseconds
* @event_type: the type of change with a value from enum * @event_type: the type of change with a value from &enum
* gpio_v2_line_changed_type * gpio_v2_line_changed_type
* @padding: reserved for future use * @padding: reserved for future use
*/ */
...@@ -269,10 +270,10 @@ enum gpio_v2_line_event_id { ...@@ -269,10 +270,10 @@ enum gpio_v2_line_event_id {
/** /**
* struct gpio_v2_line_event - The actual event being pushed to userspace * struct gpio_v2_line_event - The actual event being pushed to userspace
* @timestamp_ns: best estimate of time of event occurrence, in nanoseconds. * @timestamp_ns: best estimate of time of event occurrence, in nanoseconds.
* The timestamp_ns is read from CLOCK_MONOTONIC and is intended to allow the * The @timestamp_ns is read from %CLOCK_MONOTONIC and is intended to allow
* accurate measurement of the time between events. It does not provide * the accurate measurement of the time between events. It does not provide
* the wall-clock time. * the wall-clock time.
* @id: event identifier with value from enum gpio_v2_line_event_id * @id: event identifier with value from &enum gpio_v2_line_event_id
* @offset: the offset of the line that triggered the event * @offset: the offset of the line that triggered the event
* @seqno: the sequence number for this event in the sequence of events for * @seqno: the sequence number for this event in the sequence of events for
* all the lines in this line request * all the lines in this line request
...@@ -291,7 +292,7 @@ struct gpio_v2_line_event { ...@@ -291,7 +292,7 @@ struct gpio_v2_line_event {
}; };
/* /*
* ABI v1 * ABI v1
* *
* This version of the ABI is deprecated. * This version of the ABI is deprecated.
* Use the latest version of the ABI, defined above, instead. * Use the latest version of the ABI, defined above, instead.
...@@ -314,13 +315,13 @@ struct gpio_v2_line_event { ...@@ -314,13 +315,13 @@ struct gpio_v2_line_event {
* @flags: various flags for this line * @flags: various flags for this line
* @name: the name of this GPIO line, such as the output pin of the line on the * @name: the name of this GPIO line, such as the output pin of the line on the
* chip, a rail or a pin header name on a board, as specified by the gpio * chip, a rail or a pin header name on a board, as specified by the gpio
* chip, may be empty * chip, may be empty (i.e. name[0] == '\0')
* @consumer: a functional name for the consumer of this GPIO line as set by * @consumer: a functional name for the consumer of this GPIO line as set by
* whatever is using it, will be empty if there is no current user but may * whatever is using it, will be empty if there is no current user but may
* also be empty if the consumer doesn't set this up * also be empty if the consumer doesn't set this up
* *
* This struct is part of ABI v1 and is deprecated. * Note: This struct is part of ABI v1 and is deprecated.
* Use struct gpio_v2_line_info instead. * Use &struct gpio_v2_line_info instead.
*/ */
struct gpioline_info { struct gpioline_info {
__u32 line_offset; __u32 line_offset;
...@@ -344,17 +345,18 @@ enum { ...@@ -344,17 +345,18 @@ enum {
* of a GPIO line * of a GPIO line
* @info: updated line information * @info: updated line information
* @timestamp: estimate of time of status change occurrence, in nanoseconds * @timestamp: estimate of time of status change occurrence, in nanoseconds
* @event_type: one of GPIOLINE_CHANGED_REQUESTED, GPIOLINE_CHANGED_RELEASED * @event_type: one of %GPIOLINE_CHANGED_REQUESTED,
* and GPIOLINE_CHANGED_CONFIG * %GPIOLINE_CHANGED_RELEASED and %GPIOLINE_CHANGED_CONFIG
* @padding: reserved for future use
* *
* Note: struct gpioline_info embedded here has 32-bit alignment on its own, * The &struct gpioline_info embedded here has 32-bit alignment on its own,
* but it works fine with 64-bit alignment too. With its 72 byte size, we can * but it works fine with 64-bit alignment too. With its 72 byte size, we can
* guarantee there are no implicit holes between it and subsequent members. * guarantee there are no implicit holes between it and subsequent members.
* The 20-byte padding at the end makes sure we don't add any implicit padding * The 20-byte padding at the end makes sure we don't add any implicit padding
* at the end of the structure on 64-bit architectures. * at the end of the structure on 64-bit architectures.
* *
* This struct is part of ABI v1 and is deprecated. * Note: This struct is part of ABI v1 and is deprecated.
* Use struct gpio_v2_line_info_changed instead. * Use &struct gpio_v2_line_info_changed instead.
*/ */
struct gpioline_info_changed { struct gpioline_info_changed {
struct gpioline_info info; struct gpioline_info info;
...@@ -378,13 +380,13 @@ struct gpioline_info_changed { ...@@ -378,13 +380,13 @@ struct gpioline_info_changed {
* @lineoffsets: an array of desired lines, specified by offset index for the * @lineoffsets: an array of desired lines, specified by offset index for the
* associated GPIO device * associated GPIO device
* @flags: desired flags for the desired GPIO lines, such as * @flags: desired flags for the desired GPIO lines, such as
* GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
* together. Note that even if multiple lines are requested, the same flags * together. Note that even if multiple lines are requested, the same flags
* must be applicable to all of them, if you want lines with individual * must be applicable to all of them, if you want lines with individual
* flags set, request them one by one. It is possible to select * flags set, request them one by one. It is possible to select
* a batch of input or output lines, but they must all have the same * a batch of input or output lines, but they must all have the same
* characteristics, i.e. all inputs or all outputs, all active low etc * characteristics, i.e. all inputs or all outputs, all active low etc
* @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set for a requested * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set for a requested
* line, this specifies the default output value, should be 0 (low) or * line, this specifies the default output value, should be 0 (low) or
* 1 (high), anything else than 0 or 1 will be interpreted as 1 (high) * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
* @consumer_label: a desired consumer label for the selected GPIO line(s) * @consumer_label: a desired consumer label for the selected GPIO line(s)
...@@ -392,11 +394,11 @@ struct gpioline_info_changed { ...@@ -392,11 +394,11 @@ struct gpioline_info_changed {
* @lines: number of lines requested in this request, i.e. the number of * @lines: number of lines requested in this request, i.e. the number of
* valid fields in the above arrays, set to 1 to request a single line * valid fields in the above arrays, set to 1 to request a single line
* @fd: if successful this field will contain a valid anonymous file handle * @fd: if successful this field will contain a valid anonymous file handle
* after a GPIO_GET_LINEHANDLE_IOCTL operation, zero or negative value * after a %GPIO_GET_LINEHANDLE_IOCTL operation, zero or negative value
* means error * means error
* *
* This struct is part of ABI v1 and is deprecated. * Note: This struct is part of ABI v1 and is deprecated.
* Use struct gpio_v2_line_request instead. * Use &struct gpio_v2_line_request instead.
*/ */
struct gpiohandle_request { struct gpiohandle_request {
__u32 lineoffsets[GPIOHANDLES_MAX]; __u32 lineoffsets[GPIOHANDLES_MAX];
...@@ -410,15 +412,15 @@ struct gpiohandle_request { ...@@ -410,15 +412,15 @@ struct gpiohandle_request {
/** /**
* struct gpiohandle_config - Configuration for a GPIO handle request * struct gpiohandle_config - Configuration for a GPIO handle request
* @flags: updated flags for the requested GPIO lines, such as * @flags: updated flags for the requested GPIO lines, such as
* GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
* together * together
* @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set in flags, * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set in flags,
* this specifies the default output value, should be 0 (low) or * this specifies the default output value, should be 0 (low) or
* 1 (high), anything else than 0 or 1 will be interpreted as 1 (high) * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
* @padding: reserved for future use and should be zero filled * @padding: reserved for future use and should be zero filled
* *
* This struct is part of ABI v1 and is deprecated. * Note: This struct is part of ABI v1 and is deprecated.
* Use struct gpio_v2_line_config instead. * Use &struct gpio_v2_line_config instead.
*/ */
struct gpiohandle_config { struct gpiohandle_config {
__u32 flags; __u32 flags;
...@@ -432,8 +434,8 @@ struct gpiohandle_config { ...@@ -432,8 +434,8 @@ struct gpiohandle_config {
* state of a line, when setting the state of lines these should contain * state of a line, when setting the state of lines these should contain
* the desired target state * the desired target state
* *
* This struct is part of ABI v1 and is deprecated. * Note: This struct is part of ABI v1 and is deprecated.
* Use struct gpio_v2_line_values instead. * Use &struct gpio_v2_line_values instead.
*/ */
struct gpiohandle_data { struct gpiohandle_data {
__u8 values[GPIOHANDLES_MAX]; __u8 values[GPIOHANDLES_MAX];
...@@ -449,17 +451,17 @@ struct gpiohandle_data { ...@@ -449,17 +451,17 @@ struct gpiohandle_data {
* @lineoffset: the desired line to subscribe to events from, specified by * @lineoffset: the desired line to subscribe to events from, specified by
* offset index for the associated GPIO device * offset index for the associated GPIO device
* @handleflags: desired handle flags for the desired GPIO line, such as * @handleflags: desired handle flags for the desired GPIO line, such as
* GPIOHANDLE_REQUEST_ACTIVE_LOW or GPIOHANDLE_REQUEST_OPEN_DRAIN * %GPIOHANDLE_REQUEST_ACTIVE_LOW or %GPIOHANDLE_REQUEST_OPEN_DRAIN
* @eventflags: desired flags for the desired GPIO event line, such as * @eventflags: desired flags for the desired GPIO event line, such as
* GPIOEVENT_REQUEST_RISING_EDGE or GPIOEVENT_REQUEST_FALLING_EDGE * %GPIOEVENT_REQUEST_RISING_EDGE or %GPIOEVENT_REQUEST_FALLING_EDGE
* @consumer_label: a desired consumer label for the selected GPIO line(s) * @consumer_label: a desired consumer label for the selected GPIO line(s)
* such as "my-listener" * such as "my-listener"
* @fd: if successful this field will contain a valid anonymous file handle * @fd: if successful this field will contain a valid anonymous file handle
* after a GPIO_GET_LINEEVENT_IOCTL operation, zero or negative value * after a %GPIO_GET_LINEEVENT_IOCTL operation, zero or negative value
* means error * means error
* *
* This struct is part of ABI v1 and is deprecated. * Note: This struct is part of ABI v1 and is deprecated.
* Use struct gpio_v2_line_request instead. * Use &struct gpio_v2_line_request instead.
*/ */
struct gpioevent_request { struct gpioevent_request {
__u32 lineoffset; __u32 lineoffset;
...@@ -469,7 +471,7 @@ struct gpioevent_request { ...@@ -469,7 +471,7 @@ struct gpioevent_request {
int fd; int fd;
}; };
/** /*
* GPIO event types * GPIO event types
*/ */
#define GPIOEVENT_EVENT_RISING_EDGE 0x01 #define GPIOEVENT_EVENT_RISING_EDGE 0x01
...@@ -480,8 +482,8 @@ struct gpioevent_request { ...@@ -480,8 +482,8 @@ struct gpioevent_request {
* @timestamp: best estimate of time of event occurrence, in nanoseconds * @timestamp: best estimate of time of event occurrence, in nanoseconds
* @id: event identifier * @id: event identifier
* *
* This struct is part of ABI v1 and is deprecated. * Note: This struct is part of ABI v1 and is deprecated.
* Use struct gpio_v2_line_event instead. * Use &struct gpio_v2_line_event instead.
*/ */
struct gpioevent_data { struct gpioevent_data {
__u64 timestamp; __u64 timestamp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment