video: Add panel_notifier framework

This is designed to allow other drivers to know about panel events. It
also enables drivers to inject synchronous operations into the panel
state flow, by blocking the panel state changes at various points.

An example of this would be if a driver would l(CR) to know when a panel
is on and do an operation before the video stream to that panel begins.

Signed-off-by: Jared Suttles <jsuttles@motorola.com>
Reviewed-by: Shi-Yong Li <a22381@motorola.com>
Reviewed-by: Patrick Auchter <auchter@motorola.com>
Reviewed-by: Joseph Swantek <jswantek@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
Change-Id: I94594c93e2b989ff93271f116e010baaf774c6de
Reviewed-on: https://gerrit.mot.com/1469162
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1470251
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Reviewed-on: https://gerrit.mot.com/1509864
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
This commit is contained in:
Jared Suttles authored and Gilberto Gambugge committed 2023-06-01 00:47:06 -03:00
1 parent 58c6b1a5eb
commit ce7d3d8c48
4 files changed
+89

No files matched your search

+5
View File
@@ -45,5 +45,10 @@ if FB || SGI_NEWPORT_CONSOLE
endif
config PANEL_NOTIFICATIONS
bool 'Panel notifications'
default n
---help---
Panel notifications framework
endmenu
+1
View File
@@ -13,3 +13,4 @@ obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o
ifeq ($(CONFIG_OF),y)
obj-$(CONFIG_VIDEOMODE_HELPERS) += of_display_timing.o of_videomode.o
endif
obj-$(CONFIG_PANEL_NOTIFICATIONS) += panel_notifier.o
+34
View File
@@ -0,0 +1,34 @@
/* Copyright (c) 2016, Motorola Mobility, LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/panel_notifier.h>
static BLOCKING_NOTIFIER_HEAD(panel_notifier_list);
int panel_notify(unsigned int event, void *data)
{
return blocking_notifier_call_chain(&panel_notifier_list, event, data);
}
EXPORT_SYMBOL_GPL(panel_notify);
int panel_register_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&panel_notifier_list, nb);
}
EXPORT_SYMBOL_GPL(panel_register_notifier);
int panel_unregister_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&panel_notifier_list, nb);
}
EXPORT_SYMBOL_GPL(panel_unregister_notifier);
+49
View File
@@ -0,0 +1,49 @@
/* Copyright (c) 2016, Motorola Mobility, LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __PANEL_NOTIFIER_H__
#define __PANEL_NOTIFIER_H__
#include <linux/notifier.h>
enum panel_event {
PANEL_EVENT_PRE_DISPLAY_OFF,
PANEL_EVENT_PRE_DISPLAY_ON,
PANEL_EVENT_DISPLAY_OFF,
PANEL_EVENT_DISPLAY_ON,
};
#ifdef CONFIG_PANEL_NOTIFICATIONS
int panel_register_notifier(struct notifier_block *nb);
int panel_unregister_notifier(struct notifier_block *nb);
int panel_notify(unsigned int event, void *data);
#else
#include <linux/errno.h>
static inline int panel_register_notifier(struct notifier_block *nb)
{
return -ENOSYS;
}
static inline int panel_unregister_notifier(struct notifier_block *nb)
{
return -ENOSYS;
}
static inline int panel_notify(unsigned int event, void *data)
{
return -ENOSYS;
}
#endif
#endif