diff --git a/drivers/video/fbdev/msm/mdss.h b/drivers/video/fbdev/msm/mdss.h index cdb76fd2978a..7f4bcf2a7bd6 100644 --- a/drivers/video/fbdev/msm/mdss.h +++ b/drivers/video/fbdev/msm/mdss.h @@ -512,6 +512,7 @@ struct mdss_data_type { u32 min_prefill_lines; /* this changes within different chipsets */ u32 props; + bool twm_en; int handoff_pending; bool idle_pc; struct mdss_perf_tune perf_tune; diff --git a/drivers/video/fbdev/msm/mdss_mdp.c b/drivers/video/fbdev/msm/mdss_mdp.c index 70b2729cbb7e..afd11b5eb603 100644 --- a/drivers/video/fbdev/msm/mdss_mdp.c +++ b/drivers/video/fbdev/msm/mdss_mdp.c @@ -2889,13 +2889,55 @@ static ssize_t mdss_mdp_store_max_limit_bw(struct device *dev, return len; } +static ssize_t mdss_mdp_store_twm(struct device *dev, + struct device_attribute *attr, const char *buf, size_t len) +{ + struct mdss_data_type *mdata = mdss_mdp_get_mdata(); + u32 data = -1; + ssize_t rc = 0; + + if (!mdata) { + pr_err("Invalid mdata structure\n"); + return -EINVAL; + } + + rc = kstrtoint(buf, 10, &data); + if (rc) { + pr_err("kstrtoint failed. rc=%zd\n", rc); + return rc; + } + mdata->twm_en = data ? true : false; + pr_err("TWM : %s\n", (mdata->twm_en) ? + "ENABLED" : "DISABLED"); + return len; +} + +static ssize_t mdss_mdp_show_twm(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mdss_data_type *mdata = mdss_mdp_get_mdata(); + ssize_t ret = 0; + + if (!mdata) { + pr_err("Invalid mdata structure\n"); + return -EINVAL; + } + + pr_err("TWM : %s\n", (mdata->twm_en) ? + "ENABLED" : "DISABLED"); + ret = snprintf(buf, PAGE_SIZE, "%d\n", mdata->twm_en); + return ret; +} + static DEVICE_ATTR(caps, 0444, mdss_mdp_show_capabilities, NULL); static DEVICE_ATTR(bw_mode_bitmap, 0664, mdss_mdp_read_max_limit_bw, mdss_mdp_store_max_limit_bw); +static DEVICE_ATTR(twm_enable, 0664, mdss_mdp_show_twm, mdss_mdp_store_twm); static struct attribute *mdp_fs_attrs[] = { &dev_attr_caps.attr, &dev_attr_bw_mode_bitmap.attr, + &dev_attr_twm_enable.attr, NULL }; diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c index 16e4423ec35d..552158add3ad 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c +++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c @@ -6422,6 +6422,13 @@ static void mdss_mdp_signal_retire_fence(struct msm_fb_data_type *mfd, pr_debug("Signaled (%d) pending retire fence\n", retire_cnt); } +static bool mdss_mdp_is_twm_en(void) +{ + struct mdss_data_type *mdata = mdss_mdp_get_mdata(); + + return (mdata && mdata->twm_en); +} + int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd) { struct device *dev = mfd->fbi->dev; @@ -6464,7 +6471,7 @@ int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd) mdp5_interface->signal_retire_fence = mdss_mdp_signal_retire_fence; mdp5_interface->enable_panel_disable_mode = mdss_mdp_enable_panel_disable_mode; - mdp5_interface->is_twm_en = NULL; + mdp5_interface->is_twm_en = mdss_mdp_is_twm_en; /* * Register footswitch control only for primary fb pm