2013-04-17 01:03:04

by Jingoo Han

[permalink] [raw]
Subject: [PATCH RESEND 1/3] backlight: omap1: convert omapbl to dev_pm_ops

Instead of using legacy suspend/resume methods, using newer dev_pm_ops
structure allows better control over power management.

Signed-off-by: Jingoo Han <[email protected]>
---
drivers/video/backlight/omap1_bl.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c
index 0aed176..812e22e 100644
--- a/drivers/video/backlight/omap1_bl.c
+++ b/drivers/video/backlight/omap1_bl.c
@@ -71,27 +71,24 @@ static void omapbl_blank(struct omap_backlight *bl, int mode)
}
}

-#ifdef CONFIG_PM
-static int omapbl_suspend(struct platform_device *pdev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int omapbl_suspend(struct device *dev)
{
- struct backlight_device *dev = platform_get_drvdata(pdev);
- struct omap_backlight *bl = bl_get_data(dev);
+ struct backlight_device *bl_dev = dev_get_drvdata(dev);
+ struct omap_backlight *bl = bl_get_data(bl_dev);

omapbl_blank(bl, FB_BLANK_POWERDOWN);
return 0;
}

-static int omapbl_resume(struct platform_device *pdev)
+static int omapbl_resume(struct device *dev)
{
- struct backlight_device *dev = platform_get_drvdata(pdev);
- struct omap_backlight *bl = bl_get_data(dev);
+ struct backlight_device *bl_dev = dev_get_drvdata(dev);
+ struct omap_backlight *bl = bl_get_data(bl_dev);

omapbl_blank(bl, bl->powermode);
return 0;
}
-#else
-#define omapbl_suspend NULL
-#define omapbl_resume NULL
#endif

static int omapbl_set_power(struct backlight_device *dev, int state)
@@ -182,13 +179,14 @@ static int omapbl_remove(struct platform_device *pdev)
return 0;
}

+static SIMPLE_DEV_PM_OPS(omapbl_pm_ops, omapbl_suspend, omapbl_resume);
+
static struct platform_driver omapbl_driver = {
.probe = omapbl_probe,
.remove = omapbl_remove,
- .suspend = omapbl_suspend,
- .resume = omapbl_resume,
.driver = {
.name = "omap-bl",
+ .pm = &omapbl_pm_ops,
},
};

--
1.7.2.5


2013-04-17 01:04:33

by Jingoo Han

[permalink] [raw]
Subject: [PATCH RESEND 2/3] backlight: tosa: convert tosa to dev_pm_ops

Instead of using legacy suspend/resume methods, using newer dev_pm_ops
structure allows better control over power management.

Signed-off-by: Jingoo Han <[email protected]>
---
drivers/video/backlight/tosa_bl.c | 18 ++++++++----------
drivers/video/backlight/tosa_lcd.c | 18 ++++++++----------
2 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c
index 2326fa8..9df66ac 100644
--- a/drivers/video/backlight/tosa_bl.c
+++ b/drivers/video/backlight/tosa_bl.c
@@ -134,28 +134,27 @@ static int tosa_bl_remove(struct i2c_client *client)
return 0;
}

-#ifdef CONFIG_PM
-static int tosa_bl_suspend(struct i2c_client *client, pm_message_t pm)
+#ifdef CONFIG_PM_SLEEP
+static int tosa_bl_suspend(struct device *dev)
{
- struct tosa_bl_data *data = i2c_get_clientdata(client);
+ struct tosa_bl_data *data = dev_get_drvdata(dev);

tosa_bl_set_backlight(data, 0);

return 0;
}

-static int tosa_bl_resume(struct i2c_client *client)
+static int tosa_bl_resume(struct device *dev)
{
- struct tosa_bl_data *data = i2c_get_clientdata(client);
+ struct tosa_bl_data *data = dev_get_drvdata(dev);

backlight_update_status(data->bl);
return 0;
}
-#else
-#define tosa_bl_suspend NULL
-#define tosa_bl_resume NULL
#endif

+static SIMPLE_DEV_PM_OPS(tosa_bl_pm_ops, tosa_bl_suspend, tosa_bl_resume);
+
static const struct i2c_device_id tosa_bl_id[] = {
{ "tosa-bl", 0 },
{ },
@@ -165,11 +164,10 @@ static struct i2c_driver tosa_bl_driver = {
.driver = {
.name = "tosa-bl",
.owner = THIS_MODULE,
+ .pm = &tosa_bl_pm_ops,
},
.probe = tosa_bl_probe,
.remove = tosa_bl_remove,
- .suspend = tosa_bl_suspend,
- .resume = tosa_bl_resume,
.id_table = tosa_bl_id,
};

diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index 666fe25..bf08157 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -240,19 +240,19 @@ static int tosa_lcd_remove(struct spi_device *spi)
return 0;
}

