mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +00:00
ASoC: wm0010: Convert to GPIO descriptors
This converts the WM0010 codec to use GPIO descriptors. It's a pretty straight-forward conversion also switching over the single in-tree user in the S3C Cragganmore module for S3C 6410. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-1-c4dab6f521ec@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
2cc14f52ae
commit
b53d477756
@ -32,9 +32,18 @@
|
||||
|
||||
#include "crag6410.h"
|
||||
|
||||
static struct gpiod_lookup_table wm0010_gpiod_table = {
|
||||
.dev_id = "spi0.0", /* SPI device name */
|
||||
.table = {
|
||||
/* Active high for Glenfarclas Rev 2 */
|
||||
GPIO_LOOKUP("GPION", 6,
|
||||
"reset", GPIO_ACTIVE_HIGH),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct wm0010_pdata wm0010_pdata = {
|
||||
.gpio_reset = S3C64XX_GPN(6),
|
||||
.reset_active_high = 1, /* Active high for Glenfarclas Rev 2 */
|
||||
/* Intentionally left blank */
|
||||
};
|
||||
|
||||
static struct spi_board_info wm1253_devs[] = {
|
||||
@ -337,7 +346,8 @@ static const struct {
|
||||
{ .id = 0x21, .rev = 0xff, .name = "1275-EV1 Mortlach" },
|
||||
{ .id = 0x25, .rev = 0xff, .name = "1274-EV1 Glencadam" },
|
||||
{ .id = 0x31, .rev = 0xff, .name = "1253-EV1 Tomatin",
|
||||
.spi_devs = wm1253_devs, .num_spi_devs = ARRAY_SIZE(wm1253_devs) },
|
||||
.spi_devs = wm1253_devs, .num_spi_devs = ARRAY_SIZE(wm1253_devs),
|
||||
.gpiod_table = &wm0010_gpiod_table },
|
||||
{ .id = 0x32, .rev = 0xff, .name = "XXXX-EV1 Caol Illa" },
|
||||
{ .id = 0x33, .rev = 0xff, .name = "XXXX-EV1 Oban" },
|
||||
{ .id = 0x34, .rev = 0xff, .name = "WM0010-6320-CS42 Balblair",
|
||||
|
@ -11,12 +11,6 @@
|
||||
#define WM0010_PDATA_H
|
||||
|
||||
struct wm0010_pdata {
|
||||
int gpio_reset;
|
||||
|
||||
/* Set if there is an inverter between the GPIO controlling
|
||||
* the reset signal and the device.
|
||||
*/
|
||||
int reset_active_high;
|
||||
int irq_flags;
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/workqueue.h>
|
||||
@ -94,8 +94,7 @@ struct wm0010_priv {
|
||||
|
||||
struct wm0010_pdata pdata;
|
||||
|
||||
int gpio_reset;
|
||||
int gpio_reset_value;
|
||||
struct gpio_desc *reset;
|
||||
|
||||
struct regulator_bulk_data core_supplies[2];
|
||||
struct regulator *dbvdd;
|
||||
@ -174,8 +173,7 @@ static void wm0010_halt(struct snd_soc_component *component)
|
||||
case WM0010_STAGE2:
|
||||
case WM0010_FIRMWARE:
|
||||
/* Remember to put chip back into reset */
|
||||
gpio_set_value_cansleep(wm0010->gpio_reset,
|
||||
wm0010->gpio_reset_value);
|
||||
gpiod_set_value_cansleep(wm0010->reset, 1);
|
||||
/* Disable the regulators */
|
||||
regulator_disable(wm0010->dbvdd);
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm0010->core_supplies),
|
||||
@ -610,7 +608,7 @@ static int wm0010_boot(struct snd_soc_component *component)
|
||||
}
|
||||
|
||||
/* Release reset */
|
||||
gpio_set_value_cansleep(wm0010->gpio_reset, !wm0010->gpio_reset_value);
|
||||
gpiod_set_value_cansleep(wm0010->reset, 0);
|
||||
spin_lock_irqsave(&wm0010->irq_lock, flags);
|
||||
wm0010->state = WM0010_OUT_OF_RESET;
|
||||
spin_unlock_irqrestore(&wm0010->irq_lock, flags);
|
||||
@ -863,7 +861,6 @@ static int wm0010_probe(struct snd_soc_component *component)
|
||||
|
||||
static int wm0010_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
unsigned long gpio_flags;
|
||||
int ret;
|
||||
int trigger;
|
||||
int irq;
|
||||
@ -903,31 +900,11 @@ static int wm0010_spi_probe(struct spi_device *spi)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (wm0010->pdata.gpio_reset) {
|
||||
wm0010->gpio_reset = wm0010->pdata.gpio_reset;
|
||||
|
||||
if (wm0010->pdata.reset_active_high)
|
||||
wm0010->gpio_reset_value = 1;
|
||||
else
|
||||
wm0010->gpio_reset_value = 0;
|
||||
|
||||
if (wm0010->gpio_reset_value)
|
||||
gpio_flags = GPIOF_OUT_INIT_HIGH;
|
||||
else
|
||||
gpio_flags = GPIOF_OUT_INIT_LOW;
|
||||
|
||||
ret = devm_gpio_request_one(wm0010->dev, wm0010->gpio_reset,
|
||||
gpio_flags, "wm0010 reset");
|
||||
if (ret < 0) {
|
||||
dev_err(wm0010->dev,
|
||||
"Failed to request GPIO for DSP reset: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
dev_err(wm0010->dev, "No reset GPIO configured\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
wm0010->reset = devm_gpiod_get(wm0010->dev, "reset", GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(wm0010->reset))
|
||||
return dev_err_probe(wm0010->dev, PTR_ERR(wm0010->reset),
|
||||
"could not get RESET GPIO\n");
|
||||
gpiod_set_consumer_name(wm0010->reset, "wm0010 reset");
|
||||
|
||||
wm0010->state = WM0010_POWER_OFF;
|
||||
|
||||
@ -972,8 +949,7 @@ static void wm0010_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
struct wm0010_priv *wm0010 = spi_get_drvdata(spi);
|
||||
|
||||
gpio_set_value_cansleep(wm0010->gpio_reset,
|
||||
wm0010->gpio_reset_value);
|
||||
gpiod_set_value_cansleep(wm0010->reset, 1);
|
||||
|
||||
irq_set_irq_wake(wm0010->irq, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user