From patchwork Wed Feb 2 17:56:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 539425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E099EC433EF for ; Wed, 2 Feb 2022 17:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241557AbiBBR5O (ORCPT ); Wed, 2 Feb 2022 12:57:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346419AbiBBR5N (ORCPT ); Wed, 2 Feb 2022 12:57:13 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC46BC06173D; Wed, 2 Feb 2022 09:57:12 -0800 (PST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:7139:eada:2ff6:73dd]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E31A3E04; Wed, 2 Feb 2022 18:56:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1643824610; bh=1oG8FpUhanwzJ6Xba8rv47glsXs3JVRy9iJcIqk3Grs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j7UYdY2dRIPVhpWwWnv2DUXzxM62S3z5MZkBDfcHPcR/Ha9pjiIXxiVVv+FyLXJJA GCiQeQh81GAnPm/gmM2XOR2g5efCxjAjhuYmBHyBUefUxbMmW+cicYfg30VvN3fdzq hDF9rfUZ/FM1PX/c/Lb/l4Kj1jGuURyNNwcZTJFY= From: Jean-Michel Hautbois To: jeanmichel.hautbois@ideasonboard.com Cc: dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, kernel-list@raspberrypi.com, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, lukasz@jany.st, mchehab@kernel.org, naush@raspberrypi.com, robh@kernel.org, tomi.valkeinen@ideasonboard.com Subject: [RFC PATCH v3 03/11] media: dt-bindings: media: Add bindings for bcm2835-unicam Date: Wed, 2 Feb 2022 18:56:31 +0100 Message-Id: <20220202175639.149681-4-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> References: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Introduce the dt-bindings documentation for bcm2835 CCP2/CSI2 Unicam camera interface. Also add a MAINTAINERS entry for it. Signed-off-by: Dave Stevenson Signed-off-by: Naushir Patuck Signed-off-by: Jean-Michel Hautbois --- Dave: I assumed you were the maintainer for this file, as I based it on the bcm2835-unicam.txt file. Are you happy to be added directly as the maintainer, or should this be specified as "Raspberry Pi Kernel Maintenance " --- .../bindings/media/brcm,bcm2835-unicam.yaml | 107 ++++++++++++++++++ MAINTAINERS | 7 ++ 2 files changed, 114 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml diff --git a/Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml b/Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml new file mode 100644 index 000000000000..5bf41a8834fa --- /dev/null +++ b/Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml @@ -0,0 +1,107 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/brcm,bcm2835-unicam.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom BCM283x Camera Interface (Unicam) + +maintainers: + - Dave Stevenson + +description: |- + The Unicam block on BCM283x SoCs is the receiver for either + CSI-2 or CCP2 data from image sensors or similar devices. + + The main platform using this SoC is the Raspberry Pi family of boards. + On the Pi the VideoCore firmware can also control this hardware block, + and driving it from two different processors will cause issues. + To avoid this, the firmware checks the device tree configuration + during boot. If it finds device tree nodes starting by csi then + it will stop the firmware accessing the block, and it can then + safely be used via the device tree binding. + +properties: + compatible: + const: brcm,bcm2835-unicam + + reg: + maxItems: 2 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: Clock for the camera. + - description: Clock for the vpu. + + clock-names: + items: + - const: lp + - const: vpu + + power-domains: + items: + - description: Unicam power domain + + num-data-lanes: + items: + - enum: [ 2, 4 ] + + port: + additionalProperties: false + $ref: /schemas/graph.yaml#/$defs/port-base + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: true + link-frequencies: true + + required: + - data-lanes + - link-frequencies + + required: + - endpoint + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - power-domains + - num-data-lanes + - port + +additionalProperties: False + +examples: + - | + #include + #include + #include + csi1: csi@7e801000 { + compatible = "brcm,bcm2835-unicam"; + reg = <0x7e801000 0x800>, + <0x7e802004 0x4>; + interrupts = ; + clocks = <&clocks BCM2835_CLOCK_CAM1>, + <&firmware_clocks 4>; + clock-names = "lp", "vpu"; + power-domains = <&power RPI_POWER_DOMAIN_UNICAM1>; + num-data-lanes = <2>; + port { + csi1_ep: endpoint { + remote-endpoint = <&imx219_0>; + data-lanes = <1 2>; + link-frequencies = /bits/ 64 <456000000>; + }; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index a0770a861ca4..29344ea86847 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3670,6 +3670,13 @@ N: bcm113* N: bcm216* N: kona +BROADCOM BCM2835 CAMERA DRIVER +M: Raspberry Pi Kernel Maintenance +L: linux-media@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml +F: arch/arm/boot/dts/bcm283x* + BROADCOM BCM47XX MIPS ARCHITECTURE M: Hauke Mehrtens M: Rafał Miłecki From patchwork Wed Feb 2 17:56:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 539424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1605AC433F5 for ; Wed, 2 Feb 2022 17:57:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346422AbiBBR5R (ORCPT ); Wed, 2 Feb 2022 12:57:17 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:58274 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241948AbiBBR5O (ORCPT ); Wed, 2 Feb 2022 12:57:14 -0500 Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:7139:eada:2ff6:73dd]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D065914C3; Wed, 2 Feb 2022 18:56:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1643824611; bh=KyONaE2bw8eeU2QVSSOtMb72b8vOSRepSkFdLO6DQfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YKMWjm5IBL7GO+EtAVqGFgVv7pIwAYufGgmPR1nZhlu63Kq+jppY3yEHT7Bn0K0B0 9Qrb4QRW1wPzR6gqQ8U/KAOPRFrYtdruF2ng4oB4397OYCuWrJEp8SP+A0M/H1vfDF zCD1C5hLjVh+/xI5mauPIiOBrlFqVfCnhU7im1k4= From: Jean-Michel Hautbois To: jeanmichel.hautbois@ideasonboard.com Cc: dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, kernel-list@raspberrypi.com, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, lukasz@jany.st, mchehab@kernel.org, naush@raspberrypi.com, robh@kernel.org, tomi.valkeinen@ideasonboard.com Subject: [RFC PATCH v3 05/11] ARM: dts: bcm2711: Add unicam CSI nodes Date: Wed, 2 Feb 2022 18:56:33 +0100 Message-Id: <20220202175639.149681-6-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> References: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add both MIPI CSI-2 nodes in the core bcm2711 tree. Use the 3-cells interrupt declaration, corresponding clocks and default as disabled. Signed-off-by: Jean-Michel Hautbois --- arch/arm/boot/dts/bcm2711.dtsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi index dff18fc9a906..9ad50d4c0c16 100644 --- a/arch/arm/boot/dts/bcm2711.dtsi +++ b/arch/arm/boot/dts/bcm2711.dtsi @@ -3,6 +3,7 @@ #include #include +#include / { compatible = "brcm,bcm2711"; @@ -293,6 +294,30 @@ hvs: hvs@7e400000 { interrupts = ; }; + csi0: csi@7e800000 { + compatible = "brcm,bcm2835-unicam"; + reg = <0x7e800000 0x800>, + <0x7e802000 0x4>; + interrupts = ; + clocks = <&clocks BCM2835_CLOCK_CAM0>, + <&firmware_clocks 4>; + clock-names = "lp", "vpu"; + power-domains = <&power RPI_POWER_DOMAIN_UNICAM0>; + status = "disabled"; + }; + + csi1: csi@7e801000 { + compatible = "brcm,bcm2835-unicam"; + reg = <0x7e801000 0x800>, + <0x7e802004 0x4>; + interrupts = ; + clocks = <&clocks BCM2835_CLOCK_CAM1>, + <&firmware_clocks 4>; + clock-names = "lp", "vpu"; + power-domains = <&power RPI_POWER_DOMAIN_UNICAM1>; + status = "disabled"; + }; + pixelvalve3: pixelvalve@7ec12000 { compatible = "brcm,bcm2711-pixelvalve3"; reg = <0x7ec12000 0x100>; From patchwork Wed Feb 2 17:56:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 539423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 841F0C43217 for ; Wed, 2 Feb 2022 17:57:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346471AbiBBR5V (ORCPT ); Wed, 2 Feb 2022 12:57:21 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:58272 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346435AbiBBR5R (ORCPT ); Wed, 2 Feb 2022 12:57:17 -0500 Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:7139:eada:2ff6:73dd]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 44C4114CD; Wed, 2 Feb 2022 18:56:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1643824611; bh=wgv85acUrshpXd7kh0STF4RCGXeDk6NtpmEK6eEeSyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LvUGbaMOlWtY6lDHozbWnBD1lRiuujBGBzdSuc1Qw54T1dp+/IZZcaW5pYLYGqBNR 6yAsiTMtn/2coqyXqLE1c53udQV47boc+HFVbRw88DydrNCWV6bq2VSylpOtvcBqVA 8ACzsT2gJV8qnOpWeWaeHDMu+8DDKdvJjivRyUzI= From: Jean-Michel Hautbois To: jeanmichel.hautbois@ideasonboard.com Cc: dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, kernel-list@raspberrypi.com, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, lukasz@jany.st, mchehab@kernel.org, naush@raspberrypi.com, robh@kernel.org, tomi.valkeinen@ideasonboard.com Subject: [RFC PATCH v3 06/11] media: imx219: Rename mbus codes array Date: Wed, 2 Feb 2022 18:56:34 +0100 Message-Id: <20220202175639.149681-7-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> References: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The imx219 is using the name codes[] for the mbus format which is not easy to read and know what it means. Change it to imx219_mbus_formats. Signed-off-by: Jean-Michel Hautbois --- drivers/media/i2c/imx219.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index e10af3f74b38..74dba5e61201 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -429,7 +429,7 @@ static const char * const imx219_supply_name[] = { * - v flip * - h&v flips */ -static const u32 codes[] = { +static const u32 imx219_mbus_formats[] = { MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGBRG10_1X10, @@ -655,17 +655,17 @@ static u32 imx219_get_format_code(struct imx219 *imx219, u32 code) lockdep_assert_held(&imx219->mutex); - for (i = 0; i < ARRAY_SIZE(codes); i++) - if (codes[i] == code) + for (i = 0; i < ARRAY_SIZE(imx219_mbus_formats); i++) + if (imx219_mbus_formats[i] == code) break; - if (i >= ARRAY_SIZE(codes)) + if (i >= ARRAY_SIZE(imx219_mbus_formats)) i = 0; i = (i & ~3) | (imx219->vflip->val ? 2 : 0) | (imx219->hflip->val ? 1 : 0); - return codes[i]; + return imx219_mbus_formats[i]; } static void imx219_set_default_format(struct imx219 *imx219) @@ -808,11 +808,11 @@ static int imx219_enum_mbus_code(struct v4l2_subdev *sd, { struct imx219 *imx219 = to_imx219(sd); - if (code->index >= (ARRAY_SIZE(codes) / 4)) + if (code->index >= (ARRAY_SIZE(imx219_mbus_formats) / 4)) return -EINVAL; mutex_lock(&imx219->mutex); - code->code = imx219_get_format_code(imx219, codes[code->index * 4]); + code->code = imx219_get_format_code(imx219, imx219_mbus_formats[code->index * 4]); mutex_unlock(&imx219->mutex); return 0; @@ -908,14 +908,14 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, mutex_lock(&imx219->mutex); - for (i = 0; i < ARRAY_SIZE(codes); i++) - if (codes[i] == fmt->format.code) + for (i = 0; i < ARRAY_SIZE(imx219_mbus_formats); i++) + if (imx219_mbus_formats[i] == fmt->format.code) break; - if (i >= ARRAY_SIZE(codes)) + if (i >= ARRAY_SIZE(imx219_mbus_formats)) i = 0; /* Bayer order varies with flips */ - fmt->format.code = imx219_get_format_code(imx219, codes[i]); + fmt->format.code = imx219_get_format_code(imx219, imx219_mbus_formats[i]); mode = v4l2_find_nearest_size(supported_modes, ARRAY_SIZE(supported_modes), From patchwork Wed Feb 2 17:56:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 539422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C034FC433FE for ; Wed, 2 Feb 2022 17:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243121AbiBBR51 (ORCPT ); Wed, 2 Feb 2022 12:57:27 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:58272 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346464AbiBBR5W (ORCPT ); Wed, 2 Feb 2022 12:57:22 -0500 Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:7139:eada:2ff6:73dd]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 879EB1544; Wed, 2 Feb 2022 18:56:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1643824612; bh=7P8zmIp04YDN3+i1i3KJjkUj+aOMuxjdMxXla3XMhQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5nMt03E8apAlzwBMdK1cl5enBgQsOqWsGtEsVstIJiP41jzWbK+5Mi3LEk2arAkm OOFDvY9Y6R2KWw6iSIkAkMcejD0JI3aa56icqKnzdz1QgKbawfn1wC4PBwpegos//F m+LnC8ocLxrOvEOR7KE7WXawufNtjtp7NF7zG4AU= From: Jean-Michel Hautbois To: jeanmichel.hautbois@ideasonboard.com Cc: dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, kernel-list@raspberrypi.com, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, lukasz@jany.st, mchehab@kernel.org, naush@raspberrypi.com, robh@kernel.org, tomi.valkeinen@ideasonboard.com Subject: [RFC PATCH v3 09/11] media: imx219: use a local v4l2_subdev to simplify reading Date: Wed, 2 Feb 2022 18:56:37 +0100 Message-Id: <20220202175639.149681-10-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> References: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org There is no need to dereference the imx219 structure. Use a local v4l2_subdev instead. Signed-off-by: Jean-Michel Hautbois --- drivers/media/i2c/imx219.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 7d29cf2b06f8..7c224d007f3e 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1492,6 +1492,7 @@ static int imx219_check_hwcfg(struct device *dev) static int imx219_probe(struct i2c_client *client) { struct device *dev = &client->dev; + struct v4l2_subdev *sd; struct imx219 *imx219; int ret; @@ -1499,7 +1500,8 @@ static int imx219_probe(struct i2c_client *client) if (!imx219) return -ENOMEM; - v4l2_i2c_subdev_init(&imx219->sd, client, &imx219_subdev_ops); + sd = &imx219->sd; + v4l2_i2c_subdev_init(sd, client, &imx219_subdev_ops); /* Check the hardware configuration in device tree */ if (imx219_check_hwcfg(dev)) @@ -1566,21 +1568,21 @@ static int imx219_probe(struct i2c_client *client) goto error_power_off; /* Initialize subdev */ - imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | - V4L2_SUBDEV_FL_HAS_EVENTS | - V4L2_SUBDEV_FL_MULTIPLEXED; - imx219->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; + sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | + V4L2_SUBDEV_FL_HAS_EVENTS | + V4L2_SUBDEV_FL_MULTIPLEXED; + sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; /* Initialize source pad */ imx219->pad.flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_pads_init(&imx219->sd.entity, 1, &imx219->pad); + ret = media_entity_pads_init(&sd->entity, 1, &imx219->pad); if (ret) { dev_err(dev, "failed to init entity pads: %d\n", ret); goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor(&imx219->sd); + ret = v4l2_async_register_subdev_sensor(sd); if (ret < 0) { dev_err(dev, "failed to register sensor sub-device: %d\n", ret); goto error_media_entity; @@ -1594,7 +1596,7 @@ static int imx219_probe(struct i2c_client *client) return 0; error_media_entity: - media_entity_cleanup(&imx219->sd.entity); + media_entity_cleanup(&sd->entity); error_handler_free: imx219_free_controls(imx219); From patchwork Wed Feb 2 17:56:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 539421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BA88C433EF for ; Wed, 2 Feb 2022 17:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346472AbiBBR5w (ORCPT ); Wed, 2 Feb 2022 12:57:52 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:58274 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346499AbiBBR52 (ORCPT ); Wed, 2 Feb 2022 12:57:28 -0500 Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:7139:eada:2ff6:73dd]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 67BE21850; Wed, 2 Feb 2022 18:56:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1643824613; bh=3lrGwNeqv8zUuSa8vZIr+ceF4CcaJqG9pp3tPlC2K/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uYmuQ1hKzba11PQY9WPV1yOlDA1V8kdNg78UVgBUYTh0jmVHOar6yEiN5vaYTdhgH +Fq7Zhq4rxGmIwZfYxF9BJRnEyXNXoR+x8E1R/lT6CY/hCOWJO2NX4i53QQGtOAyxb 7C/eTAmD0C1Rox0LvpmXdAR4rb1fepNfkpDtHNPo= From: Jean-Michel Hautbois To: jeanmichel.hautbois@ideasonboard.com Cc: dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, kernel-list@raspberrypi.com, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, lukasz@jany.st, mchehab@kernel.org, naush@raspberrypi.com, robh@kernel.org, tomi.valkeinen@ideasonboard.com Subject: [RFC PATCH v3 11/11] media: bcm283x: Include the imx219 node Date: Wed, 2 Feb 2022 18:56:39 +0100 Message-Id: <20220202175639.149681-12-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> References: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org WARNING: This patch is only used to demonstrate how the imx219 node is included in the bcm2711-rpi-4-b device tree, and is not intended to be merged. Configure the csi1 endpoint, add the imx219 node and connect it through the i2c mux. Signed-off-by: Jean-Michel Hautbois --- arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 1 + arch/arm/boot/dts/bcm283x-rpi-imx219.dtsi | 102 ++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 arch/arm/boot/dts/bcm283x-rpi-imx219.dtsi diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts index 4432412044de..f7625b70fe57 100644 --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts @@ -4,6 +4,7 @@ #include "bcm2711-rpi.dtsi" #include "bcm283x-rpi-usb-peripheral.dtsi" #include "bcm283x-rpi-wifi-bt.dtsi" +#include "bcm283x-rpi-imx219.dtsi" / { compatible = "raspberrypi,4-model-b", "brcm,bcm2711"; diff --git a/arch/arm/boot/dts/bcm283x-rpi-imx219.dtsi b/arch/arm/boot/dts/bcm283x-rpi-imx219.dtsi new file mode 100644 index 000000000000..f2c6a85fd731 --- /dev/null +++ b/arch/arm/boot/dts/bcm283x-rpi-imx219.dtsi @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +/ { + compatible = "brcm,bcm2835"; + + imx219_vdig: fixedregulator@1 { + compatible = "regulator-fixed"; + regulator-name = "imx219_vdig"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + imx219_vddl: fixedregulator@2 { + compatible = "regulator-fixed"; + regulator-name = "imx219_vddl"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + }; + + imx219_clk: imx219_clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <24000000>; + clock-output-names = "24MHz-clock"; + }; + + cam1_reg: cam1_reg { + compatible = "regulator-fixed"; + regulator-name = "imx219_vana"; + enable-active-high; + status = "okay"; + gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>; + }; + + i2c0mux { + compatible = "i2c-mux-pinctrl"; + #address-cells = <1>; + #size-cells = <0>; + + i2c-parent = <&i2c0>; + + pinctrl-names = "i2c0", "i2c_csi_dsi"; + pinctrl-0 = <&i2c0_gpio0>; + pinctrl-1 = <&i2c0_gpio44>; + + i2c@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + imx219: sensor@10 { + compatible = "sony,imx219"; + reg = <0x10>; + status = "okay"; + + clocks = <&imx219_clk>; + clock-names = "xclk"; + + VANA-supply = <&cam1_reg>; /* 2.8v */ + VDIG-supply = <&imx219_vdig>; /* 1.8v */ + VDDL-supply = <&imx219_vddl>; /* 1.2v */ + + rotation = <0>; + orientation = <0>; + + port { + imx219_0: endpoint { + remote-endpoint = <&csi1_ep>; + clock-lanes = <0>; + data-lanes = <1 2>; + clock-noncontinuous; + link-frequencies = /bits/ 64 <456000000>; + }; + }; + }; + }; + }; +}; + +&csi1 { + status="okay"; + num-data-lanes = <2>; + port { + csi1_ep: endpoint { + remote-endpoint = <&imx219_0>; + data-lanes = <1 2>; + clock-lanes = <0>; + }; + }; +}; + +&i2c0 { + /delete-property/ pinctrl-names; + /delete-property/ pinctrl-0; +}; +