02 Feb, 2012

1 commit

  • Commit ca53c5f1ca5c936777caca46b7c716a40682ce83
    ("pinctrl: conjure names for unnamed pins") made pins lose
    their identity and only get autogenerated names.

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

    Linus Walleij
     

26 Jan, 2012

3 commits

  • This is needed as otherwise we can get the following when
    dealing with buggy data in a pinmux driver for
    pinmux_search_function:

    Unable to handle kernel NULL pointer dereference at virtual
    address 00000000
    ...
    PC is at strcmp+0xc/0x34
    LR is at pinmux_get+0x350/0x8f4
    ...

    As we need pctldev initialized to call ops->list_functions,
    let's initialize it before check_ops calls and pass the
    pctldev to the check_ops functions. Do this for both pinmux
    and pinconf check_ops functions.

    Signed-off-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Tony Lindgren
     
  • The ctrl_dev_name is optional for struct pinmux_map assuming
    that ctrl_dev is set. Without this patch we can get:

    Unable to handle kernel NULL pointer dereference at virtual
    address 00000000
    ...
    (pinmux_hog_maps+0xa4/0x20c)
    (pinctrl_register+0x2a4/0x378)
    ...

    Fix this by adding adding a test for map->ctrl_dev.
    Additionally move the test for map->ctrl_dev earlier
    to optimize out the loop a bit.

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

    Tony Lindgren
     
  • Fix some pinmux typos so implementing pinmux drivers
    is a bit easier.

    Signed-off-by: Tony Lindgren
    Signed-off-by: Linus Walleij

    Tony Lindgren
     

25 Jan, 2012

2 commits


21 Jan, 2012

1 commit


03 Jan, 2012

