pinctrl: don't create a device for each pin controller

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

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

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

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Stephen Warren 2011-12-09 16:59:05 -07:00 коммит произвёл Linus Walleij
Родитель 528b78306e
Коммит 51cd24ee62
6 изменённых файлов: 54 добавлений и 99 удалений

Просмотреть файл

@ -783,17 +783,17 @@ spi on the second function mapping:
static const struct pinmux_map __initdata pmx_mapping[] = { static const struct pinmux_map __initdata pmx_mapping[] = {
{ {
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "spi0", .function = "spi0",
.dev_name = "foo-spi.0", .dev_name = "foo-spi.0",
}, },
{ {
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "i2c0", .function = "i2c0",
.dev_name = "foo-i2c.0", .dev_name = "foo-i2c.0",
}, },
{ {
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "mmc0", .function = "mmc0",
.dev_name = "foo-mmc.0", .dev_name = "foo-mmc.0",
}, },
@ -815,7 +815,7 @@ You register this pinmux mapping to the pinmux subsystem by simply:
ret = pinmux_register_mappings(pmx_mapping, ARRAY_SIZE(pmx_mapping)); ret = pinmux_register_mappings(pmx_mapping, ARRAY_SIZE(pmx_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.0 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 pinmux_map __initdata pmx_mapping[] = {
@ -832,14 +832,14 @@ As it is possible to map a function to different groups of pins an optional
... ...
{ {
.name = "spi0-pos-A", .name = "spi0-pos-A",
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "spi0", .function = "spi0",
.group = "spi0_0_grp", .group = "spi0_0_grp",
.dev_name = "foo-spi.0", .dev_name = "foo-spi.0",
}, },
{ {
.name = "spi0-pos-B", .name = "spi0-pos-B",
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "spi0", .function = "spi0",
.group = "spi0_1_grp", .group = "spi0_1_grp",
.dev_name = "foo-spi.0", .dev_name = "foo-spi.0",
@ -858,42 +858,42 @@ case), we define a mapping like this:
... ...
{ {
.name "2bit" .name "2bit"
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "mmc0", .function = "mmc0",
.group = "mmc0_1_grp", .group = "mmc0_1_grp",
.dev_name = "foo-mmc.0", .dev_name = "foo-mmc.0",
}, },
{ {
.name "4bit" .name "4bit"
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "mmc0", .function = "mmc0",
.group = "mmc0_1_grp", .group = "mmc0_1_grp",
.dev_name = "foo-mmc.0", .dev_name = "foo-mmc.0",
}, },
{ {
.name "4bit" .name "4bit"
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "mmc0", .function = "mmc0",
.group = "mmc0_2_grp", .group = "mmc0_2_grp",
.dev_name = "foo-mmc.0", .dev_name = "foo-mmc.0",
}, },
{ {
.name "8bit" .name "8bit"
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "mmc0", .function = "mmc0",
.group = "mmc0_1_grp", .group = "mmc0_1_grp",
.dev_name = "foo-mmc.0", .dev_name = "foo-mmc.0",
}, },
{ {
.name "8bit" .name "8bit"
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "mmc0", .function = "mmc0",
.group = "mmc0_2_grp", .group = "mmc0_2_grp",
.dev_name = "foo-mmc.0", .dev_name = "foo-mmc.0",
}, },
{ {
.name "8bit" .name "8bit"
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "mmc0", .function = "mmc0",
.group = "mmc0_3_grp", .group = "mmc0_3_grp",
.dev_name = "foo-mmc.0", .dev_name = "foo-mmc.0",
@ -996,7 +996,7 @@ like this:
{ {
.name "POWERMAP" .name "POWERMAP"
.ctrl_dev_name = "pinctrl.0", .ctrl_dev_name = "pinctrl-foo",
.function = "power_func", .function = "power_func",
.hog_on_boot = true, .hog_on_boot = true,
}, },

Просмотреть файл

@ -34,12 +34,6 @@
static DEFINE_MUTEX(pinctrldev_list_mutex); static DEFINE_MUTEX(pinctrldev_list_mutex);
static LIST_HEAD(pinctrldev_list); static LIST_HEAD(pinctrldev_list);
static void pinctrl_dev_release(struct device *dev)
{
struct pinctrl_dev *pctldev = dev_get_drvdata(dev);
kfree(pctldev);
}
const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev) const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev)
{ {
/* We're not allowed to register devices without name */ /* We're not allowed to register devices without name */
@ -71,14 +65,14 @@ struct pinctrl_dev *get_pinctrl_dev_from_dev(struct device *dev,
mutex_lock(&pinctrldev_list_mutex); mutex_lock(&pinctrldev_list_mutex);
list_for_each_entry(pctldev, &pinctrldev_list, node) { list_for_each_entry(pctldev, &pinctrldev_list, node) {
if (dev && &pctldev->dev == dev) { if (dev && pctldev->dev == dev) {
/* Matched on device pointer */ /* Matched on device pointer */
found = true; found = true;
break; break;
} }
if (devname && if (devname &&
!strcmp(dev_name(&pctldev->dev), devname)) { !strcmp(dev_name(pctldev->dev), devname)) {
/* Matched on device name */ /* Matched on device name */
found = true; found = true;
break; break;
@ -325,7 +319,7 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
const char *gname = pctlops->get_group_name(pctldev, const char *gname = pctlops->get_group_name(pctldev,
group_selector); group_selector);
if (!strcmp(gname, pin_group)) { if (!strcmp(gname, pin_group)) {
dev_dbg(&pctldev->dev, dev_dbg(pctldev->dev,
"found group selector %u for %s\n", "found group selector %u for %s\n",
group_selector, group_selector,
pin_group); pin_group);
@ -335,7 +329,7 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
group_selector++; group_selector++;
} }
dev_err(&pctldev->dev, "does not have pin group %s\n", dev_err(pctldev->dev, "does not have pin group %s\n",
pin_group); pin_group);
return -EINVAL; return -EINVAL;
@ -508,11 +502,11 @@ static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
{ {
static struct dentry *device_root; static struct dentry *device_root;
device_root = debugfs_create_dir(dev_name(&pctldev->dev), device_root = debugfs_create_dir(dev_name(pctldev->dev),
debugfs_root); debugfs_root);
if (IS_ERR(device_root) || !device_root) { if (IS_ERR(device_root) || !device_root) {
pr_warn("failed to create debugfs directory for %s\n", pr_warn("failed to create debugfs directory for %s\n",
dev_name(&pctldev->dev)); dev_name(pctldev->dev));
return; return;
} }
debugfs_create_file("pins", S_IFREG | S_IRUGO, debugfs_create_file("pins", S_IFREG | S_IRUGO,
@ -560,7 +554,6 @@ static void pinctrl_init_debugfs(void)
struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
struct device *dev, void *driver_data) struct device *dev, void *driver_data)
{ {
static atomic_t pinmux_no = ATOMIC_INIT(0);
struct pinctrl_dev *pctldev; struct pinctrl_dev *pctldev;
int ret; int ret;
@ -601,18 +594,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
spin_lock_init(&pctldev->pin_desc_tree_lock); spin_lock_init(&pctldev->pin_desc_tree_lock);
INIT_LIST_HEAD(&pctldev->gpio_ranges); INIT_LIST_HEAD(&pctldev->gpio_ranges);
mutex_init(&pctldev->gpio_ranges_lock); mutex_init(&pctldev->gpio_ranges_lock);
pctldev->dev = dev;
/* Register device */
pctldev->dev.parent = dev;
dev_set_name(&pctldev->dev, "pinctrl.%d",
atomic_inc_return(&pinmux_no) - 1);
pctldev->dev.release = pinctrl_dev_release;
ret = device_register(&pctldev->dev);
if (ret != 0) {
pr_err("error in device registration\n");
goto out_reg_dev_err;
}
dev_set_drvdata(&pctldev->dev, pctldev);
/* Register all the pins */ /* Register all the pins */
pr_debug("try to register %d pins on %s...\n", pr_debug("try to register %d pins on %s...\n",
@ -622,7 +604,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
pr_err("error during pin registration\n"); pr_err("error during pin registration\n");
pinctrl_free_pindescs(pctldev, pctldesc->pins, pinctrl_free_pindescs(pctldev, pctldesc->pins,
pctldesc->npins); pctldesc->npins);
goto out_reg_pins_err; goto out_err;
} }
pinctrl_init_device_debugfs(pctldev); pinctrl_init_device_debugfs(pctldev);
@ -632,10 +614,8 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
pinmux_hog_maps(pctldev); pinmux_hog_maps(pctldev);
return pctldev; return pctldev;
out_reg_pins_err: out_err:
device_del(&pctldev->dev); kfree(pctldev);
out_reg_dev_err:
put_device(&pctldev->dev);
return NULL; return NULL;
} }
EXPORT_SYMBOL_GPL(pinctrl_register); EXPORT_SYMBOL_GPL(pinctrl_register);
@ -659,7 +639,7 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
/* Destroy descriptor tree */ /* Destroy descriptor tree */
pinctrl_free_pindescs(pctldev, pctldev->desc->pins, pinctrl_free_pindescs(pctldev, pctldev->desc->pins,
pctldev->desc->npins); pctldev->desc->npins);
device_unregister(&pctldev->dev); kfree(pctldev);
} }
EXPORT_SYMBOL_GPL(pinctrl_unregister); EXPORT_SYMBOL_GPL(pinctrl_unregister);

Просмотреть файл

@ -38,7 +38,7 @@ struct pinctrl_dev {
spinlock_t pin_desc_tree_lock; spinlock_t pin_desc_tree_lock;
struct list_head gpio_ranges; struct list_head gpio_ranges;
struct mutex gpio_ranges_lock; struct mutex gpio_ranges_lock;
struct device dev; struct device *dev;
struct module *owner; struct module *owner;
void *driver_data; void *driver_data;
#ifdef CONFIG_PINMUX #ifdef CONFIG_PINMUX

Просмотреть файл

@ -29,7 +29,7 @@ int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
const struct pinconf_ops *ops = pctldev->desc->confops; const struct pinconf_ops *ops = pctldev->desc->confops;
if (!ops || !ops->pin_config_get) { if (!ops || !ops->pin_config_get) {
dev_err(&pctldev->dev, "cannot get pin configuration, missing " dev_err(pctldev->dev, "cannot get pin configuration, missing "
"pin_config_get() function in driver\n"); "pin_config_get() function in driver\n");
return -EINVAL; return -EINVAL;
} }
@ -65,14 +65,14 @@ int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
int ret; int ret;
if (!ops || !ops->pin_config_set) { if (!ops || !ops->pin_config_set) {
dev_err(&pctldev->dev, "cannot configure pin, missing " dev_err(pctldev->dev, "cannot configure pin, missing "
"config function in driver\n"); "config function in driver\n");
return -EINVAL; return -EINVAL;
} }
ret = ops->pin_config_set(pctldev, pin, config); ret = ops->pin_config_set(pctldev, pin, config);
if (ret) { if (ret) {
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"unable to set pin configuration on pin %d\n", pin); "unable to set pin configuration on pin %d\n", pin);
return ret; return ret;
} }
@ -108,7 +108,7 @@ int pin_config_group_get(struct pinctrl_dev *pctldev, const char *pin_group,
int selector; int selector;
if (!ops || !ops->pin_config_group_get) { if (!ops || !ops->pin_config_group_get) {
dev_err(&pctldev->dev, "cannot get configuration for pin " dev_err(pctldev->dev, "cannot get configuration for pin "
"group, missing group config get function in " "group, missing group config get function in "
"driver\n"); "driver\n");
return -EINVAL; return -EINVAL;
@ -135,7 +135,7 @@ int pin_config_group_set(struct pinctrl_dev *pctldev, const char *pin_group,
int i; int i;
if (!ops || (!ops->pin_config_group_set && !ops->pin_config_set)) { if (!ops || (!ops->pin_config_group_set && !ops->pin_config_set)) {
dev_err(&pctldev->dev, "cannot configure pin group, missing " dev_err(pctldev->dev, "cannot configure pin group, missing "
"config function in driver\n"); "config function in driver\n");
return -EINVAL; return -EINVAL;
} }
@ -146,7 +146,7 @@ int pin_config_group_set(struct pinctrl_dev *pctldev, const char *pin_group,
ret = pctlops->get_group_pins(pctldev, selector, &pins, &num_pins); ret = pctlops->get_group_pins(pctldev, selector, &pins, &num_pins);
if (ret) { if (ret) {
dev_err(&pctldev->dev, "cannot configure pin group, error " dev_err(pctldev->dev, "cannot configure pin group, error "
"getting pins\n"); "getting pins\n");
return ret; return ret;
} }

Просмотреть файл

@ -106,24 +106,24 @@ static int pin_request(struct pinctrl_dev *pctldev,
const struct pinmux_ops *ops = pctldev->desc->pmxops; const struct pinmux_ops *ops = pctldev->desc->pmxops;
int status = -EINVAL; int status = -EINVAL;
dev_dbg(&pctldev->dev, "request pin %d for %s\n", pin, function); dev_dbg(pctldev->dev, "request pin %d for %s\n", pin, function);
desc = pin_desc_get(pctldev, pin); desc = pin_desc_get(pctldev, pin);
if (desc == NULL) { if (desc == NULL) {
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"pin is not registered so it cannot be requested\n"); "pin is not registered so it cannot be requested\n");
goto out; goto out;
} }
if (!function) { if (!function) {
dev_err(&pctldev->dev, "no function name given\n"); dev_err(pctldev->dev, "no function name given\n");
return -EINVAL; return -EINVAL;
} }
spin_lock(&desc->lock); spin_lock(&desc->lock);
if (desc->mux_function) { if (desc->mux_function) {
spin_unlock(&desc->lock); spin_unlock(&desc->lock);
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"pin already requested\n"); "pin already requested\n");
goto out; goto out;
} }
@ -132,7 +132,7 @@ static int pin_request(struct pinctrl_dev *pctldev,
/* Let each pin increase references to this module */ /* Let each pin increase references to this module */
if (!try_module_get(pctldev->owner)) { if (!try_module_get(pctldev->owner)) {
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"could not increase module refcount for pin %d\n", "could not increase module refcount for pin %d\n",
pin); pin);
status = -EINVAL; status = -EINVAL;
@ -152,7 +152,7 @@ static int pin_request(struct pinctrl_dev *pctldev,
status = 0; status = 0;
if (status) if (status)
dev_err(&pctldev->dev, "->request on device %s failed " dev_err(pctldev->dev, "->request on device %s failed "
"for pin %d\n", "for pin %d\n",
pctldev->desc->name, pin); pctldev->desc->name, pin);
out_free_pin: out_free_pin:
@ -163,7 +163,7 @@ out_free_pin:
} }
out: out:
if (status) if (status)
dev_err(&pctldev->dev, "pin-%d (%s) status %d\n", dev_err(pctldev->dev, "pin-%d (%s) status %d\n",
pin, function ? : "?", status); pin, function ? : "?", status);
return status; return status;
@ -189,7 +189,7 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin,
desc = pin_desc_get(pctldev, pin); desc = pin_desc_get(pctldev, pin);
if (desc == NULL) { if (desc == NULL) {
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"pin is not registered so it cannot be freed\n"); "pin is not registered so it cannot be freed\n");
return NULL; return NULL;
} }
@ -434,14 +434,14 @@ static int acquire_pins(struct pinctrl_dev *pctldev,
if (ret) if (ret)
return ret; return ret;
dev_dbg(&pctldev->dev, "requesting the %u pins from group %u\n", dev_dbg(pctldev->dev, "requesting the %u pins from group %u\n",
num_pins, group_selector); num_pins, group_selector);
/* Try to allocate all pins in this group, one by one */ /* Try to allocate all pins in this group, one by one */
for (i = 0; i < num_pins; i++) { for (i = 0; i < num_pins; i++) {
ret = pin_request(pctldev, pins[i], func, NULL); ret = pin_request(pctldev, pins[i], func, NULL);
if (ret) { if (ret) {
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"could not get pin %d for function %s " "could not get pin %d for function %s "
"on device %s - conflicting mux mappings?\n", "on device %s - conflicting mux mappings?\n",
pins[i], func ? : "(undefined)", pins[i], func ? : "(undefined)",
@ -473,7 +473,7 @@ static void release_pins(struct pinctrl_dev *pctldev,
ret = pctlops->get_group_pins(pctldev, group_selector, ret = pctlops->get_group_pins(pctldev, group_selector,
&pins, &num_pins); &pins, &num_pins);
if (ret) { if (ret) {
dev_err(&pctldev->dev, "could not get pins to release for " dev_err(pctldev->dev, "could not get pins to release for "
"group selector %d\n", "group selector %d\n",
group_selector); group_selector);
return; return;
@ -525,7 +525,7 @@ static int pinmux_check_pin_group(struct pinctrl_dev *pctldev,
return -EINVAL; return -EINVAL;
ret = pinctrl_get_group_selector(pctldev, groups[0]); ret = pinctrl_get_group_selector(pctldev, groups[0]);
if (ret < 0) { if (ret < 0) {
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"function %s wants group %s but the pin " "function %s wants group %s but the pin "
"controller does not seem to have that group\n", "controller does not seem to have that group\n",
pmxops->get_function_name(pctldev, func_selector), pmxops->get_function_name(pctldev, func_selector),
@ -534,7 +534,7 @@ static int pinmux_check_pin_group(struct pinctrl_dev *pctldev,
} }
if (num_groups > 1) if (num_groups > 1)
dev_dbg(&pctldev->dev, dev_dbg(pctldev->dev,
"function %s support more than one group, " "function %s support more than one group, "
"default-selecting first group %s (%d)\n", "default-selecting first group %s (%d)\n",
pmxops->get_function_name(pctldev, func_selector), pmxops->get_function_name(pctldev, func_selector),
@ -544,13 +544,13 @@ static int pinmux_check_pin_group(struct pinctrl_dev *pctldev,
return ret; return ret;
} }
dev_dbg(&pctldev->dev, dev_dbg(pctldev->dev,
"check if we have pin group %s on controller %s\n", "check if we have pin group %s on controller %s\n",
pin_group, pinctrl_dev_get_name(pctldev)); pin_group, pinctrl_dev_get_name(pctldev));
ret = pinctrl_get_group_selector(pctldev, pin_group); ret = pinctrl_get_group_selector(pctldev, pin_group);
if (ret < 0) { if (ret < 0) {
dev_dbg(&pctldev->dev, dev_dbg(pctldev->dev,
"%s does not support pin group %s with function %s\n", "%s does not support pin group %s with function %s\n",
pinctrl_dev_get_name(pctldev), pinctrl_dev_get_name(pctldev),
pin_group, pin_group,
@ -627,7 +627,7 @@ static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev,
*/ */
if (pmx->pctldev && pmx->pctldev != pctldev) { if (pmx->pctldev && pmx->pctldev != pctldev) {
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"different pin control devices given for device %s, " "different pin control devices given for device %s, "
"function %s\n", "function %s\n",
devname, devname,
@ -650,7 +650,7 @@ static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev,
*/ */
if (pmx->func_selector != UINT_MAX && if (pmx->func_selector != UINT_MAX &&
pmx->func_selector != func_selector) { pmx->func_selector != func_selector) {
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"dual function defines in the map for device %s\n", "dual function defines in the map for device %s\n",
devname); devname);
return -EINVAL; return -EINVAL;
@ -756,7 +756,7 @@ struct pinmux *pinmux_get(struct device *dev, const char *name)
} }
pr_debug("in map, found pctldev %s to handle function %s", pr_debug("in map, found pctldev %s to handle function %s",
dev_name(&pctldev->dev), map->function); dev_name(pctldev->dev), map->function);
/* /*
@ -932,7 +932,7 @@ static int pinmux_hog_map(struct pinctrl_dev *pctldev,
* without any problems, so then we can hog pinmuxes for * without any problems, so then we can hog pinmuxes for
* all devices that just want a static pin mux at this point. * all devices that just want a static pin mux at this point.
*/ */
dev_err(&pctldev->dev, "map %s wants to hog a non-system " dev_err(pctldev->dev, "map %s wants to hog a non-system "
"pinmux, this is not going to work\n", map->name); "pinmux, this is not going to work\n", map->name);
return -EINVAL; return -EINVAL;
} }
@ -944,7 +944,7 @@ static int pinmux_hog_map(struct pinctrl_dev *pctldev,
pmx = pinmux_get(NULL, map->name); pmx = pinmux_get(NULL, map->name);
if (IS_ERR(pmx)) { if (IS_ERR(pmx)) {
kfree(hog); kfree(hog);
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"could not get the %s pinmux mapping for hogging\n", "could not get the %s pinmux mapping for hogging\n",
map->name); map->name);
return PTR_ERR(pmx); return PTR_ERR(pmx);
@ -954,7 +954,7 @@ static int pinmux_hog_map(struct pinctrl_dev *pctldev,
if (ret) { if (ret) {
pinmux_put(pmx); pinmux_put(pmx);
kfree(hog); kfree(hog);
dev_err(&pctldev->dev, dev_err(pctldev->dev,
"could not enable the %s pinmux mapping for hogging\n", "could not enable the %s pinmux mapping for hogging\n",
map->name); map->name);
return ret; return ret;
@ -963,7 +963,7 @@ static int pinmux_hog_map(struct pinctrl_dev *pctldev,
hog->map = map; hog->map = map;
hog->pmx = pmx; hog->pmx = pmx;
dev_info(&pctldev->dev, "hogged map %s, function %s\n", map->name, dev_info(pctldev->dev, "hogged map %s, function %s\n", map->name,
map->function); map->function);
mutex_lock(&pctldev->pinmux_hogs_lock); mutex_lock(&pctldev->pinmux_hogs_lock);
list_add(&hog->node, &pctldev->pinmux_hogs); list_add(&hog->node, &pctldev->pinmux_hogs);
@ -982,7 +982,7 @@ static int pinmux_hog_map(struct pinctrl_dev *pctldev,
*/ */
int pinmux_hog_maps(struct pinctrl_dev *pctldev) int pinmux_hog_maps(struct pinctrl_dev *pctldev)
{ {
struct device *dev = &pctldev->dev; struct device *dev = pctldev->dev;
const char *devname = dev_name(dev); const char *devname = dev_name(dev);
int ret; int ret;
int i; int i;

Просмотреть файл

@ -73,31 +73,6 @@ struct pinmux_map {
{ .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 function onto the primary device pinctrl device
* this is especially helpful on systems that have only one pin controller
* or need to set up a lot of mappings on the primary controller.
*/
#define PINMUX_MAP_PRIMARY(a, b, c) \
{ .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \
.dev_name = c }
/*
* Convenience macro to map a system function onto the primary pinctrl device.
* System functions are not assigned to a particular device.
*/
#define PINMUX_MAP_PRIMARY_SYS(a, b) \
{ .name = a, .ctrl_dev_name = "pinctrl.0", .function = b }
/*
* Convenience macro to map a system function onto the primary pinctrl device,
* to be hogged by the pinmux core until the system shuts down.
*/
#define PINMUX_MAP_PRIMARY_SYS_HOG(a, b) \
{ .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \
.hog_on_boot = true }
#ifdef CONFIG_PINMUX #ifdef CONFIG_PINMUX
extern int pinmux_register_mappings(struct pinmux_map const *map, extern int pinmux_register_mappings(struct pinmux_map const *map,