I.MX6 PMU MMPF0100 driver porting

Posted zengjf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了I.MX6 PMU MMPF0100 driver porting相关的知识,希望对你有一定的参考价值。

/**************************************************************************
 *                   I.MX6 MMPF0100 driver porting
 * 说明:
 *     虽然主板上有MMPF0100芯片,却没有注册设备并使用该PMU驱动,真是浪费,
 * 当然因为需要,所以将PMU的驱动注册起来。
 *  
 *                                        2016-3-31 深圳 南山平山村 曾剑锋
 *************************************************************************/

参考文档:
    PF0100 PMIC drivers
        https://community.freescale.com/thread/308531

一、cat arch/arm/mach-mx6/mx6q_sabresd_pmic_pfuze100.c
    ......
    #define PFUZE100_I2C_DEVICE_NAME  "pfuze100"
    /* 7-bit I2C bus slave address */
    #define PFUZE100_I2C_ADDR         (0x08)
    ......
    static struct i2c_board_info __initdata pfuze100_i2c_device = {
        I2C_BOARD_INFO(PFUZE100_I2C_DEVICE_NAME, PFUZE100_I2C_ADDR),
        .platform_data = &pfuze100_plat,
    };
    
    int __init mx6q_sabresd_init_pfuze100(u32 int_gpio)
    {
        pfuze100_i2c_device.irq = gpio_to_irq(int_gpio); /*update INT gpio */
        return i2c_register_board_info(1, &pfuze100_i2c_device, 1);
    }

二、cat arch/arm/mach-mx6/board-mx6dl_sabresd.h
    static iomux_v3_cfg_t mx6dl_sabresd_pads[] = {
        ......
        MX6Q_PAD_GPIO_18__GPIO_7_13,
        ......
    }

三、cat arch/arm/mach-mx6/board-mx6q_sabresd.c
    ......
    #define SABREAUTO_PMIC_INT      IMX_GPIO_NR(7, 13)
    ......
    /**
     * PMU MMPF0100 devices
     */
    ret = gpio_request(SABREAUTO_PMIC_INT, "pFUZE-int");
    if (ret) {
        printk(KERN_ERR"request pFUZE-int error!!\n");
        return;
    } else {
        gpio_direction_input(SABREAUTO_PMIC_INT);
        mx6q_sabresd_init_pfuze100(SABREAUTO_PMIC_INT);
    }
    ......

四、i2c-tools检查注册情况:
    [email protected]:/data/local # ./i2cdetect -r -y 1                                 
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- UU -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         
    [email protected]:/data/local # 
    
五、查看驱动信息:
    [email protected]:/sys/bus/i2c/devices/1-0008 # cat pfuze_ctl                       
    reg000: 10
    reg001: 00
    reg002: 00
    reg003: 21
    reg004: 00
    reg005: 01
    reg006: 3f
    reg007: 01
    reg008: 00
    reg009: 7f
    reg010: 00
    reg011: 00
    reg012: 00
    reg013: 00
    reg014: 00
    reg015: 81
    reg016: 00
    reg017: 00
    reg018: 3f
    reg019: 00
    reg020: 00
    reg021: 00
    reg022: 00
    reg023: 00
    reg024: 00
    reg025: 00
    reg026: 00
    reg027: 10
    reg028: 00
    reg029: 00
    reg030: 00
    reg031: 00
    reg032: 2b
    reg033: 1b
    reg034: 2b
    reg035: 0c
    reg036: c4
    reg037: 00
    reg038: 00
    reg039: 00
    reg040: 00
    reg041: 00
    reg042: 00
    reg043: 00
    reg044: 00
    reg045: 00
    reg046: 2b
    reg047: 1b
    reg048: 2b
    reg049: 0c
    reg050: c4
    reg051: 00
    reg052: 00
    reg053: 72
    reg054: 72
    reg055: 72
    reg056: 0c
    reg057: d4
    reg058: 00
    reg059: 00
    reg060: 2c
    reg061: 2c
    reg062: 2c
    reg063: 0c
    reg064: e4
    reg065: 00
    reg066: 00
    reg067: 2c
    reg068: 2c
    reg069: 2c
    reg070: 0c
    reg071: e4
    reg072: 00
    reg073: 00
    reg074: 6f
    reg075: 6f
    reg076: 6f
    reg077: 0c
    reg078: f4
    reg079: 00
    reg080: 00
    reg081: 00
    reg082: 00
    reg083: 00
    reg084: 00
    reg085: 00
    reg086: 00
    reg087: 00
    reg088: 00
    reg089: 00
    reg090: 00
    reg091: 00
    reg092: 00
    reg093: 00
    reg094: 00
    reg095: 00
    reg096: 00
    reg097: 00
    reg098: 00
    reg099: 00
    reg100: 00
    reg101: 00
    reg102: 48
    reg103: 00
    reg104: 00
    reg105: 00
    reg106: 10
    reg107: 06
    reg108: 1e
    reg109: 1e
    reg110: 17
    reg111: 10
    reg112: 1a
    reg113: 1f
    reg114: 00
    reg115: 00
    reg116: 00
    reg117: 00
    reg118: 00
    reg119: 00
    reg120: 00
    reg121: 00
    reg122: 00
    reg123: 00
    reg124: 00
    reg125: 00
    reg126: 00
    reg127: 00
    
    [email protected]:/sys/bus/i2c/devices/1-0008 #

 

以上是关于I.MX6 PMU MMPF0100 driver porting的主要内容,如果未能解决你的问题,请参考以下文章

Linux shell MMPF0100 i2c 获取数据

I.MX6 bq27441 driver porting

i.MX6ULL驱动开发 | 15 - Linux UART 驱动框架

i.MX6ULL驱动开发 | 18 - 使用中断方式检测按键

i.MX6ULL驱动开发 | 18 - 使用中断方式检测按键

i.MX6ULL驱动开发 | 21 - 按键驱动使用 input 子系统上报事件