Skip to content

Commit ab2a5d1

Browse files
Linus Walleijbroonie
authored andcommitted
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>
1 parent 647a3c4 commit ab2a5d1

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

include/sound/rt5668.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ enum rt5668_jd_src {
2525
};
2626

2727
struct rt5668_platform_data {
28-
29-
int ldo1_en; /* GPIO for LDO1_EN */
30-
3128
enum rt5668_dmic1_data_pin dmic1_data_pin;
3229
enum rt5668_dmic1_clk_pin dmic1_clk_pin;
3330
enum rt5668_jd_src jd_src;

sound/soc/codecs/rt5668.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include <linux/platform_device.h>
1616
#include <linux/spi/spi.h>
1717
#include <linux/acpi.h>
18-
#include <linux/gpio.h>
19-
#include <linux/of_gpio.h>
18+
#include <linux/gpio/consumer.h>
2019
#include <linux/regulator/consumer.h>
2120
#include <linux/mutex.h>
2221
#include <sound/core.h>
@@ -43,6 +42,7 @@ static const char *rt5668_supply_names[RT5668_NUM_SUPPLIES] = {
4342
struct rt5668_priv {
4443
struct snd_soc_component *component;
4544
struct rt5668_platform_data pdata;
45+
struct gpio_desc *ldo1_en;
4646
struct regmap *regmap;
4747
struct snd_soc_jack *hs_jack;
4848
struct regulator_bulk_data supplies[RT5668_NUM_SUPPLIES];
@@ -2393,9 +2393,6 @@ static int rt5668_parse_dt(struct rt5668_priv *rt5668, struct device *dev)
23932393
of_property_read_u32(dev->of_node, "realtek,jd-src",
23942394
&rt5668->pdata.jd_src);
23952395

2396-
rt5668->pdata.ldo1_en = of_get_named_gpio(dev->of_node,
2397-
"realtek,ldo1-en-gpios", 0);
2398-
23992396
return 0;
24002397
}
24012398

@@ -2497,10 +2494,12 @@ static int rt5668_i2c_probe(struct i2c_client *i2c)
24972494
return ret;
24982495
}
24992496

2500-
if (gpio_is_valid(rt5668->pdata.ldo1_en)) {
2501-
if (devm_gpio_request_one(&i2c->dev, rt5668->pdata.ldo1_en,
2502-
GPIOF_OUT_INIT_HIGH, "rt5668"))
2503-
dev_err(&i2c->dev, "Fail gpio_request gpio_ldo\n");
2497+
rt5668->ldo1_en = devm_gpiod_get_optional(&i2c->dev,
2498+
"realtek,ldo1-en",
2499+
GPIOD_OUT_HIGH);
2500+
if (IS_ERR(rt5668->ldo1_en)) {
2501+
dev_err(&i2c->dev, "Fail gpio request ldo1_en\n");
2502+
return PTR_ERR(rt5668->ldo1_en);
25042503
}
25052504

25062505
/* Sleep for 300 ms miniumum */

0 commit comments

Comments
 (0)