All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: ARM CLCD: Added dt support to set tim2 register
@ 2015-02-25 21:01 ` Arun Ramamurthy
  0 siblings, 0 replies; 82+ messages in thread
From: Arun Ramamurthy @ 2015-02-25 21:01 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Russell King, Jean-Christophe Plagniol-Villard, Tomi Valkeinen
  Cc: devicetree, linux-kernel, linux-fbdev, Dmitry Torokhov,
	Anatol Pomazau, Jonathan Richardson, Scott Branden, Ray Jui,
	bcm-kernel-feedback-list, Arun Ramamurthy

Added code based on linaro tree:
http://git.linaro.org/kernel/linux-linaro-stable.git
with commit id:6846e7822c4cab5a84672baace3b768c2d0db142
at drivers/video/amba-clcd.c. This lets the driver set
certain tim2 register bits after reading them from
device tree.

Reviewed-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Arun Ramamurthy <arun.ramamurthy@broadcom.com>
---
 .../devicetree/bindings/video/arm,pl11x.txt        | 17 ++++++++-
 drivers/video/fbdev/amba-clcd.c                    | 41 ++++++++++++++++++++++
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/video/arm,pl11x.txt b/Documentation/devicetree/bindings/video/arm,pl11x.txt
index 3e3039a..14d6f87 100644
--- a/Documentation/devicetree/bindings/video/arm,pl11x.txt
+++ b/Documentation/devicetree/bindings/video/arm,pl11x.txt
@@ -35,6 +35,21 @@ Optional properties:
 	cell's memory interface can handle; if not present, the memory
 	interface is fast enough to handle all possible video modes
 
+- tim2: Used to set certain bits in LCDTiming2 register.
+	It can be TIM2_CLKSEL or TIM2_IOE or both
+
+	TIM2_CLKSEL: This bit drives the CLCDCLKSEL signal. It is the select
+	signal for the external LCD clock multiplexor.
+
+	TIM2_IOE: Invert output enable:
+	0 = CLAC output pin is active HIGH in TFT mode
+	1 = CLAC output pin is active LOW in TFT mode.
+	This bit selects the active polarity of the output enable signal in
+	TFT mode. In this mode, the CLAC pin is an enable that indicates to
+	the LCD panel when valid display data is available. In active
+	display mode, data is driven onto the LCD data lines at the
+	programmed edge of CLCP when CLAC is in its active state.
+
 Required sub-nodes:
 
 - port: describes LCD panel signals, following the common binding
@@ -76,7 +91,7 @@ Example:
 		clocks = <&oscclk1>, <&oscclk2>;
 		clock-names = "clcdclk", "apb_pclk";
 		max-memory-bandwidth = <94371840>; /* Bps, 1024x768@60 16bpp */
-
+		tim2 = "TIM2_CLKSEL";
 		port {
 			clcd_pads: endpoint {
 				remote-endpoint = <&clcd_panel>;
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c
index 32c0b6b..4e4e50f 100644
--- a/drivers/video/fbdev/amba-clcd.c
+++ b/drivers/video/fbdev/amba-clcd.c
@@ -41,6 +41,44 @@
 /* This is limited to 16 characters when displayed by X startup */
 static const char *clcd_name = "CLCD FB";
 
+struct string_lookup {
+	const char	*string;
+	const u32	val;
+};
+
+static const struct string_lookup tim2_lookups[] = {
+	{ "TIM2_CLKSEL",	TIM2_CLKSEL},
+	{ "TIM2_IOE",		TIM2_IOE},
+	{ NULL, 0},
+};
+
+static u32 parse_setting(const struct string_lookup *lookup, const char *name)
+{
+	int i = 0;
+
+	while (lookup[i].string != NULL) {
+		if (strcmp(lookup[i].string, name) == 0)
+			return lookup[i].val;
+		++i;
+	}
+	return 0;
+}
+
+static u32 get_string_lookup(struct device_node *node, const char *name,
+		      const struct string_lookup *lookup)
+{
+	const char *string;
+	int count, i;
+	u32 ret = 0;
+
+	count = of_property_count_strings(node, name);
+	if (count >= 0)
+		for (i = 0; i < count; i++)
+			if (of_property_read_string_index(node, name, i,
+					&string) == 0)
+				ret |= parse_setting(lookup, string);
+	return ret;
+}
 /*
  * Unfortunately, the enable/disable functions may be called either from
  * process or IRQ context, and we _need_ to delay.  This is _not_ good.
@@ -626,6 +664,9 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0)
 	/* Bypass pixel clock divider, data output on the falling edge */
 	fb->panel->tim2 = TIM2_BCD | TIM2_IPC;
 
+	fb->panel->tim2 |= get_string_lookup(fb->dev->dev.of_node,
+					"tim2", tim2_lookups);
+
 	/* TFT display, vert. comp. interrupt at the start of the back porch */
 	fb->panel->cntl |= CNTL_LCDTFT | CNTL_LCDVCOMP(1);
 
-- 
2.3.0


^ permalink raw reply related	[flat|nested] 82+ messages in thread

end of thread, other threads:[~2016-02-17 17:42 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 21:01 [PATCH] video: ARM CLCD: Added dt support to set tim2 register Arun Ramamurthy
2015-02-25 21:01 ` Arun Ramamurthy
2015-02-25 21:01 ` Arun Ramamurthy
2015-02-25 21:01 ` [PATCH] video: ARM CLCD: Added support for FBIOPAN_DISPLAY and virtual y resolution Arun Ramamurthy
2015-02-25 21:01   ` Arun Ramamurthy
2015-02-25 21:01   ` Arun Ramamurthy
2015-03-02 16:08   ` Pawel Moll
2015-03-02 16:08     ` Pawel Moll
2015-03-02 16:11     ` Russell King - ARM Linux
2015-03-02 16:11       ` Russell King - ARM Linux
2015-03-02 16:11       ` Russell King - ARM Linux
2015-03-02 19:09       ` Arun Ramamurthy
2015-03-02 19:09         ` Arun Ramamurthy
2015-03-02 19:09         ` Arun Ramamurthy
2015-03-02 19:12         ` Russell King - ARM Linux
2015-03-02 19:12           ` Russell King - ARM Linux
2015-03-02 19:12           ` Russell King - ARM Linux
2015-03-02 23:22         ` Rob Herring
2015-03-02 23:22           ` Rob Herring
2015-03-02 23:22           ` Rob Herring
2015-03-04  0:31           ` Arun Ramamurthy
2015-03-04  0:31             ` Arun Ramamurthy
2015-03-04  0:31             ` Arun Ramamurthy
2015-02-25 21:01 ` [PATCH] video: ARM CLCD: Added support for FBIO_WAITFORVSYNC Arun Ramamurthy
2015-02-25 21:01   ` Arun Ramamurthy
2015-02-25 21:01   ` Arun Ramamurthy
2015-03-02 16:00   ` Pawel Moll
2015-03-02 16:00     ` Pawel Moll
2015-03-02 16:00     ` Pawel Moll
2015-03-02 19:09     ` Arun Ramamurthy
2015-03-02 19:09       ` Arun Ramamurthy
2015-03-02 19:09       ` Arun Ramamurthy
2015-03-03 10:01       ` Pawel Moll
2015-03-03 10:01         ` Pawel Moll
2015-03-03 10:01         ` Pawel Moll
2015-03-04  0:35         ` Arun Ramamurthy
2015-03-04  0:35           ` Arun Ramamurthy
2015-03-04  0:35           ` Arun Ramamurthy
2015-03-02 23:27     ` Rob Herring
2015-03-02 23:27       ` Rob Herring
2015-03-02 23:27       ` Rob Herring
2015-03-04  0:31       ` Arun Ramamurthy
2015-03-04  0:31         ` Arun Ramamurthy
2015-03-04  0:31         ` Arun Ramamurthy
2015-03-02 23:29   ` Rob Herring
2015-03-02 23:29     ` Rob Herring
2015-03-02 23:29     ` Rob Herring
2015-03-04  0:33     ` Arun Ramamurthy
2015-03-04  0:33       ` Arun Ramamurthy
2015-03-04  0:33       ` Arun Ramamurthy
2015-02-25 21:01 ` [PATCH] video: ARM CLCD: Correcting timing checks for STN and TFT dispalys Arun Ramamurthy
2015-02-25 21:01   ` Arun Ramamurthy
2015-02-25 21:01   ` Arun Ramamurthy
2015-03-02 16:11 ` [PATCH] video: ARM CLCD: Added dt support to set tim2 register Pawel Moll
2015-03-02 16:11   ` Pawel Moll
2015-03-02 16:11   ` Pawel Moll
2015-03-02 19:09   ` Arun Ramamurthy
2015-03-02 19:09     ` Arun Ramamurthy
2015-03-02 19:09     ` Arun Ramamurthy
2015-03-03 10:02     ` Pawel Moll
2015-03-03 10:02       ` Pawel Moll
2015-03-03 10:22       ` Pawel Moll
2015-03-03 10:22         ` Pawel Moll
2015-03-03 10:22         ` Pawel Moll
2015-03-04  0:37         ` Arun Ramamurthy
2015-03-04  0:37           ` Arun Ramamurthy
2015-03-04  0:37           ` Arun Ramamurthy
2015-03-05 10:59           ` Pawel Moll
2015-03-05 10:59             ` Pawel Moll
2015-03-09 16:16         ` Russell King - ARM Linux
2015-03-09 16:16           ` Russell King - ARM Linux
2015-03-09 16:16           ` Russell King - ARM Linux
2016-02-10 13:58 ` Linus Walleij
2016-02-10 13:58   ` Linus Walleij
2016-02-10 17:48   ` Ray Jui
2016-02-10 17:48     ` Ray Jui
2016-02-15 13:25     ` Linus Walleij
2016-02-15 13:25       ` Linus Walleij
2016-02-15 13:25       ` Linus Walleij
2016-02-16 19:32       ` Dmitry Torokhov
2016-02-17 17:42         ` Ray Jui
2016-02-17 17:42           ` Ray Jui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.