Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319693
b: refs/heads/master
c: c94bb23
h: refs/heads/master
i:
  319691: 1a4ff14
v: v3
  • Loading branch information
Lee Jones authored and Samuel Ortiz committed Jul 8, 2012
1 parent 70aaafc commit 86b07e7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 822672a7b496e724f879af703693f342e2215163
refs/heads/master: c94bb233a9fee3314dc5d9c7de9fa702e91283f2
1 change: 1 addition & 0 deletions trunk/drivers/mfd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ menu "Multifunction device drivers"

config MFD_CORE
tristate
select IRQ_DOMAIN
default n

config MFD_88PM860X
Expand Down
30 changes: 26 additions & 4 deletions trunk/drivers/mfd/mfd-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/irqdomain.h>
#include <linux/of.h>

int mfd_cell_enable(struct platform_device *pdev)
{
Expand Down Expand Up @@ -76,6 +78,8 @@ static int mfd_add_device(struct device *parent, int id,
{
struct resource *res;
struct platform_device *pdev;
struct device_node *np = NULL;
struct irq_domain *domain = NULL;
int ret = -ENOMEM;
int r;

Expand All @@ -89,6 +93,16 @@ static int mfd_add_device(struct device *parent, int id,

pdev->dev.parent = parent;

if (parent->of_node && cell->of_compatible) {
for_each_child_of_node(parent->of_node, np) {
if (of_device_is_compatible(np, cell->of_compatible)) {
pdev->dev.of_node = np;
domain = irq_find_host(parent->of_node);
break;
}
}
}

if (cell->pdata_size) {
ret = platform_device_add_data(pdev,
cell->platform_data, cell->pdata_size);
Expand All @@ -112,10 +126,18 @@ static int mfd_add_device(struct device *parent, int id,
res[r].end = mem_base->start +
cell->resources[r].end;
} else if (cell->resources[r].flags & IORESOURCE_IRQ) {
res[r].start = irq_base +
cell->resources[r].start;
res[r].end = irq_base +
cell->resources[r].end;
if (domain) {
/* Unable to create mappings for IRQ ranges. */
WARN_ON(cell->resources[r].start !=
cell->resources[r].end);
res[r].start = res[r].end = irq_create_mapping(
domain, cell->resources[r].start);
} else {
res[r].start = irq_base +
cell->resources[r].start;
res[r].end = irq_base +
cell->resources[r].end;
}
} else {
res[r].parent = cell->resources[r].parent;
res[r].start = cell->resources[r].start;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mfd/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct mfd_cell {
/* platform data passed to the sub devices drivers */
void *platform_data;
size_t pdata_size;
const char *of_compatible;

/*
* These resources can be specified relative to the parent device.
Expand Down

0 comments on commit 86b07e7

Please sign in to comment.