From 38adb70f3c7d3fc93ed6280b0d7c9fb5d86de411 Mon Sep 17 00:00:00 2001 From: Laxminath Kasam Date: Tue, 3 Nov 2020 19:00:03 +0530 Subject: [PATCH] soc: swr-mstr: Update default val of comp_cfg for PCM_OUT/IN dataport, update enable bit logic using default value based on SWR version. Change-Id: Ibfd342d9046834d074a12003f15e868c5336798c Signed-off-by: Laxminath Kasam --- soc/swr-mstr-ctrl.c | 9 ++++++--- soc/swr-mstr-ctrl.h | 1 + soc/swr-mstr-registers.h | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c index 098070febe..8f7d0bfa40 100644 --- a/soc/swr-mstr-ctrl.c +++ b/soc/swr-mstr-ctrl.c @@ -771,6 +771,7 @@ static int swrm_pcm_port_config(struct swr_mstr_ctrl *swrm, u8 port_num, bool dir, bool enable) { u16 reg_addr = 0; + u32 reg_val = SWRM_COMP_FEATURE_CFG_DEFAULT_VAL; if (!port_num || port_num > 6) { dev_err(swrm->dev, "%s: invalid port: %d\n", @@ -781,10 +782,12 @@ static int swrm_pcm_port_config(struct swr_mstr_ctrl *swrm, u8 port_num, SWRM_DOUT_DP_PCM_PORT_CTRL(port_num)); swr_master_write(swrm, reg_addr, enable); + if (swrm->version >= SWRM_VERSION_1_7) + reg_val = SWRM_COMP_FEATURE_CFG_DEFAULT_VAL_V1P7; + if (enable) - swr_master_write(swrm, SWRM_COMP_FEATURE_CFG, 0x1E); - else - swr_master_write(swrm, SWRM_COMP_FEATURE_CFG, 0x6); + reg_val |= SWRM_COMP_FEATURE_CFG_PCM_EN_MASK; + swr_master_write(swrm, SWRM_COMP_FEATURE_CFG, reg_val); return 0; } diff --git a/soc/swr-mstr-ctrl.h b/soc/swr-mstr-ctrl.h index 40223c4a3b..dd4c7a3227 100644 --- a/soc/swr-mstr-ctrl.h +++ b/soc/swr-mstr-ctrl.h @@ -40,6 +40,7 @@ #define SWRM_VERSION_1_5 0x01050000 #define SWRM_VERSION_1_5_1 0x01050001 #define SWRM_VERSION_1_6 0x01060000 +#define SWRM_VERSION_1_7 0x01070000 #define SWR_MAX_CH_PER_PORT 8 diff --git a/soc/swr-mstr-registers.h b/soc/swr-mstr-registers.h index 9cb0e5f638..6814fc68d4 100644 --- a/soc/swr-mstr-registers.h +++ b/soc/swr-mstr-registers.h @@ -111,4 +111,8 @@ #define SWRM_COMP_PARAMS_WR_FIFO_DEPTH 0x00007C00 #define SWRM_COMP_PARAMS_RD_FIFO_DEPTH 0x000F8000 + +#define SWRM_COMP_FEATURE_CFG_DEFAULT_VAL 0x06 +#define SWRM_COMP_FEATURE_CFG_DEFAULT_VAL_V1P7 0x406 +#define SWRM_COMP_FEATURE_CFG_PCM_EN_MASK 0x18 #endif /* _SWRM_REGISTERS_H */