All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Scally <djrscally@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: yong.zhi@intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com,
	mchehab@kernel.org, gregkh@linuxfoundation.org,
	davem@davemloft.net, robh@kernel.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	devel@driverdev.osuosl.org, jorhand@linux.microsoft.com,
	kitakar@gmail.com, kieran.bingham@ideasonboard.com,
	andriy.shevchenko@linux.intel.com
Subject: Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms
Date: Mon, 28 Sep 2020 12:37:55 +0100	[thread overview]
Message-ID: <060b458e-66ee-ab22-5c4c-c8e04affff7b@gmail.com> (raw)
In-Reply-To: <20200917103343.GW26842@paasikivi.fi.intel.com>

On 17/09/2020 11:33, Sakari Ailus wrote:
>> +		sensor_props[3] = PROPERTY_ENTRY_U32_ARRAY_LEN("data-lanes",
>> +							       data_lanes,
>> +							       (int)ssdb->lanes);
>> +		sensor_props[4] = remote_endpoints[(bridge.n_sensors * 2) + ENDPOINT_SENSOR];
>> +		sensor_props[5] = PROPERTY_ENTRY_NULL;
>> +
>> +		cio2_props[0] = PROPERTY_ENTRY_U32_ARRAY_LEN("data-lanes",
>> +							     data_lanes,
>> +							     (int)ssdb->lanes);
>> +		cio2_props[1] = remote_endpoints[(bridge.n_sensors * 2) + ENDPOINT_CIO2];
>> +		cio2_props[2] = PROPERTY_ENTRY_NULL;
> I suppose the CSI-2 link frequency is generally encoded in drivers in this
> case. A lot of drivers already check for those, could you add the
> frequencies here as well (as they are known)?

This one caused me some consternation; I mentioned in a previous email
that I was overwriting the v4l2_subdev's fwnode directly because I
couldn't reprobe() the devices after changing their fwnode. Turns out
that's probably not ok, because as you point out there are some drivers
that check for properties in firmware as part of their .probe() call, so
they _have_ to be there for those to work (including ov5670, which is
the canonical ipu3 driver in the kernel docs). imx258 and ov13858 are
also affected, and I'm aware of at least one other driver in development
that would be affected.


The problem preventing the reprobe working is that i2c_device_match()
relies on a device's fwnode having acpi_device_fwnode_ops to perform
ACPI matching, so after giving the device our software nodes the
matching just fails. I thrashed out a way to make the reprobe work, but
I don't really like the solution so I wanted to talk about it. The long
story short is; clone the driver but add an i2c_device_id matching the
existing i2c_client's name, then use i2c_add_driver() to install it to
the bus before calling device_reprobe(). This does work; it makes the
devices reprobe cleanly at the end of cio2-bridge's init, but it feels a
little bit hacky. Any thoughts? Or if it makes it easier to discuss, I
can just post the v2 containing all the changes that people suggested
after the v1, and showing how this reprobe would work.


WARNING: multiple messages have this Message-ID (diff)
From: Dan Scally <djrscally@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: devel@driverdev.osuosl.org, robh@kernel.org,
	andriy.shevchenko@linux.intel.com, jorhand@linux.microsoft.com,
	linux-media@vger.kernel.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, kieran.bingham@ideasonboard.com,
	kitakar@gmail.com, bingbu.cao@intel.com, mchehab@kernel.org,
	davem@davemloft.net, tian.shu.qiu@intel.com, yong.zhi@intel.com
Subject: Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms
Date: Mon, 28 Sep 2020 12:37:55 +0100	[thread overview]
Message-ID: <060b458e-66ee-ab22-5c4c-c8e04affff7b@gmail.com> (raw)
In-Reply-To: <20200917103343.GW26842@paasikivi.fi.intel.com>

On 17/09/2020 11:33, Sakari Ailus wrote:
>> +		sensor_props[3] = PROPERTY_ENTRY_U32_ARRAY_LEN("data-lanes",
>> +							       data_lanes,
>> +							       (int)ssdb->lanes);
>> +		sensor_props[4] = remote_endpoints[(bridge.n_sensors * 2) + ENDPOINT_SENSOR];
>> +		sensor_props[5] = PROPERTY_ENTRY_NULL;
>> +
>> +		cio2_props[0] = PROPERTY_ENTRY_U32_ARRAY_LEN("data-lanes",
>> +							     data_lanes,
>> +							     (int)ssdb->lanes);
>> +		cio2_props[1] = remote_endpoints[(bridge.n_sensors * 2) + ENDPOINT_CIO2];
>> +		cio2_props[2] = PROPERTY_ENTRY_NULL;
> I suppose the CSI-2 link frequency is generally encoded in drivers in this
> case. A lot of drivers already check for those, could you add the
> frequencies here as well (as they are known)?

This one caused me some consternation; I mentioned in a previous email
that I was overwriting the v4l2_subdev's fwnode directly because I
couldn't reprobe() the devices after changing their fwnode. Turns out
that's probably not ok, because as you point out there are some drivers
that check for properties in firmware as part of their .probe() call, so
they _have_ to be there for those to work (including ov5670, which is
the canonical ipu3 driver in the kernel docs). imx258 and ov13858 are
also affected, and I'm aware of at least one other driver in development
that would be affected.


The problem preventing the reprobe working is that i2c_device_match()
relies on a device's fwnode having acpi_device_fwnode_ops to perform
ACPI matching, so after giving the device our software nodes the
matching just fails. I thrashed out a way to make the reprobe work, but
I don't really like the solution so I wanted to talk about it. The long
story short is; clone the driver but add an i2c_device_id matching the
existing i2c_client's name, then use i2c_add_driver() to install it to
the bus before calling device_reprobe(). This does work; it makes the
devices reprobe cleanly at the end of cio2-bridge's init, but it feels a
little bit hacky. Any thoughts? Or if it makes it easier to discuss, I
can just post the v2 containing all the changes that people suggested
after the v1, and showing how this reprobe would work.

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2020-09-28 11:38 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 21:36 [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms Daniel Scally
2020-09-16 21:36 ` Daniel Scally
2020-09-17  0:17 ` kernel test robot
2020-09-17  3:02 ` kernel test robot
2020-09-17  7:53 ` Greg KH
2020-09-17  7:53   ` Greg KH
2020-09-17  9:47   ` Dan Scally
2020-09-17  9:47     ` Dan Scally
2020-09-17 10:15     ` Dan Carpenter
2020-09-17 10:15       ` Dan Carpenter
2020-09-17 10:24       ` Dan Scally
2020-09-17 10:24         ` Dan Scally
2020-09-17 13:28     ` Kieran Bingham
2020-09-17 13:28       ` Kieran Bingham
2020-09-17 14:08       ` Andy Shevchenko
2020-09-17 14:08         ` Andy Shevchenko
2020-09-17 14:19         ` Kieran Bingham
2020-09-17 14:19           ` Kieran Bingham
2020-09-17 14:36           ` Andy Shevchenko
2020-09-17 14:36             ` Andy Shevchenko
2020-09-17  9:34 ` Dan Carpenter
2020-09-17  9:34   ` Dan Carpenter
2020-09-17 10:19   ` Joe Perches
2020-09-17 10:19     ` Joe Perches
2020-09-18 22:50   ` Dan Scally
2020-09-18 22:50     ` Dan Scally
2020-09-17 10:33 ` Sakari Ailus
2020-09-17 10:33   ` Sakari Ailus
2020-09-17 10:49   ` Dan Carpenter
2020-09-17 10:49     ` Dan Carpenter
2020-09-17 12:25     ` Andy Shevchenko
2020-09-17 12:25       ` Andy Shevchenko
2020-09-17 13:15       ` Dan Carpenter
2020-09-17 13:15         ` Dan Carpenter
2020-09-18  6:40     ` Sakari Ailus
2020-09-18  6:40       ` Sakari Ailus
2020-09-18  8:16       ` Dan Carpenter
2020-09-18  8:16         ` Dan Carpenter
2020-09-17 10:52   ` Dan Scally
2020-09-17 10:52     ` Dan Scally
2020-09-17 12:45     ` Andy Shevchenko
2020-09-17 12:45       ` Andy Shevchenko
2020-09-17 13:36       ` Dan Scally
2020-09-17 13:36         ` Dan Scally
2020-09-17 14:14         ` Andy Shevchenko
2020-09-17 14:14           ` Andy Shevchenko
2020-09-17 21:25           ` Daniel Scally
2020-09-17 21:25             ` Daniel Scally
2020-09-17 14:44         ` Andy Shevchenko
2020-09-17 14:44           ` Andy Shevchenko
2020-09-18  7:51       ` Sakari Ailus
2020-09-18  7:51         ` Sakari Ailus
2020-09-18 13:07         ` Andy Shevchenko
2020-09-18 13:07           ` Andy Shevchenko
2020-09-21 13:33           ` Dan Scally
2020-09-21 13:33             ` Dan Scally
2020-09-21 14:33             ` Andy Shevchenko
2020-09-21 14:33               ` Andy Shevchenko
2020-09-23  9:39   ` Dan Scally
2020-09-23  9:39     ` Dan Scally
2020-09-28 11:37   ` Dan Scally [this message]
2020-09-28 11:37     ` Dan Scally
2020-09-18  8:03 ` Dan Carpenter
2020-09-18  8:03   ` Dan Carpenter
2020-09-18  8:09   ` Dan Scally
2020-09-18  8:09     ` Dan Scally
2020-09-20 21:34 ` kernel test robot
2020-09-20 21:34 ` [RFC PATCH] cio2_sync_state() can be static kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=060b458e-66ee-ab22-5c4c-c8e04affff7b@gmail.com \
    --to=djrscally@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jorhand@linux.microsoft.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=kitakar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=yong.zhi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.