Commit
The AIU audio controller on the Meson8 and Meson8b SoC families is compatible with the one found in the later GXBB family. Add compatible strings for these two older SoC families so the driver can be loaded for them. Instead of using the I2S divider from the AIU_CLK_CTRL_MORE register we need to use the I2S divider from the AIU_CLK_CTRL register. This older register is less flexible because it only supports four divider settings (1, 2, 4, 8) compared to the AIU_CLK_CTRL_MORE register (which supports dividers in the range 0..64). Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,7 @@ static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, | |
{ | ||
struct aiu *aiu = snd_soc_component_get_drvdata(component); | ||
unsigned int srate = params_rate(params); | ||
u8 i2s_div, more_i2s_div; | ||
unsigned int fs, bs; | ||
|
||
/* Get the oversampling factor */ | ||
|
@@ -135,10 +136,6 @@ static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, | |
FIELD_PREP(AIU_CODEC_DAC_LRCLK_CTRL_DIV, | ||
64 - 1)); | ||
|
||
/* Use CLK_MORE for mclk to bclk divider */ | ||
snd_soc_component_update_bits(component, AIU_CLK_CTRL, | ||
AIU_CLK_CTRL_I2S_DIV, 0); | ||
|
||
/* | ||
* NOTE: this HW is odd. | ||
* In most configuration, the i2s divider is 'mclk / blck'. | ||
|
@@ -156,10 +153,24 @@ static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, | |
bs += bs / 2; | ||
} | ||
|
||
if (aiu->platform->has_clk_ctrl_more_i2s_div) { | ||
/* Use CLK_MORE for mclk to bclk divider */ | ||
i2s_div = 0; | ||
more_i2s_div = bs - 1; | ||
} else { | ||
i2s_div = __ffs(bs); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
more_i2s_div = 0; | ||
} | ||
|
||
snd_soc_component_update_bits(component, AIU_CLK_CTRL, | ||
AIU_CLK_CTRL_I2S_DIV, | ||
FIELD_PREP(AIU_CLK_CTRL_I2S_DIV, | ||
i2s_div)); | ||
|
||
snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, | ||
This comment has been minimized.
Sorry, something went wrong.
jeromebrunet
|
||
AIU_CLK_CTRL_MORE_I2S_DIV, | ||
FIELD_PREP(AIU_CLK_CTRL_MORE_I2S_DIV, | ||
bs - 1)); | ||
more_i2s_div)); | ||
|
||
/* Make sure amclk is used for HDMI i2s as well */ | ||
snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -371,15 +371,24 @@ static int aiu_remove(struct platform_device *pdev) | |
|
||
static const struct aiu_platform_data aiu_gxbb_pdata = { | ||
.has_acodec = false, | ||
.has_clk_ctrl_more_i2s_div = true, | ||
}; | ||
|
||
static const struct aiu_platform_data aiu_gxl_pdata = { | ||
.has_acodec = true, | ||
.has_clk_ctrl_more_i2s_div = true, | ||
}; | ||
|
||
static const struct aiu_platform_data aiu_meson8_pdata = { | ||
.has_acodec = false, | ||
.has_clk_ctrl_more_i2s_div = false, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
xdarklight
Author
Owner
|
||
}; | ||
|
||
static const struct of_device_id aiu_of_match[] = { | ||
{ .compatible = "amlogic,aiu-gxbb", .data = &aiu_gxbb_pdata }, | ||
{ .compatible = "amlogic,aiu-gxl", .data = &aiu_gxl_pdata }, | ||
{ .compatible = "amlogic,aiu-meson8", .data = &aiu_meson8_pdata }, | ||
{ .compatible = "amlogic,aiu-meson8b", .data = &aiu_meson8_pdata }, | ||
{} | ||
}; | ||
MODULE_DEVICE_TABLE(of, aiu_of_match); | ||
|
I wonder if we should check that calculation is correct ? IOW (out of range, remainder?)