mbox series

[v1,00/12] HID: cp2112: Cleanups and refactorings

Message ID 20230703185222.50554-1-andriy.shevchenko@linux.intel.com
Headers show
Series HID: cp2112: Cleanups and refactorings | expand

Message

Andy Shevchenko July 3, 2023, 6:52 p.m. UTC
After I updated GPIO library for the case Benjamin has with CP2112,
I have a brief look into the CP2112 driver itself.

Comments

Andy Shevchenko July 27, 2023, 6:43 p.m. UTC | #1
On Mon, Jul 03, 2023 at 09:52:10PM +0300, Andy Shevchenko wrote:
> After I updated GPIO library for the case Benjamin has with CP2112,
> I have a brief look into the CP2112 driver itself.
> 
> From GPIO perspective it has two main (maitenance) issues:
> - usage of ->to_irq() with IRQ chip present;
> - having IRQ chip not immutable.
> 
> Besides that there are plenty small cleanups here and there.
> Hence this series.

Any comments on this?
Andy Shevchenko Aug. 4, 2023, 6:40 a.m. UTC | #2
On Thu, Jul 27, 2023 at 09:43:29PM +0300, Andy Shevchenko wrote:
> On Mon, Jul 03, 2023 at 09:52:10PM +0300, Andy Shevchenko wrote:
> > After I updated GPIO library for the case Benjamin has with CP2112,
> > I have a brief look into the CP2112 driver itself.
> > 
> > From GPIO perspective it has two main (maitenance) issues:
> > - usage of ->to_irq() with IRQ chip present;
> > - having IRQ chip not immutable.
> > 
> > Besides that there are plenty small cleanups here and there.
> > Hence this series.
> 
> Any comments on this?

Gentle ping^2 for this...

Anything should I do to improve it or is it okay to go as is?
Jiri Kosina Aug. 7, 2023, 11:19 a.m. UTC | #3
On Fri, 4 Aug 2023, Andy Shevchenko wrote:

> On Thu, Jul 27, 2023 at 09:43:29PM +0300, Andy Shevchenko wrote:
> > On Mon, Jul 03, 2023 at 09:52:10PM +0300, Andy Shevchenko wrote:
> > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > I have a brief look into the CP2112 driver itself.
> > > 
> > > From GPIO perspective it has two main (maitenance) issues:
> > > - usage of ->to_irq() with IRQ chip present;
> > > - having IRQ chip not immutable.
> > > 
> > > Besides that there are plenty small cleanups here and there.
> > > Hence this series.
> > 
> > Any comments on this?
> 
> Gentle ping^2 for this...
> 
> Anything should I do to improve it or is it okay to go as is?

I have been off pretty much the whole July. I am now back and slowly 
making my way through everything that accumulated, I will eventually get 
to this.

Thanks for the patience,
Andy Shevchenko Aug. 7, 2023, 2:30 p.m. UTC | #4
On Mon, Aug 07, 2023 at 01:19:54PM +0200, Jiri Kosina wrote:
> On Fri, 4 Aug 2023, Andy Shevchenko wrote:
> > On Thu, Jul 27, 2023 at 09:43:29PM +0300, Andy Shevchenko wrote:
> > > On Mon, Jul 03, 2023 at 09:52:10PM +0300, Andy Shevchenko wrote:
> > > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > > I have a brief look into the CP2112 driver itself.
> > > > 
> > > > From GPIO perspective it has two main (maitenance) issues:
> > > > - usage of ->to_irq() with IRQ chip present;
> > > > - having IRQ chip not immutable.
> > > > 
> > > > Besides that there are plenty small cleanups here and there.
> > > > Hence this series.
> > > 
> > > Any comments on this?
> > 
> > Gentle ping^2 for this...
> > 
> > Anything should I do to improve it or is it okay to go as is?
> 
> I have been off pretty much the whole July. I am now back and slowly 
> making my way through everything that accumulated, I will eventually get 
> to this.
> 
> Thanks for the patience,

Ah, okay, no worries and take your time!

I was thinking more on Benjamin's answer as last time he had a hw setup
to test... Not sure what the status of that now and if he has a chance
to test this or busy enough with something else.
Jiri Kosina Aug. 14, 2023, 9:28 a.m. UTC | #5
On Mon, 7 Aug 2023, Andy Shevchenko wrote:

> > > > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > > > I have a brief look into the CP2112 driver itself.
> > > > > 
> > > > > From GPIO perspective it has two main (maitenance) issues:
> > > > > - usage of ->to_irq() with IRQ chip present;
> > > > > - having IRQ chip not immutable.
> > > > > 
> > > > > Besides that there are plenty small cleanups here and there.
> > > > > Hence this series.
> > > > 
> > > > Any comments on this?
> > > 
> > > Gentle ping^2 for this...
> > > 
> > > Anything should I do to improve it or is it okay to go as is?
> > 
> > I have been off pretty much the whole July. I am now back and slowly 
> > making my way through everything that accumulated, I will eventually get 
> > to this.
> > 
> > Thanks for the patience,
> 
> Ah, okay, no worries and take your time!
> 
> I was thinking more on Benjamin's answer as last time he had a hw setup
> to test... Not sure what the status of that now and if he has a chance
> to test this or busy enough with something else.

Ah, that would be of course nice. Benjamin?

Thanks,
Andy Shevchenko Aug. 21, 2023, 8:11 a.m. UTC | #6
On Mon, Aug 14, 2023 at 11:28:58AM +0200, Jiri Kosina wrote:
> On Mon, 7 Aug 2023, Andy Shevchenko wrote:

...

> > > > > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > > > > I have a brief look into the CP2112 driver itself.
> > > > > > 
> > > > > > From GPIO perspective it has two main (maitenance) issues:
> > > > > > - usage of ->to_irq() with IRQ chip present;
> > > > > > - having IRQ chip not immutable.
> > > > > > 
> > > > > > Besides that there are plenty small cleanups here and there.
> > > > > > Hence this series.
> > > > > 
> > > > > Any comments on this?
> > > > 
> > > > Gentle ping^2 for this...
> > > > 
> > > > Anything should I do to improve it or is it okay to go as is?
> > > 
> > > I have been off pretty much the whole July. I am now back and slowly 
> > > making my way through everything that accumulated, I will eventually get 
> > > to this.
> > > 
> > > Thanks for the patience,
> > 
> > Ah, okay, no worries and take your time!
> > 
> > I was thinking more on Benjamin's answer as last time he had a hw setup
> > to test... Not sure what the status of that now and if he has a chance
> > to test this or busy enough with something else.
> 
> Ah, that would be of course nice. Benjamin?

Benjamin? It almost full release cycle passed...
I understand if you are busy with something, just tell us.
Benjamin Tissoires Aug. 21, 2023, 8:51 a.m. UTC | #7
On Aug 21 2023, Andy Shevchenko wrote:
> On Mon, Aug 14, 2023 at 11:28:58AM +0200, Jiri Kosina wrote:
> > On Mon, 7 Aug 2023, Andy Shevchenko wrote:
> 
> ...
> 
> > > > > > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > > > > > I have a brief look into the CP2112 driver itself.
> > > > > > > 
> > > > > > > From GPIO perspective it has two main (maitenance) issues:
> > > > > > > - usage of ->to_irq() with IRQ chip present;
> > > > > > > - having IRQ chip not immutable.
> > > > > > > 
> > > > > > > Besides that there are plenty small cleanups here and there.
> > > > > > > Hence this series.
> > > > > > 
> > > > > > Any comments on this?
> > > > > 
> > > > > Gentle ping^2 for this...
> > > > > 
> > > > > Anything should I do to improve it or is it okay to go as is?
> > > > 
> > > > I have been off pretty much the whole July. I am now back and slowly 
> > > > making my way through everything that accumulated, I will eventually get 
> > > > to this.
> > > > 
> > > > Thanks for the patience,
> > > 
> > > Ah, okay, no worries and take your time!
> > > 
> > > I was thinking more on Benjamin's answer as last time he had a hw setup
> > > to test... Not sure what the status of that now and if he has a chance
> > > to test this or busy enough with something else.
> > 
> > Ah, that would be of course nice. Benjamin?
> 
> Benjamin? It almost full release cycle passed...
> I understand if you are busy with something, just tell us.

Sorry for not answering, I was off in August until just now.

I tried you series just before taking time off, but the problem was that
my automation relies on this driver to not be too far from the current
upstream, as I need to patch it to be able to inject a node child in it.

Which is why I was very interested in the ACPI/DT work so that I do not
have to patch the driver.

Long story short, I'm not able to test it right now (and I got quite
some backlog as you can imagine). IIRC the code was fine, so I think we
can just take the series as is, and work on the quirks (if any) later.

Cheers,
Benjamin
Andy Shevchenko Aug. 21, 2023, 9:34 a.m. UTC | #8
On Mon, Aug 21, 2023 at 10:51:04AM +0200, Benjamin Tissoires wrote:
> On Aug 21 2023, Andy Shevchenko wrote:
> > On Mon, Aug 14, 2023 at 11:28:58AM +0200, Jiri Kosina wrote:
> > > On Mon, 7 Aug 2023, Andy Shevchenko wrote:

...

> > > > > > > > After I updated GPIO library for the case Benjamin has with CP2112,
> > > > > > > > I have a brief look into the CP2112 driver itself.
> > > > > > > > 
> > > > > > > > From GPIO perspective it has two main (maitenance) issues:
> > > > > > > > - usage of ->to_irq() with IRQ chip present;
> > > > > > > > - having IRQ chip not immutable.
> > > > > > > > 
> > > > > > > > Besides that there are plenty small cleanups here and there.
> > > > > > > > Hence this series.
> > > > > > > 
> > > > > > > Any comments on this?
> > > > > > 
> > > > > > Gentle ping^2 for this...
> > > > > > 
> > > > > > Anything should I do to improve it or is it okay to go as is?
> > > > > 
> > > > > I have been off pretty much the whole July. I am now back and slowly 
> > > > > making my way through everything that accumulated, I will eventually get 
> > > > > to this.
> > > > > 
> > > > > Thanks for the patience,
> > > > 
> > > > Ah, okay, no worries and take your time!
> > > > 
> > > > I was thinking more on Benjamin's answer as last time he had a hw setup
> > > > to test... Not sure what the status of that now and if he has a chance
> > > > to test this or busy enough with something else.
> > > 
> > > Ah, that would be of course nice. Benjamin?
> > 
> > Benjamin? It almost full release cycle passed...
> > I understand if you are busy with something, just tell us.
> 
> Sorry for not answering, I was off in August until just now.
> 
> I tried you series just before taking time off, but the problem was that
> my automation relies on this driver to not be too far from the current
> upstream, as I need to patch it to be able to inject a node child in it.
> 
> Which is why I was very interested in the ACPI/DT work so that I do not
> have to patch the driver.
> 
> Long story short, I'm not able to test it right now (and I got quite
> some backlog as you can imagine). IIRC the code was fine, so I think we
> can just take the series as is, and work on the quirks (if any) later.

Thank you!

The thing that might be broken is interrupts handling. If that works,
I'm pretty confident with the rest.
Andy Shevchenko Aug. 21, 2023, 9:35 a.m. UTC | #9
On Mon, Aug 21, 2023 at 12:34:30PM +0300, Andy Shevchenko wrote:
> On Mon, Aug 21, 2023 at 10:51:04AM +0200, Benjamin Tissoires wrote:
> > On Aug 21 2023, Andy Shevchenko wrote:

...

> > Long story short, I'm not able to test it right now (and I got quite
> > some backlog as you can imagine). IIRC the code was fine, so I think we
> > can just take the series as is, and work on the quirks (if any) later.
> 
> Thank you!
> 
> The thing that might be broken is interrupts handling. If that works,
> I'm pretty confident with the rest.

I.o.w. first 5 patches to test is already 98% of guarantee that everything
is fine.
Benjamin Tissoires Aug. 21, 2023, 10:19 a.m. UTC | #10
On Mon, Aug 21, 2023 at 11:35 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Aug 21, 2023 at 12:34:30PM +0300, Andy Shevchenko wrote:
> > On Mon, Aug 21, 2023 at 10:51:04AM +0200, Benjamin Tissoires wrote:
> > > On Aug 21 2023, Andy Shevchenko wrote:
>
> ...
>
> > > Long story short, I'm not able to test it right now (and I got quite
> > > some backlog as you can imagine). IIRC the code was fine, so I think we
> > > can just take the series as is, and work on the quirks (if any) later.
> >
> > Thank you!
> >
> > The thing that might be broken is interrupts handling. If that works,
> > I'm pretty confident with the rest.
>
> I.o.w. first 5 patches to test is already 98% of guarantee that everything
> is fine.

Actually I applied you series locally, and applied Danny's patches on
top, and I could run your series in qemu with the cp2112 as USB
passthrough.

