Other Parts Discussed in Thread: DM3730, PCA9539, TCA8418E, TCA8418
Tool/software: Linux
hi
I am using two tca9539 device to have 20 input keys, The two devices is connected to dm3730 with i2c. The linux kernel is 2.6.3. However, the kernel only have driver pca953x.c, so I add some code in pca953x.c:
static const struct i2c_device_id pca953x_id[] = { { "pca9534", 8, }, { "pca9535", 16, }, { "pca9536", 4, }, { "pca9537", 4, }, { "pca9538", 8, }, { "pca9539", 16, }, { "pca9554", 8, }, { "pca9555", 16, }, { "pca9556", 8, }, { "pca9557", 8, }, { "max7310", 8, }, { "max7315", 8, }, { "pca6107", 8, }, { "tca6408", 8, }, { "tca6416", 16, }, { "tca9539", 16, }, /*add by me-20190723*/ /* NYET: { "tca6424", 24, }, */ { } };
more over, I also add some code in board-omap3devkit8500.c:
static struct pca953x_platform_data gpio_tca9539[]={ [0] = { .gpio_base = 500, }, [1] = { .gpio_base = 550, }, }; static struct i2c_board_info __initdata devkit8500_i2c3_boardinfo[] = { { I2C_BOARD_INFO("tca9539", 0x75), .platform_data = &gpio_tca9539[0], }, { I2C_BOARD_INFO("tca9539", 0x76), .platform_data = &gpio_tca9539[1], }, }; static int __init omap3_devkit8500_i2c_init(void) { omap_register_i2c_bus(1, 2600, devkit8500_i2c1_boardinfo, ARRAY_SIZE(devkit8500_i2c1_boardinfo)); omap_register_i2c_bus(2, 400, devkit8500_i2c2_boardinfo, ARRAY_SIZE(devkit8500_i2c2_boardinfo)); /* Bus 3 is attached to the DVI port where devices like the pico DLP * projector don't work reliably with 400kHz */ //omap_register_i2c_bus(3, 100, NULL, 0); omap_register_i2c_bus(3, 100, devkit8500_i2c3_boardinfo, ARRAY_SIZE(devkit8500_i2c3_boardinfo)); return 0; }
I do not know the two tca9539 device 20 keys gpio_base, so i give 500 and 550,
in make menuconfig, I have include
[*] /sys/class/gpio/...(syses interface)
<*>pca953x, pca955x, tca64xx, and max7310 I/o ports
<*>map i2c adapter
the questions is
1) am I right in configuring tca9539 driver?
2) how I can use this 20 keys in user level ?
please tell me , thank you very much.