All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jorijn van der Graaf" <jorijnvdgraaf@catcrafts.net>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 2/2] iio: magnetometer: add support for QST QMC6308
Date: Tue, 21 Jul 2026 14:04:03 +0000	[thread overview]
Message-ID: <20260721140404.1D94C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260721134843.7484-3-jorijnvdgraaf@catcrafts.net>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Potential hardware initialization race condition during soft reset deassertion.
--

--- Patch [2]: [PATCH v2 2/2] iio: magnetometer: add support for QST QMC6308 ---
commit 50ae109e19c53c095dd871b420a64fb846f258d5
Author: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>

iio: magnetometer: add support for QST QMC6308

This commit adds support for the QST QMC6308 3-axis anisotropic
magnetoresistive magnetometer on I2C. It implements raw readings, output
data rate, field range, filter oversampling ratio, mount matrix, and
runtime PM.

> diff --git a/drivers/iio/magnetometer/qmc6308.c b/drivers/iio/magnetometer/qmc6308.c
> new file mode 100644
> index 0000000000000..7d4df846bbc54
> --- /dev/null
> +++ b/drivers/iio/magnetometer/qmc6308.c
[ ... ]
> +static int qmc6308_init(struct qmc6308_data *data)
> +{
[ ... ]
> +	/* The SOFT_RST bit is not auto-cleared and must be written back 0 */
> +	ret = regmap_write(map, QMC6308_REG_CTRL2, QMC6308_SOFT_RST);
> +	if (ret)
> +		return ret;
> +
> +	/*
> +	 * The datasheet gives no soft-reset completion figure; reuse the
> +	 * power-on time as a conservative bound.
> +	 */
> +	fsleep(QMC6308_POR_US);
> +
> +	data->range = QMC6308_RNG_30G;
> +	data->odr = QMC6308_ODR_50HZ;
> +	data->osr = QMC6308_OSR1_8;
> +
> +	ret = regmap_write(map, QMC6308_REG_CTRL2,
> +			   FIELD_PREP(QMC6308_SET_RESET_MASK,
> +				      QMC6308_SET_RESET_ON) |
> +			   FIELD_PREP(QMC6308_RNG_MASK, data->range));
> +	if (ret)
> +		return ret;
> +
> +	/* OSR2 (second-stage filter) set to its power-on default of 0 */
> +	return regmap_write(map, QMC6308_REG_CTRL1,

[Severity: Medium]
If the soft reset logic is level-sensitive and holds the chip in reset while
the bit is 1, the initialization occurs only after the bit is cleared to 0 by
the second write to QMC6308_REG_CTRL2.

Can the hardware reliably accept this immediate subsequent write to
QMC6308_REG_CTRL1 without any delay, or does it need time to initialize after
the reset is deasserted?

> +			    FIELD_PREP(QMC6308_MODE_MASK,
> +				       QMC6308_MODE_NORMAL) |
> +			    FIELD_PREP(QMC6308_ODR_MASK, data->odr) |
> +			    FIELD_PREP(QMC6308_OSR1_MASK, data->osr) |
> +			    FIELD_PREP(QMC6308_OSR2_MASK, 0));
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721134843.7484-1-jorijnvdgraaf@catcrafts.net?part=2

  reply	other threads:[~2026-07-21 14:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 13:48 [PATCH v2 0/2] iio: magnetometer: add support for QST QMC6308 Jorijn van der Graaf
2026-07-21 13:48 ` [PATCH v2 1/2] dt-bindings: iio: magnetometer: add " Jorijn van der Graaf
2026-07-21 13:48 ` [PATCH v2 2/2] iio: magnetometer: add support for " Jorijn van der Graaf
2026-07-21 14:04   ` sashiko-bot [this message]
2026-07-21 20:19   ` Siratul Islam

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=20260721140404.1D94C1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jorijnvdgraaf@catcrafts.net \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.