mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 02:43:24 +03:00
c40156c163
Those changes may change nothing with what I'm trying to accomplish... Though they will make a full backport easier to handle as I now have isolated upstream changes from device-specific changes.
367 lines
12 KiB
Diff
367 lines
12 KiB
Diff
From d9a85ce32841047c4401dcdc682783d9515e83b7 Mon Sep 17 00:00:00 2001
|
|
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
|
|
Date: Fri, 6 Jul 2018 16:52:57 -0400
|
|
Subject: [PATCH] Porting changes found in
|
|
LineageOS/android_kernel_cyanogen_msm8916
|
|
|
|
This includes only generic changes.
|
|
|
|
This excludes device-specific changes; their commits could be applied on
|
|
top still.
|
|
---
|
|
drivers/video/msm/mdss/mdss_dsi.c | 8 +++++
|
|
drivers/video/msm/mdss/mdss_dsi_panel.c | 37 +++++++++++++++++++----
|
|
drivers/video/msm/mdss/mdss_fb.c | 38 ++++++++----------------
|
|
drivers/video/msm/mdss/mdss_hdmi_cec.c | 4 +--
|
|
drivers/video/msm/mdss/mdss_io_util.c | 4 ---
|
|
drivers/video/msm/mdss/mdss_mdp_intf_writeback.c | 34 ++++-----------------
|
|
drivers/video/msm/mdss/mdss_panel.h | 2 +-
|
|
7 files changed, 60 insertions(+), 67 deletions(-)
|
|
|
|
diff --git a/drivers/video/msm/mdss/mdss_dsi.c b/drivers/video/msm/mdss/mdss_dsi.c
|
|
index e83800db8f4..ed0baaaa807 100644
|
|
--- a/drivers/video/msm/mdss/mdss_dsi.c
|
|
+++ b/drivers/video/msm/mdss/mdss_dsi.c
|
|
@@ -101,6 +101,10 @@ static int mdss_dsi_panel_power_off(struct mdss_panel_data *pdata)
|
|
pr_debug("reset disable: pinctrl not enabled\n");
|
|
}
|
|
|
|
+
|
|
+ if (mdss_dsi_pinctrl_set_state(ctrl_pdata, false))
|
|
+ pr_debug("reset disable: pinctrl not enabled\n");
|
|
+
|
|
if (ctrl_pdata->panel_bias_vreg) {
|
|
pr_debug("%s: Disabling panel bias vreg. ndx = %d\n",
|
|
__func__, ctrl_pdata->ndx);
|
|
@@ -1881,6 +1885,10 @@ int dsi_panel_device_register(struct device_node *pan_node,
|
|
}
|
|
break;
|
|
}
|
|
+ for (i = 0; i < len; i++) {
|
|
+ pinfo->mipi.dsi_phy_db.regulator[i]
|
|
+ = data[i];
|
|
+ }
|
|
|
|
data = of_get_property(ctrl_pdev->dev.of_node,
|
|
"qcom,platform-bist-ctrl", &len);
|
|
diff --git a/drivers/video/msm/mdss/mdss_dsi_panel.c b/drivers/video/msm/mdss/mdss_dsi_panel.c
|
|
index dbbeea1747a..fc95de79858 100644
|
|
--- a/drivers/video/msm/mdss/mdss_dsi_panel.c
|
|
+++ b/drivers/video/msm/mdss/mdss_dsi_panel.c
|
|
@@ -386,7 +386,7 @@ static void mdss_dsi_panel_bklt_dcs(struct mdss_dsi_ctrl_pdata *ctrl, int level)
|
|
return;
|
|
}
|
|
|
|
- pr_debug("%s: set level %d\n",__FUNCTION__,level);
|
|
+ pr_debug("%s: level=%d\n", __func__, level);
|
|
|
|
led_pwm1[1] = (unsigned char)level;
|
|
|
|
@@ -452,7 +452,15 @@ static int mdss_dsi_request_gpios(struct mdss_dsi_ctrl_pdata *ctrl_pdata)
|
|
rc);
|
|
goto rst_gpio_err;
|
|
}
|
|
-
|
|
+ if (gpio_is_valid(ctrl_pdata->bklt_en_gpio)) {
|
|
+ rc = gpio_request(ctrl_pdata->bklt_en_gpio,
|
|
+ "bklt_enable");
|
|
+ if (rc) {
|
|
+ pr_err("request bklt gpio failed, rc=%d\n",
|
|
+ rc);
|
|
+ goto bklt_en_gpio_err;
|
|
+ }
|
|
+ }
|
|
if (gpio_is_valid(ctrl_pdata->mode_gpio)) {
|
|
rc = gpio_request(ctrl_pdata->mode_gpio, "panel_mode");
|
|
if (rc) {
|
|
@@ -464,6 +472,9 @@ static int mdss_dsi_request_gpios(struct mdss_dsi_ctrl_pdata *ctrl_pdata)
|
|
return rc;
|
|
|
|
mode_gpio_err:
|
|
+ if (gpio_is_valid(ctrl_pdata->bklt_en_gpio))
|
|
+ gpio_free(ctrl_pdata->bklt_en_gpio);
|
|
+bklt_en_gpio_err:
|
|
gpio_free(ctrl_pdata->rst_gpio);
|
|
rst_gpio_err:
|
|
if (gpio_is_valid(ctrl_pdata->disp_en_gpio))
|
|
@@ -472,7 +483,6 @@ disp_en_gpio_err:
|
|
return rc;
|
|
}
|
|
|
|
-
|
|
int mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
|
|
{
|
|
struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;
|
|
@@ -518,6 +528,8 @@ int mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
|
|
usleep(pinfo->rst_seq[i] * 1000);
|
|
}
|
|
|
|
+ if (gpio_is_valid(ctrl_pdata->bklt_en_gpio))
|
|
+ gpio_set_value((ctrl_pdata->bklt_en_gpio), 1);
|
|
}
|
|
|
|
if (gpio_is_valid(ctrl_pdata->mode_gpio)) {
|
|
@@ -533,6 +545,10 @@ int mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
|
|
pr_debug("%s: Reset panel done\n", __func__);
|
|
}
|
|
} else {
|
|
+ if (gpio_is_valid(ctrl_pdata->bklt_en_gpio)) {
|
|
+ gpio_set_value((ctrl_pdata->bklt_en_gpio), 0);
|
|
+ gpio_free(ctrl_pdata->bklt_en_gpio);
|
|
+ }
|
|
if (gpio_is_valid(ctrl_pdata->disp_en_gpio)) {
|
|
gpio_set_value((ctrl_pdata->disp_en_gpio), 0);
|
|
gpio_free(ctrl_pdata->disp_en_gpio);
|
|
@@ -540,6 +556,7 @@ int mdss_dsi_panel_reset(struct mdss_panel_data *pdata, int enable)
|
|
if (((asus_lcd_id[0]!='2') && (asus_lcd_id[0]!='3')) || fb_shutdown){ //<Asus BSP Squall - keep LCD_RST_EN high>
|
|
gpio_set_value((ctrl_pdata->rst_gpio), 0);
|
|
}
|
|
+ gpio_set_value((ctrl_pdata->rst_gpio), 0);
|
|
gpio_free(ctrl_pdata->rst_gpio);
|
|
if (gpio_is_valid(ctrl_pdata->mode_gpio))
|
|
gpio_free(ctrl_pdata->mode_gpio);
|
|
@@ -890,7 +907,7 @@ static int mdss_dsi_panel_off(struct mdss_panel_data *pdata)
|
|
{
|
|
struct mdss_dsi_ctrl_pdata *ctrl = NULL;
|
|
struct mdss_panel_info *pinfo;
|
|
-
|
|
+
|
|
if (pdata == NULL) {
|
|
pr_err("%s: Invalid input data\n", __func__);
|
|
return -EINVAL;
|
|
@@ -1053,7 +1070,7 @@ static void mdss_dsi_parse_trigger(struct device_node *np, char *trigger,
|
|
}
|
|
|
|
|
|
-static int mdss_dsi_parse_dcs_cmds(struct device_node *np,
|
|
+int mdss_dsi_parse_dcs_cmds(struct device_node *np,
|
|
struct dsi_panel_cmds *pcmds, char *cmd_key, char *link_key)
|
|
{
|
|
const char *data;
|
|
@@ -1545,6 +1562,7 @@ static int mdss_dsi_set_refresh_rate_range(struct device_node *pan_node,
|
|
struct mdss_panel_info *pinfo)
|
|
{
|
|
int rc = 0;
|
|
+ u32 tmp = 0;
|
|
rc = of_property_read_u32(pan_node,
|
|
"qcom,mdss-dsi-min-refresh-rate",
|
|
&pinfo->min_fps);
|
|
@@ -1576,6 +1594,13 @@ static int mdss_dsi_set_refresh_rate_range(struct device_node *pan_node,
|
|
rc = 0;
|
|
}
|
|
|
|
+ rc = of_property_read_u32(pan_node,
|
|
+ "qcom,mdss-dsi-idle-refresh-rate",
|
|
+ &tmp);
|
|
+ if (rc == 0 && tmp >= pinfo->min_fps && tmp <= pinfo->max_fps) {
|
|
+ pinfo->idle_fps = tmp;
|
|
+ }
|
|
+
|
|
pr_info("dyn_fps: min = %d, max = %d\n",
|
|
pinfo->min_fps, pinfo->max_fps);
|
|
return rc;
|
|
@@ -1921,7 +1946,7 @@ static int mdss_panel_parse_dt(struct device_node *np,
|
|
}
|
|
} else if (!strncmp(data, "bl_ctrl_dcs", 11)) {
|
|
ctrl_pdata->bklt_ctrl = BL_DCS_CMD;
|
|
- printk(KERN_NOTICE "<Display>%s: Configured DCS_CMD bklt ctrl\n",
|
|
+ pr_debug("%s: Configured DCS_CMD bklt ctrl\n",
|
|
__func__);
|
|
}
|
|
}
|
|
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
|
|
index 075ee8a3880..391b861e3a0 100644
|
|
--- a/drivers/video/msm/mdss/mdss_fb.c
|
|
+++ b/drivers/video/msm/mdss/mdss_fb.c
|
|
@@ -526,13 +526,14 @@ static ssize_t mdss_fb_get_panel_info(struct device *dev,
|
|
"pu_en=%d\nxstart=%d\nwalign=%d\nystart=%d\nhalign=%d\n"
|
|
"min_w=%d\nmin_h=%d\nroi_merge=%d\ndyn_fps_en=%d\n"
|
|
"min_fps=%d\nmax_fps=%d\npanel_name=%s\n"
|
|
- "primary_panel=%d\n",
|
|
+ "primary_panel=%d\nidle_fps=%d\n",
|
|
pinfo->partial_update_enabled, pinfo->xstart_pix_align,
|
|
pinfo->width_pix_align, pinfo->ystart_pix_align,
|
|
pinfo->height_pix_align, pinfo->min_width,
|
|
pinfo->min_height, pinfo->partial_update_roi_merge,
|
|
pinfo->dynamic_fps, pinfo->min_fps, pinfo->max_fps,
|
|
- pinfo->panel_name, pinfo->is_prim_panel);
|
|
+ pinfo->panel_name, pinfo->is_prim_panel,
|
|
+ pinfo->idle_fps);
|
|
|
|
return ret;
|
|
}
|
|
@@ -1252,8 +1253,8 @@ void mdss_fb_set_backlight(struct msm_fb_data_type *mfd, u32 bkl_lvl)
|
|
|
|
if (
|
|
#ifndef CONFIG_LEDS_TRIGGER_BACKLIGHT
|
|
- (((mdss_fb_is_power_off(mfd) && mfd->dcm_state != DCM_ENTER)
|
|
- || !mfd->allow_bl_updated) && !IS_CALIB_MODE_BL(mfd)) ||
|
|
+ (((mdss_fb_is_power_off(mfd) && mfd->dcm_state != DCM_ENTER)
|
|
+ || !mfd->allow_bl_update) && !IS_CALIB_MODE_BL(mfd)) ||
|
|
#endif
|
|
mfd->panel_info->cont_splash_enabled) {
|
|
if((0 == temp) &&(0 == strcmp(boot_to_charger_mode,"charger"))
|
|
@@ -2339,20 +2340,12 @@ static int mdss_fb_open(struct fb_info *info, int user)
|
|
int result;
|
|
int pid = current->tgid;
|
|
struct task_struct *task = current->group_leader;
|
|
- /* ASUS_BSP: Louis ++ */
|
|
- static int unexpected_fb_open = 5;
|
|
|
|
if (mfd->shutdown_pending) {
|
|
- if (unexpected_fb_open > 0) {
|
|
- unexpected_fb_open--;
|
|
- pr_err("Shutdown pending. Aborting operation. Request from pid:%d name=%s, unexpected_fb_open(%d)\n",
|
|
- pid, task->comm, unexpected_fb_open);
|
|
- return -EPERM;
|
|
- } else {
|
|
- return 0;
|
|
- }
|
|
+ pr_err("Shutdown pending. Aborting operation. Request from pid:%d name=%s\n",
|
|
+ pid, task->comm);
|
|
+ return -EPERM;
|
|
}
|
|
- /* ASUS_BSP: Louis -- */
|
|
|
|
file_info = kmalloc(sizeof(*file_info), GFP_KERNEL);
|
|
if (!file_info) {
|
|
@@ -2426,20 +2419,13 @@ static int mdss_fb_release_all(struct fb_info *info, bool release_all)
|
|
int pid = current->tgid;
|
|
bool unknown_pid = true, release_needed = false;
|
|
struct task_struct *task = current->group_leader;
|
|
- /* ASUS_BSP: Holt ++ */
|
|
- static int unexpected_fb_release = 5;
|
|
+
|
|
if (!mfd->ref_cnt) {
|
|
- if(unexpected_fb_release > 0)
|
|
- {
|
|
- unexpected_fb_release--;
|
|
- pr_info("try to close unopened fb %d! from %s\n", mfd->index,
|
|
+ pr_info("try to close unopened fb %d! from %s\n", mfd->index,
|
|
task->comm);
|
|
- return -EINVAL;
|
|
- } else {
|
|
- return 0;
|
|
- }
|
|
+ return -EINVAL;
|
|
}
|
|
- /* ASUS_BSP: Holt -- */
|
|
+
|
|
if (!wait_event_timeout(mfd->ioctl_q,
|
|
!atomic_read(&mfd->ioctl_ref_cnt) || !release_all,
|
|
msecs_to_jiffies(1000)))
|
|
diff --git a/drivers/video/msm/mdss/mdss_hdmi_cec.c b/drivers/video/msm/mdss/mdss_hdmi_cec.c
|
|
index 7bae54010ce..7eb1297456e 100644
|
|
--- a/drivers/video/msm/mdss/mdss_hdmi_cec.c
|
|
+++ b/drivers/video/msm/mdss/mdss_hdmi_cec.c
|
|
@@ -422,7 +422,7 @@ static void hdmi_cec_msg_recv(struct work_struct *work)
|
|
msg_node->msg.sender_id, msg_node->msg.recvr_id,
|
|
msg_node->msg.frame_size);
|
|
|
|
- if (msg_node->msg.frame_size < 1) {
|
|
+ if (msg_node->msg.frame_size < 1 || msg_node->msg.frame_size > MAX_OPERAND_SIZE) {
|
|
DEV_ERR("%s: invalid message (frame length = %d)",
|
|
__func__, msg_node->msg.frame_size);
|
|
kfree(msg_node);
|
|
@@ -444,7 +444,7 @@ static void hdmi_cec_msg_recv(struct work_struct *work)
|
|
msg_node->msg.operand[i] = data & 0xFF;
|
|
}
|
|
|
|
- for (; i < 14; i++)
|
|
+ for (; i < MAX_OPERAND_SIZE; i++)
|
|
msg_node->msg.operand[i] = 0;
|
|
|
|
DEV_DBG("%s: CEC read frame done\n", __func__);
|
|
diff --git a/drivers/video/msm/mdss/mdss_io_util.c b/drivers/video/msm/mdss/mdss_io_util.c
|
|
index 38b582ecde4..021b1c2282c 100644
|
|
--- a/drivers/video/msm/mdss/mdss_io_util.c
|
|
+++ b/drivers/video/msm/mdss/mdss_io_util.c
|
|
@@ -232,8 +232,6 @@ int msm_dss_enable_vreg(struct dss_vreg *in_vreg, int num_vreg, int enable)
|
|
in_vreg[i].vreg_name);
|
|
goto vreg_set_opt_mode_fail;
|
|
}
|
|
- //printk(KERN_DEBUG "[Display]%s enable vreg :%s \n",
|
|
- //__func__,in_vreg[i].vreg_name);
|
|
rc = regulator_enable(in_vreg[i].vreg);
|
|
if (in_vreg[i].post_on_sleep && need_sleep)
|
|
msleep(in_vreg[i].post_on_sleep);
|
|
@@ -251,8 +249,6 @@ int msm_dss_enable_vreg(struct dss_vreg *in_vreg, int num_vreg, int enable)
|
|
msleep(in_vreg[i].pre_off_sleep);
|
|
regulator_set_optimum_mode(in_vreg[i].vreg,
|
|
in_vreg[i].disable_load);
|
|
- //printk(KERN_DEBUG "[Display]%s disable vreg :%s \n",
|
|
- // __func__,in_vreg[i].vreg_name);
|
|
regulator_disable(in_vreg[i].vreg);
|
|
if (in_vreg[i].post_off_sleep)
|
|
msleep(in_vreg[i].post_off_sleep);
|
|
diff --git a/drivers/video/msm/mdss/mdss_mdp_intf_writeback.c b/drivers/video/msm/mdss/mdss_mdp_intf_writeback.c
|
|
index 25cc69d92dc..3e3bc535c70 100644
|
|
--- a/drivers/video/msm/mdss/mdss_mdp_intf_writeback.c
|
|
+++ b/drivers/video/msm/mdss/mdss_mdp_intf_writeback.c
|
|
@@ -561,36 +561,14 @@ static int mdss_mdp_wb_wait4comp(struct mdss_mdp_ctl *ctl, void *arg)
|
|
NULL, NULL);
|
|
|
|
if (rc == 0) {
|
|
- u32 status, mask, isr;
|
|
-
|
|
- mask = BIT(MDSS_MDP_IRQ_WB_ROT_COMP + ctx->intf_num);
|
|
- isr = readl_relaxed(ctl->mdata->mdp_base + MDSS_MDP_REG_INTR_STATUS);
|
|
- status = mask & isr;
|
|
-
|
|
- pr_info("mask: 0x%x, isr: 0x%x, status: 0x%x\n", mask, isr, status);
|
|
-
|
|
- if (status) {
|
|
- pr_debug("wb done but irq not triggered\n");
|
|
- mdss_mdp_irq_clear(ctl->mdata,
|
|
- MDSS_MDP_IRQ_WB_ROT_COMP,
|
|
- ctx->intf_num);
|
|
- mdss_mdp_writeback_intr_done(ctl);
|
|
- rc = 0;
|
|
- }
|
|
- else {
|
|
- mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_TIMEOUT);
|
|
- rc = -ENODEV;
|
|
- WARN(1, "writeback kickoff timed out (%d) ctl=%d\n",
|
|
- rc, ctl->num);
|
|
- }
|
|
- }
|
|
- else {
|
|
- rc = 0;
|
|
- }
|
|
-
|
|
- if (rc == 0) {
|
|
+ mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_TIMEOUT);
|
|
+ rc = -ENODEV;
|
|
+ WARN(1, "writeback kickoff timed out (%d) ctl=%d\n",
|
|
+ rc, ctl->num);
|
|
+ } else {
|
|
ctx->end_time = ktime_get();
|
|
mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_DONE);
|
|
+ rc = 0;
|
|
}
|
|
|
|
/* once operation is done, disable traffic shaper */
|
|
diff --git a/drivers/video/msm/mdss/mdss_panel.h b/drivers/video/msm/mdss/mdss_panel.h
|
|
index 82c1549a9cc..d2e5999286d 100644
|
|
--- a/drivers/video/msm/mdss/mdss_panel.h
|
|
+++ b/drivers/video/msm/mdss/mdss_panel.h
|
|
@@ -45,7 +45,6 @@ struct panel_id {
|
|
#define LVDS_PANEL 11 /* LVDS */
|
|
#define EDP_PANEL 12 /* LVDS */
|
|
|
|
-
|
|
static inline const char *mdss_panel2str(u32 panel)
|
|
{
|
|
static const char const *names[] = {
|
|
@@ -413,6 +412,7 @@ struct mdss_panel_info {
|
|
u32 min_height;
|
|
u32 min_fps;
|
|
u32 max_fps;
|
|
+ u32 idle_fps;
|
|
|
|
u32 cont_splash_enabled;
|
|
bool esd_rdy;
|
|
--
|
|
2.16.4
|
|
|