Version:  2.6.34 2.6.35 2.6.36 2.6.37 2.6.38 2.6.39 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14

Linux/drivers/power/reset/msm-poweroff.c

  1 /* Copyright (c) 2013, The Linux Foundation. All rights reserved.
  2  *
  3  * This program is free software; you can redistribute it and/or modify
  4  * it under the terms of the GNU General Public License version 2 and
  5  * only version 2 as published by the Free Software Foundation.
  6  *
  7  * This program is distributed in the hope that it will be useful,
  8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 10  * GNU General Public License for more details.
 11  *
 12  */
 13 
 14 #include <linux/delay.h>
 15 #include <linux/err.h>
 16 #include <linux/init.h>
 17 #include <linux/kernel.h>
 18 #include <linux/io.h>
 19 #include <linux/of.h>
 20 #include <linux/platform_device.h>
 21 #include <linux/module.h>
 22 #include <linux/reboot.h>
 23 
 24 #include <asm/system_misc.h>
 25 
 26 static void __iomem *msm_ps_hold;
 27 
 28 static void do_msm_restart(enum reboot_mode reboot_mode, const char *cmd)
 29 {
 30         writel(0, msm_ps_hold);
 31         mdelay(10000);
 32 }
 33 
 34 static void do_msm_poweroff(void)
 35 {
 36         /* TODO: Add poweroff capability */
 37         do_msm_restart(REBOOT_HARD, NULL);
 38 }
 39 
 40 static int msm_restart_probe(struct platform_device *pdev)
 41 {
 42         struct device *dev = &pdev->dev;
 43         struct resource *mem;
 44 
 45         mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 46         msm_ps_hold = devm_ioremap_resource(dev, mem);
 47         if (IS_ERR(msm_ps_hold))
 48                 return PTR_ERR(msm_ps_hold);
 49 
 50         pm_power_off = do_msm_poweroff;
 51         arm_pm_restart = do_msm_restart;
 52         return 0;
 53 }
 54 
 55 static const struct of_device_id of_msm_restart_match[] = {
 56         { .compatible = "qcom,pshold", },
 57         {},
 58 };
 59 MODULE_DEVICE_TABLE(of, of_msm_restart_match);
 60 
 61 static struct platform_driver msm_restart_driver = {
 62         .probe = msm_restart_probe,
 63         .driver = {
 64                 .name = "msm-restart",
 65                 .of_match_table = of_match_ptr(of_msm_restart_match),
 66         },
 67 };
 68 
 69 static int __init msm_restart_init(void)
 70 {
 71         return platform_driver_register(&msm_restart_driver);
 72 }
 73 device_initcall(msm_restart_init);
 74 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us