Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: dwc: add quirk for different register offset

DWC in ACP 2.x IP has different offsets for I2S_COMP_PARAM_* registers.
Added a quirk to support the same.

Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Maruthi Srinivas Bayyavarapu and committed by
Mark Brown
e164835a f4830312

+19 -3
+5
include/sound/designware_i2s.h
··· 45 45 u32 snd_fmts; 46 46 u32 snd_rates; 47 47 48 + #define DW_I2S_QUIRK_COMP_REG_OFFSET (1 << 0) 49 + unsigned int quirks; 50 + unsigned int i2s_reg_comp1; 51 + unsigned int i2s_reg_comp2; 52 + 48 53 void *play_dma_data; 49 54 void *capture_dma_data; 50 55 bool (*filter)(struct dma_chan *chan, void *slave);
+14 -3
sound/soc/dwc/designware_i2s.c
··· 94 94 struct clk *clk; 95 95 int active; 96 96 unsigned int capability; 97 + unsigned int quirks; 98 + unsigned int i2s_reg_comp1; 99 + unsigned int i2s_reg_comp2; 97 100 struct device *dev; 98 101 99 102 /* data related to DMA transfers b/w i2s and DMAC */ ··· 480 477 * Read component parameter registers to extract 481 478 * the I2S block's configuration. 482 479 */ 483 - u32 comp1 = i2s_read_reg(dev->i2s_base, I2S_COMP_PARAM_1); 484 - u32 comp2 = i2s_read_reg(dev->i2s_base, I2S_COMP_PARAM_2); 480 + u32 comp1 = i2s_read_reg(dev->i2s_base, dev->i2s_reg_comp1); 481 + u32 comp2 = i2s_read_reg(dev->i2s_base, dev->i2s_reg_comp2); 485 482 u32 idx; 486 483 487 484 if (COMP1_TX_ENABLED(comp1)) { ··· 524 521 struct resource *res, 525 522 const struct i2s_platform_data *pdata) 526 523 { 527 - u32 comp1 = i2s_read_reg(dev->i2s_base, I2S_COMP_PARAM_1); 524 + u32 comp1 = i2s_read_reg(dev->i2s_base, dev->i2s_reg_comp1); 528 525 u32 idx = COMP1_APB_DATA_WIDTH(comp1); 529 526 int ret; 530 527 ··· 628 625 if (pdata) { 629 626 dev->capability = pdata->cap; 630 627 clk_id = NULL; 628 + dev->quirks = pdata->quirks; 629 + if (dev->quirks & DW_I2S_QUIRK_COMP_REG_OFFSET) { 630 + dev->i2s_reg_comp1 = pdata->i2s_reg_comp1; 631 + dev->i2s_reg_comp2 = pdata->i2s_reg_comp2; 632 + } else { 633 + dev->i2s_reg_comp1 = I2S_COMP_PARAM_1; 634 + dev->i2s_reg_comp2 = I2S_COMP_PARAM_2; 635 + } 631 636 ret = dw_configure_dai_by_pd(dev, dw_i2s_dai, res, pdata); 632 637 } else { 633 638 clk_id = "i2sclk";