Skip to content

Commit 443a0a0

Browse files
committed
pinctrl: Introduce struct pinfunction and PINCTRL_PINFUNCTION() macro
There are many pin control drivers define their own data type for pin function representation which is the same or embed the same data as newly introduced one. Provide the data type and convenient macro for all pin control drivers. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent ed153b0 commit 443a0a0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

include/linux/pinctrl/pinctrl.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,26 @@ extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
206206
const char *pin_group, const unsigned **pins,
207207
unsigned *num_pins);
208208

209+
/**
210+
* struct pinfunction - Description about a function
211+
* @name: Name of the function
212+
* @groups: An array of groups for this function
213+
* @ngroups: Number of groups in @groups
214+
*/
215+
struct pinfunction {
216+
const char *name;
217+
const char * const *groups;
218+
size_t ngroups;
219+
};
220+
221+
/* Convenience macro to define a single named pinfunction */
222+
#define PINCTRL_PINFUNCTION(_name, _groups, _ngroups) \
223+
(struct pinfunction) { \
224+
.name = (_name), \
225+
.groups = (_groups), \
226+
.ngroups = (_ngroups), \
227+
}
228+
209229
#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL)
210230
extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
211231
#else

0 commit comments

Comments
 (0)