From patchwork Fri Apr 12 11:38:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10898029 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 E67B51669 for ; Fri, 12 Apr 2019 11:37:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C454928AC2 for ; Fri, 12 Apr 2019 11:37:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8A4528D49; Fri, 12 Apr 2019 11:37:55 +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 2099A28AC2 for ; Fri, 12 Apr 2019 11:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727122AbfDLLhy (ORCPT ); Fri, 12 Apr 2019 07:37:54 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:39941 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbfDLLhy (ORCPT ); Fri, 12 Apr 2019 07:37:54 -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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 57F3DC0013; Fri, 12 Apr 2019 11:37:50 +0000 (UTC) From: Jacopo Mondi To: niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com, horms@verge.net.au, sergei.shtylyov@cogentembedded.com, geert+renesas@glider.be Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 1/2] media: rcar-vin: Make the number of VIN SoC-dependent Date: Fri, 12 Apr 2019 13:38:31 +0200 Message-Id: <20190412113832.30075-2-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412113832.30075-1-jacopo+renesas@jmondi.org> References: <20190412113832.30075-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 In preparation to add ids to VIN's device tree nodes for the V3H SoC which features up to 16 VIN instances, remove the hardcoded number of VINs and make it a per-SoC property. Enlarge the existing RCAR_VIN_NUM definition, which is used to statically allocate the number of vin devices to 16, to accommodate SoCs with that many instances as V3H. Signed-off-by: Jacopo Mondi Nacked-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-core.c | 23 +++++++++++++++------ drivers/media/platform/rcar-vin/rcar-vin.h | 5 ++++- 2 files changed, 21 insertions(+), 7 deletions(-) -- 2.21.0 diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 64519b3097f7..6e9c6c8471e9 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -188,7 +188,7 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags, * we can return here. */ sd = media_entity_to_v4l2_subdev(link->source->entity); - for (i = 0; i < RCAR_VIN_NUM; i++) { + for (i = 0; i <= vin->info->vin_max_id ; i++) { if (group->vin[i] && group->vin[i]->parallel && group->vin[i]->parallel->subdev == sd) { group->vin[i]->is_csi = false; @@ -319,7 +319,7 @@ static int rvin_group_get(struct rvin_dev *vin) return -EINVAL; } - if (id >= RCAR_VIN_NUM) { + if (id > vin->info->vin_max_id) { vin_err(vin, "%pOF: Invalid renesas,id '%u'\n", vin->dev->of_node, id); return -EINVAL; @@ -662,7 +662,7 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier) } /* Register all video nodes for the group. */ - for (i = 0; i < RCAR_VIN_NUM; i++) { + for (i = 0; i <= vin->info->vin_max_id; i++) { if (vin->group->vin[i] && !video_is_registered(&vin->group->vin[i]->vdev)) { ret = rvin_v4l2_register(vin->group->vin[i]); @@ -720,7 +720,7 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier, struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev); unsigned int i; - for (i = 0; i < RCAR_VIN_NUM; i++) + for (i = 0; i <= vin->info->vin_max_id; i++) if (vin->group->vin[i]) rvin_v4l2_unregister(vin->group->vin[i]); @@ -809,7 +809,7 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin) mutex_lock(&vin->group->lock); /* If not all VIN's are registered don't register the notifier. */ - for (i = 0; i < RCAR_VIN_NUM; i++) { + for (i = 0; i <= vin->info->vin_max_id; i++) { if (vin->group->vin[i]) { count++; vin_mask |= BIT(i); @@ -830,7 +830,7 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin) * overlap but the parser function can handle it, so each subdevice * will only be registered once with the group notifier. */ - for (i = 0; i < RCAR_VIN_NUM; i++) { + for (i = 0; i <= vin->info->vin_max_id ; i++) { if (!(vin_mask & BIT(i))) continue; @@ -884,6 +884,7 @@ static int rvin_mc_init(struct rvin_dev *vin) static const struct rvin_info rcar_info_h1 = { .model = RCAR_H1, .use_mc = false, + .vin_max_id = 3, .max_width = 2048, .max_height = 2048, }; @@ -891,6 +892,7 @@ static const struct rvin_info rcar_info_h1 = { static const struct rvin_info rcar_info_m1 = { .model = RCAR_M1, .use_mc = false, + .vin_max_id = 1, .max_width = 2048, .max_height = 2048, }; @@ -898,6 +900,7 @@ static const struct rvin_info rcar_info_m1 = { static const struct rvin_info rcar_info_gen2 = { .model = RCAR_GEN2, .use_mc = false, + .vin_max_id = 5, .max_width = 2048, .max_height = 2048, }; @@ -941,6 +944,7 @@ static const struct rvin_group_route rcar_info_r8a7795_routes[] = { static const struct rvin_info rcar_info_r8a7795 = { .model = RCAR_GEN3, .use_mc = true, + .vin_max_id = 7, .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a7795_routes, @@ -995,6 +999,7 @@ static const struct rvin_group_route rcar_info_r8a7795es1_routes[] = { static const struct rvin_info rcar_info_r8a7795es1 = { .model = RCAR_GEN3, .use_mc = true, + .vin_max_id = 7, .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a7795es1_routes, @@ -1035,6 +1040,7 @@ static const struct rvin_group_route rcar_info_r8a7796_routes[] = { static const struct rvin_info rcar_info_r8a7796 = { .model = RCAR_GEN3, .use_mc = true, + .vin_max_id = 7, .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a7796_routes, @@ -1079,6 +1085,7 @@ static const struct rvin_group_route rcar_info_r8a77965_routes[] = { static const struct rvin_info rcar_info_r8a77965 = { .model = RCAR_GEN3, .use_mc = true, + .vin_max_id = 7, .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a77965_routes, @@ -1098,6 +1105,7 @@ static const struct rvin_group_route rcar_info_r8a77970_routes[] = { static const struct rvin_info rcar_info_r8a77970 = { .model = RCAR_GEN3, .use_mc = true, + .vin_max_id = 3, .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a77970_routes, @@ -1126,6 +1134,7 @@ static const struct rvin_group_route rcar_info_r8a77980_routes[] = { static const struct rvin_info rcar_info_r8a77980 = { .model = RCAR_GEN3, .use_mc = true, + .vin_max_id = 15, .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a77980_routes, @@ -1142,6 +1151,7 @@ static const struct rvin_group_route rcar_info_r8a77990_routes[] = { static const struct rvin_info rcar_info_r8a77990 = { .model = RCAR_GEN3, .use_mc = true, + .vin_max_id = 5, .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a77990_routes, @@ -1154,6 +1164,7 @@ static const struct rvin_group_route rcar_info_r8a77995_routes[] = { static const struct rvin_info rcar_info_r8a77995 = { .model = RCAR_GEN3, .use_mc = true, + .vin_max_id = 4, .max_width = 4096, .max_height = 4096, .routes = rcar_info_r8a77995_routes, diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 0b13b34d03e3..2726c56935e4 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -28,7 +28,8 @@ #define HW_BUFFER_MASK 0x7f /* Max number on VIN instances that can be in a system */ -#define RCAR_VIN_NUM 8 +#define RCAR_VIN_NUM 16 + struct rvin_group; @@ -126,6 +127,7 @@ struct rvin_group_route { * struct rvin_info - Information about the particular VIN implementation * @model: VIN model * @use_mc: use media controller instead of controlling subdevice + * @vin_max_id: id of the last VIN instance * @max_width: max input width the VIN supports * @max_height: max input height the VIN supports * @routes: list of possible routes from the CSI-2 recivers to @@ -135,6 +137,7 @@ struct rvin_info { enum model_id model; bool use_mc; + unsigned int vin_max_id; unsigned int max_width; unsigned int max_height; const struct rvin_group_route *routes; From patchwork Fri Apr 12 11:38:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10898033 X-Patchwork-Delegate: horms@verge.net.au 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 64C1614DB for ; Fri, 12 Apr 2019 11:37:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D68328AC2 for ; Fri, 12 Apr 2019 11:37:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4174128D14; Fri, 12 Apr 2019 11:37:57 +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 CE06828AC2 for ; Fri, 12 Apr 2019 11:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727170AbfDLLh4 (ORCPT ); Fri, 12 Apr 2019 07:37:56 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:50945 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727011AbfDLLh4 (ORCPT ); Fri, 12 Apr 2019 07:37:56 -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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 2CB1AC0012; Fri, 12 Apr 2019 11:37:52 +0000 (UTC) From: Jacopo Mondi To: niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com, horms@verge.net.au, sergei.shtylyov@cogentembedded.com, geert+renesas@glider.be Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 2/2] arm64: dts: renesas: r8a77980: Add "renesas,id" to VIN Date: Fri, 12 Apr 2019 13:38:32 +0200 Message-Id: <20190412113832.30075-3-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412113832.30075-1-jacopo+renesas@jmondi.org> References: <20190412113832.30075-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 Add the "renesas,id" property to VIN nodes in the R-Car V3H R8A77980 device tree. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund --- I do not have a V3H board to test on, but I suspect VIN failed to probe on V3H before these 2 patches. If that's the case, these patches would merit Fixes: 3182aa4e0bf4 ("arm64: dts: renesas: r8a77980: add CSI2/VIN support") Sergei, do you still have a V3H board around? Could I have your Tested-by tag if things are fine now? Thanks j --- arch/arm64/boot/dts/renesas/r8a77980.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.21.0 diff --git a/arch/arm64/boot/dts/renesas/r8a77980.dtsi b/arch/arm64/boot/dts/renesas/r8a77980.dtsi index 4081622d548a..a901a341dcf7 100644 --- a/arch/arm64/boot/dts/renesas/r8a77980.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77980.dtsi @@ -865,6 +865,7 @@ clocks = <&cpg CPG_MOD 811>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 811>; + renesas,id = <0>; status = "disabled"; ports { @@ -892,6 +893,7 @@ clocks = <&cpg CPG_MOD 810>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; status = "disabled"; + renesas,id = <1>; resets = <&cpg 810>; ports { @@ -919,6 +921,7 @@ clocks = <&cpg CPG_MOD 809>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 809>; + renesas,id = <2>; status = "disabled"; ports { @@ -946,6 +949,7 @@ clocks = <&cpg CPG_MOD 808>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 808>; + renesas,id = <3>; status = "disabled"; ports { @@ -973,6 +977,7 @@ clocks = <&cpg CPG_MOD 807>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 807>; + renesas,id = <4>; status = "disabled"; ports { @@ -1000,6 +1005,7 @@ clocks = <&cpg CPG_MOD 806>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 806>; + renesas,id = <5>; status = "disabled"; ports { @@ -1027,6 +1033,7 @@ clocks = <&cpg CPG_MOD 805>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 805>; + renesas,id = <6>; status = "disabled"; ports { @@ -1054,6 +1061,7 @@ clocks = <&cpg CPG_MOD 804>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 804>; + renesas,id = <7>; status = "disabled"; ports { @@ -1081,6 +1089,7 @@ clocks = <&cpg CPG_MOD 628>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 628>; + renesas,id = <8>; status = "disabled"; }; @@ -1091,6 +1100,7 @@ clocks = <&cpg CPG_MOD 627>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 627>; + renesas,id = <9>; status = "disabled"; }; @@ -1101,6 +1111,7 @@ clocks = <&cpg CPG_MOD 625>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 625>; + renesas,id = <10>; status = "disabled"; }; @@ -1111,6 +1122,7 @@ clocks = <&cpg CPG_MOD 618>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 618>; + renesas,id = <11>; status = "disabled"; }; @@ -1121,6 +1133,7 @@ clocks = <&cpg CPG_MOD 612>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 612>; + renesas,id = <12>; status = "disabled"; }; @@ -1131,6 +1144,7 @@ clocks = <&cpg CPG_MOD 608>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 608>; + renesas,id = <13>; status = "disabled"; }; @@ -1141,6 +1155,7 @@ clocks = <&cpg CPG_MOD 605>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 605>; + renesas,id = <14>; status = "disabled"; }; @@ -1151,6 +1166,7 @@ clocks = <&cpg CPG_MOD 604>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; resets = <&cpg 604>; + renesas,id = <15>; status = "disabled"; };