Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mfd: cs42l43: Use gpiod_set_raw for GPIO operations

The GPIO framework supports specifying if a GPIO is active low or
high and will invert accordingly. Whilst specifying this is part of
the normal GPIO definition flow on device tree systems, it is a DSD
extension under ACPI, that Windows doesn't really use. This means most
ACPI systems do not set the polarity of the pin.

The current cs42l43 driver assumes it is setting the level of the line
directly, which is actually the case on all current systems and likely
most future ones. However if the part was used in a device tree system
or an ACPI system that actually used the DSD extensions this would get
inverted, causing the driver to fail probe. As the driver always knows
the polarity of its own reset line, use the raw set API making the
intention to set the level directly clear and to avoid any such future
issues.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20241205115822.2371719-2-ckeepax@opensource.cirrus.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Charles Keepax and committed by
Lee Jones
a57f93b7 d496ad33

+6 -4
+6 -4
drivers/mfd/cs42l43.c
··· 984 984 /* vdd-p must be on for 50uS before any other supply */ 985 985 usleep_range(CS42L43_VDDP_DELAY_US, 2 * CS42L43_VDDP_DELAY_US); 986 986 987 - gpiod_set_value_cansleep(cs42l43->reset, 1); 987 + gpiod_set_raw_value_cansleep(cs42l43->reset, 1); 988 988 989 989 ret = regulator_bulk_enable(CS42L43_N_SUPPLIES, cs42l43->core_supplies); 990 990 if (ret) { ··· 1005 1005 err_core_supplies: 1006 1006 regulator_bulk_disable(CS42L43_N_SUPPLIES, cs42l43->core_supplies); 1007 1007 err_reset: 1008 - gpiod_set_value_cansleep(cs42l43->reset, 0); 1008 + gpiod_set_raw_value_cansleep(cs42l43->reset, 0); 1009 1009 regulator_disable(cs42l43->vdd_p); 1010 1010 1011 1011 return ret; ··· 1027 1027 return ret; 1028 1028 } 1029 1029 1030 - gpiod_set_value_cansleep(cs42l43->reset, 0); 1030 + gpiod_set_raw_value_cansleep(cs42l43->reset, 0); 1031 1031 1032 1032 ret = regulator_disable(cs42l43->vdd_p); 1033 1033 if (ret) { ··· 1052 1052 1053 1053 regcache_cache_only(cs42l43->regmap, true); 1054 1054 1055 - cs42l43->reset = devm_gpiod_get_optional(cs42l43->dev, "reset", GPIOD_OUT_LOW); 1055 + cs42l43->reset = devm_gpiod_get_optional(cs42l43->dev, "reset", GPIOD_OUT_HIGH); 1056 1056 if (IS_ERR(cs42l43->reset)) 1057 1057 return dev_err_probe(cs42l43->dev, PTR_ERR(cs42l43->reset), 1058 1058 "Failed to get reset\n"); 1059 + 1060 + gpiod_set_raw_value_cansleep(cs42l43->reset, 0); 1059 1061 1060 1062 cs42l43->vdd_p = devm_regulator_get(cs42l43->dev, "vdd-p"); 1061 1063 if (IS_ERR(cs42l43->vdd_p))