video: s3c-fb: Add device tree support
Subsystems (3)
PATCH 1/1 video: s3c-fb: Add device tree support
Add device tree based discovery support for Samsung's display controller.
--- .../devicetree/bindings/fb/samsung-fb.txt | 103 ++++++++++ drivers/video/s3c-fb.c | 209 +++++++++++++++++++- 2 files changed, 304 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/fb/samsung-fb.txt
Documentation/devicetree/bindings/fb/samsung-fb.txt new file +103 -0
@@ -0,0 +1,103 @@ +* Samsung Display Controller (Framebuffer) + +The display controller is used to transfer image data from memory to a +external LCD panel. It supports various color formats such as rgb, yuv +and I80. It also supports multiple window overlays. + +Required properties: +- compatible: should be one of the following + - samsung,exynos4210-fimd: for fimd compatible with Exynos4210 fimd + - samsung,s5pv210-fimd: for fimd compatible with s5pv210 fimd +- reg: physical base address of the controller and length of memory mapped + region. +- interrupts: Three interrupts should be specified. The format of the + interrupt specifier depends on the interrupt controller. The interrupts + should be specified in the following order. + - VSYNC (Video Frame) interrupt + - Video FIFO level interrupt + - FIMD System Interrupt +- gpios: The gpios used to interface with the external LCD panel. + +Overlays: Multiple overlays can be specified and child nodes. The order +of the overlay should be the lowest numbered overlay first. +- samsung,fimd-htiming: Specifies the horizontal timing for the overlay. + The horizontal timing includes four parameters in the following order. + - horizontal back porch (in number of lcd clocks) + - horizontal front porch (in number of lcd clocks) + - hsync pulse width (in number of lcd clocks) + - X resolution. +- samsung,fimd-vtiming: Specifies the vertical timing for the overlay. + The vertical timing includes four parameters in the following order. + - vertical back porch (in number of lcd lines) + - vertical front porch (in number of lcd lines) + - vsync pulse width (in number of lcd clocks) + - Y resolution. +- samsung,fimd-bpp: Specifies the bits per pixel. Two values should be + specified in the following order. + - max-bpp: maximum required bpp for the overlay. + - default-bpp: bpp supported by the overlay. +- samsung,fimd-virtres: Specifies the resolution of the virtual frame + buffer. The resolution contains the X and Y resolution with value + of X being the first. + +Optional properties: +- samsung,fimd-vidout-rgb: Video output format is RGB. +- samsung,fimd-inv-hsync: invert hsync pulse polarity. +- samsung,fimd-inv-vsync: invert vsync pulse polarity. +- samsung,fimd-inv-vclk: invert video clock polarity. +- samsung,fimd-inv-vden: invert video enable signal polarity. + +Example: + + fimd@11C00000 { + compatible = "samsung,exynos4210-fimd"; + interrupt-parent = <&combiner>; + reg = <0x11C00000 0x8000>; + interrupts = <11 1>, <11 0>, <11 2>; + + samsung,fimd-vidout-rgb; + samsung,fimd-inv-hsync; + samsung,fimd-inv-vsync; + samsung,fimd-inv-vclk; + + gpios = <&gpf0 0 2 0 0>, + <&gpf0 1 2 0 0>, + <&gpf0 2 2 0 0>, + <&gpf0 3 2 0 0>, + <&gpf0 4 2 0 0>, + <&gpf0 5 2 0 0>, + <&gpf0 6 2 0 0>, + <&gpf0 7 2 0 0>, + <&gpf1 0 2 0 0>, + <&gpf1 1 2 0 0>, + <&gpf1 2 2 0 0>, + <&gpf1 3 2 0 0>, + <&gpf1 4 2 0 0>, + <&gpf1 5 2 0 0>, + <&gpf1 6 2 0 0>, + <&gpf1 7 2 0 0>, + <&gpf2 0 2 0 0>, + <&gpf2 1 2 0 0>, + <&gpf2 2 2 0 0>, + <&gpf2 3 2 0 0>, + <&gpf2 4 2 0 0>, + <&gpf2 5 2 0 0>, + <&gpf2 6 2 0 0>, + <&gpf2 7 2 0 0>, + <&gpf3 0 2 0 0>, + <&gpf3 1 2 0 0>, + <&gpf3 2 2 0 0>, + <&gpf3 3 2 0 0>; + + fimd-overlay0 { + samsung,fimd-htiming = <64 16 48 1024>; + samsung,fimd-vtiming = <64 16 3 600>; + samsung,fimd-bpp = <24 32>; + }; + + fimd-overlay1 { + samsung,fimd-htiming = <64 16 48 200>; + samsung,fimd-vtiming = <64 16 3 100>; + samsung,fimd-bpp = <16 32>; + }; + };
drivers/video/s3c-fb.c +201 -8
289 lines not on this page · raw message
Signature · 1 line
1.6.6.rc2
PATCH 1/1 video: s3c-fb: Add device tree support
Quoted 3 lines · Thomas Abraham
+Required properties:
+- gpios: The gpios used to interface with the external LCD panel.
This isn't terribly informative for the user - which GPIOs and in what order are they specified? Looking at the code it looks like pin mux configuration so just some wording saying it's a list of pins to be used for the framebuffer function.
PATCH 1/1 video: s3c-fb: Add device tree support
Hi Mark,
Quoted 10 lines · Mark Brown
Quoted 3 lines · Thomas Abraham
+Required properties:
+- gpios: The gpios used to interface with the external LCD panel.
This isn't terribly informative for the user - which GPIOs and in what order are they specified? ?Looking at the code it looks like pin mux configuration so just some wording saying it's a list of pins to be used for the framebuffer function.
Ok. I will modify the sentence to mean that it is list of gpios used by framebuffer controller for data/timing interface with the lcd panel. Thanks for your review.
Regards,
Thomas.
PATCH 1/1 video: s3c-fb: Add device tree support
Quoted 10 lines · Thomas Abraham
On 10 January 2012 10:22, Mark Brown
Quoted 4 lines
This isn't terribly informative for the user - which GPIOs and in what order are they specified? ?Looking at the code it looks like pin mux configuration so just some wording saying it's a list of pins to be used for the framebuffer function.
Ok. I will modify the sentence to mean that it is list of gpios used by framebuffer controller for data/timing interface with the lcd panel. Thanks for your review.
You probably want to mention that it's for pin muxing, the reason I didn't get what it meant on first read was that normally GPIO means specifically the sort of stuff handled by gpiolib.
PATCH 1/1 video: s3c-fb: Add device tree support
In reply to Thomas AbrahamHi, Thomas.
Quoted 29 lines
-----Original Message-----
From: Thomas Abraham [mailto:thomas.abraham at linaro.org]
Sent: Tuesday, January 10, 2012 5:02 AM
To: linux-fbdev at vger.kernel.org; devicetree-discuss at lists.ozlabs.org
Cc: FlorianSchandinat at gmx.de; grant.likely at secretlab.ca; rob.herring at calxeda.com; linux-arm- kernel at lists.infradead.org; linux-samsung-soc at vger.kernel.org; kgene.kim at samsung.com; jg1.han at samsung.com; patches at linaro.org
Subject: [PATCH] video: s3c-fb: Add device tree supportAdd device tree based discovery support for Samsung's display controller.
Cc Grant Likely <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Thomas Abraham <[email protected]>--- .../devicetree/bindings/fb/samsung-fb.txt | 103 ++++++++++ drivers/video/s3c-fb.c | 209 +++++++++++++++++++- 2 files changed, 304 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/fb/samsung-fb.txt[...]
+- samsung,fimd-bpp: Specifies the bits per pixel. Two values should be
Documentation/devicetree/bindings/fb/samsung-fb.txt new file +5
-0+ specified in the following order. + - max-bpp: maximum required bpp for the overlay. + - default-bpp: bpp supported by the overlay. + fimd-overlay0 { + samsung,fimd-htiming = <64 16 48 1024>;
Documentation/devicetree/bindings/fb/samsung-fb.txt line 103
Quoted 10 lines
Documentation/devicetree/bindings/fb/samsung-fb.txt new file +10
-0+ samsung,fimd-vtiming = <64 16 3 600>; + samsung,fimd-bpp = <24 32>; + }; + + fimd-overlay1 { + samsung,fimd-htiming = <64 16 48 200>; + samsung,fimd-vtiming = <64 16 3 100>; + samsung,fimd-bpp = <16 32>; + }; + };
In the above 'samsung-fb.txt', the order is defined as max-bpp and default-bpp. However, <24 32> and <16 32> seems to be wrong.
It should be <32 24> and <32 16>, respectively.
Max bpp would be 32bpp in s3c-fb.
Best regards,
Jingoo Han
PATCH 1/1 video: s3c-fb: Add device tree support
Dear Mr. Han,
Quoted 41 lines · Jingoo Han
Hi, Thomas.
Quoted 31 lines
-----Original Message-----
From: Thomas Abraham [mailto:thomas.abraham at linaro.org]
Sent: Tuesday, January 10, 2012 5:02 AM
To: linux-fbdev at vger.kernel.org; devicetree-discuss at lists.ozlabs.org
Cc: FlorianSchandinat at gmx.de; grant.likely at secretlab.ca; rob.herring at calxeda.com; linux-arm- kernel at lists.infradead.org; linux-samsung-soc at vger.kernel.org; kgene.kim at samsung.com; jg1.han at samsung.com; patches at linaro.org
Subject: [PATCH] video: s3c-fb: Add device tree supportAdd device tree based discovery support for Samsung's display controller.
Cc Grant Likely <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Thomas Abraham <[email protected]>---
?.../devicetree/bindings/fb/samsung-fb.txt ? ? ? ? ?| ?103 ++++++++++ ?drivers/video/s3c-fb.c ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ?209 +++++++++++++++++++- ?2 files changed, 304 insertions(+), 8 deletions(-)
?create mode 100644Documentation/devicetree/bindings/fb/samsung-fb.txt[...]
+- samsung,fimd-bpp: Specifies the bits per pixel. Two values should be
+ ?specified in the following order.
+ ? ?- max-bpp: maximum required bpp for the overlay.
+ ? ?- default-bpp: bpp supported by the overlay.
[...]
+ ? ? ? ? ? ? fimd-overlay0 {
+ ? ? ? ? ? ? ? ? ? ? samsung,fimd-htiming = <64 16 48 1024>;
+ ? ? ? ? ? ? ? ? ? ? samsung,fimd-vtiming = <64 16 3 600>;
+ ? ? ? ? ? ? ? ? ? ? samsung,fimd-bpp = <24 32>;Quoted 8 lines
+ ? ? ? ? ? ? };
+
+ ? ? ? ? ? ? fimd-overlay1 {
+ ? ? ? ? ? ? ? ? ? ? samsung,fimd-htiming = <64 16 48 200>;
+ ? ? ? ? ? ? ? ? ? ? samsung,fimd-vtiming = <64 16 3 100>;
+ ? ? ? ? ? ? ? ? ? ? samsung,fimd-bpp = <16 32>;
+ ? ? ? ? ? ? };
+ ? ? };
Quoted 4 lines
In the above 'samsung-fb.txt', the order is defined as max-bpp and default-bpp. However, <24 32> and <16 32> seems to be wrong.
It should be <32 24> and <32 16>, respectively.
Max bpp would be 32bpp in s3c-fb.
You are right. I will change the order in the documentation as default-bpp and then max-bpp. Thanks for correction.
Regards,
Thomas.
Quoted 9 lines
Best regards,
Jingoo Han--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
PATCH 1/1 video: s3c-fb: Add device tree support
In reply to Thomas Abrahamdrivers/video/s3c-fb.c static void s3c_fb_clear_win(struct s3c_fb *sfb, int win) · line 1344
Quoted 12 lines · Thomas Abraham
drivers/video/s3c-fb.c +11
-0+for (idx =0 ; idx< nr_gpios; idx++) { + gpio =of_get_gpio (dev->of_node, idx); +if (!gpio_is_valid (gpio)) { +dev_err (dev,"invalid gpio[%d]: %d\n" , idx, gpio); +return -EINVAL ; + } + +if (!request) +continue ; + + ret =gpio_request (gpio,"fimd" );
Is it how it normally is supposed to be done, i.e. configuring a gpio _before_ it has been requested ? of_get_gpio() indirectly touches the gpio controller and gpio_request() doesn't seem to serve its purpose in this case, i.e. if there is situation like:
driver A driver B
of_get_gpio(nodeA, gpioA);
of_get_gpio(nodeB, gpioA);
gpio_request(gpioA);
gpio_request(gpioB);driver B will end up with configuration of gpioA from nodeA, not from nodeB.
As there are few drivers doing that I must be missing something, not sure what..
I realize the GPIO number needs to be known in order for a GPIO to be requested. Shouldn't of_get_gpio() be extended to allow locking gpio controller's module and marking a GPIO as requested in advance ?
Quoted 22 lines
drivers/video/s3c-fb.c +22
-0+if (ret) { +dev_err (dev,"gpio [%d] request failed\n" , gpio); + goto gpio_free; + } + sfb->gpios[idx] = gpio; + } +return 0 ; + +gpio_free: +while (--idx>=0 ) +gpio_free (sfb->gpios[idx]); +return ret; +} + +static void s3c_fb_dt_free_gpios (struct s3c_fb *sfb) +{ +unsigned int idx, nr_gpio; + + nr_gpio = sfb->pdata->win[0 ]->max_bpp +4 ; +for (idx =0 ; idx< nr_gpio; idx++) +gpio_free (sfb->gpios[idx]); +}
PATCH 1/1 video: s3c-fb: Add device tree support
Quoted 19 lines · Sylwester Nawrocki
drivers/video/s3c-fb.c static void s3c_fb_clear_win(struct s3c_fb *sfb, int win) · line 1344
Quoted 12 lines · Thomas Abraham
drivers/video/s3c-fb.c +11
-0+for (idx =0 ; idx< nr_gpios; idx++) { + gpio =of_get_gpio (dev->of_node, idx); +if (!gpio_is_valid (gpio)) { +dev_err (dev,"invalid gpio[%d]: %d\n" , idx, gpio); +return -EINVAL ; + } + +if (!request) +continue ; + + ret =gpio_request (gpio,"fimd" );Is it how it normally is supposed to be done, i.e. configuring a gpio _before_ it has been requested ?
of_get_gpio()indirectly touches the gpio controller andgpio_request()doesn't seem to serve its purpose in this case, i.e. if there is situation like:
Quoted 6 lines
driver A driver B
of_get_gpio(nodeA, gpioA); of_get_gpio(nodeB, gpioA); gpio_request(gpioA); gpio_request(gpioB);
s/B/A
Quoted 3 lines
driver B will end up with configuration of gpioA from nodeA, not from nodeB.
ugh, I put it wrong, it should instead read:
"driver A will end up with configuration of gpioA from nodeB, not from nodeA."
Quoted 28 lines
As there are few drivers doing that I must be missing something, not sure what..
I realize the GPIO number needs to be known in order for a GPIO to be requested. Shouldn'tof_get_gpio()be extended to allow locking gpio controller's module and marking a GPIO as requested in advance ?Quoted 22 lines
drivers/video/s3c-fb.c +22
-0+if (ret) { +dev_err (dev,"gpio [%d] request failed\n" , gpio); + goto gpio_free; + } + sfb->gpios[idx] = gpio; + } +return 0 ; + +gpio_free: +while (--idx>=0 ) +gpio_free (sfb->gpios[idx]); +return ret; +} + +static void s3c_fb_dt_free_gpios (struct s3c_fb *sfb) +{ +unsigned int idx, nr_gpio; + + nr_gpio = sfb->pdata->win[0 ]->max_bpp +4 ; +for (idx =0 ; idx< nr_gpio; idx++) +gpio_free (sfb->gpios[idx]); +}
PATCH 1/1 video: s3c-fb: Add device tree support
Hi Sylwester,
Quoted 56 lines · Sylwester Nawrocki
Quoted 19 lines · Sylwester Nawrocki
Review
Quoted 12 lines · Thomas Abraham
+ ? ?for (idx = 0; idx< ?
nr_gpios; idx++) {
+ ? ? ? ? ? ?gpio =of_get_gpio(dev->of_node, idx);
+ ? ? ? ? ? ?if (!gpio_is_valid(gpio)) {
+ ? ? ? ? ? ? ? ? ? ?dev_err(dev, "invalid gpio[%d]: %d\n", idx, gpio);
+ ? ? ? ? ? ? ? ? ? ?return-EINVAL;
+ ? ? ? ? ? ?}(quoted diff) +5
-0+ + ? ? ? ? ? ?if (!request) + ? ? ? ? ? ? ? ? ? ?continue; + + ? ? ? ? ? ?ret = gpio_request(gpio, "fimd");Is it how it normally is supposed to be done, i.e. configuring a gpio _before_ it has been requested ?
of_get_gpio()indirectly touches the gpio controller andgpio_request()doesn't seem to serve its purpose in this case, i.e. if there is situation like:Quoted 6 lines
driver A ? ? ? ? ? ? ? ? ? ? ? ?driver B
of_get_gpio(nodeA, gpioA);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?of_get_gpio(nodeB, gpioA);gpio_request(gpioA);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?gpio_request(gpioB);? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? s/B/A
Quoted 3 lines
driver B will end up with configuration of gpioA from nodeA, not from nodeB.
ugh, I put it wrong, it should instead read:
"driver A will end up with configuration of gpioA from nodeB, not from nodeA."
Quoted 20 lines
As there are few drivers doing that I must be missing something, not sure what..
I realize the GPIO number needs to be known in order for a GPIO to be requested. Shouldn'tof_get_gpio()be extended to allow locking gpio controller's module and marking a GPIO as requested in advance ?Quoted 14 lines
+ ? ? ? ? ? ?if (ret) {
+ ? ? ? ? ? ? ? ? ? ?dev_err(dev, "gpio [%d] request failed\n", gpio);
+ ? ? ? ? ? ? ? ? ? ?gotogpio_free;
+ ? ? ? ? ? ?}
+ ? ? ? ? ? ?sfb->gpios[idx] = gpio;
+ ? ?}
+ ? ?return 0;drivers/video/s3c-fb.c +7
-0+ +gpio_free: + ? ?while (--idx>= 0) + ? ? ? ? ? ?gpio_free(sfb->gpios[idx]); + ? ?return ret; +} +
Quoted 9 lines
Quoted 8 lines
drivers/video/s3c-fb.c static void s3c_fb_clear_win(struct s3c_fb *sfb, int win) · line 1366
Quoted 8 lines
drivers/video/s3c-fb.c +8
-0+static void s3c_fb_dt_free_gpios (struct s3c_fb *sfb) +{ + ? ?unsigned int idx, nr_gpio; + + ? ?nr_gpio = sfb->pdata->win[0]->max_bpp + 4; + ? ?for (idx = 0; idx< ? nr_gpio; idx++) + ? ? ? ? ? ?gpio_free(sfb->gpios[idx]); +}
Yes, I agree that there is a problem here. DT bindings for pinmux/pinconfig would solve this. But the sequence of of_get_gpio() and gpio_request() in the above code will stay even when using the dt bindings for pinmux/pinconfig. There will be only incremental changes required to adapt to dt bindings for pinmux/pinconfig.
Thanks,
Thomas.