Skip to content
  1. Apr 08, 2016
    • Robert Jarzmik's avatar
      gpio: pxa: fix legacy non pinctrl aware builds · c4e5ffb6
      Robert Jarzmik authored
      
      
      In legacy pxa builds, ie. non device-tree and platform-data only builds,
      pinctrl is not yet available. As a consequence, the pinctrl gpio
      direction change function is a stub, returning always success.
      
      In the current state, the gpio driver direction function believes the
      pinctrl direction change was successful, and exits without actually
      changing the gpio direction.
      
      This patch changes the logic :
       - if the pinctrl direction function fails, gpio direction will report
         that failure
       - if the pinctrl direction function succeeds, gpio direction is changed
         by the gpio driver anyway.
         This is sub optimal in the pinctrl aware case, as the gpio direction
         will be changed twice: once by pinctrl function and another time by
         the gpio direction function.
      
      Yet it should be acceptable in this form, as this is functional for all
      pxa platforms (device-tree and platform-data), and moreover changing a
      gpio direction is very very seldom, usually in machine initialization,
      seldom in drivers probe, and an exception for ac97 reset bug.
      
      Fixes: a770d946 ("gpio: pxa: add pin control gpio direction and request")
      Reported-by: default avatarGuenter Roeck <guenter@roeck-us.net>
      Tested-by: default avatarGuenter Roeck <guenter@roeck-us.net>
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      c4e5ffb6
    • Dmitry Torokhov's avatar
      gpio / ACPI: ignore GpioInt() GPIOs when requesting GPIO_OUT_* · 25487533
      Dmitry Torokhov authored
      
      
      When firmware does not use _DSD properties that allow properly name GPIO
      resources, the kernel falls back on parsing _CRS resources, and will
      return entries described as GpioInt() as general purpose GPIOs even
      though they are meant to be used simply as interrupt sources for the
      device:
      
      Device (ETSA)
      {
      	Name (_HID, "ELAN0001")
      	...
      
      	Method(_CRS, 0x0, NotSerialized)
      	{
      		Name(BUF0,ResourceTemplate ()
      		{
      			I2CSerialBus(
      				0x10,                     /* SlaveAddress */
      				ControllerInitiated,      /* SlaveMode */
      				400000,                   /* ConnectionSpeed */
      				AddressingMode7Bit,       /* AddressingMode */
      				"\\_SB.I2C1",             /* ResourceSource */
      			)
      			GpioInt (Edge, ActiveLow, ExclusiveAndWake, PullNone,,
      				 "\\_SB.GPSW") { BOARD_TOUCH_GPIO_INDEX }
      		} )
      		Return (BUF0)
      	}
      ...
      }
      
      This gives troubles with drivers such as Elan Touchscreen driver
      (elants_i2c) that uses devm_gpiod_get to look up "reset" GPIO line and
      decide whether the driver is responsible for powering up and resetting
      the device, or firmware is. In the above case the lookup succeeds, we
      map GPIO as output and later fail to request client->irq interrupt that
      is mapped to the same GPIO.
      
      Let's ignore resources described as GpioInt() while parsing _CRS when
      requesting output GPIOs (but allow them when requesting GPIOD_ASIS or
      GPIOD_IN as some drivers, such as i2c-hid, do request GPIO as input and
      then map it to interrupt with gpiod_to_irq).
      
      Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarDmitry Torokhov <dtor@chromium.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      25487533
  2. Apr 03, 2016
  3. Apr 02, 2016