From patchwork Tue Feb 22 10:31:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 5932 Return-path: Envelope-to: mchehab@pedra Delivery-date: Tue, 22 Feb 2011 08:20:31 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1PrqIA-0006Lo-Nt for mchehab@pedra; Tue, 22 Feb 2011 08:20:31 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Tue, 22 Feb 2011 08:20:30 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PrpfH-0003Vg-Pl; Tue, 22 Feb 2011 10:40:20 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753789Ab1BVKj5 (ORCPT + 1 other); Tue, 22 Feb 2011 05:39:57 -0500 Received: from ns.mm-sol.com ([213.240.235.226]:54411 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753677Ab1BVKjz (ORCPT ); Tue, 22 Feb 2011 05:39:55 -0500 X-Greylist: delayed 472 seconds by postgrey-1.27 at vger.kernel.org; Tue, 22 Feb 2011 05:39:55 EST Received: from intsrv.int.mm-sol.com (unknown [172.18.0.2]) by extserv.mm-sol.com (Postfix) with ESMTP id 101BBC335; Tue, 22 Feb 2011 12:32:21 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by intsrv.int.mm-sol.com (Postfix) with ESMTP id 8BF41FC2259; Tue, 22 Feb 2011 12:32:22 +0200 (EET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from intsrv.int.mm-sol.com ([127.0.0.1]) by localhost (mail.mm-sol.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q-qc1x8dpYit; Tue, 22 Feb 2011 12:32:16 +0200 (EET) Received: from localhost (svarbanov.int.mm-sol.com [172.20.4.13]) by intsrv.int.mm-sol.com (Postfix) with ESMTP id 9F4E9FC2254; Tue, 22 Feb 2011 12:32:16 +0200 (EET) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, g.liakhovetski@gmx.de, saaguirre@ti.com, Stanimir Varbanov Subject: [RFC/PATCH 1/1] v4l: Introduce sensor operation for getting interface configuration Date: Tue, 22 Feb 2011 12:31:53 +0200 Message-Id: X-Mailer: git-send-email 1.6.5 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Introduce g_interface_parms sensor operation for getting sensor interface parameters. These parameters are needed from the host side to determine it's own configuration. Signed-off-by: Stanimir Varbanov --- include/media/v4l2-subdev.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index b0316a7..4186cad 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -322,15 +322,57 @@ struct v4l2_subdev_vbi_ops { int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt); }; +/* Which interface the sensor use to provide it's image data */ +enum v4l2_subdev_sensor_iface { + V4L2_SUBDEV_SENSOR_PARALLEL, + V4L2_SUBDEV_SENSOR_SERIAL, +}; + +/* Each interface could use the following modes */ +/* Image sensor provides horizontal and vertical sync signals */ +#define V4L2_SUBDEV_SENSOR_MODE_PARALLEL_SYNC 0 +/* BT.656 interface. Embedded sync */ +#define V4L2_SUBDEV_SENSOR_MODE_PARALLEL_ITU 1 +/* MIPI CSI1 */ +#define V4L2_SUBDEV_SENSOR_MODE_SERIAL_CSI1 2 +/* MIPI CSI2 */ +#define V4L2_SUBDEV_SENSOR_MODE_SERIAL_CSI2 3 + +struct v4l2_subdev_sensor_serial_parms { + unsigned char lanes; /* number of lanes used */ + unsigned char channel; /* virtual channel */ + unsigned int phy_rate; /* output rate at CSI phy in bps */ + unsigned int pix_clk; /* pixel clock in Hz */ +}; + +struct v4l2_subdev_sensor_parallel_parms { + unsigned int pix_clk; /* pixel clock in Hz */ +}; + +struct v4l2_subdev_sensor_interface_parms { + enum v4l2_subdev_sensor_iface if_type; + unsigned int if_mode; + union { + struct v4l2_subdev_sensor_serial_parms serial; + struct v4l2_subdev_sensor_parallel_parms parallel; + } parms; +}; + /** * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations * @g_skip_top_lines: number of lines at the top of the image to be skipped. * This is needed for some sensors, which always corrupt * several top lines of the output image, or which send their * metadata in them. + * @g_interface_parms: get sensor interface parameters. The sensor subdev should + * fill this structure with current interface params. These + * interface parameters are needed on host side to configure + * it's own hardware receivers. */ struct v4l2_subdev_sensor_ops { int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines); + int (*g_interface_parms)(struct v4l2_subdev *sd, + struct v4l2_subdev_sensor_interface_parms *parms); }; /*