Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-28 Thread Dan Scally
On 17/09/2020 11:33, Sakari Ailus wrote: >> +sensor_props[3] = PROPERTY_ENTRY_U32_ARRAY_LEN("data-lanes", >> + data_lanes, >> + >> (int)ssdb->lanes); >> +sens

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-23 Thread Dan Scally
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_devi

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-21 Thread Andy Shevchenko
On Mon, Sep 21, 2020 at 02:33:57PM +0100, Dan Scally wrote: > On 18/09/2020 14:07, Andy Shevchenko wrote: > > On Fri, Sep 18, 2020 at 10:51:57AM +0300, Sakari Ailus wrote: > >> On Thu, Sep 17, 2020 at 03:45:14PM +0300, Andy Shevchenko wrote: > >>> On Thu, Sep 17, 2020 at 11:52:28AM +0100, Dan Scall

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-21 Thread Dan Scally
On 18/09/2020 14:07, Andy Shevchenko wrote: > On Fri, Sep 18, 2020 at 10:51:57AM +0300, Sakari Ailus wrote: >> On Thu, Sep 17, 2020 at 03:45:14PM +0300, Andy Shevchenko wrote: >>> On Thu, Sep 17, 2020 at 11:52:28AM +0100, Dan Scally wrote: On 17/09/2020 11:33, Sakari Ailus wrote: > a modul

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-18 Thread Dan Scally
Hi Dan -  thanks for all your comments. Sorry it took a while to get to yours. On 17/09/2020 10:34, Dan Carpenter wrote: > On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: >> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c >> b/drivers/media/pci/intel/ipu3/ipu3-cio2.c >> index

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-18 Thread Andy Shevchenko
On Fri, Sep 18, 2020 at 10:51:57AM +0300, Sakari Ailus wrote: > On Thu, Sep 17, 2020 at 03:45:14PM +0300, Andy Shevchenko wrote: > > On Thu, Sep 17, 2020 at 11:52:28AM +0100, Dan Scally wrote: > > > On 17/09/2020 11:33, Sakari Ailus wrote: > > > > a module and not enlarge everyone's kernel, and the

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-18 Thread Dan Carpenter
On Fri, Sep 18, 2020 at 09:40:43AM +0300, Sakari Ailus wrote: > Hi Dan, > > On Thu, Sep 17, 2020 at 01:49:41PM +0300, Dan Carpenter wrote: > > On Thu, Sep 17, 2020 at 01:33:43PM +0300, Sakari Ailus wrote: > > > > +static int connect_supported_devices(void) > > > > +{ > > > > + struct acpi_de

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-18 Thread Dan Scally
Ah, shoot - good spot, thanks On 18/09/2020 09:03, Dan Carpenter wrote: > I ran Smatch over the code and it spotted an off by one. > > On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: >> +#define MAX_CONNECTED_DEVICES 4 >> +#define SWNODE_SENSOR_HID

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-18 Thread Dan Carpenter
I ran Smatch over the code and it spotted an off by one. On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: > +#define MAX_CONNECTED_DEVICES4 > +#define SWNODE_SENSOR_HID0 > +#define SWNODE_SENSOR_PORT 1 > +#define SWNODE_SE

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-18 Thread Sakari Ailus
Hi Andy, On Thu, Sep 17, 2020 at 03:45:14PM +0300, Andy Shevchenko wrote: > On Thu, Sep 17, 2020 at 11:52:28AM +0100, Dan Scally wrote: > > On 17/09/2020 11:33, Sakari Ailus wrote: > > > a module and not enlarge everyone's kernel, and the initialisation would > > > at > > > the same time take pla

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Sakari Ailus
Hi Dan, On Thu, Sep 17, 2020 at 01:49:41PM +0300, Dan Carpenter wrote: > On Thu, Sep 17, 2020 at 01:33:43PM +0300, Sakari Ailus wrote: > > > +static int connect_supported_devices(void) > > > +{ > > > + struct acpi_device *adev; > > > + struct device *dev; > > > + struct sensor_bios_data ssdb; > >

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Daniel Scally
On 17/09/2020 15:14, Andy Shevchenko wrote: > On Thu, Sep 17, 2020 at 4:53 PM Dan Scally wrote: >> Hi Andy, thanks for input (as always) > You're welcome! I'm really impressed by your activity in this area. Thanks - it's pretty fun so far >>> Ah, I think you misinterpreted the meaning of above. Th

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Andy Shevchenko
On Thu, Sep 17, 2020 at 02:36:22PM +0100, Dan Scally wrote: > On 17/09/2020 13:45, Andy Shevchenko wrote: > > On Thu, Sep 17, 2020 at 11:52:28AM +0100, Dan Scally wrote: > >> On 17/09/2020 11:33, Sakari Ailus wrote: > > I will do better review for next version, assuming you will Cc reviewers and >

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Andy Shevchenko
On Thu, Sep 17, 2020 at 5:19 PM Kieran Bingham wrote: > On 17/09/2020 15:08, Andy Shevchenko wrote: ... > Ayee, ok so we have 'half' the driver for IPU3 out of staging. Correct. And your below analysis is correct. > From my understanding, the IPU3 consists of two components, the CIO2 > (CSI2 c

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Kieran Bingham
Hi Andy, On 17/09/2020 15:08, Andy Shevchenko wrote: > On Thu, Sep 17, 2020 at 4:31 PM Kieran Bingham > wrote: >> On 17/09/2020 10:47, Dan Scally wrote: >>> On 17/09/2020 08:53, Greg KH wrote: On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: > > drivers/staging/media/ipu3

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Andy Shevchenko
On Thu, Sep 17, 2020 at 4:53 PM Dan Scally wrote: > > Hi Andy, thanks for input (as always) You're welcome! I'm really impressed by your activity in this area. > On 17/09/2020 13:45, Andy Shevchenko wrote: > > On Thu, Sep 17, 2020 at 11:52:28AM +0100, Dan Scally wrote: > >> On 17/09/2020 11:33,

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Andy Shevchenko
On Thu, Sep 17, 2020 at 4:31 PM Kieran Bingham wrote: > On 17/09/2020 10:47, Dan Scally wrote: > > On 17/09/2020 08:53, Greg KH wrote: > >> On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: > >>> drivers/staging/media/ipu3/Kconfig | 15 + > >>> drivers/staging/media/ipu3/Make

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Dan Scally
Hi Andy, thanks for input (as always) On 17/09/2020 13:45, Andy Shevchenko wrote: > On Thu, Sep 17, 2020 at 11:52:28AM +0100, Dan Scally wrote: >> On 17/09/2020 11:33, Sakari Ailus wrote: > I will do better review for next version, assuming you will Cc reviewers and > TWIMC people. Below is like s

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Kieran Bingham
Hi Dan, Greg, On 17/09/2020 10:47, Dan Scally wrote: > Hi Greg - thanks for the comments, appreciate it (sorry there's so many, > I'm new to both C and kernel work) > > On 17/09/2020 08:53, Greg KH wrote: >> On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: >>> MAINTAINERS

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Dan Carpenter
On Thu, Sep 17, 2020 at 03:25:29PM +0300, Andy Shevchenko wrote: > On Thu, Sep 17, 2020 at 01:49:41PM +0300, Dan Carpenter wrote: > > On Thu, Sep 17, 2020 at 01:33:43PM +0300, Sakari Ailus wrote: > > > > > + int i, ret; > > > > > > unsigned int i > > > > > > > Why? > > > > For list itera

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Andy Shevchenko
On Thu, Sep 17, 2020 at 11:52:28AM +0100, Dan Scally wrote: > On 17/09/2020 11:33, Sakari Ailus wrote: I will do better review for next version, assuming you will Cc reviewers and TWIMC people. Below is like small part of comments I may give to the code. ... > > The ones I know require PMIC cont

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Andy Shevchenko
On Thu, Sep 17, 2020 at 01:49:41PM +0300, Dan Carpenter wrote: > On Thu, Sep 17, 2020 at 01:33:43PM +0300, Sakari Ailus wrote: > > > + int i, ret; > > > > unsigned int i > > > > Why? > > For list iterators then "int i;" is best... For sizes then unsigned is > sometimes best. Or if it's part

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Dan Scally
Hey Sakari - thanks for the reply On 17/09/2020 11:33, Sakari Ailus wrote: > Hi Daniel, > > Thank you for the patch. > > Is this all that it takes to add support for some machines shipped with > Windows? Almost > The ones I know require PMIC control done in software (not even > sensors are accessi

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Dan Carpenter
On Thu, Sep 17, 2020 at 01:33:43PM +0300, Sakari Ailus wrote: > > +static int connect_supported_devices(void) > > +{ > > + struct acpi_device *adev; > > + struct device *dev; > > + struct sensor_bios_data ssdb; > > + struct sensor *sensor; > > + struct property_entry *sensor_props; > > +

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Joe Perches
On Thu, 2020-09-17 at 12:34 +0300, Dan Carpenter wrote: > On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: > > diff --git a/drivers/staging/media/ipu3/cio2-bridge.c > > b/drivers/staging/media/ipu3/cio2-bridge.c [] > > + if (!dev->driver_data) { > > + pr_i

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Sakari Ailus
Hi Daniel, Thank you for the patch. Is this all that it takes to add support for some machines shipped with Windows? The ones I know require PMIC control done in software (not even sensors are accessible without that). One possibility would be to put this to platform code. That would effectively

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Dan Scally
On 17/09/2020 11:15, Dan Carpenter wrote: > On Thu, Sep 17, 2020 at 10:47:50AM +0100, Dan Scally wrote: >> Hi Greg - thanks for the comments, appreciate it (sorry there's so many, >> I'm new to both C and kernel work) > It's pretty impressive work if you're new to C... Thanks (and for your other re

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Dan Carpenter
On Thu, Sep 17, 2020 at 10:47:50AM +0100, Dan Scally wrote: > Hi Greg - thanks for the comments, appreciate it (sorry there's so many, > I'm new to both C and kernel work) It's pretty impressive work if you're new to C... > > > >> + return; > > No error value? > The prototype for

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Dan Scally
Hi Greg - thanks for the comments, appreciate it (sorry there's so many, I'm new to both C and kernel work) On 17/09/2020 08:53, Greg KH wrote: > On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: >> MAINTAINERS | 6 + >> drivers/media/pci/intel/ipu3/ipu

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Dan Carpenter
On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: > diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c > b/drivers/media/pci/intel/ipu3/ipu3-cio2.c > index 92f5eadf2c99..fd941d2c7581 100644 > --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c > +++ b/drivers/media/pci/intel/ipu3/ipu3-c

Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-17 Thread Greg KH
On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote: > MAINTAINERS | 6 + > drivers/media/pci/intel/ipu3/ipu3-cio2.c | 67 +++- staging drivers should be self-contained, and not modify stuff outside of drivers/staging/ > drivers/staging/media/ipu3/Kconfi

[RFC PATCH] Add bridge driver to connect sensors to CIO2 device via software nodes on ACPI platforms

2020-09-16 Thread Daniel Scally
Currently on ACPI platforms, sensors that are intended to be connected to a CIO2 device for use with the ipu3-cio2 driver lack the necessary connection information in firmware. This patch adds a module to parse the connection properties from the SSDB buffer in DSDT and build the connection using so