diff options
author | Devesh Jhunjhunwala <deveshj@codeaurora.org> | 2016-06-07 14:22:33 -0700 |
---|---|---|
committer | Devesh Jhunjhunwala <deveshj@codeaurora.org> | 2016-07-28 12:43:30 -0700 |
commit | f2509065e9a455f1fdd450177192af20d785be71 (patch) | |
tree | 3bbb66e61c22bdbbee9a22a62da9d397c9a5c0bc /drivers/leds | |
parent | 6b49283ec846e9fd68244e5fae0ee19865042d7a (diff) |
leds: qpnp-flash-v2: Create atomic notifier chain for flash irqs
Create an atomic notifier call chain to notify registered
clients of a flash-led irq event.
CRs-Fixed: 921325
Change-Id: I218195c29fede7ae5959df8c40df0231a71de379
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-qpnp-flash-v2.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/leds/leds-qpnp-flash-v2.c b/drivers/leds/leds-qpnp-flash-v2.c index 86f4c4cd4d2a..0455ea6676bb 100644 --- a/drivers/leds/leds-qpnp-flash-v2.c +++ b/drivers/leds/leds-qpnp-flash-v2.c @@ -73,6 +73,9 @@ #define FLASH_LED_SAFETY_TMR_DISABLED 0x13 #define FLASH_LED_MIN_CURRENT_MA 25 +/* notifier call chain for flash-led irqs */ +static ATOMIC_NOTIFIER_HEAD(irq_notifier_list); + enum flash_led_type { FLASH_LED_TYPE_FLASH, FLASH_LED_TYPE_TORCH, @@ -567,11 +570,26 @@ static irqreturn_t qpnp_flash_led_irq_handler(int irq, void *_led) else if (irq == led->pdata->all_ramp_down_done_irq) irq_type = ALL_RAMP_DOWN_DONE_IRQ; + if (irq_type == ALL_RAMP_UP_DONE_IRQ) + atomic_notifier_call_chain(&irq_notifier_list, + irq_type, NULL); + dev_dbg(&led->pdev->dev, "irq handled, irq_type=%x, irq_status=%x\n", irq_type, status); + return IRQ_HANDLED; } +int qpnp_flash_led_register_irq_notifier(struct notifier_block *nb) +{ + return atomic_notifier_chain_register(&irq_notifier_list, nb); +} + +int qpnp_flash_led_unregister_irq_notifier(struct notifier_block *nb) +{ + return atomic_notifier_chain_unregister(&irq_notifier_list, nb); +} + static int qpnp_flash_led_regulator_setup(struct qpnp_flash_led *led, struct flash_switch_data *snode, bool on) { |