Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 0/7] arch/mm/fault: accelerate pagefault when badaccess
From: Andrew Morton @ 2024-04-03 20:45 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: Russell King, Catalin Marinas, Will Deacon, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexander Gordeev, Gerald Schaefer, Dave Hansen,
	Andy Lutomirski, Peter Zijlstra, x86, linux-arm-kernel,
	linuxppc-dev, linux-riscv, linux-s390, surenb, linux-mm
In-Reply-To: <20240403083805.1818160-1-wangkefeng.wang@huawei.com>

On Wed, 3 Apr 2024 16:37:58 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> After VMA lock-based page fault handling enabled, if bad access met
> under per-vma lock, it will fallback to mmap_lock-based handling,
> so it leads to unnessary mmap lock and vma find again. A test from
> lmbench shows 34% improve after this changes on arm64,
> 
>   lat_sig -P 1 prot lat_sig 0.29194 -> 0.19198
> 
> Only build test on other archs except arm64.

Thanks.  So we now want a bunch of architectures to runtime test this.  Do
we have a selftest in place which will adequately do this?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 24/25] drivers: media: i2c: imx258: Add support for reset gpio
From: Luigi311 @ 2024-04-03 19:48 UTC (permalink / raw)
  To: Ondřej Jirman, Sakari Ailus, linux-media, dave.stevenson,
	jacopo.mondi, mchehab, robh, krzysztof.kozlowski+dt, conor+dt,
	shawnguo, s.hauer, kernel, festevam, devicetree, imx,
	linux-arm-kernel, linux-kernel, pavel, phone-devel
In-Reply-To: <vesqdx7w2sobjnx7tmk6s6i5zplbhsphamoalysx625r4aqffq@hos5otov5ids>

On 4/3/24 11:03, Ondřej Jirman wrote:
> Hi,
> 
> On Wed, Apr 03, 2024 at 04:28:59PM GMT, Sakari Ailus wrote:
>> Hi Luis,
>>
>> Could you unify the subject prefix for the driver patches, please? E.g.
>> "media: imx258: " would be fine.
>>
>> On Wed, Apr 03, 2024 at 09:03:53AM -0600, git@luigi311.com wrote:
>>> From: Luis Garcia <git@luigi311.com>
>>>
>>> It was documented in DT, but not implemented.
>>>
>>> Signed-off-by: Ondrej Jirman <megous@megous.com>
>>> Signed-off-by: Luis Garcia <git@luigi311.com>
>>> ---
>>>  drivers/media/i2c/imx258.c | 14 +++++++++++++-
>>>  1 file changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
>>> index 163f04f6f954..4c117c4829f1 100644
>>> --- a/drivers/media/i2c/imx258.c
>>> +++ b/drivers/media/i2c/imx258.c
>>> @@ -680,6 +680,7 @@ struct imx258 {
>>>  	unsigned int csi2_flags;
>>>  
>>>  	struct gpio_desc *powerdown_gpio;
>>> +	struct gpio_desc *reset_gpio;
>>>  
>>>  	/*
>>>  	 * Mutex for serialized access:
>>> @@ -1232,7 +1233,11 @@ static int imx258_power_on(struct device *dev)
>>>  		regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies);
>>>  	}
>>>  
>>> -	return ret;
>>> +	gpiod_set_value_cansleep(imx258->reset_gpio, 0);
>>> +
>>> +	usleep_range(400, 500);
>>
>> You could mention this at least in the commit message.
> 
> This is T6 in the datasheet: https://megous.com/dl/tmp/92c9223ce877216e.png
> 
> 
>>> +
>>> +	return 0;
>>>  }
>>>  
>>>  static int imx258_power_off(struct device *dev)
>>> @@ -1243,6 +1248,7 @@ static int imx258_power_off(struct device *dev)
>>>  	clk_disable_unprepare(imx258->clk);
>>>  	regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies);
>>>  
>>> +	gpiod_set_value_cansleep(imx258->reset_gpio, 1);
>>
>> Same question than on the other GPIO: does this belong here?
> 
> No, this should be before the regulator_bulk_disable.
> 
> See: https://megous.com/dl/tmp/c96180b23d7ce63a.png
> 
> kind regards,
> 	o.
> 

Since I'm supposed to move the reset up should I also
move the power up with it to match your downstream
driver?

>>>  	gpiod_set_value_cansleep(imx258->powerdown_gpio, 1);
>>>  
>>>  	return 0;
>>> @@ -1554,6 +1560,12 @@ static int imx258_probe(struct i2c_client *client)
>>>  	if (IS_ERR(imx258->powerdown_gpio))
>>>  		return PTR_ERR(imx258->powerdown_gpio);
>>>  
>>> +	/* request optional reset pin */
>>> +	imx258->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
>>> +						    GPIOD_OUT_HIGH);
>>> +	if (IS_ERR(imx258->reset_gpio))
>>> +		return PTR_ERR(imx258->reset_gpio);
>>> +
>>>  	/* Initialize subdev */
>>>  	v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops);
>>>  
>>
>> -- 
>> Regards,
>>
>> Sakari Ailus


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH] clk: nxp: Remove an unused field in struct lpc18xx_pll
From: Vladimir Zapolskiy @ 2024-04-03 19:42 UTC (permalink / raw)
  To: Christophe JAILLET, Michael Turquette, Stephen Boyd
  Cc: linux-kernel, kernel-janitors, linux-clk, linux-arm-kernel
In-Reply-To: <6cfb0e5251c3a59a156e70bcf6a0cc74aa764faa.1711985490.git.christophe.jaillet@wanadoo.fr>

On 4/1/24 18:31, Christophe JAILLET wrote:
> In "struct lpc18xx_pll", the 'lock' field is unused.
> Remove it.
> 
> Found with cppcheck, unusedStructMember.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Thank you for the change!

Acked-by: Vladimir Zapolskiy <vz@mleia.com>

--
Best wishes,
Vladimir

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH] arm64: dts: imx8m/qxp: Pass the tcpci compatible
From: Fabio Estevam @ 2024-04-03 19:40 UTC (permalink / raw)
  To: shawnguo
  Cc: robh, krzk+dt, conor+dt, devicetree, linux-arm-kernel,
	Fabio Estevam

From: Fabio Estevam <festevam@denx.de>

Per nxp,ptn5110.yaml, also pass the fallback "tcpci" compatible
to fix the following dt-schema warning:

 usb-typec@50: compatible: ['nxp,ptn5110'] is too short
	from schema $id: http://devicetree.org/schemas/usb/nxp,ptn5110.yaml#

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi               | 2 +-
 arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi               | 2 +-
 arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts         | 2 +-
 arch/arm64/boot/dts/freescale/imx8mq-hummingboard-pulse.dts | 2 +-
 arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts     | 2 +-
 arch/arm64/boot/dts/freescale/imx8qxp-mek.dts               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
