netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Weiss <luca@lucaweiss.eu>
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 3/3] iio: Add Qualcomm Sensor Manager drivers
Date: Wed, 18 Jun 2025 21:19:42 +0200	[thread overview]
Message-ID: <ea183f5a-b4c8-4dc0-960f-dba0db5a5abb@lucaweiss.eu> (raw)
In-Reply-To: <20250406140706.812425-4-y.oudjana@protonmail.com>

Hi Yassine!

On 06-04-2025 4:08 p.m., Yassine Oudjana wrote:
> Add drivers for sensors exposed by the Qualcomm Sensor Manager service,
> which is provided by SLPI or ADSP on Qualcomm SoCs. Supported sensors
> include accelerometers, gyroscopes, pressure sensors, proximity sensors
> and magnetometers.
> 
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>

<snip>

> +static const char *const qcom_smgr_sensor_type_platform_names[] = {
> +	[SNS_SMGR_SENSOR_TYPE_ACCEL] = "qcom-smgr-accel",
> +	[SNS_SMGR_SENSOR_TYPE_GYRO] = "qcom-smgr-gyro",
> +	[SNS_SMGR_SENSOR_TYPE_MAG] = "qcom-smgr-mag",
> +	[SNS_SMGR_SENSOR_TYPE_PROX_LIGHT] = "qcom-smgr-prox-light",
> +	[SNS_SMGR_SENSOR_TYPE_PRESSURE] = "qcom-smgr-pressure",
> +	[SNS_SMGR_SENSOR_TYPE_HALL_EFFECT] = "qcom-smgr-hall-effect"
> +};
> +
> +static void qcom_smgr_unregister_sensor(void *data)
> +{
> +	struct platform_device *pdev = data;
> +
> +	platform_device_unregister(pdev);
> +}
> +
> +static int qcom_smgr_register_sensor(struct qcom_smgr *smgr,
> +				     struct qcom_smgr_sensor *sensor)
> +{
> +	struct platform_device *pdev;
> +	const char *name = qcom_smgr_sensor_type_platform_names[sensor->type];

On msm8226 lg-lenok I get NULL here leading to a crash with the next call.

I get sensor->type=0 for some heart rate sensor on that watch. I've 
added this patch on top to fix that (excuse the formatting):

<snip>

> diff --git a/drivers/iio/common/qcom_smgr/qmi/sns_smgr.h b/drivers/iio/common/qcom_smgr/qmi/sns_smgr.h
> new file mode 100644
> index 000000000000..a741dfd87452
> --- /dev/null
> +++ b/drivers/iio/common/qcom_smgr/qmi/sns_smgr.h
> @@ -0,0 +1,163 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +
> +#ifndef __SSC_SNS_SMGR_H__
> +#define __SSC_SNS_SMGR_H__
> +
> +#include <linux/iio/common/qcom_smgr.h>
> +#include <linux/soc/qcom/qmi.h>
> +#include <linux/types.h>
> +
> +/*
> + * The structures of QMI messages used by the service were determined
> + * purely by watching transactions between proprietary Android userspace
> + * components and SSC. along with comparing values reported by Android APIs
> + * to values received in response messages. Due to that, the purpose or
> + * meaning of many fields remains unknown. Such fields are named "val*",
> + * "data*" or similar. Furthermore, the true maximum sizes of some messages
> + * with unknown array fields may be different than defined here.
> + */
> +
> +#define SNS_SMGR_QMI_SVC_ID			0x0100
> +#define SNS_SMGR_QMI_SVC_V1			1
> +#define SNS_SMGR_QMI_INS_ID			50
This instance ID needs to be 0 on msm8974 and msm8226, so I assume we 
don't want to make this a define but just add the 50 and the 0 as-is to 
the match table?

Regards
Luca

  parent reply	other threads:[~2025-06-18 19:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-06 14:07 [PATCH 0/3] QRTR bus and Qualcomm Sensor Manager IIO drivers 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 [this message]
2025-06-25 17:09     ` Yassine Oudjana
2025-04-08 10:27 ` [PATCH 0/3] QRTR bus and Qualcomm Sensor Manager IIO drivers Luca Weiss

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=ea183f5a-b4c8-4dc0-960f-dba0db5a5abb@lucaweiss.eu \
    --to=luca@lucaweiss.eu \
    --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;
as well as URLs for NNTP newsgroup(s).