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

View File

@ -68,7 +68,7 @@ EXPORT_SYMBOL(msm_drm_unregister_client);
* event(unblank or power down).
*/
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))
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,
v);
}
EXPORT_SYMBOL(msm_drm_notifier_call_chain);
void msm_drm_notifier_enable(bool val)
{

View File

@ -23,6 +23,10 @@
enum {
/* panel: power on */
MSM_DRM_BLANK_UNBLANK,
MSM_DRM_BLANK_LP1,
MSM_DRM_BLANK_LP2,
MSM_DRM_BLANK_STANDBY,
MSM_DRM_BLANK_SUSPEND,
/* panel: power off */
MSM_DRM_BLANK_POWERDOWN,
};
@ -42,4 +46,5 @@ struct msm_drm_notifier {
int msm_drm_register_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