22 commits

  • This patch removes maxpin member in the pin control descriptor
    because we don't need this value as we enumerate a pin space
    using offset.

    Signed-off-by: Chanho Park
    Signed-off-by: Kyungmin Park
    Signed-off-by: Linus Walleij

    Chanho Park
     
  • This patch modifies a offset while enumerating pins to support a
    partial pin space. If we use a pin number for enumerating pins,
    the pin space always starts with zero base. Indeed, we always check
    the pin is in the pin space. An extreme example, there is only two pins.
    One is 0. Another is 1000. We always enumerate whole offsets until 1000.
    For solving this problem, we use the offset of the pin array instead
    of the zero-based pin number.

    Signed-off-by: Chanho Park
    Signed-off-by: Kyungmin Park
    [Restored sparse pin space comment]
    Signed-off-by: Linus Walleij

    Chanho Park
     
  • Minor copyedits.

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

    Dong Aisheng
     
  • For stringent order, rename the pinmux-* pin controllers to
    pinctrl-* and also rename the Kconfig symbols and in-kernel
    users.

    Cc: Rongjun Ying
    Cc: Jean-Christophe PLAGNIOL-VILLARD
    Acked-by: Stephen Warren
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • Obtaining a "struct pinctrl_dev *" is difficult for code not directly
    related to the pinctrl subsystem. However, the device name of the pinctrl
    device is fairly well known. So, modify pin_config_*() to take the device
    name instead of the "struct pinctrl_dev *".

    Signed-off-by: Stephen Warren
    [rebased on top of refactoring code]
    Signed-off-by: Linus Walleij

    Stephen Warren
     
  • If pins with blank names are registered, we assign them names on-the-fly
    on the form "PINn" where n is the pin number for that pin on the specific
    controller.

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

    Linus Walleij
     
  • Pin controllers should already be instantiated as a device, so there's
    no need for the pinctrl core to create a new struct device for each
    controller.

    This allows the controller's real name to be used in the mux mapping
    table, rather than e.g. "pinctrl.0", "pinctrl.1", etc.

    This necessitates removal of the PINMUX_MAP_PRIMARY*() macros, since
    their sole purpose was to hard-code the .ctrl_dev_name field to be
    "pinctrl.0".

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

    Stephen Warren
     
  • This add per-pin and per-group pin config interfaces for biasing,
    driving and other such electronic properties. The details of passed
    configurations are passed in an opaque unsigned long which may be
    dereferences to integer types, structs or lists on either side
    of the configuration interface.

    ChangeLog v1->v2:
    - Clear split of terminology: we now have pin controllers, and
    those may support two interfaces using vtables: pin
    multiplexing and pin configuration.
    - Break out pin configuration to its own C file, controllers may
    implement only config without mux, and vice versa, so keep each
    sub-functionality of pin controllers separate. Introduce
    CONFIG_PINCONF in Kconfig.
    - Implement some core logic around pin configuration in the
    pinconf.c file.
    - Remove UNKNOWN config states, these were just surplus baggage.
    - Remove FLOAT config state - HIGH_IMPEDANCE should be enough for
    everyone.
    - PIN_CONFIG_POWER_SOURCE added to handle switching the power
    supply for the pin logic between different sources
    - Explicit DISABLE config enums to turn schmitt-trigger,
    wakeup etc OFF.
    - Update documentation to reflect all the recent reasoning.
    ChangeLog v2->v3:
    - Twist API around to pass around arrays of config tuples instead
    of (param, value) pairs everywhere.
    - Explicit drive strength semantics for push/pull and similar
    drive modes, this shall be the number of drive stages vs
    nominal load impedance, which should match the actual
    electronics used in push/pull CMOS or TTY totempoles.
    - Drop load capacitance configuration - I probably don't know
    what I'm doing here so leave it out.
    - Drop PIN_CONFIG_INPUT_SCHMITT_OFF, instead the argument zero to
    PIN_CONFIG_INPUT_SCHMITT turns schmitt trigger off.
    - Drop PIN_CONFIG_NORMAL_POWER_MODE and have a well defined
    argument to PIN_CONFIG_LOW_POWER_MODE to get out of it instead.
    - Drop PIN_CONFIG_WAKEUP_ENABLE/DISABLE and just use
    PIN_CONFIG_WAKEUP with defined value zero to turn wakeup off.
    - Add PIN_CONFIG_INPUT_DEBOUNCE for configuring debounce time
    on input lines.
    - Fix a bug when we tried to configure pins for pin controllers
    without pinconf support.
    - Initialized debugfs properly so it works.
    - Initialize the mutex properly and lock around config tampering
    sections.
    - Check the return value from get_initial_config() properly.
    ChangeLog v3->v4:
    - Export the pin_config_get(), pin_config_set() and
    pin_config_group() functions.
    - Drop the entire concept of just getting initial config and
    keeping track of pin states internally, instead ask the pins
    what state they are in. Previous idea was plain wrong, if the
    device cannot keep track of its state, the driver should do
    it.
    - Drop the generic configuration layout, it seems this impose
    too much restriction on some pin controllers, so let them do
    things the way they want and split off support for generic
    config as an optional add-on.
    ChangeLog v4->v5:
    - Introduce two symmetric driver calls for group configuration,
    .pin_config_group_[get|set] and corresponding external calls.
    - Remove generic semantic meanings of return values from config
    calls, these belong in the generic config patch. Just pass the
    return value through instead.
    - Add a debugfs entry "pinconf-groups" to read status from group
    configuration only, also slam in a per-group debug callback in
    the pinconf_ops so custom drivers can display something
    meaningful for their pins.
    - Fix some dangling newline.
    - Drop dangling #else clause.
    - Update documentation to match the above.
    ChangeLog v5->v6:
    - Change to using a pin name as parameter for the
    [get|set]_config() functions, as suggested by Stephen Warren.
    This is more natural as names will be what a developer has
    access to in written documentation etc.
    ChangeLog v6->v7:
    - Refactor out by-pin and by-name get/set functions, only expose
    the by-name functions externally, expose the by-pin functions
    internally.
    - Show supported pin control functionality in the debugfs
    pinctrl-devices file.

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

    Linus Walleij
     
  • This makes the COH 901 driver request muxing of its GPIO pins
    from the pinmux-u300 driver using the standard API calls.

    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • This register the actual GPIO ranges used by the COH901XXX GPIO
    driver.

    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • This driver will be converted to a dual GPIO + pinctrl driver
    since it supports biasing and driving control options. Hopefully
    it can serve as an example.

    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • Since we now anyway make a copy of the platform-supplied pinmux
    map, we can just as well make it possible to call the function
    adding maps several times, so as to simplify cases (as PXA) where
    several sets of disparate mappings need to be added depending on
    target platform.

    Acked-by: Haojian Zhuang
    Acked-by: Arnd Bergmann
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • This makes a deep copy of the pinmux function map instead of
    keeping the copy supplied from the platform around. This makes
    it possible to tag the platforms map with __initdata as is also
    done as part of this patch.

    Rationale: a certain target platform (PXA) has numerous
    pinmux maps, many of which will be lying around unused after
    boot in a multi-platform binary. Instead, deep-copy the one
    we're going to use and tag them all __initdata so they go away
    after boot.

    ChangeLog v1->v2:
    - Fixup the deep copy, missed a few items on the struct,
    plus mark bool member non-const since we're making runtime
    copies if this stuff now.
    ChangeLog v2->v3:
    - Make a shallow copy (just copy the array of map structs)
    as Arnd noticed, string constants never get discarded by the
    kernel anyway, so these pointers may be safely copied over.

    Reviewed-by: Arnd Bergmann
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • When requesting a single GPIO pin to be muxed in, some controllers
    will need to poke a different value into the control register
    depending on whether the pin will be used for GPIO output or GPIO
    input. So create pinmux counterparts to gpio_direction_[input|output]
    in the pinctrl framework.

    ChangeLog v1->v2:
    - This also amends the documentation to make it clear the this
    function and associated machinery is *ONLY* intended as a backend
    to gpiolib machinery, not for everyone and his dog to start playing
    around with pins.
    ChangeLog v2->v3:
    - Don't pass an argument to the common request function, instead
    provide pinmux_* counterparts to the gpio_direction_[input|output]
    calls, simpler and anyone can understand it.
    ChangeLog v3->v4:
    - Fix numerous spelling mistakes and dangling text in documentation.
    Add Ack and Rewewed-by.

    Cc: Igor Grinberg
    Acked-by: Stephen Warren
    Reviewed-by: Thomas Abraham
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • Show the mapped pin range corresponding to the GPIO range in
    debugfs for pin controllers.

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

    Linus Walleij
     
  • This patch enables mapping a base offset of gpio ranges with
    a pin offset even if does'nt matched. A base of pinctrl_gpio_range
    means a base offset of gpio. However, we cannot convert gpio to pin
    number for sparse gpio ranges just only using a gpio base offset.
    We can convert a gpio to real pin number(even if not matched) using
    a new pin_base which means a base pin offset of requested gpio range.
    Now, the pin control subsystem passes the pin base offset to the
    pinmux driver.

    For example, let's assume below two gpio ranges in the system.

    static struct pinctrl_gpio_range gpio_range_a = {
    .name = "chip a",
    .id = 0,
    .base = 32,
    .pin_base = 32,
    .npins = 16,
    .gc = &chip_a;
    };

    static struct pinctrl_gpio_range gpio_range_b = {
    .name = "chip b",
    .id = 0,
    .base = 48,
    .pin_base = 64,
    .npins = 8,
    .gc = &chip_b;
    };

    We can calucalate a exact pin ranges even if doesn't matched with gpio ranges.

    chip a:
    gpio-range : [32 .. 47]
    pin-range : [32 .. 47]
    chip b:
    gpio-range : [48 .. 55]
    pin-range : [64 .. 71]

    Signed-off-by: Chanho Park
    Signed-off-by: Kyungmin Park
    Signed-off-by: Linus Walleij

    Chanho Park
     
  • We want singned pins to mean "invalid" only on the outside
    of the subsystem.

    Signed-off-by: Marek Belisko
    Signed-off-by: Linus Walleij

    Marek BElisko
     
  • Update the docs removing an obsolete __refdata tag and document
    the mysterious return value of pin_free(). And fixes up some various
    confusions in the pinctrl documentation.

    Reported-by: Rajendra Nayak
    Reported-by: Randy Dunlap
    Reported-by: Thomas Abraham
    Reported-by: Uwe Kleine-König
    Acked-by: Stephen Warren
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • Some pinctrl drivers (Tegra at least) program a pin to be a GPIO in a
    completely different manner than they select which function to mux out of
    that pin. In order to support a single "free" pinmux_op, the driver would
    need to maintain a per-pin state of requested-for-gpio vs. requested-for-
    function. However, that's a lot of work when the core already has explicit
    separate paths for gpio request/free and function request/free.

    So, add a gpio_disable_free op to struct pinmux_ops, and make pin_free()
    call it when appropriate.

    When doing this, I noticed that when calling pin_request():

    !!gpio == (gpio_range != NULL)

    ... and so I collapsed those two parameters in both pin_request(), and
    when adding writing the new code in pin_free().

    Also, for pin_free():

    !!free_func == (gpio_range != NULL)

    However, I didn't want pin_free() to know about the GPIO function naming
    special case, so instead, I reworked pin_free() to always return the pin's
    previously requested function, and now pinmux_free_gpio() calls
    kfree(function). This is much more balanced with the allocation having
    been performed in pinmux_request_gpio().

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

    Stephen Warren
     
  • Function pin_is_valid just call pin_desc_get which is in pin_request
    call some line below. Remove pin_is_valid() check.

    Acked-by: Stephen Warren
    Signed-off-by: Marek Belisko
    Signed-off-by: Linus Walleij

    Marek BElisko
     
  • Now also the core needs to look up pin groups so move the lookup
    function there and expose it in the internal header.

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

    Linus Walleij
     
  • Fix u300_pmx_endisable() to iterate over the list of 'bits' and
    'mask' populated as part of u300_pmx_functions.mask[]

    Signed-off-by: Rajendra Nayak
    Signed-off-by: Linus Walleij

    Rajendra Nayak
     

08 Dec, 2011

2 commits


02 Dec, 2011

1 commit


10 Nov, 2011

1 commit

  • Machines that have embedded pin controllers need to select them
    explicitly, so why broadcast their config options to menuconfig.
    We provide a helpful submenu for those machines that do select
    it, making it possible to enable debugging for example.

    Reported-by: Linus Torvalds
    Acked-by: Stephen Warren
    Signed-off-by: Linus Walleij

    Linus Walleij
     

01 Nov, 2011

1 commit


25 Oct, 2011

1 commit


20 Oct, 2011

4 commits

  • Instead, store a pointer to the currently assigned function.

    This allows us to delete the mux_requested variable from pin_desc; a pin
    is requested if its currently assigned function is non-NULL.

    When a pin is requested as a GPIO rather than a regular function, the
    assigned function name is dynamically constructed. In this case, we have
    to kstrdup() the dynamically constructed name, so that mux_function doesn't
    pointed at stack data. This requires pin_free to be told whether to free
    the mux_function pointer or not.

    This removes the hard-coded maximum function name length.

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

    Stephen Warren
     
  • A pin controller's names array is no longer marked __refdata. Hence, we
    can avoid copying a pin's name into the descriptor when registering it.
    Instead, just point at the string supplied in the pin array.

    This both simplifies and speeds up pin controller initialization, but
    also removes the hard-coded maximum pin name length.

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

    Stephen Warren
     
  • A pin controller's pin definitions are used both during pinctrl_register()
    and pinctrl_unregister(). The latter happens outside of __init/__devinit
    time, and hence it is unsafe to mark the pin array as __refdata.

    Acked-by: Barry Song
    Signed-off-by: Stephen Warren
    Signed-off-by: Linus Walleij

    Stephen Warren
     
  • get_group_pins() "returns" a pointer to an array of const objects, through
    a pointer parameter. Fix the prototype so what's pointed at by the returned
    pointer is const, rather than the function parameter being const.

    This also allows the removal of a cast in each of the two current pinmux
    drivers.

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

    Stephen Warren
     

13 Oct, 2011

1 commit