Commit e93bcee0 authored by Linus Walleij's avatar Linus Walleij

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: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 28a8d14c
...@@ -728,19 +728,19 @@ same time. ...@@ -728,19 +728,19 @@ same time.
All the above functions are mandatory to implement for a pinmux driver. All the above functions are mandatory to implement for a pinmux driver.
Pinmux interaction with the GPIO subsystem Pin control interaction with the GPIO subsystem
========================================== ===============================================
The public pinmux API contains two functions named pinmux_request_gpio() The public pinmux API contains two functions named pinctrl_request_gpio()
and pinmux_free_gpio(). These two functions shall *ONLY* be called from and pinctrl_free_gpio(). These two functions shall *ONLY* be called from
gpiolib-based drivers as part of their gpio_request() and gpiolib-based drivers as part of their gpio_request() and
gpio_free() semantics. Likewise the pinmux_gpio_direction_[input|output] gpio_free() semantics. Likewise the pinctrl_gpio_direction_[input|output]
shall only be called from within respective gpio_direction_[input|output] shall only be called from within respective gpio_direction_[input|output]
gpiolib implementation. gpiolib implementation.
NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be
muxed in. Instead, implement a proper gpiolib driver and have that driver controlled e.g. muxed in. Instead, implement a proper gpiolib driver and have
request proper muxing for its pins. that driver request proper muxing and other control for its pins.
The function list could become long, especially if you can convert every The function list could become long, especially if you can convert every
individual pin into a GPIO pin independent of any other pins, and then try individual pin into a GPIO pin independent of any other pins, and then try
...@@ -749,7 +749,7 @@ the approach to define every pin as a function. ...@@ -749,7 +749,7 @@ the approach to define every pin as a function.
In this case, the function array would become 64 entries for each GPIO In this case, the function array would become 64 entries for each GPIO
setting and then the device functions. setting and then the device functions.
For this reason there are two functions a pinmux driver can implement For this reason there are two functions a pin control driver can implement
to enable only GPIO on an individual pin: .gpio_request_enable() and to enable only GPIO on an individual pin: .gpio_request_enable() and
.gpio_disable_free(). .gpio_disable_free().
...@@ -764,7 +764,7 @@ gpiolib driver and the affected GPIO range, pin offset and desired direction ...@@ -764,7 +764,7 @@ gpiolib driver and the affected GPIO range, pin offset and desired direction
will be passed along to this function. will be passed along to this function.
Alternatively to using these special functions, it is fully allowed to use Alternatively to using these special functions, it is fully allowed to use
named functions for each GPIO pin, the pinmux_request_gpio() will attempt to named functions for each GPIO pin, the pinctrl_request_gpio() will attempt to
obtain the function "gpioN" where "N" is the global GPIO pin number if no obtain the function "gpioN" where "N" is the global GPIO pin number if no
special GPIO-handler is registered. special GPIO-handler is registered.
...@@ -783,7 +783,7 @@ spi on the second function mapping: ...@@ -783,7 +783,7 @@ spi on the second function mapping:
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
static const struct pinmux_map __initdata pmx_mapping[] = { static const struct pinctrl_map __initdata mapping[] = {
{ {
.ctrl_dev_name = "pinctrl-foo", .ctrl_dev_name = "pinctrl-foo",
.function = "spi0", .function = "spi0",
...@@ -811,14 +811,14 @@ to map. ...@@ -811,14 +811,14 @@ to map.
You register this pinmux mapping to the pinmux subsystem by simply: You register this pinmux mapping to the pinmux subsystem by simply:
ret = pinmux_register_mappings(pmx_mapping, ARRAY_SIZE(pmx_mapping)); ret = pinctrl_register_mappings(mapping, ARRAY_SIZE(mapping));
Since the above construct is pretty common there is a helper macro to make Since the above construct is pretty common there is a helper macro to make
it even more compact which assumes you want to use pinctrl-foo and position it even more compact which assumes you want to use pinctrl-foo and position
0 for mapping, for example: 0 for mapping, for example:
static struct pinmux_map __initdata pmx_mapping[] = { static struct pinctrl_map __initdata mapping[] = {
PINMUX_MAP("I2CMAP", "pinctrl-foo", "i2c0", "foo-i2c.0"), PIN_MAP("I2CMAP", "pinctrl-foo", "i2c0", "foo-i2c.0"),
}; };
...@@ -901,7 +901,7 @@ case), we define a mapping like this: ...@@ -901,7 +901,7 @@ case), we define a mapping like this:
The result of grabbing this mapping from the device with something like The result of grabbing this mapping from the device with something like
this (see next paragraph): this (see next paragraph):
pmx = pinmux_get(&device, "8bit"); p = pinctrl_get(&device, "8bit");
Will be that you activate all the three bottom records in the mapping at Will be that you activate all the three bottom records in the mapping at
once. Since they share the same name, pin controller device, funcion and once. Since they share the same name, pin controller device, funcion and
...@@ -913,44 +913,44 @@ pinmux core. ...@@ -913,44 +913,44 @@ pinmux core.
Pinmux requests from drivers Pinmux requests from drivers
============================ ============================
Generally it is discouraged to let individual drivers get and enable pinmuxes. Generally it is discouraged to let individual drivers get and enable pin
So if possible, handle the pinmuxes in platform code or some other place where control. So if possible, handle the pin control in platform code or some other
you have access to all the affected struct device * pointers. In some cases place where you have access to all the affected struct device * pointers. In
where a driver needs to switch between different mux mappings at runtime some cases where a driver needs to e.g. switch between different mux mappings
this is not possible. at runtime this is not possible.
A driver may request a certain mux to be activated, usually just the default A driver may request a certain control state to be activated, usually just the
mux like this: default state like this:
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
struct foo_state { struct foo_state {
struct pinmux *pmx; struct pinctrl *p;
... ...
}; };
foo_probe() foo_probe()
{ {
/* Allocate a state holder named "state" etc */ /* Allocate a state holder named "state" etc */
struct pinmux pmx; struct pinctrl p;
pmx = pinmux_get(&device, NULL); p = pinctrl_get(&device, NULL);
if IS_ERR(pmx) if IS_ERR(p)
return PTR_ERR(pmx); return PTR_ERR(p);
pinmux_enable(pmx); pinctrl_enable(p);
state->pmx = pmx; state->p = p;
} }
foo_remove() foo_remove()
{ {
pinmux_disable(state->pmx); pinctrl_disable(state->p);
pinmux_put(state->pmx); pinctrl_put(state->p);
} }
If you want to grab a specific mux mapping and not just the first one found for If you want to grab a specific control mapping and not just the first one
this device you can specify a specific mapping name, for example in the above found for this device you can specify a specific mapping name, for example in
example the second i2c0 setting: pinmux_get(&device, "spi0-pos-B"); the above example the second i2c0 setting: pinctrl_get(&device, "spi0-pos-B");
This get/enable/disable/put sequence can just as well be handled by bus drivers This get/enable/disable/put sequence can just as well be handled by bus drivers
if you don't want each and every driver to handle it and you know the if you don't want each and every driver to handle it and you know the
...@@ -958,35 +958,35 @@ arrangement on your bus. ...@@ -958,35 +958,35 @@ arrangement on your bus.
The semantics of the get/enable respective disable/put is as follows: The semantics of the get/enable respective disable/put is as follows:
- pinmux_get() is called in process context to reserve the pins affected with - pinctrl_get() is called in process context to reserve the pins affected with
a certain mapping and set up the pinmux core and the driver. It will allocate a certain mapping and set up the pinmux core and the driver. It will allocate
a struct from the kernel memory to hold the pinmux state. a struct from the kernel memory to hold the pinmux state.
- pinmux_enable()/pinmux_disable() is quick and can be called from fastpath - pinctrl_enable()/pinctrl_disable() is quick and can be called from fastpath
(irq context) when you quickly want to set up/tear down the hardware muxing (irq context) when you quickly want to set up/tear down the hardware muxing
when running a device driver. Usually it will just poke some values into a when running a device driver. Usually it will just poke some values into a
register. register.
- pinmux_disable() is called in process context to tear down the pin requests - pinctrl_disable() is called in process context to tear down the pin requests
and release the state holder struct for the mux setting. and release the state holder struct for the mux setting etc.
Usually the pinmux core handled the get/put pair and call out to the device Usually the pin control core handled the get/put pair and call out to the
drivers bookkeeping operations, like checking available functions and the device drivers bookkeeping operations, like checking available functions and
associated pins, whereas the enable/disable pass on to the pin controller the associated pins, whereas the enable/disable pass on to the pin controller
driver which takes care of activating and/or deactivating the mux setting by driver which takes care of activating and/or deactivating the mux setting by
quickly poking some registers. quickly poking some registers.
The pins are allocated for your device when you issue the pinmux_get() call, The pins are allocated for your device when you issue the pinctrl_get() call,
after this you should be able to see this in the debugfs listing of all pins. after this you should be able to see this in the debugfs listing of all pins.
System pinmux hogging System pin control hogging
===================== ==========================
A system pinmux map entry, i.e. a pinmux setting that does not have a device A system pin control map entry, i.e. a pin control setting that does not have
associated with it, can be hogged by the core when the pin controller is a device associated with it, can be hogged by the core when the pin controller
registered. This means that the core will attempt to call pinmux_get() and is registered. This means that the core will attempt to call pinctrl_get() and
pinmux_enable() on it immediately after the pin control device has been pinctrl_enable() on it immediately after the pin control device has been
registered. registered.
This is enabled by simply setting the .hog_on_boot field in the map to true, This is enabled by simply setting the .hog_on_boot field in the map to true,
...@@ -1003,7 +1003,7 @@ Since it may be common to request the core to hog a few always-applicable ...@@ -1003,7 +1003,7 @@ Since it may be common to request the core to hog a few always-applicable
mux settings on the primary pin controller, there is a convenience macro for mux settings on the primary pin controller, there is a convenience macro for
this: this:
PINMUX_MAP_PRIMARY_SYS_HOG("POWERMAP", "power_func") PIN_MAP_PRIMARY_SYS_HOG("POWERMAP", "power_func")
This gives the exact same result as the above construction. This gives the exact same result as the above construction.
...@@ -1025,23 +1025,23 @@ it, disables and releases it, and muxes it in on the pins defined by group B: ...@@ -1025,23 +1025,23 @@ it, disables and releases it, and muxes it in on the pins defined by group B:
foo_switch() foo_switch()
{ {
struct pinmux *pmx; struct pinctrl *p;
/* Enable on position A */ /* Enable on position A */
pmx = pinmux_get(&device, "spi0-pos-A"); p = pinctrl_get(&device, "spi0-pos-A");
if IS_ERR(pmx) if IS_ERR(p)
return PTR_ERR(pmx); return PTR_ERR(p);
pinmux_enable(pmx); pinctrl_enable(p);
/* This releases the pins again */ /* This releases the pins again */
pinmux_disable(pmx); pinctrl_disable(p);
pinmux_put(pmx); pinctrl_put(p);
/* Enable on position B */ /* Enable on position B */
pmx = pinmux_get(&device, "spi0-pos-B"); p = pinctrl_get(&device, "spi0-pos-B");
if IS_ERR(pmx) if IS_ERR(p)
return PTR_ERR(pmx); return PTR_ERR(p);
pinmux_enable(pmx); pinctrl_enable(p);
... ...
} }
......
...@@ -1605,21 +1605,21 @@ static struct platform_device pinmux_device = { ...@@ -1605,21 +1605,21 @@ static struct platform_device pinmux_device = {
}; };
/* Pinmux settings */ /* Pinmux settings */
static struct pinmux_map __initdata u300_pinmux_map[] = { static struct pinctrl_map __initdata u300_pinmux_map[] = {
/* anonymous maps for chip power and EMIFs */ /* anonymous maps for chip power and EMIFs */
PINMUX_MAP_SYS_HOG("POWER", "pinmux-u300", "power"), PIN_MAP_SYS_HOG("POWER", "pinmux-u300", "power"),
PINMUX_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"), PIN_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"),
PINMUX_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"), PIN_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"),
/* per-device maps for MMC/SD, SPI and UART */ /* per-device maps for MMC/SD, SPI and UART */
PINMUX_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"), PIN_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"),
PINMUX_MAP("SPI", "pinmux-u300", "spi0", "pl022"), PIN_MAP("SPI", "pinmux-u300", "spi0", "pl022"),
PINMUX_MAP("UART0", "pinmux-u300", "uart0", "uart0"), PIN_MAP("UART0", "pinmux-u300", "uart0", "uart0"),
}; };
struct u300_mux_hog { struct u300_mux_hog {
const char *name; const char *name;
struct device *dev; struct device *dev;
struct pinmux *pmx; struct pinctrl *p;
}; };
static struct u300_mux_hog u300_mux_hogs[] = { static struct u300_mux_hog u300_mux_hogs[] = {
...@@ -1637,31 +1637,31 @@ static struct u300_mux_hog u300_mux_hogs[] = { ...@@ -1637,31 +1637,31 @@ static struct u300_mux_hog u300_mux_hogs[] = {
}, },
}; };
static int __init u300_pinmux_fetch(void) static int __init u300_pinctrl_fetch(void)
{ {
int i; int i;
for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) { for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) {
struct pinmux *pmx; struct pinctrl *p;
int ret; int ret;
pmx = pinmux_get(u300_mux_hogs[i].dev, NULL); p = pinctrl_get(u300_mux_hogs[i].dev, NULL);
if (IS_ERR(pmx)) { if (IS_ERR(p)) {
pr_err("u300: could not get pinmux hog %s\n", pr_err("u300: could not get pinmux hog %s\n",
u300_mux_hogs[i].name); u300_mux_hogs[i].name);
continue; continue;
} }
ret = pinmux_enable(pmx); ret = pinctrl_enable(p);
if (ret) { if (ret) {
pr_err("u300: could enable pinmux hog %s\n", pr_err("u300: could enable pinmux hog %s\n",
u300_mux_hogs[i].name); u300_mux_hogs[i].name);
continue; continue;
} }
u300_mux_hogs[i].pmx = pmx; u300_mux_hogs[i].p = p;
} }
return 0; return 0;
} }
subsys_initcall(u300_pinmux_fetch); subsys_initcall(u300_pinctrl_fetch);
/* /*
* Notice that AMBA devices are initialized before platform devices. * Notice that AMBA devices are initialized before platform devices.
...@@ -1861,7 +1861,7 @@ void __init u300_init_devices(void) ...@@ -1861,7 +1861,7 @@ void __init u300_init_devices(void)
u300_assign_physmem(); u300_assign_physmem();
/* Initialize pinmuxing */ /* Initialize pinmuxing */
pinmux_register_mappings(u300_pinmux_map, pinctrl_register_mappings(u300_pinmux_map,
ARRAY_SIZE(u300_pinmux_map)); ARRAY_SIZE(u300_pinmux_map));
/* Register subdevices on the I2C buses */ /* Register subdevices on the I2C buses */
......
...@@ -624,7 +624,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, ...@@ -624,7 +624,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
mutex_lock(&pinctrldev_list_mutex); mutex_lock(&pinctrldev_list_mutex);
list_add(&pctldev->node, &pinctrldev_list); list_add(&pctldev->node, &pinctrldev_list);
mutex_unlock(&pinctrldev_list_mutex); mutex_unlock(&pinctrldev_list_mutex);
pinmux_hog_maps(pctldev); pinctrl_hog_maps(pctldev);
return pctldev; return pctldev;
out_err: out_err:
...@@ -645,7 +645,7 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev) ...@@ -645,7 +645,7 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
return; return;
pinctrl_remove_device_debugfs(pctldev); pinctrl_remove_device_debugfs(pctldev);
pinmux_unhog_maps(pctldev); pinctrl_unhog_maps(pctldev);
/* TODO: check that no pinmuxes are still active? */ /* TODO: check that no pinmuxes are still active? */
mutex_lock(&pinctrldev_list_mutex); mutex_lock(&pinctrldev_list_mutex);
list_del(&pctldev->node); list_del(&pctldev->node);
......
...@@ -28,8 +28,8 @@ struct pinctrl_gpio_range; ...@@ -28,8 +28,8 @@ struct pinctrl_gpio_range;
* @owner: module providing the pin controller, used for refcounting * @owner: module providing the pin controller, used for refcounting
* @driver_data: driver data for drivers registering to the pin controller * @driver_data: driver data for drivers registering to the pin controller
* subsystem * subsystem
* @pinmux_hogs_lock: lock for the pinmux hog list * @pinctrl_hogs_lock: lock for the pin control hog list
* @pinmux_hogs: list of pinmux maps hogged by this device * @pinctrl_hogs: list of pin control maps hogged by this device
*/ */
struct pinctrl_dev { struct pinctrl_dev {
struct list_head node; struct list_head node;
...@@ -45,8 +45,8 @@ struct pinctrl_dev { ...@@ -45,8 +45,8 @@ struct pinctrl_dev {
struct dentry *device_root; struct dentry *device_root;
#endif #endif
#ifdef CONFIG_PINMUX #ifdef CONFIG_PINMUX
struct mutex pinmux_hogs_lock; struct mutex pinctrl_hogs_lock;
struct list_head pinmux_hogs; struct list_head pinctrl_hogs;
#endif #endif
}; };
......
...@@ -360,14 +360,14 @@ static int u300_gpio_request(struct gpio_chip *chip, unsigned offset) ...@@ -360,14 +360,14 @@ static int u300_gpio_request(struct gpio_chip *chip, unsigned offset)
*/ */
int gpio = chip->base + offset; int gpio = chip->base + offset;
return pinmux_request_gpio(gpio); return pinctrl_request_gpio(gpio);
} }
static void u300_gpio_free(struct gpio_chip *chip, unsigned offset) static void u300_gpio_free(struct gpio_chip *chip, unsigned offset)
{ {
int gpio = chip->base + offset; int gpio = chip->base + offset;
pinmux_free_gpio(gpio); pinctrl_free_gpio(gpio);
} }
static int u300_gpio_get(struct gpio_chip *chip, unsigned offset) static int u300_gpio_get(struct gpio_chip *chip, unsigned offset)
......
This diff is collapsed.
...@@ -16,8 +16,8 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev); ...@@ -16,8 +16,8 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev);
void pinmux_init_device_debugfs(struct dentry *devroot, void pinmux_init_device_debugfs(struct dentry *devroot,
struct pinctrl_dev *pctldev); struct pinctrl_dev *pctldev);
void pinmux_init_debugfs(struct dentry *subsys_root); void pinmux_init_debugfs(struct dentry *subsys_root);
int pinmux_hog_maps(struct pinctrl_dev *pctldev); int pinctrl_hog_maps(struct pinctrl_dev *pctldev);
void pinmux_unhog_maps(struct pinctrl_dev *pctldev); void pinctrl_unhog_maps(struct pinctrl_dev *pctldev);
#else #else
...@@ -35,12 +35,12 @@ static inline void pinmux_init_debugfs(struct dentry *subsys_root) ...@@ -35,12 +35,12 @@ static inline void pinmux_init_debugfs(struct dentry *subsys_root)
{ {
} }
static inline int pinmux_hog_maps(struct pinctrl_dev *pctldev) static inline int pinctrl_hog_maps(struct pinctrl_dev *pctldev)
{ {
return 0; return 0;
} }
static inline void pinmux_unhog_maps(struct pinctrl_dev *pctldev) static inline void pinctrl_unhog_maps(struct pinctrl_dev *pctldev)
{ {
} }
......
...@@ -17,56 +17,56 @@ ...@@ -17,56 +17,56 @@
#include "pinctrl.h" #include "pinctrl.h"
/* This struct is private to the core and should be regarded as a cookie */ /* This struct is private to the core and should be regarded as a cookie */
struct pinmux; struct pinctrl;
#ifdef CONFIG_PINMUX #ifdef CONFIG_PINMUX
/* External interface to pinmux */ /* External interface to pinmux */
extern int pinmux_request_gpio(unsigned gpio); extern int pinctrl_request_gpio(unsigned gpio);
extern void pinmux_free_gpio(unsigned gpio); extern void pinctrl_free_gpio(unsigned gpio);
extern int pinmux_gpio_direction_input(unsigned gpio); extern int pinctrl_gpio_direction_input(unsigned gpio);
extern int pinmux_gpio_direction_output(unsigned gpio); extern int pinctrl_gpio_direction_output(unsigned gpio);
extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); extern struct pinctrl * __must_check pinctrl_get(struct device *dev, const char *name);
extern void pinmux_put(struct pinmux *pmx); extern void pinctrl_put(struct pinctrl *p);
extern int pinmux_enable(struct pinmux *pmx); extern int pinctrl_enable(struct pinctrl *p);
extern void pinmux_disable(struct pinmux *pmx); extern void pinctrl_disable(struct pinctrl *p);
#else /* !CONFIG_PINMUX */ #else /* !CONFIG_PINMUX */
static inline int pinmux_request_gpio(unsigned gpio) static inline int pinctrl_request_gpio(unsigned gpio)
{ {
return 0; return 0;
} }
static inline void pinmux_free_gpio(unsigned gpio) static inline void pinctrl_free_gpio(unsigned gpio)
{ {
} }
static inline int pinmux_gpio_direction_input(unsigned gpio) static inline int pinctrl_gpio_direction_input(unsigned gpio)
{ {
return 0; return 0;
} }
static inline int pinmux_gpio_direction_output(unsigned gpio) static inline int pinctrl_gpio_direction_output(unsigned gpio)
{ {
return 0; return 0;
} }
static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) static inline struct pinctrl * __must_check pinctrl_get(struct device *dev, const char *name)
{ {
return NULL; return NULL;
} }
static inline void pinmux_put(struct pinmux *pmx) static inline void pinctrl_put(struct pinctrl *p)
{ {
} }
static inline int pinmux_enable(struct pinmux *pmx) static inline int pinctrl_enable(struct pinctrl *p)
{ {
return 0; return 0;
} }
static inline void pinmux_disable(struct pinmux *pmx) static inline void pinctrl_disable(struct pinctrl *p)
{ {
} }
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
* *
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#ifndef __LINUX_PINMUX_MACHINE_H #ifndef __LINUX_PINCTRL_MACHINE_H
#define __LINUX_PINMUX_MACHINE_H #define __LINUX_PINCTRL_MACHINE_H
/** /**
* struct pinmux_map - boards/machines shall provide this map for devices * struct pinctrl_map - boards/machines shall provide this map for devices
* @name: the name of this specific map entry for the particular machine. * @name: the name of this specific map entry for the particular machine.
* This is the second parameter passed to pinmux_get() when you want * This is the second parameter passed to pinmux_get() when you want
* to have several mappings to the same device * to have several mappings to the same device
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* a pinmux device supporting it is registered. These maps will not be * a pinmux device supporting it is registered. These maps will not be
* disabled and put until the system shuts down. * disabled and put until the system shuts down.
*/ */
struct pinmux_map { struct pinctrl_map {
const char *name; const char *name;
const char *ctrl_dev_name; const char *ctrl_dev_name;
const char *function; const char *function;
...@@ -47,41 +47,41 @@ struct pinmux_map { ...@@ -47,41 +47,41 @@ struct pinmux_map {
* Convenience macro to set a simple map from a certain pin controller and a * Convenience macro to set a simple map from a certain pin controller and a
* certain function to a named device * certain function to a named device
*/ */
#define PINMUX_MAP(a, b, c, d) \ #define PIN_MAP(a, b, c, d) \
{ .name = a, .ctrl_dev_name = b, .function = c, .dev_name = d } { .name = a, .ctrl_dev_name = b, .function = c, .dev_name = d }
/* /*
* Convenience macro to map a system function onto a certain pinctrl device. * Convenience macro to map a system function onto a certain pinctrl device.
* System functions are not assigned to a particular device. * System functions are not assigned to a particular device.
*/ */
#define PINMUX_MAP_SYS(a, b, c) \ #define PIN_MAP_SYS(a, b, c) \
{ .name = a, .ctrl_dev_name = b, .function = c } { .name = a, .ctrl_dev_name = b, .function = c }
/* /*
* Convenience macro to map a system function onto a certain pinctrl device, * Convenience macro to map a system function onto a certain pinctrl device,
* to be hogged by the pinmux core until the system shuts down. * to be hogged by the pin control core until the system shuts down.
*/ */
#define PINMUX_MAP_SYS_HOG(a, b, c) \ #define PIN_MAP_SYS_HOG(a, b, c) \
{ .name = a, .ctrl_dev_name = b, .function = c, \ { .name = a, .ctrl_dev_name = b, .function = c, \
.hog_on_boot = true } .hog_on_boot = true }
/* /*
* Convenience macro to map a system function onto a certain pinctrl device * Convenience macro to map a system function onto a certain pinctrl device
* using a specified group, to be hogged by the pinmux core until the system * using a specified group, to be hogged by the pin control core until the
* shuts down. * system shuts down.
*/ */
#define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \ #define PIN_MAP_SYS_HOG_GROUP(a, b, c, d) \
{ .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \
.hog_on_boot = true } .hog_on_boot = true }
#ifdef CONFIG_PINMUX #ifdef CONFIG_PINMUX
extern int pinmux_register_mappings(struct pinmux_map const *map, extern int pinctrl_register_mappings(struct pinctrl_map const *map,
unsigned num_maps); unsigned num_maps);
#else #else
static inline int pinmux_register_mappings(struct pinmux_map const *map, static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
unsigned num_maps) unsigned num_maps)
{ {
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment