lkml.org 
[lkml]   [2020]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms
From
Date
Hi Sakari

On 17/09/2020 11:33, Sakari Ailus wrote:
>> + ret = software_node_register_nodes(nodes);
>> + if (ret) {
>> + dev_err(dev,
>> + "Failed to register software nodes for %s\n",
>> + supported_devices[i]);
>> + return ret;
>> + }
>> +
>> + fwnode = software_node_fwnode(&nodes[SWNODE_SENSOR_HID]);
>> + if (!fwnode) {
>> + dev_err(dev,
>> + "Failed to get software node for %s\n",
>> + supported_devices[i]);
>> + return ret;
>> + }
>> +
>> + fwnode->secondary = ERR_PTR(-ENODEV);
>> + dev->fwnode = fwnode;
>> +
>> + /*
>> + * The device should by this point has driver_data set to an
>> + * instance of struct v4l2_subdev; set the fwnode for that too.
>> + */
>> +
>> + sd = dev_get_drvdata(dev);
>> + sd->fwnode = fwnode;
> I'm a bit lost here. Isn't it enough to have the sensor device's fwnode,
> and to use that for V4L2 async fwnode matching (as usual)?

Just working through the changes everyone's suggested for the v2. For
this one the reason it had to be this way is that
v4l2_async_register_subdev() just picks up the fwnode from the device.
If we wanted to just rely on that call as part of the sensor driver's
probe() then we need to reprobe() the sensor in case it already probed
before this code has managed to run, and reprobing after assigning the
software_nodes as fwnode to the sensor no longer works - the long and
short of that is that the ACPI matching portion of i2c_device_match()
calls ACPI_COMPANION(dev), and that macro relies on dev->fwnode->ops
being acpi_device_fwnode_ops which they no longer are. This is also the
reason I was storing the original fwnode's of the sensor device and cio2
device in the cio2-bridge; so that they could be restored if the module
was removed.



\
 
 \ /
  Last update: 2020-09-23 11:40    [W:0.251 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site