Re: BMI160 accelerometer on AyaNeo tablet

From: Hans de Goede
Date: Tue Oct 19 2021 - 04:10:19 EST


Hi,

On 10/18/21 21:02, Andy Shevchenko wrote:
> On Mon, Oct 18, 2021 at 09:02:40PM +0300, Maxim Levitsky wrote:
>> I also suspect a mistake from the hardware vendors.
>>
>> I attached all DSDT decompiled, which shows that they indeed use that
>> ID, and I also attached the windows driver .INF which was published on
>> their website with the driver (https://www.ayaneo.com/downloads)
>>
>> They are a small startup so they might have used the realtek ID by mistake.
>> I added them to the CC.
>
> Thank you for sharing. Seems they indeed used (deliberately or not) the wrong
> ID. So there are questions I have:
> - Is the firmware available in the wild?
> - Do they plan to update firmware to fix this?
> - Can we make sure that guys got their mistake and will be more careful
> in the future?
>
> Realtek probably should make this ID marked somehow broken and not use
> in their products in case the answer to the first of the above question
> is "yes". (Of course in case the ID will be used for solely PCI enumerated
> product there will be no conflict, I just propose to be on the safest side,
> but remark should be made somewhere).
>
>> BTW, I also notice a rotation matrix embedded in DSTD, but the linux's
>> BMI160 driver doesn't recognize it.
>
> This is done by the commit 8a0672003421 ("iio: accel: bmc150: Get
> mount-matrix from ACPI") which needs to be amended to take care about
> more devices, somewhere in drivers/iio/industialio-acpi.c ? Jonathan,
> Hans, what do you think?

First of all the vendor needs to be asked to fix their DSDT to just
use BOSC0200 as HID. That will fix both the driver not binding as well
as it will make the bmc150_apply_acpi_orientation() just work.

If we are going to add the funky ACPI HID to the driver, then this
HID check in bmc150_apply_acpi_orientation():

if (!adev || !acpi_dev_hid_uid_match(adev, "BOSC0200", NULL))
return false;

Should probable just be dropped changing the check to just:

if (!adev)
return false;

We already check for the method name later, so the HID check is not
really necessary.

This dropping of the HID check should probably be done in a separate
commit, with its own explanation of why this is ok.

Regards,

Hans