bcm2835_gpio_direction_output not setting up GPIO value

Noralf Trønnes noralf at tronnes.org
Mon Apr 6 03:09:01 PDT 2015


Den 06.04.2015 11:10, skrev Martin Sperl:
> Is there any reason why bcm2835_gpio_direction_output is
> not setting up the value of GPIO as requested?
>
> static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
> 					 unsigned offset, int value)
> {
> 	return pinctrl_gpio_direction_output(chip->base + offset);
> }
> Some oversight?
>
> Maybe it should look like this (untested)?
>
> static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
> 					 unsigned offset, int value)
> {
> 	int err = pinctrl_gpio_direction_output(chip->base + offset);
> 	if (!err)
> 		bcm2835_gpio_set(chip, offset, value);
> 	return err;
> }

You're right it should set the value as well.

There has recently been 3 fixes to that driver in the raspberrypi fork:

pinctrl-bcm2835: bcm2835_gpio_direction_output must set the value
https://github.com/raspberrypi/linux/commit/c288c0ec3edd40e090f49c5575c15cd0d9dac413

pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53
https://github.com/raspberrypi/linux/commit/11f2a1f8db91523fbcf10f8428f407cf3b37f936

pinctrl-bcm2835: Only request the interrupts listed in the DTB
https://github.com/raspberrypi/linux/commit/5dbbf705cb9d78fd740d2270d9141c3a88af0406

Sadly they haven't made it into mainline.
Maybe you can look at that Martin?


Regards,
Noralf Trønnes




More information about the linux-rpi-kernel mailing list