disp: msm: Register for reboot_notifier
Since implementing the factory_kill feature, then the msm_drv needs to register for reboot_notifier to shut down the display accordingly. Port from: 0d7643c Change-Id: I08a121c87e042d4ea1fcb0f1d730e0519801a8f9 Signed-off-by: Bang Nguyen <bangnguyen@motorola.com> Reviewed-on: https://gerrit.mot.com/1444412 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509815 Reviewed-by: Hua Tan <tanhua1@motorola.com>
This commit is contained in:
1 parent
f849421b27
commit
b0652e4563
2 files changed
+36
No files matched your search
@@ -41,6 +41,7 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <uapi/linux/sched/types.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <linux/reboot.h>
|
||||
|
||||
#include "msm_drv.h"
|
||||
#include "msm_kms.h"
|
||||
@@ -379,6 +380,11 @@ static int msm_drm_uninit(struct device *dev)
|
||||
priv->registered = false;
|
||||
}
|
||||
|
||||
if (priv->msm_drv_notifier.notifier_call) {
|
||||
unregister_reboot_notifier(&priv->msm_drv_notifier);
|
||||
priv->msm_drv_notifier.notifier_call = NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
if (fbdev && priv->fbdev)
|
||||
msm_fbdev_free(ddev);
|
||||
@@ -697,6 +703,23 @@ static struct msm_kms *_msm_drm_init_helper(struct msm_drm_private *priv,
|
||||
return kms;
|
||||
}
|
||||
|
||||
static void msm_pdev_shutdown(struct platform_device *pdev);
|
||||
static int msm_drv_shutdown_notifier_cb(struct notifier_block *nb,
|
||||
unsigned long event, void *unused)
|
||||
{
|
||||
struct device *dev;
|
||||
struct platform_device *pdev;
|
||||
struct msm_drm_private *priv = container_of(nb, struct msm_drm_private,
|
||||
msm_drv_notifier);
|
||||
|
||||
dev = priv->dev->dev;
|
||||
pdev = to_platform_device(dev);
|
||||
dev_warn(dev, "prepare to shutdown\n");
|
||||
msm_pdev_shutdown(pdev);
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static int msm_drm_init(struct device *dev, struct drm_driver *drv)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
@@ -827,6 +850,16 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
|
||||
|
||||
drm_kms_helper_poll_init(ddev);
|
||||
|
||||
priv->msm_drv_notifier.notifier_call = msm_drv_shutdown_notifier_cb;
|
||||
priv->msm_drv_notifier.next = NULL;
|
||||
priv->msm_drv_notifier.priority = 1;
|
||||
ret = register_reboot_notifier(&priv->msm_drv_notifier);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to register for reboot_notifier. ret = %d\n",
|
||||
ret);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <linux/sde_io_util.h>
|
||||
#include <asm/sizes.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
#include <drm/drmP.h>
|
||||
#include <drm/drm_atomic.h>
|
||||
@@ -731,6 +732,8 @@ struct msm_drm_private {
|
||||
|
||||
/* update the flag when msm driver receives shutdown notification */
|
||||
bool shutdown_in_progress;
|
||||
|
||||
struct notifier_block msm_drv_notifier;
|
||||
};
|
||||
|
||||
/* get struct msm_kms * from drm_device * */
|
||||
|
||||
Reference in new issue
Block a user