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.

tsc2007驱动触摸屏i2c探测不到,中断探测不到。



添加到devices.c的代码如下:

/*added to devices.c*/  
static struct resource tsc2007_resource[] = {
          {
                  .start          = OMAP_GPIO_IRQ(GPIO_TO_PIN(0, 12)),
				   .end			  =	OMAP_GPIO_IRQ(GPIO_TO_PIN(0, 12)),
                  .flags          = IORESOURCE_IRQ,
          },
  };
  
  static struct platform_device tsc2007_device = {
          .name           = "tsc2007",
          .id             = -1,
          .num_resources  = ARRAY_SIZE(tsc2007_resource),
          .resource       = tsc2007_resource,
  };

添加到board-am335xevm.c文件的代码如下:

/* TouchScreen */

# define TSC2007_INT_GPIO  GPIO_TO_PIN(0, 12)

 static int tsc2007_hw_init(void)
 {
	int err;
	err=gpio_request(TSC2007_INT_GPIO,"tsc2007 irq");
	if(err){
				pr_err("tsc2007 irqgpio request err\n");
				return err;
			}

	err=gpio_direction_input(TSC2007_INT_GPIO);
	if(err){
				pr_err("tsc2007 irqgpio init input err %d\n",err);
				gpio_free(TSC2007_INT_GPIO);
				return err;
			}
	setup_pin_mux(tsc2007_irq_pin_mux);
	printk("tsc2007 gpio initok\n");
	return 0;
 }

 static void tsc2007_hw_remove(void)
 {
	gpio_free(TSC2007_INT_GPIO);
 }

static int tsc2007_get_pendown_state(void)
{
	return !gpio_get_value(TSC2007_INT_GPIO);
}

static struct tsc2007_platform_data tsc2007_info = {
	.model			= 2007,
	.x_plate_ohms		= 180,
	.get_pendown_state = tsc2007_get_pendown_state,
	.init_platform_hw=tsc2007_hw_init,
	.exit_platform_hw=tsc2007_hw_remove,
};


static struct i2c_board_info tsc2007_i2c_devices[] = {
	{
		I2C_BOARD_INFO("tsc2007", 0x4B),
		.type		= "tsc2007",
		.platform_data	= &tsc2007_info,
		.irq		= OMAP_GPIO_IRQ(TSC2007_INT_GPIO),
	},
};




/* Module pin mux for tsc2007 */
static struct pinmux_config tsc2007_i2c1_pin_mux[] = {
	{"spi0_d1.i2c1_sda",    OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW |
					AM33XX_PULL_ENBL | AM33XX_INPUT_EN},
	{"spi0_cs0.i2c1_scl",   OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW |
					AM33XX_PULL_ENBL | AM33XX_INPUT_EN},			
	{NULL, 0},
};
static struct pinmux_config tsc2007_irq_pin_mux[] = {
	{"uart1_ctsn.gpio0_12",   OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},			
	{NULL, 0},
};


static void i2c1_init(void)
{
	setup_pin_mux(tsc2007_i2c1_pin_mux);
	omap_register_i2c_bus(2, 100, tsc2007_i2c_devices,
			ARRAY_SIZE(tsc2007_i2c_devices));
	return;
}


然后在添加i2c1_init();

static void __init am335x_evm_init(void)
{
  ...
  i2c1_init();

  ...

}

请问为什么i2c探测不到,中断也探测不到?????