Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Varshini Rajendran" <varshini.rajendran@microchip.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 08/18] iio: adc: at91-sama5d2_adc: adapt the driver for sama7d65
Date: Wed, 02 Dec 2026 07:16:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-245042@kernel.org> (raw)
In-Reply-To: <20261202070458.87970-9-varshini.rajendran@microchip.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] iio: adc: at91-sama5d2_adc: channel 0 misclassified as
  touchscreen on sama7d65
- [High] iio: adc: at91-sama5d2_adc: temp channel scan_index exceeds
  max_index
--

commit cbf4642d17b27b4bed86ec8eb7a607a2edb01be3
Author: Varshini Rajendran <varshini.rajendran@microchip.com>

iio: adc: at91-sama5d2_adc: adapt the driver for sama7d65

This commit adds platform configuration, temperature sensor calibration
layout, and a device tree match entry for the SAMA7D65 ADC.

> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index 604434fec2ba9..7403d62e8120b 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
[ ... ]
> @@ -766,6 +775,23 @@ static const struct at91_adc_platform sama7g5_platform = {
>  	.temp_calib_layout = &sama7g5_temp_calib,
>  };
>  
> +static const struct at91_adc_platform sama7d65_platform = {
> +	.layout = &sama7g5_layout,
> +	.adc_channels = &at91_sama7g5_adc_channels,

[Severity: High]
Does leaving touch_chan_x, touch_chan_y, and touch_chan_p zero-initialized in
sama7d65_platform cause single-ended voltage channel 0 (scan_index 0) to be
treated as a touchscreen channel?

In at91_adc_probe(), bitmap_set() unconditionally sets those indices in
st->touch_st.channels_bitmask, marking bit 0 as a touchscreen channel.
Enabling channel 0 together with any other channel then fails with -EINVAL in
at91_adc_update_scan_mode(), while enabling buffered capture on channel 0
alone causes at91_adc_current_chan_is_touch() to return true and call
at91_adc_configure_touch(), writing touchscreen settings to layout->TSMR
(offset 0x00 in sama7g5_layout, which aliases the CR control register).

> +	.nr_channels = AT91_SAMA7G5_SINGLE_CHAN_CNT +
> +		       AT91_SAMA7G5_DIFF_CHAN_CNT +
> +		       AT91_SAMA7G5_TEMP_CHAN_CNT,
> +	.max_channels = ARRAY_SIZE(at91_sama7g5_adc_channels),
> +	.max_index = AT91_SAMA7G5_MAX_CHAN_IDX,

[Severity: High]
Does setting max_index to AT91_SAMA7G5_MAX_CHAN_IDX (25) leave out the
temperature channel in at91_sama7g5_adc_channels, which has scan_index 31
(AT91_SAMA7G5_ADC_TEMP_CHANNEL)?

at91_adc_update_scan_mode() and at91_adc_current_chan_is_touch() pass
max_index + 1 (26) to bitmap_subset().  When userspace enables buffered
capture with in_temp_en and in_timestamp_en, only bit 31 is set in
active_scan_mask, so the lower 26 bits are all zero and bitmap_subset()
treats the active scan mask as a subset of st->touch_st.channels_bitmask.
at91_adc_buffer_prepare() and at91_adc_buffer_postdisable() then take the
touchscreen path and call at91_adc_configure_touch(), writing to offset 0x00
(CR).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202070458.87970-1-varshini.rajendran@microchip.com?part=8

  reply	other threads:[~2026-12-02  7:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  7:04 [PATCH v7 00/18] Add thermal management support for sama7d65 Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 01/18] dt-bindings: iio: adc: at91-sama5d2: document sama7d65 Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 02/18] dt-bindings: iio: adc: at91-sama5d2: document nvmem-cells Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 03/18] nvmem: add DEFINE_FREE for nvmem_cell_put cleanup Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 04/18] iio: adc: at91-sama5d2_adc: use cleanup.h for NVMEM buffer Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 05/18] iio: adc: at91-sama5d2_adc: rework temp calibration layout handling Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 06/18] iio: adc: at91-sama5d2_adc: add condition to validate calibration data Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 07/18] iio: adc: at91-sama5d2_adc: remove unnecessary casts in of_device_id Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 08/18] iio: adc: at91-sama5d2_adc: adapt the driver for sama7d65 Varshini Rajendran
2026-12-02  7:16   ` sashiko-bot [this message]
2026-12-02  7:04 ` [PATCH v7 09/18] dt-bindings: nvmem: microchip,sama7g5-otpc: add sama7d65 and dt node example Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 10/18] nvmem: microchip-otpc: add tag-based packet lookup Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 11/18] nvmem: microchip-otpc: add emulation mode and OTP access validation Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 12/18] ARM: dts: microchip: sama7d65: add cpu opps Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 13/18] ARM: dts: microchip: sama7d65: Add ADC node Varshini Rajendran
2026-12-02  7:16   ` sashiko-bot
2026-12-02  7:04 ` [PATCH v7 14/18] ARM: dts: microchip: sama7d65_curiosity: Enable ADC, DVFS Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 15/18] ARM: dts: microchip: sama7d65: add otpc node Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 16/18] ARM: dts: microchip: sama7d65: add cells for temperature calibration Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 17/18] ARM: dts: microchip: sama7d65: add temperature sensor Varshini Rajendran
2026-12-02  7:04 ` [PATCH v7 18/18] ARM: dts: microchip: sama7d65: add thermal zones node Varshini Rajendran

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=sashiko-outbox-245042@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=varshini.rajendran@microchip.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