This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Error while probing TSC2007 to I2C in TI AM18O8

Other Parts Discussed in Thread: TSC2007, TCA6416, CDCE913

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));

  • Solved the issue...

    the problem was with hardware address 0x90
    what to do is to probe it to the adress 0x48

    make sure that other devices are not using the same adress

    the code is
        

    #include <linux/i2c/tsc2007.h>
    ------------------------------
    #define DA850_EVM_TSC2007_ADDRESS 0x48


    /*
     * 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));


    your touchscreen will work...


  • i was thinking of the diffrence between the hardware adresses  provided ie 0x90 and 0x48

    the binary value  of 0x90 is 10010000

    and binary value of 0x48 is 01001000

    we can the difference that 90h and 48h is just a right shift. the i2c adress is a 7bit adress +1 bit read/write bit  so here when we give 48h the driver shifts the adress one bit to left and thus we get effectively 90h in the driver. Thus tsc2007 gets connected to the processor..