From patchwork Sat Mar 16 15:48:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10855935 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F037C1823 for ; Sat, 16 Mar 2019 15:47:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D79622966F for ; Sat, 16 Mar 2019 15:47:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBE742A024; Sat, 16 Mar 2019 15:47:43 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 6C4B429FCE for ; Sat, 16 Mar 2019 15:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726835AbfCPPrm (ORCPT ); Sat, 16 Mar 2019 11:47:42 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:49297 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726504AbfCPPrm (ORCPT ); Sat, 16 Mar 2019 11:47:42 -0400 X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 807761BF207; Sat, 16 Mar 2019 15:47:39 +0000 (UTC) From: Jacopo Mondi To: sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, kieran.bingham@ideasonboard.com Cc: Jacopo Mondi , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, dave.stevenson@raspberrypi.org Subject: [RFC 4/5] media: adv748x: Report D-PHY configuration Date: Sat, 16 Mar 2019 16:48:00 +0100 Message-Id: <20190316154801.20460-5-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190316154801.20460-1-jacopo+renesas@jmondi.org> References: <20190316154801.20460-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Extend the media bus frame description to report the D-PHY bus configuration. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/adv748x/adv748x-csi2.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c index 13454af72c6e..c733c7ab8247 100644 --- a/drivers/media/i2c/adv748x/adv748x-csi2.c +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c @@ -231,8 +231,12 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd, static int adv748x_csi2_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, struct v4l2_mbus_frame_desc *fd) { + struct v4l2_mbus_frame_desc_entry_csi2_dphy *dphy; struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd); + struct v4l2_mbus_frame_desc_entry_csi2 *csi2; struct v4l2_mbus_framefmt *mbusformat; + unsigned int i; + memset(fd, 0, sizeof(*fd)); @@ -244,13 +248,20 @@ static int adv748x_csi2_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, if (!mbusformat) return -EINVAL; + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2_DPHY; + fd->num_entries = 1; + fd->entry->stream = tx->vc; - fd->entry->bus.csi2.channel = tx->vc; - fd->entry->bus.csi2.data_type = - adv748x_csi2_code_to_datatype(mbusformat->code); - fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2; - fd->num_entries = 1; + csi2 = &fd->entry->bus.csi2; + csi2->channel = tx->vc; + csi2->data_type = adv748x_csi2_code_to_datatype(mbusformat->code); + + dphy = &fd->phy.csi2_dphy; + dphy->clock_lane = 0; + for (i = 0; i < tx->num_lanes; ++i) + dphy->data_lanes[i] = i + 1; + dphy->num_data_lanes = tx->num_lanes; return 0; }