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

ASoC: rt5668: Convert to use GPIO descriptors

Convert the RT5668 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-3-02fa2ca3e5b0@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Linus Walleij and committed by
Mark Brown
ab2a5d17 647a3c4c

+8 -12
-3
include/sound/rt5668.h
··· 25 25 }; 26 26 27 27 struct rt5668_platform_data { 28 - 29 - int ldo1_en; /* GPIO for LDO1_EN */ 30 - 31 28 enum rt5668_dmic1_data_pin dmic1_data_pin; 32 29 enum rt5668_dmic1_clk_pin dmic1_clk_pin; 33 30 enum rt5668_jd_src jd_src;
+8 -9
sound/soc/codecs/rt5668.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/regulator/consumer.h> 21 20 #include <linux/mutex.h> 22 21 #include <sound/core.h> ··· 42 43 struct rt5668_priv { 43 44 struct snd_soc_component *component; 44 45 struct rt5668_platform_data pdata; 46 + struct gpio_desc *ldo1_en; 45 47 struct regmap *regmap; 46 48 struct snd_soc_jack *hs_jack; 47 49 struct regulator_bulk_data supplies[RT5668_NUM_SUPPLIES]; ··· 2393 2393 of_property_read_u32(dev->of_node, "realtek,jd-src", 2394 2394 &rt5668->pdata.jd_src); 2395 2395 2396 - rt5668->pdata.ldo1_en = of_get_named_gpio(dev->of_node, 2397 - "realtek,ldo1-en-gpios", 0); 2398 - 2399 2396 return 0; 2400 2397 } 2401 2398 ··· 2494 2497 return ret; 2495 2498 } 2496 2499 2497 - if (gpio_is_valid(rt5668->pdata.ldo1_en)) { 2498 - if (devm_gpio_request_one(&i2c->dev, rt5668->pdata.ldo1_en, 2499 - GPIOF_OUT_INIT_HIGH, "rt5668")) 2500 - dev_err(&i2c->dev, "Fail gpio_request gpio_ldo\n"); 2500 + rt5668->ldo1_en = devm_gpiod_get_optional(&i2c->dev, 2501 + "realtek,ldo1-en", 2502 + GPIOD_OUT_HIGH); 2503 + if (IS_ERR(rt5668->ldo1_en)) { 2504 + dev_err(&i2c->dev, "Fail gpio request ldo1_en\n"); 2505 + return PTR_ERR(rt5668->ldo1_en); 2501 2506 } 2502 2507 2503 2508 /* Sleep for 300 ms miniumum */