码迷,mamicode.com
首页 > 系统相关 > 详细

嵌入式linux 内核关机函数实现

时间:2014-05-09 07:03:00      阅读:470      评论:0      收藏:0      [点我收藏+]

标签:linux

arch/arm/kernel/process.c

实现pm_power_off = 关机函数

参考

board-omap3touchbook.c 文件中

pm_power_off = omap3_touchbook_poweroff;

static void omap3_touchbook_poweroff(void)
{
    int pwr_off = TB_KILL_POWER_GPIO;
    if (gpio_request_one(pwr_off, GPIOF_OUT_INIT_LOW, "DVI reset") < 0)
        printk(KERN_ERR "Unable to get kill power GPIO\n");
}


https://lkml.org/lkml/2012/8/17/111

+static struct i2c_client *tps65910_i2c_client;
+static void tps65910_power_off(void)
+{
+   struct tps65910 *tps65910;
+
+   tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev);
+
+   if (tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL,
+           DEVCTRL_PWR_OFF_MASK) < 0)
+       return;
+
+   tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL,
+           DEVCTRL_DEV_ON_MASK);
+}
+
 static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
                    const struct i2c_device_id *id)
 {
@@ -267,6 +284,11 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
    tps65910_ck32k_init(tps65910, pmic_plat_data);
    tps65910_sleepinit(tps65910, pmic_plat_data);
     
+   tps65910_i2c_client = i2c;
+
+   if (pmic_plat_data->pm_off && !pm_power_off)
+       pm_power_off = tps65910_power_off;
+
    return ret;
 }



http://blog.csdn.net/linux_devices_driver/article/details/8666059

kernel power off流程分析

本文出自 “枪炮与玫瑰的BLOG” 博客,请务必保留此出处http://axlrose.blog.51cto.com/434566/1408604

嵌入式linux 内核关机函数实现,布布扣,bubuko.com

嵌入式linux 内核关机函数实现

标签:linux

原文地址:http://axlrose.blog.51cto.com/434566/1408604

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!