-#ifdef CONFIG_PM
-static int tosa_lcd_suspend(struct spi_device *spi, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int tosa_lcd_suspend(struct device *dev)
{
- struct tosa_lcd_data *data = spi_get_drvdata(spi);
+ struct tosa_lcd_data *data = dev_get_drvdata(dev);

tosa_lcd_tg_off(data);

return 0;
}

-static int tosa_lcd_resume(struct spi_device *spi)
+static int tosa_lcd_resume(struct device *dev)
{
- struct tosa_lcd_data *data = spi_get_drvdata(spi);
+ struct tosa_lcd_data *data = dev_get_drvdata(dev);

tosa_lcd_tg_init(data);
if (POWER_IS_ON(data->lcd_power))
@@ -262,20 +262,18 @@ static int tosa_lcd_resume(struct spi_device *spi)

return 0;
}
-#else
-#define tosa_lcd_suspend NULL
-#define tosa_lcd_resume NULL
#endif

+static SIMPLE_DEV_PM_OPS(tosa_lcd_pm_ops, tosa_lcd_suspend, tosa_lcd_resume);
+
static struct spi_driver tosa_lcd_driver = {
.driver = {
.name = "tosa-lcd",
.owner = THIS_MODULE,
+ .pm = &tosa_lcd_pm_ops,
},
.probe = tosa_lcd_probe,
.remove = tosa_lcd_remove,
- .suspend = tosa_lcd_suspend,
- .resume = tosa_lcd_resume,
};

module_spi_driver(tosa_lcd_driver);
--
1.7.2.5

2013-04-17 01:04:58

by Jingoo Han

[permalink] [raw]
Subject: [PATCH RESEND 3/3] backlight: vgg2432a4: convert vgg2432a4_driver to dev_pm_ops

Instead of using legacy suspend/resume methods, using newer dev_pm_ops
structure allows better control over power management. Also, use of
pm_message_t is deprecated. Thus, it is removed.

Signed-off-by: Jingoo Han <[email protected]>
---
drivers/video/backlight/ili9320.c | 24 +++++++++---------------
drivers/video/backlight/ili9320.h | 2 +-
drivers/video/backlight/vgg2432a4.c | 18 ++++++++----------
3 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c
index c3a5299..f8be90c 100644
--- a/drivers/video/backlight/ili9320.c
+++ b/drivers/video/backlight/ili9320.c
@@ -270,27 +270,21 @@ int ili9320_remove(struct ili9320 *ili)
}
EXPORT_SYMBOL_GPL(ili9320_remove);

-#ifdef CONFIG_PM
-int ili9320_suspend(struct ili9320 *lcd, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+int ili9320_suspend(struct ili9320 *lcd)
{
int ret;

- dev_dbg(lcd->dev, "%s: event %d\n", __func__, state.event);
+ ret = ili9320_power(lcd, FB_BLANK_POWERDOWN);

- if (state.event == PM_EVENT_SUSPEND) {
- ret = ili9320_power(lcd, FB_BLANK_POWERDOWN);
-
- if (lcd->platdata->suspend == ILI9320_SUSPEND_DEEP) {
- ili9320_write(lcd, ILI9320_POWER1, lcd->power1 |
- ILI9320_POWER1_SLP |
- ILI9320_POWER1_DSTB);
- lcd->initialised = 0;
- }
-
- return ret;
+ if (lcd->platdata->suspend == ILI9320_SUSPEND_DEEP) {
+ ili9320_write(lcd, ILI9320_POWER1, lcd->power1 |
+ ILI9320_POWER1_SLP |
+ ILI9320_POWER1_DSTB);
+ lcd->initialised = 0;
}

- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(ili9320_suspend);

diff --git a/drivers/video/backlight/ili9320.h b/drivers/video/backlight/ili9320.h
index e0db738..42329e7 100644
--- a/drivers/video/backlight/ili9320.h
+++ b/drivers/video/backlight/ili9320.h
@@ -76,5 +76,5 @@ extern void ili9320_shutdown(struct ili9320 *lcd);

/* PM */

-extern int ili9320_suspend(struct ili9320 *lcd, pm_message_t state);
+extern int ili9320_suspend(struct ili9320 *lcd);
extern int ili9320_resume(struct ili9320 *lcd);
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index 84d582f..d538947 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -205,18 +205,15 @@ static int vgg2432a4_lcd_init(struct ili9320 *lcd,
return ret;
}

-#ifdef CONFIG_PM
-static int vgg2432a4_suspend(struct spi_device *spi, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int vgg2432a4_suspend(struct device *dev)
{
- return ili9320_suspend(spi_get_drvdata(spi), state);
+ return ili9320_suspend(dev_get_drvdata(dev));
}
-static int vgg2432a4_resume(struct spi_device *spi)
+static int vgg2432a4_resume(struct device *dev)
{
- return ili9320_resume(spi_get_drvdata(spi));
+ return ili9320_resume(dev_get_drvdata(dev));
}
-#else
-#define vgg2432a4_suspend NULL
-#define vgg2432a4_resume NULL
#endif

static struct ili9320_client vgg2432a4_client = {
@@ -249,16 +246,17 @@ static void vgg2432a4_shutdown(struct spi_device *spi)
ili9320_shutdown(spi_get_drvdata(spi));
}

+static SIMPLE_DEV_PM_OPS(vgg2432a4_pm_ops, vgg2432a4_suspend, vgg2432a4_resume);
+
static struct spi_driver vgg2432a4_driver = {
.driver = {
.name = "VGG2432A4",
.owner = THIS_MODULE,
+ .pm = &vgg2432a4_pm_ops,
},
.probe = vgg2432a4_probe,
.remove = vgg2432a4_remove,
.shutdown = vgg2432a4_shutdown,
- .suspend = vgg2432a4_suspend,
- .resume = vgg2432a4_resume,
};

module_spi_driver(vgg2432a4_driver);
--
1.7.2.5