From patchwork Thu Jun 18 11:59:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 31108 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5IBwvc2028393 for ; Thu, 18 Jun 2009 11:58:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758000AbZFRL6w (ORCPT ); Thu, 18 Jun 2009 07:58:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758976AbZFRL6w (ORCPT ); Thu, 18 Jun 2009 07:58:52 -0400 Received: from ppsw-1.csi.cam.ac.uk ([131.111.8.131]:54067 "EHLO ppsw-1.csi.cam.ac.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757739AbZFRL6v (ORCPT ); Thu, 18 Jun 2009 07:58:51 -0400 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from coriolanus.eng.cam.ac.uk ([129.169.154.144]:41260) by ppsw-1.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.151]:25) with esmtpsa (PLAIN:jic23) (TLSv1:DHE-RSA-AES256-SHA:256) id 1MHGGb-0004wA-5B (Exim 4.70) (return-path ); Thu, 18 Jun 2009 12:58:53 +0100 Message-ID: <4A3A2C23.1040104@cam.ac.uk> Date: Thu, 18 Jun 2009 11:59:31 +0000 From: Jonathan Cameron User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Jonathan Cameron CC: Guennadi Liakhovetski , Linux Media Mailing List , Hans Verkuil Subject: Re: OV7670: getting it working with soc-camera. References: <4A392E31.4050705@cam.ac.uk> <4A3A14E4.2000301@cam.ac.uk> In-Reply-To: <4A3A14E4.2000301@cam.ac.uk> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Updated temporary patch to get ov7670 working with soc camera. --- Basically this is the original patch with the changes Guennadi suggested. Again this is only for info, not a formal patch submission. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index 0e2184e..9bea804 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -19,6 +19,12 @@ #include #include +#define OV7670_SOC + + +#ifdef OV7670_SOC +#include +#endif /* OV7670_SOC */ MODULE_AUTHOR("Jonathan Corbet "); MODULE_DESCRIPTION("A low-level driver for OmniVision ov7670 sensors"); @@ -1239,13 +1245,58 @@ static const struct v4l2_subdev_ops ov7670_ops = { }; /* ----------------------------------------------------------------------- */ +#ifdef OV7670_SOC + +static unsigned long ov7670_soc_query_bus_param(struct soc_camera_device *icd) +{ + struct soc_camera_link *icl = to_soc_camera_link(icd); + + unsigned long flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_MASTER | + SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_HIGH | + SOCAM_DATAWIDTH_8 | SOCAM_DATA_ACTIVE_HIGH; + + return soc_camera_apply_sensor_flags(icl, flags); +} +/* This device only supports one bus option */ +static int ov7670_soc_set_bus_param(struct soc_camera_device *icd, + unsigned long flags) +{ + return 0; +} + +static struct soc_camera_ops ov7670_soc_ops = { + .set_bus_param = ov7670_soc_set_bus_param, + .query_bus_param = ov7670_soc_query_bus_param, +}; +#define SETFOURCC(type) .name = (#type), .fourcc = (V4L2_PIX_FMT_ ## type) +static const struct soc_camera_data_format ov7670_soc_fmt_lists[] = { + { + SETFOURCC(YUYV), + .depth = 16, + .colorspace = V4L2_COLORSPACE_JPEG, + }, { + SETFOURCC(RGB565), + .depth = 16, + .colorspace = V4L2_COLORSPACE_SRGB, + }, +}; + +#endif static int ov7670_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct v4l2_subdev *sd; struct ov7670_info *info; int ret; +#ifdef OV7670_SOC + struct soc_camera_device *icd = client->dev.platform_data; + icd->ops = &ov7670_soc_ops; + icd->rect_max.width = VGA_WIDTH; + icd->rect_max.height = VGA_HEIGHT; + icd->formats = ov7670_soc_fmt_lists; + icd->num_formats = ARRAY_SIZE(ov7670_soc_fmt_lists); +#endif info = kzalloc(sizeof(struct ov7670_info), GFP_KERNEL); if (info == NULL)