Skip to contentSkip to conversation

ASoC: rt5514: Add the sanity checks of the buffer related address

PATCH In review Oder Chiou 2 participants 4 messages Jul 31, 2017 – Aug 1, 2017

Subsystems (3)
lore
Share & tools
lore

Oder Chiou

author maintainer
#0 lore raw

PATCH 1/2 ASoC: rt5514: Add the sanity checks of the buffer related address

The patch add the sanity checks of the buffer related address to make sure the addresses are valid.

---
 sound/soc/codecs/rt5514-spi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5514-spi.c +6 -1
index 950d1ff..6f513cc 100644
@@ -173,9 +173,14 @@ static irqreturn_t rt5514_spi_irq(int irq, void *data)
 	rt5514_dsp->buf_rp = buf[0] | buf[1] << 8 | buf[2] << 16 |
 				buf[3] << 24;
 
+	if (rt5514_dsp->buf_rp % 8)
+		rt5514_dsp->buf_rp = (rt5514_dsp->buf_rp / 8) * 8;
+
 	rt5514_dsp->buf_size = rt5514_dsp->buf_limit - rt5514_dsp->buf_base;
 
-	schedule_delayed_work(&rt5514_dsp->copy_work, 0);
+	if (rt5514_dsp->buf_base && rt5514_dsp->buf_limit &&
+		rt5514_dsp->buf_rp && rt5514_dsp->buf_size)
+		schedule_delayed_work(&rt5514_dsp->copy_work, 0);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 2/2 ASoC: rt5514: Set the pin GPIO6(IRQ) to output low as default

The patch set the pin GPIO6(IRQ) to output low as default to prevent the IRQ pin to trigger the IRQ function continuously in the float status.

---
 sound/soc/codecs/rt5514.c | 6 ++++--
 sound/soc/codecs/rt5514.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)
sound/soc/codecs/rt5514.c +4 -2
index 21cbb56..7a1c2aa 100644
@@ -58,7 +58,8 @@ static const struct reg_sequence rt5514_i2c_patch[] = {
 };
 
 static const struct reg_sequence rt5514_patch[] = {
-	{RT5514_DIG_IO_CTRL,		0x00000040},
+	{RT5514_DIG_IO_CTRL,		0x00000240},
+	{RT5514_GPIO_CTRL1,		0x04000000},
 	{RT5514_CLK_CTRL1,		0x38020041},
 	{RT5514_SRC_CTRL,		0x44000eee},
 	{RT5514_ANA_CTRL_LDO10,		0x00028604},
@@ -74,7 +75,8 @@ static const struct reg_default rt5514_reg[] = {
 	{RT5514_I2S_CTRL2,		0x20000000},
 	{RT5514_VAD_CTRL6,		0xc00007d2},
 	{RT5514_EXT_VAD_CTRL,		0x80000080},
-	{RT5514_DIG_IO_CTRL,		0x00000040},
+	{RT5514_DIG_IO_CTRL,		0x00000240},
+	{RT5514_GPIO_CTRL1,		0x04000000},
 	{RT5514_PAD_CTRL1,		0x00804000},
 	{RT5514_DMIC_DATA_CTRL,		0x00000005},
 	{RT5514_DIG_SOURCE_CTRL,	0x00000002},
sound/soc/codecs/rt5514.h +1 -0
index 2dc40e6..3da40d1 100644
@@ -25,6 +25,7 @@
 #define RT5514_VAD_CTRL6			0x2030
 #define RT5514_EXT_VAD_CTRL			0x206c
 #define RT5514_DIG_IO_CTRL			0x2070
+#define RT5514_GPIO_CTRL1			0x2074
 #define RT5514_PAD_CTRL1			0x2080
 #define RT5514_DMIC_DATA_CTRL			0x20a0
 #define RT5514_DIG_SOURCE_CTRL			0x20a4
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH 2/2] ASoC: rt5514: Set the pin GPIO6(IRQ) to output low as default

Quoted 2 lines · Oder Chiou

The patch set the pin GPIO6(IRQ) to output low as default to prevent the IRQ pin to trigger the IRQ function continuously in the float status.

Isn't this going to be a board specific thing? If it's a GPIO presumably it could have other configurations and it might cause problems (perhaps even damage) if it has been used for some other purpose.

maintainer
#3 lore raw

Applied "ASoC: rt5514: Add the sanity checks of the buffer related address" to the asoc tree

In reply to Oder Chiou

The patch

ASoC: rt5514: Add the sanity checks of the buffer related address

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

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

Quoted 1 line

From 818010dac09183e99ff02e35836544b2e1d659f3 Mon Sep 17 00:00:00 2001

From: "[email protected]" <[email protected]>
Date: Mon, 31 Jul 2017 13:47:42 +0800
Subject: [PATCH] ASoC: rt5514: Add the sanity checks of the buffer related
address

The patch add the sanity checks of the buffer related address to make sure the addresses are valid.

---
 sound/soc/codecs/rt5514-spi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5514-spi.c +6 -1
index 950d1ffdc06c..6f513cc4c56c 100644
@@ -173,9 +173,14 @@ static irqreturn_t rt5514_spi_irq(int irq, void *data)
 	rt5514_dsp->buf_rp = buf[0] | buf[1] << 8 | buf[2] << 16 |
 				buf[3] << 24;
 
+	if (rt5514_dsp->buf_rp % 8)
+		rt5514_dsp->buf_rp = (rt5514_dsp->buf_rp / 8) * 8;
+
 	rt5514_dsp->buf_size = rt5514_dsp->buf_limit - rt5514_dsp->buf_base;
 
-	schedule_delayed_work(&rt5514_dsp->copy_work, 0);
+	if (rt5514_dsp->buf_base && rt5514_dsp->buf_limit &&
+		rt5514_dsp->buf_rp && rt5514_dsp->buf_size)
+		schedule_delayed_work(&rt5514_dsp->copy_work, 0);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.13.2