mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
ASoC: rt5677: add GPIO get_direction and enable standalone compilation
Diogo Ivo <diogo.ivo@bootlin.com> says: This small series fixes two issues in the RT5677 ASoC codec driver: - Patch 1 adds the missing GPIO .get_direction() callback, allowing the direction of GPIO pins to be queried. - Patch 2 makes the Kconfig option user-visible so the driver can be built standalone for example when using generic audio-graph-card bindings, which do not pull in specific codec drivers via select/imply. Link: https://patch.msgid.link/20260620-smaug-audio-v1-0-e318acdf5abd@bootlin.com
This commit is contained in:
commit
28f4d2a9d1
|
|
@ -1888,7 +1888,7 @@ config SND_SOC_RT5670
|
|||
depends on I2C
|
||||
|
||||
config SND_SOC_RT5677
|
||||
tristate
|
||||
tristate "Realtek RT5677 Codec"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
select REGMAP_IRQ
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* Author: Oder Chiou <oder_chiou@realtek.com>
|
||||
*/
|
||||
|
||||
#include <linux/bits.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/fs.h>
|
||||
|
|
@ -4767,6 +4768,21 @@ static int rt5677_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
|
|||
return rt5677_update_gpio_bits(rt5677, offset, m, v);
|
||||
}
|
||||
|
||||
static int rt5677_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
|
||||
{
|
||||
struct rt5677_priv *rt5677 = gpiochip_get_data(chip);
|
||||
unsigned int shift = RT5677_GPIOx_DIR_SFT + (offset % 5) * 3;
|
||||
unsigned int bank = offset / 5;
|
||||
unsigned int reg = bank ? RT5677_GPIO_CTRL3 : RT5677_GPIO_CTRL2;
|
||||
int ret;
|
||||
|
||||
ret = regmap_test_bits(rt5677->regmap, reg, BIT(shift));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return ret ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
|
||||
}
|
||||
|
||||
/*
|
||||
* Configures the GPIO as
|
||||
* 0 - floating
|
||||
|
|
@ -4834,6 +4850,7 @@ static int rt5677_to_irq(struct gpio_chip *chip, unsigned offset)
|
|||
static const struct gpio_chip rt5677_template_chip = {
|
||||
.label = RT5677_DRV_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
.get_direction = rt5677_gpio_get_direction,
|
||||
.direction_output = rt5677_gpio_direction_out,
|
||||
.set = rt5677_gpio_set,
|
||||
.direction_input = rt5677_gpio_direction_in,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user