Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: trigger: stm32-timer: add output compare triggers

Add output compare trigger sources available on some instances.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Fabrice Gasnier and committed by
Jonathan Cameron
25892d6e 45fff14b

+32 -11
+20 -11
drivers/iio/trigger/stm32-timer-trigger.c
··· 29 29 { TIM7_TRGO,}, 30 30 { TIM8_TRGO, TIM8_TRGO2, TIM8_CH1, TIM8_CH2, TIM8_CH3, TIM8_CH4,}, 31 31 { TIM9_TRGO, TIM9_CH1, TIM9_CH2,}, 32 - { }, /* timer 10 */ 33 - { }, /* timer 11 */ 32 + { TIM10_OC1,}, 33 + { TIM11_OC1,}, 34 34 { TIM12_TRGO, TIM12_CH1, TIM12_CH2,}, 35 - { }, /* timer 13 */ 36 - { }, /* timer 14 */ 35 + { TIM13_OC1,}, 36 + { TIM14_OC1,}, 37 37 { TIM15_TRGO,}, 38 + { TIM16_OC1,}, 39 + { TIM17_OC1,}, 38 40 }; 39 41 40 42 /* List the triggers accepted by each timer */ ··· 49 47 { }, /* timer 6 */ 50 48 { }, /* timer 7 */ 51 49 { TIM1_TRGO, TIM2_TRGO, TIM4_TRGO, TIM5_TRGO,}, 52 - { TIM2_TRGO, TIM3_TRGO,}, 50 + { TIM2_TRGO, TIM3_TRGO, TIM10_OC1, TIM11_OC1,}, 53 51 { }, /* timer 10 */ 54 52 { }, /* timer 11 */ 55 - { TIM4_TRGO, TIM5_TRGO,}, 53 + { TIM4_TRGO, TIM5_TRGO, TIM13_OC1, TIM14_OC1,}, 56 54 }; 57 55 58 56 static const void *stm32h7_valids_table[][MAX_VALIDS] = { ··· 67 65 { }, /* timer 9 */ 68 66 { }, /* timer 10 */ 69 67 { }, /* timer 11 */ 70 - { TIM4_TRGO, TIM5_TRGO,}, 68 + { TIM4_TRGO, TIM5_TRGO, TIM13_OC1, TIM14_OC1,}, 71 69 { }, /* timer 13 */ 72 70 { }, /* timer 14 */ 73 - { TIM1_TRGO, TIM3_TRGO,}, 71 + { TIM1_TRGO, TIM3_TRGO, TIM16_OC1, TIM17_OC1,}, 72 + { }, /* timer 16 */ 73 + { }, /* timer 17 */ 74 74 }; 75 75 76 76 struct stm32_timer_trigger { ··· 93 89 static bool stm32_timer_is_trgo2_name(const char *name) 94 90 { 95 91 return !!strstr(name, "trgo2"); 92 + } 93 + 94 + static bool stm32_timer_is_trgo_name(const char *name) 95 + { 96 + return (!!strstr(name, "trgo") && !strstr(name, "trgo2")); 96 97 } 97 98 98 99 static int stm32_timer_start(struct stm32_timer_trigger *priv, ··· 364 355 365 356 while (cur && *cur) { 366 357 struct iio_trigger *trig; 358 + bool cur_is_trgo = stm32_timer_is_trgo_name(*cur); 367 359 bool cur_is_trgo2 = stm32_timer_is_trgo2_name(*cur); 368 360 369 361 if (cur_is_trgo2 && !priv->has_trgo2) { ··· 381 371 382 372 /* 383 373 * sampling frequency and master mode attributes 384 - * should only be available on trgo trigger which 385 - * is always the first in the list. 374 + * should only be available on trgo/trgo2 triggers 386 375 */ 387 - if (cur == priv->triggers || cur_is_trgo2) 376 + if (cur_is_trgo || cur_is_trgo2) 388 377 trig->dev.groups = stm32_trigger_attr_groups; 389 378 390 379 iio_trigger_set_drvdata(trig, priv);
+12
include/linux/iio/timer/stm32-timer-trigger.h
··· 55 55 #define TIM9_CH1 "tim9_ch1" 56 56 #define TIM9_CH2 "tim9_ch2" 57 57 58 + #define TIM10_OC1 "tim10_oc1" 59 + 60 + #define TIM11_OC1 "tim11_oc1" 61 + 58 62 #define TIM12_TRGO "tim12_trgo" 59 63 #define TIM12_CH1 "tim12_ch1" 60 64 #define TIM12_CH2 "tim12_ch2" 61 65 66 + #define TIM13_OC1 "tim13_oc1" 67 + 68 + #define TIM14_OC1 "tim14_oc1" 69 + 62 70 #define TIM15_TRGO "tim15_trgo" 71 + 72 + #define TIM16_OC1 "tim16_oc1" 73 + 74 + #define TIM17_OC1 "tim17_oc1" 63 75 64 76 bool is_stm32_timer_trigger(struct iio_trigger *trig); 65 77