Skip to content

Commit

Permalink
Revert "msm: mdss: Display gamma control"
Browse files Browse the repository at this point in the history
Revert "msm: mdss: Find a stable sysfs node for the gamma interface"

This reverts commit c2a2b4b.

Revert "msm: mdss: Use workqueue to send panel commands"

This reverts commit 156ef6e.

Revert "msm: mdss: Add hardware revision check"

This reverts commit e052679.

Revert "msm: mdss: Send panel commands via separate function"

This reverts commit c48d2bd.

Revert "msm: mdss: Finalize gamma interface and cleanup"

This reverts commit 4b60904.

Revert "msm: mdss: Add safety check for user input"

This reverts commit 3dde29a.

Revert "msm: mdss: Identify white point in sysfs"

This reverts commit 0e6c274.

Revert "msm: mdss: Remove sysfs for unused commands"

This reverts commit be24ec4.

Revert "msm: mdss: distinguish between Gamma RGB polarity Positive/Negative"

This reverts commit bcbda55.

Revert "msm: mdss: Remove tunable for command 32"

This reverts commit 6adf294.

Revert "msm: mdss: Apply commands values without switching screen (off and) on"

This reverts commit 4533a5f.

Revert "msm: mdss: Display gamma control"

This reverts commit 8075124.
  • Loading branch information
Slmnj committed Oct 7, 2021
1 parent 78aa360 commit b8fa31d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 217 deletions.
3 changes: 0 additions & 3 deletions drivers/video/msm/mdss/mdss_dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

static unsigned char *mdss_dsi_base;
static int mdss_dsi_use_vdd_supply = 1;
extern struct mdss_panel_data *cmds_panel_data;

static int mdss_dsi_regulator_init(struct platform_device *pdev)
{
Expand Down Expand Up @@ -131,8 +130,6 @@ static int mdss_dsi_panel_power_on(struct mdss_panel_data *pdata, int enable)
panel_data);
pr_debug("%s: enable=%d\n", __func__, enable);

cmds_panel_data = pdata;

