Skip to content

Commit

Permalink
mfd: Add rtc support to 88pm860x
Browse files Browse the repository at this point in the history
Enable rtc function in 88pm860x PMIC.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Haojian Zhuang authored and Samuel Ortiz committed May 26, 2011
1 parent db13c04 commit 008b304
Show file tree
Hide file tree
Showing 5 changed files with 473 additions and 0 deletions.
29 changes: 29 additions & 0 deletions drivers/mfd/88pm860x-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ static struct resource charger_resources[] __devinitdata = {
{PM8607_IRQ_VCHG, PM8607_IRQ_VCHG, "vchg voltage", IORESOURCE_IRQ,},
};

static struct resource rtc_resources[] __devinitdata = {
{PM8607_IRQ_RTC, PM8607_IRQ_RTC, "rtc", IORESOURCE_IRQ,},
};

static struct mfd_cell bk_devs[] = {
{"88pm860x-backlight", 0,},
{"88pm860x-backlight", 1,},
Expand Down Expand Up @@ -143,6 +147,10 @@ static struct mfd_cell power_devs[] = {
{"88pm860x-charger", -1,},
};

static struct mfd_cell rtc_devs[] = {
{"88pm860x-rtc", -1,},
};

static struct pm860x_backlight_pdata bk_pdata[ARRAY_SIZE(bk_devs)];
static struct pm860x_led_pdata led_pdata[ARRAY_SIZE(led_devs)];
static struct regulator_init_data regulator_pdata[ARRAY_SIZE(regulator_devs)];
Expand Down Expand Up @@ -635,6 +643,26 @@ static void __devinit device_regulator_init(struct pm860x_chip *chip,
return;
}

static void __devinit device_rtc_init(struct pm860x_chip *chip,
struct i2c_client *i2c,
struct pm860x_platform_data *pdata)
{
int ret;

if ((pdata == NULL))
return;

rtc_devs[0].platform_data = pdata->rtc;
rtc_devs[0].pdata_size = sizeof(struct pm860x_rtc_pdata);
rtc_devs[0].num_resources = ARRAY_SIZE(rtc_resources);
rtc_devs[0].resources = &rtc_resources[0];
ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0],
ARRAY_SIZE(rtc_devs), &rtc_resources[0],
chip->irq_base);
if (ret < 0)
dev_err(chip->dev, "Failed to add rtc subdev\n");
}

static void __devinit device_touch_init(struct pm860x_chip *chip,
struct i2c_client *i2c,
struct pm860x_platform_data *pdata)
Expand Down Expand Up @@ -770,6 +798,7 @@ static void __devinit device_8607_init(struct pm860x_chip *chip,
goto out;

device_regulator_init(chip, i2c, pdata);
device_rtc_init(chip, i2c, pdata);
device_onkey_init(chip, i2c, pdata);
device_touch_init(chip, i2c, pdata);
device_power_init(chip, i2c, pdata);
Expand Down
10 changes: 10 additions & 0 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ comment "I2C RTC drivers"

if I2C

config RTC_DRV_88PM860X
tristate "Marvell 88PM860x"
depends on RTC_CLASS && I2C && MFD_88PM860X
help
If you say yes here you get support for RTC function in Marvell
88PM860x chips.

This driver can also be built as a module. If so, the module
will be called rtc-88pm860x.

config RTC_DRV_DS1307
tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025"
help
Expand Down
1 change: 1 addition & 0 deletions drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rtc-core-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o

# Keep the list ordered.

obj-$(CONFIG_RTC_DRV_88PM860X) += rtc-88pm860x.o
obj-$(CONFIG_RTC_DRV_AB3100) += rtc-ab3100.o
obj-$(CONFIG_RTC_DRV_AB8500) += rtc-ab8500.o
obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o
Expand Down
Loading

0 comments on commit 008b304

Please sign in to comment.