On Sat, Sep 3, 2016 at 7:24 PM, Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > On 01/09/16 09:27, Linus Walleij wrote: >> This adds a helper function to the IIO trigger framework: >> >> iio_trigger_using_own(): for an IIO device, this tells >> whether the device is using itself as a trigger. >> This is true if the indio device: >> (A) supplies a trigger and >> (B) has assigned its own buffer poll function to use this >> trigger. >> >> This helper function is good when constructing triggered, >> buffered drivers that can either use its own hardware *OR* >> an external trigger such as a HRTimer or even the trigger from >> a totally different sensor. >> >> Under such circumstances it is important to know for example >> if the timestamp from the same trigger hardware should be used >> when populating the buffer: if iio_trigger_using_own() is true, >> we can use this timestamp, else we need to pick a unique >> timestamp directly in the trigger handler. >> >> For this to work of course IIO devices registering hardware >> triggers must follow the convention to set the parent device >> properly, as as well as setting the parent of the IIO device >> itself. >> >> When a new poll function is attached, we check if the parent >> device of the IIO of the poll function is the same as the >> parent device of the trigger and in that case we conclude that >> the hardware is using itself as trigger. >> >> Cc: Giuseppe Barba <giuseppe.barba@xxxxxx> >> Cc: Denis Ciocca <denis.ciocca@xxxxxx> >> Cc: Crestez Dan Leonard <leonard.crestez@xxxxxxxxx> >> Cc: Gregor Boirie <gregor.boirie@xxxxxxxxxx> >> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> > > Looks good to me, but I'll hold back on this one until we > have your driver in. > > Kick me if I forget about it. It's fine to apply 1/3 and 2/3 already, it will improve the usecase for the ST sensors. I will carry and/or squash 3/3 into the MPU-3050 driver in that case. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html