Skip to content
  1. Apr 08, 2016
    • Yong Li's avatar
      gpio: pca953x: Use correct u16 value for register word write · 9b8e3ec3
      Yong Li authored
      
      
      The current implementation only uses the first byte in val,
      the second byte is always 0. Change it to use cpu_to_le16
      to write the two bytes into the register
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarYong Li <sdliyong@gmail.com>
      Reviewed-by: default avatarPhil Reid <preid@electromag.com.au>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      9b8e3ec3
    • Guenter Roeck's avatar
      gpiolib: Defer gpio device setup until after gpiolib initialization · 159f3cd9
      Guenter Roeck authored
      
      
      Since commit ff2b1359 ("gpio: make the gpiochip a real device"),
      attempts to add a gpio chip prior to gpiolib initialization cause
      the system to crash. This happens because gpio_bus_type has not been
      registered yet. Defer creating gpio devices until after gpiolib has
      been initialized to fix the problem.
      
      Cc: Greg Ungerer <gerg@uclinux.org>
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Fixes: ff2b1359 ("gpio: make the gpiochip a real device")
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      159f3cd9
    • Guenter Roeck's avatar
      gpiolib: Do not use devm functions when registering gpio chip · 476e2fc5
      Guenter Roeck authored
      
      
      It is possible that a gpio chip is registered before the gpiolib
      initialization code has run. This means we can not use devm_ functions
      to allocate memory at that time. Do it the old fashioned way.
      
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Cc: Greg Ungerer <gerg@uclinux.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      476e2fc5
    • 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