Skip to content

Commit 20196e0

Browse files
committed
Merge series "ASoC: meson: tdm fixes" from Jerome Brunet <[email protected]>:
This patcheset is collection of fixes for the TDM input and output the axg audio architecture. Its fixes: - slave mode format setting - g12 and sm1 skew offset - tdm clock inversion - standard daifmt props names which don't require a specific prefix Jerome Brunet (4): ASoC: meson: axg-tdm-interface: fix link fmt setup ASoC: meson: axg-tdmin: fix g12a skew ASoC: meson: axg-tdm-formatters: fix sclk inversion ASoC: meson: cards: remove DT_PREFIX for standard daifmt properties sound/soc/meson/axg-tdm-formatter.c | 11 ++++++----- sound/soc/meson/axg-tdm-formatter.h | 1 - sound/soc/meson/axg-tdm-interface.c | 26 +++++++++++++++++--------- sound/soc/meson/axg-tdmin.c | 16 +++++++++++++++- sound/soc/meson/axg-tdmout.c | 3 --- sound/soc/meson/meson-card-utils.c | 2 +- 6 files changed, 39 insertions(+), 20 deletions(-) -- 2.25.4
2 parents 5c74c9d + 0d3f01d commit 20196e0

File tree

5 files changed

+38
-19
lines changed

5 files changed

+38
-19
lines changed

sound/soc/meson/axg-tdm-formatter.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks);
7070
static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter)
7171
{
7272
struct axg_tdm_stream *ts = formatter->stream;
73-
bool invert = formatter->drv->quirks->invert_sclk;
73+
bool invert;
7474
int ret;
7575

7676
/* Do nothing if the formatter is already enabled */
@@ -96,11 +96,12 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter)
9696
return ret;
9797

9898
/*
99-
* If sclk is inverted, invert it back and provide the inversion
100-
* required by the formatter
99+
* If sclk is inverted, it means the bit should latched on the
100+
* rising edge which is what our HW expects. If not, we need to
101+
* invert it before the formatter.
101102
*/
102-
invert ^= axg_tdm_sclk_invert(ts->iface->fmt);
103-
ret = clk_set_phase(formatter->sclk, invert ? 180 : 0);
103+
invert = axg_tdm_sclk_invert(ts->iface->fmt);
104+
ret = clk_set_phase(formatter->sclk, invert ? 0 : 180);
104105
if (ret)
105106
return ret;
106107

sound/soc/meson/axg-tdm-formatter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ struct snd_kcontrol;
1616

1717
struct axg_tdm_formatter_hw {
1818
unsigned int skew_offset;
19-
bool invert_sclk;
2019
};
2120

2221
struct axg_tdm_formatter_ops {

sound/soc/meson/axg-tdm-interface.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,25 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
119119
{
120120
struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai);
121121

122-
/* These modes are not supported */
123-
if (fmt & (SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_CBM_CFS)) {
122+
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
123+
case SND_SOC_DAIFMT_CBS_CFS:
124+
if (!iface->mclk) {
125+
dev_err(dai->dev, "cpu clock master: mclk missing\n");
126+
return -ENODEV;
127+
}
128+
break;
129+
130+
case SND_SOC_DAIFMT_CBM_CFM:
131+
break;
132+
133+
case SND_SOC_DAIFMT_CBS_CFM:
134+
case SND_SOC_DAIFMT_CBM_CFS:
124135
dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n");
136+
/* Fall-through */
137+
default:
125138
return -EINVAL;
126139
}
127140

128-
/* If the TDM interface is the clock master, it requires mclk */
129-
if (!iface->mclk && (fmt & SND_SOC_DAIFMT_CBS_CFS)) {
130-
dev_err(dai->dev, "cpu clock master: mclk missing\n");
131-
return -ENODEV;
132-
}
133-
134141
iface->fmt = fmt;
135142
return 0;
136143
}
@@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream,
319326
if (ret)
320327
return ret;
321328

322-
if (iface->fmt & SND_SOC_DAIFMT_CBS_CFS) {
329+
if ((iface->fmt & SND_SOC_DAIFMT_MASTER_MASK) ==
330+
SND_SOC_DAIFMT_CBS_CFS) {
323331
ret = axg_tdm_iface_set_sclk(dai, params);
324332
if (ret)
325333
return ret;

sound/soc/meson/axg-tdmin.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,29 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = {
228228
.regmap_cfg = &axg_tdmin_regmap_cfg,
229229
.ops = &axg_tdmin_ops,
230230
.quirks = &(const struct axg_tdm_formatter_hw) {
231-
.invert_sclk = false,
232231
.skew_offset = 2,
233232
},
234233
};
235234

235+
static const struct axg_tdm_formatter_driver g12a_tdmin_drv = {
236+
.component_drv = &axg_tdmin_component_drv,
237+
.regmap_cfg = &axg_tdmin_regmap_cfg,
238+
.ops = &axg_tdmin_ops,
239+
.quirks = &(const struct axg_tdm_formatter_hw) {
240+
.skew_offset = 3,
241+
},
242+
};
243+
236244
static const struct of_device_id axg_tdmin_of_match[] = {
237245
{
238246
.compatible = "amlogic,axg-tdmin",
239247
.data = &axg_tdmin_drv,
248+
}, {
249+
.compatible = "amlogic,g12a-tdmin",
250+
.data = &g12a_tdmin_drv,
251+
}, {
252+
.compatible = "amlogic,sm1-tdmin",
253+
.data = &g12a_tdmin_drv,
240254
}, {}
241255
};
242256
MODULE_DEVICE_TABLE(of, axg_tdmin_of_match);

sound/soc/meson/axg-tdmout.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = {
238238
.regmap_cfg = &axg_tdmout_regmap_cfg,
239239
.ops = &axg_tdmout_ops,
240240
.quirks = &(const struct axg_tdm_formatter_hw) {
241-
.invert_sclk = true,
242241
.skew_offset = 1,
243242
},
244243
};
@@ -248,7 +247,6 @@ static const struct axg_tdm_formatter_driver g12a_tdmout_drv = {
248247
.regmap_cfg = &axg_tdmout_regmap_cfg,
249248
.ops = &axg_tdmout_ops,
250249
.quirks = &(const struct axg_tdm_formatter_hw) {
251-
.invert_sclk = true,
252250
.skew_offset = 2,
253251
},
254252
};
@@ -309,7 +307,6 @@ static const struct axg_tdm_formatter_driver sm1_tdmout_drv = {
309307
.regmap_cfg = &axg_tdmout_regmap_cfg,
310308
.ops = &axg_tdmout_ops,
311309
.quirks = &(const struct axg_tdm_formatter_hw) {
312-
.invert_sclk = true,
313310
.skew_offset = 2,
314311
},
315312
};

0 commit comments

Comments
 (0)