我选一个稍微简单的mach来进行后面的分析,at91平台(arch/arm/mach-at91/board-sam9m10g45ek.c),我把相关的代码截取出来:
* soc-camera OV2640 */ #if defined(CONFIG_SOC_CAMERA_OV2640) || \ defined(CONFIG_SOC_CAMERA_OV2640_MODULE) static unsigned long isi_camera_query_bus_param(struct soc_camera_link *link) { /* ISI board for ek using default 8-bits connection */ return SOCAM_DATAWIDTH_8; } static int i2c_camera_power(struct device *dev, int on) { /* enable or disable the camera */ pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); at91_set_gpio_output(AT91_PIN_PD13, !on); if (!on) goto out; /* If enabled, give a reset impulse */ at91_set_gpio_output(AT91_PIN_PD12, 0); msleep(20); at91_set_gpio_output(AT91_PIN_PD12, 1); msleep(100); out: return 0; } static struct i2c_board_info i2c_camera = { I2C_BOARD_INFO("ov2640", 0x30), }; static struct soc_camera_link iclink_ov2640 = { .bus_id = 0, .board_info = &i2c_camera, .i2c_adapter_id = 0, .power = i2c_camera_power, .query_bus_param = isi_camera_query_bus_param, }; static struct platform_device isi_ov2640 = { .name = "soc-camera-pdrv", .id = 0, .dev = { .platform_data = &iclink_ov2640, }, }; #endifcamera驱动框架分析(上)【转】 (2)
内容版权声明:除非注明,否则皆为本站原创文章。