Commit 00aaf8bf authored by Shuming Fan's avatar Shuming Fan Committed by Mark Brown

ASoC: rt1308-sdw: update the preset settings

This patch updates the pad control and checks the
hardware version to set the different preset settings.
Signed-off-by: default avatarShuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20221019095731.31101-1-shumingf@realtek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent af6514f2
......@@ -50,6 +50,7 @@ static bool rt1308_volatile_register(struct device *dev, unsigned int reg)
case 0x3008:
case 0x300a:
case 0xc000:
case 0xc710:
case 0xc860 ... 0xc863:
case 0xc870 ... 0xc873:
return true;
......@@ -200,6 +201,7 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
{
struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev);
int ret = 0;
unsigned int tmp;
if (rt1308->hw_init)
return 0;
......@@ -231,6 +233,10 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
/* sw reset */
regmap_write(rt1308->regmap, RT1308_SDW_RESET, 0);
regmap_read(rt1308->regmap, 0xc710, &tmp);
rt1308->hw_ver = tmp;
dev_dbg(dev, "%s, hw_ver=0x%x\n", __func__, rt1308->hw_ver);
/* initial settings */
regmap_write(rt1308->regmap, 0xc103, 0xc0);
regmap_write(rt1308->regmap, 0xc030, 0x17);
......@@ -246,8 +252,14 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
regmap_write(rt1308->regmap, 0xc062, 0x05);
regmap_write(rt1308->regmap, 0xc171, 0x07);
regmap_write(rt1308->regmap, 0xc173, 0x0d);
regmap_write(rt1308->regmap, 0xc311, 0x7f);
regmap_write(rt1308->regmap, 0xc900, 0x90);
if (rt1308->hw_ver == RT1308_VER_C) {
regmap_write(rt1308->regmap, 0xc311, 0x7f);
regmap_write(rt1308->regmap, 0xc300, 0x09);
} else {
regmap_write(rt1308->regmap, 0xc311, 0x4f);
regmap_write(rt1308->regmap, 0xc300, 0x0b);
}
regmap_write(rt1308->regmap, 0xc900, 0x5a);
regmap_write(rt1308->regmap, 0xc1a0, 0x84);
regmap_write(rt1308->regmap, 0xc1a1, 0x01);
regmap_write(rt1308->regmap, 0xc360, 0x78);
......@@ -257,7 +269,6 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
regmap_write(rt1308->regmap, 0xc070, 0x00);
regmap_write(rt1308->regmap, 0xc100, 0xd7);
regmap_write(rt1308->regmap, 0xc101, 0xd7);
regmap_write(rt1308->regmap, 0xc300, 0x09);
if (rt1308->first_hw_init) {
regcache_cache_bypass(rt1308->regmap, false);
......
......@@ -163,6 +163,7 @@ struct rt1308_sdw_priv {
bool first_hw_init;
int rx_mask;
int slots;
int hw_ver;
};
struct sdw_stream_data {
......
......@@ -286,4 +286,9 @@ enum {
RT1308_AIFS
};
enum rt1308_hw_ver {
RT1308_VER_C = 2,
RT1308_VER_D
};
#endif /* end of _RT1308_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment