|
@@ -18,6 +18,7 @@
|
|
#include "dsi_clk.h"
|
|
#include "dsi_clk.h"
|
|
#include "dsi_pwr.h"
|
|
#include "dsi_pwr.h"
|
|
#include "dsi_catalog.h"
|
|
#include "dsi_catalog.h"
|
|
|
|
+#include "dsi_panel.h"
|
|
|
|
|
|
#include "sde_dbg.h"
|
|
#include "sde_dbg.h"
|
|
|
|
|
|
@@ -1268,9 +1269,9 @@ static void dsi_kickoff_msg_tx(struct dsi_ctrl *dsi_ctrl,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static u32 dsi_ctrl_validate_msg_flags(struct dsi_ctrl *dsi_ctrl,
|
|
|
|
|
|
+static void dsi_ctrl_validate_msg_flags(struct dsi_ctrl *dsi_ctrl,
|
|
const struct mipi_dsi_msg *msg,
|
|
const struct mipi_dsi_msg *msg,
|
|
- u32 flags)
|
|
|
|
|
|
+ u32 *flags)
|
|
{
|
|
{
|
|
/*
|
|
/*
|
|
* ASYNC command wait mode is not supported for
|
|
* ASYNC command wait mode is not supported for
|
|
@@ -1280,20 +1281,20 @@ static u32 dsi_ctrl_validate_msg_flags(struct dsi_ctrl *dsi_ctrl,
|
|
* - whenever an explicit wait time is specificed for the command
|
|
* - whenever an explicit wait time is specificed for the command
|
|
* since the wait time cannot be guaranteed in async mode
|
|
* since the wait time cannot be guaranteed in async mode
|
|
* - video mode panels
|
|
* - video mode panels
|
|
|
|
+ * If async override is set, skip async flag reset
|
|
*/
|
|
*/
|
|
- if ((flags & DSI_CTRL_CMD_FIFO_STORE) ||
|
|
|
|
- flags & DSI_CTRL_CMD_READ ||
|
|
|
|
- flags & DSI_CTRL_CMD_NON_EMBEDDED_MODE ||
|
|
|
|
|
|
+ if (((*flags & DSI_CTRL_CMD_FIFO_STORE) ||
|
|
|
|
+ *flags & DSI_CTRL_CMD_READ ||
|
|
|
|
+ *flags & DSI_CTRL_CMD_NON_EMBEDDED_MODE ||
|
|
msg->wait_ms ||
|
|
msg->wait_ms ||
|
|
- (dsi_ctrl->host_config.panel_mode == DSI_OP_VIDEO_MODE))
|
|
|
|
- flags &= ~DSI_CTRL_CMD_ASYNC_WAIT;
|
|
|
|
-
|
|
|
|
- return flags;
|
|
|
|
|
|
+ (dsi_ctrl->host_config.panel_mode == DSI_OP_VIDEO_MODE)) &&
|
|
|
|
+ !(msg->flags & MIPI_DSI_MSG_ASYNC_OVERRIDE))
|
|
|
|
+ *flags &= ~DSI_CTRL_CMD_ASYNC_WAIT;
|
|
}
|
|
}
|
|
|
|
|
|
static int dsi_message_tx(struct dsi_ctrl *dsi_ctrl,
|
|
static int dsi_message_tx(struct dsi_ctrl *dsi_ctrl,
|
|
const struct mipi_dsi_msg *msg,
|
|
const struct mipi_dsi_msg *msg,
|
|
- u32 flags)
|
|
|
|
|
|
+ u32 *flags)
|
|
{
|
|
{
|
|
int rc = 0;
|
|
int rc = 0;
|
|
struct mipi_dsi_packet packet;
|
|
struct mipi_dsi_packet packet;
|
|
@@ -1305,10 +1306,10 @@ static int dsi_message_tx(struct dsi_ctrl *dsi_ctrl,
|
|
u8 *cmdbuf;
|
|
u8 *cmdbuf;
|
|
|
|
|
|
/* Select the tx mode to transfer the command */
|
|
/* Select the tx mode to transfer the command */
|
|
- dsi_message_setup_tx_mode(dsi_ctrl, msg->tx_len, &flags);
|
|
|
|
|
|
+ dsi_message_setup_tx_mode(dsi_ctrl, msg->tx_len, flags);
|
|
|
|
|
|
/* Validate the mode before sending the command */
|
|
/* Validate the mode before sending the command */
|
|
- rc = dsi_message_validate_tx_mode(dsi_ctrl, msg->tx_len, &flags);
|
|
|
|
|
|
+ rc = dsi_message_validate_tx_mode(dsi_ctrl, msg->tx_len, flags);
|
|
if (rc) {
|
|
if (rc) {
|
|
DSI_CTRL_ERR(dsi_ctrl,
|
|
DSI_CTRL_ERR(dsi_ctrl,
|
|
"Cmd tx validation failed, cannot transfer cmd\n");
|
|
"Cmd tx validation failed, cannot transfer cmd\n");
|
|
@@ -1316,16 +1317,16 @@ static int dsi_message_tx(struct dsi_ctrl *dsi_ctrl,
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
|
|
|
|
- flags = dsi_ctrl_validate_msg_flags(dsi_ctrl, msg, flags);
|
|
|
|
|
|
+ dsi_ctrl_validate_msg_flags(dsi_ctrl, msg, flags);
|
|
|
|
|
|
if (dsi_ctrl->dma_wait_queued)
|
|
if (dsi_ctrl->dma_wait_queued)
|
|
dsi_ctrl_flush_cmd_dma_queue(dsi_ctrl);
|
|
dsi_ctrl_flush_cmd_dma_queue(dsi_ctrl);
|
|
|
|
|
|
- if (flags & DSI_CTRL_CMD_NON_EMBEDDED_MODE) {
|
|
|
|
|
|
+ if (*flags & DSI_CTRL_CMD_NON_EMBEDDED_MODE) {
|
|
cmd_mem.offset = dsi_ctrl->cmd_buffer_iova;
|
|
cmd_mem.offset = dsi_ctrl->cmd_buffer_iova;
|
|
- cmd_mem.en_broadcast = (flags & DSI_CTRL_CMD_BROADCAST) ?
|
|
|
|
|
|
+ cmd_mem.en_broadcast = (*flags & DSI_CTRL_CMD_BROADCAST) ?
|
|
true : false;
|
|
true : false;
|
|
- cmd_mem.is_master = (flags & DSI_CTRL_CMD_BROADCAST_MASTER) ?
|
|
|
|
|
|
+ cmd_mem.is_master = (*flags & DSI_CTRL_CMD_BROADCAST_MASTER) ?
|
|
true : false;
|
|
true : false;
|
|
cmd_mem.use_lpm = (msg->flags & MIPI_DSI_MSG_USE_LPM) ?
|
|
cmd_mem.use_lpm = (msg->flags & MIPI_DSI_MSG_USE_LPM) ?
|
|
true : false;
|
|
true : false;
|
|
@@ -1360,12 +1361,12 @@ static int dsi_message_tx(struct dsi_ctrl *dsi_ctrl,
|
|
if ((msg->flags & MIPI_DSI_MSG_LASTCOMMAND))
|
|
if ((msg->flags & MIPI_DSI_MSG_LASTCOMMAND))
|
|
buffer[3] |= BIT(7);//set the last cmd bit in header.
|
|
buffer[3] |= BIT(7);//set the last cmd bit in header.
|
|
|
|
|
|
- if (flags & DSI_CTRL_CMD_FETCH_MEMORY) {
|
|
|
|
|
|
+ if (*flags & DSI_CTRL_CMD_FETCH_MEMORY) {
|
|
/* Embedded mode config is selected */
|
|
/* Embedded mode config is selected */
|
|
cmd_mem.offset = dsi_ctrl->cmd_buffer_iova;
|
|
cmd_mem.offset = dsi_ctrl->cmd_buffer_iova;
|
|
- cmd_mem.en_broadcast = (flags & DSI_CTRL_CMD_BROADCAST) ?
|
|
|
|
|
|
+ cmd_mem.en_broadcast = (*flags & DSI_CTRL_CMD_BROADCAST) ?
|
|
true : false;
|
|
true : false;
|
|
- cmd_mem.is_master = (flags & DSI_CTRL_CMD_BROADCAST_MASTER) ?
|
|
|
|
|
|
+ cmd_mem.is_master = (*flags & DSI_CTRL_CMD_BROADCAST_MASTER) ?
|
|
true : false;
|
|
true : false;
|
|
cmd_mem.use_lpm = (msg->flags & MIPI_DSI_MSG_USE_LPM) ?
|
|
cmd_mem.use_lpm = (msg->flags & MIPI_DSI_MSG_USE_LPM) ?
|
|
true : false;
|
|
true : false;
|
|
@@ -1385,19 +1386,19 @@ static int dsi_message_tx(struct dsi_ctrl *dsi_ctrl,
|
|
dsi_ctrl->cmd_len = 0;
|
|
dsi_ctrl->cmd_len = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- } else if (flags & DSI_CTRL_CMD_FIFO_STORE) {
|
|
|
|
|
|
+ } else if (*flags & DSI_CTRL_CMD_FIFO_STORE) {
|
|
cmd.command = (u32 *)buffer;
|
|
cmd.command = (u32 *)buffer;
|
|
cmd.size = length;
|
|
cmd.size = length;
|
|
- cmd.en_broadcast = (flags & DSI_CTRL_CMD_BROADCAST) ?
|
|
|
|
|
|
+ cmd.en_broadcast = (*flags & DSI_CTRL_CMD_BROADCAST) ?
|
|
true : false;
|
|
true : false;
|
|
- cmd.is_master = (flags & DSI_CTRL_CMD_BROADCAST_MASTER) ?
|
|
|
|
|
|
+ cmd.is_master = (*flags & DSI_CTRL_CMD_BROADCAST_MASTER) ?
|
|
true : false;
|
|
true : false;
|
|
cmd.use_lpm = (msg->flags & MIPI_DSI_MSG_USE_LPM) ?
|
|
cmd.use_lpm = (msg->flags & MIPI_DSI_MSG_USE_LPM) ?
|
|
true : false;
|
|
true : false;
|
|
}
|
|
}
|
|
|
|
|
|
kickoff:
|
|
kickoff:
|
|
- dsi_kickoff_msg_tx(dsi_ctrl, msg, &cmd, &cmd_mem, flags);
|
|
|
|
|
|
+ dsi_kickoff_msg_tx(dsi_ctrl, msg, &cmd, &cmd_mem, *flags);
|
|
error:
|
|
error:
|
|
if (buffer)
|
|
if (buffer)
|
|
devm_kfree(&dsi_ctrl->pdev->dev, buffer);
|
|
devm_kfree(&dsi_ctrl->pdev->dev, buffer);
|
|
@@ -1425,7 +1426,7 @@ static int dsi_set_max_return_size(struct dsi_ctrl *dsi_ctrl,
|
|
dflags &= ~BIT(3);
|
|
dflags &= ~BIT(3);
|
|
msg.flags = dflags;
|
|
msg.flags = dflags;
|
|
|
|
|
|
- rc = dsi_message_tx(dsi_ctrl, &msg, flags);
|
|
|
|
|
|
+ rc = dsi_message_tx(dsi_ctrl, &msg, &flags);
|
|
if (rc)
|
|
if (rc)
|
|
DSI_CTRL_ERR(dsi_ctrl, "failed to send max return size packet, rc=%d\n",
|
|
DSI_CTRL_ERR(dsi_ctrl, "failed to send max return size packet, rc=%d\n",
|
|
rc);
|
|
rc);
|
|
@@ -1487,7 +1488,7 @@ static int dsi_parse_long_read_resp(const struct mipi_dsi_msg *msg,
|
|
|
|
|
|
static int dsi_message_rx(struct dsi_ctrl *dsi_ctrl,
|
|
static int dsi_message_rx(struct dsi_ctrl *dsi_ctrl,
|
|
const struct mipi_dsi_msg *msg,
|
|
const struct mipi_dsi_msg *msg,
|
|
- u32 flags)
|
|
|
|
|
|
+ u32 *flags)
|
|
{
|
|
{
|
|
int rc = 0;
|
|
int rc = 0;
|
|
u32 rd_pkt_size, total_read_len, hw_read_cnt;
|
|
u32 rd_pkt_size, total_read_len, hw_read_cnt;
|
|
@@ -2691,8 +2692,7 @@ void dsi_ctrl_disable_status_interrupt(struct dsi_ctrl *dsi_ctrl,
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
- if (!dsi_ctrl || dsi_ctrl->irq_info.irq_num == -1 ||
|
|
|
|
- intr_idx >= DSI_STATUS_INTERRUPT_COUNT)
|
|
|
|
|
|
+ if (!dsi_ctrl || intr_idx >= DSI_STATUS_INTERRUPT_COUNT)
|
|
return;
|
|
return;
|
|
|
|
|
|
SDE_EVT32(dsi_ctrl->cell_index, SDE_EVTLOG_FUNC_ENTRY);
|
|
SDE_EVT32(dsi_ctrl->cell_index, SDE_EVTLOG_FUNC_ENTRY);
|
|
@@ -2705,7 +2705,8 @@ void dsi_ctrl_disable_status_interrupt(struct dsi_ctrl *dsi_ctrl,
|
|
dsi_ctrl->irq_info.irq_stat_mask);
|
|
dsi_ctrl->irq_info.irq_stat_mask);
|
|
|
|
|
|
/* don't need irq if no lines are enabled */
|
|
/* don't need irq if no lines are enabled */
|
|
- if (dsi_ctrl->irq_info.irq_stat_mask == 0)
|
|
|
|
|
|
+ if (dsi_ctrl->irq_info.irq_stat_mask == 0 &&
|
|
|
|
+ dsi_ctrl->irq_info.irq_num != -1)
|
|
disable_irq_nosync(dsi_ctrl->irq_info.irq_num);
|
|
disable_irq_nosync(dsi_ctrl->irq_info.irq_num);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3088,7 +3089,7 @@ int dsi_ctrl_validate_timing(struct dsi_ctrl *dsi_ctrl,
|
|
*/
|
|
*/
|
|
int dsi_ctrl_cmd_transfer(struct dsi_ctrl *dsi_ctrl,
|
|
int dsi_ctrl_cmd_transfer(struct dsi_ctrl *dsi_ctrl,
|
|
const struct mipi_dsi_msg *msg,
|
|
const struct mipi_dsi_msg *msg,
|
|
- u32 flags)
|
|
|
|
|
|
+ u32 *flags)
|
|
{
|
|
{
|
|
int rc = 0;
|
|
int rc = 0;
|
|
|
|
|
|
@@ -3106,7 +3107,7 @@ int dsi_ctrl_cmd_transfer(struct dsi_ctrl *dsi_ctrl,
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
|
|
|
|
- if (flags & DSI_CTRL_CMD_READ) {
|
|
|
|
|
|
+ if (*flags & DSI_CTRL_CMD_READ) {
|
|
rc = dsi_message_rx(dsi_ctrl, msg, flags);
|
|
rc = dsi_message_rx(dsi_ctrl, msg, flags);
|
|
if (rc <= 0)
|
|
if (rc <= 0)
|
|
DSI_CTRL_ERR(dsi_ctrl, "read message failed read length, rc=%d\n",
|
|
DSI_CTRL_ERR(dsi_ctrl, "read message failed read length, rc=%d\n",
|