diff options
| -rw-r--r-- | drivers/media/platform/msm/camera_v2/jpeg_10/msm_jpeg_dev.c | 6 | ||||
| -rw-r--r-- | include/uapi/media/msm_camera.h | 2 | ||||
| -rw-r--r-- | include/uapi/media/msm_camsensor_sdk.h | 3 | ||||
| -rw-r--r-- | include/uapi/media/msmb_camera.h | 2 | ||||
| -rw-r--r-- | kernel/power/wakeup_reason.c | 62 |
5 files changed, 70 insertions, 5 deletions
diff --git a/drivers/media/platform/msm/camera_v2/jpeg_10/msm_jpeg_dev.c b/drivers/media/platform/msm/camera_v2/jpeg_10/msm_jpeg_dev.c index 06e3ee4c353b..5ef08cbe9aee 100644 --- a/drivers/media/platform/msm/camera_v2/jpeg_10/msm_jpeg_dev.c +++ b/drivers/media/platform/msm/camera_v2/jpeg_10/msm_jpeg_dev.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * 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 @@ -32,6 +32,8 @@ #define MSM_JPEG_NAME "jpeg" #define DEV_NAME_LEN 10 +static char devname[DEV_NAME_LEN]; + static int msm_jpeg_open(struct inode *inode, struct file *filp) { int rc = 0; @@ -185,7 +187,6 @@ static int msm_jpeg_init_dev(struct platform_device *pdev) struct msm_jpeg_device *msm_jpeg_device_p; const struct of_device_id *device_id; const struct msm_jpeg_priv_data *priv_data; - char devname[DEV_NAME_LEN]; msm_jpeg_device_p = kzalloc(sizeof(struct msm_jpeg_device), GFP_ATOMIC); if (!msm_jpeg_device_p) { @@ -328,6 +329,7 @@ static struct platform_driver msm_jpeg_driver = { static int __init msm_jpeg_driver_init(void) { int rc; + rc = platform_driver_register(&msm_jpeg_driver); return rc; } diff --git a/include/uapi/media/msm_camera.h b/include/uapi/media/msm_camera.h index fd0937ffb1e5..81e350ede6eb 100644 --- a/include/uapi/media/msm_camera.h +++ b/include/uapi/media/msm_camera.h @@ -263,7 +263,7 @@ struct msm_mctl_post_proc_cmd { #define MSM_CAMERA_STROBE_FLASH_NONE 0 #define MSM_CAMERA_STROBE_FLASH_XENON 1 -#define MSM_MAX_CAMERA_SENSORS 5 +#define MSM_MAX_CAMERA_SENSORS 6 #define MAX_SENSOR_NAME 32 #define MAX_CAM_NAME_SIZE 32 #define MAX_ACT_MOD_NAME_SIZE 32 diff --git a/include/uapi/media/msm_camsensor_sdk.h b/include/uapi/media/msm_camsensor_sdk.h index ac454ca9a7fc..40731a927ce5 100644 --- a/include/uapi/media/msm_camsensor_sdk.h +++ b/include/uapi/media/msm_camsensor_sdk.h @@ -50,6 +50,8 @@ #define MSM_SENSOR_BYPASS_VIDEO_NODE 1 +#define FRONT_AUX_SENSOR_SUPPORT + enum msm_sensor_camera_id_t { CAMERA_0, CAMERA_1, @@ -70,6 +72,7 @@ enum camb_position_t { BACK_CAMERA_B, FRONT_CAMERA_B, AUX_CAMERA_B = 0x100, + FRONT_AUX_CAMERA_B, INVALID_CAMERA_B, }; diff --git a/include/uapi/media/msmb_camera.h b/include/uapi/media/msmb_camera.h index 47d5a998e139..0a2dd446ccc4 100644 --- a/include/uapi/media/msmb_camera.h +++ b/include/uapi/media/msmb_camera.h @@ -53,7 +53,7 @@ #define MSM_CAMERA_SUBDEV_EXT 19 #define MSM_CAMERA_SUBDEV_TOF 20 #define MSM_CAMERA_SUBDEV_LASER_LED 21 -#define MSM_MAX_CAMERA_SENSORS 5 +#define MSM_MAX_CAMERA_SENSORS 6 /* The below macro is defined to put an upper limit on maximum * number of buffer requested per stream. In case of extremely diff --git a/kernel/power/wakeup_reason.c b/kernel/power/wakeup_reason.c index 252611fad2fe..54697e28ba38 100644 --- a/kernel/power/wakeup_reason.c +++ b/kernel/power/wakeup_reason.c @@ -3,8 +3,14 @@ * * Logs the reasons which caused the kernel to resume from * the suspend mode. + * Sends uevent to user space when enter or out of suspend, + * the modules of user space can use it to do some necessary + * operation. for example, sending a special signal to modem + * or controling the brightness of a lamp before or after suspend. * * Copyright (C) 2014 Google, Inc. + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. @@ -26,7 +32,8 @@ #include <linux/spinlock.h> #include <linux/notifier.h> #include <linux/suspend.h> - +#include <linux/kobject.h> +#include <linux/suspend.h> #define MAX_WAKEUP_REASON_IRQS 32 static int irq_list[MAX_WAKEUP_REASON_IRQS]; @@ -41,6 +48,9 @@ static ktime_t curr_monotime; /* monotonic time after last suspend */ static ktime_t last_stime; /* monotonic boottime offset before last suspend */ static ktime_t curr_stime; /* monotonic boottime offset after last suspend */ +static struct class *wake_uevent_class; +static struct device *wake_uevent_device; + static ssize_t last_resume_reason_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -168,12 +178,22 @@ void log_suspend_abort_reason(const char *fmt, ...) static int wakeup_reason_pm_event(struct notifier_block *notifier, unsigned long pm_event, void *unused) { + int ret = 0; + static char envp[32] = {0}; + static const char * const evp[] = {envp, NULL}; + switch (pm_event) { case PM_SUSPEND_PREPARE: spin_lock(&resume_reason_lock); irqcount = 0; suspend_abort = false; spin_unlock(&resume_reason_lock); + /* send the uevent to userspace */ + snprintf(envp, 32, "STATE=%s", "suspend start"); + ret = kobject_uevent_env(&wake_uevent_device->kobj, + KOBJ_CHANGE, (char **)evp); + if (ret) + pr_warn("Send uevent failed"); /* monotonic time since boot */ last_monotime = ktime_get(); /* monotonic time since boot including the time spent in suspend */ @@ -184,6 +204,12 @@ static int wakeup_reason_pm_event(struct notifier_block *notifier, curr_monotime = ktime_get(); /* monotonic time since boot including the time spent in suspend */ curr_stime = ktime_get_boottime(); + /* send the uevent to userspace */ + snprintf(envp, 32, "STATE=%s", "resume complete"); + ret = kobject_uevent_env(&wake_uevent_device->kobj, + KOBJ_CHANGE, (char **)evp); + if (ret) + pr_warn("Send uevent failed"); break; default: break; @@ -195,12 +221,18 @@ static struct notifier_block wakeup_reason_pm_notifier_block = { .notifier_call = wakeup_reason_pm_event, }; +static const struct file_operations wakeup_uevent = { + .owner = THIS_MODULE, +}; + /* Initializes the sysfs parameter * registers the pm_event notifier + * register the wake_uevent device */ int __init wakeup_reason_init(void) { int retval; + int major; retval = register_pm_notifier(&wakeup_reason_pm_notifier_block); if (retval) @@ -218,8 +250,36 @@ int __init wakeup_reason_init(void) kobject_put(wakeup_reason); printk(KERN_WARNING "[%s] failed to create a sysfs group %d\n", __func__, retval); + return retval; + } + major = register_chrdev(0, "wake_uevent", &wakeup_uevent); + if (major < 0) { + sysfs_remove_group(wakeup_reason, &attr_group); + kobject_put(wakeup_reason); + return major; + } + wake_uevent_class = class_create(THIS_MODULE, "wake_uevent"); + if (IS_ERR(wake_uevent_class)) { + retval = PTR_ERR(wake_uevent_class); + goto fail_class; } + wake_uevent_device = device_create(wake_uevent_class, NULL, + MKDEV(major, 0), + NULL, "wake_uevent"); + if (IS_ERR(wake_uevent_device)) { + retval = PTR_ERR(wake_uevent_device); + goto fail_device; + } + return 0; + +fail_device: + class_destroy(wake_uevent_class); +fail_class: + unregister_chrdev(major, "wake_uevent"); + sysfs_remove_group(wakeup_reason, &attr_group); + kobject_put(wakeup_reason); + return retval; } late_initcall(wakeup_reason_init); |
