From: Bryan Wu <bryan.wu@canonical.com>
To: tomi.valkeinen@nokia.com, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, gadiyar@ti.com,
rpurdie@rpsys.net
Subject: [PATCH 1/3] Backlight: driver for Sharp LS037V7DW01 panel on OMAP machine
Date: Tue, 30 Nov 2010 20:07:38 +0800 [thread overview]
Message-ID: <1291118860-10325-2-git-send-email-bryan.wu@canonical.com> (raw)
In-Reply-To: <1291118860-10325-1-git-send-email-bryan.wu@canonical.com>
This driver is split from drivers/video/backlight/sharp_ls037v7dw01.c
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
drivers/video/backlight/Kconfig | 10 ++
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/sharp_ls037v7dw01.c | 144 +++++++++++++++++++++++++++
3 files changed, 155 insertions(+), 0 deletions(-)
create mode 100644 drivers/video/backlight/sharp_ls037v7dw01.c
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index e54a337..46b2415 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -307,6 +307,16 @@ config BACKLIGHT_PCF50633
If you have a backlight driven by a NXP PCF50633 MFD, say Y here to
enable its driver.
+config BACKLIGHT_SHARP_LS037V7DW01
+ tristate "Backlight driver for SHARP LS037V7DW01 Panel"
+ depends on PANEL_GENERIC_DPI
+ help
+ If you are using Sharp LS037V7DW01 LCD panel, say Y here to enable this driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sharp_ls037v7dw01.
+
+
endif # BACKLIGHT_CLASS_DEVICE
endif # BACKLIGHT_LCD_SUPPORT
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 44c0f81..c756f49 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -35,4 +35,5 @@ obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o
obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o
obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o
obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
+obj-$(CONFIG_BACKLIGHT_SHARP_LS037V7DW01) += sharp_ls037v7dw01.o
diff --git a/drivers/video/backlight/sharp_ls037v7dw01.c b/drivers/video/backlight/sharp_ls037v7dw01.c
new file mode 100644
index 0000000..e90595e
--- /dev/null
+++ b/drivers/video/backlight/sharp_ls037v7dw01.c
@@ -0,0 +1,144 @@
+/*
+ * Backlight driver for Sharp LS037V7DW01
+ *
+ * Copyright (C) 2010 Canonical Ltd.
+ * Author: Bryan Wu <bryan.wu@canonical.com>
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ * Author: Tomi Valkeinen <tomi.valkeinen@nokia.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.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/backlight.h>
+#include <linux/fb.h>
+#include <linux/err.h>
+
+/* This OMAP platform header file is required by this driver */
+#include <plat/display.h>
+
+static int sharp_ls_bl_update_status(struct backlight_device *bl)
+{
+ struct omap_dss_device *dssdev = bl_get_data(bl);
+ int level;
+
+ if (!dssdev->set_backlight)
+ return -EINVAL;
+
+ if (bl->props.fb_blank == FB_BLANK_UNBLANK &&
+ bl->props.power == FB_BLANK_UNBLANK)
+ level = bl->props.brightness;
+ else
+ level = 0;
+
+ return dssdev->set_backlight(dssdev, level);
+}
+
+static int sharp_ls_bl_get_brightness(struct backlight_device *bl)
+{
+ if (bl->props.fb_blank == FB_BLANK_UNBLANK &&
+ bl->props.power == FB_BLANK_UNBLANK)
+ return bl->props.brightness;
+
+ return 0;
+}
+
+static const struct backlight_ops sharp_ls_bl_ops = {
+ .get_brightness = sharp_ls_bl_get_brightness,
+ .update_status = sharp_ls_bl_update_status,
+};
+
+static int __devinit sharp_ls_bl_probe(struct platform_device *pdev)
+{
+ struct backlight_properties props;
+ struct backlight_device *bl;
+ struct omap_dss_device *dssdev = pdev->dev.platform_data;
+
+ if (!dssdev)
+ return -EINVAL;
+
+ memset(&props, 0, sizeof(struct backlight_properties));
+ props.max_brightness = dssdev->max_backlight_level;
+
+ bl = backlight_device_register("sharp-ls-bl", &dssdev->dev, dssdev,
+ &sharp_ls_bl_ops, &props);
+ if (IS_ERR(bl))
+ return PTR_ERR(bl);
+
+ bl->props.fb_blank = FB_BLANK_UNBLANK;
+ bl->props.power = FB_BLANK_UNBLANK;
+ bl->props.brightness = dssdev->max_backlight_level;
+ backlight_update_status(bl);
+
+ platform_set_drvdata(pdev, bl);
+ return 0;
+}
+
+static int __devexit sharp_ls_bl_remove(struct platform_device *pdev)
+{
+ struct backlight_device *bl = platform_get_drvdata(pdev);
+
+ bl->props.power = FB_BLANK_POWERDOWN;
+ backlight_update_status(bl);
+ backlight_device_unregister(bl);
+
+ return 0;
+}
+
+#ifdef CONFIG_PM
+static int sharp_ls_bl_suspend(struct platform_device *dev, pm_message_t state)
+{
+ return 0;
+}
+
+static int sharp_ls_bl_resume(struct platform_device *dev)
+{
+ struct backlight_device *bl = platform_get_drvdata(dev);
+
+ backlight_update_status(bl);
+ return 0;
+}
+#else
+#define sharp_ls_bl_suspend NULL
+#define sharp_ls_bl_resume NULL
+#endif
+
+static struct platform_driver sharp_ls_bl_driver = {
+ .driver = {
+ .name = "sharp-ls-bl",
+ .owner = THIS_MODULE,
+ },
+ .probe = sharp_ls_bl_probe,
+ .remove = __devexit_p(sharp_ls_bl_remove),
+ .suspend = sharp_ls_bl_suspend,
+ .resume = sharp_ls_bl_resume,
+};
+
+static int __init sharp_ls_bl_init(void)
+{
+ return platform_driver_register(&sharp_ls_bl_driver);
+}
+module_init(sharp_ls_bl_init);
+
+static void __exit sharp_ls_bl_exit(void)
+{
+ platform_driver_unregister(&sharp_ls_bl_driver);
+}
+module_exit(sharp_ls_bl_exit);
+
+MODULE_DESCRIPTION("Sharp LS037V7DW01 Backlight Driver");
+MODULE_AUTHOR("Bryan Wu <bryan.wu@canonical.com>");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:sharp-ls-bl");
--
1.7.1
next prev parent reply other threads:[~2010-11-30 12:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-30 12:07 [PATCH 0/3] OMAP: Introduce Backlight driver for Sharp LS037V7DW01 LCD panel Bryan Wu
2010-11-30 12:07 ` Bryan Wu [this message]
2010-11-30 13:09 ` [PATCH 1/3] Backlight: driver for Sharp LS037V7DW01 panel on OMAP machine Janorkar, Mayuresh
2010-12-01 14:21 ` Bryan Wu
2010-11-30 12:07 ` [PATCH 2/3] OMAP: move Sharp LS LCD panel device to generic DPI panel driver and new backlight driver Bryan Wu
2010-11-30 12:07 ` [PATCH 3/3] OMAP: DSS2: remove Sharp LS037V7DW01 panel driver Bryan Wu
2010-12-01 15:32 ` [PATCH 0/3] OMAP: Introduce Backlight driver for Sharp LS037V7DW01 LCD panel Tomi Valkeinen
2010-12-06 5:06 ` Bryan Wu
2010-12-14 13:53 ` Tomi Valkeinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291118860-10325-2-git-send-email-bryan.wu@canonical.com \
--to=bryan.wu@canonical.com \
--cc=gadiyar@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=rpurdie@rpsys.net \
--cc=tomi.valkeinen@nokia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox