Message ID | 20201226094722.16580-1-oleksandr.suvorov@toradex.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mfd: stmpe: Support disabling sub-functions | expand |
Hello Oleksander, On 26.12.20 10:47, Oleksandr Suvorov wrote: > Add support of sub-functions disabling. It allows one to define > an stmpe sub-function device in devicetree, but keep it disabled. > > Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> > --- > > drivers/mfd/stmpe.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c > index 90f3292230c9..2182607b75f6 100644 > --- a/drivers/mfd/stmpe.c > +++ b/drivers/mfd/stmpe.c > @@ -1358,6 +1358,9 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata, > pdata->autosleep = (pdata->autosleep_timeout) ? true : false; > > (np, child) { > + /* skip disabled sub-function */ > + if (!of_device_is_available(child)) > + continue; Better use for_each_available_child_of_node(). > if (of_node_name_eq(child, "stmpe_gpio")) { > pdata->blocks |= STMPE_BLOCK_GPIO; > } else if (of_node_name_eq(child, "stmpe_keypad")) { >
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 90f3292230c9..2182607b75f6 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1358,6 +1358,9 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata, pdata->autosleep = (pdata->autosleep_timeout) ? true : false; for_each_child_of_node(np, child) { + /* skip disabled sub-function */ + if (!of_device_is_available(child)) + continue; if (of_node_name_eq(child, "stmpe_gpio")) { pdata->blocks |= STMPE_BLOCK_GPIO; } else if (of_node_name_eq(child, "stmpe_keypad")) {
Add support of sub-functions disabling. It allows one to define an stmpe sub-function device in devicetree, but keep it disabled. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> --- drivers/mfd/stmpe.c | 3 +++ 1 file changed, 3 insertions(+)