Skip to content

Commit 0d3f01d

Browse files
jbrun3tbroonie
authored andcommitted
ASoC: meson: axg-tdm-formatters: fix sclk inversion
After carefully checking, it appears that both tdmout and tdmin require the rising edge of the sclk they get to be synchronized with the frame sync event (which should be a rising edge of lrclk). TDMIN was improperly set before this patch. Remove the sclk_invert quirk which is no longer needed and fix the sclk phase. Fixes: 1a11d88 ("ASoC: meson: add tdm formatter base driver") Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 80a2543 commit 0d3f01d

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
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-tdmin.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ 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
};
@@ -238,7 +237,6 @@ static const struct axg_tdm_formatter_driver g12a_tdmin_drv = {
238237
.regmap_cfg = &axg_tdmin_regmap_cfg,
239238
.ops = &axg_tdmin_ops,
240239
.quirks = &(const struct axg_tdm_formatter_hw) {
241-
.invert_sclk = false,
242240
.skew_offset = 3,
243241
},
244242
};

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)