[libcamera-devel] Fwd: Surface Go VCM type (was: Need to pass acpi_enforce_resources=lax on the Surface Go (version1))
Hans de Goede
hdegoede at redhat.com
Mon Nov 8 14:12:38 CET 2021
Hi,
On 11/2/21 00:43, Daniel Scally wrote:
> Hi Hans
<snip>
>> 2. I need some help with all the fwnode link stuff (I'm not very familiar
>> with this). There seems to be a chicken and egg problem here though,
>> because the v4l2subdev for the VCM does not register because of async stuff
>> and if we add it to the "graph" then my idea to enumerate the VCMs
>> from the SSDB on the complete() callback won't work. But we can do this
>> on a per sensor basis instead from the cio2_notifier_bound() callback
>> instead I guess ?
>
>
> I think on top of your work in the cio2-bridge for patch 3 you can do this:
>
>
> 1. Create another software node against the cio2_sensor struct, with the
> name coming from the vcm_types array
>
> 2. Assign that software node to board_info.swnode in
> cio2_bridge_instantiate_vcm_i2c_client()
>
> 3. Add another entry to dev_properties for the sensor, that is named
> "lens-focus" and contains a reference to the software_node created in #2
> just like the references to the sensor/cio2 nodes.
>
>
> This way when the sensor driver calls
> v4l2_async_register_subdev_sensor() it should create a notifier that
> looks for that VCM client to bind. I think then rather than putting
> anything in the .bound() / .complete() callbacks, we should modify core
> to do _something_ when async matching some subdevs. The something would
> depend on the kind of devices that match, for example with the sensor
> driver and the ipu3-cio2 driver, there's an entity whos function is
> MEDIA_ENT_F_VID_IF_BRIDGE matching to an entity whos function is
> MEDIA_ENT_F_CAM_SENSOR, and it seems to me that every scenario like that
> is going to result in media pad links being created. Similarly for our
> sensor that's a device with entity function MEDIA_ENT_F_LENS matching to
> MEDIA_ENT_F_CAM_SENSOR, and I think that in those cases we can create
> either an interface link or a new kind of link (maybe
> "MEDIA_LNK_FL_ANCILLARY_LINK" or something...) between the two to show
> that they form a single logical unit, which we can then report to libcamera.
>
>
> Hope that makes sense...
Ok, so I gave this a try, see the attached patches, but the v4l2-subdev for
the VCM still does not show up.
I think that instead I need to build a full link between the sensor
and the VCM similar to the cio2 <-> sensor link. Both ends of that link
have:
<base-swnode attached to the device>
|
--<port-swnode named (SWNODE_GRAPH_PORT_NAME_FMT, X), where X is 0 on the
| sensor side and the link nr on the cio2 side
|
--<end-point-swnode named (SWNODE_GRAPH_ENDPOINT_NAME_FMT, 0)
And then the 2 endpoints contain a swref property pointing to the
other endpoint swnode.
I think we need a similar setup adding a swnode child named
(SWNODE_GRAPH_PORT_NAME_FMT, 1), to the nodes[SWNODE_SENSOR_HID] node.
Note 1, since 0 is the "port" to the cio2, this new port child then
gets an endpoint "0" child itself, likewise we add a "port 0" child
to the vcm swnode, with a "endpoint 0" child below that and then have
the 2 endpoints contain swref properties pointing to each other.
I think that this will properly make the VCm part of the graph and
will make its v4l2-subdev get instantiated when the graph is
complete. Before I spend a bunch of time on implementing this,
let me ask this:
Does this sound reasonable / like I'm heading in the right direction?
Regards,
Hans
p.s.
I have found a new solution for the probe-ordering problem which
is patch 2 of the attached patches, I personally I'm happy with
this solution. I hope you like it too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-i2c-acpi-Add-i2c_acpi_new_device_by_fwnode-function.patch
Type: text/x-patch
Size: 4195 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20211108/da4b54b4/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-media-ipu3-cio2-Defer-probing-until-the-PMIC-is-full.patch
Type: text/x-patch
Size: 2778 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20211108/da4b54b4/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-media-ipu3-cio2-Call-cio2_bridge_init-before-anythin.patch
Type: text/x-patch
Size: 1454 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20211108/da4b54b4/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-media-ipu3-cio2-Add-support-for-instantiating-i2c-cl.patch
Type: text/x-patch
Size: 6090 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20211108/da4b54b4/attachment-0007.bin>
More information about the libcamera-devel
mailing list