mirror of
https://github.com/Fishwaldo/build.git
synced 2025-03-28 17:51:40 +00:00
There have been intermittent issues with SPDIF output on H3 & H2+ devices. Digging into the H2+ & H3 datasheets I encountered an important clue on table 8.7.2.2: s_clk needs to be 4x24.576 MHz or 4x22.5782 Mhz. Probably due to how SPDIF is a huge oversample of the audio frequency. Co-authored-by: George Lander <lander@jagmn.com>
57 lines
1.7 KiB
Diff
57 lines
1.7 KiB
Diff
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
|
|
index cbe598b0f..08f0ed3e9 100644
|
|
--- a/sound/soc/sunxi/sun4i-spdif.c
|
|
+++ b/sound/soc/sunxi/sun4i-spdif.c
|
|
@@ -175,6 +175,7 @@ struct sun4i_spdif_quirks {
|
|
unsigned int reg_dac_txdata;
|
|
bool has_reset;
|
|
unsigned int val_fctl_ftx;
|
|
+ unsigned int mclk_multiplier;
|
|
};
|
|
|
|
struct sun4i_spdif_dev {
|
|
@@ -311,6 +312,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,
|
|
default:
|
|
return -EINVAL;
|
|
}
|
|
+ mclk *= host->quirks->mclk_multiplier;
|
|
|
|
ret = clk_set_rate(host->spdif_clk, mclk);
|
|
if (ret < 0) {
|
|
@@ -345,6 +347,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,
|
|
default:
|
|
return -EINVAL;
|
|
}
|
|
+ mclk_div *= host->quirks->mclk_multiplier;
|
|
|
|
reg_val = 0;
|
|
reg_val |= SUN4I_SPDIF_TXCFG_ASS;
|
|
@@ -427,24 +430,28 @@ static struct snd_soc_dai_driver sun4i_spdif_dai = {
|
|
static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = {
|
|
.reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
|
|
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
|
+ .mclk_multiplier = 1,
|
|
};
|
|
|
|
static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = {
|
|
.reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
|
|
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
|
.has_reset = true,
|
|
+ .mclk_multiplier = 1,
|
|
};
|
|
|
|
static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = {
|
|
.reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
|
|
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
|
|
.has_reset = true,
|
|
+ .mclk_multiplier = 4,
|
|
};
|
|
|
|
static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = {
|
|
.reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
|
|
.val_fctl_ftx = SUN50I_H6_SPDIF_FCTL_FTX,
|
|
.has_reset = true,
|
|
+ .mclk_multiplier = 1,
|
|
};
|
|
|
|
static const struct of_device_id sun4i_spdif_of_match[] = {
|