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

ASoC: rt5682s: Convert to use GPIO descriptors

Convert the RT5682S to use GPIO descriptors and drop the
legacy GPIO headers.

We remove the global GPIO number from the platform data,
but it is still possible to create board files using GPIO
descriptor tables, if desired.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230817-descriptors-asoc-rt-v2-5-02fa2ca3e5b0@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Linus Walleij and committed by
Mark Brown
8793bee7 ed117017

+9 -12
-3
include/sound/rt5682s.h
··· 32 32 }; 33 33 34 34 struct rt5682s_platform_data { 35 - 36 - int ldo1_en; /* GPIO for LDO1_EN */ 37 - 38 35 enum rt5682s_dmic1_data_pin dmic1_data_pin; 39 36 enum rt5682s_dmic1_clk_pin dmic1_clk_pin; 40 37 enum rt5682s_jd_src jd_src;
+7 -9
sound/soc/codecs/rt5682s.c
··· 15 15 #include <linux/platform_device.h> 16 16 #include <linux/spi/spi.h> 17 17 #include <linux/acpi.h> 18 - #include <linux/gpio.h> 19 - #include <linux/of_gpio.h> 18 + #include <linux/gpio/consumer.h> 20 19 #include <linux/mutex.h> 21 20 #include <sound/core.h> 22 21 #include <sound/pcm.h> ··· 2972 2973 device_property_read_u32(dev, "realtek,amic-delay-ms", 2973 2974 &rt5682s->pdata.amic_delay); 2974 2975 2975 - rt5682s->pdata.ldo1_en = of_get_named_gpio(dev->of_node, 2976 - "realtek,ldo1-en-gpios", 0); 2977 - 2978 2976 if (device_property_read_string_array(dev, "clock-output-names", 2979 2977 rt5682s->pdata.dai_clk_names, 2980 2978 RT5682S_DAI_NUM_CLKS) < 0) ··· 3168 3172 return ret; 3169 3173 } 3170 3174 3171 - if (gpio_is_valid(rt5682s->pdata.ldo1_en)) { 3172 - if (devm_gpio_request_one(&i2c->dev, rt5682s->pdata.ldo1_en, 3173 - GPIOF_OUT_INIT_HIGH, "rt5682s")) 3174 - dev_err(&i2c->dev, "Fail gpio_request gpio_ldo\n"); 3175 + rt5682s->ldo1_en = devm_gpiod_get_optional(&i2c->dev, 3176 + "realtek,ldo1-en", 3177 + GPIOD_OUT_HIGH); 3178 + if (IS_ERR(rt5682s->ldo1_en)) { 3179 + dev_err(&i2c->dev, "Fail gpio request ldo1_en\n"); 3180 + return PTR_ERR(rt5682s->ldo1_en); 3175 3181 } 3176 3182 3177 3183 /* Sleep for 50 ms minimum */
+2
sound/soc/codecs/rt5682s.h
··· 11 11 12 12 #include <sound/rt5682s.h> 13 13 #include <linux/regulator/consumer.h> 14 + #include <linux/gpio/consumer.h> 14 15 #include <linux/clk.h> 15 16 #include <linux/clkdev.h> 16 17 #include <linux/clk-provider.h> ··· 1447 1446 struct rt5682s_priv { 1448 1447 struct snd_soc_component *component; 1449 1448 struct rt5682s_platform_data pdata; 1449 + struct gpio_desc *ldo1_en; 1450 1450 struct regmap *regmap; 1451 1451 struct snd_soc_jack *hs_jack; 1452 1452 struct regulator_bulk_data supplies[RT5682S_NUM_SUPPLIES];