drm/msm: Extend drm notifier

Change-Id: Id266a34b20403a9f3ef445902730f293712bf260
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Demon000 2019-12-02 03:49:20 +01:00 committed by Richard Raya
parent 67b2692daa
commit a89662c51b
3 changed files with 21 additions and 2 deletions

View File

@ -19,6 +19,8 @@
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/msm_drm_notify.h>
#include "msm_drv.h" #include "msm_drv.h"
#include "sde_connector.h" #include "sde_connector.h"
#include "msm_mmu.h" #include "msm_mmu.h"
@ -1060,6 +1062,7 @@ int dsi_display_set_power(struct drm_connector *connector,
int power_mode, void *disp) int power_mode, void *disp)
{ {
struct dsi_display *display = disp; struct dsi_display *display = disp;
struct msm_drm_notifier notify_data;
int rc = 0; int rc = 0;
if (!display || !display->panel) { if (!display || !display->panel) {
@ -1067,17 +1070,27 @@ int dsi_display_set_power(struct drm_connector *connector,
return -EINVAL; return -EINVAL;
} }
notify_data.data = &power_mode;
notify_data.id = MSM_DRM_PRIMARY_DISPLAY;
switch (power_mode) { switch (power_mode) {
case SDE_MODE_DPMS_LP1: case SDE_MODE_DPMS_LP1:
msm_drm_notifier_call_chain(MSM_DRM_EARLY_EVENT_BLANK, &notify_data);
rc = dsi_panel_set_lp1(display->panel); rc = dsi_panel_set_lp1(display->panel);
msm_drm_notifier_call_chain(MSM_DRM_EVENT_BLANK, &notify_data);
break; break;
case SDE_MODE_DPMS_LP2: case SDE_MODE_DPMS_LP2:
msm_drm_notifier_call_chain(MSM_DRM_EARLY_EVENT_BLANK, &notify_data);
rc = dsi_panel_set_lp2(display->panel); rc = dsi_panel_set_lp2(display->panel);
msm_drm_notifier_call_chain(MSM_DRM_EVENT_BLANK, &notify_data);
break; break;
case SDE_MODE_DPMS_ON: case SDE_MODE_DPMS_ON:
if (display->panel->power_mode == SDE_MODE_DPMS_LP1 || if (display->panel->power_mode == SDE_MODE_DPMS_LP1 ||
display->panel->power_mode == SDE_MODE_DPMS_LP2) display->panel->power_mode == SDE_MODE_DPMS_LP2) {
msm_drm_notifier_call_chain(MSM_DRM_EARLY_EVENT_BLANK, &notify_data);
rc = dsi_panel_set_nolp(display->panel); rc = dsi_panel_set_nolp(display->panel);
msm_drm_notifier_call_chain(MSM_DRM_EVENT_BLANK, &notify_data);
}
break; break;
case SDE_MODE_DPMS_OFF: case SDE_MODE_DPMS_OFF:
default: default:

View File

@ -68,7 +68,7 @@ EXPORT_SYMBOL(msm_drm_unregister_client);
* event(unblank or power down). * event(unblank or power down).
*/ */
static bool notifier_enabled __read_mostly = true; static bool notifier_enabled __read_mostly = true;
static int msm_drm_notifier_call_chain(unsigned long val, void *v) int msm_drm_notifier_call_chain(unsigned long val, void *v)
{ {
if (unlikely(!notifier_enabled)) if (unlikely(!notifier_enabled))
return 0; return 0;
@ -76,6 +76,7 @@ static int msm_drm_notifier_call_chain(unsigned long val, void *v)
return blocking_notifier_call_chain(&msm_drm_notifier_list, val, return blocking_notifier_call_chain(&msm_drm_notifier_list, val,
v); v);
} }
EXPORT_SYMBOL(msm_drm_notifier_call_chain);
void msm_drm_notifier_enable(bool val) void msm_drm_notifier_enable(bool val)
{ {

View File

@ -23,6 +23,10 @@
enum { enum {
/* panel: power on */ /* panel: power on */
MSM_DRM_BLANK_UNBLANK, MSM_DRM_BLANK_UNBLANK,
MSM_DRM_BLANK_LP1,
MSM_DRM_BLANK_LP2,
MSM_DRM_BLANK_STANDBY,
MSM_DRM_BLANK_SUSPEND,
/* panel: power off */ /* panel: power off */
MSM_DRM_BLANK_POWERDOWN, MSM_DRM_BLANK_POWERDOWN,
}; };
@ -42,4 +46,5 @@ struct msm_drm_notifier {
int msm_drm_register_client(struct notifier_block *nb); int msm_drm_register_client(struct notifier_block *nb);
int msm_drm_unregister_client(struct notifier_block *nb); int msm_drm_unregister_client(struct notifier_block *nb);
int msm_drm_notifier_call_chain(unsigned long val, void *v);
#endif #endif