From 9f0fc191371843c4fc000a226b0a26b6c059aacd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 19:40:19 +0200 Subject: Merging upstream version 6.7.7. Signed-off-by: Daniel Baumann --- sound/soc/codecs/max98373.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'sound/soc/codecs/max98373.c') diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c index fde055c6c8..33eb4576da 100644 --- a/sound/soc/codecs/max98373.c +++ b/sound/soc/codecs/max98373.c @@ -12,9 +12,8 @@ #include #include #include -#include +#include #include -#include #include #include "max98373.h" @@ -478,20 +477,24 @@ void max98373_slot_config(struct device *dev, max98373->i_slot = value & 0xF; else max98373->i_slot = 1; - if (dev->of_node) { - max98373->reset_gpio = of_get_named_gpio(dev->of_node, - "maxim,reset-gpio", 0); - if (!gpio_is_valid(max98373->reset_gpio)) { - dev_err(dev, "Looking up %s property in node %s failed %d\n", - "maxim,reset-gpio", dev->of_node->full_name, - max98373->reset_gpio); - } else { - dev_dbg(dev, "maxim,reset-gpio=%d", - max98373->reset_gpio); - } - } else { - /* this makes reset_gpio as invalid */ - max98373->reset_gpio = -1; + + /* This will assert RESET */ + max98373->reset = devm_gpiod_get_optional(dev, + "maxim,reset", + GPIOD_OUT_HIGH); + if (IS_ERR(max98373->reset)) { + dev_err(dev, "error %ld looking up RESET GPIO line\n", + PTR_ERR(max98373->reset)); + return; + } + + /* Cycle reset */ + if (max98373->reset) { + gpiod_set_consumer_name(max98373->reset ,"MAX98373_RESET"); + gpiod_direction_output(max98373->reset, 1); + msleep(50); + gpiod_direction_output(max98373->reset, 0); + msleep(20); } if (!device_property_read_u32(dev, "maxim,spkfb-slot-no", &value)) -- cgit v1.2.3