14 Aug, 2017

2 commits


22 May, 2017

5 commits


14 Mar, 2017

1 commit


26 Jan, 2017

1 commit

  • When a GPIO driver is backed by a pinctrl driver the GPIO driver
    sometimes needs to call the pinctrl driver to configure certain things,
    like whether the pin is used as input or output. In addition to this
    there are other configurations applicable to GPIOs such as setting
    debounce time of the GPIO.

    To support this we introduce a new function pinctrl_gpio_set_config()
    that can be used by gpiolib based driver to pass configuration requests
    to the backing pinctrl driver.

    Signed-off-by: Mika Westerberg
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Linus Walleij

    Mika Westerberg
     

31 May, 2016

2 commits

  • To improve debugfs readability, use commas instead of whitespaces
    for separating configuration parameters.

    For example, the "pinconf-pins" dump on my board will change as follows:

    Without this commit:

    # head -5 pinconf-pins
    Pin config settings per pin
    Format: pin (name): configs
    pin 0 (ED0): input bias pull down output drive strength (8 mA) input enabled
    pin 1 (ED1): input bias pull down output drive strength (8 mA) input enabled
    pin 2 (ED2): input bias pull down output drive strength (8 mA) input enabled

    With this commit:

    # head -5 pinconf-pins
    Pin config settings per pin
    Format: pin (name): configs
    pin 0 (ED0): input bias pull down, output drive strength (8 mA), input enabled
    pin 1 (ED1): input bias pull down, output drive strength (8 mA), input enabled
    pin 2 (ED2): input bias pull down, output drive strength (8 mA), input enabled

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Linus Walleij

    Masahiro Yamada
     
  • If a pin name is not specified in struct pinctrl_pin_desc,
    pinctrl_register_one_pin() dynamically assigns its name.
    So, desc->name is always a valid pointer here.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Linus Walleij

    Masahiro Yamada
     

01 Nov, 2015

1 commit


03 Aug, 2015

1 commit


18 Jul, 2015

1 commit


17 Jul, 2015

2 commits

  • The function pinconf_dbg_config_print() only prints the configuration of
    the 1st pin config in an array of pin configurations. Fix this so that
    all pin configurations in the array are displayed.

    There are a few places in the code where the pin configs are displayed
    and so add a helper function to display the pin configs to simplify the
    code.

    Signed-off-by: Jon Hunter
    Signed-off-by: Linus Walleij

    Jon Hunter
     
  • The function pinconf_dbg_config_write() currently only supports configuring
    a pin configuration mapping via the debugfs. Allow group mappings to also
    be configured via the debugfs.

    Signed-off-by: Jon Hunter
    Signed-off-by: Linus Walleij

    Jon Hunter
     

12 Jan, 2015

1 commit

  • Additionally to the generic DT parameters, allow drivers to provide
    driver-specific DT parameters to be used with the generic parser
    infrastructure.

    To achieve this 'struct pinctrl_desc' is extended to pass custom pinconf
    option to the core. In order to pass this kind of information, the
    related data structures - 'struct pinconf_generic_dt_params',
    'pin_config_item' - are moved from pinconf internals to the
    pinconf-generic header.

    Additionally pinconfg-generic is refactored to not only iterate over the
    generic pinconf parameters but also take the parameters into account
    that are provided through the driver's 'struct pinctrl_desc'.
    In particular 'pinconf_generic_parse_dt_config()' and
    'pinconf_generic_dump' helpers are split into two parts each. In order
    to have a more generic helper that can be used to process the generic
    parameters as well as the driver-specific ones.

    v2:
    - fix typo
    - add missing documentation for @conf_items member in struct
    - rebase to pinctrl/devel: conflict in abx500
    - rename _pinconf_generic_dump() to pinconf_generic_dump_one()
    - removed '_' from _parse_dt_cfg()
    - removed BUG_ONs, error condition is handled in if statements
    - removed pinconf_generic_dump_group() & pinconf_generic_dump_pin
    helpers
    - fixed up corresponding call sites
    - renamed pinconf_generic_dump() to pinconf_generic_dump_pins()
    - added kernel-doc to pinconf_generic_dump_pins()
    - add kernel-doc
    - more verbose commit message

    Signed-off-by: Soren Brinkmann
    Tested-by: Andreas Färber
    Signed-off-by: Linus Walleij

    Soren Brinkmann
     

