1. 29 3月, 2014 3 次提交
  2. 27 3月, 2014 6 次提交
    • D
      pch_gpio: set value before enabling output direction · 2ddf6cd6
      Daniel Krueger 提交于
      This ensures that the output signal does not toggle if set to high.
      Signed-off-by: NDaniel Krueger <daniel.krueger@systec-electronic.com>
      Signed-off-by: NAlexander Stein <alexander.stein@systec-electronic.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      2ddf6cd6
    • A
      gpio: moxart: Actually set output state in moxart_gpio_direction_output() · fc860356
      Axel Lin 提交于
      moxart_gpio_direction_output() ignored the state passed into it. Fix it.
      Signed-off-by: NAxel Lin <axel.lin@ingics.com>
      Reviewed-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      fc860356
    • A
      gpio: moxart: Avoid forward declaration · c9e8dbad
      Axel Lin 提交于
      Slightly adjust the code to avoid forward declaration as we need to call
      moxart_gpio_set() in moxart_gpio_direction_output() to properly set the
      output state.
      Signed-off-by: NAxel Lin <axel.lin@ingics.com>
      Reviewed-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      c9e8dbad
    • M
      gpio: mxs: Allow for recursive enable_irq_wake() call · a585f87c
      Marek Vasut 提交于
      The scenario here is that someone calls enable_irq_wake() from somewhere
      in the code. This will result in the lockdep producing a backtrace as can
      be seen below. In my case, this problem is triggered when using the wl1271
      (TI WlCore) driver found in drivers/net/wireless/ti/ .
      
      The problem cause is rather obvious from the backtrace, but let's outline
      the dependency. enable_irq_wake() grabs the IRQ buslock in irq_set_irq_wake(),
      which in turns calls mxs_gpio_set_wake_irq() . But mxs_gpio_set_wake_irq()
      calls enable_irq_wake() again on the one-level-higher IRQ , thus it tries to
      grab the IRQ buslock again in irq_set_irq_wake() . Because the spinlock in
      irq_set_irq_wake()->irq_get_desc_buslock()->__irq_get_desc_lock() is not
      marked as recursive, lockdep will spew the stuff below.
      
      We know we can safely re-enter the lock, so use IRQ_GC_INIT_NESTED_LOCK to
      fix the spew.
      
       =============================================
       [ INFO: possible recursive locking detected ]
       3.10.33-00012-gf06b763-dirty #61 Not tainted
       ---------------------------------------------
       kworker/0:1/18 is trying to acquire lock:
        (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       but task is already holding lock:
        (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       other info that might help us debug this:
        Possible unsafe locking scenario:
      
              CPU0
              ----
         lock(&irq_desc_lock_class);
         lock(&irq_desc_lock_class);
      
        *** DEADLOCK ***
      
        May be due to missing lock nesting notation
      
       3 locks held by kworker/0:1/18:
        #0:  (events){.+.+.+}, at: [<c0036308>] process_one_work+0x134/0x4a4
        #1:  ((&fw_work->work)){+.+.+.}, at: [<c0036308>] process_one_work+0x134/0x4a4
        #2:  (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       stack backtrace:
       CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 3.10.33-00012-gf06b763-dirty #61
       Workqueue: events request_firmware_work_func
       [<c0013eb4>] (unwind_backtrace+0x0/0xf0) from [<c0011c74>] (show_stack+0x10/0x14)
       [<c0011c74>] (show_stack+0x10/0x14) from [<c005bb08>] (__lock_acquire+0x140c/0x1a64)
       [<c005bb08>] (__lock_acquire+0x140c/0x1a64) from [<c005c6a8>] (lock_acquire+0x9c/0x104)
       [<c005c6a8>] (lock_acquire+0x9c/0x104) from [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58)
       [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c00685f0>] (__irq_get_desc_lock+0x48/0x88)
       [<c00685f0>] (__irq_get_desc_lock+0x48/0x88) from [<c0068e78>] (irq_set_irq_wake+0x20/0xf4)
       [<c0068e78>] (irq_set_irq_wake+0x20/0xf4) from [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24)
       [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24) from [<c0068cf4>] (set_irq_wake_real+0x30/0x44)
       [<c0068cf4>] (set_irq_wake_real+0x30/0x44) from [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4)
       [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4) from [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c)
       [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c) from [<c02be5e8>] (request_firmware_work_func+0x38/0x58)
       [<c02be5e8>] (request_firmware_work_func+0x38/0x58) from [<c0036394>] (process_one_work+0x1c0/0x4a4)
       [<c0036394>] (process_one_work+0x1c0/0x4a4) from [<c0036a4c>] (worker_thread+0x138/0x394)
       [<c0036a4c>] (worker_thread+0x138/0x394) from [<c003cb74>] (kthread+0xa4/0xb0)
       [<c003cb74>] (kthread+0xa4/0xb0) from [<c000ee00>] (ret_from_fork+0x14/0x34)
       wlcore: loaded
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Acked-by: NShawn Guo <shawn.guo@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      a585f87c
    • A
      24016ab6
    • A
      gpio: twl4030: Remove redundant assignment · fd0f885b
      Alexander Shiyan 提交于
      Variable "status" is never used, so remove it and add warning if
      any error happen.
      Signed-off-by: NAlexander Shiyan <shc_work@mail.ru>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      fd0f885b
  3. 26 3月, 2014 6 次提交
  4. 25 3月, 2014 2 次提交
  5. 18 3月, 2014 4 次提交
  6. 15 3月, 2014 2 次提交
    • A
      gpio: gpio-dwapb size-cells should be two · 1d4a2166
      Alan Tull 提交于
      Fix size-cells to show use of OF_GPIO_ACTIVE_LOW flag.
      Signed-off-by: NAlan Tull <atull@altera.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      1d4a2166
    • M
      gpio / ACPI: Add support for ACPI GPIO operation regions · 473ed7be
      Mika Westerberg 提交于
      GPIO operation regions is a new feature introduced in ACPI 5.0
      specification. This feature adds a way for platform ASL code to call back
      to OS GPIO driver and toggle GPIO pins.
      
      An example ASL code from Lenovo Miix 2 tablet with only relevant part
      listed:
      
       Device (\_SB.GPO0)
       {
           Name (AVBL, Zero)
           Method (_REG, 2, NotSerialized)
           {
               If (LEqual (Arg0, 0x08))
               {
                   // Marks the region available
                   Store (Arg1, AVBL)
               }
           }
      
           OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
           Field (GPOP, ByteAcc, NoLock, Preserve)
           {
               Connection (
                   GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
                           "\\_SB.GPO0", 0x00, ResourceConsumer,,)
                   {
                       0x003B
                   }
               ),
               SHD3,   1,
           }
       }
      
       Device (SHUB)
       {
           Method (_PS0, 0, Serialized)
           {
               If (LEqual (\_SB.GPO0.AVBL, One))
               {
                   Store (One, \_SB.GPO0.SHD3)
                   Sleep (0x32)
               }
           }
           Method (_PS3, 0, Serialized)
           {
               If (LEqual (\_SB.GPO0.AVBL, One))
               {
                   Store (Zero, \_SB.GPO0.SHD3)
               }
           }
       }
      
      How this works is that whenever _PS0 or _PS3 method is run (typically when
      SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
      the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
      store either 0 or 1 to \_SB.GPO0.SHD3.
      
      Now, when ACPICA notices ACPI GPIO operation region access (the store
      above) it will call acpi_gpio_adr_space_handler() that then toggles the
      GPIO accordingly using standard gpiolib interfaces.
      
      Implement the support by registering GPIO operation region handlers for all
      GPIO devices that have an ACPI handle. First time the GPIO is used by the
      ASL code we make sure that the GPIO stays requested until the GPIO chip
      driver itself is unloaded. If we find out that the GPIO is already
      requested we just toggle it according to the value got from ASL code.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      473ed7be
  7. 14 3月, 2014 3 次提交
    • L
    • L
      Merge tag 'v3.14-rc6' into devel · 9e294427
      Linus Walleij 提交于
      Linux 3.14-rc6
      9e294427
    • A
      gpio: clamp returned values to the boolean range · 23600969
      Alexandre Courbot 提交于
      Nothing prevents GPIO drivers from returning values outside the
      boolean range, and as it turns out a few drivers are actually doing so.
      These values were passed as-is to unsuspecting consumers and created
      confusion.
      
      This patch makes the internal _gpiod_get_raw_value() function return a
      bool, effectively clamping the GPIO value to the boolean range no
      matter what the driver does.
      
      While we are at it, we also change the value parameter of
      _gpiod_set_raw_value() to bool type before drivers start doing funny
      things with it as well.
      
      Another way to fix this would be to change the prototypes of the driver
      interface to use bool directly, but this would require a huge
      cross-systems patch so this simpler solution is preferred.
      
      Changes since v1:
      - Change local variable type to bool as well, use boolean values in
        code
      - Also change prototype of open drain/open source setting functions
        since they are only called from _gpiod_set_raw_value()
      
      This probably calls for a larger booleanization of gpiolib, but let's
      keep that for a latter change - right now we need to address the issue
      of non-boolean values returned by drivers.
      Signed-off-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      23600969
  8. 13 3月, 2014 4 次提交
    • M
      gpio / ACPI: Rework ACPI GPIO event handling · 6072b9dc
      Mika Westerberg 提交于
      The current ACPI GPIO event handling code was never tested against real
      hardware with functioning GPIO triggered events (at the time such hardware
      wasn't available). Thus it misses certain things like requesting the GPIOs
      properly, passing correct flags to the interrupt handler and so on.
      
      This patch reworks ACPI GPIO event handling so that we:
      
       1) Use struct acpi_gpio_event for all GPIO signaled events.
       2) Switch to use GPIO descriptor API and request GPIOs by calling
          gpiochip_request_own_desc() that we added in a previous patch.
       3) Pass proper flags from ACPI GPIO resource to request_threaded_irq().
      
      Also instead of open-coding the _AEI iteration loop we can use
      acpi_walk_resources(). This simplifies the code a bit and fixes memory leak
      that was caused by missing kfree() for buffer returned by
      acpi_get_event_resources().
      
      Since the remove path now calls gpiochip_free_own_desc() which takes GPIO
      spinlock we need to call acpi_gpiochip_remove() outside of that lock
      (analogous to acpi_gpiochip_add() path where the lock is released before
      those funtions are called).
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      6072b9dc
    • M
      gpio / ACPI: Rename acpi_gpio_evt_pin to acpi_gpio_event · 4b01a14b
      Mika Westerberg 提交于
      In order to consolidate _Exx, _Lxx and _EVT to use the same structure make
      the structure name to reflect that we are dealing with any event, not just
      _EVT.
      
      This is just rename, no functional changes.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      4b01a14b
    • M
      gpio / ACPI: Allocate ACPI specific data directly in acpi_gpiochip_add() · aa92b6f6
      Mika Westerberg 提交于
      We are going to add more ACPI specific data to accompany GPIO chip so
      instead of allocating it per each use-case we allocate it once when
      acpi_gpiochip_add() is called and release it when acpi_gpiochip_remove() is
      called.
      
      Doing this allows us to add more ACPI specific data by merely adding new
      fields to struct acpi_gpio_chip.
      
      In addition we embed evt_pins member directly to the structure instead of
      having it as a pointer. This simplifies the code a bit since we don't need
      to check against NULL.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      aa92b6f6
    • M
      gpiolib: Allow GPIO chips to request their own GPIOs · 77c2d792
      Mika Westerberg 提交于
      Sometimes it is useful to allow GPIO chips themselves to request GPIOs they
      own through gpiolib API. One use case is ACPI ASL code that should be able
      to toggle GPIOs through GPIO operation regions.
      
      We can't use gpio_request() because it will pin the module to the kernel
      forever (it calls try_module_get()). To solve this we move module refcount
      manipulation to gpiod_request() and let __gpiod_request() handle the actual
      request. This changes the sequence a bit as now try_module_get() is called
      outside of gpio_lock (I think this is safe, try_module_get() handles
      serialization it needs already).
      
      Then we provide gpiolib internal functions gpiochip_request/free_own_desc()
      that do the same as gpio_request() but don't manipulate module refrence
      count. This allows the GPIO chip driver to request and free descriptors it
      owns without being pinned to the kernel forever.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      77c2d792
  9. 12 3月, 2014 7 次提交
  10. 11 3月, 2014 2 次提交
  11. 10 3月, 2014 1 次提交