if (enable) {
if (ctrl_pdata->power_data.num_vreg > 0) {
ret = msm_dss_enable_vreg(
Expand Down
217 changes: 3 additions & 214 deletions drivers/video/msm/mdss/mdss_dsi_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@

#include "mdss_dsi.h"

#include <asm/system_info.h>

#define DT_CMD_HDR 6
#define GAMMA_COMPAT 11

static bool mdss_panel_flip_ud = false;
static int mdss_panel_id = PANEL_QCOM;
Expand All @@ -40,11 +37,6 @@ extern void lm3630_lcd_backlight_set_level(int level);
#endif

static struct mdss_dsi_phy_ctrl phy_params;
static struct mdss_panel_common_pdata *local_pdata;
static struct work_struct send_cmds_work;
struct mdss_panel_data *cmds_panel_data;
static struct platform_driver this_driver;
struct kobject *module_kobj;

bool display_on = true;

Expand Down Expand Up @@ -302,8 +294,8 @@ static int mdss_dsi_panel_on(struct mdss_panel_data *pdata)

pr_debug("%s: ctrl=%pK ndx=%d\n", __func__, ctrl, ctrl->ndx);

if (local_pdata->on_cmds.cmd_cnt)
mdss_dsi_panel_cmds_send(ctrl, &local_pdata->on_cmds);
if (ctrl->on_cmds.cmd_cnt)
mdss_dsi_panel_cmds_send(ctrl, &ctrl->on_cmds);

pr_info("%s\n", __func__);
return 0;
Expand Down Expand Up @@ -767,198 +759,11 @@ static int mdss_panel_parse_dt(struct platform_device *pdev,
return -EINVAL;
}

static int read_local_on_cmds(char *buf, size_t cmd)
{
int i, len = 0;
int dlen;

if (system_rev != GAMMA_COMPAT) {
pr_err("Incompatible hardware revision: %d\n", system_rev);
return -EINVAL;
}

dlen = local_pdata->on_cmds.cmds[cmd].dchdr.dlen - 1;
if (!dlen)
return -ENOMEM;

/* don't print first and last bits */
for (i = 1; i < dlen; i++)
len += sprintf(buf + len, "%d ",
local_pdata->on_cmds.cmds[cmd].payload[i]);

len += sprintf(buf + len, "\n");

return len;
}

static unsigned int cnt;

static int write_local_on_cmds(struct device *dev, const char *buf,
size_t cmd)
{
int i, rc = 0;
int dlen;
unsigned int val;
char tmp[3];
struct mdss_dsi_ctrl_pdata *ctrl = NULL;
struct mdss_panel_common_pdata *prev_local_data;

if (cnt) {
cnt = 0;
return -EINVAL;
}

if (system_rev != GAMMA_COMPAT) {
pr_err("Incompatible hardware revision: %d\n", system_rev);
return -EINVAL;
}

if (cmds_panel_data == NULL) {
pr_err("%s: Invalid input data\n", __func__);
return -EINVAL;
}

ctrl = container_of(cmds_panel_data, struct mdss_dsi_ctrl_pdata,
panel_data);

/*
* Last bit is not written because it's either fixed at 0x00 for
* RGB or a duplicate of the previous bit for the white point.
*/
dlen = local_pdata->on_cmds.cmds[cmd].dchdr.dlen - 1;
if (!dlen)
return -EINVAL;

prev_local_data = local_pdata;

for (i = 1; i < dlen; i++) {
rc = sscanf(buf, "%u", &val);
if (rc != 1)
return -EINVAL;

if (val > 255) {
pr_err("%s: Invalid input data %u (0-255)\n", __func__, val);
local_pdata = prev_local_data;
return -EINVAL;
}

local_pdata->on_cmds.cmds[cmd].payload[i] = val;
/* white point value must be duplicated */
if (cmd == 5)
local_pdata->on_cmds.cmds[cmd].payload[i + 1] = val;

sscanf(buf, "%s", tmp);
buf += strlen(tmp) + 1;
cnt = strlen(tmp);
}

pr_info("%s\n", __func__);

return rc;
}

static void send_local_on_cmds(struct work_struct *work)
{
struct mdss_dsi_ctrl_pdata *ctrl = NULL;

if (cmds_panel_data == NULL) {
pr_err("%s: Invalid input data\n", __func__);
return;
}

ctrl = container_of(cmds_panel_data, struct mdss_dsi_ctrl_pdata,
panel_data);

if (local_pdata->on_cmds.cmd_cnt)
mdss_dsi_panel_cmds_send(ctrl, &local_pdata->on_cmds);

pr_info("%s\n", __func__);
}

/************************** sysfs interface ************************/

static ssize_t write_kgamma_send(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
if (!cmds_panel_data->panel_info.panel_power_on) {
pr_err("%s: Panel off, failed to send commands\n", __func__);
return -EPERM;
}

schedule_work(&send_cmds_work);

return count;
}

static DEVICE_ATTR(kgamma_send, 0644, NULL, write_kgamma_send);

#define read_one(file_name, cmd) \
static ssize_t read_##file_name \
(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return read_local_on_cmds(buf, cmd); \
}

read_one(kgamma_w, 5);
read_one(kgamma_rp, 7);
read_one(kgamma_rn, 9);
read_one(kgamma_gp, 11);
read_one(kgamma_gn, 13);
read_one(kgamma_bp, 15);
read_one(kgamma_bn, 17);

#define write_one(file_name, cmd) \
static ssize_t write_##file_name \
(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
return write_local_on_cmds(dev, buf, cmd); \
}

write_one(kgamma_w, 5);
write_one(kgamma_rp, 7);
write_one(kgamma_rn, 9);
write_one(kgamma_gp, 11);
write_one(kgamma_gn, 13);
write_one(kgamma_bp, 15);
write_one(kgamma_bn, 17);

#define define_one_rw(_name) \
static DEVICE_ATTR(_name, 0644, read_##_name, write_##_name);

define_one_rw(kgamma_w);
define_one_rw(kgamma_rp);
define_one_rw(kgamma_rn);
define_one_rw(kgamma_gp);
define_one_rw(kgamma_gn);
define_one_rw(kgamma_bp);
define_one_rw(kgamma_bn);

static struct attribute *dsi_panel_attributes[] = {
&dev_attr_kgamma_w.attr,
&dev_attr_kgamma_rp.attr,
&dev_attr_kgamma_rn.attr,
&dev_attr_kgamma_gp.attr,
&dev_attr_kgamma_gn.attr,
&dev_attr_kgamma_bp.attr,
&dev_attr_kgamma_bn.attr,
&dev_attr_kgamma_send.attr,
NULL
};

static struct attribute_group dsi_panel_attribute_group = {
.attrs = dsi_panel_attributes,
};

/**************************** sysfs end **************************/

static int __devinit mdss_dsi_panel_probe(struct platform_device *pdev)
{
int rc = 0;
static struct mdss_panel_common_pdata vendor_pdata;
static const char *panel_name;
const char *driver_name = this_driver.driver.name;

pr_debug("%s:%d, debug info id=%d", __func__, __LINE__, pdev->id);
if (!pdev->dev.of_node)
Expand All @@ -983,23 +788,7 @@ static int __devinit mdss_dsi_panel_probe(struct platform_device *pdev)
if (rc)
return rc;

INIT_WORK(&send_cmds_work, send_local_on_cmds);

local_pdata = &vendor_pdata;
if (!local_pdata)
return -EINVAL;

module_kobj = kobject_create_and_add(driver_name, &module_kset->kobj);
if (!module_kobj) {
pr_err("%s: kobject create failed\n", driver_name);
return -ENOMEM;
}

rc = sysfs_create_group(module_kobj, &dsi_panel_attribute_group);
if (rc)
pr_err("%s: sysfs create failed: %d\n", panel_name, rc);

return rc;
return 0;
}

static const struct of_device_id mdss_dsi_panel_match[] = {
Expand Down

0 comments on commit b8fa31d

Please sign in to comment.