mfd: pm8038-core: Add support for LEDs on pmic 8038

Add leds as a sub device to pmic 8038. This will also
take care of filling platform data for leds driver
which comes as part of pmic pdata.

Change-Id: I3814a0f36f79612684e4a2305e3c5c19dc64cb00
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
This commit is contained in:
Amy Maloche
2012-01-27 14:11:29 -08:00
parent 8ead9994c6
commit 8950101583
2 changed files with 17 additions and 0 deletions

View File

@@ -268,6 +268,11 @@ static struct mfd_cell misc_cell __devinitdata = {
.id = -1,
};
static struct mfd_cell leds_cell __devinitdata = {
.name = PM8XXX_LEDS_DEV_NAME,
.id = -1,
};
static struct mfd_cell debugfs_cell __devinitdata = {
.name = "pm8xxx-debug",
.id = 0,
@@ -501,6 +506,16 @@ pm8038_add_subdevices(const struct pm8038_platform_data *pdata,
}
}
if (pdata->leds_pdata) {
leds_cell.platform_data = pdata->leds_pdata;
leds_cell.pdata_size = sizeof(struct pm8xxx_led_platform_data);
ret = mfd_add_devices(pmic->dev, 0, &leds_cell, 1, NULL, 0);
if (ret) {
pr_err("Failed to add leds subdevice ret=%d\n", ret);
goto bail;
}
}
if (pdata->num_regulators > 0 && pdata->regulator_pdatas) {
ret = pm8038_add_regulators(pdata, pmic, irq_base);
if (ret) {

View File

@@ -30,6 +30,7 @@
#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
#include <linux/mfd/pm8xxx/pm8921-charger.h>
#include <linux/mfd/pm8xxx/pm8921-bms.h>
#include <linux/leds-pm8xxx.h>
#include <linux/mfd/pm8xxx/ccadc.h>
#define PM8038_CORE_DEV_NAME "pm8038-core"
@@ -75,6 +76,7 @@ struct pm8038_platform_data {
struct pm8921_charger_platform_data *charger_pdata;
struct pm8921_bms_platform_data *bms_pdata;
struct pm8xxx_adc_platform_data *adc_pdata;
struct pm8xxx_led_platform_data *leds_pdata;
struct pm8xxx_ccadc_platform_data *ccadc_pdata;
};