aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-abx500.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-01-21mfd/pinctrl: Delete platform data headerLinus Walleij1-1/+0
This deletes the special AB8500 GPIO platform data passing header and merges the few remaining contents down into the abx500 pinctrl driver which handles the abx500 GPIO device. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-21pinctrl: abx500: Delete non-devicetree probe pathLinus Walleij1-27/+9
All instances of this device are now coming from device tree- enabled platforms probing without using platform data. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-11-25pinctrl: abx500: fix some more bitwise AND testsDan Carpenter1-3/+3
I sent a patch to fix some bitwise AND tests but I guess I missed some. Sorry about that. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-08-28pinctrl: abx500: fix bitwise AND testDan Carpenter1-3/+3
The intent here was to test if the bit was set or not but there is a logical vs bitwise AND typo so it is true if any bits are set. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-08-28pinctrl: Pass all configs to driver on pin_config_set()Sherman Yin1-85/+102
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 <syin@broadcom.com> Reviewed-by: Christian Daudt <csd@broadcom.com> Reviewed-by: Matt Porter <matt.porter@linaro.org> Tested-by: Stephen Warren <swarren@nvidia.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-24pinctrl: abx500: rework error pathPatrice Chotard1-27/+87
At several places, return value was not tested and error output was missing. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-24pinctrl: abx500: suppress hardcoded valuePatrice Chotard1-4/+17
Replace hardcoded value by corresponding #define's. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-24pinctrl: abx500: factorize codePatrice Chotard1-17/+15
Factorize code by adding abx500_pullud_supported() which improve code readability. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-24pinctrl: abx500: fix abx500_gpio_get()Patrice Chotard1-2/+15
- allow to get output GPIO value - as there is no GPIO0 on ABX500, use correct offset with abx500_gpio_get_bit() Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-24pinctrl: abx500: fix abx500_pin_config_set()Patrice Chotard1-6/+25
- Update abx500_pin_config_set() in order to take in account PIN_CONFIG_BIAS_DISABLE state to disable pull up or pull down. - Rework error path. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-24pinctrl: abx500: Add device tree supportPatrice Chotard1-0/+184
We use the same way to define pin muxing and pin configuration than for nomadik. So pickup code from pinctrl_nomadik.c to be able to implement pin multiplexing and pin configuration using the device tree. Pin configuration uses generic parsing code. Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-16pinctrl: abx500: fix build warningPatrice Chotard1-1/+1
pinctrl-abx500.c: In function 'abx500_gpio_dbg_show_one': pinctrl-abx500.c:534:14: warning: 'pud' may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-16pinctrl: abx500: fix abx500_gpio_dbg_show_one() to show pull up/downPatrice Chotard1-16/+70
- rework abx500_gpio_dbg_show_one() to take in account pull up/down feature available on AB8540 only. - add abx500_get_pull_updown() needed by abx500_gpio_dbg_show_one() - rename abx500_config_pull_updown() to abx500_set_pull_updown() Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-16pinctrl: abx500: allow to set pull upPatrice Chotard1-1/+23
On ABx500 chip family, all pins support only pull down except for AB8540 which supports pull up/down on some pins. Rework abx500_pin_config_set to be able to set pull up on pins which support this feature. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-16pinctrl: abx500: fix abx500_config_pull_updownPatrice Chotard1-1/+1
Fix abx500_config_pull_updown() to set correct bit in AB8540_GPIO_PULL_UPDOWN_REG. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-06-16pinctrl: abx500: suppress unused mutexPatrice Chotard1-10/+0
Suppress a mutex which was initialized on probe and destroyed on remove but never used. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-05-14pinctrl: abx500: Rejiggle platform data and DT initialisationLee Jones1-14/+13
Platform Data is invariably populated for this driver, even when booting with Device Tree. Thus the Device Tree probing code encased within the first check for Platform Data will never executed, causing the driver to fail when DT is enabled. This patch fixes the aforementioned regression by rejigging the probe() semantics to attempt to extract a platform ID from Device Tree if one can not be sourced from platform data. A pointer to GPIO platform data is always passed to the driver now, so there's little point in checking for 'pdata' and executing the DT case if it's not there. The difference between booting with DT and !DT is when booting with DT, plat_id is not populated. Thus, in the DT case we have to use a DT match table in order to find out which platform we're executing on. So, we're changing the semantics here to only use the match table if no plat_id is supplied though platform data. Signed-off-by: Lee Jones <lee.jones@linaro.org> [edited commit message] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-05-14pinctrl: abx500: Specify failed sub-driver by ID instead of driver_dataLee Jones1-2/+1
If a sub-driver has not been specified correctly, there is a good chance that plat_id is NULL, hence using an attribute of plat_id in the error message is likely to not only fail the driver but Oops the kernel. Use the failed ID instead. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-04-18pinctrl: abx500: fix issue when no pdataPatrice CHOTARD1-1/+0
Fix an issue when probing pinctrl-abx500 with no platform data. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-04-09pinctrl: abx500: Staticize some symbolsSachin Kamat1-5/+5
These symbols are used only in this file. Without this patch we get the following warnings: drivers/pinctrl/pinctrl-abx500.c:520:5: warning: symbol 'abx500_gpio_request' was not declared. Should it be static? drivers/pinctrl/pinctrl-abx500.c:527:6: warning: symbol 'abx500_gpio_free' was not declared. Should it be static? drivers/pinctrl/pinctrl-abx500.c:614:5: warning: symbol 'abx500_gpio_request_enable' was not declared. Should it be static? drivers/pinctrl/pinctrl-abx500.c:714:5: warning: symbol 'abx500_pin_config_get' was not declared. Should it be static? drivers/pinctrl/pinctrl-abx500.c:721:5: warning: symbol 'abx500_pin_config_set' was not declared. Should it be static? Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-04-03Merge tag 'v3.9-rc5' into develLinus Walleij1-1/+1
Linux 3.9-rc5 Conflicts: drivers/pinctrl/pinconf.c
2013-03-13pinctrl: abx500: Fix checking if pin use AlternateFunction registerAxel Lin1-1/+1
It's pointless to check "af.alt_bit1 == UNUSED" twice. This looks like a copy-paste bug, I think what we want is to check if *both* af.alt_bit1 and af.alt_bit2 are UNUSED. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-03-07pinctrl: abx500: Add terminating entry for of_device_id tableAxel Lin1-0/+1
The of_device_id table is supposed to be zero-terminated. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-03-07pinctrl: Declare operation structures as constLaurent Pinchart1-3/+3
The pinconf, pinctrl and pinmux operation structures hold function pointers that are never modified. Declare them as const. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-10pinctrl/abx500: use direct IRQ definesLinus Walleij1-2/+1
Make it harder to do mistakes by introducing the actual defined ABx500 IRQ number into the IRQ cluster definitions. Deduct cluster offset from the GPIO offset to make each cluster coherent. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-10pinctrl/abx500: replace IRQ offsets with table read-in valuesLee Jones1-7/+11
The ABx500 GPIO controller used to provide a set of virtual contiguous IRQs for use by sub-devices, but they have been removed after a request from Mainline Maintainers. Now the AB8500 core driver deals with almost all IRQ related issues instead. The ABx500 GPIO driver is now only used to convert between GPIO and IRQ numbers which is actually quite difficult, as the ABx500 GPIO's associated IRQs are clustered together throughout the interrupt number space at irregular intervals. To solve this quandary, we have placed the read-in values into the existing cluster information table to use during conversion. Signed-off-by: Lee Jones <lee.jones@linaro.org> [Moved irq_base removal into this patch] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-10pinctrl/abx500: move IRQ handling to ab8500-coreLee Jones1-296/+3
In its current state the gpio-ab8500 driver looks after some GPIO lines found on the AB8500 MFD chip. It also controls all of its own IRQ handling for these GPIOs by inventing some virtual IRQs and handing those out to sub-devices. There has been quite a bit of controversy over this and it was a contributing factor to the driver being marked as BROKEN in Mainline. The reason for adopting this method was due to added complexity in the hardware. Unusually, each GPIO has two separate IRQs associated with it, one for a rising and a different one for a falling interrupt. Using this method complicates matters further because the GPIO IRQs are actually sandwiched between a bunch of IRQs which are handled solely by the AB8500 core driver. The best way for us to take this forward is to get rid of the virtual IRQs and only hand out the rising IRQ lines. If a sub-driver wishes to request a falling interrupt, they can do so by requesting a rising line in the normal way. They just have to add IRQ_TYPE_EDGE_FALLING or IRQ_TYPE_EDGE_BOTH, if they require both in the flags. Then if a falling IRQ is triggered, the AB8500 core driver will know how to handle the added complexity accordingly. This should greatly simply things. Signed-off-by: Lee Jones <lee.jones@linaro.org> [Augment to keep irq_base for a while (removed later)] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-07pinctrl/abx500: adjust offset for get_mode()Linus Walleij1-1/+3
The set_mode() and get_mode() functions in the abx500 were not mirrored, leading to the wrong GPIO control bits being read out. Cc: Lee Jones <lee.jones@linaro.org> Reported-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-06pinctrl/abx500: add Device Tree supportLee Jones1-5/+31
This patch will allow the ABX500 Pinctrl driver to be probed when Device Tree is enabled with an appropriate node contained. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-06pinctrl/abx500: align GPIO cluster boundariesLee Jones1-2/+4
Not quite sure how this ever worked. In ab8500_gpio_to_irq() the GPIO for conversion is passed through as the second argument. If GPIO13, which is a valid GPIO for IRQ functionality, was received; it would be rejected by the following guard: GPIO_IRQ_CLUSTER(5, 12, 0); /* GPIO numbers start from 1 */ if (offset >= cluster->start && offset <= cluster->end) /* Valid GPIO for IRQ use */ Signed-off-by: Lee Jones <lee.jones@linaro.org> [Augmented to account for off-by-one problem] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-06pinctrl/abx500: prevent error path from corrupting returning errorLee Jones1-4/+5
Prior to this patch abx500_gpio_probe() would return the return-value of gpiochip_remove() during its error patch regardless of what the actual failure was. So as long as gpiochip_remove() succeeded, probe() would look like it succeeded too. This patch ensures the correct error value is returned and that mutex_destroy() is invoked if gpiochip_add_pin_range() were to fail. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-05pinctrl/abx500: destroy mutex if returning early due to errorLee Jones1-0/+3
Current failure path neglects to mutex_destroy() before returning an error due to an invalid parameter or an error received from gpiochip_add(). This patch aims to remedy that behaviour. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-05pinctrl/abx500: beautify the ABX500 pin control driverLee Jones1-35/+59
This patch provides some superficial changes to the driver to aid with readability and maintainability. We're mostly fixing things like white-space errors, spreading out code which as been clumped together impeding readability and comment layout, such as using the new "/**" comment start for function headers etc. No code semantics were harmed in the making of this patch. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-05pinctrl/abx500: replace incorrect return valueLee Jones1-2/+1
Currently in the empty abx500_pin_config_get() function, we're returning -EINVAL, with a comment stating that the reason for the failure is that the function isn't implemented yet. Well there's a proper return code for that. If we use it, we can do away with the comment too, as it would be implied. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-05pinctrl/abx500: use the BIT() macro where appropriateLee Jones1-1/+1
The BIT() macro provides a simple and easy to read way of obtaining bit offsets into things like masks and hardware registers. In this patch we're simply replacing all instances of '1 << x' with 'bit(x)'. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-05pinctrl/abx500: add AB8540 sub-driverPatrice Chotard1-0/+3
Add AB8540 sub driver to the ABx500 family, pins, pin groups and gpio range. As the pin controller (also the ABx500 controllers) is an inherent part of the SoC and will prevent boot if not available, select this from the Ux500 SoC Kconfig. Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Patrice Chotard <patrice.chotard@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-05pinctrl/abx500: add AB9540 sub-driverPatrice Chotard1-0/+3
Add AB9540 sub driver to the ABx500 family, pins, pin groups and gpio range. As the pin controller (also the ABx500 controllers) is an inherent part of the SoC and will prevent boot if not available, select this from the Ux500 SoC Kconfig. Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Patrice Chotard <patrice.chotard@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-02-05pinctrl/abx500: add AB8505 sub-driverPatrice Chotard1-0/+3
Add AB8505 sub driver to the ABx5x family. As the pin controller (also the ABx500 controllers) is an inherent part of the SoC and will prevent boot if not available, select this from the Ux500 SoC Kconfig. Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Patrice Chotard <patrice.chotard@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-01-30pinctrl/abx500: add AB8500 sub-driverPatrice Chotard1-0/+3
This adds a subdriver for the AB8500 pinctrl portions. As the pin controller (also the ABx500 controllers) is an inherent part of the SoC and will prevent boot if not available, select this from the Ux500 SoC Kconfig. Acked-by: Olof Johansson <olof@lixom.net> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-01-30pinctrl: add abx500 pinctrl driver corePatrice Chotard1-0/+1233
This adds the AB8500 core driver, which will be utilized by the follow-on drivers for different ABx500 variants. Sselect the driver from the DBX500_SOC, as this chip is powering and clocking that SoC. Cc: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>