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

ASoC: codecs: cs4270: move to GPIO consumer API

Get the reset GPIO through the GPIO consumer API. This allows specifying the
DT property as "reset-gpios" without breaking existing DT users.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Daniel Mack and committed by
Mark Brown
f98acd8a eab8e354

+7 -16
+7 -16
sound/soc/codecs/cs4270.c
··· 29 29 #include <linux/i2c.h> 30 30 #include <linux/delay.h> 31 31 #include <linux/regulator/consumer.h> 32 + #include <linux/gpio/consumer.h> 32 33 #include <linux/of_device.h> 33 - #include <linux/of_gpio.h> 34 34 35 35 /* 36 36 * The codec isn't really big-endian or little-endian, since the I2S ··· 658 658 static int cs4270_i2c_probe(struct i2c_client *i2c_client, 659 659 const struct i2c_device_id *id) 660 660 { 661 - struct device_node *np = i2c_client->dev.of_node; 662 661 struct cs4270_private *cs4270; 662 + struct gpio_desc *reset_gpiod; 663 663 unsigned int val; 664 664 int ret, i; 665 665 ··· 678 678 if (ret < 0) 679 679 return ret; 680 680 681 - /* See if we have a way to bring the codec out of reset */ 682 - if (np) { 683 - enum of_gpio_flags flags; 684 - int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags); 685 - 686 - if (gpio_is_valid(gpio)) { 687 - ret = devm_gpio_request_one(&i2c_client->dev, gpio, 688 - flags & OF_GPIO_ACTIVE_LOW ? 689 - GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH, 690 - "cs4270 reset"); 691 - if (ret < 0) 692 - return ret; 693 - } 694 - } 681 + reset_gpiod = devm_gpiod_get_optional(&i2c_client->dev, "reset", 682 + GPIOD_OUT_HIGH); 683 + if (IS_ERR(reset_gpiod) && 684 + PTR_ERR(reset_gpiod) == -EPROBE_DEFER) 685 + return -EPROBE_DEFER; 695 686 696 687 cs4270->regmap = devm_regmap_init_i2c(i2c_client, &cs4270_regmap); 697 688 if (IS_ERR(cs4270->regmap))