mbox series

[v5,0/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices

Message ID 20250121225510.751444-1-wse@tuxedocomputers.com (mailing list archive)
Headers show
Series platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices | expand

Message

Werner Sembach Jan. 21, 2025, 10:31 p.m. UTC
Hi,
after some other work, picked this up again.
Only coding style changes vs v4.


I now got my feet a little wet with hid-bpf regarding something else, and
with that knowledge I would leave the long arrays in the beginning in the
kernel code for the time being:

sirius_16_ansii_kbl_mapping and sirius_16_iso_kbl_mapping are required
during initialization so they have to exist in the kernel code anyway.

report_descriptor will most likly not change even for future models and
afaik having report_descriptors in kernel drivers is not unheard of.

So the only things that could be meaningfully moved to a hid-bpf program
are the sirius_16_*_kbl_mapping_pos_* arrays. But for these is have to give
out some fallback value anyway for the case where a hid-bpf file is missing
or fails to load. So why not use real world values from my test device for
these values?

As soon as there is a future device that can use the same driver with just
these pos arrays different, then I would implement that change via a bpf
program instead of a change to the kernel driver.

Let me know if you too think this is a sensefull approach?


Another question: Would this patch need to wait for a userspace
implementation of lamp array before it can get accepted?


The folder structure and naming scheme with nb04 is im preparation for
other parts of tuxedo-drivers to be upstreamed. NB04 is one of the
board_vendor dmi strings on TUXEDO devices that aligns with which part of
tuxedo-drivers implements the features of that device. They are independent
of each other so I plan to put them in different subfolders to reflect
that.

Best regards,
Werner Sembach

Werner Sembach (1):
  platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices

 MAINTAINERS                                   |   6 +
 drivers/platform/x86/Kconfig                  |   2 +
 drivers/platform/x86/Makefile                 |   3 +
 drivers/platform/x86/tuxedo/Kbuild            |   6 +
 drivers/platform/x86/tuxedo/Kconfig           |   6 +
 drivers/platform/x86/tuxedo/nb04/Kbuild       |   9 +
 drivers/platform/x86/tuxedo/nb04/Kconfig      |  14 +
 .../platform/x86/tuxedo/nb04/wmi_ab_init.c    | 103 +++
 .../platform/x86/tuxedo/nb04/wmi_ab_init.h    |  18 +
 .../x86/tuxedo/nb04/wmi_ab_virt_lamparray.c   | 772 ++++++++++++++++++
 .../x86/tuxedo/nb04/wmi_ab_virt_lamparray.h   |  18 +
 .../platform/x86/tuxedo/nb04/wmi_xx_util.c    |  97 +++
 .../platform/x86/tuxedo/nb04/wmi_xx_util.h    | 112 +++
 13 files changed, 1166 insertions(+)
 create mode 100644 drivers/platform/x86/tuxedo/Kbuild
 create mode 100644 drivers/platform/x86/tuxedo/Kconfig
 create mode 100644 drivers/platform/x86/tuxedo/nb04/Kbuild
 create mode 100644 drivers/platform/x86/tuxedo/nb04/Kconfig
 create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_init.c
 create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_init.h
 create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_virt_lamparray.c
 create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_virt_lamparray.h
 create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_xx_util.c
 create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_xx_util.h

Comments

Armin Wolf Feb. 1, 2025, 4:39 a.m. UTC | #1
Am 21.01.25 um 23:31 schrieb Werner Sembach:

> Hi,
> after some other work, picked this up again.
> Only coding style changes vs v4.
>
>
> I now got my feet a little wet with hid-bpf regarding something else, and
> with that knowledge I would leave the long arrays in the beginning in the
> kernel code for the time being:
>
> sirius_16_ansii_kbl_mapping and sirius_16_iso_kbl_mapping are required
> during initialization so they have to exist in the kernel code anyway.
>
> report_descriptor will most likly not change even for future models and
> afaik having report_descriptors in kernel drivers is not unheard of.
>
> So the only things that could be meaningfully moved to a hid-bpf program
> are the sirius_16_*_kbl_mapping_pos_* arrays. But for these is have to give
> out some fallback value anyway for the case where a hid-bpf file is missing
> or fails to load. So why not use real world values from my test device for
> these values?
>
> As soon as there is a future device that can use the same driver with just
> these pos arrays different, then I would implement that change via a bpf
> program instead of a change to the kernel driver.
>
> Let me know if you too think this is a sensefull approach?
>
>
> Another question: Would this patch need to wait for a userspace
> implementation of lamp array before it can get accepted?

It would be nice if you could test the LampArray implementation. But other than that
userspace can catch up later.

Still, i am interested in the opinion of the LED maintainers regarding the fake HID interface.

Thanks,
Armin Wolf

>
> The folder structure and naming scheme with nb04 is im preparation for
> other parts of tuxedo-drivers to be upstreamed. NB04 is one of the
> board_vendor dmi strings on TUXEDO devices that aligns with which part of
> tuxedo-drivers implements the features of that device. They are independent
> of each other so I plan to put them in different subfolders to reflect
> that.
>
> Best regards,
> Werner Sembach
>
> Werner Sembach (1):
>    platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices
>
>   MAINTAINERS                                   |   6 +
>   drivers/platform/x86/Kconfig                  |   2 +
>   drivers/platform/x86/Makefile                 |   3 +
>   drivers/platform/x86/tuxedo/Kbuild            |   6 +
>   drivers/platform/x86/tuxedo/Kconfig           |   6 +
>   drivers/platform/x86/tuxedo/nb04/Kbuild       |   9 +
>   drivers/platform/x86/tuxedo/nb04/Kconfig      |  14 +
>   .../platform/x86/tuxedo/nb04/wmi_ab_init.c    | 103 +++
>   .../platform/x86/tuxedo/nb04/wmi_ab_init.h    |  18 +
>   .../x86/tuxedo/nb04/wmi_ab_virt_lamparray.c   | 772 ++++++++++++++++++
>   .../x86/tuxedo/nb04/wmi_ab_virt_lamparray.h   |  18 +
>   .../platform/x86/tuxedo/nb04/wmi_xx_util.c    |  97 +++
>   .../platform/x86/tuxedo/nb04/wmi_xx_util.h    | 112 +++
>   13 files changed, 1166 insertions(+)
>   create mode 100644 drivers/platform/x86/tuxedo/Kbuild
>   create mode 100644 drivers/platform/x86/tuxedo/Kconfig
>   create mode 100644 drivers/platform/x86/tuxedo/nb04/Kbuild
>   create mode 100644 drivers/platform/x86/tuxedo/nb04/Kconfig
>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_init.c
>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_init.h
>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_virt_lamparray.c
>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_virt_lamparray.h
>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_xx_util.c
>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_xx_util.h
>
Pavel Machek Feb. 1, 2025, 8:48 a.m. UTC | #2
Hi!

> > I now got my feet a little wet with hid-bpf regarding something else, and
> > with that knowledge I would leave the long arrays in the beginning in the
> > kernel code for the time being:
> > 
> > sirius_16_ansii_kbl_mapping and sirius_16_iso_kbl_mapping are required
> > during initialization so they have to exist in the kernel code anyway.
> > 
> > report_descriptor will most likly not change even for future models and
> > afaik having report_descriptors in kernel drivers is not unheard of.
> > 
> > So the only things that could be meaningfully moved to a hid-bpf program
> > are the sirius_16_*_kbl_mapping_pos_* arrays. But for these is have to give
> > out some fallback value anyway for the case where a hid-bpf file is missing
> > or fails to load. So why not use real world values from my test device for
> > these values?
> > 
> > As soon as there is a future device that can use the same driver with just
> > these pos arrays different, then I would implement that change via a bpf
> > program instead of a change to the kernel driver.
> > 
> > Let me know if you too think this is a sensefull approach?
> > 
> > 
> > Another question: Would this patch need to wait for a userspace
> > implementation of lamp array before it can get accepted?
> 
> It would be nice if you could test the LampArray implementation. But other than that
> userspace can catch up later.
> 
> Still, i am interested in the opinion of the LED maintainers
> regarding the fake HID interface.

Comments from previous review were not addressed.

Most importantly, this is not a way to do kernel interface. We want
reasonable interface that can be documented and modified as needed. We
want to pass /dev/input to userspace, not raw HID. This is not ok.

Best regards,
								Pavel
Werner Sembach Feb. 1, 2025, 7:49 p.m. UTC | #3
Am 01.02.25 um 05:39 schrieb Armin Wolf:
> Am 21.01.25 um 23:31 schrieb Werner Sembach:
>
>> Hi,
>> after some other work, picked this up again.
>> Only coding style changes vs v4.
>>
>>
>> I now got my feet a little wet with hid-bpf regarding something else, and
>> with that knowledge I would leave the long arrays in the beginning in the
>> kernel code for the time being:
>>
>> sirius_16_ansii_kbl_mapping and sirius_16_iso_kbl_mapping are required
>> during initialization so they have to exist in the kernel code anyway.
>>
>> report_descriptor will most likly not change even for future models and
>> afaik having report_descriptors in kernel drivers is not unheard of.
>>
>> So the only things that could be meaningfully moved to a hid-bpf program
>> are the sirius_16_*_kbl_mapping_pos_* arrays. But for these is have to give
>> out some fallback value anyway for the case where a hid-bpf file is missing
>> or fails to load. So why not use real world values from my test device for
>> these values?
>>
>> As soon as there is a future device that can use the same driver with just
>> these pos arrays different, then I would implement that change via a bpf
>> program instead of a change to the kernel driver.
>>
>> Let me know if you too think this is a sensefull approach?
>>
>>
>> Another question: Would this patch need to wait for a userspace
>> implementation of lamp array before it can get accepted?
>
> It would be nice if you could test the LampArray implementation. But other 
> than that
> userspace can catch up later.
I tested with the attached programs (I directly edited the source files to test 
different things, this is just a snapshot).
>
> Still, i am interested in the opinion of the LED maintainers regarding the 
> fake HID interface.
>
> Thanks,
> Armin Wolf
>
>>
>> The folder structure and naming scheme with nb04 is im preparation for
>> other parts of tuxedo-drivers to be upstreamed. NB04 is one of the
>> board_vendor dmi strings on TUXEDO devices that aligns with which part of
>> tuxedo-drivers implements the features of that device. They are independent
>> of each other so I plan to put them in different subfolders to reflect
>> that.
>>
>> Best regards,
>> Werner Sembach
>>
>> Werner Sembach (1):
>>    platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices
>>
>>   MAINTAINERS                                   |   6 +
>>   drivers/platform/x86/Kconfig                  |   2 +
>>   drivers/platform/x86/Makefile                 |   3 +
>>   drivers/platform/x86/tuxedo/Kbuild            |   6 +
>>   drivers/platform/x86/tuxedo/Kconfig           |   6 +
>>   drivers/platform/x86/tuxedo/nb04/Kbuild       |   9 +
>>   drivers/platform/x86/tuxedo/nb04/Kconfig      |  14 +
>>   .../platform/x86/tuxedo/nb04/wmi_ab_init.c    | 103 +++
>>   .../platform/x86/tuxedo/nb04/wmi_ab_init.h    |  18 +
>>   .../x86/tuxedo/nb04/wmi_ab_virt_lamparray.c   | 772 ++++++++++++++++++
>>   .../x86/tuxedo/nb04/wmi_ab_virt_lamparray.h   |  18 +
>>   .../platform/x86/tuxedo/nb04/wmi_xx_util.c    |  97 +++
>>   .../platform/x86/tuxedo/nb04/wmi_xx_util.h    | 112 +++
>>   13 files changed, 1166 insertions(+)
>>   create mode 100644 drivers/platform/x86/tuxedo/Kbuild
>>   create mode 100644 drivers/platform/x86/tuxedo/Kconfig
>>   create mode 100644 drivers/platform/x86/tuxedo/nb04/Kbuild
>>   create mode 100644 drivers/platform/x86/tuxedo/nb04/Kconfig
>>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_init.c
>>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_init.h
>>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_virt_lamparray.c
>>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_ab_virt_lamparray.h
>>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_xx_util.c
>>   create mode 100644 drivers/platform/x86/tuxedo/nb04/wmi_xx_util.h
>>
cmake_minimum_required(VERSION 3.5)

project(LampArrayPlayground)

add_executable(lap lap.cpp)
target_compile_features(lap PRIVATE cxx_std_17)

add_executable(laploop laploop.cpp)
target_compile_features(laploop PRIVATE cxx_std_17)

add_executable(laploopsingle laploopsingle.cpp)
target_compile_features(laploopsingle PRIVATE cxx_std_17)