Everything was done with mux entry in mux.h file inside mach-davinci/include/mach/mux.h
the corresponding GPIO pin for the IRQ line ie PENIRQ is GPIO8_12 for our SOM and EVM
for two codes tried, there was two errors.
1. First error was
Failed to register i2c client tsc2007 at 0x90 (-16)
i2c i2c-1: Can't create device at 0x90
the part of the first code was
#include <linux/i2c/tsc2007.h>
------------------------------
#define DA850_EVM_TSC2007_ADDRESS 0x90
/*
* TSC 2007 Support for Calixto-EVM
*/
#define TSC2007_GPIO_IRQ_PIN GPIO_TO_PIN(8, 12)
static int tsc2007_init_irq(void)
{
int ret = 0;
ret = gpio_request(TSC2007_GPIO_IRQ_PIN, "tsc2007-irq");
if (ret < 0) {
pr_warning("Failed to Set TSC2007 IRQ GPIO: %d\n", ret);
return ret;
}
ret = davinci_cfg_reg(DA850_GPIO8_12);
if (ret) {
pr_warning("%s: PinMux setup for GPIO %d failed: %d\n",
__func__, TSC2007_GPIO_IRQ_PIN, ret);
return ret;
}
gpio_direction_input(TSC2007_GPIO_IRQ_PIN);
return ret;
}
static void tsc2007_exit_irq(void)
{
gpio_free(TSC2007_GPIO_IRQ_PIN);
}
static int tsc2007_get_irq_level(void)
{
return gpio_get_value(TSC2007_GPIO_IRQ_PIN) ? 0 : 1;
}
struct tsc2007_platform_data tsc2007_pdata = {
.model = 2007,
.x_plate_ohms = 180,
.get_pendown_state = tsc2007_get_irq_level,
.init_platform_hw = tsc2007_init_irq,
.exit_platform_hw = tsc2007_exit_irq,
};
static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
{
I2C_BOARD_INFO("tps6507x", 0x48),
.platform_data = &tps_board,
},
{
I2C_BOARD_INFO("tlv320aic3x", 0x18),
},
{
I2C_BOARD_INFO("tca6416", 0x20),
.platform_data = &da850_evm_ui_expander_info,
},
{
I2C_BOARD_INFO("cdce913", 0x65),
},
{
I2C_BOARD_INFO("tsc2007", DA850_EVM_TSC2007_ADDRESS),
.platform_data = &tsc2007_pdata,
.irq = gpio_to_irq(TSC2007_GPIO_IRQ_PIN),
},
};
};
i2c_register_board_info(1, da850_evm_i2c_devices,
ARRAY_SIZE(da850_evm_i2c_devices));
The second error was
the code was modified again and the next issue i got while porting was
tsc2007 init...
tsc2007 probing..
tsc2007 1-0090: i2c io error: -6
the modified code was
#include <linux/i2c/tsc2007.h>
------------------------------
#define DA850_EVM_TSC2007_ADDRESS 0x90
/*
* TSC 2007 Support for Calixto-EVM
*/
#define TSC2007_GPIO_IRQ_PIN GPIO_TO_PIN(8, 12)
static int tsc2007_init_irq(void)
{
int ret = 0;
ret = gpio_request(TSC2007_GPIO_IRQ_PIN, "tsc2007-irq");
if (ret < 0) {
pr_warning("Failed to Set TSC2007 IRQ GPIO: %d\n", ret);
return ret;
}
ret = davinci_cfg_reg(DA850_GPIO8_12);
if (ret) {
pr_warning("%s: PinMux setup for GPIO %d failed: %d\n",
__func__, TSC2007_GPIO_IRQ_PIN, ret);
return ret;
}
gpio_direction_input(TSC2007_GPIO_IRQ_PIN);
return ret;
}
static void tsc2007_exit_irq(void)
{
gpio_free(TSC2007_GPIO_IRQ_PIN);
}
static int tsc2007_get_irq_level(void)
{
return gpio_get_value(TSC2007_GPIO_IRQ_PIN) ? 0 : 1;
}
struct tsc2007_platform_data tsc2007_pdata = {
.model = 2007,
.x_plate_ohms = 180,
.get_pendown_state = tsc2007_get_irq_level,
.init_platform_hw = tsc2007_init_irq,
.exit_platform_hw = tsc2007_exit_irq,
};
static struct i2c_board_info __initdata da850_evm_tsc2007_dev[] = {
[0]= {
I2C_BOARD_INFO("tsc2007", DA850_EVM_TSC2007_ADDRESS),
.platform_data = &tsc2007_pdata,
},
da850_evm_tsc2007_dev[0].irq = gpio_to_irq(TSC2007_GPIO_IRQ_PIN),
i2c_register_board_info(1, da850_evm_tsc2007_dev,
ARRAY_SIZE(da850_evm_tsc2007_dev));