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

Merge tag 'counter-updates-for-6.16b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter into char-misc-next

William writes:

Second set of Counter updates for 6.16

Adds compatible for STM32MP25 SoC and enables respective encoder
capability for stm32-timer-cnt. Implements watch_validate callback for
microchip-tcb-capture.

* tag 'counter-updates-for-6.16b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter:
counter: microchip-tcb-capture: Add watch validation support
counter: stm32-timer-cnt: add support for stm32mp25

+29 -3
+24 -1
drivers/counter/microchip-tcb-capture.c
··· 337 337 COUNTER_COMP_COMPARE(mchp_tc_count_compare_read, mchp_tc_count_compare_write), 338 338 }; 339 339 340 + static int mchp_tc_watch_validate(struct counter_device *counter, 341 + const struct counter_watch *watch) 342 + { 343 + if (watch->channel == COUNTER_MCHP_EVCHN_CV || watch->channel == COUNTER_MCHP_EVCHN_RA) 344 + switch (watch->event) { 345 + case COUNTER_EVENT_CHANGE_OF_STATE: 346 + case COUNTER_EVENT_OVERFLOW: 347 + case COUNTER_EVENT_CAPTURE: 348 + return 0; 349 + default: 350 + return -EINVAL; 351 + } 352 + 353 + if (watch->channel == COUNTER_MCHP_EVCHN_RB && watch->event == COUNTER_EVENT_CAPTURE) 354 + return 0; 355 + 356 + if (watch->channel == COUNTER_MCHP_EVCHN_RC && watch->event == COUNTER_EVENT_THRESHOLD) 357 + return 0; 358 + 359 + return -EINVAL; 360 + } 361 + 340 362 static struct counter_count mchp_tc_counts[] = { 341 363 { 342 364 .id = 0, ··· 378 356 .function_read = mchp_tc_count_function_read, 379 357 .function_write = mchp_tc_count_function_write, 380 358 .action_read = mchp_tc_count_action_read, 381 - .action_write = mchp_tc_count_action_write 359 + .action_write = mchp_tc_count_action_write, 360 + .watch_validate = mchp_tc_watch_validate, 382 361 }; 383 362 384 363 static const struct atmel_tcb_config tcb_rm9200_config = {
+5 -2
drivers/counter/stm32-timer-cnt.c
··· 669 669 dev_dbg(dev, "has %d cc channels\n", priv->nchannels); 670 670 } 671 671 672 - /* encoder supported on TIM1 TIM2 TIM3 TIM4 TIM5 TIM8 */ 673 - #define STM32_TIM_ENCODER_SUPPORTED (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(7)) 672 + /* encoder supported on TIM1 TIM2 TIM3 TIM4 TIM5 TIM8 TIM20 */ 673 + #define STM32_TIM_ENCODER_SUPPORTED (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(7) | \ 674 + BIT(19)) 674 675 675 676 static const char * const stm32_timer_trigger_compat[] = { 676 677 "st,stm32-timer-trigger", 677 678 "st,stm32h7-timer-trigger", 679 + "st,stm32mp25-timer-trigger", 678 680 }; 679 681 680 682 static int stm32_timer_cnt_probe_encoder(struct device *dev, ··· 848 846 849 847 static const struct of_device_id stm32_timer_cnt_of_match[] = { 850 848 { .compatible = "st,stm32-timer-counter", }, 849 + { .compatible = "st,stm32mp25-timer-counter", }, 851 850 {}, 852 851 }; 853 852 MODULE_DEVICE_TABLE(of, stm32_timer_cnt_of_match);