/* For this first generation of pinctrl driver every pinmux group can be *enabledbyaspecificbitinthefirstregisterrange.Whenallgroupsfor *agivenpinaredisabledthepinactsasaGPIO.
*/ #include <linux/device.h> #include <linux/regmap.h> #include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinmux.h>
/** *meson8_pmx_disable_other_groups()-disableothergroupsusingagivenpin * *@pc:mesonpincontrollerdevice *@pin:numberofthepin *@sel_group:indexoftheselectedgroup,or-1ifnone * *Thefunctiondisablesallpinmuxgroupsusingapinexceptthe *selectedone.If@sel_groupis-1allgroupsaredisabled,leaving *thepininGPIOmode.
*/ staticvoid meson8_pmx_disable_other_groups(struct meson_pinctrl *pc, unsignedint pin, int sel_group)
{ conststruct meson_pmx_group *group; struct meson8_pmx_data *pmx_data; int i, j;
for (i = 0; i < pc->data->num_groups; i++) {
group = &pc->data->groups[i];
pmx_data = (struct meson8_pmx_data *)group->data; if (pmx_data->is_gpio || i == sel_group) continue;
for (j = 0; j < group->num_pins; j++) { if (group->pins[j] == pin) { /* We have found a group using the pin */
regmap_update_bits(pc->reg_mux,
pmx_data->reg * 4,
BIT(pmx_data->bit), 0);
}
}
}
}
dev_dbg(pc->dev, "enable function %s, group %s\n", func->name,
group->name);
/* *Disablegroupsusingthesamepin. *Theselectedgroupisnotdisabledtoavoidglitches.
*/ for (i = 0; i < group->num_pins; i++)
meson8_pmx_disable_other_groups(pc, group->pins[i], group_num);
/* Function 0 (GPIO) doesn't need any additional setting */ if (func_num)
ret = regmap_update_bits(pc->reg_mux, pmx_data->reg * 4,
BIT(pmx_data->bit),
BIT(pmx_data->bit));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.