aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib-of.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 01:40:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 01:40:03 -0500
commit8a5dc585d50015af9c079ae2d182dc4c1cd22914 (patch)
tree7544d20587e589bf20c526a5f83205e113cc3e58 /drivers/gpio/gpiolib-of.c
parenteeab517b68beb9e044e869bee18e3bdfa60e5aca (diff)
parent9da8312048edcf246ac1d7ab6aa0293f252de559 (diff)
Merge tag 'pinctrl-for-v3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control updates from Linus Walleij: "Main pin control pull request for the v3.13 cycle. The changes hitting arch/blackfin are ACKed by the Blackfin maintainer, and the device tree bindings are ACKed to the extent possible by someone from the device tree maintainers group. - Blackfin ADI pin control driver, we move yet another architecture under this subsystem umbrella. - Incremental updates to the Renesas Super-H PFC pin control driver. New subdriver for the r8a7791 SoC. - Non-linear GPIO ranges from the gpiolib side of things, this enabled simplified device tree bindings by referring entire groups of pins on some pin controller to act as back-end for a certain GPIO-chip driver. - Add the Abilis TB10x pin control driver used on the ARC architecture. Also the corresponding GPIO driver is merged through this tree, so the ARC has full support for pins and GPIOs after this. - Subdrivers for Freescale i.MX1, i.MX27 and i.MX50 pin controller instances. The i.MX1 and i.MX27 is an entirely new family (silicon) of controllers whereas i.MX50 is a variant of the previous supported controller. - Then the usual slew of fixes, cleanups and incremental updates" The ARC DT changes are apparently still pending, that hopefully gets sorted out in a timely manner. * tag 'pinctrl-for-v3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (48 commits) pinctrl: imx50: add pinctrl support code for the IMX50 SoC pinctrl: at91: copy define to driver pinctrl: remove minor dead code pinctrl: imx: fix using pin->input_val wrongly pinctrl: imx1: fix return value check in imx1_pinctrl_core_probe() gpio: tb10x: fix return value check in tb10x_gpio_probe() gpio: tb10x: use module_platform_driver to simplify the code pinctrl: imx27: imx27 pincontrol driver pinctrl: imx1 core driver pinctrl: sh-pfc: r8a7791 PFC support sh-pfc: r8a7778: Add CAN pin groups gpio: add TB10x GPIO driver pinctrl: at91: correct a few typos pinctrl: mvebu: remove redundant of_match_ptr pinctrl: tb10x: use module_platform_driver to simplify the code pinctrl: tb10x: fix the error handling in tb10x_pinctrl_probe() pinctrl: add documentation for pinctrl_get_group_pins() pinctrl: rockchip: emulate both edge triggered interrupts pinctrl: rockchip: add rk3188 specifics pinctrl: rockchip: remove redundant check ...
Diffstat (limited to 'drivers/gpio/gpiolib-of.c')
-rw-r--r--drivers/gpio/gpiolib-of.c63
1 files changed, 55 insertions, 8 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 0dfaf20e4dad..e78760921bd7 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -190,10 +190,15 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
190 struct of_phandle_args pinspec; 190 struct of_phandle_args pinspec;
191 struct pinctrl_dev *pctldev; 191 struct pinctrl_dev *pctldev;
192 int index = 0, ret; 192 int index = 0, ret;
193 const char *name;
194 static const char group_names_propname[] = "gpio-ranges-group-names";
195 struct property *group_names;
193 196
194 if (!np) 197 if (!np)
195 return; 198 return;
196 199
200 group_names = of_find_property(np, group_names_propname, NULL);
201
197 for (;; index++) { 202 for (;; index++) {
198 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 203 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
199 index, &pinspec); 204 index, &pinspec);
@@ -204,14 +209,56 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
204 if (!pctldev) 209 if (!pctldev)
205 break; 210 break;
206 211
207 ret = gpiochip_add_pin_range(chip, 212 if (pinspec.args[2]) {
208 pinctrl_dev_get_devname(pctldev), 213 if (group_names) {
209 pinspec.args[0], 214 ret = of_property_read_string_index(np,
210 pinspec.args[1], 215 group_names_propname,
211 pinspec.args[2]); 216 index, &name);
212 217 if (strlen(name)) {
213 if (ret) 218 pr_err("%s: Group name of numeric GPIO ranges must be the empty string.\n",
214 break; 219 np->full_name);
220 break;
221 }
222 }
223 /* npins != 0: linear range */
224 ret = gpiochip_add_pin_range(chip,
225 pinctrl_dev_get_devname(pctldev),
226 pinspec.args[0],
227 pinspec.args[1],
228 pinspec.args[2]);
229 if (ret)
230 break;
231 } else {
232 /* npins == 0: special range */
233 if (pinspec.args[1]) {
234 pr_err("%s: Illegal gpio-range format.\n",
235 np->full_name);
236 break;
237 }
238
239 if (!group_names) {
240 pr_err("%s: GPIO group range requested but no %s property.\n",
241 np->full_name, group_names_propname);
242 break;
243 }
244
245 ret = of_property_read_string_index(np,
246 group_names_propname,
247 index, &name);
248 if (ret)
249 break;
250
251 if (!strlen(name)) {
252 pr_err("%s: Group name of GPIO group range cannot be the empty string.\n",
253 np->full_name);
254 break;
255 }
256
257 ret = gpiochip_add_pingroup_range(chip, pctldev,
258 pinspec.args[0], name);
259 if (ret)
260 break;
261 }
215 } 262 }
216} 263}
217 264