Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c
- index a7267e362ab16..37d8784a0730c 100644
- --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c
- +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c
- @@ -35,6 +35,7 @@
- #include "dsi_drm.h"
- #include "dsi_display.h"
- #include "sde_crtc.h"
- +#include "sde_hw_mdss.h"
- #include "sde_rm.h"
- #include "sde_trace.h"
- /**
- @@ -740,8 +741,9 @@ static int dsi_panel_power_off(struct dsi_panel *panel)
- return rc;
- }
- -int dsi_panel_tx_cmd_set(struct dsi_panel *panel,
- - enum dsi_cmd_set_type type)
- +static int __dsi_panel_tx_cmd_set(struct dsi_panel *panel,
- + enum dsi_cmd_set_type type,
- + bool wait)
- {
- int rc = 0, i = 0;
- ssize_t len;
- @@ -779,7 +781,7 @@ int dsi_panel_tx_cmd_set(struct dsi_panel *panel,
- pr_err("failed to set cmds(%d), rc=%d\n", type, rc);
- goto error;
- }
- - if (cmds->post_wait_ms)
- + if (wait && cmds->post_wait_ms)
- usleep_range(cmds->post_wait_ms*1000,
- ((cmds->post_wait_ms*1000)+10));
- cmds++;
- @@ -788,6 +790,12 @@ int dsi_panel_tx_cmd_set(struct dsi_panel *panel,
- return rc;
- }
- +int dsi_panel_tx_cmd_set(struct dsi_panel *panel,
- + enum dsi_cmd_set_type type)
- +{
- + return __dsi_panel_tx_cmd_set(panel, type, true);
- +}
- +
- static int dsi_panel_pinctrl_deinit(struct dsi_panel *panel)
- {
- int rc = 0;
- @@ -956,58 +964,56 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
- return rc;
- }
- -int dsi_panel_op_set_hbm_mode(struct dsi_panel *panel, int level)
- +int hbm_level;
- +static struct dsi_panel *hbm_panel;
- +static void set_hbm_mode(struct work_struct *work)
- {
- - int rc = 0;
- - u32 count;
- - struct dsi_display_mode *mode;
- + struct dsi_panel *panel = hbm_panel;
- + int level = hbm_level;
- - if (!panel || !panel->cur_mode) {
- - pr_err("Invalid params\n");
- - return -EINVAL;
- - }
- + /*
- + * Bypass the command post delay by calling __dsi_panel_tx_cmd_set().
- + * Out-of-sync FOD is less noticeable this way.
- + */
- mutex_lock(&panel->panel_lock);
- -
- - mode = panel->cur_mode;
- switch (level) {
- case 0:
- - count = mode->priv_info->cmd_sets[DSI_CMD_SET_HBM_OFF].count;
- - if (!count) {
- - pr_err("This panel does not support HBM mode off.\n");
- - goto error;
- - } else {
- - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_OFF);
- - printk(KERN_ERR
- - "When HBM OFF -->hbm_backight = %d panel->bl_config.bl_level =%d\n",
- - panel->hbm_backlight, panel->bl_config.bl_level);
- - rc = dsi_panel_update_backlight(panel,
- - panel->hbm_backlight);
- - }
- + __dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_OFF, false);
- + printk(KERN_ERR
- + "When HBM OFF -->hbm_backight = %d panel->bl_config.bl_level =%d\n",
- + panel->hbm_backlight, panel->bl_config.bl_level);
- + dsi_panel_update_backlight(panel, panel->hbm_backlight);
- break;
- -
- case 1:
- - count = mode->priv_info->cmd_sets[DSI_CMD_SET_HBM_ON_5].count;
- - if (!count) {
- - pr_err("This panel does not support HBM mode.\n");
- - goto error;
- - } else {
- - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_ON_5);
- - }
- - break;
- - default:
- + __dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_ON_5, false);
- break;
- -
- }
- - pr_err("Set HBM Mode = %d\n", level);
- - if (level == 5) {
- - pr_err("HBM == 5 for fingerprint\n");
- + mutex_unlock(&panel->panel_lock);
- +
- + pr_info("Set HBM Mode = %d\n", level);
- +}
- +
- +DECLARE_WORK(hbm_work, set_hbm_mode);
- +/*
- + * This function is used only for "op_friginer_print_hbm".
- + *
- + * As we are triggering hbm_work after dim layer is committed,
- + * remove the call here.
- + */
- +int dsi_panel_op_set_hbm_mode(struct dsi_panel *panel, int level)
- +{
- + if (!panel || !panel->cur_mode) {
- + pr_err("Invalid params\n");
- + return -EINVAL;
- }
- -error:
- - mutex_unlock(&panel->panel_lock);
- + hbm_panel = panel;
- + hbm_level = level;
- - return rc;
- + // queue_work(system_highpri_wq, &hbm_work);
- +
- + return 0;
- }
- static int dsi_panel_update_pwm_backlight(struct dsi_panel *panel,
- diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
- index 0678fb5718efc..e682d563b0c4b 100644
- --- a/drivers/gpu/drm/msm/msm_atomic.c
- +++ b/drivers/gpu/drm/msm/msm_atomic.c
- @@ -24,6 +24,7 @@
- #include "msm_gem.h"
- #include "msm_fence.h"
- #include "sde_trace.h"
- +#include "sde_hw_mdss.h"
- #define MULTIPLE_CONN_DETECTED(x) (x > 1)
- @@ -581,6 +582,8 @@ static void msm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
- /* The (potentially) asynchronous part of the commit. At this point
- * nothing can fail short of armageddon.
- */
- +extern struct work_struct hbm_work;
- +extern int hbm_level;
- static void complete_commit(struct msm_commit *c)
- {
- struct drm_atomic_state *state = c->state;
- @@ -619,6 +622,14 @@ static void complete_commit(struct msm_commit *c)
- drm_atomic_state_put(state);
- + // Ensure dim layer frame is committed
- + if (unlikely(sde_hw_dim_status & DIM_LAYER_REQUESTED)) {
- + sde_hw_dim_status ^= DIM_LAYER_REQUESTED;
- + hbm_level = sde_hw_dim_status;
- + mb();
- + queue_work(system_highpri_wq, &hbm_work);
- + }
- +
- priv->commit_end_time = ktime_get(); //commit end time
- commit_destroy(c);
- diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c
- index 8814705548b2f..a01aee16a8780 100644
- --- a/drivers/gpu/drm/msm/sde/sde_crtc.c
- +++ b/drivers/gpu/drm/msm/sde/sde_crtc.c
- @@ -3160,6 +3160,11 @@ static void _sde_crtc_clear_dim_layers_v1(struct sde_crtc_state *cstate)
- memset(&cstate->dim_layer[i], 0, sizeof(cstate->dim_layer[i]));
- cstate->num_dim_layers = 0;
- +
- + if (unlikely(sde_hw_dim_status != 0)) {
- + sde_hw_dim_status = DIM_LAYER_INACTIVE | DIM_LAYER_REQUESTED;
- + mb();
- + }
- }
- /**
- @@ -3208,6 +3213,14 @@ static void _sde_crtc_set_dim_layer_v1(struct drm_crtc *crtc,
- }
- /* populate from user space */
- cstate->num_dim_layers = count;
- + if (count == 0) {
- + if (unlikely(sde_hw_dim_status != 0)) {
- + sde_hw_dim_status = DIM_LAYER_INACTIVE | DIM_LAYER_REQUESTED;
- + mb();
- + }
- + return;
- + }
- +
- for (i = 0; i < count; i++) {
- user_cfg = &dim_layer_v1.layer_cfg[i];
- diff --git a/drivers/gpu/drm/msm/sde/sde_hw_lm.c b/drivers/gpu/drm/msm/sde/sde_hw_lm.c
- index 9b8d253bd9d78..a9bff28f6c528 100644
- --- a/drivers/gpu/drm/msm/sde/sde_hw_lm.c
- +++ b/drivers/gpu/drm/msm/sde/sde_hw_lm.c
- @@ -194,6 +194,7 @@ static void sde_hw_lm_clear_dim_layer(struct sde_hw_mixer *ctx)
- }
- }
- +u32 sde_hw_dim_status;
- static void sde_hw_lm_setup_dim_layer(struct sde_hw_mixer *ctx,
- struct sde_hw_dim_layer *dim_layer)
- {
- @@ -210,7 +211,14 @@ static void sde_hw_lm_setup_dim_layer(struct sde_hw_mixer *ctx,
- return;
- }
- - alpha = dim_layer->color_fill.color_3 & 0xFF;
- + if (dim_layer->color_fill.color_3) {
- + if (!(sde_hw_dim_status & DIM_LAYER_ACTIVE))
- + sde_hw_dim_status = DIM_LAYER_ACTIVE | DIM_LAYER_REQUESTED;
- + alpha = dim_layer->color_fill.color_3 & 0xFF;
- + } else if (unlikely(sde_hw_dim_status != 0)) {
- + sde_hw_dim_status = DIM_LAYER_INACTIVE | DIM_LAYER_REQUESTED;
- + }
- + mb();
- val = ((dim_layer->color_fill.color_1 << 2) & 0xFFF) << 16 |
- ((dim_layer->color_fill.color_0 << 2) & 0xFFF);
- SDE_REG_WRITE(c, LM_FG_COLOR_FILL_COLOR_0 + stage_off, val);
- diff --git a/drivers/gpu/drm/msm/sde/sde_hw_mdss.h b/drivers/gpu/drm/msm/sde/sde_hw_mdss.h
- index 05b071080dd08..df689aed4ece2 100644
- --- a/drivers/gpu/drm/msm/sde/sde_hw_mdss.h
- +++ b/drivers/gpu/drm/msm/sde/sde_hw_mdss.h
- @@ -560,6 +560,12 @@ struct sde_hw_dim_layer {
- struct sde_mdss_color color_fill;
- struct sde_rect rect;
- };
- +
- +extern u32 sde_hw_dim_status;
- +#define DIM_LAYER_INACTIVE 0x00
- +#define DIM_LAYER_ACTIVE 0x01
- +#define DIM_LAYER_REQUESTED 0x02
- +
- struct fingerprint_dim_layer {
- uint32_t flags;
- uint32_t stage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement