* [PATCH 0/3] iio: trigger: stm32-timer: add STM32H7 variant @ 2017-08-03 9:14 Fabrice Gasnier [not found] ` <1501751654-14153-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Fabrice Gasnier @ 2017-08-03 9:14 UTC (permalink / raw) To: jic23-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A Cc: linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, fabrice.gasnier-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o STM32H7 variant has additional timer instances, and slightly different valid triggers. This patchset introduces a new compatible for STM32H7 timers, to handle this new variant, with appropriate configuration data. Fabrice Gasnier (3): dt-bindings: iio: timer: stm32: add support for STM32H7 iio: trigger: stm32-timer: add support for STM32H7 iio: trigger: stm32-timer: add output compare triggers .../bindings/iio/timer/stm32-timer-trigger.txt | 4 +- drivers/iio/trigger/stm32-timer-trigger.c | 78 +++++++++++++++++++--- include/linux/iio/timer/stm32-timer-trigger.h | 14 ++++ 3 files changed, 84 insertions(+), 12 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <1501751654-14153-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>]
* [PATCH 1/3] dt-bindings: iio: timer: stm32: add support for STM32H7 [not found] ` <1501751654-14153-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-08-03 9:14 ` Fabrice Gasnier [not found] ` <1501751654-14153-2-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Fabrice Gasnier @ 2017-08-03 9:14 UTC (permalink / raw) To: jic23-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A Cc: linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, fabrice.gasnier-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o STM32H7 has slightly different triggers than previous versions. Introduce st,stm32h7-timer-trigger compatible to handle this new variant. Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> --- Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt b/Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt index 55a653d..b565ced 100644 --- a/Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt +++ b/Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt @@ -4,7 +4,9 @@ Must be a sub-node of an STM32 Timers device tree node. See ../mfd/stm32-timers.txt for details about the parent node. Required parameters: -- compatible: Must be "st,stm32-timer-trigger". +- compatible: Must be one of: + "st,stm32-timer-trigger" + "st,stm32h7-timer-trigger" - reg: Identify trigger hardware block. Example: -- 1.9.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
[parent not found: <1501751654-14153-2-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 1/3] dt-bindings: iio: timer: stm32: add support for STM32H7 [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 1 sibling, 0 replies; 9+ messages in thread From: Jonathan Cameron @ 2017-08-09 23:29 UTC (permalink / raw) To: Fabrice Gasnier Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o On Thu, 3 Aug 2017 11:14:12 +0200 Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> wrote: > STM32H7 has slightly different triggers than previous versions. > Introduce st,stm32h7-timer-trigger compatible to handle this new variant. > > 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 > --- > Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt b/Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt > index 55a653d..b565ced 100644 > --- a/Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt > +++ b/Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt > @@ -4,7 +4,9 @@ Must be a sub-node of an STM32 Timers device tree node. > See ../mfd/stm32-timers.txt for details about the parent node. > > Required parameters: > -- compatible: Must be "st,stm32-timer-trigger". > +- compatible: Must be one of: > + "st,stm32-timer-trigger" > + "st,stm32h7-timer-trigger" > - reg: Identify trigger hardware block. > > Example: ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dt-bindings: iio: timer: stm32: add support for STM32H7 [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 1 sibling, 1 reply; 9+ messages in thread From: Rob Herring @ 2017-08-10 17:12 UTC (permalink / raw) To: Fabrice Gasnier Cc: jic23-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o On Thu, Aug 03, 2017 at 11:14:12AM +0200, Fabrice Gasnier wrote: > STM32H7 has slightly different triggers than previous versions. > Introduce st,stm32h7-timer-trigger compatible to handle this new variant. > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> > --- > Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dt-bindings: iio: timer: stm32: add support for STM32H7 2017-08-10 17:12 ` Rob Herring @ 2017-08-12 12:05 ` Jonathan Cameron 0 siblings, 0 replies; 9+ messages in thread From: Jonathan Cameron @ 2017-08-12 12:05 UTC (permalink / raw) To: Rob Herring Cc: Fabrice Gasnier, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o On Thu, 10 Aug 2017 12:12:17 -0500 Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: > On Thu, Aug 03, 2017 at 11:14:12AM +0200, Fabrice Gasnier wrote: > > STM32H7 has slightly different triggers than previous versions. > > Introduce st,stm32h7-timer-trigger compatible to handle this new variant. > > > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> > > --- > > Documentation/devicetree/bindings/iio/timer/stm32-timer-trigger.txt | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Thanks, ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] iio: trigger: stm32-timer: add support for STM32H7 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 ` 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 2 siblings, 1 reply; 9+ messages in thread From: Fabrice Gasnier @ 2017-08-03 9:14 UTC (permalink / raw) To: jic23, robh+dt Cc: mark.rutland, devicetree, benjamin.gaignard, lars, alexandre.torgue, linux-iio, pmeerw, linux, linux-kernel, mcoquelin.stm32, knaack.h, fabrice.gasnier, linux-arm-kernel, benjamin.gaignard Add support for STM32H7 timer triggers: - Add new valids_table - Introduce compatible, with configuration data - Extend up to 15 timers, available on STM32H7 Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> --- drivers/iio/trigger/stm32-timer-trigger.c | 55 +++++++++++++++++++++++++-- include/linux/iio/timer/stm32-timer-trigger.h | 2 + 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c index d22bc56..33890f9 100644 --- a/drivers/iio/trigger/stm32-timer-trigger.c +++ b/drivers/iio/trigger/stm32-timer-trigger.c @@ -13,6 +13,7 @@ #include <linux/mfd/stm32-timers.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/of_device.h> #define MAX_TRIGGERS 7 #define MAX_VALIDS 5 @@ -31,6 +32,9 @@ { }, /* timer 10 */ { }, /* timer 11 */ { TIM12_TRGO, TIM12_CH1, TIM12_CH2,}, + { }, /* timer 13 */ + { }, /* timer 14 */ + { TIM15_TRGO,}, }; /* List the triggers accepted by each timer */ @@ -49,6 +53,24 @@ { TIM4_TRGO, TIM5_TRGO,}, }; +static const void *stm32h7_valids_table[][MAX_VALIDS] = { + { TIM15_TRGO, TIM2_TRGO, TIM3_TRGO, TIM4_TRGO,}, + { TIM1_TRGO, TIM8_TRGO, TIM3_TRGO, TIM4_TRGO,}, + { TIM1_TRGO, TIM2_TRGO, TIM15_TRGO, TIM4_TRGO,}, + { TIM1_TRGO, TIM2_TRGO, TIM3_TRGO, TIM8_TRGO,}, + { TIM1_TRGO, TIM8_TRGO, TIM3_TRGO, TIM4_TRGO,}, + { }, /* timer 6 */ + { }, /* timer 7 */ + { TIM1_TRGO, TIM2_TRGO, TIM4_TRGO, TIM5_TRGO,}, + { }, /* timer 9 */ + { }, /* timer 10 */ + { }, /* timer 11 */ + { TIM4_TRGO, TIM5_TRGO,}, + { }, /* timer 13 */ + { }, /* timer 14 */ + { TIM1_TRGO, TIM3_TRGO,}, +}; + struct stm32_timer_trigger { struct device *dev; struct regmap *regmap; @@ -59,6 +81,11 @@ struct stm32_timer_trigger { bool has_trgo2; }; +struct stm32_timer_trigger_cfg { + const void *(*valids_table)[MAX_VALIDS]; + const unsigned int num_valids_table; +}; + static bool stm32_timer_is_trgo2_name(const char *name) { return !!strstr(name, "trgo2"); @@ -734,18 +761,22 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct stm32_timer_trigger *priv; struct stm32_timers *ddata = dev_get_drvdata(pdev->dev.parent); + const struct stm32_timer_trigger_cfg *cfg; unsigned int index; int ret; if (of_property_read_u32(dev->of_node, "reg", &index)) return -EINVAL; + cfg = (const struct stm32_timer_trigger_cfg *) + of_match_device(dev->driver->of_match_table, dev)->data; + if (index >= ARRAY_SIZE(triggers_table) || - index >= ARRAY_SIZE(valids_table)) + index >= cfg->num_valids_table) return -EINVAL; /* Create an IIO device only if we have triggers to be validated */ - if (*valids_table[index]) + if (*cfg->valids_table[index]) priv = stm32_setup_counter_device(dev); else priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -758,7 +789,7 @@ 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 = valids_table[index]; + priv->valids = cfg->valids_table[index]; stm32_timer_detect_trgo2(priv); ret = stm32_setup_iio_triggers(priv); @@ -770,8 +801,24 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev) return 0; } +static const struct stm32_timer_trigger_cfg stm32_timer_trg_cfg = { + .valids_table = valids_table, + .num_valids_table = ARRAY_SIZE(valids_table), +}; + +static const struct stm32_timer_trigger_cfg stm32h7_timer_trg_cfg = { + .valids_table = stm32h7_valids_table, + .num_valids_table = ARRAY_SIZE(stm32h7_valids_table), +}; + static const struct of_device_id stm32_trig_of_match[] = { - { .compatible = "st,stm32-timer-trigger", }, + { + .compatible = "st,stm32-timer-trigger", + .data = (void *)&stm32_timer_trg_cfg, + }, { + .compatible = "st,stm32h7-timer-trigger", + .data = (void *)&stm32h7_timer_trg_cfg, + }, { /* end node */ }, }; MODULE_DEVICE_TABLE(of, stm32_trig_of_match); diff --git a/include/linux/iio/timer/stm32-timer-trigger.h b/include/linux/iio/timer/stm32-timer-trigger.h index fa7d786..20f4653 100644 --- a/include/linux/iio/timer/stm32-timer-trigger.h +++ b/include/linux/iio/timer/stm32-timer-trigger.h @@ -59,6 +59,8 @@ #define TIM12_CH1 "tim12_ch1" #define TIM12_CH2 "tim12_ch2" +#define TIM15_TRGO "tim15_trgo" + bool is_stm32_timer_trigger(struct iio_trigger *trig); #endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] iio: trigger: stm32-timer: add support for STM32H7 2017-08-03 9:14 ` [PATCH 2/3] iio: trigger: stm32-timer: " Fabrice Gasnier @ 2017-08-09 23:29 ` Jonathan Cameron 0 siblings, 0 replies; 9+ messages in thread From: Jonathan Cameron @ 2017-08-09 23:29 UTC (permalink / raw) To: Fabrice Gasnier Cc: robh+dt, linux, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars, knaack.h, pmeerw, linux-iio, devicetree, linux-arm-kernel, linux-kernel, benjamin.gaignard, benjamin.gaignard On Thu, 3 Aug 2017 11:14:13 +0200 Fabrice Gasnier <fabrice.gasnier@st.com> wrote: > Add support for STM32H7 timer triggers: > - Add new valids_table > - Introduce compatible, with configuration data > - Extend up to 15 timers, available on STM32H7 > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Applied to the togreg branch of iio.git and pushed out as testing. Thanks, Jonathan > --- > drivers/iio/trigger/stm32-timer-trigger.c | 55 +++++++++++++++++++++++++-- > include/linux/iio/timer/stm32-timer-trigger.h | 2 + > 2 files changed, 53 insertions(+), 4 deletions(-) > > diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c > index d22bc56..33890f9 100644 > --- a/drivers/iio/trigger/stm32-timer-trigger.c > +++ b/drivers/iio/trigger/stm32-timer-trigger.c > @@ -13,6 +13,7 @@ > #include <linux/mfd/stm32-timers.h> > #include <linux/module.h> > #include <linux/platform_device.h> > +#include <linux/of_device.h> > > #define MAX_TRIGGERS 7 > #define MAX_VALIDS 5 > @@ -31,6 +32,9 @@ > { }, /* timer 10 */ > { }, /* timer 11 */ > { TIM12_TRGO, TIM12_CH1, TIM12_CH2,}, > + { }, /* timer 13 */ > + { }, /* timer 14 */ > + { TIM15_TRGO,}, > }; > > /* List the triggers accepted by each timer */ > @@ -49,6 +53,24 @@ > { TIM4_TRGO, TIM5_TRGO,}, > }; > > +static const void *stm32h7_valids_table[][MAX_VALIDS] = { > + { TIM15_TRGO, TIM2_TRGO, TIM3_TRGO, TIM4_TRGO,}, > + { TIM1_TRGO, TIM8_TRGO, TIM3_TRGO, TIM4_TRGO,}, > + { TIM1_TRGO, TIM2_TRGO, TIM15_TRGO, TIM4_TRGO,}, > + { TIM1_TRGO, TIM2_TRGO, TIM3_TRGO, TIM8_TRGO,}, > + { TIM1_TRGO, TIM8_TRGO, TIM3_TRGO, TIM4_TRGO,}, > + { }, /* timer 6 */ > + { }, /* timer 7 */ > + { TIM1_TRGO, TIM2_TRGO, TIM4_TRGO, TIM5_TRGO,}, > + { }, /* timer 9 */ > + { }, /* timer 10 */ > + { }, /* timer 11 */ > + { TIM4_TRGO, TIM5_TRGO,}, > + { }, /* timer 13 */ > + { }, /* timer 14 */ > + { TIM1_TRGO, TIM3_TRGO,}, > +}; > + > struct stm32_timer_trigger { > struct device *dev; > struct regmap *regmap; > @@ -59,6 +81,11 @@ struct stm32_timer_trigger { > bool has_trgo2; > }; > > +struct stm32_timer_trigger_cfg { > + const void *(*valids_table)[MAX_VALIDS]; > + const unsigned int num_valids_table; > +}; > + > static bool stm32_timer_is_trgo2_name(const char *name) > { > return !!strstr(name, "trgo2"); > @@ -734,18 +761,22 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > struct stm32_timer_trigger *priv; > struct stm32_timers *ddata = dev_get_drvdata(pdev->dev.parent); > + const struct stm32_timer_trigger_cfg *cfg; > unsigned int index; > int ret; > > if (of_property_read_u32(dev->of_node, "reg", &index)) > return -EINVAL; > > + cfg = (const struct stm32_timer_trigger_cfg *) > + of_match_device(dev->driver->of_match_table, dev)->data; > + > if (index >= ARRAY_SIZE(triggers_table) || > - index >= ARRAY_SIZE(valids_table)) > + index >= cfg->num_valids_table) > return -EINVAL; > > /* Create an IIO device only if we have triggers to be validated */ > - if (*valids_table[index]) > + if (*cfg->valids_table[index]) > priv = stm32_setup_counter_device(dev); > else > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > @@ -758,7 +789,7 @@ 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 = valids_table[index]; > + priv->valids = cfg->valids_table[index]; > stm32_timer_detect_trgo2(priv); > > ret = stm32_setup_iio_triggers(priv); > @@ -770,8 +801,24 @@ static int stm32_timer_trigger_probe(struct platform_device *pdev) > return 0; > } > > +static const struct stm32_timer_trigger_cfg stm32_timer_trg_cfg = { > + .valids_table = valids_table, > + .num_valids_table = ARRAY_SIZE(valids_table), > +}; > + > +static const struct stm32_timer_trigger_cfg stm32h7_timer_trg_cfg = { > + .valids_table = stm32h7_valids_table, > + .num_valids_table = ARRAY_SIZE(stm32h7_valids_table), > +}; > + > static const struct of_device_id stm32_trig_of_match[] = { > - { .compatible = "st,stm32-timer-trigger", }, > + { > + .compatible = "st,stm32-timer-trigger", > + .data = (void *)&stm32_timer_trg_cfg, > + }, { > + .compatible = "st,stm32h7-timer-trigger", > + .data = (void *)&stm32h7_timer_trg_cfg, > + }, > { /* end node */ }, > }; > MODULE_DEVICE_TABLE(of, stm32_trig_of_match); > diff --git a/include/linux/iio/timer/stm32-timer-trigger.h b/include/linux/iio/timer/stm32-timer-trigger.h > index fa7d786..20f4653 100644 > --- a/include/linux/iio/timer/stm32-timer-trigger.h > +++ b/include/linux/iio/timer/stm32-timer-trigger.h > @@ -59,6 +59,8 @@ > #define TIM12_CH1 "tim12_ch1" > #define TIM12_CH2 "tim12_ch2" > > +#define TIM15_TRGO "tim15_trgo" > + > bool is_stm32_timer_trigger(struct iio_trigger *trig); > > #endif ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] iio: trigger: stm32-timer: add output compare triggers 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 2/3] iio: trigger: stm32-timer: " Fabrice Gasnier @ 2017-08-03 9:14 ` Fabrice Gasnier [not found] ` <1501751654-14153-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2 siblings, 1 reply; 9+ messages in thread From: Fabrice Gasnier @ 2017-08-03 9:14 UTC (permalink / raw) To: jic23, robh+dt Cc: mark.rutland, devicetree, benjamin.gaignard, lars, alexandre.torgue, linux-iio, pmeerw, linux, linux-kernel, mcoquelin.stm32, knaack.h, fabrice.gasnier, linux-arm-kernel, benjamin.gaignard Add output compare trigger sources available on some instances. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> --- 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 -- 1.9.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
[parent not found: <1501751654-14153-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 3/3] iio: trigger: stm32-timer: add output compare triggers [not found] ` <1501751654-14153-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-08-09 23:30 ` Jonathan Cameron 0 siblings, 0 replies; 9+ messages in thread From: Jonathan Cameron @ 2017-08-09 23:30 UTC (permalink / raw) To: Fabrice Gasnier Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-08-12 12:05 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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).