Skip to content

Commit 76aed5e

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: mtk_dsi: Add registers to pdata to fix MT8186/MT8188
Registers DSI_VM_CMD and DSI_SHADOW_DEBUG start at different addresses in both MT8186 and MT8188 compared to the older IPs. Add two members in struct mtk_dsi_driver_data to specify the offsets for these two registers on a per-SoC basis, then do specify those in all of the currently present SoC driver data. This fixes writes to the Video Mode Command Packet Control register, fixing enablement of command packet transmission (VM_CMD_EN) and allowance of this transmission during the VFP period (TS_VFP_EN) on both MT8186 and MT8188. Fixes: 03d7adc ("drm/mediatek: Add mt8186 dsi compatible to mtk_dsi.c") Fixes: 814d534 ("drm/mediatek: Add mt8188 dsi compatible to mtk_dsi.c") Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: CK Hu <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 8fe3ee9 commit 76aed5e

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

drivers/gpu/drm/mediatek/mtk_dsi.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@
139139
#define CLK_HS_POST GENMASK(15, 8)
140140
#define CLK_HS_EXIT GENMASK(23, 16)
141141

142-
#define DSI_VM_CMD_CON 0x130
142+
/* DSI_VM_CMD_CON */
143143
#define VM_CMD_EN BIT(0)
144144
#define TS_VFP_EN BIT(5)
145145

146-
#define DSI_SHADOW_DEBUG 0x190U
146+
/* DSI_SHADOW_DEBUG */
147147
#define FORCE_COMMIT BIT(0)
148148
#define BYPASS_SHADOW BIT(1)
149149

@@ -187,6 +187,8 @@ struct phy;
187187

188188
struct mtk_dsi_driver_data {
189189
const u32 reg_cmdq_off;
190+
const u32 reg_vm_cmd_off;
191+
const u32 reg_shadow_dbg_off;
190192
bool has_shadow_ctl;
191193
bool has_size_ctl;
192194
bool cmdq_long_packet_ctl;
@@ -366,8 +368,8 @@ static void mtk_dsi_set_mode(struct mtk_dsi *dsi)
366368

367369
static void mtk_dsi_set_vm_cmd(struct mtk_dsi *dsi)
368370
{
369-
mtk_dsi_mask(dsi, DSI_VM_CMD_CON, VM_CMD_EN, VM_CMD_EN);
370-
mtk_dsi_mask(dsi, DSI_VM_CMD_CON, TS_VFP_EN, TS_VFP_EN);
371+
mtk_dsi_mask(dsi, dsi->driver_data->reg_vm_cmd_off, VM_CMD_EN, VM_CMD_EN);
372+
mtk_dsi_mask(dsi, dsi->driver_data->reg_vm_cmd_off, TS_VFP_EN, TS_VFP_EN);
371373
}
372374

373375
static void mtk_dsi_rxtx_control(struct mtk_dsi *dsi)
@@ -713,7 +715,7 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)
713715

714716
if (dsi->driver_data->has_shadow_ctl)
715717
writel(FORCE_COMMIT | BYPASS_SHADOW,
716-
dsi->regs + DSI_SHADOW_DEBUG);
718+
dsi->regs + dsi->driver_data->reg_shadow_dbg_off);
717719

718720
mtk_dsi_reset_engine(dsi);
719721
mtk_dsi_phy_timconfig(dsi);
@@ -1262,26 +1264,36 @@ static void mtk_dsi_remove(struct platform_device *pdev)
12621264

12631265
static const struct mtk_dsi_driver_data mt8173_dsi_driver_data = {
12641266
.reg_cmdq_off = 0x200,
1267+
.reg_vm_cmd_off = 0x130,
1268+
.reg_shadow_dbg_off = 0x190
12651269
};
12661270

12671271
static const struct mtk_dsi_driver_data mt2701_dsi_driver_data = {
12681272
.reg_cmdq_off = 0x180,
1273+
.reg_vm_cmd_off = 0x130,
1274+
.reg_shadow_dbg_off = 0x190
12691275
};
12701276

12711277
static const struct mtk_dsi_driver_data mt8183_dsi_driver_data = {
12721278
.reg_cmdq_off = 0x200,
1279+
.reg_vm_cmd_off = 0x130,
1280+
.reg_shadow_dbg_off = 0x190,
12731281
.has_shadow_ctl = true,
12741282
.has_size_ctl = true,
12751283
};
12761284

12771285
static const struct mtk_dsi_driver_data mt8186_dsi_driver_data = {
12781286
.reg_cmdq_off = 0xd00,
1287+
.reg_vm_cmd_off = 0x200,
1288+
.reg_shadow_dbg_off = 0xc00,
12791289
.has_shadow_ctl = true,
12801290
.has_size_ctl = true,
12811291
};
12821292

12831293
static const struct mtk_dsi_driver_data mt8188_dsi_driver_data = {
12841294
.reg_cmdq_off = 0xd00,
1295+
.reg_vm_cmd_off = 0x200,
1296+
.reg_shadow_dbg_off = 0xc00,
12851297
.has_shadow_ctl = true,
12861298
.has_size_ctl = true,
12871299
.cmdq_long_packet_ctl = true,

0 commit comments

Comments
 (0)