Skip to contentSkip to conversation

ASoC: rt5677: add GPIO get_direction and enable standalone compilation

PATCH In review Diogo Ivo 3 participants 5 messages Jun 20 – Jun 30

Subsystems (4)
lore
Share & tools
lore

Diogo Ivo

author
#0 lore raw

cover 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.

- 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.

---
Diogo Ivo (2):
ASoC: rt5677: Add GPIO .get_direction() callback
ASoC: rt5677: Enable standalone compilation for generic card use

 sound/soc/codecs/Kconfig  |  2 +-
 sound/soc/codecs/rt5677.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

---
base-commit: 1a3746ccbb0a97bed3c06ccde6b880013b1dddc1
change-id: 20260620-smaug-audio-34f0209f22b4

Best regards,

Signature · 1 line
Diogo Ivo <[email protected]>
author
#1 lore raw

PATCH 1/2 ASoC: rt5677: Add GPIO .get_direction() callback

Implement the get_direction callback for the GPIO controller to allow consumers to query the direction of GPIO pins.

---
 sound/soc/codecs/rt5677.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
sound/soc/codecs/rt5677.c +17 -0
index ac084ca008f3..73fc008d558a 100644
@@ -6,6 +6,7 @@
  * Author: Oder Chiou <[email protected]>
  */
 
+#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,
Signature · 1 line
2.54.0
author
#3 lore raw

PATCH 2/2 ASoC: rt5677: Enable standalone compilation for generic card use

In reply to 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.

---
 sound/soc/codecs/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/Kconfig +1 -1
index 252f683be3c1..e9de333c5c8a 100644
@@ -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
Signature · 1 line
2.54.0
maintainer
#4 lore raw
In reply to Diogo Ivo
Quoted 8 lines · Diogo Ivo

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