Files
linux-apfs/include/linux/pinctrl/machine.h
T
Stephen Warren 46919ae63d pinctrl: introduce PINCTRL_STATE_DEFAULT, define hogs as that state
This provides a single centralized name for the default state.

Update PIN_MAP_* macros to use this state name, instead of requiring the
user to pass a state name in.

With this change, hog entries in the mapping table are defined as those
with state name PINCTRL_STATE_DEFAULT, i.e. all entries have the same
name. This interacts badly with the nested iteration over mapping table
entries in pinctrl_hog_maps() and pinctrl_hog_map() which would now
attempt to claim each hog mapping table entry multiple times. Replacing
the custom hog code with a simple pinctrl_get()/pinctrl_enable().

Update documentation and mapping tables to use this.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2012-03-02 16:18:24 +01:00

82 lines
2.6 KiB
C

/*
* Machine interface for the pinctrl subsystem.
*
* Copyright (C) 2011 ST-Ericsson SA
* Written on behalf of Linaro for ST-Ericsson
* Based on bits of regulator core, gpio core and clk core
*
* Author: Linus Walleij <linus.walleij@linaro.org>
*
* License terms: GNU General Public License (GPL) version 2
*/
#ifndef __LINUX_PINCTRL_MACHINE_H
#define __LINUX_PINCTRL_MACHINE_H
#include "pinctrl.h"
/**
* struct pinctrl_map - boards/machines shall provide this map for devices
* @dev_name: the name of the device using this specific mapping, the name
* must be the same as in your struct device*. If this name is set to the
* same name as the pin controllers own dev_name(), the map entry will be
* hogged by the driver itself upon registration
* @name: the name of this specific map entry for the particular machine.
* This is the second parameter passed to pinmux_get() when you want
* to have several mappings to the same device
* @ctrl_dev_name: the name of the device controlling this specific mapping,
* the name must be the same as in your struct device*
* @function: a function in the driver to use for this mapping, the driver
* will lookup the function referenced by this ID on the specified
* pin control device
* @group: sometimes a function can map to different pin groups, so this
* selects a certain specific pin group to activate for the function, if
* left as NULL, the first applicable group will be used
*/
struct pinctrl_map {
const char *dev_name;
const char *name;
const char *ctrl_dev_name;
const char *function;
const char *group;
};
/*
* Convenience macro to set a simple map from a certain pin controller and a
* certain function to a named device
*/
#define PIN_MAP(a, b, c, d) \
{ .name = a, .ctrl_dev_name = b, .function = c, .dev_name = d }
/*
* Convenience macro to map a system function onto a certain pinctrl device,
* to be hogged by the pin control core until the system shuts down.
*/
#define PIN_MAP_SYS_HOG(a, b) \
{ .name = PINCTRL_STATE_DEFAULT, .ctrl_dev_name = a, .dev_name = a, \
.function = b, }
/*
* Convenience macro to map a system function onto a certain pinctrl device
* using a specified group, to be hogged by the pin control core until the
* system shuts down.
*/
#define PIN_MAP_SYS_HOG_GROUP(a, b, c) \
{ .name = PINCTRL_STATE_DEFAULT, .ctrl_dev_name = a, .dev_name = a, \
.function = b, .group = c, }
#ifdef CONFIG_PINMUX
extern int pinctrl_register_mappings(struct pinctrl_map const *map,
unsigned num_maps);
#else
static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
unsigned num_maps)
{
return 0;
}
#endif /* !CONFIG_PINMUX */
#endif