* [PATCH 1/2] ASoC: rt5677: Add GPIO .get_direction() callback
2026-06-20 13:50 [PATCH 0/2] ASoC: rt5677: add GPIO get_direction and enable standalone compilation Diogo Ivo
@ 2026-06-20 13:50 ` Diogo Ivo
2026-06-22 8:13 ` Bartosz Golaszewski
2026-06-20 13:50 ` [PATCH 2/2] ASoC: rt5677: Enable standalone compilation for generic card use Diogo Ivo
2026-06-29 18:41 ` [PATCH 0/2] ASoC: rt5677: add GPIO get_direction and enable standalone compilation Mark Brown
2 siblings, 1 reply; 5+ messages in thread
From: Diogo Ivo @ 2026-06-20 13:50 UTC (permalink / raw)
To: Oder Chiou, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Linus Walleij, Bartosz Golaszewski
Cc: linux-sound, linux-kernel, linux-gpio, Diogo Ivo
Implement the get_direction callback for the GPIO controller to allow
consumers to query the direction of GPIO pins.
Signed-off-by: Diogo Ivo <diogo.ivo@bootlin.com>
---
sound/soc/codecs/rt5677.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index ac084ca008f3..73fc008d558a 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -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,
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] ASoC: rt5677: Add GPIO .get_direction() callback
2026-06-20 13:50 ` [PATCH 1/2] ASoC: rt5677: Add GPIO .get_direction() callback Diogo Ivo
@ 2026-06-22 8:13 ` Bartosz Golaszewski
0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2026-06-22 8:13 UTC (permalink / raw)
To: Diogo Ivo
Cc: linux-sound, linux-kernel, linux-gpio, Oder Chiou, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai, Linus Walleij,
Bartosz Golaszewski
On Sat, 20 Jun 2026 15:50:58 +0200, Diogo Ivo <diogo.ivo@bootlin.com> said:
> Implement the get_direction callback for the GPIO controller to allow
> consumers to query the direction of GPIO pins.
>
> Signed-off-by: Diogo Ivo <diogo.ivo@bootlin.com>
> ---
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] ASoC: rt5677: Enable standalone compilation for generic card use
2026-06-20 13:50 [PATCH 0/2] ASoC: rt5677: add GPIO get_direction and enable standalone compilation Diogo Ivo
2026-06-20 13:50 ` [PATCH 1/2] ASoC: rt5677: Add GPIO .get_direction() callback Diogo Ivo
@ 2026-06-20 13:50 ` Diogo Ivo
2026-06-29 18:41 ` [PATCH 0/2] ASoC: rt5677: add GPIO get_direction and enable standalone compilation Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Diogo Ivo @ 2026-06-20 13:50 UTC (permalink / raw)
To: Oder Chiou, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Linus Walleij, Bartosz Golaszewski
Cc: linux-sound, linux-kernel, linux-gpio, Diogo Ivo
Add a prompt string to make the RT5677 driver user-selectable, allowing
it to be built independently for use with generic sound card bindings.
Signed-off-by: Diogo Ivo <diogo.ivo@bootlin.com>
---
sound/soc/codecs/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 252f683be3c1..e9de333c5c8a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -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
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] ASoC: rt5677: add GPIO get_direction and enable standalone compilation
2026-06-20 13:50 [PATCH 0/2] ASoC: rt5677: add GPIO get_direction and enable standalone compilation Diogo Ivo
2026-06-20 13:50 ` [PATCH 1/2] ASoC: rt5677: Add GPIO .get_direction() callback Diogo Ivo
2026-06-20 13:50 ` [PATCH 2/2] ASoC: rt5677: Enable standalone compilation for generic card use Diogo Ivo
@ 2026-06-29 18:41 ` Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2026-06-29 18:41 UTC (permalink / raw)
To: Oder Chiou, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Linus Walleij, Bartosz Golaszewski, Diogo Ivo
Cc: linux-sound, linux-kernel, linux-gpio
On Sat, 20 Jun 2026 15:50:57 +0200, Diogo Ivo wrote:
> ASoC: rt5677: add GPIO get_direction and enable standalone compilation
>
> 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.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[1/2] ASoC: rt5677: Add GPIO .get_direction() callback
https://git.kernel.org/broonie/sound/c/99e361b2a504
[2/2] ASoC: rt5677: Enable standalone compilation for generic card use
https://git.kernel.org/broonie/sound/c/a5edc45d9cf6
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread