dsi: pushing display notifications

Pushing display notifications when it is turning on and off, so
registered listener can become aware of it state.

Change-Id: I5ae139d5a9099a86d94f54f7495ddf12659c98ba
Signed-off-by: Konstantin Makariev <hcv867@motorola.com>
Reviewed-on: https://gerrit.mot.com/1697625
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Konstantin Makariev 2019-12-10 13:32:51 -06:00 • committed by tongkun1
commit 3138d03a75
3 changed files with 42 additions and 2 deletions

View file

@ -6480,11 +6480,15 @@ int dsi_display_dev_probe(struct platform_device *pdev)
display->display_type = of_get_property(pdev->dev.of_node,
"label", NULL);
if (!display->display_type)
if (!display->display_type) {
display->display_type = "primary";
display->display_idx = 0;
}
if (!strcmp(display->display_type, "secondary"))
if (!strcmp(display->display_type, "secondary")) {
index = DSI_SECONDARY;
display->display_idx = 1;
}
boot_disp = &boot_displays[index];
node = pdev->dev.of_node;

View file

@ -145,6 +145,7 @@ struct dsi_display_ext_bridge {
* @ext_conn: Pointer to external connector attached to DSI connector
* @name: Name of the display.
* @display_type: Display type as defined in device tree.
* @display_idx: Display index (0-primary, 1-secondary)
* @list: List pointer.
* @is_active: Is display active.
* @is_cont_splash_enabled: Is continuous splash enabled
@ -209,6 +210,7 @@ struct dsi_display {
const char *name;
const char *display_type;
int display_idx;
struct list_head list;
bool is_cont_splash_enabled;
bool sw_te_using_wd;

View file

@ -11,6 +11,17 @@
#include <linux/pwm.h>
#include <video/mipi_display.h>
#if defined(CONFIG_PANEL_NOTIFICATIONS)
#include <linux/panel_notifier.h>
#define PANEL_NOTIFY(note) { \
int idx = dsi_panel_get_index(panel); \
panel_notify(note, (void *)&idx); \
}
#else
#define PANEL_NOTIFY(...)
#endif
#include "dsi_display.h"
#include "dsi_panel.h"
#include "dsi_ctrl_hw.h"
@ -5285,6 +5296,19 @@ int dsi_panel_post_switch(struct dsi_panel *panel)
return rc;
}
#if defined(CONFIG_PANEL_NOTIFICATIONS)
static inline int dsi_panel_get_index(struct dsi_panel *panel)
{
struct dsi_display *dsi_display =
container_of(panel->host, struct dsi_display, host);
if (unlikely(dsi_display == NULL))
return -EINVAL;
return dsi_display->display_idx;
}
#endif
int dsi_panel_enable(struct dsi_panel *panel)
{
int rc = 0;
@ -5334,6 +5358,9 @@ int dsi_panel_enable(struct dsi_panel *panel)
DSI_INFO("-: no_panel_on_read_support is set\n");
panel->panel_initialized = true;
PANEL_NOTIFY(PANEL_EVENT_PRE_DISPLAY_ON);
err:
mutex_unlock(&panel->panel_lock);
@ -5365,6 +5392,9 @@ int dsi_panel_post_enable(struct dsi_panel *panel)
panel->name, rc);
}
}
PANEL_NOTIFY(PANEL_EVENT_DISPLAY_ON);
error:
mutex_unlock(&panel->panel_lock);
return rc;
@ -5391,6 +5421,8 @@ int dsi_panel_pre_disable(struct dsi_panel *panel)
goto error;
}
PANEL_NOTIFY(PANEL_EVENT_PRE_DISPLAY_OFF);
error:
mutex_unlock(&panel->panel_lock);
return rc;
@ -5439,6 +5471,8 @@ int dsi_panel_disable(struct dsi_panel *panel)
panel->panel_initialized = false;
panel->power_mode = SDE_MODE_DPMS_OFF;
PANEL_NOTIFY(PANEL_EVENT_DISPLAY_OFF);
mutex_unlock(&panel->panel_lock);
return rc;
}