1. 16 2月, 2016 1 次提交
    • Y
      pinctrl: samsung: fix SMP race condition · d9ff0eb9
      Youngmin Nam 提交于
      Previously, samsung_gpio_drection_in/output function were not covered
      with a spinlock.
      
      For example, samsung_gpio_direction_output function consists of
      two functions.
      1. samsung_gpio_set
      2. samsung_gpio_set_direction
      
      When 2 CPUs try to control the same gpio pin heavily,
      (situation like i2c control with gpio emulation)
      This situation can cause below problem.
      
      CPU 0                                   | CPU1
                                              |
      samsung_gpio_direction_output           |
         samsung_gpio_set(pin A as 1)         | samsung_gpio_direction_output
                                              |    samsung_gpio_set(pin A as 0)
         samsung_gpio_set_direction           |
                                              |    samsung_gpio_set_direction
      
      The initial value of pin A will be set as 0 while we wanted to set pin A as 1.
      
      This patch modifies samsung_gpio_direction_in/output function
      to be done in one spinlock to fix race condition.
      
      Additionally, the new samsung_gpio_set_value was added to implement
      gpio set callback(samsung_gpio_set) with spinlock using this function.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NYoungmin Nam <ym0914@gmail.com>
      Acked-by: NTomasz Figa <tomasz.figa@gmail.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      d9ff0eb9
  2. 05 1月, 2016 1 次提交
  3. 19 11月, 2015 1 次提交
    • L
      gpio: change member .dev to .parent · 58383c78
      Linus Walleij 提交于
      The name .dev in a struct is normally reserved for a struct device
      that is let us say a superclass to the thing described by the struct.
      struct gpio_chip stands out by confusingly using a struct device *dev
      to point to the parent device (such as a platform_device) that
      represents the hardware. As we want to give gpio_chip:s real devices,
      this is not working. We need to rename this member to parent.
      
      This was done by two coccinelle scripts, I guess it is possible to
      combine them into one, but I don't know such stuff. They look like
      this:
      
      @@
      struct gpio_chip *var;
      @@
      -var->dev
      +var->parent
      
      and:
      
      @@
      struct gpio_chip var;
      @@
      -var.dev
      +var.parent
      
      and:
      
      @@
      struct bgpio_chip *var;
      @@
      -var->gc.dev
      +var->gc.parent
      
      Plus a few instances of bgpio that I couldn't figure out how
      to teach Coccinelle to rewrite.
      
      This patch hits all over the place, but I *strongly* prefer this
      solution to any piecemal approaches that just exercise patch
      mechanics all over the place. It mainly hits drivers/gpio and
      drivers/pinctrl which is my own backyard anyway.
      
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Rafał Miłecki <zajec5@gmail.com>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
      Cc: Alek Du <alek.du@intel.com>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.com>
      Acked-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NLee Jones <lee.jones@linaro.org>
      Acked-by: NJiri Kosina <jkosina@suse.cz>
      Acked-by: NHans-Christian Egtvedt <egtvedt@samfundet.no>
      Acked-by: NJacek Anaszewski <j.anaszewski@samsung.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      58383c78
  4. 16 11月, 2015 1 次提交
  5. 17 10月, 2015 1 次提交
  6. 17 7月, 2015 1 次提交
  7. 10 6月, 2015 1 次提交
  8. 04 6月, 2015 1 次提交
  9. 05 3月, 2015 1 次提交
  10. 09 11月, 2014 6 次提交
  11. 20 10月, 2014 1 次提交
  12. 23 9月, 2014 1 次提交
  13. 04 9月, 2014 1 次提交
  14. 11 7月, 2014 6 次提交
    • S
      pinctrl: samsung: Group all drivers in a sub-dir · ebe629a3
      Sachin Kamat 提交于
      Group all pin control drivers of Samsung platform together in
      a sub-directory for easy maintenance.
      Signed-off-by: NSachin Kamat <sachin.kamat@samsung.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      ebe629a3
    • T
      pinctrl: samsung: Allow pin value to be initialized using pinfunc · 2700bc01
      Tomasz Figa 提交于
      This patch extends the range of settings configurable via pinfunc API
      to cover pin value as well. This allows configuration of default values
      of pins, which is useful for pins that are not supposed to be used by
      any dedicated driver, but need certain board-specific setting.
      Signed-off-by: NTomasz Figa <t.figa@samsung.com>
      Acked-by: NKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      2700bc01
    • T
      pinctrl: samsung: Allow grouping multiple pinmux/pinconf nodes · 9a2c1c3b
      Tomasz Figa 提交于
      One of remaining limitations of current pinctrl-samsung driver was
      the inability to parse multiple pinmux/pinconf group nodes grouped
      inside a single device tree node. It made defining groups of pins for
      single purpose, but with different parameters very inconvenient.
      
      This patch implements Tegra-like support for grouping multiple pinctrl
      groups inside one device tree node, by completely changing the way
      pin groups and functions are parsed from device tree. The code creating
      pinctrl maps from DT nodes has been borrowed from pinctrl-tegra, while
      the initial creation of groups and functions has been completely
      rewritten with following assumptions:
       - each group consists of just one pin and does not depend on data
         from device tree,
       - each function is represented by a device tree child node of the
         pin controller, which in turn can contain multiple child nodes
         for pins that need to have different configuration values.
      
      Device Tree bindings are fully backwards compatible. New functionality
      can be used by defining a new pinctrl group consisting of several child
      nodes, as on following example:
      
      	sd4_bus8: sd4-bus-width8 {
      		part-1 {
      			samsung,pins = "gpk0-3", "gpk0-4",
      					"gpk0-5", "gpk0-6";
      			samsung,pin-function = <3>;
      			samsung,pin-pud = <3>;
      			samsung,pin-drv = <3>;
      		};
      		part-2 {
      			samsung,pins = "gpk1-3", "gpk1-4",
      					"gpk1-5", "gpk1-6";
      			samsung,pin-function = <4>;
      			samsung,pin-pud = <4>;
      			samsung,pin-drv = <3>;
      		};
      	};
      
      Tested on Exynos4210-Trats board and a custom Exynos4212-based one.
      Signed-off-by: NTomasz Figa <t.figa@samsung.com>
      Acked-by: NKyungmin Park <kyungmin.park@samsung.com>
      Reviewed-by: NStephen Warren <swarren@nvidia.com>
      Cc: devicetree@vger.kernel.org
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      9a2c1c3b
    • T
      pinctrl: samsung: Handle GPIO request and free using pinctrl helpers · 6c6ce620
      Tomasz Figa 提交于
      This patch adds .request() and .free() operations to gpio_chip of
      pinctrl-samsung driver, which call pinctrl request and free helpers to
      request and free pinctrl pin along with GPIO pin.
      Signed-off-by: NTomasz Figa <t.figa@samsung.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      6c6ce620
    • T
      pinctrl: samsung: Decouple direction setting from pinctrl · 18c28caa
      Tomasz Figa 提交于
      This patch makes the pinctrl-samsung driver configure GPIO direction on
      its own, without using the pinctrl_gpio_direction_*() "helpers". The
      rationale behind this change is as follows:
       - pinctrl-samsung does not need translation from GPIO namespace to
         pinctrl namespace to handle GPIO operations - GPIO chip and offset
         therein are enough to calculate necessary offsets and bit masks in
         constant time,
       - the pinctrl_gpio_direction_*() functions do not do anything useful
         other than translating the pin into pinctrl namespace and calling the
         .gpio_set_direction() from pinmux_ops of the controller,
       - the undesirable side effect of using those helpers is losing the
         ability to change GPIO direction in atomic context, because they
         explicitly use a mutex for synchronization,
      
      Results of this patch are:
       - fixed warnings about scheduling while atomic in code that needs to
         set GPIO direction in atomic context (e.g. interrupt handler),
       - reduced overhead of bitbanging drivers that use gpio_direction_*(),
         e.g. i2c-gpio.
      Signed-off-by: NTomasz Figa <t.figa@samsung.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      18c28caa
    • F
      pinctrl: avoid duplicated calling enable_pinmux_setting for a pin · 2243a87d
      Fan Wu 提交于
      What the patch does:
      1. Call pinmux_disable_setting ahead of pinmux_enable_setting
        each time pinctrl_select_state is called
      2. Remove the HW disable operation in pinmux_disable_setting function.
      3. Remove the disable ops in struct pinmux_ops
      4. Remove all the disable ops users in current code base.
      
      Notes:
      1. Great thanks for the suggestion from Linus, Tony Lindgren and
         Stephen Warren and Everyone that shared comments on this patch.
      2. The patch also includes comment fixes from Stephen Warren.
      
      The reason why we do this:
      1. To avoid duplicated calling of the enable_setting operation
         without disabling operation inbetween which will let the pin
         descriptor desc->mux_usecount increase monotonously.
      2. The HW pin disable operation is not useful for any of the
         existing platforms.
         And this can be used to avoid the HW glitch after using the
         item #1 modification.
      
      In the following case, the issue can be reproduced:
      1. There is a driver that need to switch pin state dynamically,
         e.g. between "sleep" and "default" state
      2. The pin setting configuration in a DTS node may be like this:
      
        component a {
      	pinctrl-names = "default", "sleep";
      	pinctrl-0 = <&a_grp_setting &c_grp_setting>;
      	pinctrl-1 = <&b_grp_setting &c_grp_setting>;
        }
      
        The "c_grp_setting" config node is totally identical, maybe like
        following one:
      
        c_grp_setting: c_grp_setting {
      	pinctrl-single,pins = <GPIO48 AF6>;
        }
      
      3. When switching the pin state in the following official pinctrl
         sequence:
      	pin = pinctrl_get();
      	state = pinctrl_lookup_state(wanted_state);
      	pinctrl_select_state(state);
      	pinctrl_put();
      
      Test Result:
      1. The switch is completed as expected, that is: the device's
         pin configuration is changed according to the description in the
         "wanted_state" group setting
      2. The "desc->mux_usecount" of the corresponding pins in "c_group"
         is increased without being decreased, because the "desc" is for
         each physical pin while the setting is for each setting node
         in the DTS.
         Thus, if the "c_grp_setting" in pinctrl-0 is not disabled ahead
         of enabling "c_grp_setting" in pinctrl-1, the desc->mux_usecount
         will keep increasing without any chance to be decreased.
      
      According to the comments in the original code, only the setting,
      in old state but not in new state, will be "disabled" (calling
      pinmux_disable_setting), which is correct logic but not intact. We
      still need consider case that the setting is in both old state
      and new state. We can do this in the following two ways:
      
      1. Avoid to "enable"(calling pinmux_enable_setting) the "same pin
         setting" repeatedly
      2. "Disable"(calling pinmux_disable_setting) the "same pin setting",
         actually two setting instances, ahead of enabling them.
      
      Analysis:
      1. The solution #2 is better because it can avoid too much
         iteration.
      2. If we disable all of the settings in the old state and one of
         the setting(s) exist in the new state, the pins mux function
         change may happen when some SoC vendors defined the
         "pinctrl-single,function-off"
         in their DTS file.
         old_setting => disabled_setting => new_setting.
      3. In the pinmux framework, when a pin state is switched, the
         setting in the old state should be marked as "disabled".
      
      Conclusion:
      1. To Remove the HW disabling operation to above the glitch mentioned
         above.
      2. Handle the issue mentioned above by disabling all of the settings
         in old state and then enable the all of the settings in new state.
      Signed-off-by: NFan Wu <fwu@marvell.com>
      Acked-by: NStephen Warren <swarren@nvidia.com>
      Acked-by: NPatrice Chotard <patrice.chotard@st.com>
      Acked-by: NHeiko Stuebner <heiko@sntech.de>
      Acked-by: NMaxime Coquelin <maxime.coquelin@st.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      2243a87d
  15. 23 4月, 2014 1 次提交
  16. 11 2月, 2014 1 次提交
  17. 08 10月, 2013 1 次提交
    • S
      pinctrl: remove redundant of_match_ptr · 606fca94
      Sachin Kamat 提交于
      The data structure of_match_ptr() protects is always compiled in.
      Hence of_match_ptr() is not needed.
      
      This is a squash commit of:
      pinctrl: at91: Remove redundant of_match_ptr
      pinctrl: exynos5440: Remove redundant of_match_ptr
      pinctrl: imx35: Remove redundant of_match_ptr
      pinctrl: imx51: Remove redundant of_match_ptr
      pinctrl: imx53: Remove redundant of_match_ptr
      pinctrl: imx6dl: Remove redundant of_match_ptr
      pinctrl: imx6q: Remove redundant of_match_ptr
      pinctrl: samsung: Remove redundant of_match_ptr
      pinctrl: vf610: Remove redundant of_match_ptr
      pinctrl: imx6sl: Remove redundant of_match_ptr
      pinctrl: plgpio: Remove redundant of_match_ptr
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      606fca94
  18. 28 8月, 2013 2 次提交
  19. 23 8月, 2013 1 次提交
  20. 24 6月, 2013 1 次提交
  21. 19 6月, 2013 1 次提交
  22. 27 5月, 2013 2 次提交
  23. 20 5月, 2013 1 次提交
    • H
      pinctrl: Add pinctrl-s3c24xx driver · af99a750
      Heiko Stuebner 提交于
      The s3c24xx pins follow a similar pattern as the other Samsung SoCs and
      can therefore reuse the already introduced infrastructure.
      
      The s3c24xx SoCs have one design oddity in that the first 4 external
      interrupts do not reside in the eint pending register but in the main
      interrupt controller instead. We solve this by forwarding the external
      interrupt from the main controller into the irq domain of the pin bank.
      The masking/acking of these interrupts is handled in the same way.
      
      Furthermore the S3C2412/2413 SoCs contain another oddity in that they
      keep the same 4 eints in the main interrupt controller and eintpend
      register and requiring ack operations to happen in both. This is solved
      by using different compatible properties for the wakeup eint node which
      set a property accordingly.
      Signed-off-by: NHeiko Stuebner <heiko@sntech.de>
      Reviewed-by: NTomasz Figa <t.figa@samsung.com>
      Reviewed-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NKukjin Kim <kgene.kim@samsung.com>
      af99a750
  24. 18 5月, 2013 1 次提交
  25. 09 4月, 2013 4 次提交