From patchwork Wed Oct 19 12:59:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 9384229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 519FA600CA for ; Wed, 19 Oct 2016 14:56:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43C5325227 for ; Wed, 19 Oct 2016 14:56:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3882828826; Wed, 19 Oct 2016 14:56:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AD0C25227 for ; Wed, 19 Oct 2016 14:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943180AbcJSOzu (ORCPT ); Wed, 19 Oct 2016 10:55:50 -0400 Received: from mga09.intel.com ([134.134.136.24]:40284 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S943308AbcJSOzm (ORCPT ); Wed, 19 Oct 2016 10:55:42 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 19 Oct 2016 06:01:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,514,1473145200"; d="scan'208";a="1046934227" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga001.jf.intel.com with ESMTP; 19 Oct 2016 06:01:33 -0700 Received: from nauris.fi.intel.com (nauris.localdomain [192.168.240.2]) by paasikivi.fi.intel.com (Postfix) with ESMTP id 08BA3200FB; Wed, 19 Oct 2016 16:01:25 +0300 (EEST) Received: by nauris.fi.intel.com (Postfix, from userid 1000) id AE36920157; Wed, 19 Oct 2016 15:59:54 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, p.zabel@pengutronix.de, niklas.soderlund@ragnatech.se Subject: [PATCH v2 1/1] doc-rst: v4l: Add documentation on CSI-2 bus configuration Date: Wed, 19 Oct 2016 15:59:54 +0300 Message-Id: <1476881994-32118-1-git-send-email-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476870150.3054.28.camel@pengutronix.de> References: <1476870150.3054.28.camel@pengutronix.de> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Document the interface between the CSI-2 transmitter and receiver drivers. Signed-off-by: Sakari Ailus --- Hi Philipp, Indeed the pixel rate is used by some driver as well. How about this one instead? The HTML page is available here (without CCS unfortunately): since v1: - Add PIXEL_RATE to the required controls. - Document how pixel rate is calculated from the link frequency. Documentation/media/kapi/csi2.rst | 59 ++++++++++++++++++++++++++++++++++++++ Documentation/media/media_kapi.rst | 1 + 2 files changed, 60 insertions(+) create mode 100644 Documentation/media/kapi/csi2.rst diff --git a/Documentation/media/kapi/csi2.rst b/Documentation/media/kapi/csi2.rst new file mode 100644 index 0000000..31f927d --- /dev/null +++ b/Documentation/media/kapi/csi2.rst @@ -0,0 +1,59 @@ +MIPI CSI-2 +========== + +CSI-2 is a data bus intended for transferring images from cameras to +the host SoC. It is defined by the `MIPI alliance`_. + +.. _`MIPI alliance`: http://www.mipi.org/ + +Transmitter drivers +------------------- + +CSI-2 transmitter, such as a sensor or a TV tuner, drivers need to +provide the CSI-2 receiver with information on the CSI-2 bus +configuration. These include the V4L2_CID_LINK_FREQ and +V4L2_CID_PIXEL_RATE controls and +(:c:type:`v4l2_subdev_video_ops`->s_stream() callback). These +interface elements must be present on the sub-device represents the +CSI-2 transmitter. + +The V4L2_CID_LINK_FREQ control is used to tell the receiver driver the +frequency (and not the symbol rate) of the link. The +V4L2_CID_PIXEL_RATE is may be used by the receiver to obtain the pixel +rate the transmitter uses. The +:c:type:`v4l2_subdev_video_ops`->s_stream() callback provides an +ability to start and stop the stream. + +The value of the V4L2_CID_PIXEL_RATE is calculated as follows:: + + pixel_rate = link_freq * 2 * nr_of_lanes + +where + +.. list-table:: variables in pixel rate calculation + :header-rows: 1 + + * - variable or constant + - description + * - link_freq + - The value of the V4L2_CID_LINK_FREQ integer64 menu item. + * - nr_of_lanes + - Number of data lanes used on the CSI-2 link. This can + be obtained from the OF endpoint configuration. + * - 2 + - Two bits are transferred per clock cycle per lane. + +The transmitter drivers must configure the CSI-2 transmitter to *LP-11 +mode* whenever the transmitter is powered on but not active. Some +transmitters do this automatically but some have to be explicitly +programmed to do so. + +Receiver drivers +---------------- + +Before the receiver driver may enable the CSI-2 transmitter by using +the :c:type:`v4l2_subdev_video_ops`->s_stream(), it must have powered +the transmitter up by using the +:c:type:`v4l2_subdev_core_ops`->s_power() callback. This may take +place either indirectly by using :c:func:`v4l2_pipeline_pm_use` or +directly. diff --git a/Documentation/media/media_kapi.rst b/Documentation/media/media_kapi.rst index f282ca2..bc06389 100644 --- a/Documentation/media/media_kapi.rst +++ b/Documentation/media/media_kapi.rst @@ -33,3 +33,4 @@ For more details see the file COPYING in the source distribution of Linux. kapi/rc-core kapi/mc-core kapi/cec-core + kapi/csi2