mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luca Weiss" <luca.weiss@fairphone.com>
To: "Yassine Oudjana" <y.oudjana@protonmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nicolas.schier@linux.dev>,
	"Alexander Sverdlin" <alexander.sverdlin@gmail.com>,
	"Sean Nyekjaer" <sean@geanix.com>,
	"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Ramona Gradinariu" <ramona.gradinariu@analog.com>,
	"Yo-Jung (Leo) Lin" <0xff07@gmail.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Barnabás Czémán" <barnabas.czeman@mainlining.org>,
	"Danila Tikhonov" <danila@jiaxyga.com>,
	"Antoni Pokusinski" <apokusinski01@gmail.com>,
	"Vasileios Amoiridis" <vassilisamir@gmail.com>,
	"Petar Stoykov" <pd.pstoykov@gmail.com>,
	"shuaijie wang" <wangshuaijie@awinic.com>,
	"Yasin Lee" <yasin.lee.x@gmail.com>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Pawan Gupta" <pawan.kumar.gupta@linux.intel.com>,
	"Ingo Molnar" <mingo@kernel.org>
Cc: "Yassine Oudjana" <yassine.oudjana@gmail.com>,
	<linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>,
	<linux-arm-msm@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-kbuild@vger.kernel.org>
Subject: Re: [PATCH 0/3] QRTR bus and Qualcomm Sensor Manager IIO drivers
Date: Tue, 08 Apr 2025 12:27:58 +0200	[thread overview]
Message-ID: <D916PQ9VLGEB.Q61B70OVQ9JZ@fairphone.com> (raw)
In-Reply-To: <20250406140706.812425-1-y.oudjana@protonmail.com>

Hi Yassine,

On Sun Apr 6, 2025 at 4:07 PM CEST, Yassine Oudjana wrote:
> Sensor Manager is a QMI service available on several Qualcomm SoCs which
> exposes available sensors and allows for getting data from them. This
> service is provided by either:
>
> - SSC (Snapdragon Sensor Core): Also known as SLPI (Sensor Low Power
>   Island). Has its own set of pins and peripherals to which sensors are
>   connected. These peripherals are generally inaccessible from the AP,
>   meaning sensors need to be operated exclusively through SSC. The only
>   known SoCs in this category are MSM8996 and MSM8998 (and their
>   derivatives).
> - ADSP (Audio DSP): Shares pins and peripherals with the AP. At least on
>   some devices, these pins could be configured as GPIOs which allows the AP
>   to access sensors by bit-banging their interfaces. Some SoCs in this
>   category are SDM630/660, MSM8953, MSM8974 and MSM8226.
>
> Before Sensor Manager becomes accessible, another service known as Sensor
> Registry needs to be provided by the AP. The remote processor that provides
> Sensor Manager will then request data from it, and once that process is
> done, will expose several services including Sensor Manager.
>
> This series adds kernel drivers for the Sensor Manager service, exposing
> sensors accessible through it as IIO devices. To facilitate probing of the
> Sensor Manager core driver, QRTR is turned into a bus, with services being
> exposed as devices. Once the Sensor Manager service becomes available, the
> kernel attaches its device to the driver added in this series. This allows
> for dynamic probing of Sensor Manager without the need for static DT
> bindings, which would also not be ideal because they would be describing
> software rather than hardware. Sensor Manager is given as a working example
> of the QRTR bus. Kernel drivers for other services may also be able
> to benefit from this change.
>
> As previously mentioned, a Sensor Registry server must run on the AP to
> provide the remote processor (either SLPI or ADSP) with necessary data.
> A userspace implementation of this server is made[1]. The server can be
> supplied with the necessary data in the form of a plain-text configuration
> file that can be pulled from the Android vendor partition (sample[2]), or
> generated from a binary file that can be pulled from the persist partition.
> A more recently developed kernel implementation of the Sensor Registry
> server[3] can also be used. This last implementation only supports reading
> data from the binary file pulled from persist. Sensor Registry remains out
> of the scope of this patch series, as the Sensor Registry server and Sensor
> Manager client (this series) are fully independent components.
>
> Due to the total lack of documentation on Sensor Manager, this driver was
> almost entirely the result of a process of capturing transactions between
> SSC and the proprietary Android daemons with several methods and manually
> decoding and interpreting them, sometimes by comparing with values acquired
> from Android APIs. A blog post[4] describes part of this process more
> detail. A little piece of downstream Android open-source code[5] was also
> used as reference during later stages of development. All of this, as well
> as a lack of time on my side for the last couple of years, meant that this
> driver had to go through a slow and intermittent development process for
> more than 3 years before reaching its current state.
>
> Currently supported sensor types include accelerometers, gyroscopes,
> magentometers, proximity and pressure sensors. Other types (namely
> light and temperature sensors) are close to being implemented.
>
> Some testing instructions may also be found here[6].

