lcd_uevent_ops is registered from all display plugin initialization.
It controls touchscreen_ops stop/start through uevent.
All the plugins have same lcd_uevent_changed() logic.
Thus it is relocated to display core.
Change-Id: Ie42b11f6f20e77463ea81dcf72aee662d368c5d5
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
return 0;
}
-static void esd_action(void)
-{
- const struct device_ops *touchscreen_ops = NULL;
-
- _I("ESD on");
-
- touchscreen_ops = find_device("touchscreen");
-
- if (!check_default(touchscreen_ops))
- touchscreen_ops->stop(NORMAL_MODE);
- display_panel_set_panel_state_by_off_state(NORMAL_MODE);
- display_panel_set_panel_state_by_on_state(NORMAL_MODE);
- if (!check_default(touchscreen_ops))
- touchscreen_ops->start(NORMAL_MODE);
-}
-
-static void lcd_uevent_changed(struct udev_device *dev)
-{
- const char *devpath;
- const char *action;
-
- devpath = udev_device_get_devpath(dev);
- if (!devpath)
- return;
-
- if (!fnmatch(LCD_ESD_PATH, devpath, 0)) {
- action = udev_device_get_action(dev);
- if (!strcmp(action, UDEV_CHANGE))
- esd_action();
- }
-}
-
-static const struct uevent_handler lcd_uevent_ops = {
- .subsystem = LCD_EVENT_SUBSYSTEM,
- .uevent_func = lcd_uevent_changed,
- .data = NULL,
-};
-
static void display_init(void *data)
{
int ret, i;
_W("Failed to load '%s', use default value: %d",
DISPLAY_CONF_FILE, ret);
- register_kernel_uevent_control(&lcd_uevent_ops);
-
register_notifier(DEVICE_NOTIFIER_DELAYED_INIT, delayed_init_done);
register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
/* timeout is not needed */
display_state_transition_reset_state_transition_timeout(TIMEOUT_NONE);
- unregister_kernel_uevent_control(&lcd_uevent_ops);
-
display_ops_exit(NULL);
for (i = i - 1; i >= INIT_SETTING; i--) {
return 0;
}
-static void esd_action(void)
-{
- const struct device_ops *touchscreen_ops = NULL;
-
- _I("ESD on");
-
- touchscreen_ops = find_device("touchscreen");
-
- if (!check_default(touchscreen_ops))
- touchscreen_ops->stop(NORMAL_MODE);
- display_panel_set_panel_state_by_off_state(NORMAL_MODE);
- display_panel_set_panel_state_by_on_state(NORMAL_MODE);
- if (!check_default(touchscreen_ops))
- touchscreen_ops->start(NORMAL_MODE);
-}
-
-static void lcd_uevent_changed(struct udev_device *dev)
-{
- const char *devpath;
- const char *action;
-
- devpath = udev_device_get_devpath(dev);
- if (!devpath)
- return;
-
- if (!fnmatch(LCD_ESD_PATH, devpath, 0)) {
- action = udev_device_get_action(dev);
- if (!strcmp(action, UDEV_CHANGE))
- esd_action();
- }
-}
-
-static const struct uevent_handler lcd_uevent_ops = {
- .subsystem = LCD_EVENT_SUBSYSTEM,
- .uevent_func = lcd_uevent_changed,
- .data = NULL,
-};
-
static void display_init(void *data)
{
int ret, i;
_W("Failed to load '%s', use default value: %d",
DISPLAY_CONF_FILE, ret);
- register_kernel_uevent_control(&lcd_uevent_ops);
-
register_notifier(DEVICE_NOTIFIER_DELAYED_INIT, delayed_init_done);
register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
/* timeout is not needed */
display_state_transition_reset_state_transition_timeout(TIMEOUT_NONE);
- unregister_kernel_uevent_control(&lcd_uevent_ops);
-
display_ops_exit(NULL);
for (i = i - 1; i >= INIT_SETTING; i--) {
return 0;
}
-static void esd_action(void)
-{
- const struct device_ops *touchscreen_ops = NULL;
-
- _I("ESD on");
-
- touchscreen_ops = find_device("touchscreen");
-
- if (!check_default(touchscreen_ops))
- touchscreen_ops->stop(NORMAL_MODE);
- display_panel_set_panel_state_by_off_state(NORMAL_MODE);
- display_panel_set_panel_state_by_on_state(NORMAL_MODE);
- if (!check_default(touchscreen_ops))
- touchscreen_ops->start(NORMAL_MODE);
-}
-
-static void lcd_uevent_changed(struct udev_device *dev)
-{
- const char *devpath;
- const char *action;
-
- devpath = udev_device_get_devpath(dev);
- if (!devpath)
- return;
-
- if (!fnmatch(LCD_ESD_PATH, devpath, 0)) {
- action = udev_device_get_action(dev);
- if (!strcmp(action, UDEV_CHANGE))
- esd_action();
- }
-}
-
-static const struct uevent_handler lcd_uevent_ops = {
- .subsystem = LCD_EVENT_SUBSYSTEM,
- .uevent_func = lcd_uevent_changed,
- .data = NULL,
-};
-
static void display_init(void *data)
{
int ret, i;
_W("Failed to load '%s', use default value: %d",
DISPLAY_CONF_FILE, ret);
- register_kernel_uevent_control(&lcd_uevent_ops);
-
register_notifier(DEVICE_NOTIFIER_DELAYED_INIT, delayed_init_done);
register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
/* timeout is not needed */
display_state_transition_reset_state_transition_timeout(TIMEOUT_NONE);
- unregister_kernel_uevent_control(&lcd_uevent_ops);
-
display_ops_exit(NULL);
for (i = i - 1; i >= INIT_SETTING; i--) {
return 0;
}
-static void esd_action(void)
-{
- const struct device_ops *touchscreen_ops = NULL;
-
- _I("ESD on");
-
- touchscreen_ops = find_device("touchscreen");
-
- if (!check_default(touchscreen_ops))
- touchscreen_ops->stop(NORMAL_MODE);
- display_panel_set_panel_state_by_off_state(NORMAL_MODE);
- display_panel_set_panel_state_by_on_state(NORMAL_MODE);
- if (!check_default(touchscreen_ops))
- touchscreen_ops->start(NORMAL_MODE);
-}
-
-static void lcd_uevent_changed(struct udev_device *dev)
-{
- const char *devpath;
- const char *action;
-
- devpath = udev_device_get_devpath(dev);
- if (!devpath)
- return;
-
- if (!fnmatch(LCD_ESD_PATH, devpath, 0)) {
- action = udev_device_get_action(dev);
- if (!strcmp(action, UDEV_CHANGE))
- esd_action();
- }
-}
-
static void sec_dsim_uevent_changed(struct udev_device *dev)
{
const char *devpath;
}
}
-static const struct uevent_handler lcd_uevent_ops = {
- .subsystem = LCD_EVENT_SUBSYSTEM,
- .uevent_func = lcd_uevent_changed,
- .data = NULL,
-};
-
static const struct uevent_handler sec_dsim_uevent_ops = {
.subsystem = SEC_DSIM_EVENT_SUBSYSTEM,
.uevent_func = sec_dsim_uevent_changed,
_W("Failed to load '%s', use default value: %d",
DISPLAY_CONF_FILE, ret);
- register_kernel_uevent_control(&lcd_uevent_ops);
register_kernel_uevent_control(&sec_dsim_uevent_ops);
register_notifier(DEVICE_NOTIFIER_DELAYED_INIT, delayed_init_done);
/* timeout is not needed */
display_state_transition_reset_state_transition_timeout(TIMEOUT_NONE);
- unregister_kernel_uevent_control(&lcd_uevent_ops);
unregister_kernel_uevent_control(&sec_dsim_uevent_ops);
display_ops_exit(NULL);
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#include <fnmatch.h>
#include <signal.h>
#include <libsyscommon/list.h>
#include <shared/devices.h>
+#include "core/udev.h"
#include "shared/device-notifier.h"
#include "shared/log.h"
#include "device-interface.h"
}
}
+/** FIXME: below uevent functions usage and role are unclear, during refactoring
+ these can be removed.
+*/
+static void esd_action(void)
+{
+ const struct device_ops *touchscreen_ops = NULL;
+
+ _I("ESD on");
+
+ touchscreen_ops = find_device("touchscreen");
+
+ if (!check_default(touchscreen_ops))
+ touchscreen_ops->stop(NORMAL_MODE);
+ display_panel_set_panel_state_by_off_state(NORMAL_MODE);
+ display_panel_set_panel_state_by_on_state(NORMAL_MODE);
+ if (!check_default(touchscreen_ops))
+ touchscreen_ops->start(NORMAL_MODE);
+}
+
+static void lcd_uevent_changed(struct udev_device *dev)
+{
+ const char *devpath;
+ const char *action;
+
+ devpath = udev_device_get_devpath(dev);
+ if (!devpath)
+ return;
+
+ if (!fnmatch(LCD_ESD_PATH, devpath, 0)) {
+ action = udev_device_get_action(dev);
+ if (!strcmp(action, UDEV_CHANGE))
+ esd_action();
+ }
+}
+
+static const struct uevent_handler lcd_uevent_ops = {
+ .subsystem = LCD_EVENT_SUBSYSTEM,
+ .uevent_func = lcd_uevent_changed,
+ .data = NULL,
+};
+
static gboolean handle_sighup(gpointer data)
{
int signo = (int) data;
g_unix_signal_add(SIGHUP, handle_sighup, (gpointer) SIGHUP);
display_plugin_device_ops->init(data);
+ register_kernel_uevent_control(&lcd_uevent_ops);
+
display_signal_register_display_brightness_notifier();
display_misc_register_battery_health_notifier();
register_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
display_plugin_device_ops->exit(data);
+ unregister_kernel_uevent_control(&lcd_uevent_ops);
+
display_signal_unregister_display_brightness_notifier();
display_misc_unregister_battery_health_notifier();
unregister_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);