aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMattias Wallin <mattias.wallin@stericsson.com>2010-12-02 09:09:36 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2011-01-14 06:37:46 -0500
commitcca69b67b3ba954ed8642583295b51933f902227 (patch)
tree1cbb3c0b270e6ef89f627e46779ddd75f602e550 /drivers/mfd
parent6bce7bf1a1f8a79a57ff69910c115e1d2ed8913d (diff)
mfd: Export ab8500 chip id to sysfs
This patch adds a file into sysfs for reading out chip id. It has been requested for modem silent reboot. Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com> Signed-off-by: Ludovic Barre <ludovic.barre@stericsson.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/ab8500-core.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index e91b5b759004..2bd4437cf331 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -436,6 +436,26 @@ static struct mfd_cell ab8500_devs[] = {
436 }, 436 },
437}; 437};
438 438
439static ssize_t show_chip_id(struct device *dev,
440 struct device_attribute *attr, char *buf)
441{
442 struct ab8500 *ab8500;
443
444 ab8500 = dev_get_drvdata(dev);
445 return sprintf(buf, "%#x\n", ab8500 ? ab8500->chip_id : -EINVAL);
446}
447
448static DEVICE_ATTR(chip_id, S_IRUGO, show_chip_id, NULL);
449
450static struct attribute *ab8500_sysfs_entries[] = {
451 &dev_attr_chip_id.attr,
452 NULL,
453};
454
455static struct attribute_group ab8500_attr_group = {
456 .attrs = ab8500_sysfs_entries,
457};
458
439int __devinit ab8500_init(struct ab8500 *ab8500) 459int __devinit ab8500_init(struct ab8500 *ab8500)
440{ 460{
441 struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev); 461 struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev);
@@ -510,6 +530,10 @@ int __devinit ab8500_init(struct ab8500 *ab8500)
510 if (ret) 530 if (ret)
511 goto out_freeirq; 531 goto out_freeirq;
512 532
533 ret = sysfs_create_group(&ab8500->dev->kobj, &ab8500_attr_group);
534 if (ret)
535 dev_err(ab8500->dev, "error creating sysfs entries\n");
536
513 return ret; 537 return ret;
514 538
515out_freeirq: 539out_freeirq:
@@ -523,6 +547,7 @@ out_removeirq:
523 547
524int __devexit ab8500_exit(struct ab8500 *ab8500) 548int __devexit ab8500_exit(struct ab8500 *ab8500)
525{ 549{
550 sysfs_remove_group(&ab8500->dev->kobj, &ab8500_attr_group);
526 mfd_remove_devices(ab8500->dev); 551 mfd_remove_devices(ab8500->dev);
527 if (ab8500->irq_base) { 552 if (ab8500->irq_base) {
528 free_irq(ab8500->irq, ab8500); 553 free_irq(ab8500->irq, ab8500);