iio: light: vcnl4000: Make irq handling more generic
authorMårten Lindahl <marten.lindahl@axis.com>
Tue, 17 Jan 2023 19:00:16 +0000 (20:00 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 21 Jan 2023 18:04:39 +0000 (18:04 +0000)
commitbfb6cfeeb83f314dd4a09ad6c9a24678f66c3b3b
treefc11dec0a66233eb8b31095a1ad8abab1fd4683f
parent3a52d32a7497fa21b2dcedf5051cca7b46a7921f
iio: light: vcnl4000: Make irq handling more generic

This driver supports 4 chips, by which only one (vcnl4010) handles
interrupts and has support for triggered buffer. The setup of these
functions is hardcoded for vcnl4010 inside the generic vcnl4000_probe,
and thus ignores the chip specific configuration structure where all
other chip specific functions are specified.

This complicates adding interrupt handler and triggered buffer support
to chips which may have support for it.

Add members for irq threads and iio_buffer_setup_ops to the generic
vcnl4000_chip_spec struct, so that instead of checking a chip specific
boolean irq support, we check for a chip specific triggered buffer
handler, and/or a chip specific irq thread handler.

Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230117190017.3789181-3-marten.lindahl@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/vcnl4000.c