문제

I'm having a hard time getting the pca955x module working correctly with my pca9552 chip. The module never actually runs the probe function.

my platform data

struct led_platform_data pca552_data = {
     .num_leds = 7,
};

static struct i2c_board_info mxc_i2c1_board_info[] __initdata = {
     {
          I2C_BOARD_INFO("leds-pca955x", 0x61),
          .platform_data = &pca552_data,
     },
}

called in my init

i2c_register_board_info(1, mxc_i2c1_board_info,
        ARRAY_SIZE(mxc_i2c1_board_info));

module data

static struct i2c_driver pca955x_driver = {
    .driver = {
        .name   = "leds-pca955x",
        .owner  = THIS_MODULE,
    },
    .probe  = pca955x_probe,
    .remove = __devexit_p(pca955x_remove),
    .id_table = pca955x_id,
};

I built the module in the kernel. I know there is a device there since i can use i2c tools to poke/read and toggle leds. But linux is not initializing the driver when the device is found.

Its my understanding that the driver name should match the platform data name in the board info. I have a keypad driver that is in the same mxc_i2c1_board_info that is working perfectly fine.

도움이 되었습니까?

해결책

You are trying to use the driver's name as a device id, the supported ids are given in the driver's .id_table, in your case:

static const struct i2c_device_id pca955x_id[] = {
    { "pca9550", pca9550 },
    { "pca9551", pca9551 },
    { "pca9552", pca9552 },
    { "pca9553", pca9553 },
    { }
};

So in your case, updating your board info to read:

static struct i2c_board_info mxc_i2c1_board_info[] __initdata = {
     {
          I2C_BOARD_INFO("pca9552", 0x61),
          .platform_data = &pca552_data,
     },
}

Should cause the driver to probe the device.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top