techpack: display: Import xiaomi changes
The Patch based on QualComm release TAG:LA.UM.8.15.r1-06600-KAMORTA.0 Change-Id: I1f98410528de75bb7c87b12ae7666769945e9ad9 Signed-off-by: starlight5234 <starlight5234@protonmail.ch>
This commit is contained in:
parent
1509ecd407
commit
1486a406cb
7 changed files with 559 additions and 12 deletions
|
@ -307,6 +307,10 @@ enum dsi_cmd_set_type {
|
|||
DSI_CMD_SET_POST_TIMING_SWITCH,
|
||||
DSI_CMD_SET_QSYNC_ON,
|
||||
DSI_CMD_SET_QSYNC_OFF,
|
||||
DSI_CMD_SET_CABC_ON,
|
||||
DSI_CMD_SET_CABC_OFF,
|
||||
DSI_CMD_SET_CABC_MOVIE_ON,
|
||||
DSI_CMD_SET_CABC_STILL_ON,
|
||||
DSI_CMD_SET_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/err.h>
|
||||
#include <drm/drm_notifier.h>
|
||||
#include <linux/backlight.h>
|
||||
|
||||
#include "msm_drv.h"
|
||||
#include "sde_connector.h"
|
||||
|
@ -33,6 +35,15 @@
|
|||
#define DSI_CLOCK_BITRATE_RADIX 10
|
||||
#define MAX_TE_SOURCE_ID 2
|
||||
|
||||
static struct dsi_display *whitep_display;
|
||||
extern char g_lcd_id[128];
|
||||
extern bool panel_init_judge;
|
||||
|
||||
extern bool backlight_val;
|
||||
struct dsi_whitep_display_para whitep_display_para = {0};
|
||||
#define X_coordinate 172
|
||||
#define Y_coordinate 192
|
||||
|
||||
static char dsi_display_primary[MAX_CMDLINE_PARAM_LEN];
|
||||
static char dsi_display_secondary[MAX_CMDLINE_PARAM_LEN];
|
||||
static struct dsi_display_boot_param boot_displays[MAX_DSI_ACTIVE_DISPLAY] = {
|
||||
|
@ -572,8 +583,8 @@ static bool dsi_display_validate_reg_read(struct dsi_panel *panel)
|
|||
for (i = 0; i < len; ++i) {
|
||||
if (config->return_buf[i] !=
|
||||
config->status_value[group + i]) {
|
||||
DRM_ERROR("mismatch: 0x%x\n",
|
||||
config->return_buf[i]);
|
||||
DRM_ERROR("mismatch: i = %d 0x%x\n",
|
||||
i, config->return_buf[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -623,6 +634,94 @@ static void dsi_display_parse_te_data(struct dsi_display *display)
|
|||
display->te_source = val;
|
||||
}
|
||||
|
||||
|
||||
static char dcs_cmd[2] = {0x00, 0x00}; /* DTYPE_DCS_READ */
|
||||
static struct dsi_cmd_desc dcs_read_cmd = {
|
||||
{0, 6, MIPI_DSI_MSG_REQ_ACK, 0, 5, sizeof(dcs_cmd), dcs_cmd, 0, 0},
|
||||
1,
|
||||
5,
|
||||
};
|
||||
|
||||
static int dsi_display_read_reg(struct dsi_display_ctrl *ctrl, char cmd0,
|
||||
char cmd1, char *rbuf, int len)
|
||||
{
|
||||
int rc = 0;
|
||||
struct dsi_cmd_desc *cmds;
|
||||
u32 flags = 0;
|
||||
|
||||
if (!ctrl || !ctrl->ctrl)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* When DSI controller is not in initialized state, we do not want to
|
||||
* report a false failure and hence we defer until next read
|
||||
* happen.
|
||||
*/
|
||||
if (!dsi_ctrl_validate_host_state(ctrl->ctrl))
|
||||
return 1;
|
||||
|
||||
dcs_cmd[0] = cmd0;
|
||||
dcs_cmd[1] = cmd1;
|
||||
|
||||
cmds = &dcs_read_cmd;
|
||||
flags |= (DSI_CTRL_CMD_FETCH_MEMORY | DSI_CTRL_CMD_READ );
|
||||
|
||||
memset(rbuf, 0x0, SZ_4K);
|
||||
if (cmds->last_command) {
|
||||
cmds->msg.flags |= MIPI_DSI_MSG_LASTCOMMAND;
|
||||
flags |= DSI_CTRL_CMD_LAST_COMMAND;
|
||||
}
|
||||
cmds->msg.rx_buf = rbuf;
|
||||
cmds->msg.rx_len = len;
|
||||
rc = dsi_ctrl_cmd_transfer(ctrl->ctrl, &cmds->msg, &flags);
|
||||
if (rc <= 0) {
|
||||
pr_err("rx cmd transfer failed rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static char dcs_cmd_page[2] = {0x00, 0x00}; /* DTYPE_DCS_READ */
|
||||
static struct dsi_cmd_desc dcs_read_cmd_page = {
|
||||
{0, 0x15, MIPI_DSI_MSG_REQ_ACK, 0, 5, sizeof(dcs_cmd_page), dcs_cmd_page, 0, 0},
|
||||
1,
|
||||
5,
|
||||
};
|
||||
|
||||
static int dsi_display_write_reg_page(struct dsi_display_ctrl *ctrl, char cmd0,
|
||||
char cmd1, char *rbuf, int len)
|
||||
{
|
||||
int rc = 0;
|
||||
struct dsi_cmd_desc *cmds;
|
||||
u32 flags = 0;
|
||||
|
||||
if (!ctrl || !ctrl->ctrl)
|
||||
return -EINVAL;
|
||||
|
||||
if (!dsi_ctrl_validate_host_state(ctrl->ctrl))
|
||||
return 1;
|
||||
|
||||
dcs_cmd_page[0] = cmd0;
|
||||
dcs_cmd_page[1] = cmd1;
|
||||
cmds = &dcs_read_cmd_page;
|
||||
flags |= (DSI_CTRL_CMD_FETCH_MEMORY);
|
||||
|
||||
memset(rbuf, 0x0, SZ_4K);
|
||||
if (cmds->last_command) {
|
||||
cmds->msg.flags |= MIPI_DSI_MSG_LASTCOMMAND;
|
||||
flags |= DSI_CTRL_CMD_LAST_COMMAND;
|
||||
}
|
||||
cmds->msg.rx_buf = NULL;
|
||||
cmds->msg.rx_len = 0;
|
||||
rc = dsi_ctrl_cmd_transfer(ctrl->ctrl, &cmds->msg, &flags);
|
||||
if (rc < 0) {
|
||||
pr_err("peter rx cmd transfer failed rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int dsi_display_read_status(struct dsi_display_ctrl *ctrl,
|
||||
struct dsi_panel *panel)
|
||||
{
|
||||
|
@ -1046,12 +1145,25 @@ int dsi_display_set_power(struct drm_connector *connector,
|
|||
{
|
||||
struct dsi_display *display = disp;
|
||||
int rc = 0;
|
||||
struct drm_notify_data g_notify_data;
|
||||
struct drm_device *dev = NULL;
|
||||
int event = 0;
|
||||
|
||||
if (!display || !display->panel) {
|
||||
DSI_ERR("invalid display/panel\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!connector || !connector->dev) {
|
||||
pr_err("invalid connector/dev\n");
|
||||
return -EINVAL;
|
||||
} else {
|
||||
dev = connector->dev;
|
||||
event = dev->doze_state;
|
||||
}
|
||||
|
||||
g_notify_data.data = &event;
|
||||
|
||||
switch (power_mode) {
|
||||
case SDE_MODE_DPMS_LP1:
|
||||
rc = dsi_panel_set_lp1(display->panel);
|
||||
|
@ -1066,9 +1178,17 @@ int dsi_display_set_power(struct drm_connector *connector,
|
|||
break;
|
||||
case SDE_MODE_DPMS_OFF:
|
||||
default:
|
||||
if (dev->pre_state != SDE_MODE_DPMS_LP1 &&
|
||||
dev->pre_state != SDE_MODE_DPMS_LP2)
|
||||
break;
|
||||
|
||||
drm_notifier_call_chain(DRM_EARLY_EVENT_BLANK, &g_notify_data);
|
||||
rc = dsi_panel_set_nolp(display->panel);
|
||||
drm_notifier_call_chain(DRM_EVENT_BLANK, &g_notify_data);
|
||||
return rc;
|
||||
}
|
||||
|
||||
dev->pre_state = power_mode;
|
||||
SDE_EVT32(display->panel->power_mode, power_mode, rc);
|
||||
DSI_DEBUG("Power mode transition from %d to %d %s",
|
||||
display->panel->power_mode, power_mode,
|
||||
|
@ -4967,6 +5087,155 @@ static int dsi_display_force_update_dsi_clk(struct dsi_display *display)
|
|||
|
||||
return rc;
|
||||
}
|
||||
static ssize_t dsi_display_set_cabc(struct device *dev,struct device_attribute *attr,const char *buf,size_t len)
|
||||
{
|
||||
|
||||
int rc = 0;
|
||||
int param = 0;
|
||||
struct dsi_display *display;
|
||||
|
||||
display = dev_get_drvdata(dev);
|
||||
if (!display) {
|
||||
pr_err("Invalid display\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = kstrtoint(buf, 10, ¶m);
|
||||
if (rc) {
|
||||
pr_err("kstrtoint failed. rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
pr_info("hyper:_###_%s,set_cabc_cmd: %d\n",__func__, param);
|
||||
switch(param) {
|
||||
case 0x1: //cabc on
|
||||
dsi_panel_set_feature(display->panel, DSI_CMD_SET_CABC_ON);
|
||||
break;
|
||||
case 0x2: //cabc off
|
||||
dsi_panel_set_feature(display->panel, DSI_CMD_SET_CABC_OFF);
|
||||
break;
|
||||
default:
|
||||
pr_err("unknow cmds: %d\n", param);
|
||||
break;
|
||||
}
|
||||
pr_err("hyper:_##### cabc over ###\n");
|
||||
return len;
|
||||
}
|
||||
static ssize_t dsi_display_set_cabc_movie(struct device *dev,struct device_attribute *attr,const char *buf,size_t len)
|
||||
{
|
||||
|
||||
int rc = 0;
|
||||
int param = 0;
|
||||
struct dsi_display *display;
|
||||
|
||||
display = dev_get_drvdata(dev);
|
||||
if (!display) {
|
||||
pr_err("Invalid display\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = kstrtoint(buf, 10, ¶m);
|
||||
if (rc) {
|
||||
pr_err("kstrtoint failed. rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
switch(param) {
|
||||
case 0x1: //cabc_movie on
|
||||
dsi_panel_set_feature(display->panel, DSI_CMD_SET_CABC_MOVIE_ON);
|
||||
break;
|
||||
case 0x2: //cabc_movie off
|
||||
dsi_panel_set_feature(display->panel, DSI_CMD_SET_CABC_OFF);
|
||||
break;
|
||||
default:
|
||||
pr_err("unknow cmds: %d\n", param);
|
||||
break;
|
||||
}
|
||||
pr_err("hyper:_##### cabc_movie over ###\n");
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t dsi_display_set_cabc_still(struct device *dev,struct device_attribute *attr,const char *buf,size_t len)
|
||||
{
|
||||
|
||||
int rc = 0;
|
||||
int param = 0;
|
||||
struct dsi_display *display;
|
||||
|
||||
display = dev_get_drvdata(dev);
|
||||
if (!display) {
|
||||
pr_err("Invalid display\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = kstrtoint(buf, 10, ¶m);
|
||||
if (rc) {
|
||||
pr_err("kstrtoint failed. rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
switch(param) {
|
||||
case 0x1: //cabc_still on
|
||||
dsi_panel_set_feature(display->panel, DSI_CMD_SET_CABC_STILL_ON);
|
||||
break;
|
||||
case 0x2: //cabc_still off
|
||||
dsi_panel_set_feature(display->panel, DSI_CMD_SET_CABC_OFF);
|
||||
break;
|
||||
default:
|
||||
pr_err("unknow cmds: %d\n", param);
|
||||
break;
|
||||
}
|
||||
pr_err("hyper:_##### cabc_still over ###\n");
|
||||
return len;
|
||||
}
|
||||
unsigned int hbm_mode;
|
||||
extern int dsi_hbm_set(enum backlight_hbm_mode hbm_mode);
|
||||
static ssize_t dsi_display_set_hbm(struct device *dev,struct device_attribute *attr,const char *buf,size_t len)
|
||||
{
|
||||
if ((!panel_init_judge) || (!backlight_val)) {
|
||||
pr_err("hyper: con't set hbm\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
sscanf(buf, "%d", &hbm_mode) ;
|
||||
if (hbm_mode >= HBM_MODE_LEVEL_MAX)
|
||||
hbm_mode = HBM_MODE_LEVEL_MAX - 1;
|
||||
if (hbm_mode < HBM_MODE_DEFAULT)
|
||||
hbm_mode = HBM_MODE_DEFAULT;
|
||||
|
||||
dsi_hbm_set((enum backlight_hbm_mode)hbm_mode);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(dsi_display_cabc, 0644, NULL, dsi_display_set_cabc);
|
||||
static DEVICE_ATTR(dsi_display_hbm, 0644, NULL, dsi_display_set_hbm);
|
||||
static DEVICE_ATTR(dsi_display_cabc_movie, 0644, NULL, dsi_display_set_cabc_movie);
|
||||
static DEVICE_ATTR(dsi_display_cabc_still, 0644, NULL, dsi_display_set_cabc_still);
|
||||
|
||||
static struct attribute *dsi_display_feature_attrs[] = {
|
||||
&dev_attr_dsi_display_cabc.attr,
|
||||
&dev_attr_dsi_display_hbm.attr,
|
||||
&dev_attr_dsi_display_cabc_movie.attr,
|
||||
&dev_attr_dsi_display_cabc_still.attr,
|
||||
NULL,
|
||||
};
|
||||
static struct attribute_group dsi_display_feature_attrs_group = {
|
||||
.attrs = dsi_display_feature_attrs,
|
||||
};
|
||||
|
||||
static int dsi_display_feature_create_sysfs(struct dsi_display *display){
|
||||
int ret =0;
|
||||
struct device *dev = &display->pdev->dev;
|
||||
|
||||
ret = sysfs_create_group(&dev->kobj,
|
||||
&dsi_display_feature_attrs_group);
|
||||
if(ret){
|
||||
pr_err("%s failed \n",__func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
pr_info("hyper:%s success\n",__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dsi_display_validate_split_link(struct dsi_display *display)
|
||||
{
|
||||
|
@ -5004,6 +5273,154 @@ static int dsi_display_validate_split_link(struct dsi_display *display)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int dsi_display_get_point_init(void)
|
||||
{
|
||||
if((strstr(g_lcd_id, "td4330")!= NULL)) {
|
||||
whitep_display_para.white_point_r = 656335;
|
||||
whitep_display_para.white_point_g = 299652;
|
||||
whitep_display_para.white_point_b = 154054;
|
||||
return 0;
|
||||
} else if((strstr(g_lcd_id, "ft8719")!= NULL)) {
|
||||
whitep_display_para.white_point_r = 657335;
|
||||
whitep_display_para.white_point_g = 297657;
|
||||
whitep_display_para.white_point_b = 155044;
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
static bool is_already_read = false;
|
||||
static ssize_t dsi_display_get_whitepoint(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
|
||||
struct dsi_display_ctrl *ctrl = NULL;
|
||||
|
||||
ssize_t rc = 0;
|
||||
struct dsi_display *display;
|
||||
if (is_already_read)
|
||||
goto done;
|
||||
|
||||
display = whitep_display;
|
||||
if (!display) {
|
||||
pr_err("hyper Invalid display\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (display->tx_cmd_buf == NULL) {
|
||||
rc = dsi_host_alloc_cmd_tx_buffer(display);
|
||||
if (rc) {
|
||||
pr_err("hyper failed to allocate cmd tx buffer memory\n");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
rc = dsi_display_cmd_engine_enable(display);
|
||||
if (rc) {
|
||||
pr_err("hyper cmd engine enable failed\n");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
ctrl = &display->ctrl[display->cmd_master_idx];
|
||||
|
||||
if((strstr(g_lcd_id, "ft8719")!= NULL)) {
|
||||
pr_err("hyper whitepoint ft8719\n");
|
||||
rc = dsi_display_write_reg_page(ctrl, 0x00, 0x50, buf, sizeof(buf));
|
||||
rc = dsi_display_read_reg(ctrl, 0xf4, 0, buf, sizeof(buf));
|
||||
} else {
|
||||
pr_err("hyper whitepoint td4330\n");
|
||||
rc = dsi_display_write_reg_page(ctrl, 0xff, 0x10, buf, sizeof(buf));
|
||||
rc = dsi_display_read_reg(ctrl, 0xa1, 0, buf, sizeof(buf));
|
||||
}
|
||||
|
||||
if (rc <= 0) {
|
||||
pr_err("hyper get whitepoint failed rc=%d\n", rc);
|
||||
goto exit;
|
||||
}
|
||||
if(buf[0] == 0)
|
||||
is_already_read = false;
|
||||
else
|
||||
is_already_read = true;
|
||||
pr_err("hyper val0=%d,val1=%d\n",buf[0],buf[1]);
|
||||
whitep_display_para.white_point_x = buf[0] + X_coordinate;
|
||||
whitep_display_para.white_point_y = buf[1] + Y_coordinate;
|
||||
|
||||
exit:
|
||||
dsi_display_cmd_engine_disable(display);
|
||||
done:
|
||||
rc = snprintf(buf, PAGE_SIZE, "%3d%3d\n",whitep_display_para.white_point_x,whitep_display_para.white_point_y);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static ssize_t dsi_display_get_rpoint(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int ret;
|
||||
ret = scnprintf(buf, PAGE_SIZE, "%6d\n",
|
||||
whitep_display_para.white_point_r);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t dsi_display_get_gpoint(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int ret;
|
||||
ret = scnprintf(buf, PAGE_SIZE, "%6d\n",
|
||||
whitep_display_para.white_point_g);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t dsi_display_get_bpoint(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int ret;
|
||||
ret = scnprintf(buf, PAGE_SIZE, "%6d\n",
|
||||
whitep_display_para.white_point_b);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(dsi_whitepoint, 0644, dsi_display_get_whitepoint,NULL );
|
||||
static DEVICE_ATTR(dsi_rpoint, 0644, dsi_display_get_rpoint,NULL );
|
||||
static DEVICE_ATTR(dsi_gpoint, 0644, dsi_display_get_gpoint,NULL );
|
||||
static DEVICE_ATTR(dsi_bpoint, 0644, dsi_display_get_bpoint,NULL );
|
||||
static struct kobject *msm_whitepoint;
|
||||
static int dsi_display_whitepoint_create_sysfs(void){
|
||||
int ret;
|
||||
msm_whitepoint=kobject_create_and_add("android_whitepoint",NULL);
|
||||
if(msm_whitepoint==NULL){
|
||||
pr_info("msm_whitepoint_create_sysfs_ failed\n");
|
||||
ret=-ENOMEM;
|
||||
return ret;
|
||||
}
|
||||
ret=sysfs_create_file(msm_whitepoint,&dev_attr_dsi_whitepoint.attr);
|
||||
if(ret){
|
||||
pr_err("hyper:%s failed \n",__func__);
|
||||
kobject_del(msm_whitepoint);
|
||||
return ret;
|
||||
}
|
||||
ret=sysfs_create_file(msm_whitepoint,&dev_attr_dsi_rpoint.attr);
|
||||
if(ret){
|
||||
pr_err("hyper:%s failed \n",__func__);
|
||||
kobject_del(msm_whitepoint);
|
||||
return ret;
|
||||
}
|
||||
ret=sysfs_create_file(msm_whitepoint,&dev_attr_dsi_gpoint.attr);
|
||||
if(ret){
|
||||
pr_err("hyper:%s failed \n",__func__);
|
||||
kobject_del(msm_whitepoint);
|
||||
return ret;
|
||||
}
|
||||
ret=sysfs_create_file(msm_whitepoint,&dev_attr_dsi_bpoint.attr);
|
||||
if(ret){
|
||||
pr_err("hyper:%s failed \n",__func__);
|
||||
kobject_del(msm_whitepoint);
|
||||
return ret;
|
||||
}
|
||||
dsi_display_get_point_init();
|
||||
pr_info("hyper:%s success\n",__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* dsi_display_bind - bind dsi device with controlling device
|
||||
* @dev: Pointer to base of platform device
|
||||
|
@ -5209,7 +5626,8 @@ static int dsi_display_bind(struct device *dev,
|
|||
|
||||
/* register te irq handler */
|
||||
dsi_display_register_te_irq(display);
|
||||
|
||||
dsi_display_feature_create_sysfs(display);
|
||||
dsi_display_whitepoint_create_sysfs();
|
||||
goto error;
|
||||
|
||||
error_host_deinit:
|
||||
|
@ -7133,6 +7551,7 @@ int dsi_display_prepare(struct dsi_display *display)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
whitep_display = display;
|
||||
SDE_EVT32(SDE_EVTLOG_FUNC_ENTRY);
|
||||
mutex_lock(&display->display_lock);
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_atomic.h>
|
||||
#include <drm/drm_notifier.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
#include "msm_kms.h"
|
||||
#include "sde_connector.h"
|
||||
|
@ -21,12 +23,47 @@
|
|||
#define DEFAULT_PANEL_JITTER_ARRAY_SIZE 2
|
||||
#define DEFAULT_PANEL_PREFILL_LINES 25
|
||||
|
||||
static BLOCKING_NOTIFIER_HEAD(drm_notifier_list);
|
||||
|
||||
static struct dsi_display_mode_priv_info default_priv_info = {
|
||||
.panel_jitter_numer = DEFAULT_PANEL_JITTER_NUMERATOR,
|
||||
.panel_jitter_denom = DEFAULT_PANEL_JITTER_DENOMINATOR,
|
||||
.panel_prefill_lines = DEFAULT_PANEL_PREFILL_LINES,
|
||||
.dsc_enabled = false,
|
||||
};
|
||||
bool panel_init_judge;
|
||||
struct drm_notify_data g_notify_data;
|
||||
|
||||
/*
|
||||
* drm_register_client - register a client notifier
|
||||
* @nb:notifier block to callback when event happen
|
||||
*/
|
||||
int drm_register_client(struct notifier_block *nb)
|
||||
{
|
||||
return blocking_notifier_chain_register(&drm_notifier_list, nb);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_register_client);
|
||||
|
||||
/*
|
||||
* drm_unregister_client - unregister a client notifier
|
||||
* @nb:notifier block to callback when event happen
|
||||
*/
|
||||
int drm_unregister_client(struct notifier_block *nb)
|
||||
{
|
||||
return blocking_notifier_chain_unregister(&drm_notifier_list, nb);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_unregister_client);
|
||||
|
||||
/*
|
||||
* drm_notifier_call_chain - notify clients of drm_event
|
||||
*
|
||||
*/
|
||||
|
||||
int drm_notifier_call_chain(unsigned long val, void *v)
|
||||
{
|
||||
return blocking_notifier_call_chain(&drm_notifier_list, val, v);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_notifier_call_chain);
|
||||
|
||||
static void convert_to_dsi_mode(const struct drm_display_mode *drm_mode,
|
||||
struct dsi_display_mode *dsi_mode)
|
||||
|
@ -165,6 +202,8 @@ static void dsi_bridge_pre_enable(struct drm_bridge *bridge)
|
|||
{
|
||||
int rc = 0;
|
||||
struct dsi_bridge *c_bridge = to_dsi_bridge(bridge);
|
||||
int event = DRM_BLANK_UNBLANK;
|
||||
g_notify_data.data = &event;
|
||||
|
||||
if (!bridge) {
|
||||
DSI_ERR("Invalid params\n");
|
||||
|
@ -176,6 +215,8 @@ static void dsi_bridge_pre_enable(struct drm_bridge *bridge)
|
|||
return;
|
||||
}
|
||||
|
||||
drm_notifier_call_chain(DRM_EARLY_EVENT_BLANK, &g_notify_data);
|
||||
|
||||
atomic_set(&c_bridge->display->panel->esd_recovery_pending, 0);
|
||||
|
||||
/* By this point mode should have been validated through mode_fixup */
|
||||
|
@ -211,6 +252,9 @@ static void dsi_bridge_pre_enable(struct drm_bridge *bridge)
|
|||
c_bridge->id, rc);
|
||||
(void)dsi_display_unprepare(c_bridge->display);
|
||||
}
|
||||
|
||||
drm_notifier_call_chain(DRM_EVENT_BLANK, &g_notify_data);
|
||||
|
||||
SDE_ATRACE_END("dsi_display_enable");
|
||||
|
||||
rc = dsi_display_splash_res_cleanup(c_bridge->display);
|
||||
|
@ -273,6 +317,7 @@ static void dsi_bridge_disable(struct drm_bridge *bridge)
|
|||
sde_connector_helper_bridge_disable(display->drm_conn);
|
||||
}
|
||||
|
||||
panel_init_judge = false;
|
||||
rc = dsi_display_pre_disable(c_bridge->display);
|
||||
if (rc) {
|
||||
DSI_ERR("[%d] DSI display pre disable failed, rc=%d\n",
|
||||
|
@ -284,12 +329,16 @@ static void dsi_bridge_post_disable(struct drm_bridge *bridge)
|
|||
{
|
||||
int rc = 0;
|
||||
struct dsi_bridge *c_bridge = to_dsi_bridge(bridge);
|
||||
int event = DRM_BLANK_POWERDOWN;
|
||||
g_notify_data.data = &event;
|
||||
|
||||
if (!bridge) {
|
||||
DSI_ERR("Invalid params\n");
|
||||
return;
|
||||
}
|
||||
|
||||
drm_notifier_call_chain(DRM_EARLY_EVENT_BLANK, &g_notify_data);
|
||||
|
||||
SDE_ATRACE_BEGIN("dsi_bridge_post_disable");
|
||||
SDE_ATRACE_BEGIN("dsi_display_disable");
|
||||
rc = dsi_display_disable(c_bridge->display);
|
||||
|
@ -309,6 +358,8 @@ static void dsi_bridge_post_disable(struct drm_bridge *bridge)
|
|||
return;
|
||||
}
|
||||
SDE_ATRACE_END("dsi_bridge_post_disable");
|
||||
|
||||
drm_notifier_call_chain(DRM_EVENT_BLANK, &g_notify_data);
|
||||
}
|
||||
|
||||
static void dsi_bridge_mode_set(struct drm_bridge *bridge,
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
#define MAX_PANEL_JITTER 10
|
||||
#define DEFAULT_PANEL_PREFILL_LINES 25
|
||||
#define MIN_PREFILL_LINES 35
|
||||
char g_lcd_id[128];
|
||||
extern bool panel_init_judge;
|
||||
|
||||
bool backlight_val;
|
||||
|
||||
enum dsi_dsc_ratio_type {
|
||||
DSC_8BPC_8BPP,
|
||||
|
@ -95,6 +99,7 @@ static char dsi_dsc_rc_range_max_qp_1_1_scr1[][15] = {
|
|||
static char dsi_dsc_rc_range_bpg_offset[] = {2, 0, 0, -2, -4, -6, -8, -8,
|
||||
-8, -10, -10, -12, -12, -12, -12};
|
||||
|
||||
extern int lcd_bl_set_led_brightness(int value);
|
||||
int dsi_dsc_create_pps_buf_cmd(struct msm_display_dsc_info *dsc, char *buf,
|
||||
int pps_id)
|
||||
{
|
||||
|
@ -362,6 +367,9 @@ static int dsi_panel_reset(struct dsi_panel *panel)
|
|||
struct dsi_panel_reset_config *r_config = &panel->reset_config;
|
||||
int i;
|
||||
|
||||
printk("kook: dsi_panel_reset\n");
|
||||
printk("%d %s chenwenmin r_config->reset_gpio=%d\n", __LINE__, __func__, r_config->reset_gpio);
|
||||
//return 0;
|
||||
if (gpio_is_valid(panel->reset_config.disp_en_gpio)) {
|
||||
rc = gpio_direction_output(panel->reset_config.disp_en_gpio, 1);
|
||||
if (rc) {
|
||||
|
@ -383,7 +391,7 @@ static int dsi_panel_reset(struct dsi_panel *panel)
|
|||
gpio_set_value(r_config->reset_gpio,
|
||||
r_config->sequence[i].level);
|
||||
|
||||
|
||||
printk("kook: reset value=%d, delay_time=%d", r_config->sequence[i].level, r_config->sequence[i].sleep_ms);
|
||||
if (r_config->sequence[i].sleep_ms)
|
||||
usleep_range(r_config->sequence[i].sleep_ms * 1000,
|
||||
(r_config->sequence[i].sleep_ms * 1000) + 100);
|
||||
|
@ -492,12 +500,17 @@ static int dsi_panel_power_off(struct dsi_panel *panel)
|
|||
{
|
||||
int rc = 0;
|
||||
|
||||
//return 0;
|
||||
if (gpio_is_valid(panel->reset_config.disp_en_gpio))
|
||||
gpio_set_value(panel->reset_config.disp_en_gpio, 0);
|
||||
|
||||
|
||||
if (gpio_is_valid(panel->reset_config.reset_gpio))
|
||||
gpio_set_value(panel->reset_config.reset_gpio, 1);//set high, mod by chenwenmin
|
||||
|
||||
if (gpio_is_valid(panel->reset_config.reset_gpio) &&
|
||||
!panel->reset_gpio_always_on)
|
||||
gpio_set_value(panel->reset_config.reset_gpio, 0);
|
||||
gpio_set_value(panel->reset_config.reset_gpio, 1);
|
||||
|
||||
if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio))
|
||||
gpio_set_value(panel->reset_config.lcd_mode_sel_gpio, 0);
|
||||
|
@ -660,6 +673,7 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
|
|||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
static int dsi_panel_update_pwm_backlight(struct dsi_panel *panel,
|
||||
u32 bl_lvl)
|
||||
{
|
||||
|
@ -710,12 +724,17 @@ static int dsi_panel_update_pwm_backlight(struct dsi_panel *panel,
|
|||
error:
|
||||
return rc;
|
||||
}
|
||||
|
||||
*/
|
||||
int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl)
|
||||
{
|
||||
int rc = 0;
|
||||
struct dsi_backlight_config *bl = &panel->bl_config;
|
||||
|
||||
if(bl_lvl > 0)
|
||||
backlight_val = true;
|
||||
else
|
||||
backlight_val = false;
|
||||
|
||||
if (panel->host_config.ext_bridge_mode)
|
||||
return 0;
|
||||
|
||||
|
@ -730,7 +749,8 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl)
|
|||
case DSI_BACKLIGHT_EXTERNAL:
|
||||
break;
|
||||
case DSI_BACKLIGHT_PWM:
|
||||
rc = dsi_panel_update_pwm_backlight(panel, bl_lvl);
|
||||
lcd_bl_set_led_brightness((int)bl_lvl);
|
||||
//rc = dsi_panel_update_pwm_backlight(panel, bl_lvl);
|
||||
break;
|
||||
default:
|
||||
DSI_ERR("Backlight type(%d) not supported\n", bl->type);
|
||||
|
@ -1733,6 +1753,10 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = {
|
|||
"qcom,mdss-dsi-post-mode-switch-on-command",
|
||||
"qcom,mdss-dsi-qsync-on-commands",
|
||||
"qcom,mdss-dsi-qsync-off-commands",
|
||||
"qcom,mdss-dsi-cabc-on-command",
|
||||
"qcom,mdss-dsi-cabc-off-command",
|
||||
"qcom,mdss-dsi-cabc_movie-on-command",
|
||||
"qcom,mdss-dsi-cabc_still-on-command",
|
||||
};
|
||||
|
||||
const char *cmd_set_state_map[DSI_CMD_SET_MAX] = {
|
||||
|
@ -1759,6 +1783,10 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = {
|
|||
"qcom,mdss-dsi-post-mode-switch-on-command-state",
|
||||
"qcom,mdss-dsi-qsync-on-commands-state",
|
||||
"qcom,mdss-dsi-qsync-off-commands-state",
|
||||
"qcom,mdss-dsi-cabc-on-command-state",
|
||||
"qcom,mdss-dsi-cabc-off-command-state",
|
||||
"qcom,mdss-dsi-cabc_movie-on-command-state",
|
||||
"qcom,mdss-dsi-cabc_still-on-command-state",
|
||||
};
|
||||
|
||||
static int dsi_panel_get_cmd_pkt_count(const char *data, u32 length, u32 *cnt)
|
||||
|
@ -2149,6 +2177,7 @@ static int dsi_panel_parse_gpios(struct dsi_panel *panel)
|
|||
|
||||
panel->reset_config.reset_gpio = utils->get_named_gpio(utils->data,
|
||||
reset_gpio_name, 0);
|
||||
DSI_ERR("kook: [%s], gpio=%d\n", panel->name, panel->reset_config.reset_gpio);
|
||||
if (!gpio_is_valid(panel->reset_config.reset_gpio) &&
|
||||
!panel->host_config.ext_bridge_mode) {
|
||||
rc = panel->reset_config.reset_gpio;
|
||||
|
@ -3283,6 +3312,8 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
|
|||
if (!panel->name)
|
||||
panel->name = DSI_PANEL_DEFAULT_LABEL;
|
||||
|
||||
strcpy(g_lcd_id,panel->name);
|
||||
|
||||
/*
|
||||
* Set panel type to LCD as default.
|
||||
*/
|
||||
|
@ -4147,6 +4178,30 @@ static int dsi_panel_roi_prepare_dcs_cmds(struct dsi_panel_cmd_set *set,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int dsi_panel_set_feature(struct dsi_panel *panel,enum dsi_cmd_set_type type)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!panel) {
|
||||
pr_err("Invalid params\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pr_info("hyper:%s panel_init_judge=%d type=%d,backlight_val = %d\n",__func__,panel_init_judge,type,backlight_val);
|
||||
if ((!panel_init_judge) || (!backlight_val)) {
|
||||
pr_err("hyper: con't set cmds type=%d\n",type);
|
||||
return -EINVAL;
|
||||
}
|
||||
mutex_lock(&panel->panel_lock);
|
||||
rc = dsi_panel_tx_cmd_set(panel, type);
|
||||
if (rc) {
|
||||
pr_err("[%s] failed to send DSI_CMD_SET_FEATURE_ON/OFF cmds, rc=%d,type=%d\n",
|
||||
panel->name, rc,type);
|
||||
}
|
||||
mutex_unlock(&panel->panel_lock);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int dsi_panel_send_qsync_on_dcs(struct dsi_panel *panel,
|
||||
int ctrl_idx)
|
||||
{
|
||||
|
@ -4366,8 +4421,10 @@ int dsi_panel_enable(struct dsi_panel *panel)
|
|||
if (rc)
|
||||
DSI_ERR("[%s] failed to send DSI_CMD_SET_ON cmds, rc=%d\n",
|
||||
panel->name, rc);
|
||||
else
|
||||
else {
|
||||
panel->panel_initialized = true;
|
||||
panel_init_judge = true;
|
||||
}
|
||||
mutex_unlock(&panel->panel_lock);
|
||||
return rc;
|
||||
}
|
||||
|
@ -4389,6 +4446,7 @@ int dsi_panel_post_enable(struct dsi_panel *panel)
|
|||
panel->name, rc);
|
||||
goto error;
|
||||
}
|
||||
panel_init_judge = true;
|
||||
error:
|
||||
mutex_unlock(&panel->panel_lock);
|
||||
return rc;
|
||||
|
@ -4414,6 +4472,8 @@ int dsi_panel_pre_disable(struct dsi_panel *panel)
|
|||
|
||||
error:
|
||||
mutex_unlock(&panel->panel_lock);
|
||||
panel->panel_initialized = false;
|
||||
panel_init_judge = false;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -4453,6 +4513,7 @@ int dsi_panel_disable(struct dsi_panel *panel)
|
|||
}
|
||||
}
|
||||
panel->panel_initialized = false;
|
||||
panel_init_judge = false;
|
||||
panel->power_mode = SDE_MODE_DPMS_OFF;
|
||||
|
||||
mutex_unlock(&panel->panel_lock);
|
||||
|
|
|
@ -104,6 +104,14 @@ struct dsi_panel_phy_props {
|
|||
enum dsi_panel_rotation rotation;
|
||||
};
|
||||
|
||||
struct dsi_whitep_display_para {
|
||||
int white_point_x;
|
||||
int white_point_y;
|
||||
u32 white_point_r;
|
||||
u32 white_point_g;
|
||||
u32 white_point_b;
|
||||
};
|
||||
|
||||
struct dsi_backlight_config {
|
||||
enum dsi_backlight_type type;
|
||||
enum bl_update_flag bl_update;
|
||||
|
@ -297,6 +305,8 @@ int dsi_panel_pre_disable(struct dsi_panel *panel);
|
|||
|
||||
int dsi_panel_disable(struct dsi_panel *panel);
|
||||
|
||||
int dsi_panel_set_feature(struct dsi_panel *panel,enum dsi_cmd_set_type type);
|
||||
|
||||
int dsi_panel_unprepare(struct dsi_panel *panel);
|
||||
|
||||
int dsi_panel_post_unprepare(struct dsi_panel *panel);
|
||||
|
|
|
@ -53,9 +53,7 @@ static int msm_notifier_fps_chg_callback(struct notifier_block *nb,
|
|||
* Default will be FPS60 and sent to scheduler during suspend.
|
||||
*/
|
||||
fps = notifier_data->refresh_rate;
|
||||
if (fps > FPS120)
|
||||
sched_fps = FPS144;
|
||||
else if (fps > FPS90)
|
||||
if (fps > FPS90)
|
||||
sched_fps = FPS120;
|
||||
else if (fps > FPS60)
|
||||
sched_fps = FPS90;
|
||||
|
|
|
@ -148,7 +148,7 @@ static int sde_backlight_setup(struct sde_connector *c_conn,
|
|||
display = (struct dsi_display *) c_conn->display;
|
||||
bl_config = &display->panel->bl_config;
|
||||
props.max_brightness = bl_config->brightness_max_level;
|
||||
props.brightness = bl_config->brightness_max_level;
|
||||
props.brightness = 1023;
|
||||
snprintf(bl_node_name, BL_NODE_NAME_SIZE, "panel%u-backlight",
|
||||
display_count);
|
||||
c_conn->bl_device = backlight_device_register(bl_node_name, dev->dev,
|
||||
|
@ -1378,6 +1378,10 @@ static int sde_connector_atomic_set_property(struct drm_connector *connector,
|
|||
/* connector-specific property handling */
|
||||
idx = msm_property_index(&c_conn->property_info, property);
|
||||
switch (idx) {
|
||||
case CONNECTOR_PROP_LP:
|
||||
if(connector->dev)
|
||||
connector->dev->doze_state = val;
|
||||
break;
|
||||
case CONNECTOR_PROP_OUT_FB:
|
||||
/* clear old fb, if present */
|
||||
if (c_state->out_fb)
|
||||
|
|
Loading…
Reference in a new issue