Kernel/Display: mot extend code: get lcd para

Use below command to get current dsi panel command:
adb shell "cat /sys/devices/platform/soc/soc:qcom,dsi-display-primary/
dsi_display_parse_para"

Change-Id: I7d3624da8cffc4ae4b42054c323d9ecfa6caa5c3
Reviewed-on: https://gerrit.mot.com/1464821
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1509820
Reviewed-by: Hua Tan <tanhua1@motorola.com>
This commit is contained in:
zhanggb authored and Gilberto Gambugge committed 2023-06-01 00:43:20 -03:00
1 parent d0ce7b4621
commit e2487cf114
1 file changed
+21 -12
+21 -12
View File
@@ -1056,7 +1056,7 @@ static void dsi_display_show_para(char* buf, char* pbuf, enum dsi_cmd_set_type t
int count = priv_info->cmd_sets[type].count; int count = priv_info->cmd_sets[type].count;
memset(pbuf, 0, PAGE_SIZE); memset(pbuf, 0, PAGE_SIZE);
rc = snprintf(pbuf, PAGE_SIZE, "## count:%d ====\n", count); rc = snprintf(pbuf, PAGE_SIZE, "##Command for %s: count:%d ====\n", cmd_set_prop_map[type], count);
strcat(buf, pbuf); strcat(buf, pbuf);
memset(pbuf, 0, PAGE_SIZE); memset(pbuf, 0, PAGE_SIZE);
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
@@ -1090,6 +1090,7 @@ static ssize_t dsi_display_parse_para_get(struct device *dev,
struct dsi_display_mode *display_mode; struct dsi_display_mode *display_mode;
struct dsi_display_mode_priv_info *priv_info; struct dsi_display_mode_priv_info *priv_info;
char* pbuf = NULL; char* pbuf = NULL;
char* psubbuf = NULL;
display = dev_get_drvdata(dev); display = dev_get_drvdata(dev);
if (!display) { if (!display) {
@@ -1100,27 +1101,35 @@ static ssize_t dsi_display_parse_para_get(struct device *dev,
priv_info = display->modes[index].priv_info; priv_info = display->modes[index].priv_info;
mode_timing = &display->modes[index].timing; mode_timing = &display->modes[index].timing;
pbuf = kmalloc(PAGE_SIZE, GFP_KERNEL); pbuf = kzalloc(PAGE_SIZE*4, GFP_KERNEL);
if (pbuf) { if (pbuf) {
rc = snprintf(buf, PAGE_SIZE, "panel horz active:%d front_portch:%d back_porch:%d pulse_width:%d h_skew:%d\n", psubbuf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!psubbuf)
return rc;
rc = snprintf(psubbuf, PAGE_SIZE, "panel horz active:%d front_portch:%d back_porch:%d pulse_width:%d h_skew:%d\n",
mode_timing->h_active, mode_timing->h_front_porch, mode_timing->h_back_porch, mode_timing->h_sync_width, mode_timing->h_skew); mode_timing->h_active, mode_timing->h_front_porch, mode_timing->h_back_porch, mode_timing->h_sync_width, mode_timing->h_skew);
memset(pbuf, 0, PAGE_SIZE); strcat(pbuf, psubbuf);
rc = snprintf(pbuf, PAGE_SIZE, "panel vert active:%d front_portch:%d back_porch:%d pulse_width:%d\n", memset(psubbuf, 0, PAGE_SIZE);
rc = snprintf(psubbuf, PAGE_SIZE, "panel vert active:%d front_portch:%d back_porch:%d pulse_width:%d\n",
mode_timing->v_active, mode_timing->v_front_porch, mode_timing->v_back_porch, mode_timing->v_sync_width); mode_timing->v_active, mode_timing->v_front_porch, mode_timing->v_back_porch, mode_timing->v_sync_width);
strcat(buf, pbuf); strcat(pbuf, psubbuf);
memset(pbuf, 0, PAGE_SIZE); memset(psubbuf, 0, PAGE_SIZE);
rc = snprintf(pbuf, PAGE_SIZE, "panel clk rate:%d mdp_transfer_time_us:%d refresh_rate:%d\n", rc = snprintf(psubbuf, PAGE_SIZE, "panel clk rate:%d mdp_transfer_time_us:%d refresh_rate:%d\n",
display_mode->priv_info->clk_rate_hz , display_mode->priv_info->mdp_transfer_time_us, mode_timing->refresh_rate); display_mode->priv_info->clk_rate_hz , display_mode->priv_info->mdp_transfer_time_us, mode_timing->refresh_rate);
strcat(buf, pbuf); strcat(pbuf, psubbuf);
dsi_display_show_para(buf, pbuf, DSI_CMD_SET_ON, priv_info); memset(psubbuf, 0, PAGE_SIZE);
dsi_display_show_para(buf, pbuf, DSI_CMD_SET_OFF, priv_info); dsi_display_show_para(pbuf, psubbuf, DSI_CMD_SET_ON, priv_info);
dsi_display_show_para(buf, pbuf, DSI_CMD_SET_TIMING_SWITCH, priv_info); dsi_display_show_para(pbuf, psubbuf, DSI_CMD_SET_OFF, priv_info);
dsi_display_show_para(pbuf, psubbuf, DSI_CMD_SET_TIMING_SWITCH, priv_info);
rc = snprintf(buf, PAGE_SIZE, "%s\n", pbuf);
printk("%s\n", buf); printk("%s\n", buf);
} else { } else {
pr_warn("kmalloc failed\n" ); pr_warn("kmalloc failed\n" );
} }
if (psubbuf)
kfree(psubbuf);
if (pbuf) if (pbuf)
kfree(pbuf); kfree(pbuf);
return rc; return rc;