[PATCH 5/12] add sm501 pwm support.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gdium uses sm501 PWM for LCD backlight adjust. So we need to add the
PWM support into sm501.

Signed-off-by: yajin <yajin@xxxxxxxxxxxxx>
---
 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


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux