Chinaunix首页 | 论坛 | 博客
  • 博客访问: 677291
  • 博文数量: 516
  • 博客积分: 4119
  • 博客等级: 上校
  • 技术积分: 4288
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-30 17:29
文章分类

全部博文(516)

文章存档

2014年(4)

2013年(160)

2012年(352)

分类: LINUX

2012-11-09 14:56:29

老内核触摸驱动需要修改三个地方:
1,总线:sp0-->sp1:arch/arm/mach-davince/dm365.c
2, 设备:arch/arm/mach-davince/board-dm365-evm.c
3, 驱动:/drivers/input/touchscrean/ads7846.c
----------------------board-dm365-evm.c-----------------------

static int ads7846_get_pendown_state(void)
{
return gpio_get_value(TSC2004_GPIO_IRQ_PIN) ? 0 : 1;
}
struct ads7846_platform_data tsc2046_config = {
.x_max = 0x0fff,
.y_max = 0x0fff,
.x_plate_ohms = 180,
.pressure_max = 255,
.debounce_max = 10,
.debounce_tol = 10,
.debounce_rep = 1,
.get_pendown_state = ads7846_get_pendown_state,
.keep_vref_on = 1,
.settle_delay_usecs = 15,
};
static struct spi_board_info dm365_evm_spi_info1[] __initconst = {
{
.modalias = "ads7846",
.platform_data = &tsc2046_config,
.mode = SPI_MODE_0,
.max_speed_hz = 1500000,
.bus_num = 1,
.chip_select = 0,
},
};

----------------------dm365.c------------------------
623行:static u64 dm365_spi1_dma_mask = DMA_BIT_MASK(32);

637行:static struct davinci_spi_platform_data dm365_spi1_pdata = {
.version = SPI_VERSION_1,
.num_chipselect = 1,
.clk_internal = 1,
.cs_hold = 1,
.intr_level = 0,
.poll_mode = 1, /* 0 -> interrupt mode 1-> polling mode */
.use_dma = 0, /* when 1, value in poll_mode is ignored */
.c2tdelay = 0,
.t2cdelay = 0,
};
673行:static struct resource dm365_spi1_resources[] = {
{
.start = 0x01C66800,
.end = 0x01c66fff,
.flags = IORESOURCE_MEM,
},
{
.start = 17,
.flags = IORESOURCE_IRQ,
},
{
.start = 17,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_RX_CHAN,
},
{
.start = 16,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_TX_CHAN,
},
{
.start = EVENTQ_3,
.flags = IORESOURCE_DMA | IORESOURCE_DMA_EVENT_Q,
},

};
729行:static struct platform_device dm365_spi1_device = {
.name = "spi_davinci",
.id = 1,
.dev = {
.dma_mask = &dm365_spi1_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.platform_data = &dm365_spi1_pdata,
},
.num_resources = ARRAY_SIZE(dm365_spi1_resources),
.resource = dm365_spi1_resources,
};
void __init dm365_init_spi1(unsigned chipselect_mask,
struct spi_board_info *info, unsigned len)
{
davinci_cfg_reg(DM365_SPI1_SCLK);
davinci_cfg_reg(DM365_SPI1_SDI);
davinci_cfg_reg(DM365_SPI1_SDO);
/* not all slaves will be wired up */
//if (chipselect_mask & BIT(0))
davinci_cfg_reg(DM365_SPI1_SDENA0);
//if (chipselect_mask & BIT(1))
// davinci_cfg_reg(DM365_SPI1_SDENA1);
spi_register_board_info(info, len);
platform_device_register(&dm365_spi1_device);
}
阅读(777) | 评论(0) | 转发(0) |
0

上一篇:365串口修改经验

下一篇:所有驱动配置

给主人留下些什么吧!~~