• I.MX6 Power off register hacking


    /***********************************************************************
     *                  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);
        }
        ......
  • 相关阅读:
    重头学习java(4)数组
    java collections读书笔记(1)综述
    重头再学习java(3):数值类型的相互转换
    如何学习java(转)
    c++中的变量做数组长度
    .H和.CPP的作用
    内存操作函数
    HTTP工作原理及HTTP请求、响应报文解读
    bdb_db_open: warning – no DB_CONFIG file found in directory /var/lib/ldap:
    用SWAT图行化配置Samba
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/5166071.html
Copyright © 2020-2023  润新知