Loading Documentation/gpio/driver.txt +5 −4 Original line number Original line Diff line number Diff line Loading @@ -146,10 +146,11 @@ a pull-up resistor is needed on the outgoing rail to complete the circuit, and in the second case, a pull-down resistor is needed on the rail. in the second case, a pull-down resistor is needed on the rail. Hardware that supports open drain or open source or both, can implement a Hardware that supports open drain or open source or both, can implement a special callback in the gpio_chip: .set_single_ended() that takes an enum flag special callback in the gpio_chip: .set_config() that takes a generic telling whether to configure the line as open drain, open source or push-pull. pinconf packed value telling whether to configure the line as open drain, This will happen in response to the GPIO_OPEN_DRAIN or GPIO_OPEN_SOURCE flag open source or push-pull. This will happen in response to the set in the machine file, or coming from other hardware descriptions. GPIO_OPEN_DRAIN or GPIO_OPEN_SOURCE flag set in the machine file, or coming from other hardware descriptions. If this state can not be configured in hardware, i.e. if the GPIO hardware does If this state can not be configured in hardware, i.e. if the GPIO hardware does not support open drain/open source in hardware, the GPIO library will instead not support open drain/open source in hardware, the GPIO library will instead Loading drivers/gpio/gpio-bcm-kona.c +13 −1 Original line number Original line Diff line number Diff line Loading @@ -308,6 +308,18 @@ static int bcm_kona_gpio_set_debounce(struct gpio_chip *chip, unsigned gpio, return 0; return 0; } } static int bcm_kona_gpio_set_config(struct gpio_chip *chip, unsigned gpio, unsigned long config) { u32 debounce; if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) return -ENOTSUPP; debounce = pinconf_to_config_argument(config); return bcm_kona_gpio_set_debounce(chip, gpio, debounce); } static const struct gpio_chip template_chip = { static const struct gpio_chip template_chip = { .label = "bcm-kona-gpio", .label = "bcm-kona-gpio", .owner = THIS_MODULE, .owner = THIS_MODULE, Loading @@ -318,7 +330,7 @@ static const struct gpio_chip template_chip = { .get = bcm_kona_gpio_get, .get = bcm_kona_gpio_get, .direction_output = bcm_kona_gpio_direction_output, .direction_output = bcm_kona_gpio_direction_output, .set = bcm_kona_gpio_set, .set = bcm_kona_gpio_set, .set_debounce = bcm_kona_gpio_set_debounce, .set_config = bcm_kona_gpio_set_config, .to_irq = bcm_kona_gpio_to_irq, .to_irq = bcm_kona_gpio_to_irq, .base = 0, .base = 0, }; }; Loading drivers/gpio/gpio-dln2.c +8 −4 Original line number Original line Diff line number Diff line Loading @@ -272,12 +272,16 @@ static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset, return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); } } static int dln2_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, static int dln2_gpio_set_config(struct gpio_chip *chip, unsigned offset, unsigned debounce) unsigned long config) { { struct dln2_gpio *dln2 = gpiochip_get_data(chip); struct dln2_gpio *dln2 = gpiochip_get_data(chip); __le32 duration = cpu_to_le32(debounce); __le32 duration; if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) return -ENOTSUPP; duration = cpu_to_le32(pinconf_to_config_argument(config)); return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_SET_DEBOUNCE, return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_SET_DEBOUNCE, &duration, sizeof(duration)); &duration, sizeof(duration)); } } Loading Loading @@ -474,7 +478,7 @@ static int dln2_gpio_probe(struct platform_device *pdev) dln2->gpio.get_direction = dln2_gpio_get_direction; dln2->gpio.get_direction = dln2_gpio_get_direction; dln2->gpio.direction_input = dln2_gpio_direction_input; dln2->gpio.direction_input = dln2_gpio_direction_input; dln2->gpio.direction_output = dln2_gpio_direction_output; dln2->gpio.direction_output = dln2_gpio_direction_output; dln2->gpio.set_debounce = dln2_gpio_set_debounce; dln2->gpio.set_config = dln2_gpio_set_config; platform_set_drvdata(pdev, dln2); platform_set_drvdata(pdev, dln2); Loading drivers/gpio/gpio-dwapb.c +13 −1 Original line number Original line Diff line number Diff line Loading @@ -279,6 +279,18 @@ static int dwapb_gpio_set_debounce(struct gpio_chip *gc, return 0; return 0; } } static int dwapb_gpio_set_config(struct gpio_chip *gc, unsigned offset, unsigned long config) { u32 debounce; if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) return -ENOTSUPP; debounce = pinconf_to_config_argument(config); return dwapb_gpio_set_debounce(gc, offset, debounce); } static irqreturn_t dwapb_irq_handler_mfd(int irq, void *dev_id) static irqreturn_t dwapb_irq_handler_mfd(int irq, void *dev_id) { { u32 worked; u32 worked; Loading Loading @@ -426,7 +438,7 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, /* Only port A support debounce */ /* Only port A support debounce */ if (pp->idx == 0) if (pp->idx == 0) port->gc.set_debounce = dwapb_gpio_set_debounce; port->gc.set_config = dwapb_gpio_set_config; if (pp->irq) if (pp->irq) dwapb_configure_irqs(gpio, port, pp); dwapb_configure_irqs(gpio, port, pp); Loading drivers/gpio/gpio-ep93xx.c +8 −3 Original line number Original line Diff line number Diff line Loading @@ -291,15 +291,20 @@ static struct ep93xx_gpio_bank ep93xx_gpio_banks[] = { EP93XX_GPIO_BANK("H", 0x40, 0x44, 56, false), EP93XX_GPIO_BANK("H", 0x40, 0x44, 56, false), }; }; static int ep93xx_gpio_set_debounce(struct gpio_chip *chip, static int ep93xx_gpio_set_config(struct gpio_chip *chip, unsigned offset, unsigned offset, unsigned debounce) unsigned long config) { { int gpio = chip->base + offset; int gpio = chip->base + offset; int irq = gpio_to_irq(gpio); int irq = gpio_to_irq(gpio); u32 debounce; if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) return -ENOTSUPP; if (irq < 0) if (irq < 0) return -EINVAL; return -EINVAL; debounce = pinconf_to_config_argument(config); ep93xx_gpio_int_debounce(irq, debounce ? true : false); ep93xx_gpio_int_debounce(irq, debounce ? true : false); return 0; return 0; Loading Loading @@ -335,7 +340,7 @@ static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev, gc->base = bank->base; gc->base = bank->base; if (bank->has_debounce) { if (bank->has_debounce) { gc->set_debounce = ep93xx_gpio_set_debounce; gc->set_config = ep93xx_gpio_set_config; gc->to_irq = ep93xx_gpio_to_irq; gc->to_irq = ep93xx_gpio_to_irq; } } Loading Loading
Documentation/gpio/driver.txt +5 −4 Original line number Original line Diff line number Diff line Loading @@ -146,10 +146,11 @@ a pull-up resistor is needed on the outgoing rail to complete the circuit, and in the second case, a pull-down resistor is needed on the rail. in the second case, a pull-down resistor is needed on the rail. Hardware that supports open drain or open source or both, can implement a Hardware that supports open drain or open source or both, can implement a special callback in the gpio_chip: .set_single_ended() that takes an enum flag special callback in the gpio_chip: .set_config() that takes a generic telling whether to configure the line as open drain, open source or push-pull. pinconf packed value telling whether to configure the line as open drain, This will happen in response to the GPIO_OPEN_DRAIN or GPIO_OPEN_SOURCE flag open source or push-pull. This will happen in response to the set in the machine file, or coming from other hardware descriptions. GPIO_OPEN_DRAIN or GPIO_OPEN_SOURCE flag set in the machine file, or coming from other hardware descriptions. If this state can not be configured in hardware, i.e. if the GPIO hardware does If this state can not be configured in hardware, i.e. if the GPIO hardware does not support open drain/open source in hardware, the GPIO library will instead not support open drain/open source in hardware, the GPIO library will instead Loading
drivers/gpio/gpio-bcm-kona.c +13 −1 Original line number Original line Diff line number Diff line Loading @@ -308,6 +308,18 @@ static int bcm_kona_gpio_set_debounce(struct gpio_chip *chip, unsigned gpio, return 0; return 0; } } static int bcm_kona_gpio_set_config(struct gpio_chip *chip, unsigned gpio, unsigned long config) { u32 debounce; if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) return -ENOTSUPP; debounce = pinconf_to_config_argument(config); return bcm_kona_gpio_set_debounce(chip, gpio, debounce); } static const struct gpio_chip template_chip = { static const struct gpio_chip template_chip = { .label = "bcm-kona-gpio", .label = "bcm-kona-gpio", .owner = THIS_MODULE, .owner = THIS_MODULE, Loading @@ -318,7 +330,7 @@ static const struct gpio_chip template_chip = { .get = bcm_kona_gpio_get, .get = bcm_kona_gpio_get, .direction_output = bcm_kona_gpio_direction_output, .direction_output = bcm_kona_gpio_direction_output, .set = bcm_kona_gpio_set, .set = bcm_kona_gpio_set, .set_debounce = bcm_kona_gpio_set_debounce, .set_config = bcm_kona_gpio_set_config, .to_irq = bcm_kona_gpio_to_irq, .to_irq = bcm_kona_gpio_to_irq, .base = 0, .base = 0, }; }; Loading
drivers/gpio/gpio-dln2.c +8 −4 Original line number Original line Diff line number Diff line Loading @@ -272,12 +272,16 @@ static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset, return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); } } static int dln2_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, static int dln2_gpio_set_config(struct gpio_chip *chip, unsigned offset, unsigned debounce) unsigned long config) { { struct dln2_gpio *dln2 = gpiochip_get_data(chip); struct dln2_gpio *dln2 = gpiochip_get_data(chip); __le32 duration = cpu_to_le32(debounce); __le32 duration; if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) return -ENOTSUPP; duration = cpu_to_le32(pinconf_to_config_argument(config)); return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_SET_DEBOUNCE, return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_SET_DEBOUNCE, &duration, sizeof(duration)); &duration, sizeof(duration)); } } Loading Loading @@ -474,7 +478,7 @@ static int dln2_gpio_probe(struct platform_device *pdev) dln2->gpio.get_direction = dln2_gpio_get_direction; dln2->gpio.get_direction = dln2_gpio_get_direction; dln2->gpio.direction_input = dln2_gpio_direction_input; dln2->gpio.direction_input = dln2_gpio_direction_input; dln2->gpio.direction_output = dln2_gpio_direction_output; dln2->gpio.direction_output = dln2_gpio_direction_output; dln2->gpio.set_debounce = dln2_gpio_set_debounce; dln2->gpio.set_config = dln2_gpio_set_config; platform_set_drvdata(pdev, dln2); platform_set_drvdata(pdev, dln2); Loading
drivers/gpio/gpio-dwapb.c +13 −1 Original line number Original line Diff line number Diff line Loading @@ -279,6 +279,18 @@ static int dwapb_gpio_set_debounce(struct gpio_chip *gc, return 0; return 0; } } static int dwapb_gpio_set_config(struct gpio_chip *gc, unsigned offset, unsigned long config) { u32 debounce; if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) return -ENOTSUPP; debounce = pinconf_to_config_argument(config); return dwapb_gpio_set_debounce(gc, offset, debounce); } static irqreturn_t dwapb_irq_handler_mfd(int irq, void *dev_id) static irqreturn_t dwapb_irq_handler_mfd(int irq, void *dev_id) { { u32 worked; u32 worked; Loading Loading @@ -426,7 +438,7 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, /* Only port A support debounce */ /* Only port A support debounce */ if (pp->idx == 0) if (pp->idx == 0) port->gc.set_debounce = dwapb_gpio_set_debounce; port->gc.set_config = dwapb_gpio_set_config; if (pp->irq) if (pp->irq) dwapb_configure_irqs(gpio, port, pp); dwapb_configure_irqs(gpio, port, pp); Loading
drivers/gpio/gpio-ep93xx.c +8 −3 Original line number Original line Diff line number Diff line Loading @@ -291,15 +291,20 @@ static struct ep93xx_gpio_bank ep93xx_gpio_banks[] = { EP93XX_GPIO_BANK("H", 0x40, 0x44, 56, false), EP93XX_GPIO_BANK("H", 0x40, 0x44, 56, false), }; }; static int ep93xx_gpio_set_debounce(struct gpio_chip *chip, static int ep93xx_gpio_set_config(struct gpio_chip *chip, unsigned offset, unsigned offset, unsigned debounce) unsigned long config) { { int gpio = chip->base + offset; int gpio = chip->base + offset; int irq = gpio_to_irq(gpio); int irq = gpio_to_irq(gpio); u32 debounce; if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) return -ENOTSUPP; if (irq < 0) if (irq < 0) return -EINVAL; return -EINVAL; debounce = pinconf_to_config_argument(config); ep93xx_gpio_int_debounce(irq, debounce ? true : false); ep93xx_gpio_int_debounce(irq, debounce ? true : false); return 0; return 0; Loading Loading @@ -335,7 +340,7 @@ static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev, gc->base = bank->base; gc->base = bank->base; if (bank->has_debounce) { if (bank->has_debounce) { gc->set_debounce = ep93xx_gpio_set_debounce; gc->set_config = ep93xx_gpio_set_config; gc->to_irq = ep93xx_gpio_to_irq; gc->to_irq = ep93xx_gpio_to_irq; } } Loading