media: ov2680: Allow probing if link-frequencies is absent
Subsystems (5)
Fabio Estevam
reviewerPATCH 1/2 media: ov2680: Allow probing if link-frequencies is absent
From: Fabio Estevam <[email protected]>
Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification") the ov2680 no longer probes on a imx7s-warp7:
ov2680 1-0036: error -EINVAL: supported link freq 330000000 not found ov2680 1-0036: probe with driver ov2680 failed with error -2
As the 'link-frequencies' property is not mandatory, allow the probe to succeed by skipping the link-frequency verification when the property is absent.
--- drivers/media/i2c/ov2680.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/i2c/ov2680.c +3 -0
@@ -1123,6 +1123,9 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) goto out_free_bus_cfg; } +if (!bus_cfg.nr_of_link_frequencies) +return 0 ; +for (i =0 ; i < bus_cfg.nr_of_link_frequencies; i++)if (bus_cfg.link_frequencies[i] == sensor->link_freq[0 ])break ;
Signature · 1 line
2.34.1
Fabio Estevam
reviewerPATCH 2/2 media: ov2680: Report success on link-frequency match
From: Fabio Estevam <[email protected]>
When passing the correct 'link-frequencies' in the DT, the driver should report success on the match case:
port {
ov2680_to_mipi: endpoint {
remote-endpoint = <&mipi_from_sensor>;
clock-lanes = <0>;
data-lanes = <1>;
link-frequencies = /bits/ 64 <330000000>;
};
};However, this does not happen and the probe fails like this:
ov2680 1-0036: probe with driver ov2680 failed with error -22
Fix it by returning success upon link-frequency match.
Also tested passing a wrong link-frequencies value in th DT and confirmed that the driver correctly rejects it.
--- drivers/media/i2c/ov2680.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov2680.c +1 -1
@@ -1128,7 +1128,7 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor)for (i =0 ; i < bus_cfg.nr_of_link_frequencies; i++)if (bus_cfg.link_frequencies[i] == sensor->link_freq[0 ]) -break ; +return 0 ;if (bus_cfg.nr_of_link_frequencies ==0 || bus_cfg.nr_of_link_frequencies == i) {
Signature · 1 line
2.34.1
Re: [PATCH 2/2] media: ov2680: Report success on link-frequency match
Hi Fabio,
Quoted 34 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
When passing the correct 'link-frequencies' in the DT, the driver should report success on the match case:
port { ov2680_to_mipi: endpoint { remote-endpoint = <&mipi_from_sensor>; clock-lanes = <0>; data-lanes = <1>; link-frequencies = /bits/ 64 <330000000>; }; };However, this does not happen and the probe fails like this:
ov2680 1-0036: probe with driver ov2680 failed with error -22
Fix it by returning success upon link-frequency match.
Also tested passing a wrong link-frequencies value in th DT and confirmed that the driver correctly rejects it.
Fixes 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")Signed-off-by Fabio Estevam <[email protected]>--- drivers/media/i2c/ov2680.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/ov2680.c +0
-0
drivers/media/i2c/ov2680.c static int ov2680_parse_dt(struct ov2680_dev *sensor) · line 1131
Quoted 5 lines
drivers/media/i2c/ov2680.c +1
-1@@ -1128,7 +1128,7 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor)for (i =0 ; i < bus_cfg.nr_of_link_frequencies; i++)if (bus_cfg.link_frequencies[i] == sensor->link_freq[0 ]) -break ; +return 0 ;
If you need this then that suggests that bus_cfg.nr_of_link_frequencies != 0 otherwise this patch will not make a difference. So that suggests that patch 1/2 is not necessary ?
And if bus_cfg.nr_of_link_frequencies != 0 and we break then:
drivers/media/i2c/ov2680.c static int ov2680_parse_dt(struct ov2680_dev *sensor) · line 1133
Quoted 3 lines
drivers/media/i2c/ov2680.c +0
-0if (bus_cfg.nr_of_link_frequencies ==0 || bus_cfg.nr_of_link_frequencies == i) {
This will never be true (neither condition is true) so we will continue with a clean exit of the function. Except that that clean exit does "return ret" and I see there may some paths where that is not 0 even though we are doing a clean exit.
I think that what is necessary for your case with fixed dts file is:
drivers/media/i2c/ov2680.c +2 -0
@@ -1179,6 +1179,8 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) goto out_free_bus_cfg; } + ret =0 ; + out_free_bus_cfg:v4l2_fwnode_endpoint_free (&bus_cfg);return ret;
and that then replaces both your patches, can you give this a try ?
Regards,
Hans
p.s.
Your early return 0 in this patch also leaks the bus_cfg.
Fabio Estevam
reviewerRe: [PATCH 2/2] media: ov2680: Report success on link-frequency match
Hi Hans,
[Adding DT folks]
Quoted 16 lines · Hans de Goede
I think that what is necessary for your case with fixed dts file is:
drivers/media/i2c/ov2680.c +2
-0@@ -1179,6 +1179,8 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) goto out_free_bus_cfg; } + ret =0 ; + out_free_bus_cfg:v4l2_fwnode_endpoint_free (&bus_cfg);return ret;
Quoted 1 line
and that then replaces both your patches, can you give this a try ?
This works fine if I pass link-frequencies in the dts, thanks.
arch/arm/boot/dts/nxp/imx/imx7s-warp.dts +1 -0
@@ -210,6 +210,7 @@ ov2680_to_mipi: endpoint { remote-endpoint = <&mipi_from_sensor>; clock-lanes = <0>; data-lanes = <1>; + link-frequencies = /bits/ 64 <340000000>; }; }; };
Can we allow the probe to succeed even if 'link frequencies' is absent?
That was my goal on patch 1/2: to keep existing dtb's functional.
Otherwise, the old dtb's without 'link-frequencies' will be broken and I'm not sure if the DT folks will accept a patch passing link-frequencies to imx7s-warp.dts
as a fix to be backported to 6.6.
ovti,ov2680.yaml will also need to be changed to include 'link-frequencies' as a required property.
Thoughts?
Sakari Ailus
maintainerHi Fabio,
Quoted 23 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Since commit
63b0cd30b78e("media: ov2680: Add bus-cfg / endpoint property verification") the ov2680 no longer probes on a imx7s-warp7:ov2680 1-0036: error
-EINVAL: supported link freq 330000000 not found ov2680 1-0036: probe with driver ov2680 failed with error -2As the 'link-frequencies' property is not mandatory, allow the probe to succeed by skipping the link-frequency verification when the property is absent.
Fixes 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")Signed-off-by Fabio Estevam <[email protected]>--- drivers/media/i2c/ov2680.c | 3 +++ 1 file changed, 3 insertions(+)drivers/media/i2c/ov2680.c +0
-0
drivers/media/i2c/ov2680.c static int ov2680_parse_dt(struct ov2680_dev *sensor) · line 1128
Quoted 6 lines
drivers/media/i2c/ov2680.c +3
-0@@ -1123,6 +1123,9 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) goto out_free_bus_cfg; } +if (!bus_cfg.nr_of_link_frequencies) +return 0 ; +
Thanks for the patch.
I'd still rather try to avoid going to this direction as these frequencies are hardware dependent. Add a new one to the driver and some boards may stop working properly. For details see <URL:https://hverkuil.home.xs4all.nl/spec/driver-api/camera-sensor.html#handling-clocks>.
Quoted 3 lines
drivers/media/i2c/ov2680.c +0
-0for (i =0 ; i < bus_cfg.nr_of_link_frequencies; i++)if (bus_cfg.link_frequencies[i] == sensor->link_freq[0 ])break ;
Signature · 3 lines
Kind regards, Sakari Ailus
Sakari Ailus
maintainerQuoted 35 lines · Sakari Ailus
Hi Fabio,
Quoted 23 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Since commit
63b0cd30b78e("media: ov2680: Add bus-cfg / endpoint property verification") the ov2680 no longer probes on a imx7s-warp7:ov2680 1-0036: error
-EINVAL: supported link freq 330000000 not found ov2680 1-0036: probe with driver ov2680 failed with error -2As the 'link-frequencies' property is not mandatory, allow the probe to succeed by skipping the link-frequency verification when the property is absent.
Fixes 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")Signed-off-by Fabio Estevam <[email protected]>--- drivers/media/i2c/ov2680.c | 3 +++ 1 file changed, 3 insertions(+)drivers/media/i2c/ov2680.c +0
-0drivers/media/i2c/ov2680.c static int ov2680_parse_dt(struct ov2680_dev *sensor) · line 1128
Quoted 6 lines
drivers/media/i2c/ov2680.c +3
-0@@ -1123,6 +1123,9 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) goto out_free_bus_cfg; } +if (!bus_cfg.nr_of_link_frequencies) +return 0 ; +Thanks for the patch.
Quoted 4 lines
I'd still rather try to avoid going to this direction as these frequencies are hardware dependent. Add a new one to the driver and some boards may stop working properly. For details see <URL:https://hverkuil.home.xs4all.nl/spec/driver-api/camera-sensor.html#handling-clocks>.
While the above holds, on second thought, the driver has been around for quite some time and indeed the added validation does break certain boards (at least without adding the link frequencies there).
So I'm fine with the patch.
I think this should also be cc'd to stable.
Quoted 5 lines
Quoted 4 lines
drivers/media/i2c/ov2680.c +0
-0for (i =0 ; i < bus_cfg.nr_of_link_frequencies; i++)if (bus_cfg.link_frequencies[i] == sensor->link_freq[0 ])break ;
Signature · 1 line
Sakari Ailus
Sakari Ailus
maintainerQuoted 41 lines · Sakari Ailus
Quoted 35 lines · Sakari Ailus
Hi Fabio,
Quoted 23 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Since commit
63b0cd30b78e("media: ov2680: Add bus-cfg / endpoint property verification") the ov2680 no longer probes on a imx7s-warp7:ov2680 1-0036: error
-EINVAL: supported link freq 330000000 not found ov2680 1-0036: probe with driver ov2680 failed with error -2As the 'link-frequencies' property is not mandatory, allow the probe to succeed by skipping the link-frequency verification when the property is absent.
Fixes 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")Signed-off-by Fabio Estevam <[email protected]>--- drivers/media/i2c/ov2680.c | 3 +++ 1 file changed, 3 insertions(+)drivers/media/i2c/ov2680.c +0
-0drivers/media/i2c/ov2680.c static int ov2680_parse_dt(struct ov2680_dev *sensor) · line 1128
Quoted 6 lines
drivers/media/i2c/ov2680.c +3
-0@@ -1123,6 +1123,9 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) goto out_free_bus_cfg; } +if (!bus_cfg.nr_of_link_frequencies) +return 0 ; +Thanks for the patch.
Quoted 4 lines
I'd still rather try to avoid going to this direction as these frequencies are hardware dependent. Add a new one to the driver and some boards may stop working properly. For details see <URL:https://hverkuil.home.xs4all.nl/spec/driver-api/camera-sensor.html#handling-clocks>.
Quoted 7 lines
While the above holds, on second thought, the driver has been around for quite some time and indeed the added validation does break certain boards (at least without adding the link frequencies there).
So I'm fine with the patch.
I think this should also be cc'd to stable.
And this applies to the newer version of the patch that fixes the memory leak, of course.
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
drivers/media/i2c/ov2680.c +0
-0for (i =0 ; i < bus_cfg.nr_of_link_frequencies; i++)if (bus_cfg.link_frequencies[i] == sensor->link_freq[0 ])break ;Signature · 1 line
Sakari Ailus
Signature · 1 line
Sakari Ailus
Quoted 46 lines · Sakari Ailus
Quoted 45 lines · Sakari Ailus
Quoted 35 lines · Sakari Ailus
Hi Fabio,
Quoted 23 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Since commit
63b0cd30b78e("media: ov2680: Add bus-cfg / endpoint property verification") the ov2680 no longer probes on a imx7s-warp7:ov2680 1-0036: error
-EINVAL: supported link freq 330000000 not found ov2680 1-0036: probe with driver ov2680 failed with error -2As the 'link-frequencies' property is not mandatory, allow the probe to succeed by skipping the link-frequency verification when the property is absent.
Fixes 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")Signed-off-by Fabio Estevam <[email protected]>--- drivers/media/i2c/ov2680.c | 3 +++ 1 file changed, 3 insertions(+)drivers/media/i2c/ov2680.c +0
-0drivers/media/i2c/ov2680.c static int ov2680_parse_dt(struct ov2680_dev *sensor) · line 1128
Quoted 6 lines
drivers/media/i2c/ov2680.c +3
-0@@ -1123,6 +1123,9 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) goto out_free_bus_cfg; } +if (!bus_cfg.nr_of_link_frequencies) +return 0 ; +Thanks for the patch.
Quoted 4 lines
I'd still rather try to avoid going to this direction as these frequencies are hardware dependent. Add a new one to the driver and some boards may stop working properly. For details see <URL:https://hverkuil.home.xs4all.nl/spec/driver-api/camera-sensor.html#handling-clocks>.
While the above holds, on second thought, the driver has been around for quite some time and indeed the added validation does break certain boards (at least without adding the link frequencies there).
Quoted 6 lines
Quoted 3 lines
So I'm fine with the patch.
I think this should also be cc'd to stable.
And this applies to the newer version of the patch that fixes the memory leak, of course.
Should we add least log a warning when link frequencies are not present in DT ?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/media/i2c/ov2680.c +0
-0for (i =0 ; i < bus_cfg.nr_of_link_frequencies; i++)if (bus_cfg.link_frequencies[i] == sensor->link_freq[0 ])break ;
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
maintainerQuoted 49 lines · Laurent Pinchart
Quoted 48 lines · Sakari Ailus
Quoted 47 lines · Sakari Ailus
Quoted 35 lines · Sakari Ailus
Hi Fabio,
Quoted 23 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
Since commit
63b0cd30b78e("media: ov2680: Add bus-cfg / endpoint property verification") the ov2680 no longer probes on a imx7s-warp7:ov2680 1-0036: error
-EINVAL: supported link freq 330000000 not found ov2680 1-0036: probe with driver ov2680 failed with error -2As the 'link-frequencies' property is not mandatory, allow the probe to succeed by skipping the link-frequency verification when the property is absent.
Fixes 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")Signed-off-by Fabio Estevam <[email protected]>--- drivers/media/i2c/ov2680.c | 3 +++ 1 file changed, 3 insertions(+)drivers/media/i2c/ov2680.c +0
-0drivers/media/i2c/ov2680.c static int ov2680_parse_dt(struct ov2680_dev *sensor) · line 1128
Quoted 6 lines
drivers/media/i2c/ov2680.c +3
-0@@ -1123,6 +1123,9 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) goto out_free_bus_cfg; } +if (!bus_cfg.nr_of_link_frequencies) +return 0 ; +Thanks for the patch.
Quoted 4 lines
I'd still rather try to avoid going to this direction as these frequencies are hardware dependent. Add a new one to the driver and some boards may stop working properly. For details see <URL:https://hverkuil.home.xs4all.nl/spec/driver-api/camera-sensor.html#handling-clocks>.
While the above holds, on second thought, the driver has been around for quite some time and indeed the added validation does break certain boards (at least without adding the link frequencies there).
So I'm fine with the patch.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
I think this should also be cc'd to stable.
And this applies to the newer version of the patch that fixes the memory leak, of course.
Should we add least log a warning when link frequencies are not present in DT ?
Sounds reasonable.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/media/i2c/ov2680.c +0
-0for (i =0 ; i < bus_cfg.nr_of_link_frequencies; i++)if (bus_cfg.link_frequencies[i] == sensor->link_freq[0 ])break ;
Signature · 1 line
Sakari Ailus