Everything is working fine, so I can take this one just now.

Cheers,
Benjamin

>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Benjamin Tissoires Aug. 21, 2023, 10:27 a.m. UTC | #11
On Mon, Aug 21, 2023 at 12:19 PM Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
>
> On Mon, Aug 21, 2023 at 11:35 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Mon, Aug 21, 2023 at 12:34:30PM +0300, Andy Shevchenko wrote:
> > > On Mon, Aug 21, 2023 at 10:51:04AM +0200, Benjamin Tissoires wrote:
> > > > On Aug 21 2023, Andy Shevchenko wrote:
> >
> > ...
> >
> > > > Long story short, I'm not able to test it right now (and I got quite
> > > > some backlog as you can imagine). IIRC the code was fine, so I think we
> > > > can just take the series as is, and work on the quirks (if any) later.
> > >
> > > Thank you!
> > >
> > > The thing that might be broken is interrupts handling. If that works,
> > > I'm pretty confident with the rest.
> >
> > I.o.w. first 5 patches to test is already 98% of guarantee that everything
> > is fine.
>
> Actually I applied you series locally, and applied Danny's patches on
> top, and I could run your series in qemu with the cp2112 as USB
> passthrough.
>
> Everything is working fine, so I can take this one just now.

I've pushed the series to for-6.6/cp2112, but for some reasons, b4
doesn't seem to believe the series is the one you submitted.

Would you mind double checking on your side if everything is good?

https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/log/?h=for-6.6/cp2112

Cheers,
Benjamin

>
> Cheers,
> Benjamin
>
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
> >
Andy Shevchenko Aug. 21, 2023, 10:32 a.m. UTC | #12
On Mon, Aug 21, 2023 at 12:19:39PM +0200, Benjamin Tissoires wrote:
> On Mon, Aug 21, 2023 at 11:35 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, Aug 21, 2023 at 12:34:30PM +0300, Andy Shevchenko wrote:
> > > On Mon, Aug 21, 2023 at 10:51:04AM +0200, Benjamin Tissoires wrote:
> > > > On Aug 21 2023, Andy Shevchenko wrote:

...

> > > > Long story short, I'm not able to test it right now (and I got quite
> > > > some backlog as you can imagine). IIRC the code was fine, so I think we
> > > > can just take the series as is, and work on the quirks (if any) later.
> > >
> > > Thank you!
> > >
> > > The thing that might be broken is interrupts handling. If that works,
> > > I'm pretty confident with the rest.
> >
> > I.o.w. first 5 patches to test is already 98% of guarantee that everything
> > is fine.
> 
> Actually I applied you series locally, and applied Danny's patches on
> top, and I could run your series in qemu with the cp2112 as USB
> passthrough.
> 
> Everything is working fine, so I can take this one just now.

Thank you! I assume you have some IRQ (like GPIO button) to test with that.
If no, it's easily to describe (in ACPI, see [1]) and use a wire to emulate
the button presses. In that case the /proc/interrupts should show the
different numbers.

[1]: https://github.com/westeri/meta-acpi/blob/master/recipes-bsp/acpi-tables/samples/edison/buttons.asli
Andy Shevchenko Aug. 21, 2023, 10:37 a.m. UTC | #13
On Mon, Aug 21, 2023 at 12:27:22PM +0200, Benjamin Tissoires wrote:
> On Mon, Aug 21, 2023 at 12:19 PM Benjamin Tissoires
> <benjamin.tissoires@redhat.com> wrote:
> > On Mon, Aug 21, 2023 at 11:35 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Mon, Aug 21, 2023 at 12:34:30PM +0300, Andy Shevchenko wrote:
> > > > On Mon, Aug 21, 2023 at 10:51:04AM +0200, Benjamin Tissoires wrote:
> > > > > On Aug 21 2023, Andy Shevchenko wrote:

...

> > > > > Long story short, I'm not able to test it right now (and I got quite
> > > > > some backlog as you can imagine). IIRC the code was fine, so I think we
> > > > > can just take the series as is, and work on the quirks (if any) later.
> > > >
> > > > Thank you!
> > > >
> > > > The thing that might be broken is interrupts handling. If that works,
> > > > I'm pretty confident with the rest.
> > >
> > > I.o.w. first 5 patches to test is already 98% of guarantee that everything
> > > is fine.
> >
> > Actually I applied you series locally, and applied Danny's patches on
> > top, and I could run your series in qemu with the cp2112 as USB
> > passthrough.
> >
> > Everything is working fine, so I can take this one just now.
> 
> I've pushed the series to for-6.6/cp2112, but for some reasons, b4
> doesn't seem to believe the series is the one you submitted.
> 
> Would you mind double checking on your side if everything is good?
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/log/?h=for-6.6/cp2112

