linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Nikita Mikhailevich <ermyril@gmail.com>
Cc: <linux-iio@vger.kernel.org>
Subject: Re: iio: accel: mxc4005: new ACPI ID for the MXC6655 accelerometer?
Date: Wed, 31 Jan 2024 16:38:42 +0000	[thread overview]
Message-ID: <20240131163842.00003c64@Huawei.com> (raw)
In-Reply-To: <CAHoRnbRjtAOE0xKUUZh8zfALzGnLPCjrxUE15jJ_y7i1dQq+Uw@mail.gmail.com>

On Wed, 31 Jan 2024 16:10:09 +0100
Nikita Mikhailevich <ermyril@gmail.com> wrote:

> Hello!
> 
> I've got a laptop which has an MXC6655 accelerometer, but I couldn't
> get it up and running despite the driver being present in the kernel.
> When I was manually doing modprobe mxc4005 - nothing happened. Journal
> and dmesg don't have anything relevant in them.
> And if I was trying to run monitor-sensor and start iio-sensor-proxy,
> I was getting a following error:
> 
> Failed to claim accelerometer:
> GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.609
> was not provided by any .service files
> 
> The device in /sys/bus/acpi/devices shows as MDA6655 instead of
> MXC6655, which led me to try applying the following changes, after
> which the device started working properly:
> 
> Signed-off-by: Nikita Mikhailevich <ermyril@gmail.com>
> ---
> diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c
> index 82e8d0b39..0928b6e13 100644
> --- a/drivers/iio/accel/mxc4005.c
> +++ b/drivers/iio/accel/mxc4005.c
> @@ -472,6 +472,7 @@ static int mxc4005_probe(struct i2c_client *client)
>  static const struct acpi_device_id mxc4005_acpi_match[] = {
>      {"MXC4005",    0},
>      {"MXC6655",    0},
> +    {"MDA6655",    0},

This is good.

>      { },
>  };
>  MODULE_DEVICE_TABLE(acpi, mxc4005_acpi_match);
> @@ -479,6 +480,7 @@ MODULE_DEVICE_TABLE(acpi, mxc4005_acpi_match);
>  static const struct of_device_id mxc4005_of_match[] = {
>      { .compatible = "memsic,mxc4005", },
>      { .compatible = "memsic,mxc6655", },
> +    { .compatible = "memsic,mda6655", },

Don't add this.  As far as we know it's just an ACPI ID, not a new
part number.

>      { },
>  };
>  MODULE_DEVICE_TABLE(of, mxc4005_of_match);
> @@ -486,6 +488,7 @@ MODULE_DEVICE_TABLE(of, mxc4005_of_match);
>  static const struct i2c_device_id mxc4005_id[] = {
>      {"mxc4005",    0},
>      {"mxc6655",    0},
> +    {"mda6655",     0},
Don't add this either.

>      { },
>  };
>  MODULE_DEVICE_TABLE(i2c, mxc4005_id);
> ---
> 
> Please let me know what should my next steps be, is such patch legit
> and should be submitted properly, is there anything wrong with the
> code or are we able to mitigate the issue without changes in the
> kernel, using udev rules for example, and if so - should we? (that
> will leave such devices still broken by default)

Submit a patch formally adding the ACPI Table entry you have above.
Include the device details in the patch description so we konw
this ID is definitely out there on a real device.

Thanks,

Jonathan

> 
> Thank you,
> Nikita Mikhailevich
> 
> 
> The following are the debug commands that might be useful to
> understand the situation, they were taken before rebuilding the kernel
> with the patch above
> 
> $ journalctl | grep -E "4005|6655"
> Jan 17 03:25:38 nixos systemd-modules-load[388]: Inserted module 'mxc4005'
> Jan 17 10:11:08 nixos systemd-modules-load[401]: Inserted module 'mxc4005'
> Jan 17 10:23:12 nixos systemd-modules-load[422]: Inserted module 'mxc4005'
> 
> $ journalctl | grep -Ei "iio"
> Jan 21 06:00:22 nixos systemd[1]: Starting IIO Sensor Proxy service...
> Jan 21 06:00:22 nixos systemd[1]: Started IIO Sensor Proxy service.
> Jan 21 06:00:22 nixos systemd[1]: iio-sensor-proxy.service:
> Deactivated successfully.
> 
> $ lsmod | grep 4005
> mxc4005                16384  0
> industrialio_triggered_buffer    12288  1 mxc4005
> industrialio          135168  3 industrialio_triggered_buffer,kfifo_buf,mxc4005
> 
> $ ls -al /sys/bus/acpi/devices | grep 6655
> lrwxrwxrwx 1 root root 0 Jan 24 22:57 MDA6655:00 ->
> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/MDA6655:00
> lrwxrwxrwx 1 root root 0 Jan 24 22:57 MXC6655:00 ->
> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:6c/MXC6655:00
> lrwxrwxrwx 1 root root 0 Jan 24 22:57 MXC6655:01 ->
> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:6e/MXC6655:01
> 
> $ ls -al /sys/bus/i2c/devices/ | grep 6655
> lrwxrwxrwx 1 root root 0 Jan 24 23:23 i2c-MDA6655:00 ->
> ../../../devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-MDA6655:00
> 
> $ cat /sys/bus/i2c/devices/i2c-MDA6655:00/modalias
> acpi:MDA6655:MDA6655:
> 
> $ cat /sys/bus/acpi/devices/MDA6655:00/modalias
> acpi:MDA6655:MDA6655:
> 
> $ udevadm info --export-db | grep iio
>   - empty output
> 
> 
> $ udevadm info --attribute-walk --path=/sys/bus/acpi/devices/MDA6655:00/
> 
>   looking at device '/devices/LNXSYSTM:00/LNXSYBUS:00/MDA6655:00':
>     KERNEL=="MDA6655:00"
>     SUBSYSTEM=="acpi"
>     DRIVER==""
>     ATTR{adr}=="0x00000000"
>     ATTR{hid}=="MDA6655"
>     ATTR{path}=="\_SB_.ACMK"
>     ATTR{power/async}=="disabled"
>     ATTR{power/control}=="auto"
>     ATTR{power/runtime_active_kids}=="0"
>     ATTR{power/runtime_active_time}=="0"
>     ATTR{power/runtime_enabled}=="disabled"
>     ATTR{power/runtime_status}=="unsupported"
>     ATTR{power/runtime_suspended_time}=="0"
>     ATTR{power/runtime_usage}=="0"
>     ATTR{status}=="15"
>     ATTR{uid}=="1"
> 
>   looking at parent device '/devices/LNXSYSTM:00/LNXSYBUS:00':
>     KERNELS=="LNXSYBUS:00"
>     SUBSYSTEMS=="acpi"
>     DRIVERS==""
>     ATTRS{hid}=="LNXSYBUS"
>     ATTRS{path}=="\_SB_"
>     ATTRS{power/async}=="disabled"
>     ATTRS{power/control}=="auto"
>     ATTRS{power/runtime_active_kids}=="0"
>     ATTRS{power/runtime_active_time}=="0"
>     ATTRS{power/runtime_enabled}=="disabled"
>     ATTRS{power/runtime_status}=="unsupported"
>     ATTRS{power/runtime_suspended_time}=="0"
>     ATTRS{power/runtime_usage}=="0"
> 
>   looking at parent device '/devices/LNXSYSTM:00':
>     KERNELS=="LNXSYSTM:00"
>     SUBSYSTEMS=="acpi"
>     DRIVERS==""
>     ATTRS{hid}=="LNXSYSTM"
>     ATTRS{path}=="\"
>     ATTRS{power/async}=="disabled"
>     ATTRS{power/control}=="auto"
>     ATTRS{power/runtime_active_kids}=="0"
>     ATTRS{power/runtime_active_time}=="0"
>     ATTRS{power/runtime_enabled}=="disabled"
>     ATTRS{power/runtime_status}=="unsupported"
>     ATTRS{power/runtime_suspended_time}=="0"
>     ATTRS{power/runtime_usage}=="0"
> 
> 
> $ udevadm info --attribute-walk --path=/sys/bus/acpi/devices/MXC6655:00/
> 
>   looking at device
> '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:6c/MXC6655:00':
>     KERNEL=="MXC6655:00"
>     SUBSYSTEM=="acpi"
>     DRIVER==""
>     ATTR{adr}=="0x00000000"
>     ATTR{adr}=="0x00000000"
>     ATTR{hid}=="MXC6655"
>     ATTR{path}=="\_SB_.PC00.I2C0.ACMG"
>     ATTR{power/async}=="disabled"
>     ATTR{power/control}=="auto"
>     ATTR{power/runtime_active_kids}=="0"
>     ATTR{power/runtime_active_time}=="0"
>     ATTR{power/runtime_enabled}=="disabled"
>     ATTR{power/runtime_status}=="unsupported"
>     ATTR{power/runtime_suspended_time}=="0"
>     ATTR{power/runtime_usage}=="0"
>     ATTR{status}=="0"
>     ATTR{uid}=="1"
> 
>   looking at parent device
> '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:6c':
>     KERNELS=="device:6c"
>     SUBSYSTEMS=="acpi"
>     DRIVERS==""
>     ATTRS{adr}=="0x00150000"
>     ATTRS{path}=="\_SB_.PC00.I2C0"
>     ATTRS{power/async}=="disabled"
>     ATTRS{power/control}=="auto"
>     ATTRS{power/runtime_active_kids}=="0"
>     ATTRS{power/runtime_active_time}=="0"
>     ATTRS{power/runtime_enabled}=="disabled"
>     ATTRS{power/runtime_status}=="unsupported"
>     ATTRS{power/runtime_suspended_time}=="0"
>     ATTRS{power/runtime_usage}=="0"
>     ATTRS{power_state}=="D3hot"
> 
>   looking at parent device '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00':
>     KERNELS=="PNP0A08:00"
>     SUBSYSTEMS=="acpi"
>     DRIVERS==""
>     ATTRS{adr}=="0x00000000"
>     ATTRS{hid}=="PNP0A08"
>     ATTRS{path}=="\_SB_.PC00"
>     ATTRS{power/async}=="disabled"
>     ATTRS{power/control}=="auto"
>     ATTRS{power/runtime_active_kids}=="0"
>     ATTRS{power/runtime_active_time}=="0"
>     ATTRS{power/runtime_enabled}=="disabled"
>     ATTRS{power/runtime_status}=="unsupported"
>     ATTRS{power/runtime_suspended_time}=="0"
>     ATTRS{power/runtime_usage}=="0"
>     ATTRS{uid}=="0"
> 
>   looking at parent device '/devices/LNXSYSTM:00/LNXSYBUS:00':
>     KERNELS=="LNXSYBUS:00"
>     SUBSYSTEMS=="acpi"
>     DRIVERS==""
>     ATTRS{hid}=="LNXSYBUS"
>     ATTRS{path}=="\_SB_"
>     ATTRS{power/async}=="disabled"
>     ATTRS{power/control}=="auto"
>     ATTRS{power/runtime_active_kids}=="0"
>     ATTRS{power/runtime_active_time}=="0"
>     ATTRS{power/runtime_enabled}=="disabled"
>     ATTRS{power/runtime_status}=="unsupported"
>     ATTRS{power/runtime_suspended_time}=="0"
>     ATTRS{power/runtime_usage}=="0"
> 
>   looking at parent device '/devices/LNXSYSTM:00':
>     KERNELS=="LNXSYSTM:00"
>     SUBSYSTEMS=="acpi"
>     DRIVERS==""
>     ATTRS{hid}=="LNXSYSTM"
>     ATTRS{path}=="\"
>     ATTRS{power/async}=="disabled"
>     ATTRS{power/control}=="auto"
>     ATTRS{power/runtime_active_kids}=="0"
>     ATTRS{power/runtime_active_time}=="0"
>     ATTRS{power/runtime_enabled}=="disabled"
>     ATTRS{power/runtime_status}=="unsupported"
>     ATTRS{power/runtime_suspended_time}=="0"
>     ATTRS{power/runtime_usage}=="0"
> 
> 
> $ cat /sys/class/dmi/id/modalias
> dmi:bvnAmericanMegatrendsInternational,LLC.:bvrDNN20V2.13:bd09/05/2023:br2.13:efr0.15:svnCHUWIInnovationAndTechnology(ShenZhen)co.,Ltd:pnMiniBookX:pvrDefaultstring:rvnDefaultstring:rnDefaultstring:rvrDefaultstring:cvnDefaultstring:ct10:cvrDefaultstring:skuDefaultstring:
> 


      reply	other threads:[~2024-01-31 16:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 15:10 iio: accel: mxc4005: new ACPI ID for the MXC6655 accelerometer? Nikita Mikhailevich
2024-01-31 16:38 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240131163842.00003c64@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=ermyril@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).