diff options
| author | Sudheer Papothi <spapothi@codeaurora.org> | 2016-04-14 01:03:12 +0530 |
|---|---|---|
| committer | Jeevan Shriram <jshriram@codeaurora.org> | 2016-04-22 11:57:40 -0700 |
| commit | b9990820a69dbe6b6ef9ffb327f4a63b35042dc3 (patch) | |
| tree | 8dbf115a6b83426fd1fb664266acb4de09d796fa | |
| parent | 078e42ca28008b4a0afd053d5ee849fc396cc875 (diff) | |
drivers: mfd: Allocate and register irq domain for codec interrupts
During codec interrupt controller probe, allocate and register
irq domain for codec interrupts for mapping between hwirq and
irq numbers.
Change-Id: I3e32043499f2b1e2616cf74864969815e626a23b
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
| -rw-r--r-- | drivers/mfd/wcd9xxx-irq.c | 25 | ||||
| -rwxr-xr-x | include/linux/mfd/wcd9xxx/core.h | 11 |
2 files changed, 13 insertions, 23 deletions
diff --git a/drivers/mfd/wcd9xxx-irq.c b/drivers/mfd/wcd9xxx-irq.c index e0113bed7ec0..a171950fe72e 100644 --- a/drivers/mfd/wcd9xxx-irq.c +++ b/drivers/mfd/wcd9xxx-irq.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -536,8 +536,6 @@ int wcd9xxx_request_irq(struct wcd9xxx_core_resource *wcd9xxx_res, virq = phyirq_to_virq(wcd9xxx_res, irq); - irq_modify_status(virq, IRQ_NOREQUEST, (IRQ_NOPROBE | IRQ_NOAUTOEN)); - return request_threaded_irq(virq, NULL, handler, IRQF_TRIGGER_RISING, name, data); } @@ -590,17 +588,18 @@ static int wcd9xxx_map_irq( return phyirq_to_virq(wcd9xxx_core_res, irq); } #else -int __init wcd9xxx_irq_of_init(struct device_node *node, +static struct wcd9xxx_irq_drv_data * +wcd9xxx_irq_add_domain(struct device_node *node, struct device_node *parent) { - struct wcd9xxx_irq_drv_data *data; + struct wcd9xxx_irq_drv_data *data = NULL; pr_debug("%s: node %s, node parent %s\n", __func__, node->name, node->parent->name); data = kzalloc(sizeof(*data), GFP_KERNEL); if (!data) - return -ENOMEM; + return NULL; /* * wcd9xxx_intc interrupt controller supports N to N irq mapping with @@ -612,10 +611,10 @@ int __init wcd9xxx_irq_of_init(struct device_node *node, &irq_domain_simple_ops, data); if (!data->domain) { kfree(data); - return -ENOMEM; + return NULL; } - return 0; + return data; } static struct wcd9xxx_irq_drv_data * @@ -693,7 +692,6 @@ static int wcd9xxx_map_irq(struct wcd9xxx_core_resource *wcd9xxx_res, int irq) static int wcd9xxx_irq_probe(struct platform_device *pdev) { int irq; - struct irq_domain *domain; struct wcd9xxx_irq_drv_data *data; struct device_node *node = pdev->dev.of_node; int ret = -EINVAL; @@ -709,12 +707,11 @@ static int wcd9xxx_irq_probe(struct platform_device *pdev) return irq; } dev_dbg(&pdev->dev, "%s: virq = %d\n", __func__, irq); - domain = irq_find_host(pdev->dev.of_node); - if (unlikely(!domain)) { - pr_err("%s: domain is NULL", __func__); + data = wcd9xxx_irq_add_domain(node, node->parent); + if (!data) { + pr_err("%s: irq_add_domain failed\n", __func__); return -EINVAL; } - data = (struct wcd9xxx_irq_drv_data *)domain->host_data; data->irq = irq; wmb(); ret = 0; @@ -736,6 +733,8 @@ static int wcd9xxx_irq_remove(struct platform_device *pdev) data = (struct wcd9xxx_irq_drv_data *)domain->host_data; data->irq = 0; wmb(); + irq_domain_remove(data->domain); + kfree(data); return 0; } diff --git a/include/linux/mfd/wcd9xxx/core.h b/include/linux/mfd/wcd9xxx/core.h index eed0328b3f59..e0abd4285753 100755 --- a/include/linux/mfd/wcd9xxx/core.h +++ b/include/linux/mfd/wcd9xxx/core.h @@ -319,21 +319,12 @@ int wcd9xxx_slim_bulk_write(struct wcd9xxx *wcd9xxx, struct wcd9xxx_reg_val *bulk_reg, unsigned int size, bool interface); -#if defined(CONFIG_WCD9310_CODEC) || \ - defined(CONFIG_WCD9304_CODEC) || \ - defined(CONFIG_WCD9320_CODEC) || \ - defined(CONFIG_WCD9330_CODEC) || \ - defined(CONFIG_WCD9335_CODEC) || \ - defined(CONFIG_WCD9306_CODEC) -int __init wcd9xxx_irq_of_init(struct device_node *node, - struct device_node *parent); -#else static inline int __init wcd9xxx_irq_of_init(struct device_node *node, struct device_node *parent) { return 0; } -#endif /* CONFIG_OF */ + static inline void wcd9xxx_reg_update(struct wcd9xxx *core, unsigned short reg, u8 mask, u8 val) |
