linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio
@ 2021-10-21 13:09 Maximilian Luz
  2021-10-21 13:09 ` [PATCH 2/3] HID: surface-hid: Use correct event registry for managing HID events Maximilian Luz
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Maximilian Luz @ 2021-10-21 13:09 UTC (permalink / raw)
  Cc: Maximilian Luz, Hans de Goede, Mark Gross, Jiri Kosina,
	Benjamin Tissoires, platform-driver-x86, linux-input,
	linux-kernel

This series adds Surface Aggregator Module (SAM) support for the new
Surface Laptop Studio (SLS).

This is mostly straight-forward addition of devices to the Surface
Aggregator registry, but the Surface HID driver needs a couple of small
changes. Specifically, we need to allow it to probe against SAM devices
with target ID 1 and also need to use the corresponding registry for
those.

I hope it's okay that I've CCed stable to get these included in v5.14+
stable kernels. The changes are fairly small and enable keyboard and
touchpad on the SLS. Most other things (except touch) should already
work well on the latest stable kernels, so back-porting this series
would make the SLS a usable device on those.

Maximilian Luz (3):
  platform/surface: aggregator_registry: Add support for Surface Laptop
    Studio
  HID: surface-hid: Use correct event registry for managing HID events
  HID: surface-hid: Allow driver matching for target ID 1 devices

 drivers/hid/surface-hid/surface_hid.c         |  4 +-
 .../surface/surface_aggregator_registry.c     | 54 +++++++++++++++++++
 include/linux/surface_aggregator/controller.h |  4 +-
 3 files changed, 58 insertions(+), 4 deletions(-)

-- 
2.33.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] HID: surface-hid: Use correct event registry for managing HID events
  2021-10-21 13:09 [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio Maximilian Luz
@ 2021-10-21 13:09 ` Maximilian Luz
  2021-10-21 13:09 ` [PATCH 3/3] HID: surface-hid: Allow driver matching for target ID 1 devices Maximilian Luz
  2021-10-21 18:33 ` [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio Hans de Goede
  2 siblings, 0 replies; 6+ messages in thread
From: Maximilian Luz @ 2021-10-21 13:09 UTC (permalink / raw)
  Cc: Maximilian Luz, Hans de Goede, Mark Gross, Jiri Kosina,
	Benjamin Tissoires, platform-driver-x86, linux-input,
	linux-kernel, stable

Until now, we have only ever seen the REG-category registry being used
on devices addressed with target ID 2. In fact, we have only ever seen
Surface Aggregator Module (SAM) HID devices with target ID 2. For those
devices, the registry also has to be addressed with target ID 2.

Some devices, like the new Surface Laptop Studio, however, address their
HID devices on target ID 1. As a result of this, any target ID 2
commands time out. This includes event management commands addressed to
the target ID 2 REG-category registry. For these devices, the registry
has to be addressed via target ID 1 instead.

We therefore assume that the target ID of the registry to be used
depends on the target ID of the respective device. Implement this
accordingly.

Note that we currently allow the surface HID driver to only load against
devices with target ID 2, so these timeouts are not happening (yet).
This is just a preparation step before we allow the driver to load
against all target IDs.

Cc: stable@vger.kernel.org # 5.14+
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
---
 drivers/hid/surface-hid/surface_hid.c         | 2 +-
 include/linux/surface_aggregator/controller.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/surface-hid/surface_hid.c b/drivers/hid/surface-hid/surface_hid.c
index a3a70e4f3f6c..daa452367c0b 100644
--- a/drivers/hid/surface-hid/surface_hid.c
+++ b/drivers/hid/surface-hid/surface_hid.c
@@ -209,7 +209,7 @@ static int surface_hid_probe(struct ssam_device *sdev)
 
 	shid->notif.base.priority = 1;
 	shid->notif.base.fn = ssam_hid_event_fn;
-	shid->notif.event.reg = SSAM_EVENT_REGISTRY_REG;
+	shid->notif.event.reg = SSAM_EVENT_REGISTRY_REG(sdev->uid.target);
 	shid->notif.event.id.target_category = sdev->uid.category;
 	shid->notif.event.id.instance = sdev->uid.instance;
 	shid->notif.event.mask = SSAM_EVENT_MASK_STRICT;
diff --git a/include/linux/surface_aggregator/controller.h b/include/linux/surface_aggregator/controller.h
index 068e1982ad37..74bfdffaf7b0 100644
--- a/include/linux/surface_aggregator/controller.h
+++ b/include/linux/surface_aggregator/controller.h
@@ -792,8 +792,8 @@ enum ssam_event_mask {
 #define SSAM_EVENT_REGISTRY_KIP	\
 	SSAM_EVENT_REGISTRY(SSAM_SSH_TC_KIP, 0x02, 0x27, 0x28)
 
-#define SSAM_EVENT_REGISTRY_REG \
-	SSAM_EVENT_REGISTRY(SSAM_SSH_TC_REG, 0x02, 0x01, 0x02)
+#define SSAM_EVENT_REGISTRY_REG(tid)\
+	SSAM_EVENT_REGISTRY(SSAM_SSH_TC_REG, tid, 0x01, 0x02)
 
 /**
  * enum ssam_event_notifier_flags - Flags for event notifiers.
-- 
2.33.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] HID: surface-hid: Allow driver matching for target ID 1 devices
  2021-10-21 13:09 [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio Maximilian Luz
  2021-10-21 13:09 ` [PATCH 2/3] HID: surface-hid: Use correct event registry for managing HID events Maximilian Luz
@ 2021-10-21 13:09 ` Maximilian Luz
  2021-10-21 18:33 ` [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio Hans de Goede
  2 siblings, 0 replies; 6+ messages in thread
From: Maximilian Luz @ 2021-10-21 13:09 UTC (permalink / raw)
  Cc: Maximilian Luz, Hans de Goede, Mark Gross, Jiri Kosina,
	Benjamin Tissoires, platform-driver-x86, linux-input,
	linux-kernel, stable

Until now we have only ever seen HID devices with target ID 2. The new
Surface Laptop Studio however uses HID devices with target ID 1. Allow
matching this driver to those as well.

Cc: stable@vger.kernel.org # 5.14+
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
---
 drivers/hid/surface-hid/surface_hid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/surface-hid/surface_hid.c b/drivers/hid/surface-hid/surface_hid.c
index daa452367c0b..d4aa8c81903a 100644
--- a/drivers/hid/surface-hid/surface_hid.c
+++ b/drivers/hid/surface-hid/surface_hid.c
@@ -230,7 +230,7 @@ static void surface_hid_remove(struct ssam_device *sdev)
 }
 
 static const struct ssam_device_id surface_hid_match[] = {
-	{ SSAM_SDEV(HID, 0x02, SSAM_ANY_IID, 0x00) },
+	{ SSAM_SDEV(HID, SSAM_ANY_TID, SSAM_ANY_IID, 0x00) },
 	{ },
 };
 MODULE_DEVICE_TABLE(ssam, surface_hid_match);
-- 
2.33.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio
  2021-10-21 13:09 [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio Maximilian Luz
  2021-10-21 13:09 ` [PATCH 2/3] HID: surface-hid: Use correct event registry for managing HID events Maximilian Luz
  2021-10-21 13:09 ` [PATCH 3/3] HID: surface-hid: Allow driver matching for target ID 1 devices Maximilian Luz
@ 2021-10-21 18:33 ` Hans de Goede
  2021-10-22  6:55   ` Benjamin Tissoires
  2 siblings, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2021-10-21 18:33 UTC (permalink / raw)
  To: Maximilian Luz
  Cc: Mark Gross, Jiri Kosina, Benjamin Tissoires, platform-driver-x86,
	linux-input, linux-kernel

Hi,

On 10/21/21 15:09, Maximilian Luz wrote:
> This series adds Surface Aggregator Module (SAM) support for the new
> Surface Laptop Studio (SLS).
> 
> This is mostly straight-forward addition of devices to the Surface
> Aggregator registry, but the Surface HID driver needs a couple of small
> changes. Specifically, we need to allow it to probe against SAM devices
> with target ID 1 and also need to use the corresponding registry for
> those.
> 
> I hope it's okay that I've CCed stable to get these included in v5.14+
> stable kernels. The changes are fairly small and enable keyboard and
> touchpad on the SLS. Most other things (except touch) should already
> work well on the latest stable kernels, so back-porting this series
> would make the SLS a usable device on those.

Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> 
> Maximilian Luz (3):
>   platform/surface: aggregator_registry: Add support for Surface Laptop
>     Studio
>   HID: surface-hid: Use correct event registry for managing HID events
>   HID: surface-hid: Allow driver matching for target ID 1 devices
> 
>  drivers/hid/surface-hid/surface_hid.c         |  4 +-
>  .../surface/surface_aggregator_registry.c     | 54 +++++++++++++++++++
>  include/linux/surface_aggregator/controller.h |  4 +-
>  3 files changed, 58 insertions(+), 4 deletions(-)
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio
  2021-10-21 18:33 ` [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio Hans de Goede
@ 2021-10-22  6:55   ` Benjamin Tissoires
  2021-10-22  8:56     ` Hans de Goede
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Tissoires @ 2021-10-22  6:55 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Maximilian Luz, Mark Gross, Jiri Kosina, Platform Driver,
	open list:HID CORE LAYER, lkml

On Thu, Oct 21, 2021 at 8:33 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 10/21/21 15:09, Maximilian Luz wrote:
> > This series adds Surface Aggregator Module (SAM) support for the new
> > Surface Laptop Studio (SLS).
> >
> > This is mostly straight-forward addition of devices to the Surface
> > Aggregator registry, but the Surface HID driver needs a couple of small
> > changes. Specifically, we need to allow it to probe against SAM devices
> > with target ID 1 and also need to use the corresponding registry for
> > those.
> >
> > I hope it's okay that I've CCed stable to get these included in v5.14+
> > stable kernels. The changes are fairly small and enable keyboard and
> > touchpad on the SLS. Most other things (except touch) should already
> > work well on the latest stable kernels, so back-porting this series
> > would make the SLS a usable device on those.
>
> Thank you for your patch-series, I've applied the series to my
> review-hans branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
>
> Note it will show up in my review-hans branch once I've pushed my
> local branch there, which might take a while.

I was surprised to see you taking this series when the 2 patches I
received are HID only.
But it turns out that the patch 1/3 (which I am missing) is actually
about platform, so it makes sense to have you take the full series.
The HID changes are relatively small and are not conflicting with
anything in the HID tree.

For the HID part:
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>
> Once I've run some tests on this branch the patches there will be
> added to the platform-drivers-x86/for-next branch and eventually
> will be included in the pdx86 pull-request to Linus for the next
> merge-window.
>
> Regards,
>
> Hans
>
>
>
> >
> > Maximilian Luz (3):
> >   platform/surface: aggregator_registry: Add support for Surface Laptop
> >     Studio
> >   HID: surface-hid: Use correct event registry for managing HID events
> >   HID: surface-hid: Allow driver matching for target ID 1 devices
> >
> >  drivers/hid/surface-hid/surface_hid.c         |  4 +-
> >  .../surface/surface_aggregator_registry.c     | 54 +++++++++++++++++++
> >  include/linux/surface_aggregator/controller.h |  4 +-
> >  3 files changed, 58 insertions(+), 4 deletions(-)
> >
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio
  2021-10-22  6:55   ` Benjamin Tissoires
@ 2021-10-22  8:56     ` Hans de Goede
  0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2021-10-22  8:56 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Maximilian Luz, Mark Gross, Jiri Kosina, Platform Driver,
	open list:HID CORE LAYER, lkml

Hi,

On 10/22/21 08:55, Benjamin Tissoires wrote:
> On Thu, Oct 21, 2021 at 8:33 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi,
>>
>> On 10/21/21 15:09, Maximilian Luz wrote:
>>> This series adds Surface Aggregator Module (SAM) support for the new
>>> Surface Laptop Studio (SLS).
>>>
>>> This is mostly straight-forward addition of devices to the Surface
>>> Aggregator registry, but the Surface HID driver needs a couple of small
>>> changes. Specifically, we need to allow it to probe against SAM devices
>>> with target ID 1 and also need to use the corresponding registry for
>>> those.
>>>
>>> I hope it's okay that I've CCed stable to get these included in v5.14+
>>> stable kernels. The changes are fairly small and enable keyboard and
>>> touchpad on the SLS. Most other things (except touch) should already
>>> work well on the latest stable kernels, so back-porting this series
>>> would make the SLS a usable device on those.
>>
>> Thank you for your patch-series, I've applied the series to my
>> review-hans branch:
>> https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
>>
>> Note it will show up in my review-hans branch once I've pushed my
>> local branch there, which might take a while.
> 
> I was surprised to see you taking this series when the 2 patches I
> received are HID only.
> But it turns out that the patch 1/3 (which I am missing) is actually
> about platform, so it makes sense to have you take the full series.
> The HID changes are relatively small and are not conflicting with
> anything in the HID tree.
> 
> For the HID part:
> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Thanks I'll add your Ack before moving this for-next and sorry for
not coordinating this before hand.

TBH I completely missed that the 2 other patches where under drivers/hid
since 90% or so of all surface stuff is under drivers/platform/surface
I sorta assumed all patches where for there. My bad, sorry.

(Note to self: Next time not only review the contents of the diff but
also look at the file-paths).

Regards,

Hans


> 
> Cheers,
> Benjamin
> 
>>
>> Once I've run some tests on this branch the patches there will be
>> added to the platform-drivers-x86/for-next branch and eventually
>> will be included in the pdx86 pull-request to Linus for the next
>> merge-window.
>>
>> Regards,
>>
>> Hans
>>
>>
>>
>>>
>>> Maximilian Luz (3):
>>>   platform/surface: aggregator_registry: Add support for Surface Laptop
>>>     Studio
>>>   HID: surface-hid: Use correct event registry for managing HID events
>>>   HID: surface-hid: Allow driver matching for target ID 1 devices
>>>
>>>  drivers/hid/surface-hid/surface_hid.c         |  4 +-
>>>  .../surface/surface_aggregator_registry.c     | 54 +++++++++++++++++++
>>>  include/linux/surface_aggregator/controller.h |  4 +-
>>>  3 files changed, 58 insertions(+), 4 deletions(-)
>>>
>>
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-22  8:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 13:09 [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio Maximilian Luz
2021-10-21 13:09 ` [PATCH 2/3] HID: surface-hid: Use correct event registry for managing HID events Maximilian Luz
2021-10-21 13:09 ` [PATCH 3/3] HID: surface-hid: Allow driver matching for target ID 1 devices Maximilian Luz
2021-10-21 18:33 ` [PATCH 0/3] platform/surface: aggregator: Add support for Surface Laptop Studio Hans de Goede
2021-10-22  6:55   ` Benjamin Tissoires
2021-10-22  8:56     ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).