regmap-irq: Add driver callback to configure virtual regs
authorGuru Das Srinagesh <gurus@codeaurora.org>
Wed, 24 Mar 2021 19:28:54 +0000 (12:28 -0700)
committerMark Brown <broonie@kernel.org>
Wed, 31 Mar 2021 12:53:38 +0000 (13:53 +0100)
Enable drivers to configure and modify "virtual" registers, which are
non-standard registers that further configure irq type on some devices.
Since they are non-standard, enable drivers to configure them according
to their particular idiosyncrasies by specifying an optional callback
function while registering with the framework.

Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Link: https://lore.kernel.org/r/07e058cdec2297d15c95c825aa0263064d962d5a.1616613838.git.gurus@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap-irq.c
include/linux/regmap.h

index d1ade76a6c93e28afb81b3b1d62481ba543595fb..e6343ccc6aa1b332792fd68632c46836f17aedf4 100644 (file)
@@ -333,6 +333,11 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type)
        default:
                return -EINVAL;
        }
+
+       if (d->chip->set_type_virt)
+               return d->chip->set_type_virt(d->virt_buf, type, data->hwirq,
+                                             reg);
+
        return 0;
 }
 
index 97ec73383e471e0c2b20e954454d9abb2f09b28d..f87a11a5cc4a70b403465d30bc5a81f6eb9ec832 100644 (file)
@@ -1426,6 +1426,8 @@ struct regmap_irq_sub_irq_map {
  *                  before regmap_irq_handler process the interrupts.
  * @handle_post_irq: Driver specific callback to handle interrupt from device
  *                  after handling the interrupts in regmap_irq_handler().
+ * @set_type_virt:   Driver specific callback to extend regmap_irq_set_type()
+ *                  and configure virt regs.
  * @irq_drv_data:    Driver specific IRQ data which is passed as parameter when
  *                  driver specific pre/post interrupt handler is called.
  *
@@ -1473,6 +1475,8 @@ struct regmap_irq_chip {
 
        int (*handle_pre_irq)(void *irq_drv_data);
        int (*handle_post_irq)(void *irq_drv_data);
+       int (*set_type_virt)(unsigned int **buf, unsigned int type,
+                            unsigned long hwirq, int reg);
        void *irq_drv_data;
 };