Everything is fine as far as I can tell.
Benjamin Tissoires Aug. 21, 2023, 12:06 p.m. UTC | #14
On Mon, Aug 21, 2023 at 12:32 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Aug 21, 2023 at 12:19:39PM +0200, Benjamin Tissoires wrote:
> > On Mon, Aug 21, 2023 at 11:35 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Mon, Aug 21, 2023 at 12:34:30PM +0300, Andy Shevchenko wrote:
> > > > On Mon, Aug 21, 2023 at 10:51:04AM +0200, Benjamin Tissoires wrote:
> > > > > On Aug 21 2023, Andy Shevchenko wrote:
>
> ...
>
> > > > > Long story short, I'm not able to test it right now (and I got quite
> > > > > some backlog as you can imagine). IIRC the code was fine, so I think we
> > > > > can just take the series as is, and work on the quirks (if any) later.
> > > >
> > > > Thank you!
> > > >
> > > > The thing that might be broken is interrupts handling. If that works,
> > > > I'm pretty confident with the rest.
> > >
> > > I.o.w. first 5 patches to test is already 98% of guarantee that everything
> > > is fine.
> >
> > Actually I applied you series locally, and applied Danny's patches on
> > top, and I could run your series in qemu with the cp2112 as USB
> > passthrough.
> >
> > Everything is working fine, so I can take this one just now.
>
> Thank you! I assume you have some IRQ (like GPIO button) to test with that.

Yeah, binding a test i2c-hid touchpad on top of hid forces you to use
GPIOs. Otherwise you are polling, and it's not allowed in i2c-hid
anymore IIRC :)

> If no, it's easily to describe (in ACPI, see [1]) and use a wire to emulate
> the button presses. In that case the /proc/interrupts should show the
> different numbers.

Thanks, but again, the GPIO is tested just by checking if the touchpad
can send events when touched.

Now I need to update my CI to rely on danny's patches and a DSDT overwrite :)

Cheers,
Benjamin

>
> [1]: https://github.com/westeri/meta-acpi/blob/master/recipes-bsp/acpi-tables/samples/edison/buttons.asli
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Benjamin Tissoires Aug. 21, 2023, 1:56 p.m. UTC | #15
On Aug 21 2023, Andy Shevchenko wrote:
> On Mon, Aug 21, 2023 at 12:27:22PM +0200, Benjamin Tissoires wrote:
> > On Mon, Aug 21, 2023 at 12:19 PM Benjamin Tissoires
> > <benjamin.tissoires@redhat.com> wrote:
> > > On Mon, Aug 21, 2023 at 11:35 AM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > On Mon, Aug 21, 2023 at 12:34:30PM +0300, Andy Shevchenko wrote:
> > > > > On Mon, Aug 21, 2023 at 10:51:04AM +0200, Benjamin Tissoires wrote:
> > > > > > On Aug 21 2023, Andy Shevchenko wrote:
> 
> ...
> 
> > > > > > Long story short, I'm not able to test it right now (and I got quite
> > > > > > some backlog as you can imagine). IIRC the code was fine, so I think we
> > > > > > can just take the series as is, and work on the quirks (if any) later.
> > > > >
> > > > > Thank you!
> > > > >
> > > > > The thing that might be broken is interrupts handling. If that works,
> > > > > I'm pretty confident with the rest.
> > > >
> > > > I.o.w. first 5 patches to test is already 98% of guarantee that everything
> > > > is fine.
> > >
> > > Actually I applied you series locally, and applied Danny's patches on
> > > top, and I could run your series in qemu with the cp2112 as USB
> > > passthrough.
> > >
> > > Everything is working fine, so I can take this one just now.
> > 
> > I've pushed the series to for-6.6/cp2112, but for some reasons, b4
> > doesn't seem to believe the series is the one you submitted.
> > 
> > Would you mind double checking on your side if everything is good?
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/log/?h=for-6.6/cp2112
> 
> Everything is fine as far as I can tell.

Great, thanks for double checking.

Cheers,
Benjamin

> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
>