From 142bb24d7c1a9035f5f0c7a8089030a27124a050 Mon Sep 17 00:00:00 2001 From: Vara Reddy Date: Tue, 9 Feb 2021 18:23:43 -0800 Subject: [PATCH] disp: msm: dsi: add support to send commands to each sublink Change adds support for transferring commands to each sublink. Change-Id: Iefc0dca7343325cdfe0cf48d41d50e6e2a13bc05 Signed-off-by: Vara Reddy --- msm/dsi/dsi_catalog.c | 3 +++ msm/dsi/dsi_catalog.h | 2 ++ msm/dsi/dsi_ctrl.c | 3 +++ msm/dsi/dsi_ctrl.h | 4 ++++ msm/dsi/dsi_ctrl_hw.h | 9 +++++++++ msm/dsi/dsi_ctrl_hw_2_2.c | 27 ++++++++++++++++++++++++++- 6 files changed, 47 insertions(+), 1 deletion(-) diff --git a/msm/dsi/dsi_catalog.c b/msm/dsi/dsi_catalog.c index 1499566f2b..37a790cc65 100644 --- a/msm/dsi/dsi_catalog.c +++ b/msm/dsi/dsi_catalog.c @@ -84,6 +84,7 @@ static void dsi_catalog_cmn_init(struct dsi_ctrl_hw *ctrl, ctrl->ops.configure_cmddma_window = NULL; ctrl->ops.reset_trig_ctrl = NULL; ctrl->ops.log_line_count = NULL; + ctrl->ops.splitlink_cmd_setup = NULL; break; case DSI_CTRL_VERSION_2_0: ctrl->ops.setup_lane_map = dsi_ctrl_hw_20_setup_lane_map; @@ -102,6 +103,7 @@ static void dsi_catalog_cmn_init(struct dsi_ctrl_hw *ctrl, ctrl->ops.configure_cmddma_window = NULL; ctrl->ops.reset_trig_ctrl = NULL; ctrl->ops.log_line_count = NULL; + ctrl->ops.splitlink_cmd_setup = NULL; break; case DSI_CTRL_VERSION_2_2: case DSI_CTRL_VERSION_2_3: @@ -129,6 +131,7 @@ static void dsi_catalog_cmn_init(struct dsi_ctrl_hw *ctrl, ctrl->ops.reset_trig_ctrl = dsi_ctrl_hw_22_reset_trigger_controls; ctrl->ops.log_line_count = dsi_ctrl_hw_22_log_line_count; + ctrl->ops.splitlink_cmd_setup = dsi_ctrl_hw_22_configure_splitlink; break; default: break; diff --git a/msm/dsi/dsi_catalog.h b/msm/dsi/dsi_catalog.h index f76aae181e..7ca0dac0b2 100644 --- a/msm/dsi/dsi_catalog.h +++ b/msm/dsi/dsi_catalog.h @@ -290,4 +290,6 @@ int dsi_catalog_phy_pll_setup(struct dsi_phy_hw *phy, u32 pll_ver); int dsi_pll_5nm_configure(void *pll, bool commit); int dsi_pll_5nm_toggle(void *pll, bool prepare); +void dsi_ctrl_hw_22_configure_splitlink(struct dsi_ctrl_hw *ctrl, + struct dsi_host_common_cfg *common_cfg, u32 sublink); #endif /* _DSI_CATALOG_H_ */ diff --git a/msm/dsi/dsi_ctrl.c b/msm/dsi/dsi_ctrl.c index 2121cbe7cc..7552ed9217 100644 --- a/msm/dsi/dsi_ctrl.c +++ b/msm/dsi/dsi_ctrl.c @@ -1360,6 +1360,9 @@ static void dsi_kickoff_msg_tx(struct dsi_ctrl *dsi_ctrl, { u32 hw_flags = 0; struct dsi_ctrl_hw_ops dsi_hw_ops = dsi_ctrl->hw.ops; + struct dsi_split_link_config *split_link; + + split_link = &(dsi_ctrl->host_config.common_config.split_link); SDE_EVT32(dsi_ctrl->cell_index, SDE_EVTLOG_FUNC_ENTRY, flags, msg->flags); diff --git a/msm/dsi/dsi_ctrl.h b/msm/dsi/dsi_ctrl.h index e9d3fa5fdb..52a99e7a55 100644 --- a/msm/dsi/dsi_ctrl.h +++ b/msm/dsi/dsi_ctrl.h @@ -33,6 +33,8 @@ * display panel dtsi file instead of default. * @DSI_CTRL_CMD_ASYNC_WAIT: Command flag to indicate that the wait for done * for this command is asynchronous and must be queued. + * @DSI_CTRL_CMD_SUBLINK0: Send the command in splitlink sublink0 only. + * @DSI_CTRL_CMD_SUBLINK1: Send the command in splitlink sublink1 only. */ #define DSI_CTRL_CMD_READ 0x1 #define DSI_CTRL_CMD_BROADCAST 0x2 @@ -44,6 +46,8 @@ #define DSI_CTRL_CMD_NON_EMBEDDED_MODE 0x80 #define DSI_CTRL_CMD_CUSTOM_DMA_SCHED 0x100 #define DSI_CTRL_CMD_ASYNC_WAIT 0x200 +#define DSI_CTRL_CMD_SUBLINK0 0x400 +#define DSI_CTRL_CMD_SUBLINK1 0x800 /* DSI embedded mode fifo size * If the command is greater than 256 bytes it is sent in non-embedded mode. diff --git a/msm/dsi/dsi_ctrl_hw.h b/msm/dsi/dsi_ctrl_hw.h index 92689496fb..a1a7cf1bc9 100644 --- a/msm/dsi/dsi_ctrl_hw.h +++ b/msm/dsi/dsi_ctrl_hw.h @@ -869,6 +869,15 @@ struct dsi_ctrl_hw_ops { * @cmd_mode: Boolean to indicate command mode operation. */ u32 (*log_line_count)(struct dsi_ctrl_hw *ctrl, bool cmd_mode); + + /** + * hw.ops.splitlink_cmd_setup() - configure the sublink to transfer + * @ctrl: Pointer to the controller host hardware. + * @common_cfg: Common configuration parameters. + * @sublink: Which sublink to transfer the command. + */ + void (*splitlink_cmd_setup)(struct dsi_ctrl_hw *ctrl, + struct dsi_host_common_cfg *common_cfg, u32 sublink); }; /* diff --git a/msm/dsi/dsi_ctrl_hw_2_2.c b/msm/dsi/dsi_ctrl_hw_2_2.c index 5ae0929e09..0a9d8e845d 100644 --- a/msm/dsi/dsi_ctrl_hw_2_2.c +++ b/msm/dsi/dsi_ctrl_hw_2_2.c @@ -1,11 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #include #include "dsi_ctrl_hw.h" #include "dsi_ctrl_reg.h" #include "dsi_hw.h" +#include "dsi_ctrl.h" #include "dsi_catalog.h" #define DISP_CC_MISC_CMD_REG_OFF 0x00 @@ -280,3 +281,27 @@ u32 dsi_ctrl_hw_22_log_line_count(struct dsi_ctrl_hw *ctrl, bool cmd_mode) + MDP_INTF_LINE_COUNT_OFFSET); return reg; } + +void dsi_ctrl_hw_22_configure_splitlink(struct dsi_ctrl_hw *ctrl, + struct dsi_host_common_cfg *common_cfg, u32 flags) +{ + u32 reg = 0; + + reg = DSI_R32(ctrl, DSI_SPLIT_LINK); + + /* DMA_LINK_SEL */ + reg &= ~(0x7 << 12); + + /* Send command to both sublinks unless specified */ + if (flags & DSI_CTRL_CMD_SUBLINK0) + reg |= BIT(12); + else if (flags & DSI_CTRL_CMD_SUBLINK1) + reg |= BIT(13); + else + reg |= (BIT(12) | BIT(13)); + + DSI_W32(ctrl, DSI_SPLIT_LINK, reg); + + /* Make sure the split link config is updated */ + wmb(); +}