mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 15:20:41 +00:00
pinctrl: intel: Make it possible to specify mode per pin in a group
On some SoCs not all pins in a group use the same mode when a certain function is muxed out of them. This makes it possible to specify mode per pin as an array instead in addition to single integer. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
919eb4756e
commit
1f6b419b24
2 changed files with 26 additions and 8 deletions
|
@ -398,7 +398,11 @@ static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned function,
|
||||||
value = readl(padcfg0);
|
value = readl(padcfg0);
|
||||||
|
|
||||||
value &= ~PADCFG0_PMODE_MASK;
|
value &= ~PADCFG0_PMODE_MASK;
|
||||||
value |= grp->mode << PADCFG0_PMODE_SHIFT;
|
|
||||||
|
if (grp->modes)
|
||||||
|
value |= grp->modes[i] << PADCFG0_PMODE_SHIFT;
|
||||||
|
else
|
||||||
|
value |= grp->mode << PADCFG0_PMODE_SHIFT;
|
||||||
|
|
||||||
writel(value, padcfg0);
|
writel(value, padcfg0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,16 @@ struct device;
|
||||||
* @name: Name of the groups
|
* @name: Name of the groups
|
||||||
* @pins: All pins in this group
|
* @pins: All pins in this group
|
||||||
* @npins: Number of pins in this groups
|
* @npins: Number of pins in this groups
|
||||||
* @mode: Native mode in which the group is muxed out @pins
|
* @mode: Native mode in which the group is muxed out @pins. Used if @modes
|
||||||
|
* is %NULL.
|
||||||
|
* @modes: If not %NULL this will hold mode for each pin in @pins
|
||||||
*/
|
*/
|
||||||
struct intel_pingroup {
|
struct intel_pingroup {
|
||||||
const char *name;
|
const char *name;
|
||||||
const unsigned *pins;
|
const unsigned *pins;
|
||||||
size_t npins;
|
size_t npins;
|
||||||
unsigned short mode;
|
unsigned short mode;
|
||||||
|
const unsigned *modes;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,12 +115,23 @@ struct intel_community {
|
||||||
#define PINCTRL_FEATURE_DEBOUNCE BIT(0)
|
#define PINCTRL_FEATURE_DEBOUNCE BIT(0)
|
||||||
#define PINCTRL_FEATURE_1K_PD BIT(1)
|
#define PINCTRL_FEATURE_1K_PD BIT(1)
|
||||||
|
|
||||||
#define PIN_GROUP(n, p, m) \
|
/**
|
||||||
{ \
|
* PIN_GROUP - Declare a pin group
|
||||||
.name = (n), \
|
* @n: Name of the group
|
||||||
.pins = (p), \
|
* @p: An array of pins this group consists
|
||||||
.npins = ARRAY_SIZE((p)), \
|
* @m: Mode which the pins are put when this group is active. Can be either
|
||||||
.mode = (m), \
|
* a single integer or an array of integers in which case mode is per
|
||||||
|
* pin.
|
||||||
|
*/
|
||||||
|
#define PIN_GROUP(n, p, m) \
|
||||||
|
{ \
|
||||||
|
.name = (n), \
|
||||||
|
.pins = (p), \
|
||||||
|
.npins = ARRAY_SIZE((p)), \
|
||||||
|
.mode = __builtin_choose_expr( \
|
||||||
|
__builtin_constant_p((m)), (m), 0), \
|
||||||
|
.modes = __builtin_choose_expr( \
|
||||||
|
__builtin_constant_p((m)), NULL, (m)), \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FUNCTION(n, g) \
|
#define FUNCTION(n, g) \
|
||||||
|
|
Loading…
Reference in a new issue