On 12/06/2019 11:31:42+0200, Ladislav Michl wrote: > On Wed, Jun 12, 2019 at 10:15:33AM +0200, Alexandre Belloni wrote: > > On 11/06/2019 13:56:03+0200, Ladislav Michl wrote: > > > Driver also contains some code for TC triggers. How is that supposed to > > > work? [**] The very same manual states in chapter 39.5.5: > > > "If one of the TIOA outputs is selected, the corresponding Timer Counter > > > channel must be programmed in Waveform Mode." > > > There are two drivers touching TC: drivers/clocksource/timer-atmel-tcb.c > > > and drivers/pwm/pwm-atmel-tcb.c, they seem to conflict each other and > > > > They don't, they can work simultaneously, on different TCBs. I'm still > > planning to rework pwm-atmel-tcb to switch it to the proper binding. > > Is there any draft how should that "proper binding" look like? > By "conflict" I mean DT can be written so both race for the same resource, > while I would expect timer definition with PWM and ADC using its phandle. > Last part of https://lore.kernel.org/lkml/20170530215139.9983-2-alexandre.belloni@xxxxxxxxxxxxxxxxxx/ This is not yet upstream but I'm planning to resend sometime in July. > > > none of them is anyhow related to ADC driver. Here it would seem > > > appropriate to have TC MFD driver and allocate timers for ADC, PWM and > > > clocksource from there. > > > > No, MFD is way too late for clocksource, this would break some platforms. > > > > However, there is definitively some timer framework that is missing to > > allow handling of timers that are not used as clocksource/clockevent > > devices. So indeed, there is a missing piece to make the TC trigger > > work. > > Can that be done similar way drivers/clocksource/timer-ti-dm.c is > implemented or do you have something else in mind? > Yes, something similar but this could probably be made more generic as this would benefit many other platforms too (i.e broadcom, nxp, amlogic). -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com