13 Dec, 2013

2 commits

  • Signed-off-by: Alexandre Belloni
    Signed-off-by: Linus Walleij

    Alexandre Belloni
     
  • ops->pin_config_get() is only used in one specific path that will only be taken
    for generic pinconf drivers (ops->is_generic == true) when dumping the pinconf
    by using debugfs.

    By removing the check in pinconf_check_ops(), let's stop pressuring people to
    write a pin_config_get() function that will never be used and so will probably
    never be tested.

    Removing the check in pinconf_pins_show() allows driver to not implement
    pin_config_get() but still get a dump of the pinconf in debugfs by implementing
    pin_config_dbg_show().

    Finally, not implementing pin_config_get() now results in returning -ENOTSUPP
    instead of -EINVAL. While this doesn't have any real impact for now, this feels
    more right.

    Signed-off-by: Alexandre Belloni
    Signed-off-by: Linus Walleij

    Alexandre Belloni
     

23 Sep, 2013

2 commits

  • sizeof() is already size_t so there is no need to cast here. Generally,
    casting inside the min() macro instead of using min_t() is considered
    bad style.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Linus Walleij

    Dan Carpenter
     
  • Have pinconf_dbg_config_write() return a ssize_t. This fixes the following
    compilation warning:

    drivers/pinctrl/pinconf.c:617:2: warning: initialization from incompatible pointer type [enabled by default]
    drivers/pinctrl/pinconf.c:617:2: warning: (near initialization for ‘pinconf_dbg_pinconfig_fops.write’) [enabled by default]

    Signed-off-by: Vincent Stehlé
    Cc: Linus Walleij
    Signed-off-by: Linus Walleij

    Vincent Stehlé
     

28 Aug, 2013

1 commit

  • When setting pin configuration in the pinctrl framework, pin_config_set() or
    pin_config_group_set() is called in a loop to set one configuration at a time
    for the specified pin or group.

    This patch 1) removes the loop and 2) changes the API to pass the whole pin
    config array to the driver. It is now up to the driver to loop through the
    configs. This allows the driver to potentially combine configs and reduce the
    number of writes to pin config registers.

    All c files changed have been build-tested to verify the change compiles and
    that the corresponding .o is successfully generated.

    Signed-off-by: Sherman Yin
    Reviewed-by: Christian Daudt
    Reviewed-by: Matt Porter
    Tested-by: Stephen Warren
    Acked-by: Laurent Pinchart
    Signed-off-by: Linus Walleij

    Sherman Yin
     

08 Aug, 2013

2 commits

  • Fix the following sparse warning:

    drivers/pinctrl/pinconf.c:521:20: error: incompatible types in comparison expression (different type sizes)

    Signed-off-by: Jingoo Han
    Signed-off-by: Linus Walleij

    Jingoo Han
     
  • So, I notice that we get a couple of warnings from the pinctrl code:

    drivers/pinctrl/pinconf.c: In function 'pinconf_dbg_config_print':
    drivers/pinctrl/pinconf.c:433:36: warning: 'configs' may be used uninitialized in this function
    drivers/pinctrl/pinconf.c: In function 'pinconf_dbg_config_write':
    drivers/pinctrl/pinconf.c:511:36: warning: 'configs' may be used uninitialized in this function

    While the compiler might not be able to work out that "configs" is
    safe, the code doesn't lend itself very well to identifying that
    fact when reading it either. This can be trivially solved by a slight
    restructuring of the code - which also reduces the LOC.

    Signed-off-by: Russell King
    Signed-off-by: Linus Walleij

    Russell King - ARM Linux
     

25 Jun, 2013

