Skip to content

Commit c7bf915

Browse files
saba-kareembroonie
authored andcommitted
ASoC: amd: acp: add i2s clock generation support for acp6.3 based platforms
Add I2S LRCLK & BCLK generation code for ACP6.3 based platforms. Signed-off-by: Syed Saba Kareem <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 40f74d5 commit c7bf915

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

sound/soc/amd/acp/acp-i2s.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@
2727
#define DRV_NAME "acp_i2s_playcap"
2828
#define I2S_MASTER_MODE_ENABLE 1
2929
#define I2S_MODE_ENABLE 0
30-
#define I2S_FORMAT_MODE GENMASK(1, 1)
3130
#define LRCLK_DIV_FIELD GENMASK(10, 2)
3231
#define BCLK_DIV_FIELD GENMASK(23, 11)
32+
#define ACP63_LRCLK_DIV_FIELD GENMASK(12, 2)
33+
#define ACP63_BCLK_DIV_FIELD GENMASK(23, 13)
3334

3435
static inline void acp_set_i2s_clk(struct acp_dev_data *adata, int dai_id)
3536
{
3637
u32 i2s_clk_reg, val;
38+
struct acp_chip_info *chip;
39+
struct device *dev;
3740

41+
dev = adata->dev;
42+
chip = dev_get_platdata(dev);
3843
switch (dai_id) {
3944
case I2S_SP_INSTANCE:
4045
i2s_clk_reg = ACP_I2STDM0_MSTRCLKGEN;
@@ -52,8 +57,16 @@ static inline void acp_set_i2s_clk(struct acp_dev_data *adata, int dai_id)
5257

5358
val = I2S_MASTER_MODE_ENABLE;
5459
val |= I2S_MODE_ENABLE & BIT(1);
55-
val |= FIELD_PREP(LRCLK_DIV_FIELD, adata->lrclk_div);
56-
val |= FIELD_PREP(BCLK_DIV_FIELD, adata->bclk_div);
60+
61+
switch (chip->acp_rev) {
62+
case ACP63_DEV:
63+
val |= FIELD_PREP(ACP63_LRCLK_DIV_FIELD, adata->lrclk_div);
64+
val |= FIELD_PREP(ACP63_BCLK_DIV_FIELD, adata->bclk_div);
65+
break;
66+
default:
67+
val |= FIELD_PREP(LRCLK_DIV_FIELD, adata->lrclk_div);
68+
val |= FIELD_PREP(BCLK_DIV_FIELD, adata->bclk_div);
69+
}
5770
writel(val, adata->acp_base + i2s_clk_reg);
5871
}
5972

0 commit comments

Comments
 (0)