Commit d730af98 authored by Yongqiang Niu's avatar Yongqiang Niu Committed by CK Hu

drm/mediatek: add mutex mod register offset into ddp private data

mutex mod register offset will be private data of ddp.
Signed-off-by: default avatarYongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: default avatarCK Hu <ck.hu@mediatek.com>
parent 0d3a1202
...@@ -33,10 +33,12 @@ ...@@ -33,10 +33,12 @@
#define DISP_REG_CONFIG_DSI_SEL 0x050 #define DISP_REG_CONFIG_DSI_SEL 0x050
#define DISP_REG_CONFIG_DPI_SEL 0x064 #define DISP_REG_CONFIG_DPI_SEL 0x064
#define MT2701_DISP_MUTEX0_MOD0 0x2c
#define DISP_REG_MUTEX_EN(n) (0x20 + 0x20 * (n)) #define DISP_REG_MUTEX_EN(n) (0x20 + 0x20 * (n))
#define DISP_REG_MUTEX(n) (0x24 + 0x20 * (n)) #define DISP_REG_MUTEX(n) (0x24 + 0x20 * (n))
#define DISP_REG_MUTEX_RST(n) (0x28 + 0x20 * (n)) #define DISP_REG_MUTEX_RST(n) (0x28 + 0x20 * (n))
#define DISP_REG_MUTEX_MOD(n) (0x2c + 0x20 * (n)) #define DISP_REG_MUTEX_MOD(mutex_mod_reg, n) (mutex_mod_reg + 0x20 * (n))
#define DISP_REG_MUTEX_SOF(n) (0x30 + 0x20 * (n)) #define DISP_REG_MUTEX_SOF(n) (0x30 + 0x20 * (n))
#define DISP_REG_MUTEX_MOD2(n) (0x34 + 0x20 * (n)) #define DISP_REG_MUTEX_MOD2(n) (0x34 + 0x20 * (n))
...@@ -141,6 +143,7 @@ struct mtk_disp_mutex { ...@@ -141,6 +143,7 @@ struct mtk_disp_mutex {
struct mtk_ddp_data { struct mtk_ddp_data {
const unsigned int *mutex_mod; const unsigned int *mutex_mod;
const unsigned int mutex_mod_reg;
}; };
struct mtk_ddp { struct mtk_ddp {
...@@ -200,14 +203,17 @@ static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = { ...@@ -200,14 +203,17 @@ static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = {
static const struct mtk_ddp_data mt2701_ddp_driver_data = { static const struct mtk_ddp_data mt2701_ddp_driver_data = {
.mutex_mod = mt2701_mutex_mod, .mutex_mod = mt2701_mutex_mod,
.mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0,
}; };
static const struct mtk_ddp_data mt2712_ddp_driver_data = { static const struct mtk_ddp_data mt2712_ddp_driver_data = {
.mutex_mod = mt2712_mutex_mod, .mutex_mod = mt2712_mutex_mod,
.mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0,
}; };
static const struct mtk_ddp_data mt8173_ddp_driver_data = { static const struct mtk_ddp_data mt8173_ddp_driver_data = {
.mutex_mod = mt8173_mutex_mod, .mutex_mod = mt8173_mutex_mod,
.mutex_mod_reg = MT2701_DISP_MUTEX0_MOD0,
}; };
static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id cur, static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id cur,
...@@ -473,7 +479,8 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex, ...@@ -473,7 +479,8 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
break; break;
default: default:
if (ddp->data->mutex_mod[id] < 32) { if (ddp->data->mutex_mod[id] < 32) {
offset = DISP_REG_MUTEX_MOD(mutex->id); offset = DISP_REG_MUTEX_MOD(ddp->data->mutex_mod_reg,
mutex->id);
reg = readl_relaxed(ddp->regs + offset); reg = readl_relaxed(ddp->regs + offset);
reg |= 1 << ddp->data->mutex_mod[id]; reg |= 1 << ddp->data->mutex_mod[id];
writel_relaxed(reg, ddp->regs + offset); writel_relaxed(reg, ddp->regs + offset);
...@@ -511,7 +518,8 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex *mutex, ...@@ -511,7 +518,8 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex *mutex,
break; break;
default: default:
if (ddp->data->mutex_mod[id] < 32) { if (ddp->data->mutex_mod[id] < 32) {
offset = DISP_REG_MUTEX_MOD(mutex->id); offset = DISP_REG_MUTEX_MOD(ddp->data->mutex_mod_reg,
mutex->id);
reg = readl_relaxed(ddp->regs + offset); reg = readl_relaxed(ddp->regs + offset);
reg &= ~(1 << ddp->data->mutex_mod[id]); reg &= ~(1 << ddp->data->mutex_mod[id]);
writel_relaxed(reg, ddp->regs + offset); writel_relaxed(reg, ddp->regs + offset);
......
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