* [PATCH 5/12] add sm501 pwm support.
@ 2010-05-04 9:55 yajin
2010-05-04 12:25 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: yajin @ 2010-05-04 9:55 UTC (permalink / raw)
To: linux-mips, loongson-dev, wuzhangjin, apatard, ben, vince
Gdium uses sm501 PWM for LCD backlight adjust. So we need to add the
PWM support into sm501.
Signed-off-by: yajin <yajin@vm-kernel.org>
---
drivers/mfd/sm501.c | 16 ++++++++++++++++
include/linux/sm501.h | 1 +
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index bc9275c..ab560fe 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1219,6 +1219,20 @@ static int sm501_register_gpio_i2c(struct
sm501_devdata *sm,
return 0;
}
+/* register sm501 PWM device */
+static int sm501_register_pwm(struct sm501_devdata *sm)
+{
+ struct platform_device *pdev;
+
+ pdev = sm501_create_subdev(sm, "sm501-pwm", 2, 0);
+ if (!pdev)
+ return -ENOMEM;
+ sm501_create_subio(sm, &pdev->resource[0], 0x10020, 0xC);
+ sm501_create_irq(sm, &pdev->resource[1]);
+
+ return sm501_register_device(sm, pdev);
+}
+
/* sm501_dbg_regs
*
* Debug attribute to attach to parent device to show core registers
@@ -1377,6 +1391,8 @@ static int __devinit sm501_init_dev(struct
sm501_devdata *sm)
sm501_register_uart(sm, idata->devices);
if (idata->devices & SM501_USE_GPIO)
sm501_register_gpio(sm);
+ if (idata->devices & SM501_USE_PWM)
+ sm501_register_pwm(sm);
}
if (pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) {
diff --git a/include/linux/sm501.h b/include/linux/sm501.h
index 214f932..0a4287e 100644
--- a/include/linux/sm501.h
+++ b/include/linux/sm501.h
@@ -122,6 +122,7 @@ struct sm501_reg_init {
#define SM501_USE_AC97 (1<<7)
#define SM501_USE_I2S (1<<8)
#define SM501_USE_GPIO (1<<9)
+#define SM501_USE_PWM (1<<10)
#define SM501_USE_ALL (0xffffffff)
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 5/12] add sm501 pwm support.
2010-05-04 9:55 [PATCH 5/12] add sm501 pwm support yajin
@ 2010-05-04 12:25 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2010-05-04 12:25 UTC (permalink / raw)
To: yajin; +Cc: linux-mips, loongson-dev, wuzhangjin, apatard, ben, vince
This should be sent to the MFD maintainer. I can merge it but only with
his approval.
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-04 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-04 9:55 [PATCH 5/12] add sm501 pwm support yajin
2010-05-04 12:25 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox