mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-17 10:59:01 +07:00
58cf279aca
Infrastructural changes: - In struct gpio_chip, rename the .dev node to .parent to better reflect the fact that this is not the GPIO struct device abstraction. We will add that soon so this would be totallt confusing. - It was noted that the driver .get_value() callbacks was sometimes reporting negative -ERR values to the gpiolib core, expecting them to be propagated to consumer gpiod_get_value() and gpio_get_value() calls. This was not happening, so as there was a mess of drivers returning negative errors and some returning "anything else than zero" to indicate that a line was active. As some would have bit 31 set to indicate "line active" it clashed with negative error codes. This is fixed by the largeish series clamping values in all drivers with !!value to [0,1] and then augmenting the code to propagate error codes to consumers. (Includes some ACKed patches in other subsystems.) - Add a void *data pointer to struct gpio_chip. The container_of() design pattern is indeed very nice, but we want to reform the struct gpio_chip to be a non-volative, stateless business, and keep states internal to the gpiolib to be able to hold on to the state when adding a proper userspace ABI (character device) further down the road. To achieve this, drivers need a handle at the internal state that is not dependent on their struct gpio_chip() so we add gpiochip_add_data() and gpiochip_get_data() following the pattern of many other subsystems. All the "use gpiochip data pointer" patches transforms drivers to this scheme. - The Generic GPIO chip header has been merged into the general <linux/gpio/driver.h> header, and the custom header for that removed. Instead of having a separate mm_gpio_chip struct for these generic drivers, merge that into struct gpio_chip, simplifying the code and removing the need for separate and confusing includes. Misc improvements: - Stabilize the way GPIOs are looked up from the ACPI legacy specification. - Incremental driver features for PXA, PCA953X, Lantiq (patches from the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48 New drivers: - Add a GPIO chip to the ALSA SoC AC97 driver. - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir, but the branch is merged here too to account for infrastructural changes). - The sx150x driver now supports the sx1502. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWmsZhAAoJEEEQszewGV1ztq0QAJ1KbNOpmf/s3INkOH4r771Z WIrNEsmwwLIAryo8gKNOM0H1zCwhRUV7hIE5jYWgD6JvjuAN6vobMlZAq21j6YpB pKgqnI5DuoND450xjb8wSwGQ5NTYp1rFXNmwCrtyTjOle6AAW+Kp2cvVWxVr77Av uJinRuuBr9GOKW/yYM1Fw/6EPjkvvhVOb+LBguRyVvq0s5Peyw7ZVeY1tjgPHJLn oSZ9dmPUjHEn91oZQbtfro3plOObcxdgJ8vo//pgEmyhMeR8XjXES+aUfErxqWOU PimrZuMMy4cxnsqWwh3Dyxo7KSWfJKfSPRwnGwc/HgbHZEoWxOZI1ezRtGKrRQtj vubxp5dUBA5z66TMsOCeJtzKVSofkvgX2Wr/Y9jKp5oy9cHdAZv9+jEHV1pr6asz Tas97MmmO77XuRI/GPDqVHx8dfa15OIz9s92+Gu64KxNzVxTo4+NdoPSNxkbCILO FKn7EmU3D0OjmN2NJ9GAURoFaj3BBUgNhaxacG9j2bieyh+euuUHRtyh2k8zXR9y 8OnY1UOrTUYF8YIq9pXZxMQRD/lqwCNHvEjtI6BqMcNx4MptfTL+FKYUkn/SgCYk QTNV6Ui+ety5D5aEpp5q0ItGsrDJ2LYSItsS+cOtMy2ieOxbQav9NWwu7eI3l5ly gwYTZjG9p9joPXLW0E3g =63rR -----END PGP SIGNATURE----- Merge tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "Here is the bulk of GPIO changes for v4.5. Notably there are big refactorings mostly by myself, aimed at getting the gpio_chip into a shape that makes me believe I can proceed to preserve state for a proper userspace ABI (character device) that has already been proposed once, but resulted in the feedback that I need to go back and restructure stuff. So I've been restructuring stuff. On the way I ran into brokenness (return code from the get_value() callback) and had to fix it. Also, refactored generic GPIO to be simpler. Some of that is still waiting to trickle down from the subsystems all over the kernel that provide random gpio_chips, I've touched every single GPIO driver in the kernel now, oh man I didn't know I was responsible for so much... Apart from that we're churning along as usual. I took some effort to test and retest so it should merge nicely and we shook out a couple of bugs in -next. Infrastructural changes: - In struct gpio_chip, rename the .dev node to .parent to better reflect the fact that this is not the GPIO struct device abstraction. We will add that soon so this would be totallt confusing. - It was noted that the driver .get_value() callbacks was sometimes reporting negative -ERR values to the gpiolib core, expecting them to be propagated to consumer gpiod_get_value() and gpio_get_value() calls. This was not happening, so as there was a mess of drivers returning negative errors and some returning "anything else than zero" to indicate that a line was active. As some would have bit 31 set to indicate "line active" it clashed with negative error codes. This is fixed by the largeish series clamping values in all drivers with !!value to [0,1] and then augmenting the code to propagate error codes to consumers. (Includes some ACKed patches in other subsystems.) - Add a void *data pointer to struct gpio_chip. The container_of() design pattern is indeed very nice, but we want to reform the struct gpio_chip to be a non-volative, stateless business, and keep states internal to the gpiolib to be able to hold on to the state when adding a proper userspace ABI (character device) further down the road. To achieve this, drivers need a handle at the internal state that is not dependent on their struct gpio_chip() so we add gpiochip_add_data() and gpiochip_get_data() following the pattern of many other subsystems. All the "use gpiochip data pointer" patches transforms drivers to this scheme. - The Generic GPIO chip header has been merged into the general <linux/gpio/driver.h> header, and the custom header for that removed. Instead of having a separate mm_gpio_chip struct for these generic drivers, merge that into struct gpio_chip, simplifying the code and removing the need for separate and confusing includes. Misc improvements: - Stabilize the way GPIOs are looked up from the ACPI legacy specification. - Incremental driver features for PXA, PCA953X, Lantiq (patches from the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48 New drivers: - Add a GPIO chip to the ALSA SoC AC97 driver. - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir, but the branch is merged here too to account for infrastructural changes). - The sx150x driver now supports the sx1502" * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits) gpio: generic: make bgpio_pdata always visible gpiolib: fix chip order in gpio list gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs() gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs() gpio: brcmstb: Allow building driver for BMIPS_GENERIC gpio: brcmstb: Set endian flags for big-endian MIPS gpio: moxart: fix build regression gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() leds: pca9532: use gpiochip data pointer leds: tca6507: use gpiochip data pointer hid: cp2112: use gpiochip data pointer bcma: gpio: use gpiochip data pointer avr32: gpio: use gpiochip data pointer video: fbdev: via: use gpiochip data pointer gpio: pch: Optimize pch_gpio_get() Revert "pinctrl: lantiq: Implement gpio_chip.to_irq" pinctrl: nsp-gpio: use gpiochip data pointer pinctrl: vt8500-wmt: use gpiochip data pointer pinctrl: exynos5440: use gpiochip data pointer pinctrl: at91-pio4: use gpiochip data pointer ...
426 lines
11 KiB
C
426 lines
11 KiB
C
/*
|
|
* soc-ac97.c -- ALSA SoC Audio Layer AC97 support
|
|
*
|
|
* Copyright 2005 Wolfson Microelectronics PLC.
|
|
* Copyright 2005 Openedhand Ltd.
|
|
* Copyright (C) 2010 Slimlogic Ltd.
|
|
* Copyright (C) 2010 Texas Instruments Inc.
|
|
*
|
|
* Author: Liam Girdwood <lrg@slimlogic.co.uk>
|
|
* with code, comments and ideas from :-
|
|
* Richard Purdie <richard@openedhand.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*/
|
|
|
|
#include <linux/ctype.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/export.h>
|
|
#include <linux/gpio.h>
|
|
#include <linux/gpio/driver.h>
|
|
#include <linux/init.h>
|
|
#include <linux/of_gpio.h>
|
|
#include <linux/of.h>
|
|
#include <linux/pinctrl/consumer.h>
|
|
#include <linux/slab.h>
|
|
#include <sound/ac97_codec.h>
|
|
#include <sound/soc.h>
|
|
|
|
struct snd_ac97_reset_cfg {
|
|
struct pinctrl *pctl;
|
|
struct pinctrl_state *pstate_reset;
|
|
struct pinctrl_state *pstate_warm_reset;
|
|
struct pinctrl_state *pstate_run;
|
|
int gpio_sdata;
|
|
int gpio_sync;
|
|
int gpio_reset;
|
|
};
|
|
|
|
struct snd_ac97_gpio_priv {
|
|
#ifdef CONFIG_GPIOLIB
|
|
struct gpio_chip gpio_chip;
|
|
#endif
|
|
unsigned int gpios_set;
|
|
struct snd_soc_codec *codec;
|
|
};
|
|
|
|
static struct snd_ac97_bus soc_ac97_bus = {
|
|
.ops = NULL, /* Gets initialized in snd_soc_set_ac97_ops() */
|
|
};
|
|
|
|
static void soc_ac97_device_release(struct device *dev)
|
|
{
|
|
kfree(to_ac97_t(dev));
|
|
}
|
|
|
|
#ifdef CONFIG_GPIOLIB
|
|
static inline struct snd_soc_codec *gpio_to_codec(struct gpio_chip *chip)
|
|
{
|
|
struct snd_ac97_gpio_priv *gpio_priv =
|
|
container_of(chip, struct snd_ac97_gpio_priv, gpio_chip);
|
|
|
|
return gpio_priv->codec;
|
|
}
|
|
|
|
static int snd_soc_ac97_gpio_request(struct gpio_chip *chip, unsigned offset)
|
|
{
|
|
if (offset >= AC97_NUM_GPIOS)
|
|
return -EINVAL;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int snd_soc_ac97_gpio_direction_in(struct gpio_chip *chip,
|
|
unsigned offset)
|
|
{
|
|
struct snd_soc_codec *codec = gpio_to_codec(chip);
|
|
|
|
dev_dbg(codec->dev, "set gpio %d to output\n", offset);
|
|
return snd_soc_update_bits(codec, AC97_GPIO_CFG,
|
|
1 << offset, 1 << offset);
|
|
}
|
|
|
|
static int snd_soc_ac97_gpio_get(struct gpio_chip *chip, unsigned offset)
|
|
{
|
|
struct snd_soc_codec *codec = gpio_to_codec(chip);
|
|
int ret;
|
|
|
|
ret = snd_soc_read(codec, AC97_GPIO_STATUS);
|
|
dev_dbg(codec->dev, "get gpio %d : %d\n", offset,
|
|
ret < 0 ? ret : ret & (1 << offset));
|
|
|
|
return ret < 0 ? ret : !!(ret & (1 << offset));
|
|
}
|
|
|
|
static void snd_soc_ac97_gpio_set(struct gpio_chip *chip, unsigned offset,
|
|
int value)
|
|
{
|
|
struct snd_ac97_gpio_priv *gpio_priv =
|
|
container_of(chip, struct snd_ac97_gpio_priv, gpio_chip);
|
|
struct snd_soc_codec *codec = gpio_to_codec(chip);
|
|
|
|
gpio_priv->gpios_set &= ~(1 << offset);
|
|
gpio_priv->gpios_set |= (!!value) << offset;
|
|
snd_soc_write(codec, AC97_GPIO_STATUS, gpio_priv->gpios_set);
|
|
dev_dbg(codec->dev, "set gpio %d to %d\n", offset, !!value);
|
|
}
|
|
|
|
static int snd_soc_ac97_gpio_direction_out(struct gpio_chip *chip,
|
|
unsigned offset, int value)
|
|
{
|
|
struct snd_soc_codec *codec = gpio_to_codec(chip);
|
|
|
|
dev_dbg(codec->dev, "set gpio %d to output\n", offset);
|
|
snd_soc_ac97_gpio_set(chip, offset, value);
|
|
return snd_soc_update_bits(codec, AC97_GPIO_CFG, 1 << offset, 0);
|
|
}
|
|
|
|
static struct gpio_chip snd_soc_ac97_gpio_chip = {
|
|
.label = "snd_soc_ac97",
|
|
.owner = THIS_MODULE,
|
|
.request = snd_soc_ac97_gpio_request,
|
|
.direction_input = snd_soc_ac97_gpio_direction_in,
|
|
.get = snd_soc_ac97_gpio_get,
|
|
.direction_output = snd_soc_ac97_gpio_direction_out,
|
|
.set = snd_soc_ac97_gpio_set,
|
|
.can_sleep = 1,
|
|
};
|
|
|
|
static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97,
|
|
struct snd_soc_codec *codec)
|
|
{
|
|
struct snd_ac97_gpio_priv *gpio_priv;
|
|
int ret;
|
|
|
|
gpio_priv = devm_kzalloc(codec->dev, sizeof(*gpio_priv), GFP_KERNEL);
|
|
if (!gpio_priv)
|
|
return -ENOMEM;
|
|
ac97->gpio_priv = gpio_priv;
|
|
gpio_priv->codec = codec;
|
|
gpio_priv->gpio_chip = snd_soc_ac97_gpio_chip;
|
|
gpio_priv->gpio_chip.ngpio = AC97_NUM_GPIOS;
|
|
gpio_priv->gpio_chip.parent = codec->dev;
|
|
gpio_priv->gpio_chip.base = -1;
|
|
|
|
ret = gpiochip_add(&gpio_priv->gpio_chip);
|
|
if (ret != 0)
|
|
dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97)
|
|
{
|
|
gpiochip_remove(&ac97->gpio_priv->gpio_chip);
|
|
}
|
|
#else
|
|
static int snd_soc_ac97_init_gpio(struct snd_ac97 *ac97,
|
|
struct snd_soc_codec *codec)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static void snd_soc_ac97_free_gpio(struct snd_ac97 *ac97)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* snd_soc_alloc_ac97_codec() - Allocate new a AC'97 device
|
|
* @codec: The CODEC for which to create the AC'97 device
|
|
*
|
|
* Allocated a new snd_ac97 device and intializes it, but does not yet register
|
|
* it. The caller is responsible to either call device_add(&ac97->dev) to
|
|
* register the device, or to call put_device(&ac97->dev) to free the device.
|
|
*
|
|
* Returns: A snd_ac97 device or a PTR_ERR in case of an error.
|
|
*/
|
|
struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec)
|
|
{
|
|
struct snd_ac97 *ac97;
|
|
|
|
ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
|
|
if (ac97 == NULL)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
ac97->bus = &soc_ac97_bus;
|
|
ac97->num = 0;
|
|
|
|
ac97->dev.bus = &ac97_bus_type;
|
|
ac97->dev.parent = codec->component.card->dev;
|
|
ac97->dev.release = soc_ac97_device_release;
|
|
|
|
dev_set_name(&ac97->dev, "%d-%d:%s",
|
|
codec->component.card->snd_card->number, 0,
|
|
codec->component.name);
|
|
|
|
device_initialize(&ac97->dev);
|
|
|
|
return ac97;
|
|
}
|
|
EXPORT_SYMBOL(snd_soc_alloc_ac97_codec);
|
|
|
|
/**
|
|
* snd_soc_new_ac97_codec - initailise AC97 device
|
|
* @codec: audio codec
|
|
* @id: The expected device ID
|
|
* @id_mask: Mask that is applied to the device ID before comparing with @id
|
|
*
|
|
* Initialises AC97 codec resources for use by ad-hoc devices only.
|
|
*
|
|
* If @id is not 0 this function will reset the device, then read the ID from
|
|
* the device and check if it matches the expected ID. If it doesn't match an
|
|
* error will be returned and device will not be registered.
|
|
*
|
|
* Returns: A PTR_ERR() on failure or a valid snd_ac97 struct on success.
|
|
*/
|
|
struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
|
|
unsigned int id, unsigned int id_mask)
|
|
{
|
|
struct snd_ac97 *ac97;
|
|
int ret;
|
|
|
|
ac97 = snd_soc_alloc_ac97_codec(codec);
|
|
if (IS_ERR(ac97))
|
|
return ac97;
|
|
|
|
if (id) {
|
|
ret = snd_ac97_reset(ac97, false, id, id_mask);
|
|
if (ret < 0) {
|
|
dev_err(codec->dev, "Failed to reset AC97 device: %d\n",
|
|
ret);
|
|
goto err_put_device;
|
|
}
|
|
}
|
|
|
|
ret = device_add(&ac97->dev);
|
|
if (ret)
|
|
goto err_put_device;
|
|
|
|
ret = snd_soc_ac97_init_gpio(ac97, codec);
|
|
if (ret)
|
|
goto err_put_device;
|
|
|
|
return ac97;
|
|
|
|
err_put_device:
|
|
put_device(&ac97->dev);
|
|
return ERR_PTR(ret);
|
|
}
|
|
EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec);
|
|
|
|
/**
|
|
* snd_soc_free_ac97_codec - free AC97 codec device
|
|
* @codec: audio codec
|
|
*
|
|
* Frees AC97 codec device resources.
|
|
*/
|
|
void snd_soc_free_ac97_codec(struct snd_ac97 *ac97)
|
|
{
|
|
snd_soc_ac97_free_gpio(ac97);
|
|
device_del(&ac97->dev);
|
|
ac97->bus = NULL;
|
|
put_device(&ac97->dev);
|
|
}
|
|
EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);
|
|
|
|
static struct snd_ac97_reset_cfg snd_ac97_rst_cfg;
|
|
|
|
static void snd_soc_ac97_warm_reset(struct snd_ac97 *ac97)
|
|
{
|
|
struct pinctrl *pctl = snd_ac97_rst_cfg.pctl;
|
|
|
|
pinctrl_select_state(pctl, snd_ac97_rst_cfg.pstate_warm_reset);
|
|
|
|
gpio_direction_output(snd_ac97_rst_cfg.gpio_sync, 1);
|
|
|
|
udelay(10);
|
|
|
|
gpio_direction_output(snd_ac97_rst_cfg.gpio_sync, 0);
|
|
|
|
pinctrl_select_state(pctl, snd_ac97_rst_cfg.pstate_run);
|
|
msleep(2);
|
|
}
|
|
|
|
static void snd_soc_ac97_reset(struct snd_ac97 *ac97)
|
|
{
|
|
struct pinctrl *pctl = snd_ac97_rst_cfg.pctl;
|
|
|
|
pinctrl_select_state(pctl, snd_ac97_rst_cfg.pstate_reset);
|
|
|
|
gpio_direction_output(snd_ac97_rst_cfg.gpio_sync, 0);
|
|
gpio_direction_output(snd_ac97_rst_cfg.gpio_sdata, 0);
|
|
gpio_direction_output(snd_ac97_rst_cfg.gpio_reset, 0);
|
|
|
|
udelay(10);
|
|
|
|
gpio_direction_output(snd_ac97_rst_cfg.gpio_reset, 1);
|
|
|
|
pinctrl_select_state(pctl, snd_ac97_rst_cfg.pstate_run);
|
|
msleep(2);
|
|
}
|
|
|
|
static int snd_soc_ac97_parse_pinctl(struct device *dev,
|
|
struct snd_ac97_reset_cfg *cfg)
|
|
{
|
|
struct pinctrl *p;
|
|
struct pinctrl_state *state;
|
|
int gpio;
|
|
int ret;
|
|
|
|
p = devm_pinctrl_get(dev);
|
|
if (IS_ERR(p)) {
|
|
dev_err(dev, "Failed to get pinctrl\n");
|
|
return PTR_ERR(p);
|
|
}
|
|
cfg->pctl = p;
|
|
|
|
state = pinctrl_lookup_state(p, "ac97-reset");
|
|
if (IS_ERR(state)) {
|
|
dev_err(dev, "Can't find pinctrl state ac97-reset\n");
|
|
return PTR_ERR(state);
|
|
}
|
|
cfg->pstate_reset = state;
|
|
|
|
state = pinctrl_lookup_state(p, "ac97-warm-reset");
|
|
if (IS_ERR(state)) {
|
|
dev_err(dev, "Can't find pinctrl state ac97-warm-reset\n");
|
|
return PTR_ERR(state);
|
|
}
|
|
cfg->pstate_warm_reset = state;
|
|
|
|
state = pinctrl_lookup_state(p, "ac97-running");
|
|
if (IS_ERR(state)) {
|
|
dev_err(dev, "Can't find pinctrl state ac97-running\n");
|
|
return PTR_ERR(state);
|
|
}
|
|
cfg->pstate_run = state;
|
|
|
|
gpio = of_get_named_gpio(dev->of_node, "ac97-gpios", 0);
|
|
if (gpio < 0) {
|
|
dev_err(dev, "Can't find ac97-sync gpio\n");
|
|
return gpio;
|
|
}
|
|
ret = devm_gpio_request(dev, gpio, "AC97 link sync");
|
|
if (ret) {
|
|
dev_err(dev, "Failed requesting ac97-sync gpio\n");
|
|
return ret;
|
|
}
|
|
cfg->gpio_sync = gpio;
|
|
|
|
gpio = of_get_named_gpio(dev->of_node, "ac97-gpios", 1);
|
|
if (gpio < 0) {
|
|
dev_err(dev, "Can't find ac97-sdata gpio %d\n", gpio);
|
|
return gpio;
|
|
}
|
|
ret = devm_gpio_request(dev, gpio, "AC97 link sdata");
|
|
if (ret) {
|
|
dev_err(dev, "Failed requesting ac97-sdata gpio\n");
|
|
return ret;
|
|
}
|
|
cfg->gpio_sdata = gpio;
|
|
|
|
gpio = of_get_named_gpio(dev->of_node, "ac97-gpios", 2);
|
|
if (gpio < 0) {
|
|
dev_err(dev, "Can't find ac97-reset gpio\n");
|
|
return gpio;
|
|
}
|
|
ret = devm_gpio_request(dev, gpio, "AC97 link reset");
|
|
if (ret) {
|
|
dev_err(dev, "Failed requesting ac97-reset gpio\n");
|
|
return ret;
|
|
}
|
|
cfg->gpio_reset = gpio;
|
|
|
|
return 0;
|
|
}
|
|
|
|
struct snd_ac97_bus_ops *soc_ac97_ops;
|
|
EXPORT_SYMBOL_GPL(soc_ac97_ops);
|
|
|
|
int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
|
|
{
|
|
if (ops == soc_ac97_ops)
|
|
return 0;
|
|
|
|
if (soc_ac97_ops && ops)
|
|
return -EBUSY;
|
|
|
|
soc_ac97_ops = ops;
|
|
soc_ac97_bus.ops = ops;
|
|
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(snd_soc_set_ac97_ops);
|
|
|
|
/**
|
|
* snd_soc_set_ac97_ops_of_reset - Set ac97 ops with generic ac97 reset functions
|
|
*
|
|
* 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.
|
|
*/
|
|
int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
|
|
struct platform_device *pdev)
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
struct snd_ac97_reset_cfg cfg;
|
|
int ret;
|
|
|
|
ret = snd_soc_ac97_parse_pinctl(dev, &cfg);
|
|
if (ret)
|
|
return ret;
|
|
|
|
ret = snd_soc_set_ac97_ops(ops);
|
|
if (ret)
|
|
return ret;
|
|
|
|
ops->warm_reset = snd_soc_ac97_warm_reset;
|
|
ops->reset = snd_soc_ac97_reset;
|
|
|
|
snd_ac97_rst_cfg = cfg;
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(snd_soc_set_ac97_ops_of_reset);
|