summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@stericsson.com>2012-02-03 11:19:05 +0100
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:01:36 +0200
commit7d465f0f807deefcf396d0b61b938ac9893a3261 (patch)
tree55b64dbeef5f871cfeedbc8fb55c4094e498a347
parent3c2571945199c6f9080b815d58a107a5efab4bf5 (diff)
mfd/ab8500: remaining mainline differences
This collects the AB9540 changes that could not be included in the mainline patch set due to differences in the internal code (esp re GPIO driver). Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Change-Id: Ia5ed55f1f44da923e8b9ae22f9b47b681bbb8403 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/47743
-rw-r--r--drivers/mfd/ab8500-debugfs.c51
-rw-r--r--include/linux/mfd/abx500.h1
2 files changed, 42 insertions, 10 deletions
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
index befdbb31678..7f893aeba22 100644
--- a/drivers/mfd/ab8500-debugfs.c
+++ b/drivers/mfd/ab8500-debugfs.c
@@ -94,10 +94,11 @@ static u32 debug_address;
static int irq_first;
static int irq_last;
-static u32 irq_count[AB8500_NR_IRQS];
+static u32 *irq_count;
+static int num_irqs;
-static struct device_attribute *dev_attr[AB8500_NR_IRQS];
-static char *event_name[AB8500_NR_IRQS];
+static struct device_attribute **dev_attr;
+static char **event_name;
/**
* struct ab8500_reg_range
@@ -483,7 +484,7 @@ static irqreturn_t ab8500_debug_handler(int irq, void *data)
struct kobject *kobj = (struct kobject *)data;
unsigned int irq_abb = irq - irq_first;
- if (irq_abb < AB8500_NR_IRQS)
+ if (irq_abb < num_irqs)
irq_count[irq_abb]++;
/*
* This makes it possible to use poll for events (POLLPRI | POLLERR)
@@ -1337,7 +1338,7 @@ static ssize_t show_irq(struct device *dev,
return err;
irq_index = name - irq_first;
- if (irq_index >= AB8500_NR_IRQS)
+ if (irq_index >= num_irqs)
return -EINVAL;
else
return sprintf(buf, "%u\n", irq_count[irq_index]);
@@ -1373,7 +1374,7 @@ static ssize_t ab8500_subscribe_write(struct file *file,
}
irq_index = user_val - irq_first;
- if (irq_index >= AB8500_NR_IRQS)
+ if (irq_index >= num_irqs)
return -EINVAL;
/*
@@ -1436,7 +1437,7 @@ static ssize_t ab8500_unsubscribe_write(struct file *file,
}
irq_index = user_val - irq_first;
- if (irq_index >= AB8500_NR_IRQS)
+ if (irq_index >= num_irqs)
return -EINVAL;
/* Set irq count to 0 when unsubscribe */
@@ -1517,21 +1518,40 @@ static struct dentry *ab8500_gpadc_dir;
static int __devinit ab8500_debug_probe(struct platform_device *plf)
{
struct dentry *file;
+ int ret = -ENOMEM;
+ struct ab8500 *ab8500;
debug_bank = AB8500_MISC;
debug_address = AB8500_REV_REG & 0x00FF;
+ ab8500 = dev_get_drvdata(plf->dev.parent);
+ num_irqs = ab8500->mask_size;
+
+ irq_count = kzalloc(sizeof(irq_count)*num_irqs, GFP_KERNEL);
+ if (!irq_count)
+ return -ENOMEM;
+
+ dev_attr = kzalloc(sizeof(*dev_attr)*num_irqs,GFP_KERNEL);
+ if (!dev_attr)
+ goto out_freeirq_count;
+
+ event_name = kzalloc(sizeof(*event_name)*num_irqs, GFP_KERNEL);
+ if (!event_name)
+ goto out_freedev_attr;
+
irq_first = platform_get_irq_byname(plf, "IRQ_FIRST");
if (irq_first < 0) {
dev_err(&plf->dev, "First irq not found, err %d\n",
irq_first);
- return irq_first;
+ ret = irq_first;
+ goto out_freeevent_name;
}
irq_last = platform_get_irq_byname(plf, "IRQ_LAST");
if (irq_last < 0) {
dev_err(&plf->dev, "Last irq not found, err %d\n",
irq_last);
- return irq_last;
+ ret = irq_last;
+ goto out_freeevent_name;
}
ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL);
@@ -1654,12 +1674,23 @@ err:
if (ab8500_dir)
debugfs_remove_recursive(ab8500_dir);
dev_err(&plf->dev, "failed to create debugfs entries.\n");
- return -ENOMEM;
+out_freeevent_name:
+ kfree(event_name);
+out_freedev_attr:
+ kfree(dev_attr);
+out_freeirq_count:
+ kfree(irq_count);
+
+ return ret;
}
static int __devexit ab8500_debug_remove(struct platform_device *plf)
{
debugfs_remove_recursive(ab8500_dir);
+ kfree(event_name);
+ kfree(dev_attr);
+ kfree(irq_count);
+
return 0;
}
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 2cf7f7b1823..1eb4c001471 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -33,6 +33,7 @@ struct device;
#define AB5500_1_0 0x20
#define AB5500_1_1 0x21
#define AB5500_2_0 0x24
+#define AB5500_2_1 0x25
/*
* AB3100, EVENTA1, A2 and A3 event register flags