It's awesome to see this work being sent! I remember trying this quite a
while ago, so I definitely need to pick this up again and try it out!

I can try on msm8226, msm8974 and msm8953 so lots of platforms which
will gain sensor support thanks to you!

Regards
Luca

>
> [1] https://gitlab.com/msm8996-mainline/sns-reg
> [2] https://github.com/nian0114/android_vendor_xiaomi_scorpio/blob/mkn-mr1/proprietary/etc/sensors/sensor_def_qcomdev.conf
> [3] https://github.com/sdm660-mainline/linux/pull/57
> [4] https://emainline.gitlab.io/2022/04/08/Unlocking_SSC_P2.html
> [5] https://android.googlesource.com/platform/system/chre/+/android-8.0.0_r2/platform/slpi
> [6] https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/4118
>
> Yassine Oudjana (3):
>   net: qrtr: Turn QRTR into a bus
>   net: qrtr: Define macro to convert QMI version and instance to QRTR
>     instance
>   iio: Add Qualcomm Sensor Manager drivers
>
>  MAINTAINERS                                 |  18 +
>  drivers/iio/accel/Kconfig                   |  10 +
>  drivers/iio/accel/Makefile                  |   2 +
>  drivers/iio/accel/qcom_smgr_accel.c         | 138 ++++
>  drivers/iio/common/Kconfig                  |   1 +
>  drivers/iio/common/Makefile                 |   1 +
>  drivers/iio/common/qcom_smgr/Kconfig        |  16 +
>  drivers/iio/common/qcom_smgr/Makefile       |   8 +
>  drivers/iio/common/qcom_smgr/qcom_smgr.c    | 589 ++++++++++++++++
>  drivers/iio/common/qcom_smgr/qmi/Makefile   |   3 +
>  drivers/iio/common/qcom_smgr/qmi/sns_smgr.c | 711 ++++++++++++++++++++
>  drivers/iio/common/qcom_smgr/qmi/sns_smgr.h | 163 +++++
>  drivers/iio/gyro/Kconfig                    |  10 +
>  drivers/iio/gyro/Makefile                   |   2 +
>  drivers/iio/gyro/qcom_smgr_gyro.c           | 138 ++++
>  drivers/iio/magnetometer/Kconfig            |   9 +
>  drivers/iio/magnetometer/Makefile           |   2 +
>  drivers/iio/magnetometer/qcom_smgr_mag.c    | 138 ++++
>  drivers/iio/pressure/Kconfig                |  10 +
>  drivers/iio/pressure/Makefile               |   1 +
>  drivers/iio/pressure/qcom_smgr_pressure.c   | 106 +++
>  drivers/iio/proximity/Kconfig               |  10 +
>  drivers/iio/proximity/Makefile              |   1 +
>  drivers/iio/proximity/qcom_smgr_prox.c      | 106 +++
>  drivers/soc/qcom/qmi_interface.c            |   5 +-
>  include/linux/iio/common/qcom_smgr.h        |  64 ++
>  include/linux/mod_devicetable.h             |   9 +
>  include/linux/soc/qcom/qrtr.h               |  36 +
>  net/qrtr/af_qrtr.c                          |  23 +-
>  net/qrtr/qrtr.h                             |   3 +
>  net/qrtr/smd.c                              | 250 ++++++-
>  scripts/mod/devicetable-offsets.c           |   4 +
>  scripts/mod/file2alias.c                    |  10 +
>  33 files changed, 2573 insertions(+), 24 deletions(-)
>  create mode 100644 drivers/iio/accel/qcom_smgr_accel.c
>  create mode 100644 drivers/iio/common/qcom_smgr/Kconfig
>  create mode 100644 drivers/iio/common/qcom_smgr/Makefile
>  create mode 100644 drivers/iio/common/qcom_smgr/qcom_smgr.c
>  create mode 100644 drivers/iio/common/qcom_smgr/qmi/Makefile
>  create mode 100644 drivers/iio/common/qcom_smgr/qmi/sns_smgr.c
>  create mode 100644 drivers/iio/common/qcom_smgr/qmi/sns_smgr.h
>  create mode 100644 drivers/iio/gyro/qcom_smgr_gyro.c
>  create mode 100644 drivers/iio/magnetometer/qcom_smgr_mag.c
>  create mode 100644 drivers/iio/pressure/qcom_smgr_pressure.c
>  create mode 100644 drivers/iio/proximity/qcom_smgr_prox.c
>  create mode 100644 include/linux/iio/common/qcom_smgr.h
>  create mode 100644 include/linux/soc/qcom/qrtr.h


      parent reply	other threads:[~2025-04-08 10:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-06 14:07 Yassine Oudjana
2025-04-06 14:07 ` [PATCH 1/3] net: qrtr: Turn QRTR into a bus Yassine Oudjana
2025-04-06 16:01   ` Jonathan Cameron
2025-04-10 12:10     ` Yassine Oudjana
2025-04-12 10:58       ` Jonathan Cameron
2025-04-10 12:44     ` Yassine Oudjana
2025-04-12 10:59       ` Jonathan Cameron
2025-06-25 22:20     ` Yassine Oudjana
2025-04-06 14:07 ` [PATCH 2/3] net: qrtr: Define macro to convert QMI version and instance to QRTR instance Yassine Oudjana
2025-04-09 14:54   ` Konrad Dybcio
2025-07-05 18:29     ` Yassine Oudjana
2025-07-07 17:06       ` Simon Horman
2025-07-09  7:44         ` Yassine Oudjana
2025-07-09 11:52           ` Simon Horman
2025-04-06 14:08 ` [PATCH 3/3] iio: Add Qualcomm Sensor Manager drivers Yassine Oudjana
2025-04-06 16:29   ` Jonathan Cameron
2025-04-10 12:31     ` Yassine Oudjana
2025-04-12 11:21       ` Jonathan Cameron
2025-06-18 19:19   ` Luca Weiss
2025-06-25 17:09     ` Yassine Oudjana
2025-04-08 10:27 ` Luca Weiss [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=D916PQ9VLGEB.Q61B70OVQ9JZ@fairphone.com \
    --to=luca.weiss@fairphone.com \
    --cc=0xff07@gmail.com \
    --cc=alexander.sverdlin@gmail.com \
    --cc=andersson@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=antoniu.miclaus@analog.com \
    --cc=apokusinski01@gmail.com \
    --cc=barnabas.czeman@mainlining.org \
    --cc=bp@alien8.de \
    --cc=danila@jiaxyga.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=jic23@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=masahiroy@kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=mingo@kernel.org \
    --cc=nathan@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.schier@linux.dev \
    --cc=pabeni@redhat.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=pd.pstoykov@gmail.com \
    --cc=ramona.gradinariu@analog.com \
    --cc=sean@geanix.com \
    --cc=tony.luck@intel.com \
    --cc=vassilisamir@gmail.com \
    --cc=wangshuaijie@awinic.com \
    --cc=y.oudjana@protonmail.com \
    --cc=yasin.lee.x@gmail.com \
    --cc=yassine.oudjana@gmail.com \
    /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

all inboxes | Powered by JetHome®