* [PATCH v3 0/7] ASoC: qcom: Add Nord audio support
@ 2026-10-09 13:12 Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 1/7] ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock Mohammad Rafi Shaik
` (6 more replies)
0 siblings, 7 replies; 14+ messages in thread
From: Mohammad Rafi Shaik @ 2026-10-09 13:12 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla, Shawn Guo
Cc: Mohammad Rafi Shaik, linux-sound, devicetree, linux-kernel,
linux-arm-msm
This series adds audio support for the Qualcomm Nord Ride and
RRD boards and includes the required machine driver, device tree
binding updates, and codec improvements needed for the board's
external audio codec configuration.
Nord Ride uses a PCM1681 DAC for playback and an ADAU1979 ADC for capture.
Compared to other SC8280XP based platforms, Nord Ride requires
board-specific DAI format and codec clock configuration to support
the external PCM1681 DAC and ADAU1979 ADC.
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
Changes in v3:
- Enabled PCM1681 VCC1, VCC2 and VDD supplies, as suggested Konrad.
- Link to v2: https://patch.msgid.link/20261008-nord-asoc-driver-support-v2-v2-0-0b6f7e94060d@oss.qualcomm.com
Changes in v2:
- Dropped patch 1 from v1, as the ADAU1979 codec change has already been applied.
- Moved the compatible string from the board-specific file to the SoC file, as suggested by Shawn.
- Added runtime PM support to the PCM1681 codec to manage the SCK clock sequence.
- Added TDM support to the PCM1681 codec.
- Added the required POR delay to the PCM1681 codec, as suggested by Mark Brown.
- Replaced LPASS DAI IDs with QAIF DAI IDs.
- Link to v1: https://patch.msgid.link/20260907-nord-asoc-driver-support-v1-0-997d3b20cf43@oss.qualcomm.com
To: Shenghao Ding <shenghao-ding@ti.com>
To: Kevin Lu <kevin-lu@ti.com>
To: Baojun Xu <baojun.xu@ti.com>
To: Sen Wang <sen@ti.com>
To: Liam Girdwood <lgirdwood@gmail.com>
To: Mark Brown <broonie@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>
To: Takashi Iwai <tiwai@suse.com>
To: Srinivas Kandagatla <srini@kernel.org>
To: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Cc: linux-sound@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org
---
Mohammad Rafi Shaik (5):
ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock
ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support
ASoC: codec: pcm1681: Add TDM support
ASoC: dt-bindings: qcom,sm8250: Add Nord sound card
ASoC: qcom: sc8280xp: Add Nord sound card support
Shawn Guo (2):
ASoC: dt-bindings: ti,pcm1681: Document the PCM1681 supplies
ASoC: codec: pcm1681: Enable the PCM1681 supplies
.../devicetree/bindings/sound/qcom,sm8250.yaml | 1 +
.../devicetree/bindings/sound/ti,pcm1681.yaml | 16 +++
sound/soc/codecs/pcm1681.c | 157 +++++++++++++++++++--
sound/soc/qcom/sc8280xp.c | 51 +++++++
4 files changed, 217 insertions(+), 8 deletions(-)
---
base-commit: 62d9f9ffdfd44e88010412bf8f23732f0a93a9be
change-id: 20261009-nord-asoc-driver-support-v3-71ebd98740c6
Best regards,
--
Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 1/7] ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
@ 2026-10-09 13:12 ` Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support Mohammad Rafi Shaik
` (5 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Mohammad Rafi Shaik @ 2026-10-09 13:12 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla, Shawn Guo
Cc: Mohammad Rafi Shaik, linux-sound, devicetree, linux-kernel,
linux-arm-msm
The PCM1681 can use an external system clock supplied on the SCK input
pin. Platforms that provide this clock need a way to describe the clock
connection in Device Tree.
Document the optional 'clocks' and 'clock-names' properties and define
the clock name as "sck" to represent the external system clock source.
This allows boards using an externally supplied SCK clock to accurately
describe the hardware configuration.
Reviewed-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
Documentation/devicetree/bindings/sound/ti,pcm1681.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/ti,pcm1681.yaml b/Documentation/devicetree/bindings/sound/ti,pcm1681.yaml
index 1f0e6787a..1b3803518 100644
--- a/Documentation/devicetree/bindings/sound/ti,pcm1681.yaml
+++ b/Documentation/devicetree/bindings/sound/ti,pcm1681.yaml
@@ -21,6 +21,13 @@ properties:
reg:
maxItems: 1
+ clocks:
+ maxItems: 1
+ description: System clock (SCK)
+
+ clock-names:
+ const: sck
+
"#sound-dai-cells":
const: 0
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 1/7] ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock Mohammad Rafi Shaik
@ 2026-10-09 13:12 ` Mohammad Rafi Shaik
2026-10-09 13:23 ` sashiko-bot
2026-10-10 3:07 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support Mohammad Rafi Shaik
` (4 subsequent siblings)
6 siblings, 2 replies; 14+ messages in thread
From: Mohammad Rafi Shaik @ 2026-10-09 13:12 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla, Shawn Guo
Cc: Mohammad Rafi Shaik, linux-sound, devicetree, linux-kernel,
linux-arm-msm
The PCM1681 requires its SCK system clock to be running before register
access. On platforms where SCK is provided by a gateable clock, register
access may fail when the clock is disabled.
Add support for an optional "sck" clock and enable it before accessing the
device. After enabling SCK, wait for the required 65536 system clock cycles
to allow the device to complete its internal reset sequence.
Use runtime PM to manage SCK instead of keeping it enabled for the lifetime
of the device. Disable the clock during runtime suspend and restore it on
runtime resume. Use autosuspend to avoid unnecessary clock toggling between
closely spaced accesses.
Since the device register state may be lost when SCK is disabled, enable
the regmap cache. Switch regmap to cache-only mode and mark the cache
dirty on runtime suspend, then synchronize the cached register state after
SCK is restored on runtime resume. Mark the zero-detect status register
volatile since it is updated by hardware.
Drop idle_bias_on so that the component can reach SND_SOC_BIAS_OFF and
runtime suspend can gate SCK.
Assisted-by: LLM
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
sound/soc/codecs/pcm1681.c | 137 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 131 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index 60fdbe5c4..a1ccf1edf 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -12,6 +12,8 @@
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/of.h>
+#include <linux/clk.h>
+#include <linux/pm_runtime.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -36,6 +38,12 @@
#define PCM1681_DEEMPH_CONTROL 0x0a /* De-emphasis control */
#define PCM1681_ZERO_DETECT_STATUS 0x0e /* Zero detect status reg */
+/*
+ * The DAC requires 65536 system clock cycles after the clock is supplied to
+ * complete its internal reset sequence before it is ready to be used.
+ */
+#define PCM1681_SCK_SETTLE_CYCLES 65536
+
static const struct reg_default pcm1681_reg_defaults[] = {
{ 0x01, 0xff },
{ 0x02, 0xff },
@@ -67,6 +75,12 @@ static bool pcm1681_writeable_reg(struct device *dev, unsigned int reg)
(reg != PCM1681_ZERO_DETECT_STATUS);
}
+static bool pcm1681_volatile_reg(struct device *dev, unsigned int reg)
+{
+ /* Status is updated by the hardware and must never be cached */
+ return reg == PCM1681_ZERO_DETECT_STATUS;
+}
+
struct pcm1681_private {
struct regmap *regmap;
unsigned int format;
@@ -74,8 +88,24 @@ struct pcm1681_private {
unsigned int deemph;
/* Current rate for deemphasis control */
unsigned int rate;
+ struct clk *sck;
};
+/* Wait for the DAC to come out of its internal reset after sck is enabled */
+static void pcm1681_sck_settle(struct pcm1681_private *priv)
+{
+ unsigned long rate = clk_get_rate(priv->sck);
+
+ /*
+ * sck is optional, so there may be no clock to wait on, and its rate
+ * is not always discoverable. Only wait when the cycle count can be
+ * converted into a delay.
+ */
+ if (rate)
+ fsleep(DIV_ROUND_UP_ULL(PCM1681_SCK_SETTLE_CYCLES *
+ (u64)USEC_PER_SEC, rate));
+}
+
static const int pcm1681_deemph[] = { 44100, 48000, 32000 };
static int pcm1681_set_deemph(struct snd_soc_component *component)
@@ -282,6 +312,8 @@ static const struct regmap_config pcm1681_regmap = {
.num_reg_defaults = ARRAY_SIZE(pcm1681_reg_defaults),
.writeable_reg = pcm1681_writeable_reg,
.readable_reg = pcm1681_accessible_reg,
+ .volatile_reg = pcm1681_volatile_reg,
+ .cache_type = REGCACHE_MAPLE,
};
static const struct snd_soc_component_driver soc_component_dev_pcm1681 = {
@@ -291,7 +323,6 @@ static const struct snd_soc_component_driver soc_component_dev_pcm1681 = {
.num_dapm_widgets = ARRAY_SIZE(pcm1681_dapm_widgets),
.dapm_routes = pcm1681_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(pcm1681_dapm_routes),
- .idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
};
@@ -304,34 +335,128 @@ MODULE_DEVICE_TABLE(i2c, pcm1681_i2c_id);
static int pcm1681_i2c_probe(struct i2c_client *client)
{
+ struct device *dev = &client->dev;
int ret;
struct pcm1681_private *priv;
- priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
+ priv->sck = devm_clk_get_optional(dev, "sck");
+ if (IS_ERR(priv->sck))
+ return dev_err_probe(dev, PTR_ERR(priv->sck),
+ "Failed to get sck\n");
+
priv->regmap = devm_regmap_init_i2c(client, &pcm1681_regmap);
if (IS_ERR(priv->regmap)) {
ret = PTR_ERR(priv->regmap);
- dev_err(&client->dev, "Failed to create regmap: %d\n", ret);
+ dev_err(dev, "Failed to create regmap: %d\n", ret);
return ret;
}
+ /* Must be set before runtime PM is enabled, the callbacks use it */
i2c_set_clientdata(client, priv);
- return devm_snd_soc_register_component(&client->dev,
- &soc_component_dev_pcm1681,
- &pcm1681_dai, 1);
+ ret = clk_prepare_enable(priv->sck);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to enable sck\n");
+
+ pcm1681_sck_settle(priv);
+
+ /* The clock is on, so hand the now-active device over to runtime PM */
+ pm_runtime_set_autosuspend_delay(dev, 100);
+ pm_runtime_use_autosuspend(dev);
+ pm_runtime_set_active(dev);
+ pm_runtime_enable(dev);
+ pm_runtime_idle(dev);
+
+ ret = devm_snd_soc_register_component(dev,
+ &soc_component_dev_pcm1681,
+ &pcm1681_dai, 1);
+ if (ret) {
+ dev_err(dev, "Failed to register component: %d\n", ret);
+ goto err_pm;
+ }
+
+ return 0;
+
+err_pm:
+ pm_runtime_dont_use_autosuspend(dev);
+ pm_runtime_disable(dev);
+ if (!pm_runtime_status_suspended(dev))
+ clk_disable_unprepare(priv->sck);
+ pm_runtime_set_suspended(dev);
+
+ return ret;
}
+static void pcm1681_i2c_remove(struct i2c_client *client)
+{
+ struct pcm1681_private *priv = i2c_get_clientdata(client);
+ struct device *dev = &client->dev;
+
+ pm_runtime_dont_use_autosuspend(dev);
+ pm_runtime_disable(dev);
+ /* Runtime PM may already have gated the clock */
+ if (!pm_runtime_status_suspended(dev))
+ clk_disable_unprepare(priv->sck);
+ pm_runtime_set_suspended(dev);
+}
+
+static int pcm1681_runtime_suspend(struct device *dev)
+{
+ struct pcm1681_private *priv = dev_get_drvdata(dev);
+
+ /*
+ * Registers lose their contents once the clock is gated, so serve
+ * further access from the cache and replay it on resume.
+ */
+ regcache_cache_only(priv->regmap, true);
+ regcache_mark_dirty(priv->regmap);
+
+ clk_disable_unprepare(priv->sck);
+
+ return 0;
+}
+
+static int pcm1681_runtime_resume(struct device *dev)
+{
+ struct pcm1681_private *priv = dev_get_drvdata(dev);
+ int ret;
+
+ ret = clk_prepare_enable(priv->sck);
+ if (ret) {
+ dev_err(dev, "Failed to enable sck: %d\n", ret);
+ return ret;
+ }
+
+ pcm1681_sck_settle(priv);
+
+ regcache_cache_only(priv->regmap, false);
+ ret = regcache_sync(priv->regmap);
+ if (ret) {
+ dev_err(dev, "Failed to sync regcache: %d\n", ret);
+ regcache_cache_only(priv->regmap, true);
+ clk_disable_unprepare(priv->sck);
+ return ret;
+ }
+
+ return 0;
+}
+
+static DEFINE_RUNTIME_DEV_PM_OPS(pcm1681_pm_ops, pcm1681_runtime_suspend,
+ pcm1681_runtime_resume, NULL);
+
static struct i2c_driver pcm1681_i2c_driver = {
.driver = {
.name = "pcm1681",
.of_match_table = of_match_ptr(pcm1681_dt_ids),
+ .pm = pm_ptr(&pcm1681_pm_ops),
},
.id_table = pcm1681_i2c_id,
.probe = pcm1681_i2c_probe,
+ .remove = pcm1681_i2c_remove,
};
module_i2c_driver(pcm1681_i2c_driver);
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 1/7] ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support Mohammad Rafi Shaik
@ 2026-10-09 13:12 ` Mohammad Rafi Shaik
2026-10-09 13:20 ` sashiko-bot
2026-10-10 3:12 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 4/7] ASoC: dt-bindings: ti,pcm1681: Document the PCM1681 supplies Mohammad Rafi Shaik
` (3 subsequent siblings)
6 siblings, 2 replies; 14+ messages in thread
From: Mohammad Rafi Shaik @ 2026-10-09 13:12 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla, Shawn Guo
Cc: Mohammad Rafi Shaik, linux-sound, devicetree, linux-kernel,
linux-arm-msm
The PCM1681 selects the audio interface format using FMT[3:0] in the
format register. The driver currently supports only I2S, left-justified,
and right-justified formats, preventing a machine driver from selecting
TDM mode.
Add support for SND_SOC_DAIFMT_DSP_A and program the PCM1681 I2S TDM
format when it is selected. Also advertise DSP_A in the selectable DAI
formats.
While adding TDM support, correct the reset default for the format
register from 0x06 to 0x05. The current default does not match the
hardware reset value. Although this has no effect while regmap caching
is disabled, it could cause the TDM format write to be skipped if
regmap caching is enabled in the future.
The existing I2S, left-justified, and right-justified formats remain
unchanged.
Assisted-by: LLM
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
sound/soc/codecs/pcm1681.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index a1ccf1edf..3675b2236 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -53,7 +53,7 @@ static const struct reg_default pcm1681_reg_defaults[] = {
{ 0x06, 0xff },
{ 0x07, 0x00 },
{ 0x08, 0x00 },
- { 0x09, 0x06 },
+ { 0x09, 0x05 },
{ 0x0A, 0x00 },
{ 0x0B, 0xff },
{ 0x0C, 0x0f },
@@ -217,6 +217,9 @@ static int pcm1681_hw_params(struct snd_pcm_substream *substream,
case SND_SOC_DAIFMT_LEFT_J:
val = 0x05;
break;
+ case SND_SOC_DAIFMT_DSP_A:
+ val = 0x06;
+ break;
default:
dev_err(component->dev, "Invalid DAI format\n");
return -EINVAL;
@@ -232,7 +235,8 @@ static int pcm1681_hw_params(struct snd_pcm_substream *substream,
static const u64 pcm1681_selectable_formats =
SND_SOC_POSSIBLE_DAIFMT_I2S |
SND_SOC_POSSIBLE_DAIFMT_RIGHT_J |
- SND_SOC_POSSIBLE_DAIFMT_LEFT_J;
+ SND_SOC_POSSIBLE_DAIFMT_LEFT_J |
+ SND_SOC_POSSIBLE_DAIFMT_DSP_A;
static const struct snd_soc_dai_ops pcm1681_dai_ops = {
.set_fmt = pcm1681_set_dai_fmt,
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 4/7] ASoC: dt-bindings: ti,pcm1681: Document the PCM1681 supplies
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
` (2 preceding siblings ...)
2026-10-09 13:12 ` [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support Mohammad Rafi Shaik
@ 2026-10-09 13:12 ` Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 5/7] ASoC: codec: pcm1681: Enable " Mohammad Rafi Shaik
` (2 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Mohammad Rafi Shaik @ 2026-10-09 13:12 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla, Shawn Guo
Cc: Mohammad Rafi Shaik, linux-sound, devicetree, linux-kernel,
linux-arm-msm
From: Shawn Guo <shengchao.guo@oss.qualcomm.com>
The PCM1681 takes a 5V analog supply on VCC1 and VCC2 and a 3.3V
digital supply on VDD. On boards where these rails are switchable, the
codec has to know about them to be able to power the DAC up and down,
which needs a way to describe the connections in Device Tree.
Document the VCC1, VCC2 and VDD supply properties.
Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
Documentation/devicetree/bindings/sound/ti,pcm1681.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/ti,pcm1681.yaml b/Documentation/devicetree/bindings/sound/ti,pcm1681.yaml
index 1b3803518..fb09d1c39 100644
--- a/Documentation/devicetree/bindings/sound/ti,pcm1681.yaml
+++ b/Documentation/devicetree/bindings/sound/ti,pcm1681.yaml
@@ -28,6 +28,15 @@ properties:
clock-names:
const: sck
+ VCC1-supply:
+ description: 5V analog power supply
+
+ VCC2-supply:
+ description: 5V analog power supply
+
+ VDD-supply:
+ description: 3.3V digital power supply
+
"#sound-dai-cells":
const: 0
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 5/7] ASoC: codec: pcm1681: Enable the PCM1681 supplies
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
` (3 preceding siblings ...)
2026-10-09 13:12 ` [PATCH v3 4/7] ASoC: dt-bindings: ti,pcm1681: Document the PCM1681 supplies Mohammad Rafi Shaik
@ 2026-10-09 13:12 ` Mohammad Rafi Shaik
2026-10-09 13:21 ` sashiko-bot
2026-10-10 3:13 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 6/7] ASoC: dt-bindings: qcom,sm8250: Add Nord sound card Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 7/7] ASoC: qcom: sc8280xp: Add Nord sound card support Mohammad Rafi Shaik
6 siblings, 2 replies; 14+ messages in thread
From: Mohammad Rafi Shaik @ 2026-10-09 13:12 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla, Shawn Guo
Cc: Mohammad Rafi Shaik, linux-sound, devicetree, linux-kernel,
linux-arm-msm
From: Shawn Guo <shengchao.guo@oss.qualcomm.com>
The driver assumes that the analog and digital supplies of the DAC are
already up by the time it probes. That only holds when the rails are
hardwired or left on by the bootloader. Boards which gate them, like
the Qualcomm Nord RRD and Ride, have no way to get them enabled, and
the first register access then fails.
Enable the VCC1, VCC2 and VDD supplies before touching the clock or the
regmap, so that the DAC is powered whenever the driver is bound. The
supplies are optional as far as the regulator core is concerned, so
boards which do not describe them keep working through the dummy
regulator.
Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
sound/soc/codecs/pcm1681.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index 3675b2236..6002da3a5 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -14,6 +14,7 @@
#include <linux/of.h>
#include <linux/clk.h>
#include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -337,6 +338,10 @@ static const struct i2c_device_id pcm1681_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, pcm1681_i2c_id);
+static const char * const pcm1681_supply_names[] = {
+ "VCC1", "VCC2", "VDD",
+};
+
static int pcm1681_i2c_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
@@ -347,6 +352,13 @@ static int pcm1681_i2c_probe(struct i2c_client *client)
if (!priv)
return -ENOMEM;
+ ret = devm_regulator_bulk_get_enable(dev,
+ ARRAY_SIZE(pcm1681_supply_names),
+ pcm1681_supply_names);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to enable supplies\n");
+
priv->sck = devm_clk_get_optional(dev, "sck");
if (IS_ERR(priv->sck))
return dev_err_probe(dev, PTR_ERR(priv->sck),
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 6/7] ASoC: dt-bindings: qcom,sm8250: Add Nord sound card
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
` (4 preceding siblings ...)
2026-10-09 13:12 ` [PATCH v3 5/7] ASoC: codec: pcm1681: Enable " Mohammad Rafi Shaik
@ 2026-10-09 13:12 ` Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 7/7] ASoC: qcom: sc8280xp: Add Nord sound card support Mohammad Rafi Shaik
6 siblings, 0 replies; 14+ messages in thread
From: Mohammad Rafi Shaik @ 2026-10-09 13:12 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla, Shawn Guo
Cc: Mohammad Rafi Shaik, linux-sound, devicetree, linux-kernel,
linux-arm-msm
Document the bindings for the Qualcomm Nord sound card.
The bindings are the same as for other newer Qualcomm ADSP
sound cards, thus keep them in existing qcom,sm8250.yaml file.
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
Documentation/devicetree/bindings/sound/qcom,sm8250.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
index fc7bccdac..372919ff9 100644
--- a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml
@@ -38,6 +38,7 @@ properties:
- fairphone,fp5-sndcard
- qcom,apq8096-sndcard
- qcom,glymur-sndcard
+ - qcom,nord-sndcard
- qcom,qcm6490-idp-sndcard
- qcom,qcs615-sndcard
- qcom,qcs6490-rb3gen2-sndcard
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 7/7] ASoC: qcom: sc8280xp: Add Nord sound card support
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
` (5 preceding siblings ...)
2026-10-09 13:12 ` [PATCH v3 6/7] ASoC: dt-bindings: qcom,sm8250: Add Nord sound card Mohammad Rafi Shaik
@ 2026-10-09 13:12 ` Mohammad Rafi Shaik
6 siblings, 0 replies; 14+ messages in thread
From: Mohammad Rafi Shaik @ 2026-10-09 13:12 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Sen Wang, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla, Shawn Guo
Cc: Mohammad Rafi Shaik, linux-sound, devicetree, linux-kernel,
linux-arm-msm
Add support for the Nord Ride and RRD sound cards by introducing the
qcom,nord-sndcard compatible and associated platform-specific data.
Nord uses external codecs for its playback and capture paths and requires
board-specific DAI and clock configuration. Configure the codec DAI format
for DSP_A operation and enable MI2S bit clock handling for the platform.
Add a platform-specific sound card initialization callback to configure
the ADAU1979 capture codec to use LRCLK as its system clock source. This
configuration is done during DAI link initialization so that the codec
clock source and associated rate constraints are established before the
capture stream is opened.
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
sound/soc/qcom/sc8280xp.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index b5d367486..a759ae951 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -25,6 +25,10 @@
#define I2S_BIT_RATE(rate, channels, format) \
((rate) * (channels) * (format))
+#define ADAU1977_SYSCLK 0
+#define ADAU1977_SYSCLK_SRC_MCLK 0
+#define ADAU1977_SYSCLK_SRC_LRCLK 1
+
static struct snd_soc_dapm_widget sc8280xp_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
@@ -92,6 +96,7 @@ struct qcom_snd_soc_common {
bool wcd_jack;
const struct sc8280xp_dai_data *dai_data;
size_t num_dai_data;
+ int (*snd_init)(struct snd_soc_pcm_runtime *rtd);
int (*snd_prepare)(struct snd_pcm_substream *substream);
};
@@ -224,9 +229,16 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_card *card = rtd->card;
struct snd_soc_jack *dp_jack = NULL;
int dp_pcm_id = 0;
+ int ret;
dai_data = sc8280xp_get_dai_data(data->priv, cpu_dai->id);
+ if (data->priv->snd_init) {
+ ret = data->priv->snd_init(rtd);
+ if (ret)
+ return ret;
+ }
+
switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0:
case WSA_CODEC_DMA_RX_1:
@@ -305,6 +317,35 @@ static int sc8280xp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
return 0;
}
+static int nord_snd_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ int ret;
+
+ switch (cpu_dai->id) {
+ case AIF_TDM_TX_8:
+ /*
+ * adau1979 PLL clocked from LRCLK, no external MCLK. Selecting
+ * the source also installs the PLL rate constraint, which the
+ * codec applies from its startup() callback, so it has to be
+ * in place before the first stream is opened. The frequency is
+ * unused for an LRCLK-sourced PLL.
+ */
+ ret = snd_soc_component_set_sysclk(codec_dai->component,
+ ADAU1977_SYSCLK,
+ ADAU1977_SYSCLK_SRC_LRCLK,
+ 48000, SND_SOC_CLOCK_IN);
+ if (ret && ret != -ENOTSUPP)
+ return ret;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
@@ -552,6 +593,15 @@ static const struct qcom_snd_soc_common kaanapali_priv_data = {
.wcd_jack = true,
};
+static const struct qcom_snd_soc_common nord_priv_data = {
+ .driver_name = "nord",
+ .mi2s_bclk_enable = true,
+ .codec_dai_fmt = SND_SOC_DAIFMT_CBC_CFC |
+ SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_DSP_A,
+ .snd_init = nord_snd_init,
+};
+
static const struct qcom_snd_soc_common qcs9100_priv_data = {
.driver_name = "sa8775p",
.dapm_widgets = sc8280xp_dapm_widgets,
@@ -677,6 +727,7 @@ static const struct of_device_id snd_sc8280xp_dt_match[] = {
{ .compatible = "qcom,hawi-sndcard", .data = &hawi_priv_data },
{ .compatible = "qcom,kaanapali-sndcard", .data = &kaanapali_priv_data },
{ .compatible = "qcom,maili-sndcard", .data = &hawi_priv_data },
+ { .compatible = "qcom,nord-sndcard", .data = &nord_priv_data },
{ .compatible = "qcom,qcm6490-idp-sndcard", .data = &qcm6490_priv_data },
{ .compatible = "qcom,qcs615-sndcard", .data = &qcs615_priv_data },
{ .compatible = "qcom,qcs6490-rb3gen2-sndcard", .data = &qcs6490_priv_data },
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support
2026-10-09 13:12 ` [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support Mohammad Rafi Shaik
@ 2026-10-09 13:20 ` sashiko-bot
2026-10-10 3:12 ` Wang, Sen
1 sibling, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-10-09 13:20 UTC (permalink / raw)
To: Mohammad Rafi Shaik; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] ASoC: missing regmap_update_bits error check in pcm1681_set_deemph()
--
commit c7cf94fd54a2248eb129e6005f0299fa2844892f
Author: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
ASoC: codec: pcm1681: Add TDM support
The PCM1681 selects the audio interface format using FMT[3:0] in the format
register. This commit adds support for SND_SOC_DAIFMT_DSP_A and programs the
PCM1681 I2S TDM format when it is selected. It also corrects the reset
default for the format register to match the hardware reset value.
> diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
> index a1ccf1edf4819..3675b2236d663 100644
> --- a/sound/soc/codecs/pcm1681.c
> +++ b/sound/soc/codecs/pcm1681.c
[ ... ]
> @@ -217,6 +217,9 @@ static int pcm1681_hw_params(struct snd_pcm_substream *substream,
> case SND_SOC_DAIFMT_LEFT_J:
> val = 0x05;
> break;
> + case SND_SOC_DAIFMT_DSP_A:
> + val = 0x06;
> + break;
> default:
> dev_err(component->dev, "Invalid DAI format\n");
> return -EINVAL;
[Severity: Low]
Does this code ignore the return value of the first regmap_update_bits() call
in pcm1681_set_deemph()?
When pcm1681_hw_params() finishes successfully, it calls pcm1681_set_deemph():
sound/soc/codecs/pcm1681.c:pcm1681_set_deemph() {
...
if (val != -1) {
regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL,
PCM1681_DEEMPH_RATE_MASK, val << 3);
enable = 1;
} else {
...
}
If the first register update to set the de-emphasis rate fails due to a
transient bus error, its return value is ignored before executing the
subsequent update.
If the subsequent transaction to enable it succeeds, the codec will have
de-emphasis enabled with an incorrect or default rate, potentially causing
minor audio distortion.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-nord-asoc-driver-support-v3-v3-0-0c1897f21ccf@oss.qualcomm.com?part=3
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 5/7] ASoC: codec: pcm1681: Enable the PCM1681 supplies
2026-10-09 13:12 ` [PATCH v3 5/7] ASoC: codec: pcm1681: Enable " Mohammad Rafi Shaik
@ 2026-10-09 13:21 ` sashiko-bot
2026-10-10 3:13 ` Wang, Sen
1 sibling, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-10-09 13:21 UTC (permalink / raw)
To: Mohammad Rafi Shaik; +Cc: devicetree, conor+dt, robh
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] asoc: devres ordering bug leaves component active after remove disables clocks
--
commit 7a5eea3c05ab4c0d2ec17ff354d7cd0e31ecd47b
Author: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Subject: ASoC: codec: pcm1681: Enable the PCM1681 supplies
This commit adds regulator support for the PCM1681 DAC's analog and digital
supplies. It uses devm_regulator_bulk_get_enable() during probe to ensure
power is enabled before touching clocks or regmap.
> diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
> index 3675b2236d663..6002da3a56669 100644
> --- a/sound/soc/codecs/pcm1681.c
> +++ b/sound/soc/codecs/pcm1681.c
[ ... ]
> @@ -347,6 +352,13 @@ static int pcm1681_i2c_probe(struct i2c_client *client)
> if (!priv)
> return -ENOMEM;
>
> + ret = devm_regulator_bulk_get_enable(dev,
> + ARRAY_SIZE(pcm1681_supply_names),
> + pcm1681_supply_names);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "Failed to enable supplies\n");
> +
[Severity: High]
Does adding this regulator to the devres stack interact poorly with the device
teardown sequence?
The probe function registers the component using
devm_snd_soc_register_component(), meaning it will be unregistered
automatically by devres after the driver's remove() callback completes.
However, in pcm1681_i2c_remove(), the driver explicitly tears down runtime
PM and forcefully disables the hardware clock before devres gets a chance
to unregister the component:
sound/soc/codecs/pcm1681.c:pcm1681_i2c_remove() {
...
pm_runtime_disable(dev);
/* Runtime PM may already have gated the clock */
if (!pm_runtime_status_suspended(dev))
clk_disable_unprepare(priv->sck);
...
}
This creates a window where the ASoC component is still fully registered and
active in ALSA, but its hardware clock is disabled and runtime PM is
permanently deactivated.
If ALSA or userspace accesses the component (e.g., reading or writing mixer
controls like pcm1681_put_deemph) during this window, the component will
attempt I2C register accesses without the required system clock or runtime PM
support. This can lead to kernel crashes, I2C bus hangs, or silent register
corruption.
While the current patch adds a devm_regulator action to the devres stack,
modifying the overall teardown sequence, this ordering window leaves the
component vulnerable during remove. Should the driver avoid devres for
component registration or reorder the manual cleanup to prevent this?
> priv->sck = devm_clk_get_optional(dev, "sck");
> if (IS_ERR(priv->sck))
> return dev_err_probe(dev, PTR_ERR(priv->sck),
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-nord-asoc-driver-support-v3-v3-0-0c1897f21ccf@oss.qualcomm.com?part=5
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support
2026-10-09 13:12 ` [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support Mohammad Rafi Shaik
@ 2026-10-09 13:23 ` sashiko-bot
2026-10-10 3:07 ` Wang, Sen
1 sibling, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-10-09 13:23 UTC (permalink / raw)
To: Mohammad Rafi Shaik; +Cc: robh, conor+dt, devicetree
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] snd: soc: pcm1681: Devres teardown ordering bug leaves component accessible with gated clock
--
commit 0a50ee85ef797e0816bf4c1d1aa2f3b04e25ef3c
Author: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support
This commit adds support for an optional sck clock and runtime PM to the
PCM1681 codec driver. It enables the clock before accessing the device, waits
for a reset sequence, and uses runtime PM autosuspend to manage the clock state
alongside regmap caching.
> diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
> index 60fdbe5c4e054..a1ccf1edf4819 100644
> --- a/sound/soc/codecs/pcm1681.c
> +++ b/sound/soc/codecs/pcm1681.c
[ ... ]
> static int pcm1681_i2c_probe(struct i2c_client *client)
> {
[ ... ]
> + ret = devm_snd_soc_register_component(dev,
> + &soc_component_dev_pcm1681,
> + &pcm1681_dai, 1);
> + if (ret) {
> + dev_err(dev, "Failed to register component: %d\n", ret);
> + goto err_pm;
> + }
> +
> + return 0;
> +
> +err_pm:
> + pm_runtime_dont_use_autosuspend(dev);
> + pm_runtime_disable(dev);
> + if (!pm_runtime_status_suspended(dev))
> + clk_disable_unprepare(priv->sck);
> + pm_runtime_set_suspended(dev);
> +
> + return ret;
> }
>
> +static void pcm1681_i2c_remove(struct i2c_client *client)
> +{
> + struct pcm1681_private *priv = i2c_get_clientdata(client);
> + struct device *dev = &client->dev;
> +
> + pm_runtime_dont_use_autosuspend(dev);
> + pm_runtime_disable(dev);
> + /* Runtime PM may already have gated the clock */
> + if (!pm_runtime_status_suspended(dev))
> + clk_disable_unprepare(priv->sck);
[Severity: High]
Does this devres teardown ordering leave the component accessible while its
clock is gated?
In pcm1681_i2c_probe() in sound/soc/codecs/pcm1681.c, the component is
registered via devm_snd_soc_register_component(), which defers unregistration
until after pcm1681_i2c_remove() completes. However, pcm1681_i2c_remove()
manually disables runtime PM and gates the sck clock.
When the ASoC core later unregisters the component during the devres cleanup
phase, it may attempt to power down DAPM widgets or mute the codec, resulting
in physical regmap_write() calls. Since the clock is already gated and the
regmap cache is not marked as cache-only here, this regression could cause
these transactions to fail, potentially leading to I2C timeouts, bus hangs, or
kernel warnings.
Should devm_pm_runtime_enable() or a custom devm action be used for PM and
clock cleanup to ensure proper ordering, or should the component registration be
changed to the non-devres variant?
> + pm_runtime_set_suspended(dev);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-nord-asoc-driver-support-v3-v3-0-0c1897f21ccf@oss.qualcomm.com?part=2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support
2026-10-09 13:12 ` [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support Mohammad Rafi Shaik
2026-10-09 13:23 ` sashiko-bot
@ 2026-10-10 3:07 ` Wang, Sen
1 sibling, 0 replies; 14+ messages in thread
From: Wang, Sen @ 2026-10-10 3:07 UTC (permalink / raw)
To: Mohammad Rafi Shaik, Shenghao Ding, Kevin Lu, Baojun Xu,
Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla,
Shawn Guo
Cc: linux-sound, devicetree, linux-kernel, linux-arm-msm
On 10/9/2026 8:12 AM, Mohammad Rafi Shaik wrote:
> The PCM1681 requires its SCK system clock to be running before register
> access. On platforms where SCK is provided by a gateable clock, register
> access may fail when the clock is disabled.
>
> Add support for an optional "sck" clock and enable it before accessing the
> device. After enabling SCK, wait for the required 65536 system clock cycles
> to allow the device to complete its internal reset sequence.
>
> Use runtime PM to manage SCK instead of keeping it enabled for the lifetime
> of the device. Disable the clock during runtime suspend and restore it on
> runtime resume. Use autosuspend to avoid unnecessary clock toggling between
> closely spaced accesses.
>
> Since the device register state may be lost when SCK is disabled, enable
> the regmap cache. Switch regmap to cache-only mode and mark the cache
> dirty on runtime suspend, then synchronize the cached register state after
> SCK is restored on runtime resume. Mark the zero-detect status register
> volatile since it is updated by hardware.
>
> Drop idle_bias_on so that the component can reach SND_SOC_BIAS_OFF and
> runtime suspend can gate SCK.
>
> Assisted-by: LLM
> Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
Hi Mohammd, thanks for your patches.
> ---
> sound/soc/codecs/pcm1681.c | 137 +++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 131 insertions(+), 6 deletions(-)
>
> diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
> index 60fdbe5c4..a1ccf1edf 100644
> --- a/sound/soc/codecs/pcm1681.c
> +++ b/sound/soc/codecs/pcm1681.c
>
>
> - return devm_snd_soc_register_component(&client->dev,
> - &soc_component_dev_pcm1681,
> - &pcm1681_dai, 1);
> + ret = clk_prepare_enable(priv->sck);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to enable sck\n");
> +
> + pcm1681_sck_settle(priv);
> +
> + /* The clock is on, so hand the now-active device over to runtime PM */
> + pm_runtime_set_autosuspend_delay(dev, 100);
> + pm_runtime_use_autosuspend(dev);
> + pm_runtime_set_active(dev);
> + pm_runtime_enable(dev);
> + pm_runtime_idle(dev);
For the sake of consistency let's add mark_last_busy first, so that
first suspend won't skip the delay.
> +static void pcm1681_i2c_remove(struct i2c_client *client)
> +{
> + struct pcm1681_private *priv = i2c_get_clientdata(client);
> + struct device *dev = &client->dev;
> +
> + pm_runtime_dont_use_autosuspend(dev);
> + pm_runtime_disable(dev);
> + /* Runtime PM may already have gated the clock */
> + if (!pm_runtime_status_suspended(dev))
> + clk_disable_unprepare(priv->sck);
> + pm_runtime_set_suspended(dev);
> +}
> +
Sashiko reported something valid here so please take a look at this.
> +static int pcm1681_runtime_resume(struct device *dev)
> +{
> + struct pcm1681_private *priv = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = clk_prepare_enable(priv->sck);
> + if (ret) {
> + dev_err(dev, "Failed to enable sck: %d\n", ret);
> + return ret;
> + }
> +
> + pcm1681_sck_settle(priv);
> +
> + regcache_cache_only(priv->regmap, false);
> + ret = regcache_sync(priv->regmap);
I'm wondering if this would cause regression on existing boards without
SCK clock, since now regcache_sync writes from runtime resume at stream
open, before machine/CPU DAI startup or machine hw_params that may
enable SCK. Rather than writing in codec hw_params as before. Did/can
you try running your board with runtime PM but without the SCK and see
what it does?
The SCK dt might not be optional afterall with runtime PM
enabled.Overall I think it's a cramped patch with runtime PM, regcache
enable and SCK clock support which are all major features and shall be
bisected individually, therefore can you decouple and have separate
patches instead?
Best,
Sen Wang
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support
2026-10-09 13:12 ` [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support Mohammad Rafi Shaik
2026-10-09 13:20 ` sashiko-bot
@ 2026-10-10 3:12 ` Wang, Sen
1 sibling, 0 replies; 14+ messages in thread
From: Wang, Sen @ 2026-10-10 3:12 UTC (permalink / raw)
To: Mohammad Rafi Shaik, Shenghao Ding, Kevin Lu, Baojun Xu,
Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla,
Shawn Guo
Cc: linux-sound, devicetree, linux-kernel, linux-arm-msm
On 10/9/2026 8:12 AM, Mohammad Rafi Shaik wrote:
> The PCM1681 selects the audio interface format using FMT[3:0] in the
> format register. The driver currently supports only I2S, left-justified,
> and right-justified formats, preventing a machine driver from selecting
> TDM mode.
>
> Add support for SND_SOC_DAIFMT_DSP_A and program the PCM1681 I2S TDM
> format when it is selected. Also advertise DSP_A in the selectable DAI
> formats.
>
> While adding TDM support, correct the reset default for the format
> register from 0x06 to 0x05. The current default does not match the
> hardware reset value. Although this has no effect while regmap caching
> is disabled, it could cause the TDM format write to be skipped if
> regmap caching is enabled in the future.
>
> The existing I2S, left-justified, and right-justified formats remain
> unchanged.
>
> Assisted-by: LLM
> Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
> ---
> sound/soc/codecs/pcm1681.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
> index a1ccf1edf..3675b2236 100644
> --- a/sound/soc/codecs/pcm1681.c
> +++ b/sound/soc/codecs/pcm1681.c
> @@ -53,7 +53,7 @@ static const struct reg_default pcm1681_reg_defaults[] = {
> { 0x06, 0xff },
> { 0x07, 0x00 },
> { 0x08, 0x00 },
> - { 0x09, 0x06 },
> + { 0x09, 0x05 },
Let's group this with the patch that has regcache enable instead, otherwise:
Reviewed-by: Sen Wang <sen@ti.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 5/7] ASoC: codec: pcm1681: Enable the PCM1681 supplies
2026-10-09 13:12 ` [PATCH v3 5/7] ASoC: codec: pcm1681: Enable " Mohammad Rafi Shaik
2026-10-09 13:21 ` sashiko-bot
@ 2026-10-10 3:13 ` Wang, Sen
1 sibling, 0 replies; 14+ messages in thread
From: Wang, Sen @ 2026-10-10 3:13 UTC (permalink / raw)
To: Mohammad Rafi Shaik, Shenghao Ding, Kevin Lu, Baojun Xu,
Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Jaroslav Kysela, Takashi Iwai, Srinivas Kandagatla,
Shawn Guo
Cc: linux-sound, devicetree, linux-kernel, linux-arm-msm
On 10/9/2026 8:12 AM, Mohammad Rafi Shaik wrote:
> From: Shawn Guo <shengchao.guo@oss.qualcomm.com>
>
> The driver assumes that the analog and digital supplies of the DAC are
> already up by the time it probes. That only holds when the rails are
> hardwired or left on by the bootloader. Boards which gate them, like
> the Qualcomm Nord RRD and Ride, have no way to get them enabled, and
> the first register access then fails.
>
> Enable the VCC1, VCC2 and VDD supplies before touching the clock or the
> regmap, so that the DAC is powered whenever the driver is bound. The
> supplies are optional as far as the regulator core is concerned, so
> boards which do not describe them keep working through the dummy
> regulator.
>
> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
> Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
> ---
Reviewed-by: Sen Wang <sen@ti.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-10-10 3:14 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09 13:12 [PATCH v3 0/7] ASoC: qcom: Add Nord audio support Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 1/7] ASoC: dt-bindings: ti,pcm1681: Document the optional SCK clock Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 2/7] ASoC: codec: pcm1681: Add optional SCK clock and runtime PM support Mohammad Rafi Shaik
2026-10-09 13:23 ` sashiko-bot
2026-10-10 3:07 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 3/7] ASoC: codec: pcm1681: Add TDM support Mohammad Rafi Shaik
2026-10-09 13:20 ` sashiko-bot
2026-10-10 3:12 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 4/7] ASoC: dt-bindings: ti,pcm1681: Document the PCM1681 supplies Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 5/7] ASoC: codec: pcm1681: Enable " Mohammad Rafi Shaik
2026-10-09 13:21 ` sashiko-bot
2026-10-10 3:13 ` Wang, Sen
2026-10-09 13:12 ` [PATCH v3 6/7] ASoC: dt-bindings: qcom,sm8250: Add Nord sound card Mohammad Rafi Shaik
2026-10-09 13:12 ` [PATCH v3 7/7] ASoC: qcom: sc8280xp: Add Nord sound card support Mohammad Rafi Shaik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox