mbox series

[v3,0/3] Basic DT support for Lenovo Miix 630

Message ID 20190415160915.16324-1-jeffrey.l.hugo@gmail.com
Headers show
Series Basic DT support for Lenovo Miix 630 | expand

Message

Jeffrey Hugo April 15, 2019, 4:09 p.m. UTC
The Lenovo Miix 630 is one of three ARM based (specifically Qualcomm
MSM8998) laptops that comes with Windows, and seems to have a dedicated
following of folks intrested to get Linux up and running on it.

This series adds support for the basic functionality this is validated
towork using devicetree.  Although the laptops do feed ACPI to Windows,
the existing MSM8998 support in mainline is DT based, so DT provides a
quick path to functionality while ACPI support is investigated.

The three devices are very similar, but do have differences in the set
of peripherals supported, so the idea is that the vast majority of the
support for all three can live in a common include, which should reduce
overall duplication.  Adding support for the other two devices as a
follow on should involve minimal work.

The bleeding edge work for these laptops and work in progress can be
found at https://github.com/aarch64-laptops/prebuilt

v3:
-Changed "clam" to "clamshell"
-Defined a dt binding for the combo Elan keyboard + touchpad device
-Adjusted the HID quirk to be correct for dt boot
-Removed extranious comment in board dts
-Fixed board level compatible

v2:
-Changed "cls" to "clam" since feedback indicated "cls" is too opaque,
but
"clamshell" is a mouthfull.  "clam" seems to be a happy medium.

Jeffrey Hugo (3):
  dt-bindings: input: add Elan 400 combo keyboard/touchpad over i2c
  HID: quirks: Fix keyboard + touchpad on Lenovo Miix 630 for DT
  arm64: dts: qcom: Add Lenovo Miix 630

 .../bindings/input/elan,combo400-i2c.txt      |  11 +
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../boot/dts/qcom/msm8998-clamshell.dtsi      | 278 ++++++++++++++++++
 .../boot/dts/qcom/msm8998-lenovo-miix-630.dts |  30 ++
 drivers/hid/hid-quirks.c                      |   3 +-
 5 files changed, 322 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/input/elan,combo400-i2c.txt
 create mode 100644 arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/msm8998-lenovo-miix-630.dts

Comments

Benjamin Tissoires April 18, 2019, 9:34 a.m. UTC | #1
On Mon, Apr 15, 2019 at 6:11 PM Jeffrey Hugo <jeffrey.l.hugo@gmail.com> wrote:
>
> Following up on commit 2bafa1e96254 ("HID: quirks: Fix keyboard + touchpad
> on Lenovo Miix 630"), the devicetree (DT) identifier for the combo keyboard
> + touchpad device is "elan,combo400-i2c", which differs from the ACPI ID,
> thus if we want the quirk to work properly when booting via DT instead of
> ACPI, we need to key off the DT id as well.
>
> Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
> ---
>  drivers/hid/hid-quirks.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
> index 77ffba48cc73..00c08f8318b8 100644
> --- a/drivers/hid/hid-quirks.c
> +++ b/drivers/hid/hid-quirks.c
> @@ -997,7 +997,8 @@ bool hid_ignore(struct hid_device *hdev)
>                         return true;
>                 /* Same with product id 0x0400 */
>                 if (hdev->product == 0x0400 &&
> -                   strncmp(hdev->name, "QTEC0001", 8) != 0)
> +                   (strncmp(hdev->name, "QTEC0001", 8) != 0 ||
> +                    strncmp(hdev->name, "elan,combo400-i2c", 17) != 0))

I think we are taking the problem the wrong way here.

When I first introduced 6ccfe64, I thought 0x0400 would be reserved
for the elan_i2c touchpads only. But it turns out we are deliberately
disabling valid HID touchpads hoping that they would be picked up by
elan_i2c when elan_i2c has its own whitelist of devices.

How about we turn this into list with the matching ones from elan_i2c:
if ((hdev->product == 0x0400 || hdev->product == 0x0401) &&
   (strncmp(hdev->name, "ELAN0000", 8) == 0 ||
    strncmp(hdev->name, "ELAN0100", 8) == 0 ||
    ...
    strncmp(hdev->name, "ELAN1000", 8) == 0))
      return true;

So next time we need to force binding a HID touchpad to elan_i2c, we
can just blacklist here and whitelist it in elan_i2c.

Cheers,
Benjamin

>                         return true;
>                 break;
>         }
> --
> 2.17.1
>
Hans de Goede April 18, 2019, 9:51 a.m. UTC | #2
Hi,

On 18-04-19 11:34, Benjamin Tissoires wrote:
> On Mon, Apr 15, 2019 at 6:11 PM Jeffrey Hugo <jeffrey.l.hugo@gmail.com> wrote:
>>
>> Following up on commit 2bafa1e96254 ("HID: quirks: Fix keyboard + touchpad
>> on Lenovo Miix 630"), the devicetree (DT) identifier for the combo keyboard
>> + touchpad device is "elan,combo400-i2c", which differs from the ACPI ID,
>> thus if we want the quirk to work properly when booting via DT instead of
>> ACPI, we need to key off the DT id as well.
>>
>> Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
>> ---
>>   drivers/hid/hid-quirks.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
>> index 77ffba48cc73..00c08f8318b8 100644
>> --- a/drivers/hid/hid-quirks.c
>> +++ b/drivers/hid/hid-quirks.c
>> @@ -997,7 +997,8 @@ bool hid_ignore(struct hid_device *hdev)
>>                          return true;
>>                  /* Same with product id 0x0400 */
>>                  if (hdev->product == 0x0400 &&
>> -                   strncmp(hdev->name, "QTEC0001", 8) != 0)
>> +                   (strncmp(hdev->name, "QTEC0001", 8) != 0 ||
>> +                    strncmp(hdev->name, "elan,combo400-i2c", 17) != 0))
> 
> I think we are taking the problem the wrong way here.
> 
> When I first introduced 6ccfe64, I thought 0x0400 would be reserved
> for the elan_i2c touchpads only. But it turns out we are deliberately
> disabling valid HID touchpads hoping that they would be picked up by
> elan_i2c when elan_i2c has its own whitelist of devices.
> 
> How about we turn this into list with the matching ones from elan_i2c:
> if ((hdev->product == 0x0400 || hdev->product == 0x0401) &&
>     (strncmp(hdev->name, "ELAN0000", 8) == 0 ||
>      strncmp(hdev->name, "ELAN0100", 8) == 0 ||
>      ...
>      strncmp(hdev->name, "ELAN1000", 8) == 0))
>        return true;
> 
> So next time we need to force binding a HID touchpad to elan_i2c, we
> can just blacklist here and whitelist it in elan_i2c.

This indeed sounds like a better way forward with this.

Regards,

Hans
Jeffrey Hugo April 18, 2019, 2:43 p.m. UTC | #3
On Thu, Apr 18, 2019 at 3:51 AM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 18-04-19 11:34, Benjamin Tissoires wrote:
> > On Mon, Apr 15, 2019 at 6:11 PM Jeffrey Hugo <jeffrey.l.hugo@gmail.com> wrote:
> >>
> >> Following up on commit 2bafa1e96254 ("HID: quirks: Fix keyboard + touchpad
> >> on Lenovo Miix 630"), the devicetree (DT) identifier for the combo keyboard
> >> + touchpad device is "elan,combo400-i2c", which differs from the ACPI ID,
> >> thus if we want the quirk to work properly when booting via DT instead of
> >> ACPI, we need to key off the DT id as well.
> >>
> >> Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
> >> ---
> >>   drivers/hid/hid-quirks.c | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
> >> index 77ffba48cc73..00c08f8318b8 100644
> >> --- a/drivers/hid/hid-quirks.c
> >> +++ b/drivers/hid/hid-quirks.c
> >> @@ -997,7 +997,8 @@ bool hid_ignore(struct hid_device *hdev)
> >>                          return true;
> >>                  /* Same with product id 0x0400 */
> >>                  if (hdev->product == 0x0400 &&
> >> -                   strncmp(hdev->name, "QTEC0001", 8) != 0)
> >> +                   (strncmp(hdev->name, "QTEC0001", 8) != 0 ||
> >> +                    strncmp(hdev->name, "elan,combo400-i2c", 17) != 0))
> >
> > I think we are taking the problem the wrong way here.
> >
> > When I first introduced 6ccfe64, I thought 0x0400 would be reserved
> > for the elan_i2c touchpads only. But it turns out we are deliberately
> > disabling valid HID touchpads hoping that they would be picked up by
> > elan_i2c when elan_i2c has its own whitelist of devices.
> >
> > How about we turn this into list with the matching ones from elan_i2c:
> > if ((hdev->product == 0x0400 || hdev->product == 0x0401) &&
> >     (strncmp(hdev->name, "ELAN0000", 8) == 0 ||
> >      strncmp(hdev->name, "ELAN0100", 8) == 0 ||
> >      ...
> >      strncmp(hdev->name, "ELAN1000", 8) == 0))
> >        return true;
> >
> > So next time we need to force binding a HID touchpad to elan_i2c, we
> > can just blacklist here and whitelist it in elan_i2c.
>
> This indeed sounds like a better way forward with this.

This sounds good to me.  Let me implement it and test with the Miix
630.  Thanks for the suggestion.
Bjorn Andersson April 27, 2019, 4:42 a.m. UTC | #4
On Mon 15 Apr 09:11 PDT 2019, Jeffrey Hugo wrote:
> diff --git a/arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi b/arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi
[..]
> +	thermal-zones {
> +		battery-thermal {
> +			polling-delay-passive = <250>;
> +			polling-delay = <1000>;
> +
> +			thermal-sensors = <&tsens0 0>;

I guess you inherited the battery and skin thermal nodes from my MTP
dts. Unfortunately after talking to Amit I think I got these wrong, and
they should be &pmi8998_adc 0 and 5 instead.

Can you confirm this?

> +
> +			trips {
> +				battery_crit: trip0 {
> +					temperature = <60000>;
> +					hysteresis = <2000>;
> +					type = "critical";
> +				};
> +			};
> +		};

Regards,
Bjorn
Jeffrey Hugo April 29, 2019, 3:16 p.m. UTC | #5
On Fri, Apr 26, 2019 at 10:42 PM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> On Mon 15 Apr 09:11 PDT 2019, Jeffrey Hugo wrote:
> > diff --git a/arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi b/arch/arm64/boot/dts/qcom/msm8998-clamshell.dtsi
> [..]
> > +     thermal-zones {
> > +             battery-thermal {
> > +                     polling-delay-passive = <250>;
> > +                     polling-delay = <1000>;
> > +
> > +                     thermal-sensors = <&tsens0 0>;
>
> I guess you inherited the battery and skin thermal nodes from my MTP
> dts. Unfortunately after talking to Amit I think I got these wrong, and
> they should be &pmi8998_adc 0 and 5 instead.
>
> Can you confirm this?

Yeah, I pulled thermal from the MTP.  Someone pointed this out on the
v4 series.  I haven't circled back to it yet.

>
> > +
> > +                     trips {
> > +                             battery_crit: trip0 {
> > +                                     temperature = <60000>;
> > +                                     hysteresis = <2000>;
> > +                                     type = "critical";
> > +                             };
> > +                     };
> > +             };
>
> Regards,
> Bjorn