mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
pinctrl: add optional .release_mux() callback
Add an optional .release_mux() callback to struct pinmux_ops.
Some drivers acquire additional resources in .set_mux(), such as software
locks. These resources may need to be released when the mux function is no
longer active. Introducing a dedicated .release_mux() callback allows
drivers to clean up such resources.
The callback is optional and does not affect existing drivers.
Commit 2243a87d90 ("pinctrl: avoid duplicated calling
enable_pinmux_setting for a pin") removed the .disable() callback
to resolve two issues:
1. desc->mux_usecount increasing monotonically
2. Hardware glitches caused by repeated .disable()/.enable() calls
Adding .release_mux() does not reintroduce those problems. The callback is
intended only for releasing driver-side resources (e.g. locks) and must not
modify hardware registers.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
parent
aaaf31be04
commit
418a2bbdee
|
|
@ -517,6 +517,7 @@ void pinmux_disable_setting(const struct pinctrl_setting *setting)
|
|||
{
|
||||
struct pinctrl_dev *pctldev = setting->pctldev;
|
||||
const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
|
||||
const struct pinmux_ops *ops = pctldev->desc->pmxops;
|
||||
int ret = 0;
|
||||
const unsigned int *pins = NULL;
|
||||
unsigned int num_pins = 0;
|
||||
|
|
@ -563,6 +564,10 @@ void pinmux_disable_setting(const struct pinctrl_setting *setting)
|
|||
pins[i], desc->name, gname);
|
||||
}
|
||||
}
|
||||
|
||||
if (ops->release_mux)
|
||||
ops->release_mux(pctldev, setting->data.mux.func,
|
||||
setting->data.mux.group);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ struct pinctrl_gpio_range;
|
|||
* are handled by the pinmux subsystem. The @func_selector selects a
|
||||
* certain function whereas @group_selector selects a certain set of pins
|
||||
* to be used. On simple controllers the latter argument may be ignored
|
||||
* @release_mux: Release software resources acquired by @set_mux. This callback
|
||||
* must not change hardware state to avoid glitches when switching mux.
|
||||
* @gpio_request_enable: requests and enables GPIO on a certain pin.
|
||||
* Implement this only if you can mux every pin individually as GPIO. The
|
||||
* affected GPIO range is passed along with an offset(pin number) into that
|
||||
|
|
@ -80,6 +82,9 @@ struct pinmux_ops {
|
|||
unsigned int selector);
|
||||
int (*set_mux) (struct pinctrl_dev *pctldev, unsigned int func_selector,
|
||||
unsigned int group_selector);
|
||||
void (*release_mux) (struct pinctrl_dev *pctldev,
|
||||
unsigned int func_selector,
|
||||
unsigned int group_selector);
|
||||
int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
|
||||
struct pinctrl_gpio_range *range,
|
||||
unsigned int offset);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user