diff mbox series

[03/13] media: i2c: Defer probe if not endpoint found

Message ID 20210722203407.3588046-4-djrscally@gmail.com
State Superseded
Headers show
Series [01/13] media: i2c: Add ACPI support to ov8865 | expand

Commit Message

Daniel Scally July 22, 2021, 8:33 p.m. UTC
The ov8865 driver is one of those that can be connected to a CIO2
device by the cio2-bridge code. This means that the absence of an
endpoint for this device is not necessarily fatal, as one might be
built by the cio2-bridge when it probes. Return -EPROBE_DEFER if no
endpoint is found rather than a fatal error.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
 drivers/media/i2c/ov8865.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Paul Kocialkowski July 23, 2021, 7:49 a.m. UTC | #1
Hi Daniel,

On Thu 22 Jul 21, 21:33, Daniel Scally wrote:
> The ov8865 driver is one of those that can be connected to a CIO2

> device by the cio2-bridge code. This means that the absence of an

> endpoint for this device is not necessarily fatal, as one might be

> built by the cio2-bridge when it probes. Return -EPROBE_DEFER if no

> endpoint is found rather than a fatal error.


Is this an error that you have actually seen in practice?

My understanding is that this function should return the handle to the *local*
fwnode graph endpoint, which relates to the static device-tree description
and should be unrelated to another driver probing.

So as far as I can see, this should not be needed (but correct me if I'm wrong).

Cheers,

Paul

> Signed-off-by: Daniel Scally <djrscally@gmail.com>

> ---

>  drivers/media/i2c/ov8865.c | 6 ++----

>  1 file changed, 2 insertions(+), 4 deletions(-)

> 

> diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c

> index 2ef146e7e7ef..66182142c28b 100644

> --- a/drivers/media/i2c/ov8865.c

> +++ b/drivers/media/i2c/ov8865.c

> @@ -2796,10 +2796,8 @@ static int ov8865_probe(struct i2c_client *client)

>  	/* Graph Endpoint */

>  

>  	handle = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);

> -	if (!handle) {

> -		dev_err(dev, "unable to find endpoint node\n");

> -		return -EINVAL;

> -	}

> +	if (!handle)

> +		return -EPROBE_DEFER;

>  

>  	sensor->endpoint.bus_type = V4L2_MBUS_CSI2_DPHY;

>  

> -- 

> 2.25.1

> 


-- 
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Daniel Scally July 23, 2021, 9:15 a.m. UTC | #2
Hi Paul

On 23/07/2021 08:49, Paul Kocialkowski wrote:
> Hi Daniel,

>

> On Thu 22 Jul 21, 21:33, Daniel Scally wrote:

>> The ov8865 driver is one of those that can be connected to a CIO2

>> device by the cio2-bridge code. This means that the absence of an

>> endpoint for this device is not necessarily fatal, as one might be

>> built by the cio2-bridge when it probes. Return -EPROBE_DEFER if no

>> endpoint is found rather than a fatal error.

> Is this an error that you have actually seen in practice?



Yes

> My understanding is that this function should return the handle to the *local*

> fwnode graph endpoint, which relates to the static device-tree description

> and should be unrelated to another driver probing.

>

> So as far as I can see, this should not be needed (but correct me if I'm wrong).



It's a newly possible scenario - some laptops with Intel IPU3s have ACPI
that is _creative_,. and rather than define the endpoints in an ACPI
device's _DSD they're encoded within a buffer that's against the sensor
devices instead. We're parsing those out and building the fwnode graph
using software nodes in the ipu3-cio2 driver:


https://elixir.bootlin.com/linux/v5.14-rc2/source/drivers/media/pci/intel/ipu3/cio2-bridge.c#L166


But that means there's no endpoint for the sensor until ipu3-cio2 has
probed.


Thanks

Dan

>

> Cheers,

>

> Paul

>

>> Signed-off-by: Daniel Scally <djrscally@gmail.com>

>> ---

>>  drivers/media/i2c/ov8865.c | 6 ++----

>>  1 file changed, 2 insertions(+), 4 deletions(-)

>>

>> diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c

>> index 2ef146e7e7ef..66182142c28b 100644

>> --- a/drivers/media/i2c/ov8865.c

>> +++ b/drivers/media/i2c/ov8865.c

>> @@ -2796,10 +2796,8 @@ static int ov8865_probe(struct i2c_client *client)

>>  	/* Graph Endpoint */

>>  

>>  	handle = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);

>> -	if (!handle) {

>> -		dev_err(dev, "unable to find endpoint node\n");

>> -		return -EINVAL;

>> -	}

>> +	if (!handle)

>> +		return -EPROBE_DEFER;

>>  

>>  	sensor->endpoint.bus_type = V4L2_MBUS_CSI2_DPHY;

>>  

>> -- 

>> 2.25.1

>>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
index 2ef146e7e7ef..66182142c28b 100644
--- a/drivers/media/i2c/ov8865.c
+++ b/drivers/media/i2c/ov8865.c
@@ -2796,10 +2796,8 @@  static int ov8865_probe(struct i2c_client *client)
 	/* Graph Endpoint */
 
 	handle = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);
-	if (!handle) {
-		dev_err(dev, "unable to find endpoint node\n");
-		return -EINVAL;
-	}
+	if (!handle)
+		return -EPROBE_DEFER;
 
 	sensor->endpoint.bus_type = V4L2_MBUS_CSI2_DPHY;