1 commit

  • From the inception ot the pin config API there has been the
    possibility to get a handle at a pin directly and configure
    its electrical characteristics. For this reason we had:

    int pin_config_get(const char *dev_name, const char *name,
    unsigned long *config);
    int pin_config_set(const char *dev_name, const char *name,
    unsigned long config);
    int pin_config_group_get(const char *dev_name,
    const char *pin_group,
    unsigned long *config);
    int pin_config_group_set(const char *dev_name,
    const char *pin_group,
    unsigned long config);

    After the introduction of the pin control states that will
    control pins associated with devices, and its subsequent
    introduction to the device core, as well as the
    introduction of pin control hogs that can set up states on
    boot and optionally also at sleep, this direct pin control
    API is a thing of the past.

    As could be expected, it has zero in-kernel users.
    Let's delete this API and make our world simpler.

    Reported-by: Tony Lindgren
    Reviewed-by: Stephen Warren
    Acked-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Linus Walleij
     

27 May, 2013

1 commit


26 Apr, 2013

2 commits

  • This mutex avoids deadlock in case of use of multiple pin
    controllers. Before this modification, by using a global
    mutex, deadlock appeared when, for example, a call to
    pinctrl_pins_show() locked the pinctrl_mutex, called the
    ops->pin_dbg_show of a particular pin controller. If this
    pin controller needs I2C access to retrieve configuration
    information and I2C driver is using pinctrl to drive its
    pins, a call to pinctrl_select_state() try to lock again
    pinctrl_mutex which leads to a deadlock.

    Notice that the mutex grab from the two direction functions
    was moved into pinctrl_gpio_direction().

    For several cases, we can't replace pinctrl_mutex by
    pctldev->mutex, because at this stage, pctldev is
    not accessible :
    - pinctrl_get()/pinctrl_put()
    - pinctrl_register_maps()

    So add respectively pinctrl_list_mutex and
    pinctrl_maps_mutex in order to protect
    pinctrl_list and pinctrl_maps list instead.

    Reintroduce pinctrldev_list_mutex in
    find_pinctrl_by_of_node(),
    pinctrl_find_and_add_gpio_range()
    pinctrl_request_gpio(), pinctrl_free_gpio(),
    pinctrl_gpio_direction(), pinctrl_devices_show(),
    pinctrl_register() and pinctrl_unregister() to
    protect pinctrldev_list.

    Changes v2->v3:
    - Fix a missing EXPORT_SYMBOL_GPL() for pinctrl_select_state().

    Changes v1->v2:
    - pinctrl_select_state_locked() is removed, all lock mechanism
    is located inside pinctrl_select_state(). When parsing
    the state->setting list, take the per-pin-controller driver
    lock. (Patrice).
    - Introduce pinctrldev_list_mutex to protect pinctrldev_list
    in all functions which parse or modify pictrldev_list.
    (Patrice).
    - move find_pinctrl_by_of_node() from pinctrl/devicetree.c to
    pinctrl/core.c in order to protect pinctrldev_list.
    (Patrice).
    - Sink mutex:es into some functions and remove some _locked
    variants down to where the lists are actually accessed to
    make things simpler. (Linus)
    - Drop *all* mutexes completely from pinctrl_lookup_state()
    and pinctrl_select_state() - no relevant mutex was taken
    and it was unclear what this was protecting against. (Linus)

    Reported by : Seraphin Bonnaffe
    Signed-off-by: Patrice Chotard
    Signed-off-by: Linus Walleij

    Patrice Chotard
     
  • This update contains a basic fix that went unseen through
    test and review.

    Signed-off-by: Laurent Meunier
    Reviewed-by: Patrice Chotard
    Signed-off-by: Linus Walleij

    Laurent Meunier
     

19 Apr, 2013

1 commit

  • This update adds a debugfs interface to modify a pin configuration
    for a given state in the pinctrl map. This allows to modify the
    configuration for a non-active state, typically sleep state.
    This configuration is not applied right away, but only when the state
    will be entered.

    This solution is mandated for us by HW validation: in order
    to test and verify several pin configurations during sleep without
    recompiling the software.

    Change log in this patch set;
    Take into account latest feedback from Stephen Warren:
    - stale comments update
    - improved code efficiency and readibility
    - limit size of global variable pinconf_dbg_conf
    - remove req_type as it can easily be added later when
    add/delete requests support is implemented

    Signed-off-by: Laurent Meunier
    Signed-off-by: Linus Walleij

    Laurent Meunier
     

04 Apr, 2013

1 commit


07 Mar, 2013

1 commit


11 Feb, 2013

1 commit

  • This update adds a debugfs interface to modify a pin configuration
    for a given state in the pinctrl map. This allows to modify the
    configuration for a non-active state, typically sleep state.
    This configuration is not applied right away, but only when the state
    will be entered.

    This solution is mandated for us by HW validation: in order
    to test and verify several pin configurations during sleep without
    recompiling the software.

    Signed-off-by: Laurent Meunier
    Signed-off-by: Linus Walleij

    Laurent Meunier
     

19 Oct, 2012

1 commit


15 May, 2012

1 commit


27 Apr, 2012

1 commit

  • There are a few places in the api where the code simply returns -EINVAL when
    it finds an error. An example is pinmux_map_to_setting() which now reports an
    error if we try to match a group with a function that it does not support.

    The reporting of errors in pinconf_check_ops and pinmux_check_ops now has the
    same style and is located inside the according functions and not the calling
    code.

    When the map is found in the DT but the default state can not be selected we
    get an error to know that the code at least tried.

    The patch also removes a stray word from one comment and a "->" from another
    for the sake of consistency.

    Finally we replace a few pr_err/debug() calls with dev_err/dbg().

    Thanks go to Stephen Warren for reviewing the patch and enhancing the reporting
    inside pinmux_map_to_setting().

    Signed-off-by: John Crispin
    Acked-by: Stephen Warren
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Linus Walleij

    John Crispin
     

18 Apr, 2012

4 commits

  • Signed-off-by: Dong Aisheng
    Signed-off-by: Linus Walleij

    Dong Aisheng
     
  • Add a pinconf op so that pin controller drivers can decode their pin
    config settings for debugfs.

    Signed-off-by: Stephen Warren
    Signed-off-by: Linus Walleij

    Stephen Warren
     
  • This patch can avoid kernel oops in case the mux or config
    function is not supported by driver.

    Acked-by: Stephen Warren
    Signed-off-by: Dong Aisheng
    Signed-off-by: Linus Walleij

    Dong Aisheng
     
  • Most of the SoC drivers implement list_groups() and list_functions()
    routines for pinctrl and pinmux. These routines continue returning
    zero until the selector argument is greater than total count of
    available groups or functions.

    This patch replaces these list_*() routines with get_*_count()
    routines, which returns the number of available selection for SoC
    driver. pinctrl layer will use this value to check the range it can
    choose.

    This patch fixes all user drivers for this change. There are other
    routines in user drivers, which have checks to check validity of
    selector passed to them. It is also no more required and hence
    removed.

    Documentation updated as well.

    Acked-by: Stephen Warren
    Signed-off-by: Viresh Kumar
    [Folded in fix and fixed a minor merge artifact manually]
    Signed-off-by: Linus Walleij

    Viresh Kumar
     

13 Mar, 2012

1 commit

  • This is a split-off from the earlier patch set which adds generic
    pin configuration for the pin controllers that want it. Since
    we may have a system with mixed generic and custom pin controllers,
    we pass a boolean in the pin controller ops vtable to indicate
    if it is generic.

    ChangeLog v1->v5:
    - Follow parent patch versioning number system.
    - Document the semantic meaning of return values from pin config
    get functions, so we can iterate over pins and check their
    properties from debugfs as part of the generic config code.
    - Use proper cast functions in the generic debugfs pin config
    file.
    - Expand generic config to optionally cover groups too.
    ChangeLog v5->v6:
    - Update to match underlying changes.
    ChangeLog v6->v7:
    - Drop DRIVE_OFF parameter, use bias high impedance for this
    - Delete argument for drive modes push-pull, od and os. These
    are now just state transitions.
    - Delete slew rate rising/falling due to discussions on on
    proper semantics
    - Drop config wakeup, struct irq_chip does this for now, add
    back if need be.
    - Set PIN_CONFIG_END to 0x7fff making room for custom config
    parameters from 0x8000 and up.
    - Prefix accessor functions with pinconf_

    Linus Walleij