From patchwork Tue Dec 11 15:16:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10723981 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 B62A913AF for ; Tue, 11 Dec 2018 15:16:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6DAF2B314 for ; Tue, 11 Dec 2018 15:16:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B2F52B324; Tue, 11 Dec 2018 15:16:38 +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 3E9B52B2F1 for ; Tue, 11 Dec 2018 15:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726664AbeLKPQi (ORCPT ); Tue, 11 Dec 2018 10:16:38 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:51813 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbeLKPQh (ORCPT ); Tue, 11 Dec 2018 10:16:37 -0500 X-Originating-IP: 2.224.242.101 Received: from w540.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id AA350C0004; Tue, 11 Dec 2018 15:16:34 +0000 (UTC) From: Jacopo Mondi To: 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 Subject: [PATCH 3/5] media: adv748x: Store the source subdevice in TX Date: Tue, 11 Dec 2018 16:16:11 +0100 Message-Id: <1544541373-30044-4-git-send-email-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544541373-30044-1-git-send-email-jacopo+renesas@jmondi.org> References: <1544541373-30044-1-git-send-email-jacopo+renesas@jmondi.org> 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 The power_up_tx() procedure needs to set a few registers conditionally to the selected video source, but it currently checks for the provided tx to be either TXA or TXB. With the introduction of dynamic routing between HDMI and AFE entities to TXA, checking which TX the function is operating on is not meaningful anymore. To fix this, store the subdevice of the source providing video data to the CSI-2 TX in the 'struct adv748x_csi2' representing the TX and check on it. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- drivers/media/i2c/adv748x/adv748x-core.c | 2 +- drivers/media/i2c/adv748x/adv748x-csi2.c | 3 +++ drivers/media/i2c/adv748x/adv748x.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 5495dc7891e8..f3aabbccdfb5 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -254,7 +254,7 @@ static int adv748x_power_up_tx(struct adv748x_csi2 *tx) adv748x_write_check(state, page, 0x00, 0xa0 | tx->num_lanes, &ret); /* ADI Required Write */ - if (is_txa(tx)) { + if (tx->rsd == &state->hdmi.sd) { adv748x_write_check(state, page, 0xdb, 0x10, &ret); adv748x_write_check(state, page, 0xd6, 0x07, &ret); } else { diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c index 4d1aefc2c8d0..307966f4c736 100644 --- a/drivers/media/i2c/adv748x/adv748x-csi2.c +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c @@ -46,6 +46,9 @@ static int adv748x_csi2_register_link(struct adv748x_csi2 *tx, return ret; } + if (flags & MEDIA_LNK_FL_ENABLED) + tx->rsd = src; + return media_create_pad_link(&src->entity, src_pad, &tx->sd.entity, ADV748X_CSI2_SINK, flags); diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index b482c7fe6957..387002d6da65 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -85,6 +85,7 @@ struct adv748x_csi2 { struct v4l2_ctrl_handler ctrl_hdl; struct v4l2_ctrl *pixel_rate; struct v4l2_subdev sd; + struct v4l2_subdev *rsd; }; #define notifier_to_csi2(n) container_of(n, struct adv748x_csi2, notifier)