index 888070b8b287..90d1901df2b1 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
@@ -395,7 +395,7 @@ adv7535_out: endpoint {
 	};
 
 	ptn5110: tcpc@50 {
-		compatible = "nxp,ptn5110";
+		compatible = "nxp,ptn5110", "tcpci";
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_typec1>;
 		reg = <0x50>;
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
index 690da24a4335..9e0259ddf4bc 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
@@ -244,7 +244,7 @@ adv7535_out: endpoint {
 	};
 
 	ptn5110: tcpc@50 {
-		compatible = "nxp,ptn5110";
+		compatible = "nxp,ptn5110", "tcpci";
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_typec1>;
 		reg = <0x50>;
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts b/arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts
index a08057410bde..e5d3901f2913 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts
@@ -340,7 +340,7 @@ pcieclk: clock-generator@68 {
 &i2c3 {
 	/* Connected to USB Hub */
 	usb-typec@52 {
-		compatible = "nxp,ptn5110";
+		compatible = "nxp,ptn5110", "tcpci";
 		reg = <0x52>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_typec>;
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-hummingboard-pulse.dts b/arch/arm64/boot/dts/freescale/imx8mq-hummingboard-pulse.dts
index 366693f31992..e92b5d5a66b5 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-hummingboard-pulse.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mq-hummingboard-pulse.dts
@@ -42,7 +42,7 @@ &i2c2 {
 	status = "okay";
 
 	typec_ptn5100: usb-typec@50 {
-		compatible = "nxp,ptn5110";
+		compatible = "nxp,ptn5110", "tcpci";
 		reg = <0x50>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_typec>;
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
index 8055a2c23035..b268ba7a0e12 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts
@@ -429,7 +429,7 @@ ldo7_reg: LDO7 {
 	};
 
 	typec_ptn5100: usb-typec@52 {
-		compatible = "nxp,ptn5110";
+		compatible = "nxp,ptn5110", "tcpci";
 		reg = <0x52>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_typec>;
diff --git a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
index 8360bb851ac0..83d298c2bfd3 100644
--- a/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
+++ b/arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
@@ -149,7 +149,7 @@ light-sensor@44 {
 	};
 
 	ptn5110: tcpc@50 {
-		compatible = "nxp,ptn5110";
+		compatible = "nxp,ptn5110", "tcpci";
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_typec>;
 		reg = <0x50>;
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCH v3 23/25] drivers: media: i2c: imx258: Add support for powerdown gpio
From: Luigi311 @ 2024-04-03 19:34 UTC (permalink / raw)
  To: Ondřej Jirman, Sakari Ailus, linux-media, dave.stevenson,
	jacopo.mondi, mchehab, robh, krzysztof.kozlowski+dt, conor+dt,
	shawnguo, s.hauer, kernel, festevam, devicetree, imx,
	linux-arm-kernel, linux-kernel, pavel, phone-devel
In-Reply-To: <wjlcde7yoooygj4hhdmiwrdloh6l4p6i2qbmjek5uwsifyzwgu@xjhutvmsdfou>

On 4/3/24 10:57, Ondřej Jirman wrote:
> Hi Sakari and Luis,
> 
> On Wed, Apr 03, 2024 at 04:25:41PM GMT, Sakari Ailus wrote:
>> Hi Luis, Ondrej,
>>
>> On Wed, Apr 03, 2024 at 09:03:52AM -0600, git@luigi311.com wrote:
>>> From: Luis Garcia <git@luigi311.com>
>>>
>>> On some boards powerdown signal needs to be deasserted for this
>>> sensor to be enabled.
>>>
>>> Signed-off-by: Ondrej Jirman <megi@xff.cz>
>>> Signed-off-by: Luis Garcia <git@luigi311.com>
>>> ---
>>>  drivers/media/i2c/imx258.c | 13 +++++++++++++
>>>  1 file changed, 13 insertions(+)
>>>
>>> diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
>>> index 30352c33f63c..163f04f6f954 100644
>>> --- a/drivers/media/i2c/imx258.c
>>> +++ b/drivers/media/i2c/imx258.c
>>> @@ -679,6 +679,8 @@ struct imx258 {
>>>  	unsigned int lane_mode_idx;
>>>  	unsigned int csi2_flags;
>>>  
>>> +	struct gpio_desc *powerdown_gpio;
>>> +
>>>  	/*
>>>  	 * Mutex for serialized access:
>>>  	 * Protect sensor module set pad format and start/stop streaming safely.
>>> @@ -1213,6 +1215,8 @@ static int imx258_power_on(struct device *dev)
>>>  	struct imx258 *imx258 = to_imx258(sd);
>>>  	int ret;
>>>  
>>> +	gpiod_set_value_cansleep(imx258->powerdown_gpio, 0);
>>
>> What does the spec say? Should this really happen before switching on the
>> supplies below?
> 
> There's no powerdown input in the IMX258 manual. The manual only mentions
> that XCLR (reset) should be held low during power on.
> 
> https://megous.com/dl/tmp/15b0992a720ab82d.png
> 
> https://megous.com/dl/tmp/f2cc991046d97641.png
> 
>    This sensor doesn’t have a built-in “Power ON Reset” function. The XCLR pin
>    is set to “LOW” and the power supplies are brought up. Then the XCLR pin
>    should be set to “High” after INCK supplied.
> 
> So this input is some feature on camera module itself outside of the
> IMX258 chip, which I think is used to gate power to the module. Eg. on Pinephone
> Pro, there are two modules with shared power rails, so enabling supply to
> one module enables it to the other one, too. So this input becomes the only way
> to really enable/disable power to the chip when both are used at once at some
> point, because regulator_bulk_enable/disable becomes ineffective at that point.
> 
> Luis, maybe you saw some other datasheet that mentions this input? IMO,
> it just gates the power rails via some mosfets on the module itself, since
> there's not power down input to the chip itself.
> 
> kind regards,
> 	o.
> 

Ondrej, I did not see anything else in the datasheet since I'm pretty sure
I'm looking at the same datasheet as it was supplied to me by Pine64. I'm
not sure what datasheet Dave has access to since he got his for a
completely different module than what we are testing with though.

>>> +
>>>  	ret = regulator_bulk_enable(IMX258_NUM_SUPPLIES,
>>>  				    imx258->supplies);
>>>  	if (ret) {
>>> @@ -1224,6 +1228,7 @@ static int imx258_power_on(struct device *dev)
>>>  	ret = clk_prepare_enable(imx258->clk);
>>>  	if (ret) {
>>>  		dev_err(dev, "failed to enable clock\n");
>>> +		gpiod_set_value_cansleep(imx258->powerdown_gpio, 1);
>>>  		regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies);
>>>  	}
>>>  
>>> @@ -1238,6 +1243,8 @@ static int imx258_power_off(struct device *dev)
>>>  	clk_disable_unprepare(imx258->clk);
>>>  	regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies);
>>>  
>>> +	gpiod_set_value_cansleep(imx258->powerdown_gpio, 1);
>>> +
>>>  	return 0;
>>>  }
>>>  
>>> @@ -1541,6 +1548,12 @@ static int imx258_probe(struct i2c_client *client)
>>>  	if (!imx258->variant_cfg)
>>>  		imx258->variant_cfg = &imx258_cfg;
>>>  
>>> +	/* request optional power down pin */
>>> +	imx258->powerdown_gpio = devm_gpiod_get_optional(&client->dev, "powerdown",
>>> +						    GPIOD_OUT_HIGH);
>>> +	if (IS_ERR(imx258->powerdown_gpio))
>>> +		return PTR_ERR(imx258->powerdown_gpio);
>>> +
>>>  	/* Initialize subdev */
>>>  	v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops);
>>>  
>>
>> -- 
>> Regards,
>>
>> Sakari Ailus


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v2 3/3] arm64: dts: imx8mm-evk: Describe the OV5640 supplies
From: Fabio Estevam @ 2024-04-03 19:31 UTC (permalink / raw)
  To: shawnguo; +Cc: victor.liu, linux-arm-kernel, Fabio Estevam
In-Reply-To: <20240403193125.450110-1-festevam@gmail.com>

From: Fabio Estevam <festevam@denx.de>

Per ovti,ov5640.yaml, the OV5640 power supplies are mandatory
properties.

Describe them to fix dt-schema warnings.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Improve commit log and Subject.

 arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
index bd5b365867fd..888070b8b287 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
@@ -72,6 +72,20 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
 		enable-active-high;
 	};
 
+	reg_1v5: regulator-1v5 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V5";
+		regulator-min-microvolt = <1500000>;
+		regulator-max-microvolt = <1500000>;
+	};
+
+	reg_1v8: regulator-1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
 	reg_vddext_3v3: regulator-vddext-3v3 {
 		compatible = "regulator-fixed";
 		regulator-name = "VDDEXT_3V3";
@@ -441,6 +455,9 @@ camera@3c {
 		assigned-clock-rates = <24000000>;
 		powerdown-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
 		reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+		DOVDD-supply = <&buck5_reg>;
+		AVDD-supply = <&reg_1v8>;
+		DVDD-supply = <&reg_1v5>;
 
 		port {
 			ov5640_to_mipi_csi2: endpoint {
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH v2 2/3] arm64: dts: imx8mn-evk: Describe the OV5640 supplies
From: Fabio Estevam @ 2024-04-03 19:31 UTC (permalink / raw)
  To: shawnguo; +Cc: victor.liu, linux-arm-kernel, Fabio Estevam
In-Reply-To: <20240403193125.450110-1-festevam@gmail.com>

From: Fabio Estevam <festevam@denx.de>

Per ovti,ov5640.yaml, the OV5640 power supplies are mandatory
properties.

Describe them to fix dt-schema warnings.

As there are two different PMICs used on the imx8mn-evk variants,
describe the DOVDD OV5640 power supply in each board devicetree.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Improve commit log.

 .../boot/dts/freescale/imx8mn-ddr3l-evk.dts      |  6 ++++++
 .../arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts |  6 ++++++
 arch/arm64/boot/dts/freescale/imx8mn-evk.dts     |  6 ++++++
 arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi    | 16 ++++++++++++++++
 4 files changed, 34 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
index 9ebd81e7eb7c..d25032e3ceab 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
@@ -122,3 +122,9 @@ hdmi@3d {
 		v1p2-supply = <&buck5>;
 	};
 };
+
+&i2c3 {
+	camera@3c {
+		DOVDD-supply = <&buck5>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
index 1a4ac39ebde8..6d85a0b052c9 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
@@ -168,3 +168,9 @@ hdmi@3d {
 		v1p2-supply = <&buck5_reg>;
 	};
 };
+
+&i2c3 {
+	camera@3c {
+		DOVDD-supply = <&buck5_reg>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
index 6f7f409c4181..41330210a05f 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
@@ -135,3 +135,9 @@ hdmi@3d {
 		v1p2-supply = <&buck5>;
 	};
 };
+
+&i2c3 {
+	camera@3c {
+		DOVDD-supply = <&buck5>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
index c06bcf86bb73..690da24a4335 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
@@ -52,6 +52,20 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
 		enable-active-high;
 	};
 
+	reg_1v5: regulator-1v5 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V5";
+		regulator-min-microvolt = <1500000>;
+		regulator-max-microvolt = <1500000>;
+	};
+
+	reg_1v8: regulator-1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
 	reg_vddext_3v3: regulator-vddext-3v3 {
 		compatible = "regulator-fixed";
 		regulator-name = "VDDEXT_3V3";
@@ -287,6 +301,8 @@ camera@3c {
 		assigned-clock-rates = <24000000>;
 		powerdown-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
 		reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+		AVDD-supply = <&reg_1v8>;
+		DVDD-supply = <&reg_1v5>;
 
 		port {
 			ov5640_to_mipi_csi2: endpoint {
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH v2 1/3] arm64: dts: imx8mn-evk: Fix ADV7535 dt-schema warnings
From: Fabio Estevam @ 2024-04-03 19:31 UTC (permalink / raw)
  To: shawnguo; +Cc: victor.liu, linux-arm-kernel, Fabio Estevam

From: Fabio Estevam <festevam@denx.de>

Currently, there are several ADV7535 dt-schema warnings.

Fx them the same way as in commit efa97aed071e060 ("arm64: dts:
imx8mm-evk: Fix hdmi@3d node").

As there are two different PMICs used on the imx8mn-evk variants,
describe the ADV7535 power supplies in each board devicetree.

Fixes: 5aafda608f73 ("arm64: dts: imx8mn-evk: Add camera support")
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- None.

 .../boot/dts/freescale/imx8mn-ddr3l-evk.dts   | 10 +++++++
 .../boot/dts/freescale/imx8mn-ddr4-evk.dts    | 10 +++++++
 arch/arm64/boot/dts/freescale/imx8mn-evk.dts  | 10 +++++++
 arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi | 27 ++++++++++---------
 4 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
index 000e2c0596df..9ebd81e7eb7c 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
@@ -112,3 +112,13 @@ ldo5: LDO5 {
 		};
 	};
 };
+
+&i2c2 {
+	hdmi@3d {
+		avdd-supply = <&buck5>;
+		dvdd-supply = <&buck5>;
+		pvdd-supply = <&buck5>;
+		a2vdd-supply = <&buck5>;
+		v1p2-supply = <&buck5>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
index cc2ff59ac53b..1a4ac39ebde8 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
@@ -158,3 +158,13 @@ ldo6_reg: LDO6 {
 		};
 	};
 };
+
+&i2c2 {
+	hdmi@3d {
+		avdd-supply = <&buck5_reg>;
+		dvdd-supply = <&buck5_reg>;
+		pvdd-supply = <&buck5_reg>;
+		a2vdd-supply = <&buck5_reg>;
+		v1p2-supply = <&buck5_reg>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
index 0b71f50d936e..6f7f409c4181 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
@@ -125,3 +125,13 @@ ldo5: LDO5 {
 		};
 	};
 };
+
+&i2c2 {
+	hdmi@3d {
+		avdd-supply = <&buck5>;
+		dvdd-supply = <&buck5>;
+		pvdd-supply = <&buck5>;
+		a2vdd-supply = <&buck5>;
+		v1p2-supply = <&buck5>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
index 269e70f66a13..c06bcf86bb73 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
@@ -30,7 +30,7 @@ hdmi-connector {
 
 		port {
 			hdmi_connector_in: endpoint {
-				remote-endpoint = <&adv7533_out>;
+				remote-endpoint = <&adv7535_out>;
 			};
 		};
 	};
@@ -52,6 +52,13 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
 		enable-active-high;
 	};
 
+	reg_vddext_3v3: regulator-vddext-3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDEXT_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
 	ir-receiver {
 		compatible = "gpio-ir-receiver";
 		gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
@@ -193,15 +200,11 @@ &i2c2 {
 
 	hdmi@3d {
 		compatible = "adi,adv7535";
-		reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>;
-		reg-names = "main", "cec", "edid", "packet";
+		reg = <0x3d>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
 		adi,dsi-lanes = <4>;
-
-		adi,input-depth = <8>;
-		adi,input-colorspace = "rgb";
-		adi,input-clock = "1x";
-		adi,input-style = <1>;
-		adi,input-justification = "evenly";
+		v3p3-supply = <&reg_vddext_3v3>;
 
 		ports {
 			#address-cells = <1>;
@@ -210,7 +213,7 @@ ports {
 			port@0 {
 				reg = <0>;
 
-				adv7533_in: endpoint {
+				adv7535_in: endpoint {
 					remote-endpoint = <&dsi_out>;
 				};
 			};
@@ -218,7 +221,7 @@ adv7533_in: endpoint {
 			port@1 {
 				reg = <1>;
 
-				adv7533_out: endpoint {
+				adv7535_out: endpoint {
 					remote-endpoint = <&hdmi_connector_in>;
 				};
 			};
@@ -335,7 +338,7 @@ port@1 {
 			reg = <1>;
 
 			dsi_out: endpoint {
-				remote-endpoint = <&adv7533_in>;
+				remote-endpoint = <&adv7535_in>;
 				data-lanes = <1 2 3 4>;
 			};
 		};
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCH v3 22/25] dt-bindings: media: imx258: Add binding for powerdown-gpio
From: Luigi311 @ 2024-04-03 19:26 UTC (permalink / raw)
  To: Pavel Machek
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel, Ondrej Jirman
In-Reply-To: <Zg2kn5/5T9ukP4nd@duo.ucw.cz>

On 4/3/24 12:49, Pavel Machek wrote:
> Hi!
> 
>> From: Luis Garcia <git@luigi311.com>
>>
>> Add powerdown-gpio binding as it is required for some boards
> 
> "." at end of sentence.
> 
>> Signed-off-by: Ondrej Jirman <megi@xff.cz>
>> Signed-off-by: Luis Garcia <git@luigi311.com>
> 
> If the patch is from Ondrej, he should be in From:, I believe.
> 
> Best regards,
> 							Pavel

Ohh your right, this was broken out from another patch and didn't
set it to be his actual commit same with the other ones. They
were based on his downstream changes and just modified to match
up with what Dave had set the values too. I'll set it to him
for the next revision. Thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 21/25] drivers: media: i2c: imx258: Use macros
From: Luigi311 @ 2024-04-03 19:17 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, devicetree, imx, linux-arm-kernel, linux-kernel, pavel,
	phone-devel, Ondrej Jirman
In-Reply-To: <Zg2CirmwL3JfjA8s@kekkonen.localdomain>

On 4/3/24 10:23, Sakari Ailus wrote:
> Hi Luis,
> 
> On Wed, Apr 03, 2024 at 09:03:50AM -0600, git@luigi311.com wrote:
>> From: Luis Garcia <git@luigi311.com>
>>
>> Use understandable macros instead of raw values.
>>
>> Signed-off-by: Ondrej Jirman <megi@xff.cz>
>> Signed-off-by: Luis Garcia <git@luigi311.com>
>> ---
>>  drivers/media/i2c/imx258.c | 434 ++++++++++++++++++-------------------
>>  1 file changed, 207 insertions(+), 227 deletions(-)
>>
>> diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
>> index e2ecf6109516..30352c33f63c 100644
>> --- a/drivers/media/i2c/imx258.c
>> +++ b/drivers/media/i2c/imx258.c
>> @@ -33,8 +33,6 @@
>>  #define IMX258_VTS_30FPS_VGA		0x034c
>>  #define IMX258_VTS_MAX			65525
>>  
>> -#define IMX258_REG_VTS			0x0340
>> -
>>  /* HBLANK control - read only */
>>  #define IMX258_PPL_DEFAULT		5352
>>  
>> @@ -90,6 +88,53 @@
>>  #define IMX258_PIXEL_ARRAY_WIDTH	4208U
>>  #define IMX258_PIXEL_ARRAY_HEIGHT	3120U
>>  
>> +/* regs */
>> +#define IMX258_REG_PLL_MULT_DRIV                  0x0310
>> +#define IMX258_REG_IVTPXCK_DIV                    0x0301
>> +#define IMX258_REG_IVTSYCK_DIV                    0x0303
>> +#define IMX258_REG_PREPLLCK_VT_DIV                0x0305
>> +#define IMX258_REG_IOPPXCK_DIV                    0x0309
>> +#define IMX258_REG_IOPSYCK_DIV                    0x030b
>> +#define IMX258_REG_PREPLLCK_OP_DIV                0x030d
>> +#define IMX258_REG_PHASE_PIX_OUTEN                0x3030
>> +#define IMX258_REG_PDPIX_DATA_RATE                0x3032
>> +#define IMX258_REG_SCALE_MODE                     0x0401
>> +#define IMX258_REG_SCALE_MODE_EXT                 0x3038
>> +#define IMX258_REG_AF_WINDOW_MODE                 0x7bcd
>> +#define IMX258_REG_FRM_LENGTH_CTL                 0x0350
>> +#define IMX258_REG_CSI_LANE_MODE                  0x0114
>> +#define IMX258_REG_X_EVN_INC                      0x0381
>> +#define IMX258_REG_X_ODD_INC                      0x0383
>> +#define IMX258_REG_Y_EVN_INC                      0x0385
>> +#define IMX258_REG_Y_ODD_INC                      0x0387
>> +#define IMX258_REG_BINNING_MODE                   0x0900
>> +#define IMX258_REG_BINNING_TYPE_V                 0x0901
>> +#define IMX258_REG_FORCE_FD_SUM                   0x300d
>> +#define IMX258_REG_DIG_CROP_X_OFFSET              0x0408
>> +#define IMX258_REG_DIG_CROP_Y_OFFSET              0x040a
>> +#define IMX258_REG_DIG_CROP_IMAGE_WIDTH           0x040c
>> +#define IMX258_REG_DIG_CROP_IMAGE_HEIGHT          0x040e
>> +#define IMX258_REG_SCALE_M                        0x0404
>> +#define IMX258_REG_X_OUT_SIZE                     0x034c
>> +#define IMX258_REG_Y_OUT_SIZE                     0x034e
>> +#define IMX258_REG_X_ADD_STA                      0x0344
>> +#define IMX258_REG_Y_ADD_STA                      0x0346
>> +#define IMX258_REG_X_ADD_END                      0x0348
>> +#define IMX258_REG_Y_ADD_END                      0x034a
>> +#define IMX258_REG_EXCK_FREQ                      0x0136
>> +#define IMX258_REG_CSI_DT_FMT                     0x0112
>> +#define IMX258_REG_LINE_LENGTH_PCK                0x0342
>> +#define IMX258_REG_SCALE_M_EXT                    0x303a
>> +#define IMX258_REG_FRM_LENGTH_LINES               0x0340
>> +#define IMX258_REG_FINE_INTEG_TIME                0x0200
>> +#define IMX258_REG_PLL_IVT_MPY                    0x0306
>> +#define IMX258_REG_PLL_IOP_MPY                    0x030e
>> +#define IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H       0x0820
>> +#define IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L       0x0822
>> +
>> +#define REG8(a, v) { a, v }
>> +#define REG16(a, v) { a, ((v) >> 8) & 0xff }, { (a) + 1, (v) & 0xff }
> 
> The patch is nice but these macros are better replaced by the V4L2 CCI
> helper that also offers register access functions. Could you add a patch to
> convert the driver to use it (maybe after this one)?
> 

Ohh perfect, using something else would be great. Ill go ahead and see
if I can get that working.

>> +
>>  struct imx258_reg {
>>  	u16 address;
>>  	u8 val;
>> @@ -145,179 +190,139 @@ struct imx258_mode {
>>   * lane data rate when using 2 lanes, thus allowing a maximum of 15fps.
>>   */
>>  static const struct imx258_reg mipi_1267mbps_19_2mhz_2l[] = {
>> -	{ 0x0136, 0x13 },
>> -	{ 0x0137, 0x33 },
>> -	{ 0x0301, 0x0A },
>> -	{ 0x0303, 0x02 },
>> -	{ 0x0305, 0x03 },
>> -	{ 0x0306, 0x00 },
>> -	{ 0x0307, 0xC6 },
>> -	{ 0x0309, 0x0A },
>> -	{ 0x030B, 0x01 },
>> -	{ 0x030D, 0x02 },
>> -	{ 0x030E, 0x00 },
>> -	{ 0x030F, 0xD8 },
>> -	{ 0x0310, 0x00 },
>> -
>> -	{ 0x0114, 0x01 },
>> -	{ 0x0820, 0x09 },
>> -	{ 0x0821, 0xa6 },
>> -	{ 0x0822, 0x66 },
>> -	{ 0x0823, 0x66 },
>> +	REG16(IMX258_REG_EXCK_FREQ, 0x1333),
>> +	REG8(IMX258_REG_IVTPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IVTSYCK_DIV, 2),
>> +	REG8(IMX258_REG_PREPLLCK_VT_DIV, 3),
>> +	REG16(IMX258_REG_PLL_IVT_MPY, 0x00C6),
>> +	REG8(IMX258_REG_IOPPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IOPSYCK_DIV, 1),
>> +	REG8(IMX258_REG_PREPLLCK_OP_DIV, 2),
>> +	REG16(IMX258_REG_PLL_IOP_MPY, 0x00D8),
>> +	REG8(IMX258_REG_PLL_MULT_DRIV, 0),
>> +
>> +	REG8(IMX258_REG_CSI_LANE_MODE, 1),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H, 0x09A6),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L, 0x6666),
>>  };
>>  
>>  static const struct imx258_reg mipi_1267mbps_19_2mhz_4l[] = {
>> -	{ 0x0136, 0x13 },
>> -	{ 0x0137, 0x33 },
>> -	{ 0x0301, 0x05 },
>> -	{ 0x0303, 0x02 },
>> -	{ 0x0305, 0x03 },
>> -	{ 0x0306, 0x00 },
>> -	{ 0x0307, 0xC6 },
>> -	{ 0x0309, 0x0A },
>> -	{ 0x030B, 0x01 },
>> -	{ 0x030D, 0x02 },
>> -	{ 0x030E, 0x00 },
>> -	{ 0x030F, 0xD8 },
>> -	{ 0x0310, 0x00 },
>> -
>> -	{ 0x0114, 0x03 },
>> -	{ 0x0820, 0x13 },
>> -	{ 0x0821, 0x4C },
>> -	{ 0x0822, 0xCC },
>> -	{ 0x0823, 0xCC },
>> +	REG16(IMX258_REG_EXCK_FREQ, 0x1333),
>> +	REG8(IMX258_REG_IVTPXCK_DIV, 5),
>> +	REG8(IMX258_REG_IVTSYCK_DIV, 2),
>> +	REG8(IMX258_REG_PREPLLCK_VT_DIV, 3),
>> +	REG16(IMX258_REG_PLL_IVT_MPY, 0x00C6),
>> +	REG8(IMX258_REG_IOPPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IOPSYCK_DIV, 1),
>> +	REG8(IMX258_REG_PREPLLCK_OP_DIV, 2),
>> +	REG16(IMX258_REG_PLL_IOP_MPY, 0x00D8),
>> +	REG8(IMX258_REG_PLL_MULT_DRIV, 0),
>> +
>> +	REG8(IMX258_REG_CSI_LANE_MODE, 3),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H, 0x134C),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L, 0xCCCC),
>>  };
>>  
>>  static const struct imx258_reg mipi_1272mbps_24mhz_2l[] = {
>> -	{ 0x0136, 0x18 },
>> -	{ 0x0137, 0x00 },
>> -	{ 0x0301, 0x0a },
>> -	{ 0x0303, 0x02 },
>> -	{ 0x0305, 0x04 },
>> -	{ 0x0306, 0x00 },
>> -	{ 0x0307, 0xD4 },
>> -	{ 0x0309, 0x0A },
>> -	{ 0x030B, 0x01 },
>> -	{ 0x030D, 0x02 },
>> -	{ 0x030E, 0x00 },
>> -	{ 0x030F, 0xD8 },
>> -	{ 0x0310, 0x00 },
>> -
>> -	{ 0x0114, 0x01 },
>> -	{ 0x0820, 0x13 },
>> -	{ 0x0821, 0x4C },
>> -	{ 0x0822, 0xCC },
>> -	{ 0x0823, 0xCC },
>> +	REG16(IMX258_REG_EXCK_FREQ, 0x1800),
>> +	REG8(IMX258_REG_IVTPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IVTSYCK_DIV, 2),
>> +	REG8(IMX258_REG_PREPLLCK_VT_DIV, 4),
>> +	REG16(IMX258_REG_PLL_IVT_MPY, 0x00D4),
>> +	REG8(IMX258_REG_IOPPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IOPSYCK_DIV, 1),
>> +	REG8(IMX258_REG_PREPLLCK_OP_DIV, 2),
>> +	REG16(IMX258_REG_PLL_IOP_MPY, 0x00D8),
>> +	REG8(IMX258_REG_PLL_MULT_DRIV, 0),
>> +
>> +	REG8(IMX258_REG_CSI_LANE_MODE, 1),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H, 0x134C),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L, 0xCCCC),
>>  };
>>  
>>  static const struct imx258_reg mipi_1272mbps_24mhz_4l[] = {
>> -	{ 0x0136, 0x18 },
>> -	{ 0x0137, 0x00 },
>> -	{ 0x0301, 0x05 },
>> -	{ 0x0303, 0x02 },
>> -	{ 0x0305, 0x04 },
>> -	{ 0x0306, 0x00 },
>> -	{ 0x0307, 0xD4 },
>> -	{ 0x0309, 0x0A },
>> -	{ 0x030B, 0x01 },
>> -	{ 0x030D, 0x02 },
>> -	{ 0x030E, 0x00 },
>> -	{ 0x030F, 0xD8 },
>> -	{ 0x0310, 0x00 },
>> -
>> -	{ 0x0114, 0x03 },
>> -	{ 0x0820, 0x13 },
>> -	{ 0x0821, 0xE0 },
>> -	{ 0x0822, 0x00 },
>> -	{ 0x0823, 0x00 },
>> +	REG16(IMX258_REG_EXCK_FREQ, 0x1800),
>> +	REG8(IMX258_REG_IVTPXCK_DIV, 5),
>> +	REG8(IMX258_REG_IVTSYCK_DIV, 2),
>> +	REG8(IMX258_REG_PREPLLCK_VT_DIV, 4),
>> +	REG16(IMX258_REG_PLL_IVT_MPY, 0x00D4),
>> +	REG8(IMX258_REG_IOPPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IOPSYCK_DIV, 1),
>> +	REG8(IMX258_REG_PREPLLCK_OP_DIV, 2),
>> +	REG16(IMX258_REG_PLL_IOP_MPY, 0x00D8),
>> +	REG8(IMX258_REG_PLL_MULT_DRIV, 0),
>> +
>> +	REG8(IMX258_REG_CSI_LANE_MODE, 3),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H, 0x13E0),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L, 0x0000),
>>  };
>>  
>>  static const struct imx258_reg mipi_640mbps_19_2mhz_2l[] = {
>> -	{ 0x0136, 0x13 },
>> -	{ 0x0137, 0x33 },
>> -	{ 0x0301, 0x05 },
>> -	{ 0x0303, 0x02 },
>> -	{ 0x0305, 0x03 },
>> -	{ 0x0306, 0x00 },
>> -	{ 0x0307, 0x64 },
>> -	{ 0x0309, 0x0A },
>> -	{ 0x030B, 0x01 },
>> -	{ 0x030D, 0x02 },
>> -	{ 0x030E, 0x00 },
>> -	{ 0x030F, 0xD8 },
>> -	{ 0x0310, 0x00 },
>> -
>> -	{ 0x0114, 0x01 },
>> -	{ 0x0820, 0x05 },
>> -	{ 0x0821, 0x00 },
>> -	{ 0x0822, 0x00 },
>> -	{ 0x0823, 0x00 },
>> +	REG16(IMX258_REG_EXCK_FREQ, 0x1333),
>> +	REG8(IMX258_REG_IVTPXCK_DIV, 5),
>> +	REG8(IMX258_REG_IVTSYCK_DIV, 2),
>> +	REG8(IMX258_REG_PREPLLCK_VT_DIV, 3),
>> +	REG16(IMX258_REG_PLL_IVT_MPY, 0x0064),
>> +	REG8(IMX258_REG_IOPPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IOPSYCK_DIV, 1),
>> +	REG8(IMX258_REG_PREPLLCK_OP_DIV, 2),
>> +	REG16(IMX258_REG_PLL_IOP_MPY, 0x00D8),
>> +	REG8(IMX258_REG_PLL_MULT_DRIV, 0),
>> +
>> +	REG8(IMX258_REG_CSI_LANE_MODE, 1),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H, 0x0500),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L, 0x0000),
>>  };
>>  
>>  static const struct imx258_reg mipi_640mbps_19_2mhz_4l[] = {
>> -	{ 0x0136, 0x13 },
>> -	{ 0x0137, 0x33 },
>> -	{ 0x0301, 0x05 },
>> -	{ 0x0303, 0x02 },
>> -	{ 0x0305, 0x03 },
>> -	{ 0x0306, 0x00 },
>> -	{ 0x0307, 0x64 },
>> -	{ 0x0309, 0x0A },
>> -	{ 0x030B, 0x01 },
>> -	{ 0x030D, 0x02 },
>> -	{ 0x030E, 0x00 },
>> -	{ 0x030F, 0xD8 },
>> -	{ 0x0310, 0x00 },
>> -
>> -	{ 0x0114, 0x03 },
>> -	{ 0x0820, 0x0A },
>> -	{ 0x0821, 0x00 },
>> -	{ 0x0822, 0x00 },
>> -	{ 0x0823, 0x00 },
>> +	REG16(IMX258_REG_EXCK_FREQ, 0x1333),
>> +	REG8(IMX258_REG_IVTPXCK_DIV, 5),
>> +	REG8(IMX258_REG_IVTSYCK_DIV, 2),
>> +	REG8(IMX258_REG_PREPLLCK_VT_DIV, 3),
>> +	REG16(IMX258_REG_PLL_IVT_MPY, 0x0064),
>> +	REG8(IMX258_REG_IOPPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IOPSYCK_DIV, 1),
>> +	REG8(IMX258_REG_PREPLLCK_OP_DIV, 2),
>> +	REG16(IMX258_REG_PLL_IOP_MPY, 0x00D8),
>> +	REG8(IMX258_REG_PLL_MULT_DRIV, 0),
>> +
>> +	REG8(IMX258_REG_CSI_LANE_MODE, 3),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H, 0x0A00),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L, 0x0000),
>>  };
>>  
>>  static const struct imx258_reg mipi_642mbps_24mhz_2l[] = {
>> -	{ 0x0136, 0x18 },
>> -	{ 0x0137, 0x00 },
>> -	{ 0x0301, 0x05 },
>> -	{ 0x0303, 0x02 },
>> -	{ 0x0305, 0x04 },
>> -	{ 0x0306, 0x00 },
>> -	{ 0x0307, 0x6B },
>> -	{ 0x0309, 0x0A },
>> -	{ 0x030B, 0x01 },
>> -	{ 0x030D, 0x02 },
>> -	{ 0x030E, 0x00 },
>> -	{ 0x030F, 0xD8 },
>> -	{ 0x0310, 0x00 },
>> -
>> -	{ 0x0114, 0x01 },
>> -	{ 0x0820, 0x0A },
>> -	{ 0x0821, 0x00 },
>> -	{ 0x0822, 0x00 },
>> -	{ 0x0823, 0x00 },
>> +	REG16(IMX258_REG_EXCK_FREQ, 0x1800),
>> +	REG8(IMX258_REG_IVTPXCK_DIV, 5),
>> +	REG8(IMX258_REG_IVTSYCK_DIV, 2),
>> +	REG8(IMX258_REG_PREPLLCK_VT_DIV, 4),
>> +	REG16(IMX258_REG_PLL_IVT_MPY, 0x006B),
>> +	REG8(IMX258_REG_IOPPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IOPSYCK_DIV, 1),
>> +	REG8(IMX258_REG_PREPLLCK_OP_DIV, 2),
>> +	REG16(IMX258_REG_PLL_IOP_MPY, 0x00D8),
>> +	REG8(IMX258_REG_PLL_MULT_DRIV, 0),
>> +
>> +	REG8(IMX258_REG_CSI_LANE_MODE, 1),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H, 0x0A00),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L, 0x0000),
>>  };
>>  
>>  static const struct imx258_reg mipi_642mbps_24mhz_4l[] = {
>> -	{ 0x0136, 0x18 },
>> -	{ 0x0137, 0x00 },
>> -	{ 0x0301, 0x05 },
>> -	{ 0x0303, 0x02 },
>> -	{ 0x0305, 0x04 },
>> -	{ 0x0306, 0x00 },
>> -	{ 0x0307, 0x6B },
>> -	{ 0x0309, 0x0A },
>> -	{ 0x030B, 0x01 },
>> -	{ 0x030D, 0x02 },
>> -	{ 0x030E, 0x00 },
>> -	{ 0x030F, 0xD8 },
>> -	{ 0x0310, 0x00 },
>> -
>> -	{ 0x0114, 0x03 },
>> -	{ 0x0820, 0x0A },
>> -	{ 0x0821, 0x00 },
>> -	{ 0x0822, 0x00 },
>> -	{ 0x0823, 0x00 },
>> +	REG16(IMX258_REG_EXCK_FREQ, 0x1800),
>> +	REG8(IMX258_REG_IVTPXCK_DIV, 5),
>> +	REG8(IMX258_REG_IVTSYCK_DIV, 2),
>> +	REG8(IMX258_REG_PREPLLCK_VT_DIV, 4),
>> +	REG16(IMX258_REG_PLL_IVT_MPY, 0x006B),
>> +	REG8(IMX258_REG_IOPPXCK_DIV, 10),
>> +	REG8(IMX258_REG_IOPSYCK_DIV, 1),
>> +	REG8(IMX258_REG_PREPLLCK_OP_DIV, 2),
>> +	REG16(IMX258_REG_PLL_IOP_MPY, 0x00D8),
>> +	REG8(IMX258_REG_PLL_MULT_DRIV, 0),
>> +
>> +	REG8(IMX258_REG_CSI_LANE_MODE, 3),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_H, 0x0A00),
>> +	REG16(IMX258_REG_REQ_LINK_BIT_RATE_MBPS_L, 0x0000),
>>  };
>>  
>>  static const struct imx258_reg mode_common_regs[] = {
>> @@ -363,45 +368,29 @@ static const struct imx258_reg mode_common_regs[] = {
>>  	{ 0x7423, 0xD7 },
>>  	{ 0x5F04, 0x00 },
>>  	{ 0x5F05, 0xED },
>> -	{ 0x0112, 0x0A },
>> -	{ 0x0113, 0x0A },
>> -	{ 0x0342, 0x14 },
>> -	{ 0x0343, 0xE8 },
>> -	{ 0x0344, 0x00 },
>> -	{ 0x0345, 0x00 },
>> -	{ 0x0346, 0x00 },
>> -	{ 0x0347, 0x00 },
>> -	{ 0x0348, 0x10 },
>> -	{ 0x0349, 0x6F },
>> -	{ 0x034A, 0x0C },
>> -	{ 0x034B, 0x2F },
>> -	{ 0x0381, 0x01 },
>> -	{ 0x0383, 0x01 },
>> -	{ 0x0385, 0x01 },
>> -	{ 0x0387, 0x01 },
>> -	{ 0x0404, 0x00 },
>> -	{ 0x0408, 0x00 },
>> -	{ 0x0409, 0x00 },
>> -	{ 0x040A, 0x00 },
>> -	{ 0x040B, 0x00 },
>> -	{ 0x040C, 0x10 },
>> -	{ 0x040D, 0x70 },
>> -	{ 0x3038, 0x00 },
>> -	{ 0x303A, 0x00 },
>> -	{ 0x303B, 0x10 },
>> -	{ 0x300D, 0x00 },
>> -	{ 0x0350, 0x00 },
>> -	{ 0x0204, 0x00 },
>> -	{ 0x0205, 0x00 },
>> -	{ 0x020E, 0x01 },
>> -	{ 0x020F, 0x00 },
>> -	{ 0x0210, 0x01 },
>> -	{ 0x0211, 0x00 },
>> -	{ 0x0212, 0x01 },
>> -	{ 0x0213, 0x00 },
>> -	{ 0x0214, 0x01 },
>> -	{ 0x0215, 0x00 },
>> -	{ 0x7BCD, 0x00 },
>> +	REG16(IMX258_REG_CSI_DT_FMT, 0x0a0a),
>> +	REG16(IMX258_REG_LINE_LENGTH_PCK, 5352),
>> +	REG16(IMX258_REG_X_ADD_STA, 0),
>> +	REG16(IMX258_REG_Y_ADD_STA, 0),
>> +	REG16(IMX258_REG_X_ADD_END, 4207),
>> +	REG16(IMX258_REG_Y_ADD_END, 3119),
>> +	REG8(IMX258_REG_X_EVN_INC, 1),
>> +	REG8(IMX258_REG_X_ODD_INC, 1),
>> +	REG8(IMX258_REG_Y_EVN_INC, 1),
>> +	REG8(IMX258_REG_Y_ODD_INC, 1),
>> +	REG16(IMX258_REG_DIG_CROP_X_OFFSET, 0),
>> +	REG16(IMX258_REG_DIG_CROP_Y_OFFSET, 0),
>> +	REG16(IMX258_REG_DIG_CROP_IMAGE_WIDTH, 4208),
>> +	REG8(IMX258_REG_SCALE_MODE_EXT, 0),
>> +	REG16(IMX258_REG_SCALE_M_EXT, 16),
>> +	REG8(IMX258_REG_FORCE_FD_SUM, 0),
>> +	REG8(IMX258_REG_FRM_LENGTH_CTL, 0),
>> +	REG16(IMX258_REG_ANALOG_GAIN, 0),
>> +	REG16(IMX258_REG_GR_DIGITAL_GAIN, 256),
>> +	REG16(IMX258_REG_R_DIGITAL_GAIN, 256),
>> +	REG16(IMX258_REG_B_DIGITAL_GAIN, 256),
>> +	REG16(IMX258_REG_GB_DIGITAL_GAIN, 256),
>> +	REG8(IMX258_REG_AF_WINDOW_MODE, 0),
>>  	{ 0x94DC, 0x20 },
>>  	{ 0x94DD, 0x20 },
>>  	{ 0x94DE, 0x20 },
>> @@ -414,48 +403,39 @@ static const struct imx258_reg mode_common_regs[] = {
>>  	{ 0x941B, 0x50 },
>>  	{ 0x9519, 0x50 },
>>  	{ 0x951B, 0x50 },
>> -	{ 0x3030, 0x00 },
>> -	{ 0x3032, 0x00 },
>> -	{ 0x0220, 0x00 },
>> +	REG8(IMX258_REG_PHASE_PIX_OUTEN, 0),
>> +	REG8(IMX258_REG_PDPIX_DATA_RATE, 0),
>> +	REG8(IMX258_REG_HDR, 0),
>>  };
>>  
>>  static const struct imx258_reg mode_4208x3120_regs[] = {
>> -	{ 0x0900, 0x00 },
>> -	{ 0x0901, 0x11 },
>> -	{ 0x0401, 0x00 },
>> -	{ 0x0405, 0x10 },
>> -	{ 0x040E, 0x0C },
>> -	{ 0x040F, 0x30 },
>> -	{ 0x034C, 0x10 },
>> -	{ 0x034D, 0x70 },
>> -	{ 0x034E, 0x0C },
>> -	{ 0x034F, 0x30 },
>> +	REG8(IMX258_REG_BINNING_MODE, 0),
>> +	REG8(IMX258_REG_BINNING_TYPE_V, 0x11),
>> +	REG8(IMX258_REG_SCALE_MODE, 0),
>> +	REG16(IMX258_REG_SCALE_M, 16),
>> +	REG16(IMX258_REG_DIG_CROP_IMAGE_HEIGHT, 3120),
>> +	REG16(IMX258_REG_X_OUT_SIZE, 4208),
>> +	REG16(IMX258_REG_Y_OUT_SIZE, 3120),
>>  };
>>  
>>  static const struct imx258_reg mode_2104_1560_regs[] = {
>> -	{ 0x0900, 0x01 },
>> -	{ 0x0901, 0x12 },
>> -	{ 0x0401, 0x01 },
>> -	{ 0x0405, 0x20 },
>> -	{ 0x040E, 0x06 },
>> -	{ 0x040F, 0x18 },
>> -	{ 0x034C, 0x08 },
>> -	{ 0x034D, 0x38 },
>> -	{ 0x034E, 0x06 },
>> -	{ 0x034F, 0x18 },
>> +	REG8(IMX258_REG_BINNING_MODE, 1),
>> +	REG8(IMX258_REG_BINNING_TYPE_V, 0x12),
>> +	REG8(IMX258_REG_SCALE_MODE, 1),
>> +	REG16(IMX258_REG_SCALE_M, 32),
>> +	REG16(IMX258_REG_DIG_CROP_IMAGE_HEIGHT, 1560),
>> +	REG16(IMX258_REG_X_OUT_SIZE, 2104),
>> +	REG16(IMX258_REG_Y_OUT_SIZE, 1560),
>>  };
>>  
>>  static const struct imx258_reg mode_1048_780_regs[] = {
>> -	{ 0x0900, 0x01 },
>> -	{ 0x0901, 0x14 },
>> -	{ 0x0401, 0x01 },
>> -	{ 0x0405, 0x40 },
>> -	{ 0x040E, 0x03 },
>> -	{ 0x040F, 0x0C },
>> -	{ 0x034C, 0x04 },
>> -	{ 0x034D, 0x18 },
>> -	{ 0x034E, 0x03 },
>> -	{ 0x034F, 0x0C },
>> +	REG8(IMX258_REG_BINNING_MODE, 1),
>> +	REG8(IMX258_REG_BINNING_TYPE_V, 0x14),
>> +	REG8(IMX258_REG_SCALE_MODE, 1),
>> +	REG16(IMX258_REG_SCALE_M, 64),
>> +	REG16(IMX258_REG_DIG_CROP_IMAGE_HEIGHT, 780),
>> +	REG16(IMX258_REG_X_OUT_SIZE, 1048),
>> +	REG16(IMX258_REG_Y_OUT_SIZE, 780),
>>  };
>>  
>>  struct imx258_variant_cfg {
>> @@ -923,7 +903,7 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
>>  		}
>>  		break;
>>  	case V4L2_CID_VBLANK:
>> -		ret = imx258_write_reg(imx258, IMX258_REG_VTS,
>> +		ret = imx258_write_reg(imx258, IMX258_REG_FRM_LENGTH_LINES,
>>  				       IMX258_REG_VALUE_16BIT,
>>  				       imx258->cur_mode->height + ctrl->val);
>>  		break;
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 10/25] media: i2c: imx258: Follow normal V4L2 behaviours for clipping exposure
From: Luigi311 @ 2024-04-03 19:14 UTC (permalink / raw)
  To: Pavel Machek
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel
In-Reply-To: <Zg2j1XeOhFwO2Nf2@duo.ucw.cz>

On 4/3/24 12:45, Pavel Machek wrote:
> On Wed 2024-04-03 09:03:39, git@luigi311.com wrote:
>> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
>>
>> V4L2 sensor drivers are expected are expected to clip the supported
> 
> Remove one copy of "are expected".
> 
> Best regards,
> 								Pavel
> 

Done

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH 3/3] imx8mm-evk: Describe the OV5640 supplies
From: Fabio Estevam @ 2024-04-03 19:04 UTC (permalink / raw)
  To: shawnguo; +Cc: victor.liu, linux-arm-kernel, Fabio Estevam
In-Reply-To: <20240403190409.446522-1-festevam@gmail.com>

From: Fabio Estevam <festevam@denx.de>

Per ovti,ov5640.yaml, the OV5640 power supplies are mandatory
properties.

Describe them to fix dt-schema warnings.

As there are two different PMICs used on the imx8mn-evk variants,
describe the OV5640 power supplies in each board devicetree.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
index bd5b365867fd..888070b8b287 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
@@ -72,6 +72,20 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
 		enable-active-high;
 	};
 
+	reg_1v5: regulator-1v5 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V5";
+		regulator-min-microvolt = <1500000>;
+		regulator-max-microvolt = <1500000>;
+	};
+
+	reg_1v8: regulator-1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
 	reg_vddext_3v3: regulator-vddext-3v3 {
 		compatible = "regulator-fixed";
 		regulator-name = "VDDEXT_3V3";
@@ -441,6 +455,9 @@ camera@3c {
 		assigned-clock-rates = <24000000>;
 		powerdown-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
 		reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+		DOVDD-supply = <&buck5_reg>;
+		AVDD-supply = <&reg_1v8>;
+		DVDD-supply = <&reg_1v5>;
 
 		port {
 			ov5640_to_mipi_csi2: endpoint {
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 2/3] arm64: dts: imx8mn-evk: Describe the OV5640 supplies
From: Fabio Estevam @ 2024-04-03 19:04 UTC (permalink / raw)
  To: shawnguo; +Cc: victor.liu, linux-arm-kernel, Fabio Estevam
In-Reply-To: <20240403190409.446522-1-festevam@gmail.com>

From: Fabio Estevam <festevam@denx.de>

Per ovti,ov5640.yaml, the OV5640 power supplies are mandatory
properties.

Describe them to fix dt-schema warnings.

As there are two different PMICs used on the imx8mn-evk variants,
describe the OV5640 power supplies in each board devicetree.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 .../boot/dts/freescale/imx8mn-ddr3l-evk.dts      |  6 ++++++
 .../arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts |  6 ++++++
 arch/arm64/boot/dts/freescale/imx8mn-evk.dts     |  6 ++++++
 arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi    | 16 ++++++++++++++++
 4 files changed, 34 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
index 9ebd81e7eb7c..d25032e3ceab 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
@@ -122,3 +122,9 @@ hdmi@3d {
 		v1p2-supply = <&buck5>;
 	};
 };
+
+&i2c3 {
+	camera@3c {
+		DOVDD-supply = <&buck5>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
index 1a4ac39ebde8..6d85a0b052c9 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
@@ -168,3 +168,9 @@ hdmi@3d {
 		v1p2-supply = <&buck5_reg>;
 	};
 };
+
+&i2c3 {
+	camera@3c {
+		DOVDD-supply = <&buck5_reg>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
index 6f7f409c4181..41330210a05f 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
@@ -135,3 +135,9 @@ hdmi@3d {
 		v1p2-supply = <&buck5>;
 	};
 };
+
+&i2c3 {
+	camera@3c {
+		DOVDD-supply = <&buck5>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
index c06bcf86bb73..690da24a4335 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
@@ -52,6 +52,20 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
 		enable-active-high;
 	};
 
+	reg_1v5: regulator-1v5 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V5";
+		regulator-min-microvolt = <1500000>;
+		regulator-max-microvolt = <1500000>;
+	};
+
+	reg_1v8: regulator-1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDD_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
 	reg_vddext_3v3: regulator-vddext-3v3 {
 		compatible = "regulator-fixed";
 		regulator-name = "VDDEXT_3V3";
@@ -287,6 +301,8 @@ camera@3c {
 		assigned-clock-rates = <24000000>;
 		powerdown-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
 		reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+		AVDD-supply = <&reg_1v8>;
+		DVDD-supply = <&reg_1v5>;
 
 		port {
 			ov5640_to_mipi_csi2: endpoint {
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 1/3] arm64: dts: imx8mn-evk: Fix ADV7535 dt-schema warnings
From: Fabio Estevam @ 2024-04-03 19:04 UTC (permalink / raw)
  To: shawnguo; +Cc: victor.liu, linux-arm-kernel, Fabio Estevam

From: Fabio Estevam <festevam@denx.de>

Currently, there are several ADV7535 dt-schema warnings.

Fx them the same way as in commit efa97aed071e060 ("arm64: dts:
imx8mm-evk: Fix hdmi@3d node").

As there are two different PMICs used on the imx8mn-evk variants,
describe the ADV7535 power supplies in each board devicetree.

Fixes: 5aafda608f73 ("arm64: dts: imx8mn-evk: Add camera support")
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 .../boot/dts/freescale/imx8mn-ddr3l-evk.dts   | 10 +++++++
 .../boot/dts/freescale/imx8mn-ddr4-evk.dts    | 10 +++++++
 arch/arm64/boot/dts/freescale/imx8mn-evk.dts  | 10 +++++++
 arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi | 27 ++++++++++---------
 4 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
index 000e2c0596df..9ebd81e7eb7c 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr3l-evk.dts
@@ -112,3 +112,13 @@ ldo5: LDO5 {
 		};
 	};
 };
+
+&i2c2 {
+	hdmi@3d {
+		avdd-supply = <&buck5>;
+		dvdd-supply = <&buck5>;
+		pvdd-supply = <&buck5>;
+		a2vdd-supply = <&buck5>;
+		v1p2-supply = <&buck5>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
index cc2ff59ac53b..1a4ac39ebde8 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
@@ -158,3 +158,13 @@ ldo6_reg: LDO6 {
 		};
 	};
 };
+
+&i2c2 {
+	hdmi@3d {
+		avdd-supply = <&buck5_reg>;
+		dvdd-supply = <&buck5_reg>;
+		pvdd-supply = <&buck5_reg>;
+		a2vdd-supply = <&buck5_reg>;
+		v1p2-supply = <&buck5_reg>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
index 0b71f50d936e..6f7f409c4181 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dts
@@ -125,3 +125,13 @@ ldo5: LDO5 {
 		};
 	};
 };
+
+&i2c2 {
+	hdmi@3d {
+		avdd-supply = <&buck5>;
+		dvdd-supply = <&buck5>;
+		pvdd-supply = <&buck5>;
+		a2vdd-supply = <&buck5>;
+		v1p2-supply = <&buck5>;
+	};
+};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
index 269e70f66a13..c06bcf86bb73 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
@@ -30,7 +30,7 @@ hdmi-connector {
 
 		port {
 			hdmi_connector_in: endpoint {
-				remote-endpoint = <&adv7533_out>;
+				remote-endpoint = <&adv7535_out>;
 			};
 		};
 	};
@@ -52,6 +52,13 @@ reg_usdhc2_vmmc: regulator-usdhc2 {
 		enable-active-high;
 	};
 
+	reg_vddext_3v3: regulator-vddext-3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDEXT_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
 	ir-receiver {
 		compatible = "gpio-ir-receiver";
 		gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
@@ -193,15 +200,11 @@ &i2c2 {
 
 	hdmi@3d {
 		compatible = "adi,adv7535";
-		reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>;
-		reg-names = "main", "cec", "edid", "packet";
+		reg = <0x3d>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
 		adi,dsi-lanes = <4>;
-
-		adi,input-depth = <8>;
-		adi,input-colorspace = "rgb";
-		adi,input-clock = "1x";
-		adi,input-style = <1>;
-		adi,input-justification = "evenly";
+		v3p3-supply = <&reg_vddext_3v3>;
 
 		ports {
 			#address-cells = <1>;
@@ -210,7 +213,7 @@ ports {
 			port@0 {
 				reg = <0>;
 
-				adv7533_in: endpoint {
+				adv7535_in: endpoint {
 					remote-endpoint = <&dsi_out>;
 				};
 			};
@@ -218,7 +221,7 @@ adv7533_in: endpoint {
 			port@1 {
 				reg = <1>;
 
-				adv7533_out: endpoint {
+				adv7535_out: endpoint {
 					remote-endpoint = <&hdmi_connector_in>;
 				};
 			};
@@ -335,7 +338,7 @@ port@1 {
 			reg = <1>;
 
 			dsi_out: endpoint {
-				remote-endpoint = <&adv7533_in>;
+				remote-endpoint = <&adv7535_in>;
 				data-lanes = <1 2 3 4>;
 			};
 		};
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCH v3 00/25] imx258 improvement series
From: Pavel Machek @ 2024-04-03 18:50 UTC (permalink / raw)
  To: git
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel
In-Reply-To: <20240403150355.189229-1-git@luigi311.com>


[-- Attachment #1.1: Type: text/plain, Size: 257 bytes --]

Hi!

Thanks for doing this. I had some comments on 5, 9, 10, 11, 12, 21
and 22. You can add "Reviewed-by: Pavel Machek <pavel@ucw.cz>" to the
rest.

Best regards,
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 22/25] dt-bindings: media: imx258: Add binding for powerdown-gpio
From: Pavel Machek @ 2024-04-03 18:49 UTC (permalink / raw)
  To: git
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel, Ondrej Jirman
In-Reply-To: <20240403150355.189229-23-git@luigi311.com>


[-- Attachment #1.1: Type: text/plain, Size: 408 bytes --]

Hi!

> From: Luis Garcia <git@luigi311.com>
> 
> Add powerdown-gpio binding as it is required for some boards

"." at end of sentence.

> Signed-off-by: Ondrej Jirman <megi@xff.cz>
> Signed-off-by: Luis Garcia <git@luigi311.com>

If the patch is from Ondrej, he should be in From:, I believe.

Best regards,
							Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 12/25] media: i2c: imx258: Allow configuration of clock lane behaviour
From: Pavel Machek @ 2024-04-03 18:48 UTC (permalink / raw)
  To: git
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel
In-Reply-To: <20240403150355.189229-13-git@luigi311.com>


[-- Attachment #1.1: Type: text/plain, Size: 622 bytes --]

Hi!

> The sensor supports the clock lane either remaining in HS mode
> during frame blanking, or dropping to LP11.
> 
> Add configuration of the mode via V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK.

> +	ret = imx258_write_reg(imx258, IMX258_CLK_BLANK_STOP,
> +			       IMX258_REG_VALUE_08BIT,
> +			       imx258->csi2_flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK ?
> +			       1 : 0);

!! can be used to turn value into 1/0. I find it easier to read than ?
1 : 0  combination, but possibly that's fine, too.

Best regards,
								Pavel

-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 11/25] media: i2c: imx258: Add get_selection for pixel array information
From: Pavel Machek @ 2024-04-03 18:46 UTC (permalink / raw)
  To: git
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel
In-Reply-To: <20240403150355.189229-12-git@luigi311.com>


[-- Attachment #1.1: Type: text/plain, Size: 559 bytes --]

Hi!

> Libcamera requires the cropping information for each mode, so
> add this information to the driver.

> @@ -116,6 +124,9 @@ struct imx258_mode {
>  	u32 link_freq_index;
>  	/* Default register values */
>  	struct imx258_reg_list reg_list;
> +
> +	/* Analog crop rectangle. */

No need for "." at the end, as it is not above.

> +	struct v4l2_rect crop;
>  };

If the crop is same in all modes, should we have it in common place?

Best regards,
								Pavel
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 10/25] media: i2c: imx258: Follow normal V4L2 behaviours for clipping exposure
From: Pavel Machek @ 2024-04-03 18:45 UTC (permalink / raw)
  To: git
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel
In-Reply-To: <20240403150355.189229-11-git@luigi311.com>


[-- Attachment #1.1: Type: text/plain, Size: 329 bytes --]

On Wed 2024-04-03 09:03:39, git@luigi311.com wrote:
> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
> 
> V4L2 sensor drivers are expected are expected to clip the supported

Remove one copy of "are expected".

Best regards,
								Pavel

-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 09/25] media: i2c: imx258: Add support for running on 2 CSI data lanes
From: Pavel Machek @ 2024-04-03 18:45 UTC (permalink / raw)
  To: git
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel
In-Reply-To: <20240403150355.189229-10-git@luigi311.com>


[-- Attachment #1.1: Type: text/plain, Size: 1040 bytes --]

Hi!

> +/*
> + * 4208x3120 @ 30 fps needs 1267Mbps/lane, 4 lanes.
> + * To avoid further computation of clock settings, adopt the same per
> + * lane data rate when using 2 lanes, thus allowing a maximum of 15fps.
> + */
> +static const struct imx258_reg mipi_1267mbps_19_2mhz_2l[] = {
> +	{ 0x0136, 0x13 },
> +	{ 0x0137, 0x33 },
> +	{ 0x0301, 0x0A },
> +	{ 0x0303, 0x02 },
> +	{ 0x0305, 0x03 },
> +	{ 0x0306, 0x00 },
> +	{ 0x0307, 0xC6 },
> +	{ 0x0309, 0x0A },
> +	{ 0x030B, 0x01 },
> +	{ 0x030D, 0x02 },
> +	{ 0x030E, 0x00 },
> +	{ 0x030F, 0xD8 },
> +	{ 0x0310, 0x00 },
> +
> +	{ 0x0114, 0x01 },
> +	{ 0x0820, 0x09 },
> +	{ 0x0821, 0xa6 },
> +	{ 0x0822, 0x66 },
> +	{ 0x0823, 0x66 },
> +};
> +
> +static const struct imx258_reg mipi_1267mbps_19_2mhz_4l[] = {
>  	{ 0x0136, 0x13 },
>  	{ 0x0137, 0x33 },
>  	{ 0x0301, 0x05 },

I wish we did not have to copy all the magic values like this.

Best regards,
								Pavel
								
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 05/25] media: i2c: imx258: Add regulator control
From: Pavel Machek @ 2024-04-03 18:44 UTC (permalink / raw)
  To: git
  Cc: linux-media, dave.stevenson, jacopo.mondi, mchehab, robh,
	krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer, kernel,
	festevam, sakari.ailus, devicetree, imx, linux-arm-kernel,
	linux-kernel, phone-devel
In-Reply-To: <20240403150355.189229-6-git@luigi311.com>


[-- Attachment #1.1: Type: text/plain, Size: 579 bytes --]

Hi!

> The device tree bindings define the relevant regulators for the
> sensor, so update the driver to request the regulators and control
> them at the appropriate times.

> @@ -995,9 +1007,19 @@ static int imx258_power_on(struct device *dev)
>  	struct imx258 *imx258 = to_imx258(sd);
>  	int ret;
>  
> +	ret = regulator_bulk_enable(IMX258_NUM_SUPPLIES,
> +				    imx258->supplies);
> +	if (ret) {

Will this make it fail for all current users?

Best regards,
								Pavel
								
-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH net-next 3/3] net: sparx5: add support for tc flower redirect action
From: Daniel Machon @ 2024-04-03 18:41 UTC (permalink / raw)
  To: Lars Povlsen, Steen Hegelund, UNGLinuxDriver, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-arm-kernel, netdev, linux-kernel, Daniel Machon
In-Reply-To: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com>

Add support for the flower redirect action. Two VCAP actions are encoded
in the rule - one for the port mask, and one for the port mask mode.
When the rule is hit, the port mask is used as the final destination
set, replacing all other port masks.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
 .../ethernet/microchip/sparx5/sparx5_tc_flower.c   | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
index a86ce1f8f3e5..0df8724251a0 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
@@ -1042,6 +1042,34 @@ static int sparx5_tc_action_mirred(struct vcap_admin *admin,
 	return 0;
 }
 
+static int sparx5_tc_action_redirect(struct vcap_admin *admin,
+				     struct vcap_rule *vrule,
+				     struct flow_cls_offload *fco,
+				     struct flow_action_entry *act)
+{
+	struct vcap_u72_action ports = {0};
+	int err;
+
+	if (admin->vtype != VCAP_TYPE_IS0 && admin->vtype != VCAP_TYPE_IS2) {
+		NL_SET_ERR_MSG_MOD(fco->common.extack,
+				   "Redirect action not supported in this VCAP");
+		return -EOPNOTSUPP;
+	}
+
+	err = vcap_rule_add_action_u32(vrule, VCAP_AF_MASK_MODE,
+				       SPX5_PMM_REPLACE_ALL);
+	if (err)
+		return err;
+
+	sparx5_tc_flower_set_port_mask(&ports, act->dev);
+
+	err = vcap_rule_add_action_u72(vrule, VCAP_AF_PORT_MASK, &ports);
+	if (err)
+		return err;
+
+	return 0;
+}
+
 /* Remove rule keys that may prevent templates from matching a keyset */
 static void sparx5_tc_flower_simplify_rule(struct vcap_admin *admin,
 					   struct vcap_rule *vrule,
@@ -1193,6 +1221,11 @@ static int sparx5_tc_flower_replace(struct net_device *ndev,
 			if (err)
 				goto out;
 			break;
+		case FLOW_ACTION_REDIRECT:
+			err = sparx5_tc_action_redirect(admin, vrule, fco, act);
+			if (err)
+				goto out;
+			break;
 		case FLOW_ACTION_ACCEPT:
 			err = sparx5_tc_set_actionset(admin, vrule);
 			if (err)

-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH net-next 0/3] Add support for flower actions mirred and redirect
From: Daniel Machon @ 2024-04-03 18:41 UTC (permalink / raw)
  To: Lars Povlsen, Steen Hegelund, UNGLinuxDriver, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-arm-kernel, netdev, linux-kernel, Daniel Machon

================================================================================
Add support for tc flower actions mirred and redirect.
================================================================================

This series adds support for the two tc flower actions mirred and
redirect. Both actions are implemented by means of a port mask and a
mask mode. The mask mode controls how the mask is applied, and together
they are used by the switch to make a forwarding decision. Both actions
are configurable via the IS0 or IS2 VCAP's (ingress stage 0 and 2,
respectively).

Patch #1: adds support for 72-bit actions.
Patch #2: adds support for tc flower mirred action.
Patch #3: adds support for tc flower redirect action.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
Daniel Machon (3):
      net: sparx5: support 72-bit VCAP actions
      net: sparx5: add support for tc flower mirred action.
      net: sparx5: add support for tc flower redirect action

 .../ethernet/microchip/sparx5/sparx5_tc_flower.c   | 76 ++++++++++++++++++++++
 drivers/net/ethernet/microchip/vcap/vcap_api.c     | 12 ++++
 .../net/ethernet/microchip/vcap/vcap_api_client.h  |  2 +
 3 files changed, 90 insertions(+)
---
base-commit: 5fc68320c1fb3c7d456ddcae0b4757326a043e6f
change-id: 20240402-mirror-redirect-actions-cc469cc58586

Best regards,
-- 
Daniel Machon <daniel.machon@microchip.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH net-next 1/3] net: sparx5: support 72-bit VCAP actions
From: Daniel Machon @ 2024-04-03 18:41 UTC (permalink / raw)
  To: Lars Povlsen, Steen Hegelund, UNGLinuxDriver, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-arm-kernel, netdev, linux-kernel, Daniel Machon
In-Reply-To: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com>

In preparation for supporting tc flower mirred and redirect action,
extend the VCAP API to support 72-bit wide VCAP actions.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
 drivers/net/ethernet/microchip/vcap/vcap_api.c        | 12 ++++++++++++
 drivers/net/ethernet/microchip/vcap/vcap_api_client.h |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c
index ef980e4e5bc2..80ae5e1708a6 100644
--- a/drivers/net/ethernet/microchip/vcap/vcap_api.c
+++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c
@@ -2907,6 +2907,18 @@ int vcap_rule_add_action_u32(struct vcap_rule *rule,
 }
 EXPORT_SYMBOL_GPL(vcap_rule_add_action_u32);
 
+/* Add a 72 bit action field with value to the rule */
+int vcap_rule_add_action_u72(struct vcap_rule *rule,
+			     enum vcap_action_field action,
+			     struct vcap_u72_action *fieldval)
+{
+	struct vcap_client_actionfield_data data;
+
+	memcpy(&data.u72, fieldval, sizeof(data.u72));
+	return vcap_rule_add_action(rule, action, VCAP_FIELD_U72, &data);
+}
+EXPORT_SYMBOL_GPL(vcap_rule_add_action_u72);
+
 static int vcap_read_counter(struct vcap_rule_internal *ri,
 			     struct vcap_counter *ctr)
 {
diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api_client.h b/drivers/net/ethernet/microchip/vcap/vcap_api_client.h
index 88641508f885..56874f2adbba 100644
--- a/drivers/net/ethernet/microchip/vcap/vcap_api_client.h
+++ b/drivers/net/ethernet/microchip/vcap/vcap_api_client.h
@@ -200,6 +200,8 @@ int vcap_rule_add_action_bit(struct vcap_rule *rule,
 			     enum vcap_action_field action, enum vcap_bit val);
 int vcap_rule_add_action_u32(struct vcap_rule *rule,
 			     enum vcap_action_field action, u32 value);
+int vcap_rule_add_action_u72(struct vcap_rule *rule, enum vcap_action_field action,
+			     struct vcap_u72_action *fieldval);
 
 /* Get number of rules in a vcap instance lookup chain id range */
 int vcap_admin_rule_count(struct vcap_admin *admin, int cid);

-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH net-next 2/3] net: sparx5: add support for tc flower mirred action.
From: Daniel Machon @ 2024-04-03 18:41 UTC (permalink / raw)
  To: Lars Povlsen, Steen Hegelund, UNGLinuxDriver, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-arm-kernel, netdev, linux-kernel, Daniel Machon
In-Reply-To: <20240403-mirror-redirect-actions-v1-0-c8e7c8132c89@microchip.com>

Add support for tc flower mirred action. Two VCAP actions are encoded in
the rule - one for the port mask, and one for the port mask mode. When
the rule is hit, the destination mask is OR'ed with the port mask.

Also add helper to set port forwarding mask.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
 .../ethernet/microchip/sparx5/sparx5_tc_flower.c   | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
index 523e0c470894..a86ce1f8f3e5 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
@@ -1004,6 +1004,44 @@ static int sparx5_tc_action_vlan_push(struct vcap_admin *admin,
 	return err;
 }
 
+static void sparx5_tc_flower_set_port_mask(struct vcap_u72_action *ports,
+					   struct net_device *ndev)
+{
+	struct sparx5_port *port = netdev_priv(ndev);
+	int byidx = port->portno / BITS_PER_BYTE;
+	int biidx = port->portno % BITS_PER_BYTE;
+
+	ports->value[byidx] |= BIT(biidx);
+}
+
+static int sparx5_tc_action_mirred(struct vcap_admin *admin,
+				   struct vcap_rule *vrule,
+				   struct flow_cls_offload *fco,
+				   struct flow_action_entry *act)
+{
+	struct vcap_u72_action ports = {0};
+	int err;
+
+	if (admin->vtype != VCAP_TYPE_IS0 && admin->vtype != VCAP_TYPE_IS2) {
+		NL_SET_ERR_MSG_MOD(fco->common.extack,
+				   "Mirror action not supported in this VCAP");
+		return -EOPNOTSUPP;
+	}
+
+	err = vcap_rule_add_action_u32(vrule, VCAP_AF_MASK_MODE,
+				       SPX5_PMM_OR_DSTMASK);
+	if (err)
+		return err;
+
+	sparx5_tc_flower_set_port_mask(&ports, act->dev);
+
+	err = vcap_rule_add_action_u72(vrule, VCAP_AF_PORT_MASK, &ports);
+	if (err)
+		return err;
+
+	return 0;
+}
+
 /* Remove rule keys that may prevent templates from matching a keyset */
 static void sparx5_tc_flower_simplify_rule(struct vcap_admin *admin,
 					   struct vcap_rule *vrule,
@@ -1150,6 +1188,11 @@ static int sparx5_tc_flower_replace(struct net_device *ndev,
 			if (err)
 				goto out;
 			break;
+		case FLOW_ACTION_MIRRED:
+			err = sparx5_tc_action_mirred(admin, vrule, fco, act);
+			if (err)
+				goto out;
+			break;
 		case FLOW_ACTION_ACCEPT:
 			err = sparx5_tc_set_actionset(admin, vrule);
 			if (err)

-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox