linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: <lee@kernel.org>, <robh@kernel.org>, <krzk+dt@kernel.org>,
	<conor+dt@kernel.org>, <alexandre.torgue@foss.st.com>,
	<wbg@kernel.org>, <ukleinek@kernel.org>,
	<catalin.marinas@arm.com>, <will@kernel.org>,
	<devicetree@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>,
	<linux-pwm@vger.kernel.org>, <olivier.moysan@foss.st.com>
Subject: Re: [PATCH 3/9] iio: trigger: stm32-timer: add support for stm32mp25
Date: Thu, 19 Dec 2024 15:10:56 +0000	[thread overview]
Message-ID: <20241219151056.26e21aed@jic23-huawei> (raw)
In-Reply-To: <20241218090153.742869-4-fabrice.gasnier@foss.st.com>

On Wed, 18 Dec 2024 10:01:47 +0100
Fabrice Gasnier <fabrice.gasnier@foss.st.com> wrote:

> Add support for STM32MP25 SoC. Use newly introduced compatible to handle
> this new HW variant. Add TIM20 trigger definitions that can be used by
> the stm32 analog-to-digital converter. Use compatible data to identify
> it.
> As the counter framework is now superseding the deprecated IIO counter
> interface (IIO_COUNT), don't support it. Only register IIO trigger
> devices for ADC usage. So, make the valids_table a cfg option.
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Looks good to me.  Looks like I can just pick this up for IIO?

Or is thOre a dependency I'm missing?

Just in case it goes another route.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Jonathan
> ---
>  drivers/iio/trigger/stm32-timer-trigger.c     | 21 +++++++++++++++++--
>  include/linux/iio/timer/stm32-timer-trigger.h |  6 ++++++
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
> index bb60b2d7b2ec..8aaf3abf044e 100644
> --- a/drivers/iio/trigger/stm32-timer-trigger.c
> +++ b/drivers/iio/trigger/stm32-timer-trigger.c
> @@ -38,6 +38,9 @@ static const void *triggers_table[][MAX_TRIGGERS] = {
>  	{ TIM15_TRGO,},
>  	{ TIM16_OC1,},
>  	{ TIM17_OC1,},
> +	{ }, /* timer 18 */
> +	{ }, /* timer 19 */
> +	{ TIM20_TRGO, TIM20_TRGO2, TIM20_OC1, TIM20_OC2, TIM20_OC3, },
>  };
>  
>  /* List the triggers accepted by each timer */
> @@ -781,7 +784,7 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  
>  	/* Create an IIO device only if we have triggers to be validated */
> -	if (*cfg->valids_table[index])
> +	if (cfg->valids_table && *cfg->valids_table[index])
>  		priv = stm32_setup_counter_device(dev);
>  	else
>  		priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> @@ -794,7 +797,8 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev)
>  	priv->clk = ddata->clk;
>  	priv->max_arr = ddata->max_arr;
>  	priv->triggers = triggers_table[index];
> -	priv->valids = cfg->valids_table[index];
> +	if (cfg->valids_table && *cfg->valids_table[index])
> +		priv->valids = cfg->valids_table[index];
>  	stm32_timer_detect_trgo2(priv);
>  	mutex_init(&priv->lock);
>  
> @@ -886,6 +890,16 @@ static const struct stm32_timer_trigger_cfg stm32h7_timer_trg_cfg = {
>  	.num_valids_table = ARRAY_SIZE(stm32h7_valids_table),
>  };
>  
> +static const struct stm32_timer_trigger_cfg stm32mp25_timer_trg_cfg = {
> +	/*
> +	 * valids_table not used: counter framework is now superseding the deprecated IIO
> +	 * counter interface (IIO_COUNT), so don't support it. num_valids_table is only
> +	 * kept here to register the IIO HW triggers. valids_table should be moved at some
> +	 * point to the stm32-timer-cnt driver instead.
> +	 */
> +	.num_valids_table = ARRAY_SIZE(triggers_table),
> +};
> +
>  static const struct of_device_id stm32_trig_of_match[] = {
>  	{
>  		.compatible = "st,stm32-timer-trigger",
> @@ -893,6 +907,9 @@ static const struct of_device_id stm32_trig_of_match[] = {
>  	}, {
>  		.compatible = "st,stm32h7-timer-trigger",
>  		.data = (void *)&stm32h7_timer_trg_cfg,
> +	}, {
> +		.compatible = "st,stm32mp25-timer-trigger",
> +		.data = (void *)&stm32mp25_timer_trg_cfg,
>  	},
>  	{ /* end node */ },
>  };
> diff --git a/include/linux/iio/timer/stm32-timer-trigger.h b/include/linux/iio/timer/stm32-timer-trigger.h
> index 37572e4dc73a..1ee237b56183 100644
> --- a/include/linux/iio/timer/stm32-timer-trigger.h
> +++ b/include/linux/iio/timer/stm32-timer-trigger.h
> @@ -72,6 +72,12 @@
>  
>  #define TIM17_OC1	"tim17_oc1"
>  
> +#define TIM20_OC1	"tim20_oc1"
> +#define TIM20_OC2	"tim20_oc2"
> +#define TIM20_OC3	"tim20_oc3"
> +#define TIM20_TRGO	"tim20_trgo"
> +#define TIM20_TRGO2	"tim20_trgo2"
> +
>  #if IS_REACHABLE(CONFIG_IIO_STM32_TIMER_TRIGGER)
>  bool is_stm32_timer_trigger(struct iio_trigger *trig);
>  #else


  reply	other threads:[~2024-12-19 15:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  9:01 [PATCH 0/9] Add STM32MP25 timers support: MFD, PWM, IIO and counter drivers Fabrice Gasnier
2024-12-18  9:01 ` [PATCH 1/9] dt-bindings: mfd: stm32-timers: add support for stm32mp25 Fabrice Gasnier
2024-12-18 17:05   ` Conor Dooley
2024-12-18  9:01 ` [PATCH 2/9] " Fabrice Gasnier
2025-01-09 10:49   ` Lee Jones
2025-01-09 16:29     ` Fabrice Gasnier
2024-12-18  9:01 ` [PATCH 3/9] iio: trigger: stm32-timer: " Fabrice Gasnier
2024-12-19 15:10   ` Jonathan Cameron [this message]
2024-12-18  9:01 ` [PATCH 4/9] counter: stm32-timer-cnt: " Fabrice Gasnier
2024-12-19  4:35   ` William Breathitt Gray
2024-12-18  9:01 ` [PATCH 5/9] pwm: stm32: " Fabrice Gasnier
2024-12-18 10:05   ` Uwe Kleine-König
2024-12-18  9:01 ` [PATCH 6/9] arm64: defconfig: enable STM32 timers drivers Fabrice Gasnier
2024-12-18  9:01 ` [PATCH 7/9] arm64: dts: st: add timer nodes on stm32mp251 Fabrice Gasnier
2024-12-18  9:01 ` [PATCH 8/9] arm64: dts: st: add timer pins for stm32mp257f-ev1 Fabrice Gasnier
2024-12-18  9:01 ` [PATCH 9/9] arm64: dts: st: add timer nodes on stm32mp257f-ev1 Fabrice Gasnier

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=20241219151056.26e21aed@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=olivier.moysan@foss.st.com \
    --cc=robh@kernel.org \
    --cc=ukleinek@kernel.org \
    --cc=wbg@kernel.org \
    --cc=will@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).