Commit cca69b67 authored by Mattias Wallin's avatar Mattias Wallin Committed by Samuel Ortiz

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: default avatarMattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: default avatarLudovic Barre <ludovic.barre@stericsson.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 6bce7bf1
...@@ -436,6 +436,26 @@ static struct mfd_cell ab8500_devs[] = { ...@@ -436,6 +436,26 @@ static struct mfd_cell ab8500_devs[] = {
}, },
}; };
static ssize_t show_chip_id(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ab8500 *ab8500;
ab8500 = dev_get_drvdata(dev);
return sprintf(buf, "%#x\n", ab8500 ? ab8500->chip_id : -EINVAL);
}
static DEVICE_ATTR(chip_id, S_IRUGO, show_chip_id, NULL);
static struct attribute *ab8500_sysfs_entries[] = {
&dev_attr_chip_id.attr,
NULL,
};
static struct attribute_group ab8500_attr_group = {
.attrs = ab8500_sysfs_entries,
};
int __devinit ab8500_init(struct ab8500 *ab8500) int __devinit ab8500_init(struct ab8500 *ab8500)
{ {
struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev); struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev);
...@@ -510,6 +530,10 @@ int __devinit ab8500_init(struct ab8500 *ab8500) ...@@ -510,6 +530,10 @@ int __devinit ab8500_init(struct ab8500 *ab8500)
if (ret) if (ret)
goto out_freeirq; goto out_freeirq;
ret = sysfs_create_group(&ab8500->dev->kobj, &ab8500_attr_group);
if (ret)
dev_err(ab8500->dev, "error creating sysfs entries\n");
return ret; return ret;
out_freeirq: out_freeirq:
...@@ -523,6 +547,7 @@ int __devinit ab8500_init(struct ab8500 *ab8500) ...@@ -523,6 +547,7 @@ int __devinit ab8500_init(struct ab8500 *ab8500)
int __devexit ab8500_exit(struct ab8500 *ab8500) int __devexit ab8500_exit(struct ab8500 *ab8500)
{ {
sysfs_remove_group(&ab8500->dev->kobj, &ab8500_attr_group);
mfd_remove_devices(ab8500->dev); mfd_remove_devices(ab8500->dev);
if (ab8500->irq_base) { if (ab8500->irq_base) {
free_irq(ab8500->irq, ab8500); free_irq(ab8500->irq, ab8500);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment