[PATCH] backlight: enable backlight in 88pm860x

Haojian Zhuang haojian.zhuang at marvell.com
Mon Nov 9 12:41:07 EST 2009


At most, three backlight device can be supported in 88pm860x driver.

Signed-off-by: Haojian Zhuang <haojian.zhuang at marvell.com>
---
 drivers/video/backlight/88pm860x_bl.c |  311 +++++++++++++++++++++++++++++=
++++
 drivers/video/backlight/Kconfig       |    6 +
 drivers/video/backlight/Makefile      |    1 +
 3 files changed, 318 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/backlight/88pm860x_bl.c

diff --git a/drivers/video/backlight/88pm860x_bl.c
b/drivers/video/backlight/88pm860x_bl.c
new file mode 100644
index 0000000..d6a4e97
--- /dev/null
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -0,0 +1,311 @@
+/*
+ * Backlight driver for Marvell Semiconductor 88PM8606
+ *
+ * Copyright (C) 2009 Marvell International Ltd.
+ *	Haojian Zhuang <haojian.zhuang at marvell.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/mfd/88pm860x.h>
+
+#define MAX_BRIGHTNESS		(0xFF)
+#define MIN_BRIGHTNESS		(0)
+
+#define CURRENT_MASK		(0x1F << 1)
+
+struct pm860x_backlight_data {
+	struct pm860x_chip *chip;
+	int	current_brightness;
+	int	port;
+	int	pwm;
+	int	iset;
+};
+
+static inline int wled_a(int port)
+{
+	int ret;
+
+	ret =3D ((port - PM8606_BACKLIGHT1) << 1) + 2;
+	return ret;
+}
+
+static inline int wled_b(int port)
+{
+	int ret;
+
+	ret =3D ((port - PM8606_BACKLIGHT1) << 1) + 3;
+	return ret;
+}
+
+/* WLED2 & WLED3 share the same IDC */
+static inline int wled_idc(int port)
+{
+	int ret;
+
+	switch (port) {
+	case PM8606_BACKLIGHT1:
+	case PM8606_BACKLIGHT2:
+		ret =3D ((port - PM8606_BACKLIGHT1) << 1) + 3;
+		break;
+	case PM8606_BACKLIGHT3:
+	default:
+		ret =3D ((port - PM8606_BACKLIGHT2) << 1) + 3;
+		break;
+	}
+	return ret;
+}
+
+static int pm860x_backlight_set(struct backlight_device *bl, int brightnes=
s)
+{
+	struct pm860x_backlight_data *data =3D bl_get_data(bl);
+	struct pm860x_chip *chip =3D data->chip;
+	unsigned char value;
+	int ret;
+
+	if (brightness > MAX_BRIGHTNESS)
+		value =3D MAX_BRIGHTNESS;
+	else
+		value =3D brightness;
+
+	ret =3D pm860x_reg_write(chip->parent, DESC_8606,
+			       wled_a(data->port), value);
+	if (ret < 0)
+		goto out;
+
+	if ((data->current_brightness =3D=3D 0) && brightness) {
+		if (data->iset) {
+			ret =3D pm860x_set_bits(chip->parent, DESC_8606,
+					      wled_idc(data->port),
+					      CURRENT_MASK, data->iset);
+			if (ret < 0)
+				goto out;
+		}
+		if (data->pwm) {
+			ret =3D pm860x_set_bits(chip->parent, DESC_8606,
+					      PM8606_PWM, PM8606_PWM_FREQ_MASK,
+					      data->pwm);
+			if (ret < 0)
+				goto out;
+		}
+		if (brightness =3D=3D MAX_BRIGHTNESS) {
+			/* set WLED_ON bit as 100% */
+			ret =3D pm860x_set_bits(chip->parent, DESC_8606,
+					      wled_b(data->port),
+					      PM8606_WLED_ON, PM8606_WLED_ON);
+		}
+	} else {
+		if (brightness =3D=3D MAX_BRIGHTNESS) {
+			/* set WLED_ON bit as 100% */
+			ret =3D pm860x_set_bits(chip->parent, DESC_8606,
+					      wled_b(data->port),
+					      PM8606_WLED_ON, PM8606_WLED_ON);
+		} else {
+			/* clear WLED_ON bit since it's not 100% */
+			ret =3D pm860x_set_bits(chip->parent, DESC_8606,
+					      wled_b(data->port),
+					      PM8606_WLED_ON, 0);
+		}
+	}
+	if (ret < 0)
+		goto out;
+
+	dev_dbg(chip->dev, "set brightness %d\n", value);
+	data->current_brightness =3D value;
+	return 0;
+out:
+	dev_dbg(chip->dev, "set brightness %d failure with return "
+		"value:%d\n", value, ret);
+	return ret;
+}
+
+static int pm860x_backlight_update_status(struct backlight_device *bl)
+{
+	int brightness =3D bl->props.brightness;
+
+	if (bl->props.power !=3D FB_BLANK_UNBLANK)
+		brightness =3D 0;
+
+	if (bl->props.fb_blank !=3D FB_BLANK_UNBLANK)
+		brightness =3D 0;
+
+	if (bl->props.state & BL_CORE_SUSPENDED)
+		brightness =3D 0;
+
+	return pm860x_backlight_set(bl, brightness);
+}
+
+static int pm860x_backlight_get_brightness(struct backlight_device *bl)
+{
+	struct pm860x_backlight_data *data =3D bl_get_data(bl);
+	struct pm860x_chip *chip =3D data->chip;
+	int ret;
+
+	ret =3D pm860x_reg_read(chip->parent, DESC_8606,
+			      wled_a(data->port));
+	if (ret < 0)
+		goto out;
+	data->current_brightness =3D ret;
+	dev_dbg(chip->dev, "get brightness %d\n", data->current_brightness);
+	return data->current_brightness;
+out:
+	return -EINVAL;
+}
+
+static struct backlight_ops pm860x_backlight_ops =3D {
+	.options	=3D BL_CORE_SUSPENDRESUME,
+	.update_status	=3D pm860x_backlight_update_status,
+	.get_brightness	=3D pm860x_backlight_get_brightness,
+};
+
+static int __check_device(struct pm860x_backlight_pdata *pdata, char *name=
)
+{
+	struct pm860x_backlight_pdata *p =3D pdata;
+	int ret =3D -EINVAL;
+
+	while (p && p->id) {
+		if ((p->id !=3D PM8606_ID_BACKLIGHT) || (p->flags < 0))
+			break;
+
+		if (!strncmp(name, pm860x_backlight_name[p->flags],
+			MFD_NAME_SIZE)) {
+			ret =3D (int)p->flags;
+			break;
+		}
+		p++;
+	}
+	return ret;
+}
+
+static int pm860x_backlight_probe(struct platform_device *pdev)
+{
+	struct pm860x_chip *chip =3D dev_get_drvdata(pdev->dev.parent);
+	struct pm860x_plat_data *pm860x_pdata;
+	struct pm860x_backlight_pdata *pdata;
+	struct pm860x_backlight_data *data;
+	struct backlight_device *bl;
+	struct resource *res;
+	unsigned char value;
+	char name[MFD_NAME_SIZE];
+	int ret;
+
+	res =3D platform_get_resource(pdev, IORESOURCE_IO, 0);
+	if (res =3D=3D NULL) {
+		dev_err(&pdev->dev, "No I/O resource!\n");
+		return -EINVAL;
+	}
+
+	if (pdev->dev.parent->platform_data) {
+		pm860x_pdata =3D pdev->dev.parent->platform_data;
+		pdata =3D pm860x_pdata->backlight;
+	} else
+		pdata =3D NULL;
+
+	if (pdata =3D=3D NULL) {
+		dev_err(&pdev->dev, "platform data isn't assigned to "
+			"backlight\n");
+		return -EINVAL;
+	}
+
+	data =3D kzalloc(sizeof(struct pm860x_backlight_data), GFP_KERNEL);
+	if (data =3D=3D NULL)
+		return -ENOMEM;
+	strncpy(name, res->name, MFD_NAME_SIZE);
+	data->chip =3D chip;
+	data->current_brightness =3D MAX_BRIGHTNESS;
+	data->pwm =3D pdata->pwm;
+	data->iset =3D pdata->iset;
+	data->port =3D __check_device(pdata, name);
+	if (data->port < 0) {
+		dev_err(&pdev->dev, "wrong platform data is assigned");
+		return -EINVAL;
+	}
+
+	bl =3D backlight_device_register(name, &pdev->dev, data,
+					&pm860x_backlight_ops);
+	if (IS_ERR(bl)) {
+		dev_err(&pdev->dev, "failed to register backlight\n");
+		kfree(data);
+		return PTR_ERR(bl);
+	}
+	bl->props.max_brightness =3D MAX_BRIGHTNESS;
+	bl->props.brightness =3D MAX_BRIGHTNESS;
+
+	platform_set_drvdata(pdev, bl);
+
+	/* Enable reference VSYS */
+	ret =3D pm860x_reg_read(chip->parent, DESC_8606, PM8606_VSYS);
+	if (ret < 0)
+		goto out;
+	if ((ret & PM8606_VSYS_EN) =3D=3D 0) {
+		value =3D ret | PM8606_VSYS_EN;
+		ret =3D pm860x_reg_write(chip->parent, DESC_8606, PM8606_VSYS,
+				       value);
+		if (ret < 0)
+			goto out;
+	}
+	/* Enable reference OSC */
+	ret =3D pm860x_reg_read(chip->parent, DESC_8606, PM8606_MISC);
+	if (ret < 0)
+		goto out;
+	if ((ret & PM8606_MISC_OSC_EN) =3D=3D 0) {
+		value =3D ret | PM8606_MISC_OSC_EN;
+		ret =3D pm860x_reg_write(chip->parent, DESC_8606, PM8606_MISC,
+				       value);
+		if (ret < 0)
+			goto out;
+	}
+	/* read current backlight */
+	ret =3D pm860x_backlight_get_brightness(bl);
+	if (ret < 0)
+		goto out;
+
+	backlight_update_status(bl);
+	return 0;
+out:
+	kfree(data);
+	return ret;
+}
+
+static int pm860x_backlight_remove(struct platform_device *pdev)
+{
+	struct backlight_device *bl =3D platform_get_drvdata(pdev);
+	struct pm860x_backlight_data *data =3D bl_get_data(bl);
+
+	backlight_device_unregister(bl);
+	kfree(data);
+	return 0;
+}
+
+static struct platform_driver pm860x_backlight_driver =3D {
+	.driver		=3D {
+		.name	=3D "88pm860x-backlight",
+		.owner	=3D THIS_MODULE,
+	},
+	.probe		=3D pm860x_backlight_probe,
+	.remove		=3D pm860x_backlight_remove,
+};
+
+static int __init pm860x_backlight_init(void)
+{
+	return platform_driver_register(&pm860x_backlight_driver);
+}
+module_init(pm860x_backlight_init);
+
+static void __exit pm860x_backlight_exit(void)
+{
+	platform_driver_unregister(&pm860x_backlight_driver);
+}
+module_exit(pm860x_backlight_exit);
+
+MODULE_DESCRIPTION("Backlight Driver for Marvell Semiconductor 88PM8606");
+MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang at marvell.com>");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:88pm860x-backlight");
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kcon=
fig
index 09bfa96..bb760a6 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -262,3 +262,9 @@ config BACKLIGHT_ADP5520
 	  To compile this driver as a module, choose M here: the module will
 	  be called adp5520_bl.

