diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2012-02-09 01:23:28 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-02-10 15:33:02 -0500 |
commit | e93bcee00c43e2bd4037291262111016f4c05793 (patch) | |
tree | e69b5f7ffffb36096949eabdc0526173b25f695d /drivers | |
parent | 28a8d14cc74a0180323d9150c3d3dbf9dd60d55a (diff) |
pinctrl: move generic functions to the pinctrl_ namespace
Since we want to use the former pinmux handles and mapping tables for
generic control involving both muxing and configuration we begin
refactoring by renaming them from pinmux_* to pinctrl_*.
ChangeLog v1->v2:
- Also rename the PINMUX_* macros in machine.h to PIN_ as indicated
in the documentation so as to reflect the generic nature of these
mapping entries from now on.
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pinctrl/core.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/core.h | 8 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-coh901.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/pinmux.c | 351 | ||||
-rw-r--r-- | drivers/pinctrl/pinmux.h | 8 |
5 files changed, 188 insertions, 187 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 4f10476cc1f2..75c6a6bb6c0a 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -624,7 +624,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
624 | mutex_lock(&pinctrldev_list_mutex); | 624 | mutex_lock(&pinctrldev_list_mutex); |
625 | list_add(&pctldev->node, &pinctrldev_list); | 625 | list_add(&pctldev->node, &pinctrldev_list); |
626 | mutex_unlock(&pinctrldev_list_mutex); | 626 | mutex_unlock(&pinctrldev_list_mutex); |
627 | pinmux_hog_maps(pctldev); | 627 | pinctrl_hog_maps(pctldev); |
628 | return pctldev; | 628 | return pctldev; |
629 | 629 | ||
630 | out_err: | 630 | out_err: |
@@ -645,7 +645,7 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev) | |||
645 | return; | 645 | return; |
646 | 646 | ||
647 | pinctrl_remove_device_debugfs(pctldev); | 647 | pinctrl_remove_device_debugfs(pctldev); |
648 | pinmux_unhog_maps(pctldev); | 648 | pinctrl_unhog_maps(pctldev); |
649 | /* TODO: check that no pinmuxes are still active? */ | 649 | /* TODO: check that no pinmuxes are still active? */ |
650 | mutex_lock(&pinctrldev_list_mutex); | 650 | mutex_lock(&pinctrldev_list_mutex); |
651 | list_del(&pctldev->node); | 651 | list_del(&pctldev->node); |
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h index 8a8b02e9c18e..7a89888fce94 100644 --- a/drivers/pinctrl/core.h +++ b/drivers/pinctrl/core.h | |||
@@ -28,8 +28,8 @@ struct pinctrl_gpio_range; | |||
28 | * @owner: module providing the pin controller, used for refcounting | 28 | * @owner: module providing the pin controller, used for refcounting |
29 | * @driver_data: driver data for drivers registering to the pin controller | 29 | * @driver_data: driver data for drivers registering to the pin controller |
30 | * subsystem | 30 | * subsystem |
31 | * @pinmux_hogs_lock: lock for the pinmux hog list | 31 | * @pinctrl_hogs_lock: lock for the pin control hog list |
32 | * @pinmux_hogs: list of pinmux maps hogged by this device | 32 | * @pinctrl_hogs: list of pin control maps hogged by this device |
33 | */ | 33 | */ |
34 | struct pinctrl_dev { | 34 | struct pinctrl_dev { |
35 | struct list_head node; | 35 | struct list_head node; |
@@ -45,8 +45,8 @@ struct pinctrl_dev { | |||
45 | struct dentry *device_root; | 45 | struct dentry *device_root; |
46 | #endif | 46 | #endif |
47 | #ifdef CONFIG_PINMUX | 47 | #ifdef CONFIG_PINMUX |
48 | struct mutex pinmux_hogs_lock; | 48 | struct mutex pinctrl_hogs_lock; |
49 | struct list_head pinmux_hogs; | 49 | struct list_head pinctrl_hogs; |
50 | #endif | 50 | #endif |
51 | }; | 51 | }; |
52 | 52 | ||
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index 8bac3f093d58..eba232a46a82 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c | |||
@@ -360,14 +360,14 @@ static int u300_gpio_request(struct gpio_chip *chip, unsigned offset) | |||
360 | */ | 360 | */ |
361 | int gpio = chip->base + offset; | 361 | int gpio = chip->base + offset; |
362 | 362 | ||
363 | return pinmux_request_gpio(gpio); | 363 | return pinctrl_request_gpio(gpio); |
364 | } | 364 | } |
365 | 365 | ||
366 | static void u300_gpio_free(struct gpio_chip *chip, unsigned offset) | 366 | static void u300_gpio_free(struct gpio_chip *chip, unsigned offset) |
367 | { | 367 | { |
368 | int gpio = chip->base + offset; | 368 | int gpio = chip->base + offset; |
369 | 369 | ||
370 | pinmux_free_gpio(gpio); | 370 | pinctrl_free_gpio(gpio); |
371 | } | 371 | } |
372 | 372 | ||
373 | static int u300_gpio_get(struct gpio_chip *chip, unsigned offset) | 373 | static int u300_gpio_get(struct gpio_chip *chip, unsigned offset) |
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 1311f1d22002..773835d18f55 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Core driver for the pin muxing portions of the pin control subsystem | 2 | * Core driver for the pin muxing portions of the pin control subsystem |
3 | * | 3 | * |
4 | * Copyright (C) 2011 ST-Ericsson SA | 4 | * Copyright (C) 2011-2012 ST-Ericsson SA |
5 | * Written on behalf of Linaro for ST-Ericsson | 5 | * Written on behalf of Linaro for ST-Ericsson |
6 | * Based on bits of regulator core, gpio core and clk core | 6 | * Based on bits of regulator core, gpio core and clk core |
7 | * | 7 | * |
@@ -29,13 +29,13 @@ | |||
29 | #include <linux/pinctrl/pinmux.h> | 29 | #include <linux/pinctrl/pinmux.h> |
30 | #include "core.h" | 30 | #include "core.h" |
31 | 31 | ||
32 | /* List of pinmuxes */ | 32 | /* List of pin controller handles */ |
33 | static DEFINE_MUTEX(pinmux_list_mutex); | 33 | static DEFINE_MUTEX(pinctrl_list_mutex); |
34 | static LIST_HEAD(pinmux_list); | 34 | static LIST_HEAD(pinctrl_list); |
35 | 35 | ||
36 | /* Global pinmux maps */ | 36 | /* Global pinctrl maps */ |
37 | static struct pinmux_map *pinmux_maps; | 37 | static struct pinctrl_map *pinctrl_maps; |
38 | static unsigned pinmux_maps_num; | 38 | static unsigned pinctrl_maps_num; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * struct pinmux_group - group list item for pinmux groups | 41 | * struct pinmux_group - group list item for pinmux groups |
@@ -48,12 +48,12 @@ struct pinmux_group { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * struct pinmux - per-device pinmux state holder | 51 | * struct pinctrl - per-device pin control state holder |
52 | * @node: global list node | 52 | * @node: global list node |
53 | * @dev: the device using this pinmux | 53 | * @dev: the device using this pin control handle |
54 | * @usecount: the number of active users of this mux setting, used to keep | 54 | * @usecount: the number of active users of this pin controller setting, used |
55 | * track of nested use cases | 55 | * to keep track of nested use cases |
56 | * @pctldev: pin control device handling this pinmux | 56 | * @pctldev: pin control device handling this pin control handle |
57 | * @func_selector: the function selector for the pinmux device handling | 57 | * @func_selector: the function selector for the pinmux device handling |
58 | * this pinmux | 58 | * this pinmux |
59 | * @groups: the group selectors for the pinmux device and | 59 | * @groups: the group selectors for the pinmux device and |
@@ -62,7 +62,7 @@ struct pinmux_group { | |||
62 | * get/put/enable/disable | 62 | * get/put/enable/disable |
63 | * @mutex: a lock for the pinmux state holder | 63 | * @mutex: a lock for the pinmux state holder |
64 | */ | 64 | */ |
65 | struct pinmux { | 65 | struct pinctrl { |
66 | struct list_head node; | 66 | struct list_head node; |
67 | struct device *dev; | 67 | struct device *dev; |
68 | unsigned usecount; | 68 | unsigned usecount; |
@@ -73,15 +73,15 @@ struct pinmux { | |||
73 | }; | 73 | }; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * struct pinmux_hog - a list item to stash mux hogs | 76 | * struct pinctrl_hog - a list item to stash control hogs |
77 | * @node: pinmux hog list node | 77 | * @node: pin control hog list node |
78 | * @map: map entry responsible for this hogging | 78 | * @map: map entry responsible for this hogging |
79 | * @pmx: the pinmux hogged by this item | 79 | * @pmx: the pin control hogged by this item |
80 | */ | 80 | */ |
81 | struct pinmux_hog { | 81 | struct pinctrl_hog { |
82 | struct list_head node; | 82 | struct list_head node; |
83 | struct pinmux_map const *map; | 83 | struct pinctrl_map const *map; |
84 | struct pinmux *pmx; | 84 | struct pinctrl *p; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /** | 87 | /** |
@@ -207,14 +207,14 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin, | |||
207 | } | 207 | } |
208 | 208 | ||
209 | /** | 209 | /** |
210 | * pinmux_request_gpio() - request a single pin to be muxed in as GPIO | 210 | * pinctrl_request_gpio() - request a single pin to be used in as GPIO |
211 | * @gpio: the GPIO pin number from the GPIO subsystem number space | 211 | * @gpio: the GPIO pin number from the GPIO subsystem number space |
212 | * | 212 | * |
213 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, | 213 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, |
214 | * as part of their gpio_request() semantics, platforms and individual drivers | 214 | * as part of their gpio_request() semantics, platforms and individual drivers |
215 | * shall *NOT* request GPIO pins to be muxed in. | 215 | * shall *NOT* request GPIO pins to be muxed in. |
216 | */ | 216 | */ |
217 | int pinmux_request_gpio(unsigned gpio) | 217 | int pinctrl_request_gpio(unsigned gpio) |
218 | { | 218 | { |
219 | char gpiostr[16]; | 219 | char gpiostr[16]; |
220 | const char *function; | 220 | const char *function; |
@@ -243,17 +243,17 @@ int pinmux_request_gpio(unsigned gpio) | |||
243 | 243 | ||
244 | return ret; | 244 | return ret; |
245 | } | 245 | } |
246 | EXPORT_SYMBOL_GPL(pinmux_request_gpio); | 246 | EXPORT_SYMBOL_GPL(pinctrl_request_gpio); |
247 | 247 | ||
248 | /** | 248 | /** |
249 | * pinmux_free_gpio() - free a single pin, currently used as GPIO | 249 | * pinctrl_free_gpio() - free control on a single pin, currently used as GPIO |
250 | * @gpio: the GPIO pin number from the GPIO subsystem number space | 250 | * @gpio: the GPIO pin number from the GPIO subsystem number space |
251 | * | 251 | * |
252 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, | 252 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, |
253 | * as part of their gpio_free() semantics, platforms and individual drivers | 253 | * as part of their gpio_free() semantics, platforms and individual drivers |
254 | * shall *NOT* request GPIO pins to be muxed out. | 254 | * shall *NOT* request GPIO pins to be muxed out. |
255 | */ | 255 | */ |
256 | void pinmux_free_gpio(unsigned gpio) | 256 | void pinctrl_free_gpio(unsigned gpio) |
257 | { | 257 | { |
258 | struct pinctrl_dev *pctldev; | 258 | struct pinctrl_dev *pctldev; |
259 | struct pinctrl_gpio_range *range; | 259 | struct pinctrl_gpio_range *range; |
@@ -271,9 +271,9 @@ void pinmux_free_gpio(unsigned gpio) | |||
271 | func = pin_free(pctldev, pin, range); | 271 | func = pin_free(pctldev, pin, range); |
272 | kfree(func); | 272 | kfree(func); |
273 | } | 273 | } |
274 | EXPORT_SYMBOL_GPL(pinmux_free_gpio); | 274 | EXPORT_SYMBOL_GPL(pinctrl_free_gpio); |
275 | 275 | ||
276 | static int pinmux_gpio_direction(unsigned gpio, bool input) | 276 | static int pinctrl_gpio_direction(unsigned gpio, bool input) |
277 | { | 277 | { |
278 | struct pinctrl_dev *pctldev; | 278 | struct pinctrl_dev *pctldev; |
279 | struct pinctrl_gpio_range *range; | 279 | struct pinctrl_gpio_range *range; |
@@ -299,36 +299,36 @@ static int pinmux_gpio_direction(unsigned gpio, bool input) | |||
299 | } | 299 | } |
300 | 300 | ||
301 | /** | 301 | /** |
302 | * pinmux_gpio_direction_input() - request a GPIO pin to go into input mode | 302 | * pinctrl_gpio_direction_input() - request a GPIO pin to go into input mode |
303 | * @gpio: the GPIO pin number from the GPIO subsystem number space | 303 | * @gpio: the GPIO pin number from the GPIO subsystem number space |
304 | * | 304 | * |
305 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, | 305 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, |
306 | * as part of their gpio_direction_input() semantics, platforms and individual | 306 | * as part of their gpio_direction_input() semantics, platforms and individual |
307 | * drivers shall *NOT* touch pinmux GPIO calls. | 307 | * drivers shall *NOT* touch pin control GPIO calls. |
308 | */ | 308 | */ |
309 | int pinmux_gpio_direction_input(unsigned gpio) | 309 | int pinctrl_gpio_direction_input(unsigned gpio) |
310 | { | 310 | { |
311 | return pinmux_gpio_direction(gpio, true); | 311 | return pinctrl_gpio_direction(gpio, true); |
312 | } | 312 | } |
313 | EXPORT_SYMBOL_GPL(pinmux_gpio_direction_input); | 313 | EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input); |
314 | 314 | ||
315 | /** | 315 | /** |
316 | * pinmux_gpio_direction_output() - request a GPIO pin to go into output mode | 316 | * pinctrl_gpio_direction_output() - request a GPIO pin to go into output mode |
317 | * @gpio: the GPIO pin number from the GPIO subsystem number space | 317 | * @gpio: the GPIO pin number from the GPIO subsystem number space |
318 | * | 318 | * |
319 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, | 319 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, |
320 | * as part of their gpio_direction_output() semantics, platforms and individual | 320 | * as part of their gpio_direction_output() semantics, platforms and individual |
321 | * drivers shall *NOT* touch pinmux GPIO calls. | 321 | * drivers shall *NOT* touch pin control GPIO calls. |
322 | */ | 322 | */ |
323 | int pinmux_gpio_direction_output(unsigned gpio) | 323 | int pinctrl_gpio_direction_output(unsigned gpio) |
324 | { | 324 | { |
325 | return pinmux_gpio_direction(gpio, false); | 325 | return pinctrl_gpio_direction(gpio, false); |
326 | } | 326 | } |
327 | EXPORT_SYMBOL_GPL(pinmux_gpio_direction_output); | 327 | EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output); |
328 | 328 | ||
329 | /** | 329 | /** |
330 | * pinmux_register_mappings() - register a set of pinmux mappings | 330 | * pinctrl_register_mappings() - register a set of pin controller mappings |
331 | * @maps: the pinmux mappings table to register, this should be marked with | 331 | * @maps: the pincontrol mappings table to register, this should be marked with |
332 | * __initdata so it can be discarded after boot, this function will | 332 | * __initdata so it can be discarded after boot, this function will |
333 | * perform a shallow copy for the mapping entries. | 333 | * perform a shallow copy for the mapping entries. |
334 | * @num_maps: the number of maps in the mapping table | 334 | * @num_maps: the number of maps in the mapping table |
@@ -338,8 +338,8 @@ EXPORT_SYMBOL_GPL(pinmux_gpio_direction_output); | |||
338 | * passed into this function will be owned by the pinmux core and cannot be | 338 | * passed into this function will be owned by the pinmux core and cannot be |
339 | * freed. | 339 | * freed. |
340 | */ | 340 | */ |
341 | int __init pinmux_register_mappings(struct pinmux_map const *maps, | 341 | int __init pinctrl_register_mappings(struct pinctrl_map const *maps, |
342 | unsigned num_maps) | 342 | unsigned num_maps) |
343 | { | 343 | { |
344 | void *tmp_maps; | 344 | void *tmp_maps; |
345 | int i; | 345 | int i; |
@@ -380,26 +380,27 @@ int __init pinmux_register_mappings(struct pinmux_map const *maps, | |||
380 | * Make a copy of the map array - string pointers will end up in the | 380 | * Make a copy of the map array - string pointers will end up in the |
381 | * kernel const section anyway so these do not need to be deep copied. | 381 | * kernel const section anyway so these do not need to be deep copied. |
382 | */ | 382 | */ |
383 | if (!pinmux_maps_num) { | 383 | if (!pinctrl_maps_num) { |
384 | /* On first call, just copy them */ | 384 | /* On first call, just copy them */ |
385 | tmp_maps = kmemdup(maps, | 385 | tmp_maps = kmemdup(maps, |
386 | sizeof(struct pinmux_map) * num_maps, | 386 | sizeof(struct pinctrl_map) * num_maps, |
387 | GFP_KERNEL); | 387 | GFP_KERNEL); |
388 | if (!tmp_maps) | 388 | if (!tmp_maps) |
389 | return -ENOMEM; | 389 | return -ENOMEM; |
390 | } else { | 390 | } else { |
391 | /* Subsequent calls, reallocate array to new size */ | 391 | /* Subsequent calls, reallocate array to new size */ |
392 | size_t oldsize = sizeof(struct pinmux_map) * pinmux_maps_num; | 392 | size_t oldsize = sizeof(struct pinctrl_map) * pinctrl_maps_num; |
393 | size_t newsize = sizeof(struct pinmux_map) * num_maps; | 393 | size_t newsize = sizeof(struct pinctrl_map) * num_maps; |
394 | 394 | ||
395 | tmp_maps = krealloc(pinmux_maps, oldsize + newsize, GFP_KERNEL); | 395 | tmp_maps = krealloc(pinctrl_maps, |
396 | oldsize + newsize, GFP_KERNEL); | ||
396 | if (!tmp_maps) | 397 | if (!tmp_maps) |
397 | return -ENOMEM; | 398 | return -ENOMEM; |
398 | memcpy((tmp_maps + oldsize), maps, newsize); | 399 | memcpy((tmp_maps + oldsize), maps, newsize); |
399 | } | 400 | } |
400 | 401 | ||
401 | pinmux_maps = tmp_maps; | 402 | pinctrl_maps = tmp_maps; |
402 | pinmux_maps_num += num_maps; | 403 | pinctrl_maps_num += num_maps; |
403 | return 0; | 404 | return 0; |
404 | } | 405 | } |
405 | 406 | ||
@@ -560,7 +561,7 @@ static int pinmux_check_pin_group(struct pinctrl_dev *pctldev, | |||
560 | * negative otherwise | 561 | * negative otherwise |
561 | */ | 562 | */ |
562 | static int pinmux_search_function(struct pinctrl_dev *pctldev, | 563 | static int pinmux_search_function(struct pinctrl_dev *pctldev, |
563 | struct pinmux_map const *map, | 564 | struct pinctrl_map const *map, |
564 | unsigned *func_selector, | 565 | unsigned *func_selector, |
565 | unsigned *group_selector) | 566 | unsigned *group_selector) |
566 | { | 567 | { |
@@ -598,10 +599,10 @@ static int pinmux_search_function(struct pinctrl_dev *pctldev, | |||
598 | * pinmux_enable_muxmap() - enable a map entry for a certain pinmux | 599 | * pinmux_enable_muxmap() - enable a map entry for a certain pinmux |
599 | */ | 600 | */ |
600 | static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev, | 601 | static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev, |
601 | struct pinmux *pmx, | 602 | struct pinctrl *p, |
602 | struct device *dev, | 603 | struct device *dev, |
603 | const char *devname, | 604 | const char *devname, |
604 | struct pinmux_map const *map) | 605 | struct pinctrl_map const *map) |
605 | { | 606 | { |
606 | unsigned func_selector; | 607 | unsigned func_selector; |
607 | unsigned group_selector; | 608 | unsigned group_selector; |
@@ -615,14 +616,14 @@ static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev, | |||
615 | * by anyone else. | 616 | * by anyone else. |
616 | */ | 617 | */ |
617 | 618 | ||
618 | if (pmx->pctldev && pmx->pctldev != pctldev) { | 619 | if (p->pctldev && p->pctldev != pctldev) { |
619 | dev_err(pctldev->dev, | 620 | dev_err(pctldev->dev, |
620 | "different pin control devices given for device %s, function %s\n", | 621 | "different pin control devices given for device %s, function %s\n", |
621 | devname, map->function); | 622 | devname, map->function); |
622 | return -EINVAL; | 623 | return -EINVAL; |
623 | } | 624 | } |
624 | pmx->dev = dev; | 625 | p->dev = dev; |
625 | pmx->pctldev = pctldev; | 626 | p->pctldev = pctldev; |
626 | 627 | ||
627 | /* Now go into the driver and try to match a function and group */ | 628 | /* Now go into the driver and try to match a function and group */ |
628 | ret = pinmux_search_function(pctldev, map, &func_selector, | 629 | ret = pinmux_search_function(pctldev, map, &func_selector, |
@@ -635,14 +636,14 @@ static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev, | |||
635 | * we support several groups with one function but not several | 636 | * we support several groups with one function but not several |
636 | * functions with one or several groups in the same pinmux. | 637 | * functions with one or several groups in the same pinmux. |
637 | */ | 638 | */ |
638 | if (pmx->func_selector != UINT_MAX && | 639 | if (p->func_selector != UINT_MAX && |
639 | pmx->func_selector != func_selector) { | 640 | p->func_selector != func_selector) { |
640 | dev_err(pctldev->dev, | 641 | dev_err(pctldev->dev, |
641 | "dual function defines in the map for device %s\n", | 642 | "dual function defines in the map for device %s\n", |
642 | devname); | 643 | devname); |
643 | return -EINVAL; | 644 | return -EINVAL; |
644 | } | 645 | } |
645 | pmx->func_selector = func_selector; | 646 | p->func_selector = func_selector; |
646 | 647 | ||
647 | /* Now add this group selector, we may have many of them */ | 648 | /* Now add this group selector, we may have many of them */ |
648 | grp = kmalloc(sizeof(struct pinmux_group), GFP_KERNEL); | 649 | grp = kmalloc(sizeof(struct pinmux_group), GFP_KERNEL); |
@@ -654,38 +655,38 @@ static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev, | |||
654 | kfree(grp); | 655 | kfree(grp); |
655 | return ret; | 656 | return ret; |
656 | } | 657 | } |
657 | list_add(&grp->node, &pmx->groups); | 658 | list_add(&grp->node, &p->groups); |
658 | 659 | ||
659 | return 0; | 660 | return 0; |
660 | } | 661 | } |
661 | 662 | ||
662 | static void pinmux_free_groups(struct pinmux *pmx) | 663 | static void pinmux_free_groups(struct pinctrl *p) |
663 | { | 664 | { |
664 | struct list_head *node, *tmp; | 665 | struct list_head *node, *tmp; |
665 | 666 | ||
666 | list_for_each_safe(node, tmp, &pmx->groups) { | 667 | list_for_each_safe(node, tmp, &p->groups) { |
667 | struct pinmux_group *grp = | 668 | struct pinmux_group *grp = |
668 | list_entry(node, struct pinmux_group, node); | 669 | list_entry(node, struct pinmux_group, node); |
669 | /* Release all pins taken by this group */ | 670 | /* Release all pins taken by this group */ |
670 | release_pins(pmx->pctldev, grp->group_selector); | 671 | release_pins(p->pctldev, grp->group_selector); |
671 | list_del(node); | 672 | list_del(node); |
672 | kfree(grp); | 673 | kfree(grp); |
673 | } | 674 | } |
674 | } | 675 | } |
675 | 676 | ||
676 | /** | 677 | /** |
677 | * pinmux_get() - retrieves the pinmux for a certain device | 678 | * pinctrl_get() - retrieves the pin controller handle for a certain device |
678 | * @dev: the device to get the pinmux for | 679 | * @dev: the device to get the pin controller handle for |
679 | * @name: an optional specific mux mapping name or NULL, the name is only | 680 | * @name: an optional specific control mapping name or NULL, the name is only |
680 | * needed if you want to have more than one mapping per device, or if you | 681 | * needed if you want to have more than one mapping per device, or if you |
681 | * need an anonymous pinmux (not tied to any specific device) | 682 | * need an anonymous pin control (not tied to any specific device) |
682 | */ | 683 | */ |
683 | struct pinmux *pinmux_get(struct device *dev, const char *name) | 684 | struct pinctrl *pinctrl_get(struct device *dev, const char *name) |
684 | { | 685 | { |
685 | struct pinmux_map const *map = NULL; | 686 | struct pinctrl_map const *map = NULL; |
686 | struct pinctrl_dev *pctldev = NULL; | 687 | struct pinctrl_dev *pctldev = NULL; |
687 | const char *devname = NULL; | 688 | const char *devname = NULL; |
688 | struct pinmux *pmx; | 689 | struct pinctrl *p; |
689 | bool found_map; | 690 | bool found_map; |
690 | unsigned num_maps = 0; | 691 | unsigned num_maps = 0; |
691 | int ret = -ENODEV; | 692 | int ret = -ENODEV; |
@@ -706,16 +707,16 @@ struct pinmux *pinmux_get(struct device *dev, const char *name) | |||
706 | * mapping, this is what consumers will get when requesting | 707 | * mapping, this is what consumers will get when requesting |
707 | * a pinmux handle with pinmux_get() | 708 | * a pinmux handle with pinmux_get() |
708 | */ | 709 | */ |
709 | pmx = kzalloc(sizeof(struct pinmux), GFP_KERNEL); | 710 | p = kzalloc(sizeof(struct pinctrl), GFP_KERNEL); |
710 | if (pmx == NULL) | 711 | if (p == NULL) |
711 | return ERR_PTR(-ENOMEM); | 712 | return ERR_PTR(-ENOMEM); |
712 | mutex_init(&pmx->mutex); | 713 | mutex_init(&p->mutex); |
713 | pmx->func_selector = UINT_MAX; | 714 | p->func_selector = UINT_MAX; |
714 | INIT_LIST_HEAD(&pmx->groups); | 715 | INIT_LIST_HEAD(&p->groups); |
715 | 716 | ||
716 | /* Iterate over the pinmux maps to locate the right ones */ | 717 | /* Iterate over the pin control maps to locate the right ones */ |
717 | for (i = 0; i < pinmux_maps_num; i++) { | 718 | for (i = 0; i < pinctrl_maps_num; i++) { |
718 | map = &pinmux_maps[i]; | 719 | map = &pinctrl_maps[i]; |
719 | found_map = false; | 720 | found_map = false; |
720 | 721 | ||
721 | /* | 722 | /* |
@@ -763,11 +764,11 @@ struct pinmux *pinmux_get(struct device *dev, const char *name) | |||
763 | 764 | ||
764 | /* If this map is applicable, then apply it */ | 765 | /* If this map is applicable, then apply it */ |
765 | if (found_map) { | 766 | if (found_map) { |
766 | ret = pinmux_enable_muxmap(pctldev, pmx, dev, | 767 | ret = pinmux_enable_muxmap(pctldev, p, dev, |
767 | devname, map); | 768 | devname, map); |
768 | if (ret) { | 769 | if (ret) { |
769 | pinmux_free_groups(pmx); | 770 | pinmux_free_groups(p); |
770 | kfree(pmx); | 771 | kfree(p); |
771 | return ERR_PTR(ret); | 772 | return ERR_PTR(ret); |
772 | } | 773 | } |
773 | num_maps++; | 774 | num_maps++; |
@@ -780,7 +781,7 @@ struct pinmux *pinmux_get(struct device *dev, const char *name) | |||
780 | pr_err("could not find any mux maps for device %s, ID %s\n", | 781 | pr_err("could not find any mux maps for device %s, ID %s\n", |
781 | devname ? devname : "(anonymous)", | 782 | devname ? devname : "(anonymous)", |
782 | name ? name : "(undefined)"); | 783 | name ? name : "(undefined)"); |
783 | kfree(pmx); | 784 | kfree(p); |
784 | return ERR_PTR(-EINVAL); | 785 | return ERR_PTR(-EINVAL); |
785 | } | 786 | } |
786 | 787 | ||
@@ -790,96 +791,96 @@ struct pinmux *pinmux_get(struct device *dev, const char *name) | |||
790 | name ? name : "(undefined)"); | 791 | name ? name : "(undefined)"); |
791 | 792 | ||
792 | /* Add the pinmux to the global list */ | 793 | /* Add the pinmux to the global list */ |
793 | mutex_lock(&pinmux_list_mutex); | 794 | mutex_lock(&pinctrl_list_mutex); |
794 | list_add(&pmx->node, &pinmux_list); | 795 | list_add(&p->node, &pinctrl_list); |
795 | mutex_unlock(&pinmux_list_mutex); | 796 | mutex_unlock(&pinctrl_list_mutex); |
796 | 797 | ||
797 | return pmx; | 798 | return p; |
798 | } | 799 | } |
799 | EXPORT_SYMBOL_GPL(pinmux_get); | 800 | EXPORT_SYMBOL_GPL(pinctrl_get); |
800 | 801 | ||
801 | /** | 802 | /** |
802 | * pinmux_put() - release a previously claimed pinmux | 803 | * pinctrl_put() - release a previously claimed pin control handle |
803 | * @pmx: a pinmux previously claimed by pinmux_get() | 804 | * @p: a pin control handle previously claimed by pinctrl_get() |
804 | */ | 805 | */ |
805 | void pinmux_put(struct pinmux *pmx) | 806 | void pinctrl_put(struct pinctrl *p) |
806 | { | 807 | { |
807 | if (pmx == NULL) | 808 | if (p == NULL) |
808 | return; | 809 | return; |
809 | 810 | ||
810 | mutex_lock(&pmx->mutex); | 811 | mutex_lock(&p->mutex); |
811 | if (pmx->usecount) | 812 | if (p->usecount) |
812 | pr_warn("releasing pinmux with active users!\n"); | 813 | pr_warn("releasing pin control handle with active users!\n"); |
813 | /* Free the groups and all acquired pins */ | 814 | /* Free the groups and all acquired pins */ |
814 | pinmux_free_groups(pmx); | 815 | pinmux_free_groups(p); |
815 | mutex_unlock(&pmx->mutex); | 816 | mutex_unlock(&p->mutex); |
816 | 817 | ||
817 | /* Remove from list */ | 818 | /* Remove from list */ |
818 | mutex_lock(&pinmux_list_mutex); | 819 | mutex_lock(&pinctrl_list_mutex); |
819 | list_del(&pmx->node); | 820 | list_del(&p->node); |
820 | mutex_unlock(&pinmux_list_mutex); | 821 | mutex_unlock(&pinctrl_list_mutex); |
821 | 822 | ||
822 | kfree(pmx); | 823 | kfree(p); |
823 | } | 824 | } |
824 | EXPORT_SYMBOL_GPL(pinmux_put); | 825 | EXPORT_SYMBOL_GPL(pinctrl_put); |
825 | 826 | ||
826 | /** | 827 | /** |
827 | * pinmux_enable() - enable a certain pinmux setting | 828 | * pinctrl_enable() - enable a certain pin controller setting |
828 | * @pmx: the pinmux to enable, previously claimed by pinmux_get() | 829 | * @p: the pin control handle to enable, previously claimed by pinctrl_get() |
829 | */ | 830 | */ |
830 | int pinmux_enable(struct pinmux *pmx) | 831 | int pinctrl_enable(struct pinctrl *p) |
831 | { | 832 | { |
832 | int ret = 0; | 833 | int ret = 0; |
833 | 834 | ||
834 | if (pmx == NULL) | 835 | if (p == NULL) |
835 | return -EINVAL; | 836 | return -EINVAL; |
836 | mutex_lock(&pmx->mutex); | 837 | mutex_lock(&p->mutex); |
837 | if (pmx->usecount++ == 0) { | 838 | if (p->usecount++ == 0) { |
838 | struct pinctrl_dev *pctldev = pmx->pctldev; | 839 | struct pinctrl_dev *pctldev = p->pctldev; |
839 | const struct pinmux_ops *ops = pctldev->desc->pmxops; | 840 | const struct pinmux_ops *ops = pctldev->desc->pmxops; |
840 | struct pinmux_group *grp; | 841 | struct pinmux_group *grp; |
841 | 842 | ||
842 | list_for_each_entry(grp, &pmx->groups, node) { | 843 | list_for_each_entry(grp, &p->groups, node) { |
843 | ret = ops->enable(pctldev, pmx->func_selector, | 844 | ret = ops->enable(pctldev, p->func_selector, |
844 | grp->group_selector); | 845 | grp->group_selector); |
845 | if (ret) { | 846 | if (ret) { |
846 | /* | 847 | /* |
847 | * TODO: call disable() on all groups we called | 848 | * TODO: call disable() on all groups we called |
848 | * enable() on to this point? | 849 | * enable() on to this point? |
849 | */ | 850 | */ |
850 | pmx->usecount--; | 851 | p->usecount--; |
851 | break; | 852 | break; |
852 | } | 853 | } |
853 | } | 854 | } |
854 | } | 855 | } |
855 | mutex_unlock(&pmx->mutex); | 856 | mutex_unlock(&p->mutex); |
856 | return ret; | 857 | return ret; |
857 | } | 858 | } |
858 | EXPORT_SYMBOL_GPL(pinmux_enable); | 859 | EXPORT_SYMBOL_GPL(pinctrl_enable); |
859 | 860 | ||
860 | /** | 861 | /** |
861 | * pinmux_disable() - disable a certain pinmux setting | 862 | * pinctrl_disable() - disable a certain pin control setting |
862 | * @pmx: the pinmux to disable, previously claimed by pinmux_get() | 863 | * @p: the pin control handle to disable, previously claimed by pinctrl_get() |
863 | */ | 864 | */ |
864 | void pinmux_disable(struct pinmux *pmx) | 865 | void pinctrl_disable(struct pinctrl *p) |
865 | { | 866 | { |
866 | if (pmx == NULL) | 867 | if (p == NULL) |
867 | return; | 868 | return; |
868 | 869 | ||
869 | mutex_lock(&pmx->mutex); | 870 | mutex_lock(&p->mutex); |
870 | if (--pmx->usecount == 0) { | 871 | if (--p->usecount == 0) { |
871 | struct pinctrl_dev *pctldev = pmx->pctldev; | 872 | struct pinctrl_dev *pctldev = p->pctldev; |
872 | const struct pinmux_ops *ops = pctldev->desc->pmxops; | 873 | const struct pinmux_ops *ops = pctldev->desc->pmxops; |
873 | struct pinmux_group *grp; | 874 | struct pinmux_group *grp; |
874 | 875 | ||
875 | list_for_each_entry(grp, &pmx->groups, node) { | 876 | list_for_each_entry(grp, &p->groups, node) { |
876 | ops->disable(pctldev, pmx->func_selector, | 877 | ops->disable(pctldev, p->func_selector, |
877 | grp->group_selector); | 878 | grp->group_selector); |
878 | } | 879 | } |
879 | } | 880 | } |
880 | mutex_unlock(&pmx->mutex); | 881 | mutex_unlock(&p->mutex); |
881 | } | 882 | } |
882 | EXPORT_SYMBOL_GPL(pinmux_disable); | 883 | EXPORT_SYMBOL_GPL(pinctrl_disable); |
883 | 884 | ||
884 | int pinmux_check_ops(struct pinctrl_dev *pctldev) | 885 | int pinmux_check_ops(struct pinctrl_dev *pctldev) |
885 | { | 886 | { |
@@ -910,11 +911,11 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev) | |||
910 | } | 911 | } |
911 | 912 | ||
912 | /* Hog a single map entry and add to the hoglist */ | 913 | /* Hog a single map entry and add to the hoglist */ |
913 | static int pinmux_hog_map(struct pinctrl_dev *pctldev, | 914 | static int pinctrl_hog_map(struct pinctrl_dev *pctldev, |
914 | struct pinmux_map const *map) | 915 | struct pinctrl_map const *map) |
915 | { | 916 | { |
916 | struct pinmux_hog *hog; | 917 | struct pinctrl_hog *hog; |
917 | struct pinmux *pmx; | 918 | struct pinctrl *p; |
918 | int ret; | 919 | int ret; |
919 | 920 | ||
920 | if (map->dev_name) { | 921 | if (map->dev_name) { |
@@ -929,61 +930,61 @@ static int pinmux_hog_map(struct pinctrl_dev *pctldev, | |||
929 | return -EINVAL; | 930 | return -EINVAL; |
930 | } | 931 | } |
931 | 932 | ||
932 | hog = kzalloc(sizeof(struct pinmux_hog), GFP_KERNEL); | 933 | hog = kzalloc(sizeof(struct pinctrl_hog), GFP_KERNEL); |
933 | if (!hog) | 934 | if (!hog) |
934 | return -ENOMEM; | 935 | return -ENOMEM; |
935 | 936 | ||
936 | pmx = pinmux_get(NULL, map->name); | 937 | p = pinctrl_get(NULL, map->name); |
937 | if (IS_ERR(pmx)) { | 938 | if (IS_ERR(p)) { |
938 | kfree(hog); | 939 | kfree(hog); |
939 | dev_err(pctldev->dev, | 940 | dev_err(pctldev->dev, |
940 | "could not get the %s pinmux mapping for hogging\n", | 941 | "could not get the %s pin control mapping for hogging\n", |
941 | map->name); | 942 | map->name); |
942 | return PTR_ERR(pmx); | 943 | return PTR_ERR(p); |
943 | } | 944 | } |
944 | 945 | ||
945 | ret = pinmux_enable(pmx); | 946 | ret = pinctrl_enable(p); |
946 | if (ret) { | 947 | if (ret) { |
947 | pinmux_put(pmx); | 948 | pinctrl_put(p); |
948 | kfree(hog); | 949 | kfree(hog); |
949 | dev_err(pctldev->dev, | 950 | dev_err(pctldev->dev, |
950 | "could not enable the %s pinmux mapping for hogging\n", | 951 | "could not enable the %s pin control mapping for hogging\n", |
951 | map->name); | 952 | map->name); |
952 | return ret; | 953 | return ret; |
953 | } | 954 | } |
954 | 955 | ||
955 | hog->map = map; | 956 | hog->map = map; |
956 | hog->pmx = pmx; | 957 | hog->p = p; |
957 | 958 | ||
958 | dev_info(pctldev->dev, "hogged map %s, function %s\n", map->name, | 959 | dev_info(pctldev->dev, "hogged map %s, function %s\n", map->name, |
959 | map->function); | 960 | map->function); |
960 | mutex_lock(&pctldev->pinmux_hogs_lock); | 961 | mutex_lock(&pctldev->pinctrl_hogs_lock); |
961 | list_add(&hog->node, &pctldev->pinmux_hogs); | 962 | list_add(&hog->node, &pctldev->pinctrl_hogs); |
962 | mutex_unlock(&pctldev->pinmux_hogs_lock); | 963 | mutex_unlock(&pctldev->pinctrl_hogs_lock); |
963 | 964 | ||
964 | return 0; | 965 | return 0; |
965 | } | 966 | } |
966 | 967 | ||
967 | /** | 968 | /** |
968 | * pinmux_hog_maps() - hog specific map entries on controller device | 969 | * pinctrl_hog_maps() - hog specific map entries on controller device |
969 | * @pctldev: the pin control device to hog entries on | 970 | * @pctldev: the pin control device to hog entries on |
970 | * | 971 | * |
971 | * When the pin controllers are registered, there may be some specific pinmux | 972 | * When the pin controllers are registered, there may be some specific pinmux |
972 | * map entries that need to be hogged, i.e. get+enabled until the system shuts | 973 | * map entries that need to be hogged, i.e. get+enabled until the system shuts |
973 | * down. | 974 | * down. |
974 | */ | 975 | */ |
975 | int pinmux_hog_maps(struct pinctrl_dev *pctldev) | 976 | int pinctrl_hog_maps(struct pinctrl_dev *pctldev) |
976 | { | 977 | { |
977 | struct device *dev = pctldev->dev; | 978 | struct device *dev = pctldev->dev; |
978 | const char *devname = dev_name(dev); | 979 | const char *devname = dev_name(dev); |
979 | int ret; | 980 | int ret; |
980 | int i; | 981 | int i; |
981 | 982 | ||
982 | INIT_LIST_HEAD(&pctldev->pinmux_hogs); | 983 | INIT_LIST_HEAD(&pctldev->pinctrl_hogs); |
983 | mutex_init(&pctldev->pinmux_hogs_lock); | 984 | mutex_init(&pctldev->pinctrl_hogs_lock); |
984 | 985 | ||
985 | for (i = 0; i < pinmux_maps_num; i++) { | 986 | for (i = 0; i < pinctrl_maps_num; i++) { |
986 | struct pinmux_map const *map = &pinmux_maps[i]; | 987 | struct pinctrl_map const *map = &pinctrl_maps[i]; |
987 | 988 | ||
988 | if (!map->hog_on_boot) | 989 | if (!map->hog_on_boot) |
989 | continue; | 990 | continue; |
@@ -991,7 +992,7 @@ int pinmux_hog_maps(struct pinctrl_dev *pctldev) | |||
991 | if (map->ctrl_dev_name && | 992 | if (map->ctrl_dev_name && |
992 | !strcmp(map->ctrl_dev_name, devname)) { | 993 | !strcmp(map->ctrl_dev_name, devname)) { |
993 | /* OK time to hog! */ | 994 | /* OK time to hog! */ |
994 | ret = pinmux_hog_map(pctldev, map); | 995 | ret = pinctrl_hog_map(pctldev, map); |
995 | if (ret) | 996 | if (ret) |
996 | return ret; | 997 | return ret; |
997 | } | 998 | } |
@@ -1000,23 +1001,23 @@ int pinmux_hog_maps(struct pinctrl_dev *pctldev) | |||
1000 | } | 1001 | } |
1001 | 1002 | ||
1002 | /** | 1003 | /** |
1003 | * pinmux_unhog_maps() - unhog specific map entries on controller device | 1004 | * pinctrl_unhog_maps() - unhog specific map entries on controller device |
1004 | * @pctldev: the pin control device to unhog entries on | 1005 | * @pctldev: the pin control device to unhog entries on |
1005 | */ | 1006 | */ |
1006 | void pinmux_unhog_maps(struct pinctrl_dev *pctldev) | 1007 | void pinctrl_unhog_maps(struct pinctrl_dev *pctldev) |
1007 | { | 1008 | { |
1008 | struct list_head *node, *tmp; | 1009 | struct list_head *node, *tmp; |
1009 | 1010 | ||
1010 | mutex_lock(&pctldev->pinmux_hogs_lock); | 1011 | mutex_lock(&pctldev->pinctrl_hogs_lock); |
1011 | list_for_each_safe(node, tmp, &pctldev->pinmux_hogs) { | 1012 | list_for_each_safe(node, tmp, &pctldev->pinctrl_hogs) { |
1012 | struct pinmux_hog *hog = | 1013 | struct pinctrl_hog *hog = |
1013 | list_entry(node, struct pinmux_hog, node); | 1014 | list_entry(node, struct pinctrl_hog, node); |
1014 | pinmux_disable(hog->pmx); | 1015 | pinctrl_disable(hog->p); |
1015 | pinmux_put(hog->pmx); | 1016 | pinctrl_put(hog->p); |
1016 | list_del(node); | 1017 | list_del(node); |
1017 | kfree(hog); | 1018 | kfree(hog); |
1018 | } | 1019 | } |
1019 | mutex_unlock(&pctldev->pinmux_hogs_lock); | 1020 | mutex_unlock(&pctldev->pinctrl_hogs_lock); |
1020 | } | 1021 | } |
1021 | 1022 | ||
1022 | #ifdef CONFIG_DEBUG_FS | 1023 | #ifdef CONFIG_DEBUG_FS |
@@ -1085,11 +1086,11 @@ static int pinmux_pins_show(struct seq_file *s, void *what) | |||
1085 | static int pinmux_hogs_show(struct seq_file *s, void *what) | 1086 | static int pinmux_hogs_show(struct seq_file *s, void *what) |
1086 | { | 1087 | { |
1087 | struct pinctrl_dev *pctldev = s->private; | 1088 | struct pinctrl_dev *pctldev = s->private; |
1088 | struct pinmux_hog *hog; | 1089 | struct pinctrl_hog *hog; |
1089 | 1090 | ||
1090 | seq_puts(s, "Pinmux map hogs held by device\n"); | 1091 | seq_puts(s, "Pin control map hogs held by device\n"); |
1091 | 1092 | ||
1092 | list_for_each_entry(hog, &pctldev->pinmux_hogs, node) | 1093 | list_for_each_entry(hog, &pctldev->pinctrl_hogs, node) |
1093 | seq_printf(s, "%s\n", hog->map->name); | 1094 | seq_printf(s, "%s\n", hog->map->name); |
1094 | 1095 | ||
1095 | return 0; | 1096 | return 0; |
@@ -1097,11 +1098,11 @@ static int pinmux_hogs_show(struct seq_file *s, void *what) | |||
1097 | 1098 | ||
1098 | static int pinmux_show(struct seq_file *s, void *what) | 1099 | static int pinmux_show(struct seq_file *s, void *what) |
1099 | { | 1100 | { |
1100 | struct pinmux *pmx; | 1101 | struct pinctrl *p; |
1101 | 1102 | ||
1102 | seq_puts(s, "Requested pinmuxes and their maps:\n"); | 1103 | seq_puts(s, "Requested pinmuxes and their maps:\n"); |
1103 | list_for_each_entry(pmx, &pinmux_list, node) { | 1104 | list_for_each_entry(p, &pinctrl_list, node) { |
1104 | struct pinctrl_dev *pctldev = pmx->pctldev; | 1105 | struct pinctrl_dev *pctldev = p->pctldev; |
1105 | const struct pinmux_ops *pmxops; | 1106 | const struct pinmux_ops *pmxops; |
1106 | const struct pinctrl_ops *pctlops; | 1107 | const struct pinctrl_ops *pctlops; |
1107 | struct pinmux_group *grp; | 1108 | struct pinmux_group *grp; |
@@ -1115,13 +1116,13 @@ static int pinmux_show(struct seq_file *s, void *what) | |||
1115 | pctlops = pctldev->desc->pctlops; | 1116 | pctlops = pctldev->desc->pctlops; |
1116 | 1117 | ||
1117 | seq_printf(s, "device: %s function: %s (%u),", | 1118 | seq_printf(s, "device: %s function: %s (%u),", |
1118 | pinctrl_dev_get_name(pmx->pctldev), | 1119 | pinctrl_dev_get_name(p->pctldev), |
1119 | pmxops->get_function_name(pctldev, | 1120 | pmxops->get_function_name(pctldev, |
1120 | pmx->func_selector), | 1121 | p->func_selector), |
1121 | pmx->func_selector); | 1122 | p->func_selector); |
1122 | 1123 | ||
1123 | seq_printf(s, " groups: ["); | 1124 | seq_printf(s, " groups: ["); |
1124 | list_for_each_entry(grp, &pmx->groups, node) { | 1125 | list_for_each_entry(grp, &p->groups, node) { |
1125 | seq_printf(s, " %s (%u)", | 1126 | seq_printf(s, " %s (%u)", |
1126 | pctlops->get_group_name(pctldev, | 1127 | pctlops->get_group_name(pctldev, |
1127 | grp->group_selector), | 1128 | grp->group_selector), |
@@ -1130,21 +1131,21 @@ static int pinmux_show(struct seq_file *s, void *what) | |||
1130 | seq_printf(s, " ]"); | 1131 | seq_printf(s, " ]"); |
1131 | 1132 | ||
1132 | seq_printf(s, " users: %u map-> %s\n", | 1133 | seq_printf(s, " users: %u map-> %s\n", |
1133 | pmx->usecount, | 1134 | p->usecount, |
1134 | pmx->dev ? dev_name(pmx->dev) : "(system)"); | 1135 | p->dev ? dev_name(p->dev) : "(system)"); |
1135 | } | 1136 | } |
1136 | 1137 | ||
1137 | return 0; | 1138 | return 0; |
1138 | } | 1139 | } |
1139 | 1140 | ||
1140 | static int pinmux_maps_show(struct seq_file *s, void *what) | 1141 | static int pinctrl_maps_show(struct seq_file *s, void *what) |
1141 | { | 1142 | { |
1142 | int i; | 1143 | int i; |
1143 | 1144 | ||
1144 | seq_puts(s, "Pinmux maps:\n"); | 1145 | seq_puts(s, "Pinctrl maps:\n"); |
1145 | 1146 | ||
1146 | for (i = 0; i < pinmux_maps_num; i++) { | 1147 | for (i = 0; i < pinctrl_maps_num; i++) { |
1147 | struct pinmux_map const *map = &pinmux_maps[i]; | 1148 | struct pinctrl_map const *map = &pinctrl_maps[i]; |
1148 | 1149 | ||
1149 | seq_printf(s, "%s:\n", map->name); | 1150 | seq_printf(s, "%s:\n", map->name); |
1150 | if (map->dev_name) | 1151 | if (map->dev_name) |
@@ -1181,9 +1182,9 @@ static int pinmux_open(struct inode *inode, struct file *file) | |||
1181 | return single_open(file, pinmux_show, NULL); | 1182 | return single_open(file, pinmux_show, NULL); |
1182 | } | 1183 | } |
1183 | 1184 | ||
1184 | static int pinmux_maps_open(struct inode *inode, struct file *file) | 1185 | static int pinctrl_maps_open(struct inode *inode, struct file *file) |
1185 | { | 1186 | { |
1186 | return single_open(file, pinmux_maps_show, NULL); | 1187 | return single_open(file, pinctrl_maps_show, NULL); |
1187 | } | 1188 | } |
1188 | 1189 | ||
1189 | static const struct file_operations pinmux_functions_ops = { | 1190 | static const struct file_operations pinmux_functions_ops = { |
@@ -1214,8 +1215,8 @@ static const struct file_operations pinmux_ops = { | |||
1214 | .release = single_release, | 1215 | .release = single_release, |
1215 | }; | 1216 | }; |
1216 | 1217 | ||
1217 | static const struct file_operations pinmux_maps_ops = { | 1218 | static const struct file_operations pinctrl_maps_ops = { |
1218 | .open = pinmux_maps_open, | 1219 | .open = pinctrl_maps_open, |
1219 | .read = seq_read, | 1220 | .read = seq_read, |
1220 | .llseek = seq_lseek, | 1221 | .llseek = seq_lseek, |
1221 | .release = single_release, | 1222 | .release = single_release, |
@@ -1236,8 +1237,8 @@ void pinmux_init_debugfs(struct dentry *subsys_root) | |||
1236 | { | 1237 | { |
1237 | debugfs_create_file("pinmuxes", S_IFREG | S_IRUGO, | 1238 | debugfs_create_file("pinmuxes", S_IFREG | S_IRUGO, |
1238 | subsys_root, NULL, &pinmux_ops); | 1239 | subsys_root, NULL, &pinmux_ops); |
1239 | debugfs_create_file("pinmux-maps", S_IFREG | S_IRUGO, | 1240 | debugfs_create_file("pinctrl-maps", S_IFREG | S_IRUGO, |
1240 | subsys_root, NULL, &pinmux_maps_ops); | 1241 | subsys_root, NULL, &pinctrl_maps_ops); |
1241 | } | 1242 | } |
1242 | 1243 | ||
1243 | #endif /* CONFIG_DEBUG_FS */ | 1244 | #endif /* CONFIG_DEBUG_FS */ |
diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h index 97f52223fbc2..dfe81726965c 100644 --- a/drivers/pinctrl/pinmux.h +++ b/drivers/pinctrl/pinmux.h | |||
@@ -16,8 +16,8 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev); | |||
16 | void pinmux_init_device_debugfs(struct dentry *devroot, | 16 | void pinmux_init_device_debugfs(struct dentry *devroot, |
17 | struct pinctrl_dev *pctldev); | 17 | struct pinctrl_dev *pctldev); |
18 | void pinmux_init_debugfs(struct dentry *subsys_root); | 18 | void pinmux_init_debugfs(struct dentry *subsys_root); |
19 | int pinmux_hog_maps(struct pinctrl_dev *pctldev); | 19 | int pinctrl_hog_maps(struct pinctrl_dev *pctldev); |
20 | void pinmux_unhog_maps(struct pinctrl_dev *pctldev); | 20 | void pinctrl_unhog_maps(struct pinctrl_dev *pctldev); |
21 | 21 | ||
22 | #else | 22 | #else |
23 | 23 | ||
@@ -35,12 +35,12 @@ static inline void pinmux_init_debugfs(struct dentry *subsys_root) | |||
35 | { | 35 | { |
36 | } | 36 | } |
37 | 37 | ||
38 | static inline int pinmux_hog_maps(struct pinctrl_dev *pctldev) | 38 | static inline int pinctrl_hog_maps(struct pinctrl_dev *pctldev) |
39 | { | 39 | { |
40 | return 0; | 40 | return 0; |
41 | } | 41 | } |
42 | 42 | ||
43 | static inline void pinmux_unhog_maps(struct pinctrl_dev *pctldev) | 43 | static inline void pinctrl_unhog_maps(struct pinctrl_dev *pctldev) |
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||