aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-ac97.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sound/soc/soc-ac97.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c
index c086786e4471..32c5be61e2ec 100644
--- a/sound/soc/soc-ac97.c
+++ b/sound/soc/soc-ac97.c
@@ -34,14 +34,6 @@ struct snd_ac97_reset_cfg {
int gpio_reset;
};
-struct snd_ac97_gpio_priv {
-#ifdef CONFIG_GPIOLIB
- struct gpio_chip gpio_chip;
-#endif
- unsigned int gpios_set;
- struct snd_soc_component *component;
-};
-
static struct snd_ac97_bus soc_ac97_bus = {
.ops = NULL, /* Gets initialized in snd_soc_set_ac97_ops() */
};
@@ -52,6 +44,12 @@ static void soc_ac97_device_release(struct device *dev)
}
#ifdef CONFIG_GPIOLIB
+struct snd_ac97_gpio_priv {
+ struct gpio_chip gpio_chip;
+ unsigned int gpios_set;
+ struct snd_soc_component *component;
+};
+
static inline struct snd_soc_component *gpio_to_component(struct gpio_chip *chip)
{
struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip);
@@ -59,7 +57,7 @@ static inline struct snd_soc_component *gpio_to_component(struct gpio_chip *chip
return gpio_priv->component;
}
-static int snd_soc_ac97_gpio_request(struct gpio_chip *chip, unsigned offset)
+static int snd_soc_ac97_gpio_request(struct gpio_chip *chip, unsigned int offset)
{
if (offset >= AC97_NUM_GPIOS)
return -EINVAL;
@@ -68,7 +66,7 @@ static int snd_soc_ac97_gpio_request(struct gpio_chip *chip, unsigned offset)
}
static int snd_soc_ac97_gpio_direction_in(struct gpio_chip *chip,
- unsigned offset)
+ unsigned int offset)
{
struct snd_soc_component *component = gpio_to_component(chip);
@@ -77,21 +75,20 @@ static int snd_soc_ac97_gpio_direction_in(struct gpio_chip *chip,
1 << offset, 1 << offset);
}
-static int snd_soc_ac97_gpio_get(struct gpio_chip *chip, unsigned offset)
+static int snd_soc_ac97_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
struct snd_soc_component *component = gpio_to_component(chip);
int ret;
- if (snd_soc_component_read(component, AC97_GPIO_STATUS, &ret) < 0)
- ret = -1;
+ ret = snd_soc_component_read(component, AC97_GPIO_STATUS);
dev_dbg(component->dev, "get gpio %d : %d\n", offset,
- ret < 0 ? ret : ret & (1 << offset));
+ ret & (1 << offset));
- return ret < 0 ? ret : !!(ret & (1 << offset));
+ return !!(ret & (1 << offset));
}
-static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned offset,
+static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned int offset,
int value)
{
struct snd_ac97_gpio_priv *gpio_priv = gpiochip_get_data(chip);
@@ -394,6 +391,8 @@ EXPORT_SYMBOL_GPL(snd_soc_set_ac97_ops);
/**
* snd_soc_set_ac97_ops_of_reset - Set ac97 ops with generic ac97 reset functions
+ * @ops: bus ops
+ * @pdev: platform device
*
* This function sets the reset and warm_reset properties of ops and parses
* the device node of pdev to get pinctrl states and gpio numbers to use.