+config BACKLIGHT_88PM860X
+	bool "Backlight Driver for 88PM8606 using WLED"
+	depends on BACKLIGHT_CLASS_DEVICE && MFD_88PM860X
+	help
+	  Say Y to enable the backlight driver for Marvell 88PM8606.
+
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Mak=
efile
index 9a40554..802d467 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -28,4 +28,5 @@ obj-$(CONFIG_BACKLIGHT_SAHARA)	+=3D kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X)	+=3D wm831x_bl.o
 obj-$(CONFIG_BACKLIGHT_ADX)    +=3D adx_bl.o
 obj-$(CONFIG_BACKLIGHT_ADP5520)	+=3D adp5520_bl.o
+obj-$(CONFIG_BACKLIGHT_88PM860X) +=3D 88pm860x_bl.o

--=20
1.5.6.5

--0016e64ea9289d6d3c04788b422b
Content-Type: text/x-patch; charset=US-ASCII; 
	name="0007-backlight-enable-backlight-in-88pm860x.patch"
Content-Disposition: attachment; 
	filename="0007-backlight-enable-backlight-in-88pm860x.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_g24r308n0

RnJvbSAyYzJjMjk2YzA4Njk4YzBiYzAwZWY2MWNlODdiZmI0NzA1MGMxNjYyIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBIYW9qaWFuIFpodWFuZyA8aGFvamlhbi56aHVhbmdAbWFydmVs
bC5jb20+CkRhdGU6IE1vbiwgOSBOb3YgMjAwOSAxMjo0MTowNyAtMDUwMApTdWJqZWN0OiBbUEFU
Q0hdIGJhY2tsaWdodDogZW5hYmxlIGJhY2tsaWdodCBpbiA4OHBtODYweAoKQXQgbW9zdCwgdGhy
ZWUgYmFja2xpZ2h0IGRldmljZSBjYW4gYmUgc3VwcG9ydGVkIGluIDg4cG04NjB4IGRyaXZlci4K
ClNpZ25lZC1vZmYtYnk6IEhhb2ppYW4gWmh1YW5nIDxoYW9qaWFuLnpodWFuZ0BtYXJ2ZWxsLmNv
bT4KLS0tCiBkcml2ZXJzL3ZpZGVvL2JhY2tsaWdodC84OHBtODYweF9ibC5jIHwgIDMxMSArKysr
KysrKysrKysrKysrKysrKysrKysrKysrKysrKysKIGRyaXZlcnMvdm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mlsZQorKysgYi9kcml2ZXJzL3ZpZGVvL2Jh
Y2tsaWdodC9NYWtlZmlsZQpAQCAtMjgsNCArMjgsNSBAQCBvYmotJChDT05GSUdfQkFDS0xJR0hU
X1NBSEFSQSkJKz0ga2IzODg2X2JsLm8KIG9iai0kKENPTkZJR19CQUNLTElHSFRfV004MzFYKQkr
PSB3bTgzMXhfYmwubwogb2JqLSQoQ09ORklHX0JBQ0tMSUdIVF9BRFgpICAgICs9IGFkeF9ibC5v
CiBvYmotJChDT05GSUdfQkFDS0xJR0hUX0FEUDU1MjApCSs9IGFkcDU1MjBfYmwubworb2JqLSQo
Q09ORklHX0JBQ0tMSUdIVF84OFBNODYwWCkgKz0gODhwbTg2MHhfYmwubwogCi0tIAoxLjUuNi41
Cgo=
--0016e64ea9289d6d3c04788b422b--



More information about the linux-arm-kernel mailing list