mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
iio: trigger: stm32-timer: add support for stm32mp25
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> Link: https://patch.msgid.link/20241220095927.1122782-4-fabrice.gasnier@foss.st.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
e9ed97be4f
commit
e2f9d754fc
|
@ -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 */
|
||||
|
@ -791,7 +794,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);
|
||||
|
@ -804,7 +807,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);
|
||||
|
||||
|
@ -896,6 +900,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",
|
||||
|
@ -903,6 +917,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 */ },
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user