* [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support
@ 2025-05-09 9:34 Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 01/37] ASoC: da7213: Add support for mono, set frame width to 32 when possible Claudiu
` (35 more replies)
0 siblings, 36 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Hi,
Series backports the Renesas RZ/G3S audio support to v5.10.y CIP.
Thank you,
Claudiu Beznea
Cezary Rojewski (1):
ASoC: codecs: da7213: Simplify mclk initialization
Claudiu Beznea (30):
ASoC: da7213: Populate max_register to regmap_config
ASoC: da7213: Return directly the value of regcache_sync()
ASoC: da7213: Add suspend to RAM support
ASoC: da7213: Initialize the mutex
clk: renesas: r9a08g045: Add clocks, resets and power domains support
for SSI
clk: versaclock3: Prepare for the addition of 5L35023 device
dt-bindings: clock: versaclock3: Document 5L35023 Versa3 clock
generator
clk: versaclock3: Add support for the 5L35023 variant
ASoC: renesas: rz-ssi: Terminate all the DMA transactions
ASoC: renesas: rz-ssi: Use only the proper amount of dividers
ASoC: renesas: rz-ssi: Fix typo on SSI_RATES macro comment
ASoC: renesas: rz-ssi: Remove pdev member of struct rz_ssi_priv
ASoC: renesas: rz-ssi: Remove the first argument of
rz_ssi_stream_is_play()
ASoC: renesas: rz-ssi: Use readl_poll_timeout_atomic()
ASoC: renesas: rz-ssi: Use temporary variable for struct device
ASoC: renesas: rz-ssi: Use goto label names that specify their actions
ASoC: renesas: rz-ssi: Rely on the ASoC subsystem to runtime
resume/suspend the SSI
ASoC: renesas: rz-ssi: Enable runtime PM autosuspend support
ASoC: renesas: rz-ssi: Add runtime PM support
ASoC: renesas: rz-ssi: Issue software reset in hw_params API
ASoC: renesas: rz-ssi: Add suspend to RAM support
ASoC: renesas: rz-ssi: Use NOIRQ_SYSTEM_SLEEP_PM_OPS()
ASoC: dt-bindings: renesas,rz-ssi: Remove DMA description
ASoC: dt-bindings: renesas,rz-ssi: Document the Renesas RZ/G3S SoC
pinctrl: renesas: rzg2l: Add audio clock pins on RZ/G3S
arm64: dts: renesas: r9a08g045: Add SSI nodes
arm64: dts: renesas: rzg3s-smarc-som: Add versa3 clock generator node
arm64: dts: renesas: Add da7212 audio codec node
arm64: dts: renesas: rzg3s-smarc: Enable SSI3
arm64: dts: renesas: rzg3s-smarc: Add sound card
David Rau (2):
ASoC: da7213: Add support for mono, set frame width to 32 when
possible
ASoC: da7213: Add new kcontrol for tonegen
Duy Nguyen (1):
ASoC: da7213.c: add missing pm_runtime_disable()
Hao Bui (2):
ASoC: da7213: Avoid setting PLL when closing audio stream
ASoC: da7213: Extend support for the MCK in range [2, 50] MHz
Kuninori Morimoto (1):
arm64: defconfig: Enable DA7213 Codec
.../bindings/clock/renesas,5p35023.yaml | 1 +
.../bindings/sound/renesas,rz-ssi.yaml | 19 +-
arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 94 +++++++
.../boot/dts/renesas/rzg3s-smarc-som.dtsi | 47 +++-
arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi | 63 +++++
arch/arm64/configs/defconfig | 1 +
drivers/clk/clk-versaclock3.c | 67 +++--
drivers/clk/renesas/r9a08g045-cpg.c | 12 +
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 2 +
sound/soc/codecs/da7213.c | 250 ++++++++++++++++--
sound/soc/codecs/da7213.h | 68 ++++-
sound/soc/sh/rz-ssi.c | 211 +++++++++------
12 files changed, 698 insertions(+), 137 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 01/37] ASoC: da7213: Add support for mono, set frame width to 32 when possible
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 02/37] ASoC: da7213.c: add missing pm_runtime_disable() Claudiu
` (34 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: David Rau <David.Rau.opensource@dm.renesas.com>
commit c89e652e84f636354213aae42490c7f77a0eadde upstream.
This adds the DAI mono mode support and set the frame width to 32
Signed-off-by: Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
Tested-by: David Rau <David.Rau.opensource@dm.renesas.com>
Signed-off-by: David Rau <David.Rau.opensource@dm.renesas.com>
Link: https://lore.kernel.org/r/20221214044058.6289-1-David.Rau.opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 30 ++++++++++++++++++++++++++++--
sound/soc/codecs/da7213.h | 3 +++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 72402467adcc..89842d77e4f6 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -1157,13 +1157,31 @@ static int da7213_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_component *component = dai->component;
struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
+ u8 dai_clk_mode = DA7213_DAI_BCLKS_PER_WCLK_64;
u8 dai_ctrl = 0;
u8 fs;
+ /* Set channels */
+ switch (params_channels(params)) {
+ case 1:
+ if (da7213->fmt != DA7213_DAI_FORMAT_DSP) {
+ dev_err(component->dev, "Mono supported only in DSP mode\n");
+ return -EINVAL;
+ }
+ dai_ctrl |= DA7213_DAI_MONO_MODE_EN;
+ break;
+ case 2:
+ dai_ctrl &= ~(DA7213_DAI_MONO_MODE_EN);
+ break;
+ default:
+ return -EINVAL;
+ }
+
/* Set DAI format */
switch (params_width(params)) {
case 16:
dai_ctrl |= DA7213_DAI_WORD_LENGTH_S16_LE;
+ dai_clk_mode = DA7213_DAI_BCLKS_PER_WCLK_32; /* 32bit for 1ch and 2ch */
break;
case 20:
dai_ctrl |= DA7213_DAI_WORD_LENGTH_S20_LE;
@@ -1224,8 +1242,11 @@ static int da7213_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- snd_soc_component_update_bits(component, DA7213_DAI_CTRL, DA7213_DAI_WORD_LENGTH_MASK,
- dai_ctrl);
+ snd_soc_component_update_bits(component, DA7213_DAI_CLK_MODE,
+ DA7213_DAI_BCLKS_PER_WCLK_MASK, dai_clk_mode);
+
+ snd_soc_component_update_bits(component, DA7213_DAI_CTRL,
+ DA7213_DAI_WORD_LENGTH_MASK | DA7213_DAI_MONO_MODE_MASK, dai_ctrl);
snd_soc_component_write(component, DA7213_SR, fs);
return 0;
@@ -1300,19 +1321,24 @@ static int da7213_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
dai_ctrl |= DA7213_DAI_FORMAT_I2S_MODE;
+ da7213->fmt = DA7213_DAI_FORMAT_I2S_MODE;
break;
case SND_SOC_DAIFMT_LEFT_J:
dai_ctrl |= DA7213_DAI_FORMAT_LEFT_J;
+ da7213->fmt = DA7213_DAI_FORMAT_LEFT_J;
break;
case SND_SOC_DAIFMT_RIGHT_J:
dai_ctrl |= DA7213_DAI_FORMAT_RIGHT_J;
+ da7213->fmt = DA7213_DAI_FORMAT_RIGHT_J;
break;
case SND_SOC_DAI_FORMAT_DSP_A: /* L data MSB after FRM LRC */
dai_ctrl |= DA7213_DAI_FORMAT_DSP;
dai_offset = 1;
+ da7213->fmt = DA7213_DAI_FORMAT_DSP;
break;
case SND_SOC_DAI_FORMAT_DSP_B: /* L data MSB during FRM LRC */
dai_ctrl |= DA7213_DAI_FORMAT_DSP;
+ da7213->fmt = DA7213_DAI_FORMAT_DSP;
break;
default:
return -EINVAL;
diff --git a/sound/soc/codecs/da7213.h b/sound/soc/codecs/da7213.h
index 97ccf0ddd2be..4ca9cfdea06d 100644
--- a/sound/soc/codecs/da7213.h
+++ b/sound/soc/codecs/da7213.h
@@ -195,6 +195,8 @@
#define DA7213_DAI_WORD_LENGTH_S24_LE (0x2 << 2)
#define DA7213_DAI_WORD_LENGTH_S32_LE (0x3 << 2)
#define DA7213_DAI_WORD_LENGTH_MASK (0x3 << 2)
+#define DA7213_DAI_MONO_MODE_EN (0x1 << 4)
+#define DA7213_DAI_MONO_MODE_MASK (0x1 << 4)
#define DA7213_DAI_EN_SHIFT 7
/* DA7213_DIG_ROUTING_DAI = 0x21 */
@@ -542,6 +544,7 @@ struct da7213_priv {
bool alc_en;
bool fixed_clk_auto_pll;
struct da7213_platform_data *pdata;
+ int fmt;
};
#endif /* _DA7213_H */
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 02/37] ASoC: da7213.c: add missing pm_runtime_disable()
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 01/37] ASoC: da7213: Add support for mono, set frame width to 32 when possible Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 03/37] ASoC: da7213: Add new kcontrol for tonegen Claudiu
` (33 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Duy Nguyen <duy.nguyen.rh@renesas.com>
commit 44378cd113e5f15bb0a89f5ac5a0e687b52feb90 upstream.
da7213.c is missing pm_runtime_disable(), thus we will get
below error when rmmod -> insmod.
$ rmmod snd-soc-da7213.ko
$ insmod snd-soc-da7213.ko
da7213 0-001a: Unbalanced pm_runtime_enable!"
[Kuninori adjusted to latest upstream]
Signed-off-by: Duy Nguyen <duy.nguyen.rh@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Khanh Le <khanh.le.xr@renesas.com>
Link: https://lore.kernel.org/r/87mt3xg2tk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[claudiu.beznea: fixed conflict by keeping both the .probe and .remove
in da7213_i2c_driver, make da7213_i2c_remove() return int]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 89842d77e4f6..0a4b22a711b7 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -2024,6 +2024,13 @@ static int da7213_i2c_probe(struct i2c_client *i2c,
return ret;
}
+static int da7213_i2c_remove(struct i2c_client *i2c)
+{
+ pm_runtime_disable(&i2c->dev);
+
+ return 0;
+}
+
static int __maybe_unused da7213_runtime_suspend(struct device *dev)
{
struct da7213_priv *da7213 = dev_get_drvdata(dev);
@@ -2067,6 +2074,7 @@ static struct i2c_driver da7213_i2c_driver = {
.pm = &da7213_pm,
},
.probe = da7213_i2c_probe,
+ .remove = da7213_i2c_remove,
.id_table = da7213_i2c_id,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 03/37] ASoC: da7213: Add new kcontrol for tonegen
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 01/37] ASoC: da7213: Add support for mono, set frame width to 32 when possible Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 02/37] ASoC: da7213.c: add missing pm_runtime_disable() Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-12 8:01 ` Pavel Machek
2025-05-09 9:34 ` [PATCH 5.10.y-cip 04/37] ASoC: codecs: da7213: Simplify mclk initialization Claudiu
` (32 subsequent siblings)
35 siblings, 1 reply; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: David Rau <David.Rau.opensource@dm.renesas.com>
commit 64c3259b5f86963c5214e63cfadedaa2278ba0ed upstream.
Add new kcontrol for tone generator
Signed-off-by: David Rau <David.Rau.opensource@dm.renesas.com>
Link: https://lore.kernel.org/r/20231018064444.23186-1-David.Rau.opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 171 +++++++++++++++++++++++++++++++++++++-
sound/soc/codecs/da7213.h | 64 +++++++++++++-
2 files changed, 233 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 0a4b22a711b7..8a30221a20a1 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -55,6 +55,7 @@ static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -5700, 100, 0);
static const DECLARE_TLV_DB_SCALE(lineout_vol_tlv, -4800, 100, 0);
static const DECLARE_TLV_DB_SCALE(alc_threshold_tlv, -9450, 150, 0);
static const DECLARE_TLV_DB_SCALE(alc_gain_tlv, 0, 600, 0);
+static const DECLARE_TLV_DB_SCALE(da7213_tonegen_gain_tlv, -4500, 300, 0);
/* ADC and DAC voice mode (8kHz) high pass cutoff value */
static const char * const da7213_voice_hpf_corner_txt[] = {
@@ -86,6 +87,23 @@ static SOC_ENUM_SINGLE_DECL(da7213_adc_audio_hpf_corner,
DA7213_AUDIO_HPF_CORNER_SHIFT,
da7213_audio_hpf_corner_txt);
+static const char * const da7213_tonegen_dtmf_key_txt[] = {
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D",
+ "*", "#"
+};
+
+static const struct soc_enum da7213_tonegen_dtmf_key =
+ SOC_ENUM_SINGLE(DA7213_TONE_GEN_CFG1, DA7213_DTMF_REG_SHIFT,
+ DA7213_DTMF_REG_MAX, da7213_tonegen_dtmf_key_txt);
+
+static const char * const da7213_tonegen_swg_sel_txt[] = {
+ "Sum", "SWG1", "SWG2", "Sum"
+};
+
+static const struct soc_enum da7213_tonegen_swg_sel =
+ SOC_ENUM_SINGLE(DA7213_TONE_GEN_CFG2, DA7213_SWG_SEL_SHIFT,
+ DA7213_SWG_SEL_MAX, da7213_tonegen_swg_sel_txt);
+
/* Gain ramping rate value */
static const char * const da7213_gain_ramp_rate_txt[] = {
"nominal rate * 8", "nominal rate * 16", "nominal rate / 16",
@@ -191,6 +209,64 @@ static SOC_ENUM_SINGLE_DECL(da7213_alc_integ_release_rate,
* Control Functions
*/
+/* Locked Kcontrol calls */
+static int da7213_volsw_locked_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
+ int ret;
+
+ mutex_lock(&da7213->ctrl_lock);
+ ret = snd_soc_get_volsw(kcontrol, ucontrol);
+ mutex_unlock(&da7213->ctrl_lock);
+
+ return ret;
+}
+
+static int da7213_volsw_locked_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
+ int ret;
+
+ mutex_lock(&da7213->ctrl_lock);
+ ret = snd_soc_put_volsw(kcontrol, ucontrol);
+ mutex_unlock(&da7213->ctrl_lock);
+
+ return ret;
+}
+
+static int da7213_enum_locked_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
+ int ret;
+
+ mutex_lock(&da7213->ctrl_lock);
+ ret = snd_soc_get_enum_double(kcontrol, ucontrol);
+ mutex_unlock(&da7213->ctrl_lock);
+
+ return ret;
+}
+
+static int da7213_enum_locked_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
+ int ret;
+
+ mutex_lock(&da7213->ctrl_lock);
+ ret = snd_soc_put_enum_double(kcontrol, ucontrol);
+ mutex_unlock(&da7213->ctrl_lock);
+
+ return ret;
+}
+
+/* ALC */
static int da7213_get_alc_data(struct snd_soc_component *component, u8 reg_val)
{
int mid_data, top_data;
@@ -376,6 +452,64 @@ static int da7213_put_alc_sw(struct snd_kcontrol *kcontrol,
return snd_soc_put_volsw(kcontrol, ucontrol);
}
+/* ToneGen */
+static int da7213_tonegen_freq_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
+ struct soc_mixer_control *mixer_ctrl =
+ (struct soc_mixer_control *) kcontrol->private_value;
+ unsigned int reg = mixer_ctrl->reg;
+ __le16 val;
+ int ret;
+
+ mutex_lock(&da7213->ctrl_lock);
+ ret = regmap_raw_read(da7213->regmap, reg, &val, sizeof(val));
+ mutex_unlock(&da7213->ctrl_lock);
+
+ if (ret)
+ return ret;
+
+ /*
+ * Frequency value spans two 8-bit registers, lower then upper byte.
+ * Therefore we need to convert to host endianness here.
+ */
+ ucontrol->value.integer.value[0] = le16_to_cpu(val);
+
+ return 0;
+}
+
+static int da7213_tonegen_freq_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component);
+ struct soc_mixer_control *mixer_ctrl =
+ (struct soc_mixer_control *) kcontrol->private_value;
+ unsigned int reg = mixer_ctrl->reg;
+ __le16 val_new, val_old;
+ int ret;
+
+ /*
+ * Frequency value spans two 8-bit registers, lower then upper byte.
+ * Therefore we need to convert to little endian here to align with
+ * HW registers.
+ */
+ val_new = cpu_to_le16(ucontrol->value.integer.value[0]);
+
+ mutex_lock(&da7213->ctrl_lock);
+ ret = regmap_raw_read(da7213->regmap, reg, &val_old, sizeof(val_old));
+ if (ret == 0 && (val_old != val_new))
+ ret = regmap_raw_write(da7213->regmap, reg,
+ &val_new, sizeof(val_new));
+ mutex_unlock(&da7213->ctrl_lock);
+
+ if (ret < 0)
+ return ret;
+
+ return val_old != val_new;
+}
/*
* KControls
@@ -477,6 +611,37 @@ static const struct snd_kcontrol_new da7213_snd_controls[] = {
SOC_DOUBLE_R("Headphone ZC Switch", DA7213_HP_L_CTRL, DA7213_HP_R_CTRL,
DA7213_ZC_EN_SHIFT, DA7213_ZC_EN_MAX, DA7213_NO_INVERT),
+ /* Tone Generator */
+ SOC_SINGLE_EXT_TLV("ToneGen Volume", DA7213_TONE_GEN_CFG2,
+ DA7213_TONE_GEN_GAIN_SHIFT, DA7213_TONE_GEN_GAIN_MAX,
+ DA7213_NO_INVERT, da7213_volsw_locked_get,
+ da7213_volsw_locked_put, da7213_tonegen_gain_tlv),
+ SOC_ENUM_EXT("ToneGen DTMF Key", da7213_tonegen_dtmf_key,
+ da7213_enum_locked_get, da7213_enum_locked_put),
+ SOC_SINGLE_EXT("ToneGen DTMF Switch", DA7213_TONE_GEN_CFG1,
+ DA7213_DTMF_EN_SHIFT, DA7213_SWITCH_EN_MAX,
+ DA7213_NO_INVERT, da7213_volsw_locked_get,
+ da7213_volsw_locked_put),
+ SOC_SINGLE_EXT("ToneGen Start", DA7213_TONE_GEN_CFG1,
+ DA7213_START_STOPN_SHIFT, DA7213_SWITCH_EN_MAX,
+ DA7213_NO_INVERT, da7213_volsw_locked_get,
+ da7213_volsw_locked_put),
+ SOC_ENUM_EXT("ToneGen Sinewave Gen Type", da7213_tonegen_swg_sel,
+ da7213_enum_locked_get, da7213_enum_locked_put),
+ SOC_SINGLE_EXT("ToneGen Sinewave1 Freq", DA7213_TONE_GEN_FREQ1_L,
+ DA7213_FREQ1_L_SHIFT, DA7213_FREQ_MAX, DA7213_NO_INVERT,
+ da7213_tonegen_freq_get, da7213_tonegen_freq_put),
+ SOC_SINGLE_EXT("ToneGen Sinewave2 Freq", DA7213_TONE_GEN_FREQ2_L,
+ DA7213_FREQ2_L_SHIFT, DA7213_FREQ_MAX, DA7213_NO_INVERT,
+ da7213_tonegen_freq_get, da7213_tonegen_freq_put),
+ SOC_SINGLE_EXT("ToneGen On Time", DA7213_TONE_GEN_ON_PER,
+ DA7213_BEEP_ON_PER_SHIFT, DA7213_BEEP_ON_OFF_MAX,
+ DA7213_NO_INVERT, da7213_volsw_locked_get,
+ da7213_volsw_locked_put),
+ SOC_SINGLE("ToneGen Off Time", DA7213_TONE_GEN_OFF_PER,
+ DA7213_BEEP_OFF_PER_SHIFT, DA7213_BEEP_ON_OFF_MAX,
+ DA7213_NO_INVERT),
+
/* Gain Ramping controls */
SOC_DOUBLE_R("Aux Gain Ramping Switch", DA7213_AUX_L_CTRL,
DA7213_AUX_R_CTRL, DA7213_GAIN_RAMP_EN_SHIFT,
@@ -765,7 +930,7 @@ static int da7213_dai_event(struct snd_soc_dapm_widget *w,
/* Check SRM has locked */
do {
pll_status = snd_soc_component_read(component, DA7213_PLL_STATUS);
- if (pll_status & DA7219_PLL_SRM_LOCK) {
+ if (pll_status & DA7213_PLL_SRM_LOCK) {
srm_lock = true;
} else {
++i;
@@ -1931,6 +2096,9 @@ static int da7213_probe(struct snd_soc_component *component)
da7213->fixed_clk_auto_pll = true;
}
+ /* Default infinite tone gen, start/stop by Kcontrol */
+ snd_soc_component_write(component, DA7213_TONE_GEN_CYCLES, DA7213_BEEP_CYCLES_MASK);
+
return 0;
}
@@ -2082,4 +2250,5 @@ module_i2c_driver(da7213_i2c_driver);
MODULE_DESCRIPTION("ASoC DA7213 Codec driver");
MODULE_AUTHOR("Adam Thomson <Adam.Thomson.Opensource@diasemi.com>");
+MODULE_AUTHOR("David Rau <David.Rau.opensource@dm.renesas.com>");
MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/da7213.h b/sound/soc/codecs/da7213.h
index 4ca9cfdea06d..505b731c0adb 100644
--- a/sound/soc/codecs/da7213.h
+++ b/sound/soc/codecs/da7213.h
@@ -5,6 +5,7 @@
* Copyright (c) 2013 Dialog Semiconductor
*
* Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
+ * Author: David Rau <David.Rau.opensource@dm.renesas.com>
*/
#ifndef _DA7213_H
@@ -135,13 +136,24 @@
#define DA7213_DAC_NG_ON_THRESHOLD 0xB1
#define DA7213_DAC_NG_CTRL 0xB2
+#define DA7213_TONE_GEN_CFG1 0xB4
+#define DA7213_TONE_GEN_CFG2 0xB5
+#define DA7213_TONE_GEN_CYCLES 0xB6
+#define DA7213_TONE_GEN_FREQ1_L 0xB7
+#define DA7213_TONE_GEN_FREQ1_U 0xB8
+#define DA7213_TONE_GEN_FREQ2_L 0xB9
+#define DA7213_TONE_GEN_FREQ2_U 0xBA
+#define DA7213_TONE_GEN_ON_PER 0xBB
+#define DA7213_TONE_GEN_OFF_PER 0xBC
/*
* Bit fields
*/
+#define DA7213_SWITCH_EN_MAX 0x1
+
/* DA7213_PLL_STATUS = 0x03 */
-#define DA7219_PLL_SRM_LOCK (0x1 << 1)
+#define DA7213_PLL_SRM_LOCK (0x1 << 1)
/* DA7213_SR = 0x22 */
#define DA7213_SR_8000 (0x1 << 0)
@@ -484,6 +496,55 @@
#define DA7213_DAC_NG_EN_SHIFT 7
#define DA7213_DAC_NG_EN_MAX 0x1
+/* DA7213_TONE_GEN_CFG1 = 0xB4 */
+#define DA7213_DTMF_REG_SHIFT 0
+#define DA7213_DTMF_REG_MASK (0xF << 0)
+#define DA7213_DTMF_REG_MAX 16
+#define DA7213_DTMF_EN_SHIFT 4
+#define DA7213_DTMF_EN_MASK (0x1 << 4)
+#define DA7213_START_STOPN_SHIFT 7
+#define DA7213_START_STOPN_MASK (0x1 << 7)
+
+/* DA7213_TONE_GEN_CFG2 = 0xB5 */
+#define DA7213_SWG_SEL_SHIFT 0
+#define DA7213_SWG_SEL_MASK (0x3 << 0)
+#define DA7213_SWG_SEL_MAX 4
+#define DA7213_SWG_SEL_SRAMP (0x3 << 0)
+#define DA7213_TONE_GEN_GAIN_SHIFT 4
+#define DA7213_TONE_GEN_GAIN_MASK (0xF << 4)
+#define DA7213_TONE_GEN_GAIN_MAX 0xF
+#define DA7213_TONE_GEN_GAIN_MINUS_9DB (0x3 << 4)
+#define DA7213_TONE_GEN_GAIN_MINUS_15DB (0x5 << 4)
+
+/* DA7213_TONE_GEN_CYCLES = 0xB6 */
+#define DA7213_BEEP_CYCLES_SHIFT 0
+#define DA7213_BEEP_CYCLES_MASK (0x7 << 0)
+
+/* DA7213_TONE_GEN_FREQ1_L = 0xB7 */
+#define DA7213_FREQ1_L_SHIFT 0
+#define DA7213_FREQ1_L_MASK (0xFF << 0)
+#define DA7213_FREQ_MAX 0xFFFF
+
+/* DA7213_TONE_GEN_FREQ1_U = 0xB8 */
+#define DA7213_FREQ1_U_SHIFT 0
+#define DA7213_FREQ1_U_MASK (0xFF << 0)
+
+/* DA7213_TONE_GEN_FREQ2_L = 0xB9 */
+#define DA7213_FREQ2_L_SHIFT 0
+#define DA7213_FREQ2_L_MASK (0xFF << 0)
+
+/* DA7213_TONE_GEN_FREQ2_U = 0xBA */
+#define DA7213_FREQ2_U_SHIFT 0
+#define DA7213_FREQ2_U_MASK (0xFF << 0)
+
+/* DA7213_TONE_GEN_ON_PER = 0xBB */
+#define DA7213_BEEP_ON_PER_SHIFT 0
+#define DA7213_BEEP_ON_PER_MASK (0x3F << 0)
+#define DA7213_BEEP_ON_OFF_MAX 0x3F
+
+/* DA7213_TONE_GEN_OFF_PER = 0xBC */
+#define DA7213_BEEP_OFF_PER_SHIFT 0
+#define DA7213_BEEP_OFF_PER_MASK (0x3F << 0)
/*
* General defines
@@ -534,6 +595,7 @@ enum da7213_supplies {
/* Codec private data */
struct da7213_priv {
struct regmap *regmap;
+ struct mutex ctrl_lock;
struct regulator_bulk_data supplies[DA7213_NUM_SUPPLIES];
struct clk *mclk;
unsigned int mclk_rate;
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 04/37] ASoC: codecs: da7213: Simplify mclk initialization
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (2 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 03/37] ASoC: da7213: Add new kcontrol for tonegen Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 05/37] ASoC: da7213: Populate max_register to regmap_config Claudiu
` (31 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Cezary Rojewski <cezary.rojewski@intel.com>
commit e2cb72d28740516cb03fa072e14b2f1a6eceef61 upstream.
Most of clk_xxx() functions do check if provided clk-pointer is
non-NULL. These do not check if the pointer is an error-pointer.
Providing such to a clk_xxx() results in a panic.
By utilizing _optional() variant of devm_clk_get() the driver code is
both simplified and more robust. There is no need to remember about
IS_ERR(clk) checks each time mclk is accessed.
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240221152516.852353-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 8a30221a20a1..911348ba8ad7 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -2083,18 +2083,14 @@ static int da7213_probe(struct snd_soc_component *component)
pm_runtime_put_sync(component->dev);
/* Check if MCLK provided */
- da7213->mclk = devm_clk_get(component->dev, "mclk");
- if (IS_ERR(da7213->mclk)) {
- if (PTR_ERR(da7213->mclk) != -ENOENT)
- return PTR_ERR(da7213->mclk);
- else
- da7213->mclk = NULL;
- } else {
+ da7213->mclk = devm_clk_get_optional(component->dev, "mclk");
+ if (IS_ERR(da7213->mclk))
+ return PTR_ERR(da7213->mclk);
+ if (da7213->mclk)
/* Do automatic PLL handling assuming fixed clock until
* set_pll() has been called. This makes the codec usable
* with the simple-audio-card driver. */
da7213->fixed_clk_auto_pll = true;
- }
/* Default infinite tone gen, start/stop by Kcontrol */
snd_soc_component_write(component, DA7213_TONE_GEN_CYCLES, DA7213_BEEP_CYCLES_MASK);
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 05/37] ASoC: da7213: Populate max_register to regmap_config
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (3 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 04/37] ASoC: codecs: da7213: Simplify mclk initialization Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 06/37] ASoC: da7213: Return directly the value of regcache_sync() Claudiu
` (30 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 9d4f9f6a7bb1afbde57d08c98f2db4ff019ee19d upstream.
On the Renesas RZ/G3S SMARC Carrier II board having a DA7212 codec (using
da7213 driver) connected to one SSIF-2 available on the Renesas RZ/G3S SoC
it has been discovered that using the runtime PM API for suspend/resume
(as will be proposed in the following commits) leads to the codec not
being propertly initialized after resume. This is because w/o
max_register populated to regmap_config the regcache_rbtree_sync()
breaks on base_reg > max condition and the regcache_sync_block() call is
skipped.
Fixes: ef5c2eba2412 ("ASoC: codecs: Add da7213 codec")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241106081826.1211088-23-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 911348ba8ad7..d4b0e48f818c 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -2119,6 +2119,7 @@ static const struct regmap_config da7213_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
+ .max_register = DA7213_TONE_GEN_OFF_PER,
.reg_defaults = da7213_reg_defaults,
.num_reg_defaults = ARRAY_SIZE(da7213_reg_defaults),
.volatile_reg = da7213_volatile_register,
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 06/37] ASoC: da7213: Return directly the value of regcache_sync()
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (4 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 05/37] ASoC: da7213: Populate max_register to regmap_config Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 07/37] ASoC: da7213: Add suspend to RAM support Claudiu
` (29 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 841256954037ad80a57b8fa17a794ae9a01b2e23 upstream.
Return directly the value of the regcache_sync() in
da7213_runtime_resume(). In case of any failures this will inform the
runtime resume process.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241106081826.1211088-24-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index d4b0e48f818c..807a8448bd27 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -2216,8 +2216,7 @@ static int __maybe_unused da7213_runtime_resume(struct device *dev)
if (ret < 0)
return ret;
regcache_cache_only(da7213->regmap, false);
- regcache_sync(da7213->regmap);
- return 0;
+ return regcache_sync(da7213->regmap);
}
static const struct dev_pm_ops da7213_pm = {
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 07/37] ASoC: da7213: Add suspend to RAM support
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (5 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 06/37] ASoC: da7213: Return directly the value of regcache_sync() Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 08/37] ASoC: da7213: Avoid setting PLL when closing audio stream Claudiu
` (28 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 431e040065c814448ffcc2fac493f7dbbfb2e796 upstream.
Add suspend to RAM support. This uses the already available runtime PM
support.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241106081826.1211088-25-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 807a8448bd27..61edcf70e717 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -2221,6 +2221,7 @@ static int __maybe_unused da7213_runtime_resume(struct device *dev)
static const struct dev_pm_ops da7213_pm = {
SET_RUNTIME_PM_OPS(da7213_runtime_suspend, da7213_runtime_resume, NULL)
+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
};
static const struct i2c_device_id da7213_i2c_id[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 08/37] ASoC: da7213: Avoid setting PLL when closing audio stream
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (6 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 07/37] ASoC: da7213: Add suspend to RAM support Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 09/37] ASoC: da7213: Extend support for the MCK in range [2, 50] MHz Claudiu
` (27 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Hao Bui <hao.bui.yg@renesas.com>
commit 1e1a2ef95b571825ca9c0113f6bef51e9cec98b0 upstream.
When audio stream is closing, audio frequency is set to 0 by ALSA but
codec driver DA7213 does not handle properly in this case. This patch
adds checking of 0Hz frequency to da7213_set_component_sysclk() and avoid
unnecessary PLL settings.
Signed-off-by: Hao Bui <hao.bui.yg@renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241106081826.1211088-26-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 61edcf70e717..32d03f764e00 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -1555,6 +1555,10 @@ static int da7213_set_component_sysclk(struct snd_soc_component *component,
if ((da7213->clk_src == clk_id) && (da7213->mclk_rate == freq))
return 0;
+ /* Maybe audio stream is closing. */
+ if (freq == 0)
+ return 0;
+
if (((freq < 5000000) && (freq != 32768)) || (freq > 54000000)) {
dev_err(component->dev, "Unsupported MCLK value %d\n",
freq);
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 09/37] ASoC: da7213: Extend support for the MCK in range [2, 50] MHz
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (7 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 08/37] ASoC: da7213: Avoid setting PLL when closing audio stream Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 10/37] ASoC: da7213: Initialize the mutex Claudiu
` (26 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Hao Bui <hao.bui.yg@renesas.com>
commit b3296f9095d6ad24723e5ad89c28acc317d0c3cf upstream.
According to DA7212 HW manual, the codec's PLL input divider can operate
with MCLK range from 2MHz to 50MHz but current driver only set the
minimum supported MCLK frequency to 5MHz. That cause 11.025kHz audio
which is corresponding to MCLK of 2.8224MHz (11.025kHz * 256) unable to
play in case audio-simple-card is used.
Signed-off-by: Hao Bui <hao.bui.yg@renesas.com>
Co-developed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241106081826.1211088-27-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 18 +++++++++++++-----
sound/soc/codecs/da7213.h | 1 +
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 32d03f764e00..9a7ad34ae554 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -20,6 +20,7 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <linux/pm_runtime.h>
+#include <linux/units.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>
@@ -1559,7 +1560,7 @@ static int da7213_set_component_sysclk(struct snd_soc_component *component,
if (freq == 0)
return 0;
- if (((freq < 5000000) && (freq != 32768)) || (freq > 54000000)) {
+ if (((freq < da7213->fin_min_rate) && (freq != 32768)) || (freq > 54000000)) {
dev_err(component->dev, "Unsupported MCLK value %d\n",
freq);
return -EINVAL;
@@ -1840,11 +1841,14 @@ static int da7213_set_bias_level(struct snd_soc_component *component,
return 0;
}
+#define DA7213_FIN_MIN_RATE (5 * MEGA)
+#define DA7212_FIN_MIN_RATE (2 * MEGA)
+
#if defined(CONFIG_OF)
/* DT */
static const struct of_device_id da7213_of_match[] = {
- { .compatible = "dlg,da7212", },
- { .compatible = "dlg,da7213", },
+ { .compatible = "dlg,da7212", .data = (void *)DA7212_FIN_MIN_RATE },
+ { .compatible = "dlg,da7213", .data = (void *)DA7213_FIN_MIN_RATE },
{ }
};
MODULE_DEVICE_TABLE(of, da7213_of_match);
@@ -1852,8 +1856,8 @@ MODULE_DEVICE_TABLE(of, da7213_of_match);
#ifdef CONFIG_ACPI
static const struct acpi_device_id da7213_acpi_match[] = {
- { "DLGS7212", 0},
- { "DLGS7213", 0},
+ { "DLGS7212", DA7212_FIN_MIN_RATE },
+ { "DLGS7213", DA7213_FIN_MIN_RATE },
{ },
};
MODULE_DEVICE_TABLE(acpi, da7213_acpi_match);
@@ -2151,6 +2155,10 @@ static int da7213_i2c_probe(struct i2c_client *i2c,
if (!da7213)
return -ENOMEM;
+ da7213->fin_min_rate = (uintptr_t)i2c_get_match_data(i2c);
+ if (!da7213->fin_min_rate)
+ return -EINVAL;
+
i2c_set_clientdata(i2c, da7213);
/* Get required supplies */
diff --git a/sound/soc/codecs/da7213.h b/sound/soc/codecs/da7213.h
index 505b731c0adb..b9ab791d6b88 100644
--- a/sound/soc/codecs/da7213.h
+++ b/sound/soc/codecs/da7213.h
@@ -600,6 +600,7 @@ struct da7213_priv {
struct clk *mclk;
unsigned int mclk_rate;
unsigned int out_rate;
+ unsigned int fin_min_rate;
int clk_src;
bool master;
bool alc_calib_auto;
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 10/37] ASoC: da7213: Initialize the mutex
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (8 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 09/37] ASoC: da7213: Extend support for the MCK in range [2, 50] MHz Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 11/37] arm64: defconfig: Enable DA7213 Codec Claudiu
` (25 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 4a32a38cb68f55ff9e100df348ddb3d4b3e50643 upstream.
Initialize the struct da7213_priv::ctrl_lock mutex. Without it the
following stack trace is displayed when rebooting and lockdep is enabled:
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: CPU: 0 PID: 180 at kernel/locking/mutex.c:564 __mutex_lock+0x254/0x4e4
CPU: 0 UID: 0 PID: 180 Comm: alsactl Not tainted 6.13.0-next-20250123-arm64-renesas-00002-g132083a22d3d #30
Hardware name: Renesas SMARC EVK version 2 based on r9a08g045s33 (DT)
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __mutex_lock+0x254/0x4e4
lr : __mutex_lock+0x254/0x4e4
sp : ffff800082c13c00
x29: ffff800082c13c00 x28: ffff00001002b500 x27: 0000000000000000
x26: 0000000000000000 x25: ffff800080b30db4 x24: 0000000000000002
x23: ffff800082c13c70 x22: 0000ffffc2a68a70 x21: ffff000010348000
x20: 0000000000000000 x19: ffff00000be2e488 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 00000000000003c1 x13: 00000000000003c1 x12: 0000000000000000
x11: 0000000000000011 x10: 0000000000001420 x9 : ffff800082c13a70
x8 : 0000000000000001 x7 : ffff800082c13a50 x6 : ffff800082c139e0
x5 : ffff800082c14000 x4 : ffff800082c13a50 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00001002b500
Call trace:
__mutex_lock+0x254/0x4e4 (P)
mutex_lock_nested+0x20/0x28
da7213_volsw_locked_get+0x34/0x60
snd_ctl_elem_read+0xbc/0x114
snd_ctl_ioctl+0x878/0xa70
__arm64_sys_ioctl+0x94/0xc8
invoke_syscall+0x44/0x104
el0_svc_common.constprop.0+0xb4/0xd4
do_el0_svc+0x18/0x20
el0_svc+0x3c/0xf0
el0t_64_sync_handler+0xc0/0xc4
el0t_64_sync+0x154/0x158
irq event stamp: 7713
hardirqs last enabled at (7713): [<ffff800080170d94>] ktime_get_coarse_real_ts64+0xf0/0x10c
hardirqs last disabled at (7712): [<ffff800080170d58>] ktime_get_coarse_real_ts64+0xb4/0x10c
softirqs last enabled at (7550): [<ffff8000800179d4>] fpsimd_restore_current_state+0x30/0xb8
softirqs last disabled at (7548): [<ffff8000800179a8>] fpsimd_restore_current_state+0x4/0xb8
---[ end trace 0000000000000000 ]---
Fixes: 64c3259b5f86 ("ASoC: da7213: Add new kcontrol for tonegen")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20250123121036.70406-1-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/codecs/da7213.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 9a7ad34ae554..6d32026ae69f 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -2187,6 +2187,8 @@ static int da7213_i2c_probe(struct i2c_client *i2c,
return ret;
}
+ mutex_init(&da7213->ctrl_lock);
+
pm_runtime_set_autosuspend_delay(&i2c->dev, 100);
pm_runtime_use_autosuspend(&i2c->dev);
pm_runtime_set_active(&i2c->dev);
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 11/37] arm64: defconfig: Enable DA7213 Codec
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (9 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 10/37] ASoC: da7213: Initialize the mutex Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 12/37] clk: renesas: r9a08g045: Add clocks, resets and power domains support for SSI Claudiu
` (24 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
commit 29dfd412ec9e08b05b65848174646353b58fb54d upstream.
Enable the DA7213 Codec for ARD-AUDIO-DA7212 support on R-Car V4H White
Hawk.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/87mt4pl9sz.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 14a6a6978714..0bda64450d24 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -731,6 +731,7 @@ CONFIG_SND_SOC_TEGRA210_I2S=m
CONFIG_SND_SOC_TEGRA186_DSPK=m
CONFIG_SND_SOC_TEGRA210_ADMAIF=m
CONFIG_SND_SOC_AK4613=m
+CONFIG_SND_SOC_DA7213=m
CONFIG_SND_SOC_ES7134=m
CONFIG_SND_SOC_ES7241=m
CONFIG_SND_SOC_PCM3168A_I2C=m
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 12/37] clk: renesas: r9a08g045: Add clocks, resets and power domains support for SSI
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (10 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 11/37] arm64: defconfig: Enable DA7213 Codec Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 13/37] clk: versaclock3: Prepare for the addition of 5L35023 device Claudiu
` (23 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 97088b3a8e71ed87fbb25a34b222d869033d73df upstream.
Add SSI clocks, resets and power domains support for the SSI blocks
available on the Renesas RZ/G3S SoC.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241113133540.2005850-2-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[claudiu.beznea: dropped USB clocks and resets, dropped the power domain
instantiation as the core code is not available yet]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/clk/renesas/r9a08g045-cpg.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/clk/renesas/r9a08g045-cpg.c b/drivers/clk/renesas/r9a08g045-cpg.c
index c14b34bfdb05..d01a784cbb10 100644
--- a/drivers/clk/renesas/r9a08g045-cpg.c
+++ b/drivers/clk/renesas/r9a08g045-cpg.c
@@ -208,6 +208,14 @@ static const struct rzg2l_mod_clk r9a08g045_mod_clks[] = {
DEF_MOD("sdhi2_imclk2", R9A08G045_SDHI2_IMCLK2, CLK_SD2_DIV4, 0x554, 9),
DEF_MOD("sdhi2_clk_hs", R9A08G045_SDHI2_CLK_HS, R9A08G045_CLK_SD2, 0x554, 10),
DEF_MOD("sdhi2_aclk", R9A08G045_SDHI2_ACLK, R9A08G045_CLK_P1, 0x554, 11),
+ DEF_MOD("ssi0_pclk2", R9A08G045_SSI0_PCLK2, R9A08G045_CLK_P0, 0x570, 0),
+ DEF_MOD("ssi0_sfr", R9A08G045_SSI0_PCLK_SFR, R9A08G045_CLK_P0, 0x570, 1),
+ DEF_MOD("ssi1_pclk2", R9A08G045_SSI1_PCLK2, R9A08G045_CLK_P0, 0x570, 2),
+ DEF_MOD("ssi1_sfr", R9A08G045_SSI1_PCLK_SFR, R9A08G045_CLK_P0, 0x570, 3),
+ DEF_MOD("ssi2_pclk2", R9A08G045_SSI2_PCLK2, R9A08G045_CLK_P0, 0x570, 4),
+ DEF_MOD("ssi2_sfr", R9A08G045_SSI2_PCLK_SFR, R9A08G045_CLK_P0, 0x570, 5),
+ DEF_MOD("ssi3_pclk2", R9A08G045_SSI3_PCLK2, R9A08G045_CLK_P0, 0x570, 6),
+ DEF_MOD("ssi3_sfr", R9A08G045_SSI3_PCLK_SFR, R9A08G045_CLK_P0, 0x570, 7),
DEF_COUPLED("eth0_axi", R9A08G045_ETH0_CLK_AXI, R9A08G045_CLK_M0, 0x57c, 0),
DEF_COUPLED("eth0_chi", R9A08G045_ETH0_CLK_CHI, R9A08G045_CLK_ZT, 0x57c, 0),
DEF_MOD("eth0_refclk", R9A08G045_ETH0_REFCLK, R9A08G045_CLK_HP, 0x57c, 8),
@@ -233,6 +241,10 @@ static const struct rzg2l_reset r9a08g045_resets[] = {
DEF_RST(R9A08G045_SDHI0_IXRST, 0x854, 0),
DEF_RST(R9A08G045_SDHI1_IXRST, 0x854, 1),
DEF_RST(R9A08G045_SDHI2_IXRST, 0x854, 2),
+ DEF_RST(R9A08G045_SSI0_RST_M2_REG, 0x870, 0),
+ DEF_RST(R9A08G045_SSI1_RST_M2_REG, 0x870, 1),
+ DEF_RST(R9A08G045_SSI2_RST_M2_REG, 0x870, 2),
+ DEF_RST(R9A08G045_SSI3_RST_M2_REG, 0x870, 3),
DEF_RST(R9A08G045_ETH0_RST_HW_N, 0x87c, 0),
DEF_RST(R9A08G045_ETH1_RST_HW_N, 0x87c, 1),
DEF_RST(R9A08G045_I2C0_MRST, 0x880, 0),
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 13/37] clk: versaclock3: Prepare for the addition of 5L35023 device
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (11 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 12/37] clk: renesas: r9a08g045: Add clocks, resets and power domains support for SSI Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 14/37] dt-bindings: clock: versaclock3: Document 5L35023 Versa3 clock generator Claudiu
` (22 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit ae6040cd7c7f8e80deefe5a49691734480f97409 upstream.
The 5P35023 and 5L35035 Versa 3 clock generator variants are different but
the versaclock3 driver could be used with small adjustments. The features
that are implemented in driver and differs b/w variants are the PLL2 Fvco
and clock sel bit for SE2 clock. Adjust the driver to prepare for the
addition of 5L35023 device.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20241210170953.2936724-2-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/clk/clk-versaclock3.c | 61 ++++++++++++++++++++++++-----------
1 file changed, 43 insertions(+), 18 deletions(-)
diff --git a/drivers/clk/clk-versaclock3.c b/drivers/clk/clk-versaclock3.c
index 89bd4c29346c..70f23e64939c 100644
--- a/drivers/clk/clk-versaclock3.c
+++ b/drivers/clk/clk-versaclock3.c
@@ -78,9 +78,6 @@
#define VC3_PLL1_VCO_MIN 300000000UL
#define VC3_PLL1_VCO_MAX 600000000UL
-#define VC3_PLL2_VCO_MIN 400000000UL
-#define VC3_PLL2_VCO_MAX 1200000000UL
-
#define VC3_PLL3_VCO_MIN 300000000UL
#define VC3_PLL3_VCO_MAX 800000000UL
@@ -147,9 +144,13 @@ struct vc3_pfd_data {
u8 mdiv2_bitmsk;
};
+struct vc3_vco {
+ unsigned long min;
+ unsigned long max;
+};
+
struct vc3_pll_data {
- unsigned long vco_min;
- unsigned long vco_max;
+ struct vc3_vco vco;
u8 num;
u8 int_div_msb_offs;
u8 int_div_lsb_offs;
@@ -166,12 +167,17 @@ struct vc3_div_data {
struct vc3_hw_data {
struct clk_hw hw;
struct regmap *regmap;
- const void *data;
+ void *data;
u32 div_int;
u32 div_frc;
};
+struct vc3_hw_cfg {
+ struct vc3_vco pll2_vco;
+ u32 se2_clk_sel_msk;
+};
+
static const struct clk_div_table div1_divs[] = {
{ .val = 0, .div = 1, }, { .val = 1, .div = 4, },
{ .val = 2, .div = 5, }, { .val = 3, .div = 6, },
@@ -385,10 +391,10 @@ static long vc3_pll_round_rate(struct clk_hw *hw, unsigned long rate,
const struct vc3_pll_data *pll = vc3->data;
u64 div_frc;
- if (rate < pll->vco_min)
- rate = pll->vco_min;
- if (rate > pll->vco_max)
- rate = pll->vco_max;
+ if (rate < pll->vco.min)
+ rate = pll->vco.min;
+ if (rate > pll->vco.max)
+ rate = pll->vco.max;
vc3->div_int = rate / *parent_rate;
@@ -684,8 +690,10 @@ static struct vc3_hw_data clk_pll[] = {
.num = VC3_PLL1,
.int_div_msb_offs = VC3_PLL1_LOOP_FILTER_N_DIV_MSB,
.int_div_lsb_offs = VC3_PLL1_VCO_N_DIVIDER,
- .vco_min = VC3_PLL1_VCO_MIN,
- .vco_max = VC3_PLL1_VCO_MAX
+ .vco = {
+ .min = VC3_PLL1_VCO_MIN,
+ .max = VC3_PLL1_VCO_MAX
+ }
},
.hw.init = &(struct clk_init_data) {
.name = "pll1",
@@ -702,8 +710,6 @@ static struct vc3_hw_data clk_pll[] = {
.num = VC3_PLL2,
.int_div_msb_offs = VC3_PLL2_FB_INT_DIV_MSB,
.int_div_lsb_offs = VC3_PLL2_FB_INT_DIV_LSB,
- .vco_min = VC3_PLL2_VCO_MIN,
- .vco_max = VC3_PLL2_VCO_MAX
},
.hw.init = &(struct clk_init_data) {
.name = "pll2",
@@ -720,8 +726,10 @@ static struct vc3_hw_data clk_pll[] = {
.num = VC3_PLL3,
.int_div_msb_offs = VC3_PLL3_LOOP_FILTER_N_DIV_MSB,
.int_div_lsb_offs = VC3_PLL3_N_DIVIDER,
- .vco_min = VC3_PLL3_VCO_MIN,
- .vco_max = VC3_PLL3_VCO_MAX
+ .vco = {
+ .min = VC3_PLL3_VCO_MIN,
+ .max = VC3_PLL3_VCO_MAX
+ }
},
.hw.init = &(struct clk_init_data) {
.name = "pll3",
@@ -905,7 +913,6 @@ static struct vc3_hw_data clk_mux[] = {
[VC3_SE2_MUX] = {
.data = &(struct vc3_clk_data) {
.offs = VC3_SE2_CTRL_REG0,
- .bitmsk = VC3_SE2_CTRL_REG0_SE2_CLK_SEL
},
.hw.init = &(struct clk_init_data) {
.name = "se2_mux",
@@ -986,6 +993,7 @@ static int vc3_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
u8 settings[NUM_CONFIG_REGISTERS];
+ const struct vc3_hw_cfg *data;
struct regmap *regmap;
const char *name;
int ret, i;
@@ -1033,9 +1041,16 @@ static int vc3_probe(struct i2c_client *client)
clk_pfd[i].hw.init->name);
}
+ data = i2c_get_match_data(client);
+
/* Register pll's */
for (i = 0; i < ARRAY_SIZE(clk_pll); i++) {
clk_pll[i].regmap = regmap;
+ if (i == VC3_PLL2) {
+ struct vc3_pll_data *pll_data = clk_pll[i].data;
+
+ pll_data->vco = data->pll2_vco;
+ }
ret = devm_clk_hw_register(dev, &clk_pll[i].hw);
if (ret)
return dev_err_probe(dev, ret, "%s failed\n",
@@ -1063,6 +1078,11 @@ static int vc3_probe(struct i2c_client *client)
/* Register clk muxes */
for (i = 0; i < ARRAY_SIZE(clk_mux); i++) {
clk_mux[i].regmap = regmap;
+ if (i == VC3_SE2_MUX) {
+ struct vc3_clk_data *clk_data = clk_mux[i].data;
+
+ clk_data->bitmsk = data->se2_clk_sel_msk;
+ }
ret = devm_clk_hw_register(dev, &clk_mux[i].hw);
if (ret)
return dev_err_probe(dev, ret, "%s failed\n",
@@ -1112,8 +1132,13 @@ static int vc3_probe(struct i2c_client *client)
return ret;
}
+static const struct vc3_hw_cfg vc3_5p = {
+ .pll2_vco = { .min = 400000000UL, .max = 1200000000UL },
+ .se2_clk_sel_msk = BIT(6),
+};
+
static const struct of_device_id dev_ids[] = {
- { .compatible = "renesas,5p35023" },
+ { .compatible = "renesas,5p35023", .data = &vc3_5p },
{ /* Sentinel */ }
};
MODULE_DEVICE_TABLE(of, dev_ids);
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 14/37] dt-bindings: clock: versaclock3: Document 5L35023 Versa3 clock generator
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (12 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 13/37] clk: versaclock3: Prepare for the addition of 5L35023 device Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 15/37] clk: versaclock3: Add support for the 5L35023 variant Claudiu
` (21 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 626b77735a3712b02dabb25be3a0abdde6696bf3 upstream.
There are some differences b/w 5L35023 and 5P35023 Versa3 clock
generator variants but the same driver could be used with minimal
adjustments. The identified differences are PLL2 Fvco, the clock sel
bit for SE2 clock and different default values for some registers.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20241210170953.2936724-3-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Documentation/devicetree/bindings/clock/renesas,5p35023.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/clock/renesas,5p35023.yaml b/Documentation/devicetree/bindings/clock/renesas,5p35023.yaml
index 42b6f80613f3..162d38035188 100644
--- a/Documentation/devicetree/bindings/clock/renesas,5p35023.yaml
+++ b/Documentation/devicetree/bindings/clock/renesas,5p35023.yaml
@@ -31,6 +31,7 @@ description: |
properties:
compatible:
enum:
+ - renesas,5l35023
- renesas,5p35023
reg:
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 15/37] clk: versaclock3: Add support for the 5L35023 variant
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (13 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 14/37] dt-bindings: clock: versaclock3: Document 5L35023 Versa3 clock generator Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 16/37] ASoC: renesas: rz-ssi: Terminate all the DMA transactions Claudiu
` (20 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit d3dcc98f65dbd364ff839edecf39d1a1e949ee90 upstream.
Add support for the 5L35023 variant of the Versa 3 clock generator.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20241210170953.2936724-4-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/clk/clk-versaclock3.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/clk/clk-versaclock3.c b/drivers/clk/clk-versaclock3.c
index 70f23e64939c..b6db9453f9b6 100644
--- a/drivers/clk/clk-versaclock3.c
+++ b/drivers/clk/clk-versaclock3.c
@@ -1137,8 +1137,14 @@ static const struct vc3_hw_cfg vc3_5p = {
.se2_clk_sel_msk = BIT(6),
};
+static const struct vc3_hw_cfg vc3_5l = {
+ .pll2_vco = { .min = 30000000UL, .max = 130000000UL },
+ .se2_clk_sel_msk = BIT(0),
+};
+
static const struct of_device_id dev_ids[] = {
{ .compatible = "renesas,5p35023", .data = &vc3_5p },
+ { .compatible = "renesas,5l35023", .data = &vc3_5l },
{ /* Sentinel */ }
};
MODULE_DEVICE_TABLE(of, dev_ids);
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 16/37] ASoC: renesas: rz-ssi: Terminate all the DMA transactions
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (14 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 15/37] clk: versaclock3: Add support for the 5L35023 variant Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 17/37] ASoC: renesas: rz-ssi: Use only the proper amount of dividers Claudiu
` (19 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 541011dc2d7c4c82523706f726f422a5e23cc86f upstream.
The stop trigger invokes rz_ssi_stop() and rz_ssi_stream_quit().
- The purpose of rz_ssi_stop() is to disable TX/RX, terminate DMA
transactions, and set the controller to idle.
- The purpose of rz_ssi_stream_quit() is to reset the substream-specific
software data by setting strm->running and strm->substream appropriately.
The function rz_ssi_is_stream_running() checks if both strm->substream and
strm->running are valid and returns true if so. Its implementation is as
follows:
static inline bool rz_ssi_is_stream_running(struct rz_ssi_stream *strm)
{
return strm->substream && strm->running;
}
When the controller is configured in full-duplex mode (with both playback
and capture active), the rz_ssi_stop() function does not modify the
controller settings when called for the first substream in the full-duplex
setup. Instead, it simply sets strm->running = 0 and returns if the
companion substream is still running. The following code illustrates this:
static int rz_ssi_stop(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
{
strm->running = 0;
if (rz_ssi_is_stream_running(&ssi->playback) ||
rz_ssi_is_stream_running(&ssi->capture))
return 0;
// ...
}
The controller settings, along with the DMA termination (for the last
stopped substream), are only applied when the last substream in the
full-duplex setup is stopped.
While applying the controller settings only when the last substream stops
is not problematic, terminating the DMA operations for only one substream
causes failures when starting and stopping full-duplex operations multiple
times in a loop.
To address this issue, call dmaengine_terminate_async() for both substreams
involved in the full-duplex setup when the last substream in the setup is
stopped.
Fixes: 4f8cd05a4305 ("ASoC: sh: rz-ssi: Add full duplex support")
Cc: stable@vger.kernel.org
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20241210170953.2936724-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index ce0233e8879d..a2cae68245a7 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -418,8 +418,12 @@ static int rz_ssi_stop(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
rz_ssi_reg_mask_setl(ssi, SSICR, SSICR_TEN | SSICR_REN, 0);
/* Cancel all remaining DMA transactions */
- if (rz_ssi_is_dma_enabled(ssi))
- dmaengine_terminate_async(strm->dma_ch);
+ if (rz_ssi_is_dma_enabled(ssi)) {
+ if (ssi->playback.dma_ch)
+ dmaengine_terminate_async(ssi->playback.dma_ch);
+ if (ssi->capture.dma_ch)
+ dmaengine_terminate_async(ssi->capture.dma_ch);
+ }
rz_ssi_set_idle(ssi);
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 17/37] ASoC: renesas: rz-ssi: Use only the proper amount of dividers
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (15 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 16/37] ASoC: renesas: rz-ssi: Terminate all the DMA transactions Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 18/37] ASoC: renesas: rz-ssi: Fix typo on SSI_RATES macro comment Claudiu
` (18 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 55c209cd4318c701e6e88e0b2512a0f12dd02a7d upstream.
There is no need to populate the ckdv[] with invalid dividers as that
part will not be indexed anyway. The ssi->audio_mck/bclk_rate should
always be >= 0. While at it, change the ckdv type as u8, as the divider
128 was previously using the s8 sign bit.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Fixes: 03e786bd43410fa9 ("ASoC: sh: Add RZ/G2L SSIF-2 driver")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20241210170953.2936724-6-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index a2cae68245a7..9b99a0318572 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -259,8 +259,7 @@ static void rz_ssi_stream_quit(struct rz_ssi_priv *ssi,
static int rz_ssi_clk_setup(struct rz_ssi_priv *ssi, unsigned int rate,
unsigned int channels)
{
- static s8 ckdv[16] = { 1, 2, 4, 8, 16, 32, 64, 128,
- 6, 12, 24, 48, 96, -1, -1, -1 };
+ static u8 ckdv[] = { 1, 2, 4, 8, 16, 32, 64, 128, 6, 12, 24, 48, 96 };
unsigned int channel_bits = 32; /* System Word Length */
unsigned long bclk_rate = rate * channels * channel_bits;
unsigned int div;
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 18/37] ASoC: renesas: rz-ssi: Fix typo on SSI_RATES macro comment
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (16 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 17/37] ASoC: renesas: rz-ssi: Use only the proper amount of dividers Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 19/37] ASoC: renesas: rz-ssi: Remove pdev member of struct rz_ssi_priv Claudiu
` (17 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 100c6b22d6c70adabdf45dcb346d7d853bff6a30 upstream.
The SSI_RATES macro covers 8KHz-48KHz audio frequencies. Update macro
comment to reflect it.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-7-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 9b99a0318572..5828d059262f 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -72,7 +72,7 @@
#define PREALLOC_BUFFER (SZ_32K)
#define PREALLOC_BUFFER_MAX (SZ_32K)
-#define SSI_RATES SNDRV_PCM_RATE_8000_48000 /* 8k-44.1kHz */
+#define SSI_RATES SNDRV_PCM_RATE_8000_48000 /* 8k-48kHz */
#define SSI_FMTS SNDRV_PCM_FMTBIT_S16_LE
#define SSI_CHAN_MIN 2
#define SSI_CHAN_MAX 2
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 19/37] ASoC: renesas: rz-ssi: Remove pdev member of struct rz_ssi_priv
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (17 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 18/37] ASoC: renesas: rz-ssi: Fix typo on SSI_RATES macro comment Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 20/37] ASoC: renesas: rz-ssi: Remove the first argument of rz_ssi_stream_is_play() Claudiu
` (16 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit a73710a25808a585a2bf0a8325eb16fd6a2f370c upstream.
Remove the pdev member of struct rz_ssi_priv as it is not used.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-8-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 5828d059262f..c1b729822747 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -100,7 +100,6 @@ struct rz_ssi_stream {
struct rz_ssi_priv {
void __iomem *base;
- struct platform_device *pdev;
struct reset_control *rstc;
struct device *dev;
struct clk *sfr_clk;
@@ -1045,7 +1044,6 @@ static int rz_ssi_probe(struct platform_device *pdev)
if (!ssi)
return -ENOMEM;
- ssi->pdev = pdev;
ssi->dev = &pdev->dev;
ssi->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(ssi->base))
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 20/37] ASoC: renesas: rz-ssi: Remove the first argument of rz_ssi_stream_is_play()
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (18 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 19/37] ASoC: renesas: rz-ssi: Remove pdev member of struct rz_ssi_priv Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 21/37] ASoC: renesas: rz-ssi: Use readl_poll_timeout_atomic() Claudiu
` (15 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 109e60866f11c7db8f720f01b0bda3105c47b463 upstream.
The first argument of the rz_ssi_stream_is_play() is not used. Remove it.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-10-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[claudiu.beznea: fixed conflict with rz_ssi_get_dai() by keeping it]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index c1b729822747..ff8c04d4c07f 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -171,8 +171,7 @@ rz_ssi_get_dai(struct snd_pcm_substream *substream)
return asoc_rtd_to_cpu(rtd, 0);
}
-static inline bool rz_ssi_stream_is_play(struct rz_ssi_priv *ssi,
- struct snd_pcm_substream *substream)
+static inline bool rz_ssi_stream_is_play(struct snd_pcm_substream *substream)
{
return substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
}
@@ -348,7 +347,7 @@ static void rz_ssi_set_idle(struct rz_ssi_priv *ssi)
static int rz_ssi_start(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
{
- bool is_play = rz_ssi_stream_is_play(ssi, strm->substream);
+ bool is_play = rz_ssi_stream_is_play(strm->substream);
bool is_full_duplex;
u32 ssicr, ssifcr;
@@ -685,7 +684,7 @@ static int rz_ssi_dma_transfer(struct rz_ssi_priv *ssi,
*/
return 0;
- dir = rz_ssi_stream_is_play(ssi, substream) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+ dir = rz_ssi_stream_is_play(substream) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
/* Always transfer 1 period */
amount = runtime->period_size;
@@ -811,7 +810,7 @@ static int rz_ssi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
if (ssi->dma_rt) {
bool is_playback;
- is_playback = rz_ssi_stream_is_play(ssi, substream);
+ is_playback = rz_ssi_stream_is_play(substream);
ret = rz_ssi_dma_slave_config(ssi, ssi->playback.dma_ch,
is_playback);
/* Fallback to pio */
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 21/37] ASoC: renesas: rz-ssi: Use readl_poll_timeout_atomic()
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (19 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 20/37] ASoC: renesas: rz-ssi: Remove the first argument of rz_ssi_stream_is_play() Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 22/37] ASoC: renesas: rz-ssi: Use temporary variable for struct device Claudiu
` (14 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 4bf77dfa3308b7cfda29d9c4ead1dc32f1ceefa9 upstream.
Use readl_poll_timeout_atomic() instead of hardcoding something similar.
While at it replace dev_info() with dev_warn_ratelimited() as the
rz_ssi_set_idle() can also be called from IRQ context and if the SSI
idle is not properly set this is at least a warning for user.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-11-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index ff8c04d4c07f..2b9e649d641f 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -9,6 +9,7 @@
#include <linux/clk.h>
#include <linux/dmaengine.h>
#include <linux/io.h>
+#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/pm_runtime.h>
@@ -317,7 +318,8 @@ static int rz_ssi_clk_setup(struct rz_ssi_priv *ssi, unsigned int rate,
static void rz_ssi_set_idle(struct rz_ssi_priv *ssi)
{
- int timeout;
+ u32 tmp;
+ int ret;
/* Disable irqs */
rz_ssi_reg_mask_setl(ssi, SSICR, SSICR_TUIEN | SSICR_TOIEN |
@@ -330,15 +332,9 @@ static void rz_ssi_set_idle(struct rz_ssi_priv *ssi)
SSISR_RUIRQ), 0);
/* Wait for idle */
- timeout = 100;
- while (--timeout) {
- if (rz_ssi_reg_readl(ssi, SSISR) & SSISR_IIRQ)
- break;
- udelay(1);
- }
-
- if (!timeout)
- dev_info(ssi->dev, "timeout waiting for SSI idle\n");
+ ret = readl_poll_timeout_atomic(ssi->base + SSISR, tmp, (tmp & SSISR_IIRQ), 1, 100);
+ if (ret)
+ dev_warn_ratelimited(ssi->dev, "timeout waiting for SSI idle\n");
/* Hold FIFOs in reset */
rz_ssi_reg_mask_setl(ssi, SSIFCR, 0,
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 22/37] ASoC: renesas: rz-ssi: Use temporary variable for struct device
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (20 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 21/37] ASoC: renesas: rz-ssi: Use readl_poll_timeout_atomic() Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 23/37] ASoC: renesas: rz-ssi: Use goto label names that specify their actions Claudiu
` (13 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 403366d2a43eb7c911c6cddf1d7882e429d1212d upstream.
Use a temporary variable for the struct device pointers to avoid
dereferencing.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-12-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[claudiu.beznea: fixed conflict by keeping the "irq request error
(dma_rt)" text from commit 403366d2a43eb7c911c6cddf1d7882e429d1212d]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 64 +++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 2b9e649d641f..64fa773f2ea2 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -1030,36 +1030,37 @@ static const struct snd_soc_component_driver rz_ssi_soc_component = {
static int rz_ssi_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct rz_ssi_priv *ssi;
struct clk *audio_clk;
struct resource *res;
int ret;
- ssi = devm_kzalloc(&pdev->dev, sizeof(*ssi), GFP_KERNEL);
+ ssi = devm_kzalloc(dev, sizeof(*ssi), GFP_KERNEL);
if (!ssi)
return -ENOMEM;
- ssi->dev = &pdev->dev;
+ ssi->dev = dev;
ssi->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(ssi->base))
return PTR_ERR(ssi->base);
ssi->phys = res->start;
- ssi->clk = devm_clk_get(&pdev->dev, "ssi");
+ ssi->clk = devm_clk_get(dev, "ssi");
if (IS_ERR(ssi->clk))
return PTR_ERR(ssi->clk);
- ssi->sfr_clk = devm_clk_get(&pdev->dev, "ssi_sfr");
+ ssi->sfr_clk = devm_clk_get(dev, "ssi_sfr");
if (IS_ERR(ssi->sfr_clk))
return PTR_ERR(ssi->sfr_clk);
- audio_clk = devm_clk_get(&pdev->dev, "audio_clk1");
+ audio_clk = devm_clk_get(dev, "audio_clk1");
if (IS_ERR(audio_clk))
return dev_err_probe(&pdev->dev, PTR_ERR(audio_clk),
"no audio clk1");
ssi->audio_clk_1 = clk_get_rate(audio_clk);
- audio_clk = devm_clk_get(&pdev->dev, "audio_clk2");
+ audio_clk = devm_clk_get(dev, "audio_clk2");
if (IS_ERR(audio_clk))
return dev_err_probe(&pdev->dev, PTR_ERR(audio_clk),
"no audio clk2");
@@ -1072,13 +1073,13 @@ static int rz_ssi_probe(struct platform_device *pdev)
ssi->audio_mck = ssi->audio_clk_1 ? ssi->audio_clk_1 : ssi->audio_clk_2;
/* Detect DMA support */
- ret = rz_ssi_dma_request(ssi, &pdev->dev);
+ ret = rz_ssi_dma_request(ssi, dev);
if (ret < 0) {
- dev_warn(&pdev->dev, "DMA not available, using PIO\n");
+ dev_warn(dev, "DMA not available, using PIO\n");
ssi->playback.transfer = rz_ssi_pio_send;
ssi->capture.transfer = rz_ssi_pio_recv;
} else {
- dev_info(&pdev->dev, "DMA enabled");
+ dev_info(dev, "DMA enabled");
ssi->playback.transfer = rz_ssi_dma_transfer;
ssi->capture.transfer = rz_ssi_dma_transfer;
}
@@ -1087,7 +1088,7 @@ static int rz_ssi_probe(struct platform_device *pdev)
ssi->capture.priv = ssi;
spin_lock_init(&ssi->lock);
- dev_set_drvdata(&pdev->dev, ssi);
+ dev_set_drvdata(dev, ssi);
/* Error Interrupt */
ssi->irq_int = platform_get_irq_byname(pdev, "int_req");
@@ -1096,12 +1097,11 @@ static int rz_ssi_probe(struct platform_device *pdev)
return ssi->irq_int;
}
- ret = devm_request_irq(&pdev->dev, ssi->irq_int, &rz_ssi_interrupt,
- 0, dev_name(&pdev->dev), ssi);
+ ret = devm_request_irq(dev, ssi->irq_int, &rz_ssi_interrupt,
+ 0, dev_name(dev), ssi);
if (ret < 0) {
rz_ssi_release_dma_channels(ssi);
- return dev_err_probe(&pdev->dev, ret,
- "irq request error (int_req)\n");
+ return dev_err_probe(dev, ret, "irq request error (int_req)\n");
}
if (!rz_ssi_is_dma_enabled(ssi)) {
@@ -1113,12 +1113,12 @@ static int rz_ssi_probe(struct platform_device *pdev)
if (ssi->irq_rt < 0)
return ssi->irq_rt;
- ret = devm_request_irq(&pdev->dev, ssi->irq_rt,
+ ret = devm_request_irq(dev, ssi->irq_rt,
&rz_ssi_interrupt, 0,
- dev_name(&pdev->dev), ssi);
+ dev_name(dev), ssi);
if (ret < 0)
- return dev_err_probe(&pdev->dev, ret,
- "irq request error (dma_tx)\n");
+ return dev_err_probe(dev, ret,
+ "irq request error (dma_rt)\n");
} else {
if (ssi->irq_tx < 0)
return ssi->irq_tx;
@@ -1126,50 +1126,50 @@ static int rz_ssi_probe(struct platform_device *pdev)
if (ssi->irq_rx < 0)
return ssi->irq_rx;
- ret = devm_request_irq(&pdev->dev, ssi->irq_tx,
+ ret = devm_request_irq(dev, ssi->irq_tx,
&rz_ssi_interrupt, 0,
- dev_name(&pdev->dev), ssi);
+ dev_name(dev), ssi);
if (ret < 0)
- return dev_err_probe(&pdev->dev, ret,
+ return dev_err_probe(dev, ret,
"irq request error (dma_tx)\n");
- ret = devm_request_irq(&pdev->dev, ssi->irq_rx,
+ ret = devm_request_irq(dev, ssi->irq_rx,
&rz_ssi_interrupt, 0,
- dev_name(&pdev->dev), ssi);
+ dev_name(dev), ssi);
if (ret < 0)
- return dev_err_probe(&pdev->dev, ret,
+ return dev_err_probe(dev, ret,
"irq request error (dma_rx)\n");
}
}
- ssi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
+ ssi->rstc = devm_reset_control_get_exclusive(dev, NULL);
if (IS_ERR(ssi->rstc)) {
ret = PTR_ERR(ssi->rstc);
goto err_reset;
}
reset_control_deassert(ssi->rstc);
- pm_runtime_enable(&pdev->dev);
- ret = pm_runtime_resume_and_get(&pdev->dev);
+ pm_runtime_enable(dev);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0) {
- dev_err(&pdev->dev, "pm_runtime_resume_and_get failed\n");
+ dev_err(dev, "pm_runtime_resume_and_get failed\n");
goto err_pm;
}
- ret = devm_snd_soc_register_component(&pdev->dev, &rz_ssi_soc_component,
+ ret = devm_snd_soc_register_component(dev, &rz_ssi_soc_component,
rz_ssi_soc_dai,
ARRAY_SIZE(rz_ssi_soc_dai));
if (ret < 0) {
- dev_err(&pdev->dev, "failed to register snd component\n");
+ dev_err(dev, "failed to register snd component\n");
goto err_snd_soc;
}
return 0;
err_snd_soc:
- pm_runtime_put(ssi->dev);
+ pm_runtime_put(dev);
err_pm:
- pm_runtime_disable(ssi->dev);
+ pm_runtime_disable(dev);
reset_control_assert(ssi->rstc);
err_reset:
rz_ssi_release_dma_channels(ssi);
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 23/37] ASoC: renesas: rz-ssi: Use goto label names that specify their actions
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (21 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 22/37] ASoC: renesas: rz-ssi: Use temporary variable for struct device Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 24/37] ASoC: renesas: rz-ssi: Rely on the ASoC subsystem to runtime resume/suspend the SSI Claudiu
` (12 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit f0c155c9da7536ab33687b5207eb21e704122a56 upstream.
Use goto label names that specify their action. In this way we can have
a better understanding of what is the action associated with the label
by just reading the label name.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-13-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 64fa773f2ea2..042ecd20006c 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -1093,15 +1093,15 @@ static int rz_ssi_probe(struct platform_device *pdev)
/* Error Interrupt */
ssi->irq_int = platform_get_irq_byname(pdev, "int_req");
if (ssi->irq_int < 0) {
- rz_ssi_release_dma_channels(ssi);
- return ssi->irq_int;
+ ret = ssi->irq_int;
+ goto err_release_dma_chs;
}
ret = devm_request_irq(dev, ssi->irq_int, &rz_ssi_interrupt,
0, dev_name(dev), ssi);
if (ret < 0) {
- rz_ssi_release_dma_channels(ssi);
- return dev_err_probe(dev, ret, "irq request error (int_req)\n");
+ dev_err_probe(dev, ret, "irq request error (int_req)\n");
+ goto err_release_dma_chs;
}
if (!rz_ssi_is_dma_enabled(ssi)) {
@@ -1145,7 +1145,7 @@ static int rz_ssi_probe(struct platform_device *pdev)
ssi->rstc = devm_reset_control_get_exclusive(dev, NULL);
if (IS_ERR(ssi->rstc)) {
ret = PTR_ERR(ssi->rstc);
- goto err_reset;
+ goto err_release_dma_chs;
}
reset_control_deassert(ssi->rstc);
@@ -1161,17 +1161,17 @@ static int rz_ssi_probe(struct platform_device *pdev)
ARRAY_SIZE(rz_ssi_soc_dai));
if (ret < 0) {
dev_err(dev, "failed to register snd component\n");
- goto err_snd_soc;
+ goto err_pm_put;
}
return 0;
-err_snd_soc:
+err_pm_put:
pm_runtime_put(dev);
err_pm:
pm_runtime_disable(dev);
reset_control_assert(ssi->rstc);
-err_reset:
+err_release_dma_chs:
rz_ssi_release_dma_channels(ssi);
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 24/37] ASoC: renesas: rz-ssi: Rely on the ASoC subsystem to runtime resume/suspend the SSI
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (22 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 23/37] ASoC: renesas: rz-ssi: Use goto label names that specify their actions Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 25/37] ASoC: renesas: rz-ssi: Enable runtime PM autosuspend support Claudiu
` (11 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit e8fcf25f562891d5c0734d4f49c44bb6aa72bc15 upstream.
The ASoC subsystem takes care of runtime resume/suspend the audio
devices when needed. Just enable the runtime PM on the SSI driver and
let the subsystem runtime resume/suspend it. While at it use directly
the devm_pm_runtime_enable().
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-14-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 042ecd20006c..64b1c47375e3 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -1149,11 +1149,10 @@ static int rz_ssi_probe(struct platform_device *pdev)
}
reset_control_deassert(ssi->rstc);
- pm_runtime_enable(dev);
- ret = pm_runtime_resume_and_get(dev);
+ ret = devm_pm_runtime_enable(dev);
if (ret < 0) {
- dev_err(dev, "pm_runtime_resume_and_get failed\n");
- goto err_pm;
+ dev_err(dev, "Failed to enable runtime PM!\n");
+ goto err_reset;
}
ret = devm_snd_soc_register_component(dev, &rz_ssi_soc_component,
@@ -1161,15 +1160,12 @@ static int rz_ssi_probe(struct platform_device *pdev)
ARRAY_SIZE(rz_ssi_soc_dai));
if (ret < 0) {
dev_err(dev, "failed to register snd component\n");
- goto err_pm_put;
+ goto err_reset;
}
return 0;
-err_pm_put:
- pm_runtime_put(dev);
-err_pm:
- pm_runtime_disable(dev);
+err_reset:
reset_control_assert(ssi->rstc);
err_release_dma_chs:
rz_ssi_release_dma_channels(ssi);
@@ -1183,8 +1179,6 @@ static int rz_ssi_remove(struct platform_device *pdev)
rz_ssi_release_dma_channels(ssi);
- pm_runtime_put(ssi->dev);
- pm_runtime_disable(ssi->dev);
reset_control_assert(ssi->rstc);
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 25/37] ASoC: renesas: rz-ssi: Enable runtime PM autosuspend support
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (23 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 24/37] ASoC: renesas: rz-ssi: Rely on the ASoC subsystem to runtime resume/suspend the SSI Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 26/37] ASoC: renesas: rz-ssi: Add runtime PM support Claudiu
` (10 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit cf3a79e4f826fc680fd7bfef7c427e2cc6023bc3 upstream.
Enable runtime PM autosuspend support. The chosen autosuspend delay is
zero for immediate autosuspend. In case there are users that need a
different autosuspend delay, it can be adjusted through sysfs.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-15-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 64b1c47375e3..507ba55b9b9c 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -1149,6 +1149,9 @@ static int rz_ssi_probe(struct platform_device *pdev)
}
reset_control_deassert(ssi->rstc);
+ /* Default 0 for power saving. Can be overridden via sysfs. */
+ pm_runtime_set_autosuspend_delay(dev, 0);
+ pm_runtime_use_autosuspend(dev);
ret = devm_pm_runtime_enable(dev);
if (ret < 0) {
dev_err(dev, "Failed to enable runtime PM!\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 26/37] ASoC: renesas: rz-ssi: Add runtime PM support
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (24 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 25/37] ASoC: renesas: rz-ssi: Enable runtime PM autosuspend support Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 27/37] ASoC: renesas: rz-ssi: Issue software reset in hw_params API Claudiu
` (9 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 3888672495fcaee98b90196c0a899b1c2eb57d5b upstream.
Add runtime PM support to the ssi driver. This assert/de-assert the
reset lines on runtime suspend/resume. Along with it the de-assertion of
the reset line from probe function was removed as it is not necessary
anymore.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-16-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[claudiu.beznea: use SET_RUNTIME_PM_OPS() as RUNTIME_PM_OPS() is not
available in v5.10]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 507ba55b9b9c..2e688889653a 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -1148,14 +1148,13 @@ static int rz_ssi_probe(struct platform_device *pdev)
goto err_release_dma_chs;
}
- reset_control_deassert(ssi->rstc);
/* Default 0 for power saving. Can be overridden via sysfs. */
pm_runtime_set_autosuspend_delay(dev, 0);
pm_runtime_use_autosuspend(dev);
ret = devm_pm_runtime_enable(dev);
if (ret < 0) {
dev_err(dev, "Failed to enable runtime PM!\n");
- goto err_reset;
+ goto err_release_dma_chs;
}
ret = devm_snd_soc_register_component(dev, &rz_ssi_soc_component,
@@ -1163,13 +1162,11 @@ static int rz_ssi_probe(struct platform_device *pdev)
ARRAY_SIZE(rz_ssi_soc_dai));
if (ret < 0) {
dev_err(dev, "failed to register snd component\n");
- goto err_reset;
+ goto err_release_dma_chs;
}
return 0;
-err_reset:
- reset_control_assert(ssi->rstc);
err_release_dma_chs:
rz_ssi_release_dma_channels(ssi);
@@ -1193,10 +1190,29 @@ static const struct of_device_id rz_ssi_of_match[] = {
};
MODULE_DEVICE_TABLE(of, rz_ssi_of_match);
+static int rz_ssi_runtime_suspend(struct device *dev)
+{
+ struct rz_ssi_priv *ssi = dev_get_drvdata(dev);
+
+ return reset_control_assert(ssi->rstc);
+}
+
+static int rz_ssi_runtime_resume(struct device *dev)
+{
+ struct rz_ssi_priv *ssi = dev_get_drvdata(dev);
+
+ return reset_control_deassert(ssi->rstc);
+}
+
+static const struct dev_pm_ops rz_ssi_pm_ops = {
+ SET_RUNTIME_PM_OPS(rz_ssi_runtime_suspend, rz_ssi_runtime_resume, NULL)
+};
+
static struct platform_driver rz_ssi_driver = {
.driver = {
.name = "rz-ssi-pcm-audio",
.of_match_table = rz_ssi_of_match,
+ .pm = pm_ptr(&rz_ssi_pm_ops),
},
.probe = rz_ssi_probe,
.remove = rz_ssi_remove,
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 27/37] ASoC: renesas: rz-ssi: Issue software reset in hw_params API
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (25 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 26/37] ASoC: renesas: rz-ssi: Add runtime PM support Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 28/37] ASoC: renesas: rz-ssi: Add suspend to RAM support Claudiu
` (8 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit fc2a31affb22394d1d74d3ecc86b5c68da33d52a upstream.
The code initially issued software reset on SNDRV_PCM_TRIGGER_START
action only before starting the first stream. This can be easily moved to
hw_params() as the action is similar to setting the clocks. Moreover,
according to the hardware manual (Table 35.7 Bits Initialized by Software
Reset of the SSIFCR.SSIRST Bit) the software reset action acts also on the
clock dividers bits. Due to this issue the software reset in hw_params()
before configuring the clock dividers. This also simplifies the code in
trigger API.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-17-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 2e688889653a..bc9e75b04dcc 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -399,6 +399,15 @@ static int rz_ssi_start(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
return 0;
}
+static int rz_ssi_swreset(struct rz_ssi_priv *ssi)
+{
+ u32 tmp;
+
+ rz_ssi_reg_mask_setl(ssi, SSIFCR, 0, SSIFCR_SSIRST);
+ rz_ssi_reg_mask_setl(ssi, SSIFCR, SSIFCR_SSIRST, 0);
+ return readl_poll_timeout_atomic(ssi->base + SSIFCR, tmp, !(tmp & SSIFCR_SSIRST), 1, 5);
+}
+
static int rz_ssi_stop(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
{
strm->running = 0;
@@ -793,14 +802,6 @@ static int rz_ssi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
- /* Soft Reset */
- if (!rz_ssi_is_stream_running(&ssi->playback) &&
- !rz_ssi_is_stream_running(&ssi->capture)) {
- rz_ssi_reg_mask_setl(ssi, SSIFCR, 0, SSIFCR_SSIRST);
- rz_ssi_reg_mask_setl(ssi, SSIFCR, SSIFCR_SSIRST, 0);
- udelay(5);
- }
-
rz_ssi_stream_init(strm, substream);
if (ssi->dma_rt) {
@@ -925,6 +926,7 @@ static int rz_ssi_dai_hw_params(struct snd_pcm_substream *substream,
SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min;
unsigned int channels = params_channels(params);
unsigned int rate = params_rate(params);
+ int ret;
if (sample_bits != 16) {
dev_err(ssi->dev, "Unsupported sample width: %d\n",
@@ -951,6 +953,10 @@ static int rz_ssi_dai_hw_params(struct snd_pcm_substream *substream,
rz_ssi_cache_hw_params(ssi, rate, channels, strm->sample_width,
sample_bits);
+ ret = rz_ssi_swreset(ssi);
+ if (ret)
+ return ret;
+
return rz_ssi_clk_setup(ssi, rate, channels);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 28/37] ASoC: renesas: rz-ssi: Add suspend to RAM support
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (26 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 27/37] ASoC: renesas: rz-ssi: Issue software reset in hw_params API Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 29/37] ASoC: renesas: rz-ssi: Use NOIRQ_SYSTEM_SLEEP_PM_OPS() Claudiu
` (7 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 1fc778f7c833aeb13041adc06f016f1a2dff7350 upstream.
The SSIF-2 IP is available on the Renesas RZ/G3S SoC. The Renesas RZ/G3S
SoC supports a power-saving mode where power to most of the SoC
components is turned off. Add suspend/resume support to the SSIF-2 driver
to support this power-saving mode.
On SNDRV_PCM_TRIGGER_SUSPEND trigger the SSI is stopped (the stream
user pointer is left untouched to avoid breaking user space and the dma
buffer pointer is set to zero), on SNDRV_PCM_TRIGGER_RESUME software reset
is issued for the SSIF-2 IP and the clocks are re-configured.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-18-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[claudiu.beznea: use SET_SYSTEM_SLEEP_PM_OPS() as
SYSTEM_SLEEP_PM_OPS() is not available in v5.10]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 46 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index bc9e75b04dcc..0f03739f920c 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -793,6 +793,32 @@ static int rz_ssi_dma_request(struct rz_ssi_priv *ssi, struct device *dev)
return -ENODEV;
}
+static int rz_ssi_trigger_resume(struct rz_ssi_priv *ssi)
+{
+ int ret;
+
+ if (rz_ssi_is_stream_running(&ssi->playback) ||
+ rz_ssi_is_stream_running(&ssi->capture))
+ return 0;
+
+ ret = rz_ssi_swreset(ssi);
+ if (ret)
+ return ret;
+
+ return rz_ssi_clk_setup(ssi, ssi->hw_params_cache.rate,
+ ssi->hw_params_cache.channels);
+}
+
+static void rz_ssi_streams_suspend(struct rz_ssi_priv *ssi)
+{
+ if (rz_ssi_is_stream_running(&ssi->playback) ||
+ rz_ssi_is_stream_running(&ssi->capture))
+ return;
+
+ ssi->playback.dma_buffer_pos = 0;
+ ssi->capture.dma_buffer_pos = 0;
+}
+
static int rz_ssi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
@@ -801,8 +827,16 @@ static int rz_ssi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
int ret = 0, i, num_transfer = 1;
switch (cmd) {
+ case SNDRV_PCM_TRIGGER_RESUME:
+ ret = rz_ssi_trigger_resume(ssi);
+ if (ret)
+ return ret;
+
+ fallthrough;
+
case SNDRV_PCM_TRIGGER_START:
- rz_ssi_stream_init(strm, substream);
+ if (cmd == SNDRV_PCM_TRIGGER_START)
+ rz_ssi_stream_init(strm, substream);
if (ssi->dma_rt) {
bool is_playback;
@@ -830,6 +864,12 @@ static int rz_ssi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
ret = rz_ssi_start(ssi, strm);
break;
+
+ case SNDRV_PCM_TRIGGER_SUSPEND:
+ rz_ssi_stop(ssi, strm);
+ rz_ssi_streams_suspend(ssi);
+ break;
+
case SNDRV_PCM_TRIGGER_STOP:
rz_ssi_stop(ssi, strm);
rz_ssi_stream_quit(ssi, strm);
@@ -969,7 +1009,8 @@ static const struct snd_soc_dai_ops rz_ssi_dai_ops = {
static const struct snd_pcm_hardware rz_ssi_pcm_hardware = {
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP |
- SNDRV_PCM_INFO_MMAP_VALID,
+ SNDRV_PCM_INFO_MMAP_VALID |
+ SNDRV_PCM_INFO_RESUME,
.buffer_bytes_max = PREALLOC_BUFFER,
.period_bytes_min = 32,
.period_bytes_max = 8192,
@@ -1212,6 +1253,7 @@ static int rz_ssi_runtime_resume(struct device *dev)
static const struct dev_pm_ops rz_ssi_pm_ops = {
SET_RUNTIME_PM_OPS(rz_ssi_runtime_suspend, rz_ssi_runtime_resume, NULL)
+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
};
static struct platform_driver rz_ssi_driver = {
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 29/37] ASoC: renesas: rz-ssi: Use NOIRQ_SYSTEM_SLEEP_PM_OPS()
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (27 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 28/37] ASoC: renesas: rz-ssi: Add suspend to RAM support Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 30/37] ASoC: dt-bindings: renesas,rz-ssi: Remove DMA description Claudiu
` (6 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit c1b0f5183a4488b6b7790f834ce3a786725b3583 upstream.
In the latest kernel versions system crashes were noticed occasionally
during suspend/resume. This occurs because the RZ SSI suspend trigger
(called from snd_soc_suspend()) is executed after rz_ssi_pm_ops->suspend()
and it accesses IP registers. After the rz_ssi_pm_ops->suspend() is
executed the IP clocks are disabled and its reset line is asserted.
Since snd_soc_suspend() is invoked through snd_soc_pm_ops->suspend(),
snd_soc_pm_ops is associated with soc_driver (defined in
sound/soc/soc-core.c), and there is no parent-child relationship between
soc_driver and rz_ssi_driver the power management subsystem does not
enforce a specific suspend/resume order between the RZ SSI platform driver
and soc_driver.
To ensure that the suspend/resume function of rz-ssi is executed after
snd_soc_suspend(), use NOIRQ_SYSTEM_SLEEP_PM_OPS().
Fixes: 1fc778f7c833 ("ASoC: renesas: rz-ssi: Add suspend to RAM support")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20250410141525.4126502-1-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[claudiu.beznea: use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() as
NOIRQ_SYSTEM_SLEEP_PM_OPS() is NA in v5.10]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 0f03739f920c..c431e67903f7 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -1253,7 +1253,7 @@ static int rz_ssi_runtime_resume(struct device *dev)
static const struct dev_pm_ops rz_ssi_pm_ops = {
SET_RUNTIME_PM_OPS(rz_ssi_runtime_suspend, rz_ssi_runtime_resume, NULL)
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
};
static struct platform_driver rz_ssi_driver = {
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 30/37] ASoC: dt-bindings: renesas,rz-ssi: Remove DMA description
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (28 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 29/37] ASoC: renesas: rz-ssi: Use NOIRQ_SYSTEM_SLEEP_PM_OPS() Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 31/37] ASoC: dt-bindings: renesas,rz-ssi: Document the Renesas RZ/G3S SoC Claudiu
` (5 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit c28dac5d3a6e87615d4c8e50f574c320172a3d55 upstream.
Remove the DMA description, as it duplicates content from
../dma/renesas,rz-dma.yaml. Additionally, remove the MID/RID examples
mentioned in the dropped description (this information is already
documented in the hardware manual).
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241210170953.2936724-19-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
.../bindings/sound/renesas,rz-ssi.yaml | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml b/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
index 2863b10ef12a..94e2e3abdaf0 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
+++ b/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
@@ -54,24 +54,6 @@ properties:
dmas:
minItems: 1
maxItems: 2
- description:
- The first cell represents a phandle to dmac.
- The second cell specifies the encoded MID/RID values of the SSI port
- connected to the DMA client and the slave channel configuration
- parameters.
- bits[0:9] - Specifies MID/RID value of a SSI channel as below
- MID/RID value of SSI rx0 = 0x256
- MID/RID value of SSI tx0 = 0x255
- MID/RID value of SSI rx1 = 0x25a
- MID/RID value of SSI tx1 = 0x259
- MID/RID value of SSI rt2 = 0x25f
- MID/RID value of SSI rx3 = 0x262
- MID/RID value of SSI tx3 = 0x261
- bit[10] - HIEN = 1, Detects a request in response to the rising edge
- of the signal
- bit[11] - LVL = 0, Detects based on the edge
- bits[12:14] - AM = 2, Bus cycle mode
- bit[15] - TM = 0, Single transfer mode
dma-names:
oneOf:
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 31/37] ASoC: dt-bindings: renesas,rz-ssi: Document the Renesas RZ/G3S SoC
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (29 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 30/37] ASoC: dt-bindings: renesas,rz-ssi: Remove DMA description Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 32/37] pinctrl: renesas: rzg2l: Add audio clock pins on RZ/G3S Claudiu
` (4 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 699a9733a354d74482ae4d4304acdbb0c0318a23 upstream.
The SSI IP variant present on the Renesas RZ/G3S SoC is similar to the
one found on the Renesas RZ/G2{UL, L, LC} SoCs. Add documentation for
it.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20241210170953.2936724-20-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml b/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
index 94e2e3abdaf0..fd1ba590e8d3 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
+++ b/Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml
@@ -16,6 +16,7 @@ properties:
- renesas,r9a07g043-ssi # RZ/G2UL
- renesas,r9a07g044-ssi # RZ/G2{L,LC}
- renesas,r9a07g054-ssi # RZ/V2L
+ - renesas,r9a08g045-ssi # RZ/G3S
- const: renesas,rz-ssi
reg:
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 32/37] pinctrl: renesas: rzg2l: Add audio clock pins on RZ/G3S
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (30 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 31/37] ASoC: dt-bindings: renesas,rz-ssi: Document the Renesas RZ/G3S SoC Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 33/37] arm64: dts: renesas: r9a08g045: Add SSI nodes Claudiu
` (3 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 03fc60cd8e7b7e6f330d0a48c54545740addd9d8 upstream.
Add audio clock pins on the RZ/G3S SoC. These are used by audio IPs as
input pins to feed them with audio clocks.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241113133540.2005850-6-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 4e95cf53d0cd..7e6ff6617c93 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -1803,6 +1803,8 @@ static const struct rzg2l_dedicated_configs rzg3s_dedicated_pins[] = {
{ "TMS/SWDIO", RZG2L_SINGLE_PIN_PACK(0x1, 0, (PIN_CFG_IOLH_A | PIN_CFG_IEN |
PIN_CFG_SOFT_PS)) },
{ "TDO", RZG2L_SINGLE_PIN_PACK(0x1, 1, (PIN_CFG_IOLH_A | PIN_CFG_SOFT_PS)) },
+ { "AUDIO_CLK1", RZG2L_SINGLE_PIN_PACK(0x2, 0, PIN_CFG_IEN) },
+ { "AUDIO_CLK2", RZG2L_SINGLE_PIN_PACK(0x2, 1, PIN_CFG_IEN) },
{ "WDTOVF_PERROUT#", RZG2L_SINGLE_PIN_PACK(0x6, 0, PIN_CFG_IOLH_A | PIN_CFG_SOFT_PS) },
{ "SD0_CLK", RZG2L_SINGLE_PIN_PACK(0x10, 0, (PIN_CFG_IOLH_B | PIN_CFG_IO_VMC_SD0)) },
{ "SD0_CMD", RZG2L_SINGLE_PIN_PACK(0x10, 1, (PIN_CFG_IOLH_B | PIN_CFG_IEN |
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 33/37] arm64: dts: renesas: r9a08g045: Add SSI nodes
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (31 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 32/37] pinctrl: renesas: rzg2l: Add audio clock pins on RZ/G3S Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 34/37] arm64: dts: renesas: rzg3s-smarc-som: Add versa3 clock generator node Claudiu
` (2 subsequent siblings)
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 880f6c84701cb7735d19f20db89e757086a8fcfa upstream.
Add DT nodes for the SSI IPs available on the Renesas RZ/G3S SoC. Along
with it external audio clocks were added. Board device tree could use it
and update the frequencies.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20241210170953.2936724-21-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 94 ++++++++++++++++++++++
1 file changed, 94 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi b/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
index 496394ca141c..7913820d88e7 100644
--- a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
@@ -14,6 +14,20 @@ / {
#address-cells = <2>;
#size-cells = <2>;
+ audio_clk1: audio1-clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ /* This value must be overridden by boards that provide it. */
+ clock-frequency = <0>;
+ };
+
+ audio_clk2: audio2-clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ /* This value must be overridden by boards that provide it. */
+ clock-frequency = <0>;
+ };
+
cpus {
#address-cells = <1>;
#size-cells = <0>;
@@ -187,6 +201,86 @@ i2c3: i2c@10090c00 {
status = "disabled";
};
+ ssi0: ssi@100a8000 {
+ compatible = "renesas,r9a08g045-ssi",
+ "renesas,rz-ssi";
+ reg = <0 0x100a8000 0 0x400>;
+ interrupts = <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 241 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 242 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "int_req", "dma_rx", "dma_tx";
+ clocks = <&cpg CPG_MOD R9A08G045_SSI0_PCLK2>,
+ <&cpg CPG_MOD R9A08G045_SSI0_PCLK_SFR>,
+ <&audio_clk1>, <&audio_clk2>;
+ clock-names = "ssi", "ssi_sfr", "audio_clk1", "audio_clk2";
+ resets = <&cpg R9A08G045_SSI0_RST_M2_REG>;
+ dmas = <&dmac 0x2665>, <&dmac 0x2666>;
+ dma-names = "tx", "rx";
+ power-domains = <&cpg>;
+ #sound-dai-cells = <0>;
+ status = "disabled";
+ };
+
+ ssi1: ssi@100a8400 {
+ compatible = "renesas,r9a08g045-ssi",
+ "renesas,rz-ssi";
+ reg = <0 0x100a8400 0 0x400>;
+ interrupts = <GIC_SPI 243 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 244 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 245 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "int_req", "dma_rx", "dma_tx";
+ clocks = <&cpg CPG_MOD R9A08G045_SSI1_PCLK2>,
+ <&cpg CPG_MOD R9A08G045_SSI1_PCLK_SFR>,
+ <&audio_clk1>, <&audio_clk2>;
+ clock-names = "ssi", "ssi_sfr", "audio_clk1", "audio_clk2";
+ resets = <&cpg R9A08G045_SSI1_RST_M2_REG>;
+ dmas = <&dmac 0x2669>, <&dmac 0x266a>;
+ dma-names = "tx", "rx";
+ power-domains = <&cpg>;
+ #sound-dai-cells = <0>;
+ status = "disabled";
+ };
+
+ ssi2: ssi@100a8800 {
+ compatible = "renesas,r9a08g045-ssi",
+ "renesas,rz-ssi";
+ reg = <0 0x100a8800 0 0x400>;
+ interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 247 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 248 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "int_req", "dma_rx", "dma_tx";
+ clocks = <&cpg CPG_MOD R9A08G045_SSI2_PCLK2>,
+ <&cpg CPG_MOD R9A08G045_SSI2_PCLK_SFR>,
+ <&audio_clk1>, <&audio_clk2>;
+ clock-names = "ssi", "ssi_sfr", "audio_clk1", "audio_clk2";
+ resets = <&cpg R9A08G045_SSI2_RST_M2_REG>;
+ dmas = <&dmac 0x266d>, <&dmac 0x266e>;
+ dma-names = "tx", "rx";
+ power-domains = <&cpg>;
+ #sound-dai-cells = <0>;
+ status = "disabled";
+ };
+
+ ssi3: ssi@100a8c00 {
+ compatible = "renesas,r9a08g045-ssi",
+ "renesas,rz-ssi";
+ reg = <0 0x100a8c00 0 0x400>;
+ interrupts = <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 250 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 251 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "int_req", "dma_rx", "dma_tx";
+ clocks = <&cpg CPG_MOD R9A08G045_SSI3_PCLK2>,
+ <&cpg CPG_MOD R9A08G045_SSI3_PCLK_SFR>,
+ <&audio_clk1>, <&audio_clk2>;
+ clock-names = "ssi", "ssi_sfr", "audio_clk1", "audio_clk2";
+ resets = <&cpg R9A08G045_SSI3_RST_M2_REG>;
+ dmas = <&dmac 0x2671>, <&dmac 0x2672>;
+ dma-names = "tx", "rx";
+ power-domains = <&cpg>;
+ #sound-dai-cells = <0>;
+ status = "disabled";
+ };
+
cpg: clock-controller@11010000 {
compatible = "renesas,r9a08g045-cpg";
reg = <0 0x11010000 0 0x10000>;
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH 5.10.y-cip 34/37] arm64: dts: renesas: rzg3s-smarc-som: Add versa3 clock generator node
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (32 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 33/37] arm64: dts: renesas: r9a08g045: Add SSI nodes Claudiu
@ 2025-05-09 9:34 ` Claudiu
2025-05-11 19:46 ` [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Pavel Machek
2025-05-12 16:08 ` Pavel Machek
35 siblings, 0 replies; 40+ messages in thread
From: Claudiu @ 2025-05-09 9:34 UTC (permalink / raw)
To: nobuhiro1.iwamatsu, pavel; +Cc: claudiu.beznea, cip-dev
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit a94253232b0454ae3f45e2a941bbc0a1d5bdb955 upstream.
Add versa3 clock generator node. It provides the clocks for the Ethernet
PHY, PCIe, audio devices.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/20241210170953.2936724-22-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
.../boot/dts/renesas/rzg3s-smarc-som.dtsi | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi
index 0f8efaeb163b..5f5c6b23a504 100644
--- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi
@@ -92,6 +92,12 @@ vcc_sdhi2: regulator2 {
gpios = <&pinctrl RZG2L_GPIO(8, 1) GPIO_ACTIVE_HIGH>;
enable-active-high;
};
+
+ x3_clk: x3-clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <24000000>;
+ };
};
#if SW_CONFIG3 == SW_ON
@@ -154,6 +160,30 @@ &extal_clk {
&i2c1 {
status = "okay";
+
+ versa3: clock-generator@68 {
+ compatible = "renesas,5l35023";
+ reg = <0x68>;
+ clocks = <&x3_clk>;
+ #clock-cells = <1>;
+ assigned-clocks = <&versa3 0>,
+ <&versa3 1>,
+ <&versa3 2>,
+ <&versa3 3>,
+ <&versa3 4>,
+ <&versa3 5>;
+ assigned-clock-rates = <24000000>,
+ <12288000>,
+ <11289600>,
+ <25000000>,
+ <100000000>,
+ <100000000>;
+ renesas,settings = [
+ 80 00 11 19 4c 42 dc 2f 06 7d 20 1a 5f 1e f2 27
+ 00 40 00 00 00 00 00 00 06 0c 19 02 3f f0 90 86
+ a0 80 30 30 9c
+ ];
+ };
};
#if SW_CONFIG2 == SW_ON
--
2.43.0
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (33 preceding siblings ...)
2025-05-09 9:34 ` [PATCH 5.10.y-cip 34/37] arm64: dts: renesas: rzg3s-smarc-som: Add versa3 clock generator node Claudiu
@ 2025-05-11 19:46 ` Pavel Machek
2025-05-12 16:08 ` Pavel Machek
35 siblings, 0 replies; 40+ messages in thread
From: Pavel Machek @ 2025-05-11 19:46 UTC (permalink / raw)
To: Claudiu; +Cc: nobuhiro1.iwamatsu, cip-dev
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
Hi!
> Series backports the Renesas RZ/G3S audio support to v5.10.y CIP.
I went through the patches, and it looks like I'll only have minor
comments. So I can apply this if it passes testing and there are no
other comments.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 5.10.y-cip 03/37] ASoC: da7213: Add new kcontrol for tonegen
2025-05-09 9:34 ` [PATCH 5.10.y-cip 03/37] ASoC: da7213: Add new kcontrol for tonegen Claudiu
@ 2025-05-12 8:01 ` Pavel Machek
2025-05-12 10:45 ` Claudiu Beznea
0 siblings, 1 reply; 40+ messages in thread
From: Pavel Machek @ 2025-05-12 8:01 UTC (permalink / raw)
To: Claudiu; +Cc: nobuhiro1.iwamatsu, cip-dev
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
Hi!
> From: David Rau <David.Rau.opensource@dm.renesas.com>
>
> commit 64c3259b5f86963c5214e63cfadedaa2278ba0ed upstream.
>
> Add new kcontrol for tone generator
DTMF in hardware? What are you using DTMF for these days? And is it
really useful to have special silicon and special code in driver to
accelerate it?
Like I mean... I'll take the patch, but it looks strange.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 5.10.y-cip 03/37] ASoC: da7213: Add new kcontrol for tonegen
2025-05-12 8:01 ` Pavel Machek
@ 2025-05-12 10:45 ` Claudiu Beznea
2025-05-12 11:44 ` Pavel Machek
0 siblings, 1 reply; 40+ messages in thread
From: Claudiu Beznea @ 2025-05-12 10:45 UTC (permalink / raw)
To: Pavel Machek; +Cc: nobuhiro1.iwamatsu, cip-dev
Hi, Pavel,
On 12.05.2025 11:01, Pavel Machek wrote:
> Hi!
>
>> From: David Rau <David.Rau.opensource@dm.renesas.com>
>>
>> commit 64c3259b5f86963c5214e63cfadedaa2278ba0ed upstream.
>>
>> Add new kcontrol for tone generator
>
> DTMF in hardware? What are you using DTMF for these days? And is it
> really useful to have special silicon and special code in driver to
> accelerate it?
We are currently don't use this with the RZ/G3S SoC. I've backported this
patch as it was needed to have the DA7213_TONE_GEN_OFF_PER macro used in
patch 05/37 "ASoC: da7213: Populate max_register to regmap_config".
Would you like me to try another approach 05/37? E.g. Use directly the
latest available offset for v5.10?
Thank you,
Claudiu
>
> Like I mean... I'll take the patch, but it looks strange.
>
> Best regards,
> Pavel
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 5.10.y-cip 03/37] ASoC: da7213: Add new kcontrol for tonegen
2025-05-12 10:45 ` Claudiu Beznea
@ 2025-05-12 11:44 ` Pavel Machek
0 siblings, 0 replies; 40+ messages in thread
From: Pavel Machek @ 2025-05-12 11:44 UTC (permalink / raw)
To: Claudiu Beznea; +Cc: nobuhiro1.iwamatsu, cip-dev
[-- Attachment #1: Type: text/plain, Size: 958 bytes --]
Hi!
> >> From: David Rau <David.Rau.opensource@dm.renesas.com>
> >>
> >> commit 64c3259b5f86963c5214e63cfadedaa2278ba0ed upstream.
> >>
> >> Add new kcontrol for tone generator
> >
> > DTMF in hardware? What are you using DTMF for these days? And is it
> > really useful to have special silicon and special code in driver to
> > accelerate it?
>
> We are currently don't use this with the RZ/G3S SoC. I've backported this
> patch as it was needed to have the DA7213_TONE_GEN_OFF_PER macro used in
> patch 05/37 "ASoC: da7213: Populate max_register to regmap_config".
>
> Would you like me to try another approach 05/37? E.g. Use directly the
> latest available offset for v5.10?
No, its okay as it is. I was just wondering how people uses DTMF in
2025.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
` (34 preceding siblings ...)
2025-05-11 19:46 ` [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Pavel Machek
@ 2025-05-12 16:08 ` Pavel Machek
35 siblings, 0 replies; 40+ messages in thread
From: Pavel Machek @ 2025-05-12 16:08 UTC (permalink / raw)
To: Claudiu; +Cc: nobuhiro1.iwamatsu, cip-dev
[-- Attachment #1: Type: text/plain, Size: 334 bytes --]
Hi!
> Series backports the Renesas RZ/G3S audio support to v5.10.y CIP.
Thank you, applied.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 40+ messages in thread
end of thread, other threads:[~2025-05-12 16:08 UTC | newest]
Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09 9:34 [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 01/37] ASoC: da7213: Add support for mono, set frame width to 32 when possible Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 02/37] ASoC: da7213.c: add missing pm_runtime_disable() Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 03/37] ASoC: da7213: Add new kcontrol for tonegen Claudiu
2025-05-12 8:01 ` Pavel Machek
2025-05-12 10:45 ` Claudiu Beznea
2025-05-12 11:44 ` Pavel Machek
2025-05-09 9:34 ` [PATCH 5.10.y-cip 04/37] ASoC: codecs: da7213: Simplify mclk initialization Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 05/37] ASoC: da7213: Populate max_register to regmap_config Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 06/37] ASoC: da7213: Return directly the value of regcache_sync() Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 07/37] ASoC: da7213: Add suspend to RAM support Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 08/37] ASoC: da7213: Avoid setting PLL when closing audio stream Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 09/37] ASoC: da7213: Extend support for the MCK in range [2, 50] MHz Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 10/37] ASoC: da7213: Initialize the mutex Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 11/37] arm64: defconfig: Enable DA7213 Codec Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 12/37] clk: renesas: r9a08g045: Add clocks, resets and power domains support for SSI Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 13/37] clk: versaclock3: Prepare for the addition of 5L35023 device Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 14/37] dt-bindings: clock: versaclock3: Document 5L35023 Versa3 clock generator Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 15/37] clk: versaclock3: Add support for the 5L35023 variant Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 16/37] ASoC: renesas: rz-ssi: Terminate all the DMA transactions Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 17/37] ASoC: renesas: rz-ssi: Use only the proper amount of dividers Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 18/37] ASoC: renesas: rz-ssi: Fix typo on SSI_RATES macro comment Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 19/37] ASoC: renesas: rz-ssi: Remove pdev member of struct rz_ssi_priv Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 20/37] ASoC: renesas: rz-ssi: Remove the first argument of rz_ssi_stream_is_play() Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 21/37] ASoC: renesas: rz-ssi: Use readl_poll_timeout_atomic() Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 22/37] ASoC: renesas: rz-ssi: Use temporary variable for struct device Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 23/37] ASoC: renesas: rz-ssi: Use goto label names that specify their actions Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 24/37] ASoC: renesas: rz-ssi: Rely on the ASoC subsystem to runtime resume/suspend the SSI Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 25/37] ASoC: renesas: rz-ssi: Enable runtime PM autosuspend support Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 26/37] ASoC: renesas: rz-ssi: Add runtime PM support Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 27/37] ASoC: renesas: rz-ssi: Issue software reset in hw_params API Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 28/37] ASoC: renesas: rz-ssi: Add suspend to RAM support Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 29/37] ASoC: renesas: rz-ssi: Use NOIRQ_SYSTEM_SLEEP_PM_OPS() Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 30/37] ASoC: dt-bindings: renesas,rz-ssi: Remove DMA description Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 31/37] ASoC: dt-bindings: renesas,rz-ssi: Document the Renesas RZ/G3S SoC Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 32/37] pinctrl: renesas: rzg2l: Add audio clock pins on RZ/G3S Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 33/37] arm64: dts: renesas: r9a08g045: Add SSI nodes Claudiu
2025-05-09 9:34 ` [PATCH 5.10.y-cip 34/37] arm64: dts: renesas: rzg3s-smarc-som: Add versa3 clock generator node Claudiu
2025-05-11 19:46 ` [PATCH 5.10.y-cip 00/37] RZ/G3S: Backport audio support Pavel Machek
2025-05-12 16:08 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox