From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
alexandre.torgue-qxv4g6HH51o@public.gmane.org,
lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org,
knaack.h-Mmb7MZpHnFY@public.gmane.org,
pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
benjamin.gaignard-qxv4g6HH51o@public.gmane.org
Subject: Re: [PATCH 3/3] iio: trigger: stm32-timer: add output compare triggers
Date: Thu, 10 Aug 2017 00:30:11 +0100 [thread overview]
Message-ID: <20170810003011.11fdb081@archlinux> (raw)
In-Reply-To: <1501751654-14153-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
On Thu, 3 Aug 2017 11:14:14 +0200
Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> wrote:
> Add output compare trigger sources available on some instances.
>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
Applied to the togreg branch of iio.git and pushed out as testing.
Thanks,
Jonathan
> ---
> drivers/iio/trigger/stm32-timer-trigger.c | 31 +++++++++++++++++----------
> include/linux/iio/timer/stm32-timer-trigger.h | 12 +++++++++++
> 2 files changed, 32 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
> index 33890f9..a9bc5b6 100644
> --- a/drivers/iio/trigger/stm32-timer-trigger.c
> +++ b/drivers/iio/trigger/stm32-timer-trigger.c
> @@ -29,12 +29,14 @@
> { TIM7_TRGO,},
> { TIM8_TRGO, TIM8_TRGO2, TIM8_CH1, TIM8_CH2, TIM8_CH3, TIM8_CH4,},
> { TIM9_TRGO, TIM9_CH1, TIM9_CH2,},
> - { }, /* timer 10 */
> - { }, /* timer 11 */
> + { TIM10_OC1,},
> + { TIM11_OC1,},
> { TIM12_TRGO, TIM12_CH1, TIM12_CH2,},
> - { }, /* timer 13 */
> - { }, /* timer 14 */
> + { TIM13_OC1,},
> + { TIM14_OC1,},
> { TIM15_TRGO,},
> + { TIM16_OC1,},
> + { TIM17_OC1,},
> };
>
> /* List the triggers accepted by each timer */
> @@ -47,10 +49,10 @@
> { }, /* timer 6 */
> { }, /* timer 7 */
> { TIM1_TRGO, TIM2_TRGO, TIM4_TRGO, TIM5_TRGO,},
> - { TIM2_TRGO, TIM3_TRGO,},
> + { TIM2_TRGO, TIM3_TRGO, TIM10_OC1, TIM11_OC1,},
> { }, /* timer 10 */
> { }, /* timer 11 */
> - { TIM4_TRGO, TIM5_TRGO,},
> + { TIM4_TRGO, TIM5_TRGO, TIM13_OC1, TIM14_OC1,},
> };
>
> static const void *stm32h7_valids_table[][MAX_VALIDS] = {
> @@ -65,10 +67,12 @@
> { }, /* timer 9 */
> { }, /* timer 10 */
> { }, /* timer 11 */
> - { TIM4_TRGO, TIM5_TRGO,},
> + { TIM4_TRGO, TIM5_TRGO, TIM13_OC1, TIM14_OC1,},
> { }, /* timer 13 */
> { }, /* timer 14 */
> - { TIM1_TRGO, TIM3_TRGO,},
> + { TIM1_TRGO, TIM3_TRGO, TIM16_OC1, TIM17_OC1,},
> + { }, /* timer 16 */
> + { }, /* timer 17 */
> };
>
> struct stm32_timer_trigger {
> @@ -91,6 +95,11 @@ static bool stm32_timer_is_trgo2_name(const char *name)
> return !!strstr(name, "trgo2");
> }
>
> +static bool stm32_timer_is_trgo_name(const char *name)
> +{
> + return (!!strstr(name, "trgo") && !strstr(name, "trgo2"));
> +}
> +
> static int stm32_timer_start(struct stm32_timer_trigger *priv,
> struct iio_trigger *trig,
> unsigned int frequency)
> @@ -355,6 +364,7 @@ static int stm32_setup_iio_triggers(struct stm32_timer_trigger *priv)
>
> while (cur && *cur) {
> struct iio_trigger *trig;
> + bool cur_is_trgo = stm32_timer_is_trgo_name(*cur);
> bool cur_is_trgo2 = stm32_timer_is_trgo2_name(*cur);
>
> if (cur_is_trgo2 && !priv->has_trgo2) {
> @@ -371,10 +381,9 @@ static int stm32_setup_iio_triggers(struct stm32_timer_trigger *priv)
>
> /*
> * sampling frequency and master mode attributes
> - * should only be available on trgo trigger which
> - * is always the first in the list.
> + * should only be available on trgo/trgo2 triggers
> */
> - if (cur == priv->triggers || cur_is_trgo2)
> + if (cur_is_trgo || cur_is_trgo2)
> trig->dev.groups = stm32_trigger_attr_groups;
>
> iio_trigger_set_drvdata(trig, priv);
> diff --git a/include/linux/iio/timer/stm32-timer-trigger.h b/include/linux/iio/timer/stm32-timer-trigger.h
> index 20f4653..d68add8 100644
> --- a/include/linux/iio/timer/stm32-timer-trigger.h
> +++ b/include/linux/iio/timer/stm32-timer-trigger.h
> @@ -55,12 +55,24 @@
> #define TIM9_CH1 "tim9_ch1"
> #define TIM9_CH2 "tim9_ch2"
>
> +#define TIM10_OC1 "tim10_oc1"
> +
> +#define TIM11_OC1 "tim11_oc1"
> +
> #define TIM12_TRGO "tim12_trgo"
> #define TIM12_CH1 "tim12_ch1"
> #define TIM12_CH2 "tim12_ch2"
>
> +#define TIM13_OC1 "tim13_oc1"
> +
> +#define TIM14_OC1 "tim14_oc1"
> +
> #define TIM15_TRGO "tim15_trgo"
>
> +#define TIM16_OC1 "tim16_oc1"
> +
> +#define TIM17_OC1 "tim17_oc1"
> +
> bool is_stm32_timer_trigger(struct iio_trigger *trig);
>
> #endif
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2017-08-09 23:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 9:14 [PATCH 0/3] iio: trigger: stm32-timer: add STM32H7 variant Fabrice Gasnier
[not found] ` <1501751654-14153-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
2017-08-03 9:14 ` [PATCH 1/3] dt-bindings: iio: timer: stm32: add support for STM32H7 Fabrice Gasnier
[not found] ` <1501751654-14153-2-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
2017-08-09 23:29 ` Jonathan Cameron
2017-08-10 17:12 ` Rob Herring
2017-08-12 12:05 ` Jonathan Cameron
2017-08-03 9:14 ` [PATCH 2/3] iio: trigger: stm32-timer: " Fabrice Gasnier
2017-08-09 23:29 ` Jonathan Cameron
2017-08-03 9:14 ` [PATCH 3/3] iio: trigger: stm32-timer: add output compare triggers Fabrice Gasnier
[not found] ` <1501751654-14153-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
2017-08-09 23:30 ` Jonathan Cameron [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=20170810003011.11fdb081@archlinux \
--to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=alexandre.torgue-qxv4g6HH51o@public.gmane.org \
--cc=benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=benjamin.gaignard-qxv4g6HH51o@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=fabrice.gasnier-qxv4g6HH51o@public.gmane.org \
--cc=knaack.h-Mmb7MZpHnFY@public.gmane.org \
--cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
--cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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).