Skip to contentSkip to conversation

backlight: Add backlight driver for Bachmann's ot200

PATCH In review Christian Gmeiner 2 participants 2 messages Feb 1, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 backlight: Add backlight driver for Bachmann's ot200

Quoted 1 line

From dc2c282a4af25fccdadf87f5cb8f4b4d5721bfc0 Mon Sep 17 00:00:00 2001

From: Christian Gmeiner <[email protected]>
Date: Wed, 1 Feb 2012 10:04:13 +0100
Subject: [PATCH v2] backlight: Add backlight driver for Bachmann's ot200

Add backlight driver for Bachmann's ot200 visualisation device. The driver uses MFGPT 7 of CS5535 silicon to regulate the backlight.

Changes in v2:
- incorporated feedback from Andres Salomon

---
 drivers/video/backlight/Kconfig    |    7 ++
 drivers/video/backlight/Makefile   |    2 +-
 drivers/video/backlight/ot200_bl.c |  175 ++++++++++++++++++++++++++++++++++++
 3 files changed, 183 insertions(+), 1 deletions(-)
 create mode 100644 drivers/video/backlight/ot200_bl.c
drivers/video/backlight/Kconfig +7 -0
index 681b369..ecc8d7a 100644
@@ -334,6 +334,13 @@ config BACKLIGHT_AAT2870
 	  If you have a AnalogicTech AAT2870 say Y to enable the
 	  backlight driver.
 
+config BACKLIGHT_OT200
+	tristate "Backlight driver for ot200 visualisation device"
+	depends on BACKLIGHT_CLASS_DEVICE && CS5535_MFGPT
+	help
+	  To compile this driver as a module, choose M here: the module will be
+	  called ot200_bl.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endif # BACKLIGHT_LCD_SUPPORT
drivers/video/backlight/Makefile +1 -1
index af5cf65..c9352ac 100644
@@ -38,4 +38,4 @@ obj-$(CONFIG_BACKLIGHT_ADP8870)	+= adp8870_bl.o
 obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)	+= pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o
-
+obj-$(CONFIG_BACKLIGHT_OT200) += ot200_bl.o
drivers/video/backlight/ot200_bl.c new file +175 -0

175 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 2 lines · On Wed, 01 Feb 2012 19:48:57 +0100 Christian Gmeiner…

Add backlight driver for Bachmann's ot200 visualisation device. The driver uses MFGPT 7 of CS5535 silicon to regulate the backlight.

Looks OK to me. A couple of little tweaks:

+++ a/drivers/video/backlight/ot200_bl.c
@@ -19,15 +19,15 @@
static struct cs5535_mfgpt_timer *pwm_timer;

/* this array defines the mapping of brightness in % to pwm frequency */
-static const u8 dim_table[101] = {0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,

-				   2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
-				   4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9,
-				   10, 10, 11, 11, 12, 12, 13, 14, 15, 15, 16,
-				   17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28,
-				   30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 50,
-				   53, 55, 58, 61, 65, 68, 72, 75, 79, 84, 88,
-				   93, 97, 103, 108, 114, 120, 126, 133, 140,
-				   147, 155, 163};
+static const u8 dim_table[101] = {0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
+				  2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
+				  4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9,
+				  10, 10, 11, 11, 12, 12, 13, 14, 15, 15, 16,
+				  17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28,
+				  30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 50,
+				  53, 55, 58, 61, 65, 68, 72, 75, 79, 84, 88,
+				  93, 97, 103, 108, 114, 120, 126, 133, 140,
+				  147, 155, 163};

struct ot200_backlight_data {
int current_brightness;
@@ -51,7 +51,7 @@ static int ot200_backlight_update_status
/* enable or disable PWM timer */
if (brightness == 0)
cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, 0);
- else if (brightness != 0 && data->current_brightness == 0) {
+ else if (data->current_brightness == 0) {
cs5535_mfgpt_write(pwm_timer, MFGPT_REG_COUNTER, 0); cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP,
MFGPT_SETUP_CNTEN);
_