I.MX6 Power off register hacking

简介: /*********************************************************************** * I.MX6 Power off register hacking * 声明: * 本文主要记录I.MX6DL中的Power off按键的注册过程。
/***********************************************************************
 *                  I.MX6 Power off register hacking
 * 声明:
 *     本文主要记录I.MX6DL中的Power off按键的注册过程。
 *
 *                                     2016-1-28 深圳 南山平山村 曾剑锋
 **********************************************************************/


一、cat arch/arm/mach-mx6/board-mx6dl_sabresd.h
    ......
    static iomux_v3_cfg_t mx6dl_sabresd_pads[] = {
        ......
        MX6DL_PAD_GPIO_17__GPIO_7_12, /* power off */
        ......
    }
    ......

二、cat arch/arm/mach-mx6/board-mx6q_sabresd.c
    ......
    #define SABRESD_POWER_OFF   IMX_GPIO_NR(7, 12)
    ......
    static struct gpio_keys_button new_sabresd_buttons[] = {
        GPIO_BUTTON(SABRESD_VOLUME_UP, KEY_VOLUMEUP, 1, "volume-up", 0, 1),
        GPIO_BUTTON(SABRESD_VOLUME_DN, KEY_VOLUMEDOWN, 1, "volume-down", 0, 1),
        GPIO_BUTTON(SABRESD_POWER_OFF, KEY_POWER, 1, "power-key", 1, 1),
    };
    
    static struct gpio_keys_platform_data new_sabresd_button_data = {
        .buttons    = new_sabresd_buttons,
        .nbuttons   = ARRAY_SIZE(new_sabresd_buttons),
    };
    
    static struct platform_device sabresd_button_device = {
        .name       = "gpio-keys",
        .id     = -1,
        .num_resources  = 0,
    };
    
    static void __init imx6q_add_device_buttons(void)
    {
        /* fix me */
        /* For new sabresd(RevB4 ane above) change the
         * ONOFF key(SW1) design, the SW1 now connect
         * to GPIO_3_29, it can be use as a general power
         * key that Android reuired. But those old sabresd
         * such as RevB or older could not support this
         * change, so it needs a way to distinguish different
         * boards. Before board id/rev are defined cleary,
         * there is a simple way to achive this, that is using
         * SOC revison to identify differnt board revison.
         *
         * With the new sabresd change and SW mapping the
         * SW1 as power key, below function related to power
         * key are OK on new sabresd board(B4 or above).
         *  1 Act as power button to power on the device when device is power off
         *  2 Act as power button to power on the device(need keep press SW1 >5s)
         *  3 Act as power key to let device suspend/resume
         *  4 Act screenshort(hold power key and volume down key for 2s)
         */
            platform_device_add_data(&sabresd_button_device,
                    &new_sabresd_button_data,
                    sizeof(new_sabresd_button_data));
    
        platform_device_register(&sabresd_button_device);
    }
    ......

 

目录
相关文章
|
移动开发 Android开发
I.MX6 天嵌 E9 U-boot menu hacking
/************************************************************************************ * I.MX6 天嵌 E9 U-boot menu hacking * 说明: * 天嵌在U-boot中添加了自己的选择menu,想看一下怎么实现的。
930 0
I.MX6 MAC Address hacking
/************************************************************************** * I.MX6 MAC Address hacking * 说明: * 本文记录I.MX6驱动是如何获取MAC地址的。
883 0
|
Linux Android开发
I.MX6 gpio-keys driver hacking
/**************************************************************************** * I.MX6 gpio-keys driver hacking * 说明: * 1. 本文解读gpio-keys驱动是如何注册,最终处理函数在哪里。
1120 0
|
Linux Android开发
Linux power supply class hacking
/*************************************************************************** * Linux power supply class hacking * 声明: * 本文主要是记录linux电源管理的工作机制是什么,那些供Android jni使用 * 的属性文件是如何生成的,调用机制是什么。
798 0
|
芯片
I.MX6 bq27441 driver hacking
/************************************************************************* * I.MX6 bq27441 driver hacking * 声明: * 本文主要是记录对电池计量芯片bq27441芯片驱动注册过程进行代码跟踪。
771 0
|
Linux 芯片
I.MX6 bq27441 driver porting
/************************************************************************** * I.MX6 bq27441 driver porting * 声明: * 本文主要记录bq27441电池检测芯片驱动遇到的一些问题以及解决方法。
854 0
I.MX6 Goodix GT9xx touchscreen driver porting
/************************************************************************ * I.MX6 Goodix GT9xx touchscreen driver porting * 声明: * 本文主要是记录GT9xx电容Touch移植过程中遇到的一些问题。
2357 0
|
Linux
OK335xS Linux kernel check clock 24M hacking
/****************************************************************************** * OK335xS Linux kernel check clock 24M hacking * 声明: * 由于需要确认kernel中的时钟和引脚配置的时钟是否一致,于是需要去跟踪内核 * 中的代码是如何对引脚配置时钟进行识别,并对其进行相关配置的额。
726 0
|
机器学习/深度学习 定位技术 Android开发
I.MX6 GPS JNI HAL register init hacking
/************************************************************************************ * I.
986 0
|
Linux 测试技术
I.MX6 PWM buzzer driver hacking with Demo test
/***************************************************************************** * I.MX6 PWM buzzer driver hacking with Demo test * 声明: * 1. I.MX6和OK335xS实现PWM驱动函数是不一样的; * 2. 通过分析PWM驱动,了解有哪些驱动函数可以用; * 3. 使用I.MX6提供的PWM函数,编写测试用例buzzer驱动; * 4. 使用C编写测试程序。
1001 0