CLCD Nomadik+Versatile support
Subsystems (10)
cover CLCD Nomadik+Versatile support
This is the result of some tiresome work to adopt the CLCD driver to use device tree properly for Nomadik, Integrator, Versatile and RealView.
The Nomadik support basically just adds some vendor data stuff similar to what we have done for other drivers, but also add as per-vendor .board_init() and .panel_init() hook.
These hooks are then used to handle panels on these boards. Versatile is the most elaborate and took the most time, as it is doing autodetection of the panel at runtime, and thus we encode all possible panels in the DT and select the detected panel at .panel_init() time.
The patches have been tested quite extensively on my Nomadik NHK8815 and the ARM Integrator, Versatile, and RealView reference designs, as well as on the more forgiving QEMU emulation of Versatile.
Eventually I would like to have patches 1 thru 8 (those with patches to CLCD or the DT bindings) applied through the FBDEV subsystem, while I will take the SoC specifics (patches 9 thru 11, and some non-included Nomadik patches) separately as it affects multiple ARM SoC files.
Linus Walleij (11):
video: ARM CLCD: backlight support for OF
video: ARM CLCD: support DT signal inversion flags
video: ARM CLCD: support pads connected in reverse order
video: ARM CLCD: support Nomadik variant
video: ARM CLCD: add special board and panel hooks for Nomadik Documentation/DT: add blurb for IB2 syscon to Versatile Documentation/DT: add Versatile display bindings
video: ARM CLCD: add special panel hook for Versatiles
ARM: PB11MPCore: define a standard VGA panel
ARM: PB1176: define a standard VGA panel
ARM: versatile: move CLCD configuration to device tree
Documentation/devicetree/bindings/arm/arm-boards | 8 + .../bindings/display/panel/epson,l2f50113t00.txt | 7 + .../bindings/display/panel/sanyo,alr252rgt.txt | 7 + .../bindings/display/panel/sanyo,tm38qv67a02a.txt | 7 + .../bindings/display/panel/sharp,lq084v1dg21.txt | 7 + .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/arm-realview-pb1176.dts | 40 ++ arch/arm/boot/dts/arm-realview-pb11mp.dts | 19 +- arch/arm/boot/dts/versatile-ab-ib2.dts | 20 + arch/arm/boot/dts/versatile-ab.dts | 203 ++++++++++- arch/arm/mach-versatile/versatile_dt.c | 162 -------- drivers/video/fbdev/Kconfig | 6 +- drivers/video/fbdev/Makefile | 1 + drivers/video/fbdev/amba-clcd-nomadik.c | 263 +++++++++++++ drivers/video/fbdev/amba-clcd-nomadik.h | 24 ++ drivers/video/fbdev/amba-clcd-versatile.c | 406 +++++++++++++++++++++ drivers/video/fbdev/amba-clcd-versatile.h | 17 + drivers/video/fbdev/amba-clcd.c | 205 ++++++++++- include/linux/amba/clcd.h | 76 +++- 20 files changed, 1279 insertions(+), 201 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sanyo,alr252rgt.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sanyo,tm38qv67a02a.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sharp,lq084v1dg21.txt create mode 100644 arch/arm/boot/dts/versatile-ab-ib2.dts create mode 100644 drivers/video/fbdev/amba-clcd-nomadik.c create mode 100644 drivers/video/fbdev/amba-clcd-nomadik.h create mode 100644 drivers/video/fbdev/amba-clcd-versatile.h
Signature · 1 line
2.4.3
PATCH 1/11 video: ARM CLCD: backlight support for OF
If the device is probed from device tree, we can support backlight. This is used with some systems such as the ST Microelectronics Nomadik.
We have to add HAS_IOMEM to the dependencies of CLCD since the backlight class device will now be selected, and if it gets selected on an arch that does not have IOMEM, compilation will fail.
--- drivers/video/fbdev/Kconfig | 4 +++- drivers/video/fbdev/amba-clcd.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/amba/clcd.h | 3 +++ 3 files changed, 46 insertions(+), 1 deletion(-)
drivers/video/fbdev/Kconfig +3 -1
@@ -284,12 +284,14 @@ config FB_PM2_FIFO_DISCONNECT config FB_ARMCLCD tristate "ARM PrimeCell PL110 support" depends on ARM || ARM64 || COMPILE_TEST - depends on FB && ARM_AMBA + depends on FB && ARM_AMBA && HAS_IOMEM select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select FB_MODE_HELPERS if OF select VIDEOMODE_HELPERS if OF + select BACKLIGHT_LCD_SUPPORT if OF + select BACKLIGHT_CLASS_DEVICE if OF help This framebuffer device driver is for the ARM PrimeCell PL110 Colour LCD controller. ARM PrimeCells provide the building
drivers/video/fbdev/amba-clcd.c +40 -0
@@ -30,6 +30,7 @@#include <linux/of.h> #include <linux/of_address.h> #include <linux/of_graph.h> +#include <linux/backlight.h> #include <video/display_timing.h> #include <video/of_display_timing.h> #include <video/videomode.h>
@@ -73,6 +74,11 @@ static void clcdfb_disable(struct clcd_fb *fb)if (fb->board->disable) fb->board->disable (fb); +if (fb->panel->backlight) { + fb->panel->backlight->props.power =FB_BLANK_POWERDOWN ; +backlight_update_status (fb->panel->backlight); + } + val =readl (fb->regs + fb->off_cntl);if (val &CNTL_LCDPWR ) { val &= ~CNTL_LCDPWR ;
@@ -119,6 +125,14 @@ static void clcdfb_enable(struct clcd_fb *fb, u32 cntl)writel (cntl, fb->regs + fb->off_cntl);/* +* Turn on backlight +*/ +if (fb->panel->backlight) { + fb->panel->backlight->props.power =FB_BLANK_UNBLANK ; +backlight_update_status (fb->panel->backlight); + } + +/* * finally, enable the interface. */ if (fb->board->enable)
@@ -578,6 +592,28 @@ static int clcdfb_snprintf_mode(char *buf, int size, struct fb_videomode *mode) mode->refresh); } +static int clcdfb_of_get_backlight (struct device_node *endpoint, +struct clcd_panel *clcd_panel) +{ +struct device_node *panel; +struct device_node *backlight; + + panel =of_graph_get_remote_port_parent (endpoint); +if (!panel) +return -ENODEV ; + +/* Look up the optional backlight phandle */ + backlight =of_parse_phandle (panel,"backlight" ,0 ); +if (backlight) { + clcd_panel->backlight =of_find_backlight_by_node (backlight); +of_node_put (backlight); + +if (!clcd_panel->backlight) +return -EPROBE_DEFER ; + } +return 0 ; +} +static int clcdfb_of_get_mode (struct device *dev,struct device_node *endpoint,struct fb_videomode *mode) {
@@ -664,6 +700,10 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)if (!endpoint)return -ENODEV ; + err =clcdfb_of_get_backlight (endpoint, fb->panel); +if (err) +return err; + err =clcdfb_of_get_mode (&fb->dev->dev, endpoint, &fb->panel->mode);if (err)return err;
include/linux/amba/clcd.h +3 -0
@@ -93,6 +93,8 @@ enum { CLCD_CAP_ALL = CLCD_CAP_BGR | CLCD_CAP_RGB, }; +struct backlight_device ; +struct clcd_panel {struct fb_videomode mode;signed short width;/* width in mm */
@@ -105,6 +107,7 @@ struct clcd_panel { fixedtimings:1 , grayscale:1;unsigned int connector; +struct backlight_device *backlight; };struct clcd_regs {
Signature · 1 line
2.4.3
PATCH 2/11 video: ARM CLCD: support DT signal inversion flags
In reply to Linus WalleijThe device tree bindings from display-timing.txt allows us to specify if data enable, hsync, vsync or the pixed clock should be inverted on the way to the display. The driver does not currently handle this so add support for those flags as it is needed for the Versatile Sanyo LCD display.
Note that the previous behaviour was to invert the pixel clock for all displays, so unless the pixel clock polarity is explicitly defined in the device tree (i.e. the timings node has the "pixelclk-active" property) we fall back to inverting the pixel clock. This needs some extra compatibility code.
Since the timing flags have to be set up inside the struct clcd_panel, we need to refactor the code a bit to pass around the panel rather than just the mode.
--- drivers/video/fbdev/amba-clcd.c | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-)
drivers/video/fbdev/amba-clcd.c +34 -7
@@ -567,10 +567,11 @@ static int clcdfb_register(struct clcd_fb *fb)#ifdef CONFIG_OF static int clcdfb_of_get_dpi_panel_mode (struct device_node *node, -struct fb_videomode *mode) +struct clcd_panel *clcd_panel) {int err;struct display_timing timing; +struct device_node *timnp;struct videomode video; err =of_get_display_timing (node,"panel-timing" , &timing);
@@ -579,10 +580,34 @@ static int clcdfb_of_get_dpi_panel_mode(struct device_node *node,videomode_from_timing (&timing, &video); - err =fb_videomode_from_videomode (&video, mode); + err =fb_videomode_from_videomode (&video, &clcd_panel->mode);if (err)return err; +/* Set up some inversion flags */ + timnp =of_get_child_by_name (node,"panel-timing" ); +if (timnp &&of_property_read_bool (timnp,"pixelclk-active" )) { +if (timing.flags &DISPLAY_FLAGS_PIXDATA_NEGEDGE ) + clcd_panel->tim2 |=TIM2_IPC ; + }else { +/* +* To preserve backwards compatibility, the IPC (inverted +* pixel clock) flag needs to be set on any display that +* doesn't explicitly specify that the pixel clock is +* active on the negative edge. +*/ + clcd_panel->tim2 |=TIM2_IPC ; + } + +if (timing.flags &DISPLAY_FLAGS_HSYNC_LOW ) + clcd_panel->tim2 |=TIM2_IHS ; + +if (timing.flags &DISPLAY_FLAGS_VSYNC_LOW ) + clcd_panel->tim2 |=TIM2_IVS ; + +if (timing.flags &DISPLAY_FLAGS_DE_LOW ) + clcd_panel->tim2 |=TIM2_IOE ; +return 0 ; }
@@ -615,10 +640,11 @@ static int clcdfb_of_get_backlight(struct device_node *endpoint, }static int clcdfb_of_get_mode (struct device *dev,struct device_node *endpoint, -struct fb_videomode *mode) +struct clcd_panel *clcd_panel) {int err;struct device_node *panel; +struct fb_videomode *mode;char *name;int len;
@@ -628,11 +654,12 @@ static int clcdfb_of_get_mode(struct device *dev, struct device_node *endpoint,/* Only directly connected DPI panels supported for now */ if (of_device_is_compatible (panel,"panel-dpi" )) - err =clcdfb_of_get_dpi_panel_mode (panel, mode); + err =clcdfb_of_get_dpi_panel_mode (panel, clcd_panel);else err = -ENOENT ;if (err)return err; + mode = &clcd_panel->mode; len =clcdfb_snprintf_mode (NULL ,0 , mode); name =devm_kzalloc (dev, len +1 ,GFP_KERNEL );
@@ -663,8 +690,8 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0) };int i; -/* Bypass pixel clock divider, data output on the falling edge */ - fb->panel->tim2 =TIM2_BCD |TIM2_IPC ; +/* Bypass pixel clock divider */ + fb->panel->tim2 |=TIM2_BCD ;/* TFT display, vert. comp. interrupt at the start of the back porch */ fb->panel->cntl |=CNTL_LCDTFT |CNTL_LCDVCOMP (1 );
@@ -704,7 +731,7 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)if (err)return err; - err =clcdfb_of_get_mode (&fb->dev->dev, endpoint, &fb->panel->mode); + err =clcdfb_of_get_mode (&fb->dev->dev, endpoint, fb->panel);if (err)return err;
Signature · 1 line
2.4.3
PATCH 2/11 video: ARM CLCD: support DT signal inversion flags
Hi Linus,
A somewhat related question, how do you see the CLKSEL bit in the TIM2 register will be supported in the future? There are some cases where the CLKSEL bit needs to be set, and therefore the "CLCDCLK" instead of "HCLK" reference clock source is selected.
Thanks!
Ray
Quoted 126 lines · Linus Walleij
The device tree bindings from display-timing.txt allows us to specify if data enable, hsync, vsync or the pixed clock should be inverted on the way to the display. The driver does not currently handle this so add support for those flags as it is needed for the Versatile Sanyo LCD display.
Note that the previous behaviour was to invert the pixel clock for all displays, so unless the pixel clock polarity is explicitly defined in the device tree (i.e. the timings node has the "pixelclk-active" property) we fall back to inverting the pixel clock. This needs some extra compatibility code.
Since the timing flags have to be set up inside the struct
clcd_panel, we need to refactor the code a bit to pass around the panel rather than just the mode.Cc Pawel Moll <[email protected]>Cc Rob Herring <[email protected]>Cc Russell King <[email protected]>Signed-off-by Linus Walleij <[email protected]>---
drivers/video/fbdev/amba-clcd.c| 41 ++++++++++++++++++++++++++++++++++-------1 file changed, 34 insertions(+), 7 deletions(-)drivers/video/fbdev/amba-clcd.c +34
-7@@ -567,10 +567,11 @@ static int clcdfb_register(struct clcd_fb *fb)#ifdef CONFIG_OF static int clcdfb_of_get_dpi_panel_mode (struct device_node *node, -struct fb_videomode *mode) +struct clcd_panel *clcd_panel) {int err;struct display_timing timing; +struct device_node *timnp;struct videomode video; err =of_get_display_timing (node,"panel-timing" , &timing);@@ -579,10 +580,34 @@ static int clcdfb_of_get_dpi_panel_mode(struct device_node *node,videomode_from_timing (&timing, &video); - err =fb_videomode_from_videomode (&video, mode); + err =fb_videomode_from_videomode (&video, &clcd_panel->mode);if (err)return err; +/* Set up some inversion flags */ + timnp =of_get_child_by_name (node,"panel-timing" ); +if (timnp &&of_property_read_bool (timnp,"pixelclk-active" )) { +if (timing.flags &DISPLAY_FLAGS_PIXDATA_NEGEDGE ) + clcd_panel->tim2 |=TIM2_IPC ; + }else { +/* +* To preserve backwards compatibility, the IPC (inverted +* pixel clock) flag needs to be set on any display that +* doesn't explicitly specify that the pixel clock is +* active on the negative edge. +*/ + clcd_panel->tim2 |=TIM2_IPC ; + } + +if (timing.flags &DISPLAY_FLAGS_HSYNC_LOW ) + clcd_panel->tim2 |=TIM2_IHS ; + +if (timing.flags &DISPLAY_FLAGS_VSYNC_LOW ) + clcd_panel->tim2 |=TIM2_IVS ; + +if (timing.flags &DISPLAY_FLAGS_DE_LOW ) + clcd_panel->tim2 |=TIM2_IOE ; +return 0 ; }@@ -615,10 +640,11 @@ static int clcdfb_of_get_backlight(struct device_node *endpoint, }static int clcdfb_of_get_mode (struct device *dev,struct device_node *endpoint, -struct fb_videomode *mode) +struct clcd_panel *clcd_panel) {int err;struct device_node *panel; +struct fb_videomode *mode;char *name;int len;@@ -628,11 +654,12 @@ static int clcdfb_of_get_mode(struct device *dev, struct device_node *endpoint,/* Only directly connected DPI panels supported for now */ if (of_device_is_compatible (panel,"panel-dpi" )) - err =clcdfb_of_get_dpi_panel_mode (panel, mode); + err =clcdfb_of_get_dpi_panel_mode (panel, clcd_panel);else err = -ENOENT ;if (err)return err; + mode = &clcd_panel->mode; len =clcdfb_snprintf_mode (NULL ,0 , mode); name =devm_kzalloc (dev, len +1 ,GFP_KERNEL );@@ -663,8 +690,8 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0) };int i; -/* Bypass pixel clock divider, data output on the falling edge */ - fb->panel->tim2 =TIM2_BCD |TIM2_IPC ; +/* Bypass pixel clock divider */ + fb->panel->tim2 |=TIM2_BCD ;/* TFT display, vert. comp. interrupt at the start of the back porch */ fb->panel->cntl |=CNTL_LCDTFT |CNTL_LCDVCOMP (1 );@@ -704,7 +731,7 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)if (err)return err; - err =clcdfb_of_get_mode (&fb->dev->dev, endpoint, &fb->panel->mode); + err =clcdfb_of_get_mode (&fb->dev->dev, endpoint, fb->panel);if (err)return err;
PATCH 2/11 video: ARM CLCD: support DT signal inversion flags
Quoted 4 lines · Ray Jui
A somewhat related question, how do you see the CLKSEL bit in the TIM2 register will be supported in the future? There are some cases where the CLKSEL bit needs to be set, and therefore the "CLCDCLK" instead of "HCLK" reference clock source is selected.
I think it's very simple:
The DT node usually looks like so:
display at 10120000 {
compatible = "arm,pl110", "arm,primecell";
(...)
clocks = <&oscclk4>, <&pclk>;
clock-names = "clcd", "apb_pclk";Just add a custom attribute pointing to the
reference clock in this array:
clcd-reference-clock = <0>;
If this is set to <1> "apb_pclk" (i.e. HCLK) is
the reference, and that bit in TIM2 gets set.
Do you have a system that needs this?
Yours,
Linus Walleij
PATCH 2/11 video: ARM CLCD: support DT signal inversion flags
Hi Linus,
Quoted 17 lines · Linus Walleij
Quoted 4 lines · Ray Jui
A somewhat related question, how do you see the CLKSEL bit in the TIM2 register will be supported in the future? There are some cases where the CLKSEL bit needs to be set, and therefore the "CLCDCLK" instead of "HCLK" reference clock source is selected.
I think it's very simple:
The DT node usually looks like so:
display at 10120000 { compatible = "arm,pl110", "arm,primecell"; (...) clocks = <&oscclk4>, <&pclk>; clock-names = "clcd", "apb_pclk";
Quoted 7 lines
Just add a custom attribute pointing to the
reference clock in this array:clcd-reference-clock = <0>;
If this is set to <1> "
apb_pclk" (i.e. HCLK) is
the reference, and that bit in TIM2 gets set.
This looks good!
Quoted 3 lines
Do you have a system that needs this?
Yah, we have a system (Cygnus) that can either use the HCLK, or an external clock generated from a PLL. To get certain pixel clock frequencies (depending on the LCD panel we use), we need to use the external clock source with the PLL configured to a particular VCO frequency.
We have not enabled full LCD/video support on that platform in the mainline kernel, but we'll eventually get to it.
Quoted 3 lines
Yours,
Linus Walleij
Thanks,
Ray
PATCH 2/11 video: ARM CLCD: support DT signal inversion flags
Quoted 9 lines · Ray Jui
Quoted 1 line
Do you have a system that needs this?
Yah, we have a system (Cygnus) that can either use the HCLK, or an external clock generated from a PLL. To get certain pixel clock frequencies (depending on the LCD panel we use), we need to use the external clock source with the PLL configured to a particular VCO frequency.
We have not enabled full LCD/video support on that platform in the mainline kernel, but we'll eventually get to it.
OK I hope to finish these patches soon so you have some nice stuff to build upon. I guess it will need the same per-vendor plug-in that I supplied for the ARMs and the Nomadik.
Yours,
Linus Walleij
PATCH 3/11 video: ARM CLCD: support pads connected in reverse order
In reply to Linus WalleijThere are CLCDs connected with the pads in BGR rather than RGB order. It really doesn't matter since the CLCD has a flag and a bit to switch the position of the RGB and BGR components. This is needed to put something logical into the arm,pl11x,tft-r0g0b0-pads property of the device tree on the Nomadik which will then be <16 8 0>.
--- drivers/video/fbdev/amba-clcd.c | 8 ++++++++ include/linux/amba/clcd.h | 31 ++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-)
drivers/video/fbdev/amba-clcd.c +8 -0
@@ -681,6 +681,7 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0) } panels[] = { { 0x110, 1, 7, 13, CLCD_CAP_5551 }, { 0x110, 0, 8, 16, CLCD_CAP_888 }, + { 0x110, 16, 8, 0, CLCD_CAP_888 }, { 0x111, 4, 14, 20, CLCD_CAP_444 }, { 0x111, 3, 11, 19, CLCD_CAP_444 | CLCD_CAP_5551 }, { 0x111, 3, 10, 19, CLCD_CAP_444 | CLCD_CAP_5551 |
@@ -708,6 +709,13 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0) fb->panel->caps = panels[i].caps; } +/* +* If we actually physically connected the R lines to B and +* vice versa +*/ +if (r0 !=0 && b0 ==0 ) + fb->panel->bgr_connection = true; +return fb->panel->caps ?0 : -EINVAL ; }
include/linux/amba/clcd.h +24 -7
@@ -108,6 +108,12 @@ struct clcd_panel { grayscale:1 ;unsigned int connector;struct backlight_device *backlight; +/* +* If the B/R lines are switched between the CLCD +* and the panel we need to know this and not try to +* compensate with the BGR bit in the control register. +*/ +bool bgr_connection; };struct clcd_regs {
@@ -234,16 +240,27 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)if (var->grayscale) val |=CNTL_LCDBW ; -if (fb->panel->caps && fb->board->caps && - var->bits_per_pixel >=16 ) { +if (fb->panel->caps && fb->board->caps && var->bits_per_pixel >=16 ) {/* * if board and panel supply capabilities, we can support -* changing BGR/RGB depending on supplied parameters +* changing BGR/RGB depending on supplied parameters. Here +* we switch to what the framebuffer is providing if need +* be, so if the framebuffer is BGR but the display connection +* is RGB (first case) we switch it around. Vice versa mutatis +* mutandis if the framebuffer is RGB but the display connection +* is BGR, we flip it around. */ -if (var->red.offset ==0 ) - val &= ~CNTL_BGR ; -else - val |=CNTL_BGR ; +if (!fb->panel->bgr_connection) { +if (var->red.offset ==0 ) + val &= ~CNTL_BGR ; +else + val |=CNTL_BGR ; + }else { +if (var->blue.offset ==0 ) + val &= ~CNTL_BGR ; +else + val |=CNTL_BGR ; + } }switch (var->bits_per_pixel) {
Signature · 1 line
2.4.3
PATCH 4/11 video: ARM CLCD: support Nomadik variant
In reply to Linus WalleijThe Nomadik variant has a few special quirks that need to be respected to make the driver work:
- The block need to be clocked during writing of the TIMn registers or the bus will stall.
- Special bits in the control register select how many of the output display lines get activated.
- Special bits in the control register select how to manage the different 565 and 5551 modes.
- There is a packed 24bit graphics mode, i.e 888 pixels can be stored in memory is three consecutive bytes, not evenly aligned to a 32bit word.
This patch uses the vendor data pointer from the AMBA matching mechanism to track the quirks for this variant, and adds two hooks that variants can use to initialize boards and panels during start-up. These will later be used to adopt a Nomadik board profile.
--- drivers/video/fbdev/amba-clcd.c | 108 ++++++++++++++++++++++++++++++++++++---- include/linux/amba/clcd.h | 42 ++++++++++++++++ 2 files changed, 140 insertions(+), 10 deletions(-)
drivers/video/fbdev/amba-clcd.c +98 -10
@@ -227,6 +227,15 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) var->blue.length =4 ; }break ; +case 24 : +if (fb->vendor->packed_24_bit_pixels) { + var->red.length =8 ; + var->green.length =8 ; + var->blue.length =8 ; + }else { + ret = -EINVAL ; + } +break ;case 32 :/* If we can't do 888, reject */ caps &=CLCD_CAP_888 ;
@@ -313,6 +322,12 @@ static int clcdfb_set_par(struct fb_info *info)clcdfb_disable (fb); +/* Some variants must be clocked here */ +if (fb->vendor->clock_timregs && !fb->clk_enabled) { + fb->clk_enabled = true; +clk_enable (fb->clk); + } +writel (regs.tim0, fb->regs +CLCD_TIM0 );writel (regs.tim1, fb->regs +CLCD_TIM1 );writel (regs.tim2, fb->regs +CLCD_TIM2 );
@@ -716,12 +731,48 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0)if (r0 !=0 && b0 ==0 ) fb->panel->bgr_connection = true; +if (fb->panel->caps && fb->vendor->st_bitmux_control) { +/* +* Set up the special bits for the Nomadik control register +* (other platforms tend to do this through an external +* register). +*/ + +/* Offset of the highest used color */ +int maxoff =max3 (r0, g0, b0); +/* Most significant bit out, highest used bit */ +int msb =0 ; + +if (fb->panel->caps &CLCD_CAP_888 ) { + msb = maxoff +8 -1 ; + }else if (fb->panel->caps &CLCD_CAP_565 ) { + msb = maxoff +5 -1 ; + fb->panel->cntl |=CNTL_ST_1XBPP_565 ; + }else if (fb->panel->caps &CLCD_CAP_5551 ) { + msb = maxoff +5 -1 ; + fb->panel->cntl |=CNTL_ST_1XBPP_5551 ; + }else if (fb->panel->caps &CLCD_CAP_444 ) { + msb = maxoff +4 -1 ; + fb->panel->cntl |=CNTL_ST_1XBPP_444 ; + } + +/* Send out as many bits as we need */ +if (msb >17 ) + fb->panel->cntl |=CNTL_ST_CDWID_24 ; +else if (msb >15 ) + fb->panel->cntl |=CNTL_ST_CDWID_18 ; +else if (msb >11 ) + fb->panel->cntl |=CNTL_ST_CDWID_16 ; +else + fb->panel->cntl |=CNTL_ST_CDWID_12 ; + } +return fb->panel->caps ?0 : -EINVAL ; }static int clcdfb_of_init_display (struct clcd_fb *fb) { -struct device_node *endpoint; +struct device_node *endpoint =NULL ;int err;unsigned int bpp;u32 max_bandwidth;
@@ -731,9 +782,21 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)if (!fb->panel)return -ENOMEM ; - endpoint =of_graph_get_next_endpoint (fb->dev->dev.of_node,NULL ); -if (!endpoint) -return -ENODEV ; +if (fb->vendor->init_panel) { + err = fb->vendor->init_panel (fb, &endpoint); +if (err) +return err; + } +/* +* If the vendor-specific code did not choose an endpoint, +* take the first one. +*/ +if (!endpoint) { + endpoint =of_graph_get_next_endpoint (fb->dev->dev.of_node, +NULL ); +if (!endpoint) +return -ENODEV ; + } err =clcdfb_of_get_backlight (endpoint, fb->panel);if (err)
@@ -770,11 +833,11 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)if (of_property_read_u32_array (endpoint,"arm,pl11x,tft-r0g0b0-pads" , - tft_r0b0g0,ARRAY_SIZE (tft_r0b0g0)) ==0 ) -return clcdfb_of_init_tft_panel (fb, tft_r0b0g0[0 ], - tft_r0b0g0[1 ], tft_r0b0g0[2 ]); + tft_r0b0g0,ARRAY_SIZE (tft_r0b0g0)) !=0 ) +return -ENOENT ; -return -ENOENT ; +return clcdfb_of_init_tft_panel (fb, tft_r0b0g0[0 ], + tft_r0b0g0[1 ], tft_r0b0g0[2 ]); }static int clcdfb_of_vram_setup (struct clcd_fb *fb)
@@ -895,6 +958,7 @@ static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)static int clcdfb_probe (struct amba_device *dev,const struct amba_id *id) {struct clcd_board *board =dev_get_platdata (&dev->dev); +struct clcd_vendor_data *vendor = id->data;struct clcd_fb *fb;int ret;
@@ -904,6 +968,12 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)if (!board)return -EINVAL ; +if (vendor->init_board) { + ret = vendor->init_board (dev, board); +if (ret) +return ret; + } + ret =dma_set_mask_and_coherent (&dev->dev,DMA_BIT_MASK (32 ));if (ret) goto out;
@@ -922,10 +992,11 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id) } fb->dev = dev; + fb->vendor = vendor; fb->board = board; -dev_info (&fb->dev->dev,"PL%03x rev%u at 0x%08llx\n" , -amba_part (dev),amba_rev (dev), +dev_info (&fb->dev->dev,"PL%03x designer %02x rev%u at 0x%08llx\n" , +amba_part (dev),amba_manf (dev),amba_rev (dev), (unsigned long long )dev->res.start); ret = fb->board->setup (fb);
@@ -968,10 +1039,27 @@ static int clcdfb_remove(struct amba_device *dev)return 0 ; } +static struct clcd_vendor_data vendor_arm = { +/* No special business */ +}; + +static struct clcd_vendor_data vendor_nomadik = { + .clock_timregs = true, + .packed_24_bit_pixels = true, + .st_bitmux_control = true, +}; +static struct amba_id clcdfb_id_table[] = { { .id =0x00041110 , .mask =0x000ffffe , + .data = &vendor_arm, + }, +/* ST Electronics Nomadik variant */ + { + .id =0x00180110 , + .mask =0x00fffffe , + .data = &vendor_nomadik, }, {0 ,0 }, };
include/linux/amba/clcd.h +42 -0
65 lines not on this page · raw message
Signature · 1 line
2.4.3
PATCH 5/11 video: ARM CLCD: add special board and panel hooks for Nomadik
In reply to Linus WalleijIn the .board_init() callback will set up a mux register in the Nomadik system controller. It so happens that the platform has two display output engines, and we have to poke a bit in a special register to make sure the right engine is muxed in as they are mutually exclusive.
The Nomadik CLCD variant is instantiated on a platform where it is combined with a 800x480 TPO WVGA display. In the .panel_init() hook we will detect this display from the compatible string and set it up. We also add .enable() and .disable() callbacks for it as the sleep state is software controlled.
The display is connected with a special 3-wire serial bus (this is sadly neither I2C or SPI) using three GPIO lines that we bitbang to detect the display and enable/disable sleep state.
--- drivers/video/fbdev/Makefile | 1 + drivers/video/fbdev/amba-clcd-nomadik.c | 263 ++++++++++++++++++++++++++++++++ drivers/video/fbdev/amba-clcd-nomadik.h | 24 +++ drivers/video/fbdev/amba-clcd.c | 6 +- 4 files changed, 293 insertions(+), 1 deletion(-) create mode 100644 drivers/video/fbdev/amba-clcd-nomadik.c create mode 100644 drivers/video/fbdev/amba-clcd-nomadik.h
drivers/video/fbdev/Makefile +1 -0
@@ -79,6 +79,7 @@ obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o +obj-$(CONFIG_ARCH_NOMADIK) += amba-clcd-nomadik.o obj-$(CONFIG_PLAT_VERSATILE_CLCD) += amba-clcd-versatile.o obj-$(CONFIG_FB_GOLDFISH) += goldfishfb.o obj-$(CONFIG_FB_68328) += 68328fb.o
drivers/video/fbdev/amba-clcd-nomadik.c new file +263 -0
263 lines not on this page · raw message
drivers/video/fbdev/amba-clcd-nomadik.h new file +24 -0
@@ -0,0 +1,24 @@ +#ifndef _AMBA_CLCD_NOMADIK_H +#define _AMBA_CLCD_NOMADIK_H + +#include <linux/amba/bus.h> + +#ifdef CONFIG_ARCH_NOMADIK +int nomadik_clcd_init_board (struct amba_device *adev, +struct clcd_board *board); +int nomadik_clcd_init_panel (struct clcd_fb *fb, +struct device_node **endpoint); +#else +static inline int nomadik_clcd_init_board (struct amba_device *adev, +struct clcd_board *board) +{ +return 0 ; +} +static inline int nomadik_clcd_init_panel (struct clcd_fb *fb, +struct device_node **endpoint) +{ +return 0 ; +} +#endif + +#endif /* inclusion guard */
drivers/video/fbdev/amba-clcd.c +5 -1
@@ -37,6 +37,8 @@#include <asm/sizes.h> +#include "amba-clcd-nomadik.h" +#define to_clcd (info) container_of(info, struct clcd_fb, fb)/* This is limited to 16 characters when displayed by X startup */
@@ -1003,7 +1005,7 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)if (ret) goto free_fb; - ret =clcdfb_register (fb); + ret =clcdfb_register (fb);if (ret ==0 ) {amba_set_drvdata (dev, fb); goto out;
@@ -1047,6 +1049,8 @@ static struct clcd_vendor_data vendor_nomadik = { .clock_timregs = true, .packed_24_bit_pixels = true, .st_bitmux_control = true, + .init_board = nomadik_clcd_init_board, + .init_panel = nomadik_clcd_init_panel, };static struct amba_id clcdfb_id_table[] = {
Signature · 1 line
2.4.3
PATCH 6/11 Documentation/DT: add blurb for IB2 syscon to Versatile
In reply to Linus WalleijThe ARM Versatile has an optional daughterboard, if this is mounted, we need to be able to access its system controller. Put in a documentation blurb for this.
--- Documentation/devicetree/bindings/arm/arm-boards | 8 ++++++++ 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/arm/arm-boards +8 -0
@@ -93,6 +93,14 @@ Required nodes: a core-module with regs and the compatible strings "arm,core-module-versatile", "syscon" +Optional nodes: + +- arm,versatile-ib2-syscon : if the Versatile has an IB2 interface + board mounted, this has a separate system controller that is + defined in this node. + Required properties: + compatible = "arm,versatile-ib2-syscon", "syscon" + ARM RealView Boards ------------------- The RealView boards cover tailored evaluation boards that are used to explore
Signature · 1 line
2.4.3
PATCH 7/11 Documentation/DT: add Versatile display bindings
In reply to Linus WalleijThis adds bindings for the LCD displays that can be found connected to the ARM Versatile reference design, interface boards IB1 and IB2.
--- .../devicetree/bindings/display/panel/epson,l2f50113t00.txt | 7 +++++++ .../devicetree/bindings/display/panel/sanyo,alr252rgt.txt | 7 +++++++ .../devicetree/bindings/display/panel/sanyo,tm38qv67a02a.txt | 7 +++++++ .../devicetree/bindings/display/panel/sharp,lq084v1dg21.txt | 7 +++++++ Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 5 files changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sanyo,alr252rgt.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sanyo,tm38qv67a02a.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sharp,lq084v1dg21.txt
Documentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt new file +7 -0
@@ -0,0 +1,7 @@ +Epson Mobile display + +Required properties: +- compatible: should be "epson,l2f50113t00" + +This binding is compatible with the panel-dpi binding, which is specified +in panel-dpi.txt in this directory.
Documentation/devicetree/bindings/display/panel/sanyo,alr252rgt.txt new file +7 -0
@@ -0,0 +1,7 @@ +Sanyo Electric Co. 2.5" panel + +Required properties: +- compatible: should be "sanyo,alr252rgt" + +This binding is compatible with the panel-dpi binding, which is specified +in panel-dpi.txt in this directory.
Documentation/devicetree/bindings/display/panel/sanyo,tm38qv67a02a.txt new file +7 -0
@@ -0,0 +1,7 @@ +Sanyo Electric Co. 3.8" panel + +Required properties: +- compatible: should be "sanyo,tm38qv67a02a" + +This binding is compatible with the panel-dpi binding, which is specified +in panel-dpi.txt in this directory.
Documentation/devicetree/bindings/display/panel/sharp,lq084v1dg21.txt new file +7 -0
@@ -0,0 +1,7 @@ +Sharp 8.4" VGA color TFT + +Required properties: +- compatible: should be "sharp,lq084v1dg21" + +This binding is compatible with the panel-dpi binding, which is specified +in panel-dpi.txt in this directory.
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -198,6 +198,7 @@ ricoh Ricoh Co. Ltd. rockchip Fuzhou Rockchip Electronics Co., Ltd samsung Samsung Semiconductor sandisk Sandisk Corporation +sanyo Sanyo Electric Co., Ltd. sbs Smart Battery System schindler Schindler seagate Seagate Technology PLC
Signature · 1 line
2.4.3
PATCH 7/11 Documentation/DT: add Versatile display bindings
Quoted 26 lines · Linus Walleij
This adds bindings for the LCD displays that can be found connected to the ARM Versatile reference design, interface boards IB1 and IB2.
Cc Pawel Moll <[email protected]>Cc Rob Herring <[email protected]>Cc Russell King <[email protected]>Signed-off-by Linus Walleij <[email protected]>--- .../devicetree/bindings/display/panel/epson,l2f50113t00.txt | 7 +++++++ .../devicetree/bindings/display/panel/sanyo,alr252rgt.txt | 7 +++++++ .../devicetree/bindings/display/panel/sanyo,tm38qv67a02a.txt | 7 +++++++ .../devicetree/bindings/display/panel/sharp,lq084v1dg21.txt | 7 +++++++ Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 5 files changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sanyo,alr252rgt.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sanyo,tm38qv67a02a.txt create mode 100644 Documentation/devicetree/bindings/display/panel/sharp,lq084v1dg21.txtDocumentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt new file +0
-0
Documentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt line 7
Quoted 7 lines
Documentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt new file +7
-0@@ -0,0 +1,7 @@ +Epson Mobile display + +Required properties: +- compatible: should be "epson,l2f50113t00" + +This binding is compatible with the panel-dpi binding, which is specified +in panel-dpi.txt in this directory.
Do we really want to add new binding doc files for all panels, even if they just point to a more generic binding? We may end up with quite a lot of these, each only saying "look at the panel-dpi.txt".
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160217/39cfbc9c/attachment-0001.sig>
PATCH 7/11 Documentation/DT: add Versatile display bindings
Quoted 9 lines · Tomi Valkeinen
Documentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt line 7
Quoted 5 lines
Documentation/devicetree/bindings/display/panel/epson,l2f50113t00.txt new file +5
-0+Required properties: +- compatible: should be "epson,l2f50113t00" + +This binding is compatible with the panel-dpi binding, which is specified +in panel-dpi.txt in this directory.Do we really want to add new binding doc files for all panels, even if they just point to a more generic binding? We may end up with quite a lot of these, each only saying "look at the panel-dpi.txt".
That's sort of what I'm asking too. But there was some other file doing exactly this :(
What do you say about just putting a list of compatible panels directly into panel-dpi.txt?
Yours,
Linus Walleij
PATCH 8/11 video: ARM CLCD: add special panel hook for Versatiles
In reply to Linus WalleijThis adds a special panel init hook for the ARM reference designs Integrator (IM-PD1), Versatile and RealView, so we can configure a DPI panel from device tree and have it working without boardfiles for these machines.
Basically this is the same code as from the board files, just moved over to look up the syscon DT node and manipulate the special CLCD register from their regmap.
Tested on RealView PB11MPcore.
--- drivers/video/fbdev/Kconfig | 2 + drivers/video/fbdev/amba-clcd-versatile.c | 406 ++++++++++++++++++++++++++++++ drivers/video/fbdev/amba-clcd-versatile.h | 17 ++ drivers/video/fbdev/amba-clcd.c | 4 +- 4 files changed, 428 insertions(+), 1 deletion(-) create mode 100644 drivers/video/fbdev/amba-clcd-versatile.h
drivers/video/fbdev/Kconfig +2 -0
@@ -307,6 +307,8 @@ config PLAT_VERSATILE_CLCD def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS || ARCH_INTEGRATOR depends on ARM depends on FB_ARMCLCD && FB=y + select REGMAP + select MFD_SYSCON config FB_ACORN bool "Acorn VIDC support"
drivers/video/fbdev/amba-clcd-versatile.c +406 -0
415 lines not on this page · raw message
drivers/video/fbdev/amba-clcd-versatile.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Special local versatile callbacks +*/ +#include <linux/of.h> +#include <linux/amba/bus.h> +#include <linux/platform_data/video-clcd-versatile.h> + +#if defined(CONFIG_PLAT_VERSATILE_CLCD ) && defined(CONFIG_OF ) +int versatile_clcd_init_panel (struct clcd_fb *fb, +struct device_node **endpoint); +#else +static inline int versatile_clcd_init_panel (struct clcd_fb *fb, +struct device_node **endpoint) +{ +return 0 ; +} +#endif
drivers/video/fbdev/amba-clcd.c +3 -1
@@ -38,6 +38,7 @@#include <asm/sizes.h> #include "amba-clcd-nomadik.h" +#include "amba-clcd-versatile.h" #define to_clcd (info) container_of(info, struct clcd_fb, fb)
@@ -1042,7 +1043,8 @@ static int clcdfb_remove(struct amba_device *dev) }static struct clcd_vendor_data vendor_arm = { -/* No special business */ +/* Sets up the versatile board displays */ + .init_panel = versatile_clcd_init_panel, };static struct clcd_vendor_data vendor_nomadik = {
Signature · 1 line
2.4.3
PATCH 9/11 ARM: PB11MPCore: define a standard VGA panel
In reply to Linus WalleijLet's supply a standard VGA panel by default on the PB11MPCore, this will work with most monitors. If more screen real estate is desired, users can update the DPI definition.
--- arch/arm/boot/dts/arm-realview-pb11mp.dts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
arch/arm/boot/dts/arm-realview-pb11mp.dts +10 -9
@@ -629,16 +629,17 @@ }; }; + /* Standard 640x480 VGA timings */ panel-timing { - clock-frequency = <63500127>; - hactive = <1024>; - hback-porch = <152>; - hfront-porch = <48>; - hsync-len = <104>; - vactive = <768>; - vback-porch = <23>; - vfront-porch = <3>; - vsync-len = <4>; + clock-frequency = <25175000>; + hactive = <640>; + hback-porch = <48>; + hfront-porch = <16>; + hsync-len = <96>; + vactive = <480>; + vback-porch = <33>; + vfront-porch = <10>; + vsync-len = <2>; }; }; };
Signature · 1 line
2.4.3
PATCH 10/11 ARM: PB1176: define a standard VGA panel
In reply to Linus WalleijThis defines the CLCD block in the PB1176 and adds a standard 640x480 VGA panel to the device tree.
--- arch/arm/boot/dts/arm-realview-pb1176.dts | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
arch/arm/boot/dts/arm-realview-pb1176.dts +40 -0
@@ -362,6 +362,46 @@ clocks = <&uartclk>, <&pclk>; clock-names = "uartclk", "apb_pclk"; }; + + clcd at 10112000 { + compatible = "arm,pl111", "arm,primecell"; + reg = <0x10112000 0x1000>; + interrupt-parent = <&intc_dc1176>; + interrupt-names = "combined"; + interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&oscclk0>, <&pclk>; + clock-names = "clcdclk", "apb_pclk"; + + port { + clcd_pads: endpoint { + remote-endpoint = <&clcd_panel>; + arm,pl11x,tft-r0g0b0-pads = <0 8 16>; + }; + }; + + panel { + compatible = "panel-dpi"; + + port { + clcd_panel: endpoint { + remote-endpoint = <&clcd_pads>; + }; + }; + + /* Standard 640x480 VGA timings */ + panel-timing { + clock-frequency = <25175000>; + hactive = <640>; + hback-porch = <48>; + hfront-porch = <16>; + hsync-len = <96>; + vactive = <480>; + vback-porch = <33>; + vfront-porch = <10>; + vsync-len = <2>; + }; + }; + }; }; /* These peripherals are inside the FPGA rather than the DevChip */
Signature · 1 line
2.4.3
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Linus WalleijThis moves the versatile CLCD configuration to the device tree by:
- Deleting the board file set-up of CLCD displays and quirks, instead relying on the driver to handle this. The driver will attempt to auto-detect (like the board file did) and match to a corresponding panel in the device tree.
- Defining all auto-detectable panels in the device tree for the versatile-ab, defaulting the first one to VGA. The right panel will be selected at panel initialization, and should just work for the IB1 daughterboard panels, like EPSON.
- Creating a special superset DTS file for the IB2 daughterboard (phone form-factor) equipped Versatile, overriding the default VGA display with the Sanyo 2.5" portrait display definitions, so that the IB2-equipped Versatile can be used with this. This follows the pattern of how we define the Versatile PB as a superset of Versatile AB.
Tested on Versatile AB with just VGA with the default device tree, and with the IB2 daughterboard with the custom IB2 device tree. Tested to shunt in XVGA by modifying the device tree and this works too. Also tested on QEMU for Versatile in both VGA and Sanyo 2.5" mode. I don't have the IB1 daughterboard and its add-on displays, but it should work as long as the detection mechanism and device tree parameters are sound.
--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/versatile-ab-ib2.dts | 20 ++++ arch/arm/boot/dts/versatile-ab.dts | 203 ++++++++++++++++++++++++++++++++- arch/arm/mach-versatile/versatile_dt.c | 162 -------------------------- 4 files changed, 220 insertions(+), 166 deletions(-) create mode 100644 arch/arm/boot/dts/versatile-ab-ib2.dts
arch/arm/boot/dts/Makefile +1 -0
@@ -743,6 +743,7 @@ dtb-$(CONFIG_ARCH_UNIPHIER) += \ uniphier-proxstream2-vodka.dtb dtb-$(CONFIG_ARCH_VERSATILE) += \ versatile-ab.dtb \ + versatile-ab-ib2.dtb \ versatile-pb.dtb dtb-$(CONFIG_ARCH_VEXPRESS) += \ vexpress-v2p-ca5s.dtb \
arch/arm/boot/dts/versatile-ab-ib2.dts new file +20 -0
@@ -0,0 +1,20 @@ +#include <versatile-ab.dts> + +/ { + model = "ARM Versatile AB + IB2 board"; + + /* Special IB2 control register */ + ib2_syscon at 27000000 { + compatible = "arm,versatile-ib2-syscon", "syscon", "simple-mfd"; + reg = <0x27000000 0x4>; + + led at 00.4 { + compatible = "register-bit-led"; + offset = <0x00>; + mask = <0x10>; + label = "versatile-ib2:0"; + linux,default-trigger = "heartbeat"; + default-state = "on"; + }; + }; +};
arch/arm/boot/dts/versatile-ab.dts +199 -4
223 lines not on this page · raw message
arch/arm/mach-versatile/versatile_dt.c +0 -162
205 lines not on this page · raw message
Signature · 1 line
2.4.3
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 19 lines · Linus Walleij
This moves the versatile CLCD configuration to the device tree by:
- Deleting the board file set-up of CLCD displays and quirks, instead relying on the driver to handle this. The driver will attempt to auto-detect (like the board file did) and match to a corresponding panel in the device tree.
- Defining all auto-detectable panels in the device tree for the versatile-ab, defaulting the first one to VGA. The right panel will be selected at panel initialization, and should just work for the IB1 daughterboard panels, like EPSON.
- Creating a special superset DTS file for the IB2 daughterboard (phone form-factor) equipped Versatile, overriding the default VGA display with the Sanyo 2.5" portrait display definitions, so that the IB2-equipped Versatile can be used with this. This follows the pattern of how we define the Versatile PB as a superset of Versatile AB.
Quoted 7 lines
Tested on Versatile AB with just VGA with the default device tree, and with the IB2 daughterboard with the custom IB2 device tree. Tested to shunt in XVGA by modifying the device tree and this works too. Also tested on QEMU for Versatile in both VGA and Sanyo 2.5" mode. I don't have the IB1 daughterboard and its add-on displays, but it should work as long as the detection mechanism and device tree parameters are sound.
Well... I don't like this very much. The .dts should contain descriptions for hardware that is connected. Have you looked at DT overlays? I think they would be a much better match for this.
What's the SYS_CLCD register? An EEPROM or such, programmed when the board is manufactured? Is the panel meant to be switchable by the user, possibly to a panel that's not "standard"?
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160217/1978c9c1/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 3 lines · Tomi Valkeinen
What's the
SYS_CLCDregister? An EEPROM or such, programmed when the board is manufactured? Is the panel meant to be switchable by the user, possibly to a panel that's not "standard"?
If you read this bit of the patch, which describes the bits in the register, it gives some clues:
-#define SYS_CLCD_MODE_MASK (3 << 0) -#define SYS_CLCD_MODE_888 (0 << 0) -#define SYS_CLCD_MODE_5551 (1 << 0) -#define SYS_CLCD_MODE_565_RLSB (2 << 0) -#define SYS_CLCD_MODE_565_BLSB (3 << 0) -#define SYS_CLCD_NLCDIOON (1 << 2) -#define SYS_CLCD_VDDPOSSWITCH (1 << 3) -#define SYS_CLCD_PWR3V5SWITCH (1 << 4) -#define SYS_CLCD_ID_MASK (0x1f << 8) -#define SYS_CLCD_ID_SANYO_3_8 (0x00 << 8)
-#define SYS_CLCD_ID_UNKNOWN_8_4 (0x01 << 8)
-#define SYS_CLCD_ID_EPSON_2_2 (0x02 << 8)
-#define SYS_CLCD_ID_SANYO_2_5 (0x07 << 8)
-#define SYS_CLCD_ID_VGA (0x1f << 8)
The LCD panels plug-in to the board, and they have a 5-bit hard-wired ID, which is signalled through five ID lines into the FPGA.
The register is also writable, which is used to control power supplies to the LCD and an external MUX which changes the RGB format outside of the capabilities of the CLCD itself.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: [email protected] down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Tomi ValkeinenQuoted 11 lines · Tomi Valkeinen
Quoted 7 lines
Tested on Versatile AB with just VGA with the default device tree, and with the IB2 daughterboard with the custom IB2 device tree. Tested to shunt in XVGA by modifying the device tree and this works too. Also tested on QEMU for Versatile in both VGA and Sanyo 2.5" mode. I don't have the IB1 daughterboard and its add-on displays, but it should work as long as the detection mechanism and device tree parameters are sound.
Well... I don't like this very much. The .dts should contain descriptions for hardware that is connected. Have you looked at DT overlays? I think they would be a much better match for this.
I'll look into it. I don't know how good those are. They must be overlaid at runtime and anyways exist somewhere in memory so they can be overlaid in there.
Quoted 3 lines
What's the
SYS_CLCDregister? An EEPROM or such, programmed when the board is manufactured? Is the panel meant to be switchable by the user, possibly to a panel that's not "standard"?
As Russell points out: it's a register that contains a number saying what panel is connected.
So it is plug-n-play and I want to preserve this in the patch.
The alternative is to make one DTS per display type connected, but that is loosing all the nice plug'n'play :(
But if an overlay can do the same, I'm game for it.
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 7 lines · Linus Walleij
As Russell points out: it's a register that contains a number saying what panel is connected.
So it is plug-n-play and I want to preserve this in the patch.
The alternative is to make one DTS per display type connected, but that is loosing all the nice plug'n'play :(
That's totally insane: we're talking about what's plugged in through an external connector. It's not an "internal" device connector. These displays are external separate boxes to the board.
We don't have separate DT files just because we plugged in a USB device to a board., or a SDIO card, or an external HDD.
Quoted 1 line
But if an overlay can do the same, I'm game for it.
That's rather eww, because that means you need to either build the overlay into the kernel (which IIRC then ties the base DT file to that exact kernel) or it needs to sit in userland, which means no LCD display until userland is up and running. It doesn't sound very satisfactory, IMHO.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 9 lines · Russell King - ARM Linux
Quoted 7 lines · Linus Walleij
As Russell points out: it's a register that contains a number saying what panel is connected.
So it is plug-n-play and I want to preserve this in the patch.
The alternative is to make one DTS per display type connected, but that is loosing all the nice plug'n'play :(
Quoted 6 lines
That's totally insane: we're talking about what's plugged in through an external connector. It's not an "internal" device connector. These displays are external separate boxes to the board.
We don't have separate DT files just because we plugged in a USB device to a board., or a SDIO card, or an external HDD.
That's because USB, SDIO, HDD are all standard piece of HW, and any probing can be done via the bus.
For panels we need DT fragments. The question is where these fragments are and, possibly, who who loads them.
Quoted 7 lines
Quoted 1 line
But if an overlay can do the same, I'm game for it.
That's rather eww, because that means you need to either build the overlay into the kernel (which IIRC then ties the base DT file to that exact kernel) or it needs to sit in userland, which means no LCD display until userland is up and running. It doesn't sound very satisfactory, IMHO.
I don't think there are any satisfactory solutions to this.
For me the eww'est option is what this patch does, adding lots of panels to the .dts, even if the panels are not connected, and having a board specific fbdev driver. On the other hand, it's easy solution.
One a bit more general question here is: who should know the details of the board? Is it the bootloader, kernel or userspace? I think the aim has been to make the kernel drivers generic, not board specific. If so, it hints either towards the bootloader or userspace. If userspace, the panels will only be enabled later, when userspace is up.
In my opinion the best option would be to use DT overlays, but so that the bootloader would supply them, or construct the dtb. But afaik that's not possible at the moment. And perhaps I think that's the best option only because I don't work with the bootloaders =).
So, I don't like this, but I don't have a good suggestion how to do it better with the infrastructure in place at the moment.
We (TI) are struggling with the same problem at the moment (we don't even have detection capability in all cases), and so far I've refused to start adding board specific hacks to the display drivers. So I'm very interested to find a good solution to this too.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160218/768efc8c/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 7 lines · Tomi Valkeinen
In my opinion the best option would be to use DT overlays, but so that the bootloader would supply them, or construct the dtb. But afaik that's not possible at the moment. And perhaps I think that's the best option only because I don't work with the bootloaders =).
So, I don't like this, but I don't have a good suggestion how to do it better with the infrastructure in place at the moment.
The danger of that position is that we end up with nothing happening, and the problem remaining unresolved, which then pushes people into maintaining patches out of mainline just to have a working setup - which then pushes people to vendor trees.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines · Tomi Valkeinen
In my opinion the best option would be to use DT overlays, but so that the bootloader would supply them, or construct the dtb. But afaik that's not possible at the moment. And perhaps I think that's the best option only because I don't work with the bootloaders =).
Quoted 7 lines
Quoted 2 lines
So, I don't like this, but I don't have a good suggestion how to do it better with the infrastructure in place at the moment.
The danger of that position is that we end up with nothing happening, and the problem remaining unresolved, which then pushes people into maintaining patches out of mainline just to have a working setup - which then pushes people to vendor trees.
I agree.
I didn't express my position clearly: I'm ok with the approach, if we don't come up with anything better.
But if we go with this approach, it must be understood that it may cause problems later. It's not the most maintainable approach.
I'd also like to have an ack from the DT maintainers, as I think this is somewhat of an abuse of the DT.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160218/d9a76271/attachment-0001.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 15 lines · Tomi Valkeinen
Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines · Tomi Valkeinen
In my opinion the best option would be to use DT overlays, but so that the bootloader would supply them, or construct the dtb. But afaik that's not possible at the moment. And perhaps I think that's the best option only because I don't work with the bootloaders =).
Quoted 7 lines
Quoted 2 lines
So, I don't like this, but I don't have a good suggestion how to do it better with the infrastructure in place at the moment.
The danger of that position is that we end up with nothing happening, and the problem remaining unresolved, which then pushes people into maintaining patches out of mainline just to have a working setup - which then pushes people to vendor trees.
Quoted 4 lines
I agree.
I didn't express my position clearly: I'm ok with the approach, if we don't come up with anything better.
I'm checking to see if I can use the overlay primitives directly from the kernel.
It seems possible, basically to have a panel defined in the device tree for VGA as default, and then augment it depending on what we detect. Meaning I start to overwrite clock-frequency, pixelclk-active, hactive etc. It basically means we go back to having a database in the kernel.
I would then even overwrite the .compatible string from the kernel.
It may be more elegant than this solution though?
Quoted 5 lines
But if we go with this approach, it must be understood that it may cause problems later. It's not the most maintainable approach.
I'd also like to have an ack from the DT maintainers, as I think this is somewhat of an abuse of the DT.
What I am doing in this patch is sort of a "Schr?dinger's cat approach", I basically say that the cat is both dead and alive until we open the box, i.e. all displays are connected until we figure out which one it actually is.
Basically the approach taken could even handle the case of switching a display at runtime. Though I don't think the hardware would like that.
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Tomi ValkeinenQuoted 2 lines · Tomi Valkeinen
For panels we need DT fragments. The question is where these fragments are and, possibly, who who loads them.
I hacked something up that augments the device tree from the kernel, given you have a node with all the props you want to augment, tell me what you think of this and whether I should continue in this direction... also the DT people need to be involved:
#include "../../drivers/of/of_private.h"
/* Obviously make the property duplication function public instead, it's a test */
struct versatile_panel {
u32 id;
char *compatible;
u32 clock_frequency;
u32 pixelclk_active;
u32 hsync_active;
u32 vsync_active;
u32 de_active;
u32 hactive;
u32 hback_porch;
u32 hfront_porch;
u32 hsync_len;
u32 vactive;
u32 vback_porch;
u32 vfront_porch;
u32 vsync_len;
bool ib2;
};static const struct versatile_panel versatile_panels[] = {
{
.id = SYS_CLCD_ID_VGA,
.compatible = "VGA",
.clock_frequency = 25175000,
.pixelclk_active = 0,
.hsync_active = 1,
.vsync_active = 1,
.de_active = 1,
.hactive = 640,
.hback_porch = 48,
.hfront_porch = 16,
.hsync_len = 96,
.vactive = 480,
.vback_porch = 33,
.vfront_porch = 10,
.vsync_len = 2,
},
{
.id = SYS_CLCD_ID_SANYO_3_8,
.compatible = "sanyo,tm38qv67a02a",
.clock_frequency = 10000000,
.pixelclk_active = 1,
.hsync_active = 1,
.vsync_active = 1,
.de_active = 1,
.hactive = 320,
.hback_porch = 6,
.hfront_porch = 6,
.hsync_len = 6,
.vactive = 240,
.vback_porch = 6,
.vfront_porch = 6,
.vsync_len = 0,
},
{
.id = SYS_CLCD_ID_SHARP_8_4,
.compatible = "sharp,lq084v1dg21",
.clock_frequency = 25175000,
.pixelclk_active = 0,
.hsync_active = 1,
.vsync_active = 1,
.de_active = 1,
.hactive = 640,
.hback_porch = 48,
.hfront_porch = 16,
.hsync_len = 96,
.vactive = 480,
.vback_porch = 33,
.vfront_porch = 10,
.vsync_len = 2,
},
{
.id = SYS_CLCD_ID_EPSON_2_2,
.compatible = "epson,l2f50113t00",
.clock_frequency = 16000000,
.pixelclk_active = 0,
.hsync_active = 1,
.vsync_active = 1,
.de_active = 1,
.hactive = 176,
.hback_porch = 3,
.hfront_porch = 2,
.hsync_len = 3,
.vactive = 220,
.vback_porch = 1,
.vfront_porch = 0,
.vsync_len = 2,
},
{
.id = SYS_CLCD_ID_SANYO_2_5,
.compatible = "sanyo,alr252rgt",
.ib2 = true,
.clock_frequency = 5440000,
.pixelclk_active = 0,
.hsync_active = 0,
.vsync_active = 0,
.de_active = 1,
.hactive = 240,
.hback_porch = 20,
.hfront_porch = 10,
.hsync_len = 10,
.vactive = 320,
.vback_porch = 2,
.vfront_porch = 2,
.vsync_len = 2,
},
};static void update_timings_prop(struct device *dev,
struct of_changeset *cset, struct device_node *timings, const char *propname,
u32 val)
{
struct property *prop, *new;
__be32 *dt_val;
prop = of_find_property(timings, propname, NULL);
if (!prop) {
dev_err(dev, "could not find property \"%s\" - skipping\n",
propname);
return;
}
new = __of_prop_dup(prop, GFP_KERNEL);
if (!new) {
dev_err(dev, "could not copy property \"%s\" - skipping\n",
propname);
return;
}
dt_val = new->value;
*dt_val = cpu_to_be32(val);
of_changeset_update_property(cset, timings, new);
}static int versatile_overwrite_of_panel(struct device *dev,
struct device_node *panel, const struct versatile_panel *vpanel)
{
struct of_changeset cset;
struct device_node *timings;
int ret;
dev_info(dev, "CLCD: overwriting device tree\n");
of_changeset_init(&cset);
/* Find the timings node */
timings = of_get_child_by_name(panel, "panel-timing");
if (!timings) {
dev_err(dev, "could not find panel timing node\n");
goto err_destroy_cs;
}
update_timings_prop(dev, &cset, timings, "clock-frequency",
vpanel->clock_frequency);
update_timings_prop(dev, &cset, timings, "pixelclk-active",
vpanel->pixelclk_active);
update_timings_prop(dev, &cset, timings, "hsync-active",
vpanel->hsync_active);
update_timings_prop(dev, &cset, timings, "vsync-active",
vpanel->vsync_active);
update_timings_prop(dev, &cset, timings, "de-active",
vpanel->de_active);
update_timings_prop(dev, &cset, timings, "hactive",
vpanel->hactive);
update_timings_prop(dev, &cset, timings, "hback-porch",
vpanel->hback_porch);
update_timings_prop(dev, &cset, timings, "hsync-len",
vpanel->hsync_len);
update_timings_prop(dev, &cset, timings, "vactive",
vpanel->vactive);
update_timings_prop(dev, &cset, timings, "vback-porch",
vpanel->vback_porch);
update_timings_prop(dev, &cset, timings, "vfront-porch",
vpanel->vfront_porch);
update_timings_prop(dev, &cset, timings, "vsync-len",
vpanel->hsync_len);
ret = of_changeset_apply(&cset);
if (ret) {
dev_err(dev, "could not apply device tree changeset\n");
goto err_destroy_cs;
}
return ret;err_destroy_cs:
of_changeset_destroy(&cset);
return ret;
}static void versatile_panel_probe(struct device *dev,
struct device_node *endpoint)
{
struct versatile_panel const *vpanel = NULL;
struct device_node *panel = NULL;
u32 val;
int ret;
int i;
/*
* The Versatile CLCD has a panel auto-detection mechanism.
* We use this and look for the compatible panel in the
* device tree.
*/
ret = regmap_read(versatile_syscon_map, SYS_CLCD, &val);
if (ret) {
dev_err(dev, "cannot read CLCD syscon register\n");
return;
}
val &= SYS_CLCD_CLCDID_MASK;
dev_info(dev, "SYS_CLCD=%08x\n", val);
/* First find corresponding panel information */
for (i = 0; i < ARRAY_SIZE(versatile_panels); i++) {
vpanel = &versatile_panels[i];
if (val == vpanel->id) {
dev_err(dev, "autodetected panel \"%s\"\n",
vpanel->compatible);
break;
}
}
if (i == ARRAY_SIZE(versatile_panels)) {
dev_err(dev, "could not auto-detect panel\n");
return;
}
/* This is the default panel node in the device tree */
panel = of_graph_get_remote_port_parent(endpoint);
if (!panel) {
dev_err(dev, "could not locate remote port for panel\n");
return;
}
/*
* So now we dynamically update the display properties of the
* panel in accordance to what was detected..
*/
ret = versatile_overwrite_of_panel(dev, panel, vpanel);
if (ret) {
dev_err(dev, "cannot overwrite devicetree panel\n");
return;
}
/*
* If we have a Sanyo 2.5" port
* that we're running on an IB2 and proceed to look for the
* IB2 syscon regmap.
*/
if (!vpanel->ib2)
return;
versatile_ib2_map = syscon_regmap_lookup_by_compatible(
"arm,versatile-ib2-syscon");
if (IS_ERR(versatile_ib2_map)) {
dev_err(dev, "could not locate IB2 control register\n");
versatile_ib2_map = NULL;
return;
}
}This actually works. But would need some public device tree property augmentation API instead of the hacks. Should I pursue it?
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 9 lines · Linus Walleij
Quoted 2 lines · Tomi Valkeinen
For panels we need DT fragments. The question is where these fragments are and, possibly, who who loads them.
I hacked something up that augments the device tree from the kernel, given you have a node with all the props you want to augment, tell me what you think of this and whether I should continue in this direction... also the DT people need to be involved:
What you have there is almost like a legacy board file, isn't it? It's just passing DT data forward, instead of device platform data. In fact, if the driver in question supports platform data too, you could as well generate platform data for it (but I'm not saying that's a better option).
After thinking this a bit and discussing it with Laurent P., generally speaking I still think that the only sane option is that the bootloader does any detection needed and provides the kernel a .dtb that contains the HW that is connected. No board specific drivers are needed on the kernel side.
In some cases userspace loaded DT overlays may be fine, if the userspace can do the detection and the device in question is not somehow critical to operation. But I think displays are critical, and afaik in Versatile case the userspace can't even do the detection (?).
The third option is to have board specific display handling code and the display HW data in the kernel, as you've done in the patches.
But, of course, which option should be used for which board is not always clear...
What bootloader is used on Versatile? If it's some proprietary loader which can't be changed, then the bootloader option is out, and I guess it points to the third option, i.e. either the version in this patch or the earlier version. If it's u-boot, I would suggest going for the bootloader option.
Afaik u-boot doesn't support combining DT fragments yet. But (also afaik) the u-boot maintainer is ok with the idea. And I know there are others (for example TI) interested in the same functionality.
Now, adding that support might take some time, and in the meantime it'd be good to get the HW working with kernel with a temporary solution. To do that, my suggestion is basically "any solution which requires no (temporary) changes to .dts".
While I don't like too much the solution in the patch here, it's all inside kernel code and can be dropped easily, right? If we would merge the the multi-endpoint solution you had in the earlier patch, you would have to support that .dts in the future too.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160222/75449315/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 6 lines · Tomi Valkeinen
After thinking this a bit and discussing it with Laurent P., generally speaking I still think that the only sane option is that the bootloader does any detection needed and provides the kernel a .dtb that contains the HW that is connected. No board specific drivers are needed on the kernel side.
Quoted 7 lines
In some cases userspace loaded DT overlays may be fine, if the userspace can do the detection and the device in question is not somehow critical to operation. But I think displays are critical, and afaik in Versatile case the userspace can't even do the detection (?).
The third option is to have board specific display handling code and the display HW data in the kernel, as you've done in the patches.
Yeah correct...
Quoted 4 lines
But, of course, which option should be used for which board is not always clear...
What bootloader is used on Versatile?
It's U-boot indeed. Not that I've tried to compile or use it, I got it as binary from ARM.
Quoted 9 lines
If it's some proprietary loader
which can't be changed, then the bootloader option is out, and I guess it points to the third option, i.e. either the version in this patch or the earlier version. If it's u-boot, I would suggest going for the bootloader option.Afaik u-boot doesn't support combining DT fragments yet. But (also afaik) the u-boot maintainer is ok with the idea. And I know there are others (for example TI) interested in the same functionality.
Hm OK.... so the bootloader need to be better at augmenting device trees than the kernel. Well... The problem is that there are a bunch of deployed systems out there and they all need to have their boot loader updated then, which may be OK since it's ARM development boards but I don't know.
Quoted 9 lines
Now, adding that support might take some time, and in the meantime it'd be good to get the HW working with kernel with a temporary solution. To do that, my suggestion is basically "any solution which requires no (temporary) changes to .dts".
While I don't like too much the solution in the patch here, it's all inside kernel code and can be dropped easily, right? If we would merge the the multi-endpoint solution you had in the earlier patch, you would have to support that .dts in the future too.
To go with this solution I need to extend the drivers/of library to be able to update properties properly instead of this hack, and that is non-reversible if we start to use it.
It is not really an overlay because the DT stuff is dynamically augmented by the kernel, not taken from somewhere else.
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Linus WalleijQuoted 1 line · Linus Walleij
This moves the versatile CLCD configuration to the device tree by:
As this Schr?dinger's cat approach seems controversial, as well as the alternative to manipulate the DT in memory at run-time, I will respin the series without the full Versatile support, adding plug-in for the other ARM boards and and half-baked support for the Versatile supporting just VGA (like the other reference designs from ARM).
The pluggable displays prove yet again to be a problem to the world, sigh.
I will think of a better solution, if any, for this for v4.6, but will put forward something that handles the Nomadik and all the other ARM reference designs for now.
Yours,
Linus Walleij
Arnd Bergmann
maintainerPATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 4 lines · On Tuesday 23 February 2016 10:08:05 Linus Walleij wrote:
I will think of a better solution, if any, for this for v4.6, but will put forward something that handles the Nomadik and all the other ARM reference designs for now.
How about still describing all known panels in the DT marked 'status="disabled"', but then having a minimal piece of board specific code that just enables whichever one gets detected at boot time?
Arnd
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 9 lines · Arnd Bergmann
Quoted 4 lines · On Tuesday 23 February 2016 10:08:05 Linus Walleij wrote:
I will think of a better solution, if any, for this for v4.6, but will put forward something that handles the Nomadik and all the other ARM reference designs for now.
How about still describing all known panels in the DT marked 'status="disabled"', but then having a minimal piece of board specific code that just enables whichever one gets detected at boot time?
Close but no cigar :D
It means that all panels (enabled and all disabled) have to have the same endpoint in the of_graph.
I tried it:
panel at 0 {
compatible = "panel-dpi";
port {
clcd_panel: endpoint {
remote-endpoint = <&clcd_pads>;
};
};(...)
panel at 1 {
compatible = "panel-dpi";
port {
clcd_panel: endpoint {
remote-endpoint = <&clcd_pads>;
};
};(...)
display at 10120000 {
(...)
port {
(...)
clcd_pads: endpoint at 0 {
reg = <0>;
remote-endpoint = <&clcd_panel>;
arm,pl11x,tft-r0g0b0-pads = <1 7 13>;
};
};Building the device tree:
ERROR (duplicate_label): ERROR (duplicate_label): Duplicate label 'clcd_panel' on /panel at 1/port/endpoint and /panel at 0/port/endpoint Duplicate label 'clcd_panel' on /panel at 1/port/endpoint and /panel at 0/port/endpoint
So the dtc does not allow duplicate node labels for the phandle even if the node it resides in is disabled. Tough luck...
Yours,
Linus Walleij
Arnd Bergmann
maintainerPATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 8 lines · On Tuesday 23 February 2016 11:10:33 Linus Walleij wrote:
ERROR (
duplicate_label): ERROR (duplicate_label): Duplicate label 'clcd_panel' on /panel at 1/port/endpoint and /panel at 0/port/endpoint Duplicate label 'clcd_panel' on /panel at 1/port/endpoint and /panel at 0/port/endpointSo the dtc does not allow duplicate node labels for the phandle even if the node it resides in is disabled. Tough luck...
Ah, too bad. I guess we could still do it by also setting the remote-endpoint property to node->phandle, but then it's not as simple any more.
Arnd
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · On Tuesday 23 February 2016 11:10:33 Linus Walleij wrote:
ERROR (
duplicate_label): ERROR (duplicate_label): Duplicate label 'clcd_panel' on /panel at 1/port/endpoint and /panel at 0/port/endpoint Duplicate label 'clcd_panel' on /panel at 1/port/endpoint and /panel at 0/port/endpoint
Quoted 6 lines
Quoted 2 lines
So the dtc does not allow duplicate node labels for the phandle even if the node it resides in is disabled. Tough luck...
Ah, too bad. I guess we could still do it by also setting the remote-endpoint property to
node->phandle, but then it's not as simple any more.
I think it could be done with all panels in an endpoint of their own, as it is currently in this patch. All the panels would be disabled by default, and one of them gets enabled at some early boot phase. The fbdev driver would then iterate the endpoints and pick the first panel that's enabled.
That would be almost the same as what's already in this patch, except (if I'm not mistaken) the detection part could be in platform code, and the fbdev driver itself would know nothing about board specific detection or board specific panel lists.
So maybe that would be a bit cleaner. Still ugly, I think =). I really don't like having possible-panels in the Schr?dinger's DT data
(http://www.angryflower.com/387.html).
That said, maybe this is the best way to deal with Versatile, without requiring any change to the bootloader or the boot mechanism.
What is the current status of Versatile? Have we had working display with Versatile when booting with device tree? Or has the display been supported only with legacy boot?
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160223/39c3ae95/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 4 lines · Tomi Valkeinen
That would be almost the same as what's already in this patch, except (if I'm not mistaken) the detection part could be in platform code, and the fbdev driver itself would know nothing about board specific detection or board specific panel lists.
In this patch set the board/platform-specific plugins are separated out adding the opaque .board_init() and .panel_init() to the driver. The platform-specific code is in completely separate files this way, and the CLCD driver itself just handles various versions of that IP block.
Quoted 3 lines
So maybe that would be a bit cleaner. Still ugly, I think =). I really don't like having possible-panels in the Schr?dinger's DT data
(http://www.angryflower.com/387.html).
OK I will focus my work on the DT-augment code instead.
Quoted 2 lines
That said, maybe this is the best way to deal with Versatile, without requiring any change to the bootloader or the boot mechanism.
Depends on if the OF core maintainers will accept my patches to dynamically alter DT properties at runtime. If I can't do that then I have to go back to the Schr?dinger patch.
Quoted 3 lines
What is the current status of Versatile? Have we had working display with Versatile when booting with device tree? Or has the display been supported only with legacy boot?
Versatile is DT only as of kernel v4.5. The DT boot uses AUXDATA which is the Frankenstein solution, bolting on a boardfile piece to the DT boot and ignoring the existing panel bindings, and of course standing in the way of cleaning things up.
IMO Schr?dinger > Frankenstein.
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 7 lines · Linus Walleij
Quoted 4 lines · Tomi Valkeinen
That would be almost the same as what's already in this patch, except (if I'm not mistaken) the detection part could be in platform code, and the fbdev driver itself would know nothing about board specific detection or board specific panel lists.
Quoted 5 lines
In this patch set the board/platform-specific plugins are separated out adding the opaque .board_init() and .panel_init() to the driver. The platform-specific code is in completely separate files this way, and the CLCD driver itself just handles various versions of that IP block.
I see. Yes, it's in separate files but still part of the fbdev driver.
One thing to mention is that I'm looking at this maybe from a slightly different perspective.
TI makes SoCs which may be used on a lot of different boards from different vendors. I will not allow any solution on TI display subsystem that would contain any board specific data, as that would quickly expand to an unmaintainable mess. All the display data has to come from the bootloader.
Maybe Versatile is different. If CLCD is only used on that board, or a small family of boards, from one vendor, I guess it is maintainable to have board specific driver parts for CLCD. But if CLCD can be used by many vendors in many different boards, I'd steer clear of board specific driver code.
Quoted 5 lines
Quoted 3 lines
So maybe that would be a bit cleaner. Still ugly, I think =). I really don't like having possible-panels in the Schr?dinger's DT data
(http://www.angryflower.com/387.html).OK I will focus my work on the DT-augment code instead.
Yeah, I don't know if that will fly either, so I think it's better to see if these discussion go somewhere first.
Quoted 7 lines
Quoted 2 lines
That said, maybe this is the best way to deal with Versatile, without requiring any change to the bootloader or the boot mechanism.
Depends on if the OF core maintainers will accept my patches to dynamically alter DT properties at runtime. If I can't do that then I have to go back to the Schr?dinger patch.
Quoted 8 lines
Quoted 3 lines
What is the current status of Versatile? Have we had working display with Versatile when booting with device tree? Or has the display been supported only with legacy boot?
Versatile is DT only as of kernel v4.5. The DT boot uses AUXDATA which is the Frankenstein solution, bolting on a boardfile piece to the DT boot and ignoring the existing panel bindings, and of course standing in the way of cleaning things up.
Ok. I feel everyone is trying to push the ugly part out of their domain. I want the board specific hacks out of fbdev. Bootloader people don't want it there. arch/arm/ people don't want it there. =)
So what you're saying is that Versatile boots now with DT, and supports display without any panel info in the DT data? If so, it means that when you add panel data to the .dts, the old .dts will not support display anymore, except if you leave all the current boardfile stuff there.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160223/9c052c07/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 3 lines · Tomi Valkeinen
Ok. I feel everyone is trying to push the ugly part out of their domain. I want the board specific hacks out of fbdev. Bootloader people don't want it there.
arch/arm/people don't want it there. =)
I think that is really really unfair. No one is trying to push ugly bits out of their domain - this is being driven by Linus, who is trying to convert Versatile to DT. There is no other agenda here.
Remember, I was the one who wrote the CLCD driver, and it was written to support the boards at the time using the best methods at the time. Things change, people's ideas of what's acceptable change. What was acceptable when classes of boards were separate is no longer acceptable with single zImage.
The board specific parts of CLCD were in arch/arm for a very long time, but that gets in the way of single zImage, and the solution adopted by the newly interested parties has been to move them to drivers/video to keep things working.
That's how we're here: there isn't a conspiracy as you seem to be thinking.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 9 lines · Russell King - ARM Linux
Quoted 3 lines · Tomi Valkeinen
Ok. I feel everyone is trying to push the ugly part out of their domain. I want the board specific hacks out of fbdev. Bootloader people don't want it there.
arch/arm/people don't want it there. =)I think that is really really unfair. No one is trying to push ugly bits out of their domain - this is being driven by Linus, who is trying to convert Versatile to DT. There is no other agenda here.
Quoted 5 lines
Remember, I was the one who wrote the CLCD driver, and it was written to support the boards at the time using the best methods at the time. Things change, people's ideas of what's acceptable change. What was acceptable when classes of boards were separate is no longer acceptable with single zImage.
That's fine. I've done the same. The point here is where should we aim for with today's kernel? What's the good solution for the future boards?
Quoted 4 lines
The board specific parts of CLCD were in
arch/armfor a very long time, but that gets in the way of single zImage, and the solution adopted by the newly interested parties has been to move them todrivers/videoto keep things working.
And I'm fine with having board specific parts in drivers/video when needed. That's the only option when we really need a driver for the board specific parts, i.e. we need to do something with the board specific HW at runtime.
But that's not really the case with Versatile. Correct me if I'm wrong, but there's just one panel connected to the board at a time and the panel cannot be changed at runtime. We need to do the board specific panel probing once at boot time, but other than that, there's no difference to a single on-board panel.
To me it sounds that the cleanest solution to this is that the bootloader does the detection (it's a trivial detection, isn't it? no complex busses need to be used?), and just passes the kernel the correct HW setup with DT.
Again, I understand there are lots of board out there without bootloader doing that, so we may not get there with Versatile. But if someone comes with patches for a new board, I'd like to have a good suggestion how to handle similar cases the best way.
Quoted 2 lines
That's how we're here: there isn't a conspiracy as you seem to be thinking.
I wasn't exactly serious there, as the smiley tried to imply...
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160224/6b6f3241/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Tomi ValkeinenQuoted 5 lines · Tomi Valkeinen
Maybe Versatile is different. If CLCD is only used on that board, or a small family of boards, from one vendor, I guess it is maintainable to have board specific driver parts for CLCD. But if CLCD can be used by many vendors in many different boards, I'd steer clear of board specific driver code.
OK I think at this point we would say that CLCD is a legacy driver. It is a PrimceCell (IP block) made by ARM Ltd for their reference designs, and intended for demonstration purposes. It is used in these:arch/arm/mach-integrator/arch/arm/mach-versatile/arch/arm/mach-realview/arch/arm/mach-vexpress/
At the last iteration of their reference designs, ARM invented a new display driver called HDLCD, which you can find in drivers/gpu/drm/arm in linux-next. Thus the CLCD is now legacy.
As part of signing a deal with ARM to synthesize their silicon, vendors get copies of the IP blocks to jumpstart design work. Sometimes they will design their own display controller, sometimes they will take the ARM CLCD and synthesize it right off and not innovate around it at all. That is why CLCD also appears in:arch/arm/configs/axm55xx_defconfig arch/arm/configs/lpc18xx_defconfig arch/arm/boot/dts/lpc18xx.dtsi arch/arm/configs/lpc32xx_defconfig arch/arm/boot/dts/lpc32xx.dtsi arch/arm/configs/netx_defconfig arch/arm/configs/spear3xx_defconfig
Sometimes the vendors will tweak the CLCD. St Microelectronics did the latter, and that is why I add support for that variant as well.
HOWEVER: the ARM Versatile is the *only* platform I have seen of these that have plug'n'play for the display.
*All* the others
will be very happy with *ONE* display defined as panel in the device tree, and off they go. Usually VGA. And that will look much like arch/arm/boot/dts/vexpress-v2m.dtsi already look like today, using "panel-dpi" to define their displays.
They and their displays may need some board-specific or SoC specific tweaks though, just like the Nomadik. The Vexpress is happy to be able to go without, because I guess it is hard-coded to just use the DVI output, so no path for the signal needs to be set up.
I add support for doing this for the Integrator and RealView in the patch set, by grabbing a handle to the system controller where they have a few "misc registers". However if you look at it:
static void integrator_clcd_enable(struct clcd_fb *fb)
{
struct fb_var_screeninfo *var = &fb->fb.var;
u32 val;
dev_info(&fb->dev->dev, "enable Integrator CLCD connectors\n");
val = INTEGRATOR_CLCD_LCD_STATIC1 | INTEGRATOR_CLCD_LCD_STATIC2 |
INTEGRATOR_CLCD_LCD0_EN | INTEGRATOR_CLCD_LCD1_EN;
if (var->bits_per_pixel <= 8 ||
(var->bits_per_pixel == 16 && var->green.length == 5))
/* Pseudocolor, RGB555, BGR555 */
val |= INTEGRATOR_CLCD_LCDMUX_VGA555;
else if (fb->fb.var.bits_per_pixel <= 16)
/* truecolor RGB565 */
val |= INTEGRATOR_CLCD_LCDMUX_VGA565;
else
val = 0; /* no idea for this, don't trust the docs */
regmap_update_bits(versatile_syscon_map,
INTEGRATOR_HDR_CTRL_OFFSET,
0,
INTEGRATOR_CLCD_MASK);
}This is stuff that is so closely tied in to the fbdev driver that even if it is SoC-specific (and reside in arch/arm/mach-integrator etc today) it would be hard to argument that it should not be part of the fbdev driver: what it does is connect the lines out of the CLCD block to the physical VGA encode chip in different ways depending on how the pixels were set up.
Yours,
Linus Walleij
Arnd Bergmann
maintainerPATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 31 lines · On Thursday 25 February 2016 15:04:52 Linus Walleij wrote:
I add support for doing this for the Integrator and RealView in the patch set, by grabbing a handle to the system controller where they have a few "misc registers". However if you look at it:
static void
integrator_clcd_enable(struct clcd_fb *fb){ struct fb_var_screeninfo *var = &fb->fb.var; u32 val; dev_info(&fb->dev->dev, "enable Integrator CLCD connectors\n"); val = INTEGRATOR_CLCD_LCD_STATIC1 | INTEGRATOR_CLCD_LCD_STATIC2 | INTEGRATOR_CLCD_LCD0_EN | INTEGRATOR_CLCD_LCD1_EN; if (var->bits_per_pixel <= 8 || (var->bits_per_pixel == 16 && var->green.length == 5)) /* Pseudocolor, RGB555, BGR555 */ val |= INTEGRATOR_CLCD_LCDMUX_VGA555; else if (fb->fb.var.bits_per_pixel <= 16) /* truecolor RGB565 */ val |= INTEGRATOR_CLCD_LCDMUX_VGA565; else val = 0; /* no idea for this, don't trust the docs */ regmap_update_bits(versatile_syscon_map, INTEGRATOR_HDR_CTRL_OFFSET, 0, INTEGRATOR_CLCD_MASK); }
Quoted 6 lines
This is stuff that is so closely tied in to the fbdev driver that even if it is SoC-specific (and reside in
arch/arm/mach-integratoretc today) it would be hard to argument that it should not be part of the fbdev driver: what it does is connect the lines out of the CLCD block to the physical VGA encode chip in different ways depending on how the pixels were set up.
I think the nicest approach here would be to make this a layered driver, where you have a separate platform_driver instance that contains all the versatile specific add-ons, and this calls into the common driver that handles everything that is not specific to versatile.
It may not be worth investing much into a rework to get there though, so simply putting it all into one module sounds like a reasonable compromise.
Arnd
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Linus WalleijQuoted 2 lines · Linus Walleij
HOWEVER: the ARM Versatile is the *only* platform I have seen of these that have plug'n'play for the display.
And Realview, at least Realview EB, which is the same format board as Versatile and carries the same LCD connector.
Quoted 5 lines
*All* the others
will be very happy with *ONE* display defined as panel in the device tree, and off they go. Usually VGA. And that will look much likearch/arm/boot/dts/vexpress-v2m.dtsialready look like today, using "panel-dpi" to define their displays.
Versatile Express only has a DVI connector.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Linus WalleijQuoted 9 lines · Linus Walleij
Quoted 5 lines · Tomi Valkeinen
Maybe Versatile is different. If CLCD is only used on that board, or a small family of boards, from one vendor, I guess it is maintainable to have board specific driver parts for CLCD. But if CLCD can be used by many vendors in many different boards, I'd steer clear of board specific driver code.
OK I think at this point we would say that CLCD is a legacy driver.
Ok.
My biggest fear with this is the maintenance nightmare that comes if an IP or panel is used in multiple SoCs and future designs. We have the same display subsystem and panel drivers used from OMAP2 forward, and it's been a constant struggle, so I've come to appreciate the effort to split things up as much as possible, so that when the time comes when the HW guys have decided to change a piece here or there, it's easier to cope with.
Anyway, if it's likely that we're not seeing new CLCD boards, I think it's fine if we don't go to any great lengths to clean things up there. Let's just get it working.
Quoted 2 lines
HOWEVER: the ARM Versatile is the *only* platform I have seen of these that have plug'n'play for the display.
Ok. And presumably no new boards will use that plug'n'play display, so we can just consider it specific to versatile.
Quoted 3 lines
*All* the others
will be very happy with *ONE* display defined as panel in the device tree, and off they go. Usually VGA. And that will look
You keep mentioning VGA. So is there are VGA output? Or do you just mean MIPI DPI panels, which happen to take the same video timings as VGA?
Quoted 30 lines
I add support for doing this for the Integrator and RealView in the patch set, by grabbing a handle to the system controller where they have a few "misc registers". However if you look at it:
static void
integrator_clcd_enable(struct clcd_fb *fb){ struct fb_var_screeninfo *var = &fb->fb.var; u32 val; dev_info(&fb->dev->dev, "enable Integrator CLCD connectors\n"); val = INTEGRATOR_CLCD_LCD_STATIC1 | INTEGRATOR_CLCD_LCD_STATIC2 | INTEGRATOR_CLCD_LCD0_EN | INTEGRATOR_CLCD_LCD1_EN; if (var->bits_per_pixel <= 8 || (var->bits_per_pixel == 16 && var->green.length == 5)) /* Pseudocolor, RGB555, BGR555 */ val |= INTEGRATOR_CLCD_LCDMUX_VGA555; else if (fb->fb.var.bits_per_pixel <= 16) /* truecolor RGB565 */ val |= INTEGRATOR_CLCD_LCDMUX_VGA565; else val = 0; /* no idea for this, don't trust the docs */ regmap_update_bits(versatile_syscon_map, INTEGRATOR_HDR_CTRL_OFFSET, 0, INTEGRATOR_CLCD_MASK); }
Quoted 6 lines
This is stuff that is so closely tied in to the fbdev driver that even if it is SoC-specific (and reside in
arch/arm/mach-integratoretc today) it would be hard to argument that it should not be part of the fbdev driver: what it does is connect the lines out of the CLCD block to the physical VGA encode chip in different ways depending on how the pixels were set up.
Hmm so is there an external VGA encoder on the board?
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160225/bd6de85d/attachment-0001.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 6 lines · Tomi Valkeinen
Quoted 3 lines
*All* the others
will be very happy with *ONE* display defined as panel in the device tree, and off they go. Usually VGA. And that will lookYou keep mentioning VGA. So is there are VGA output? Or do you just mean MIPI DPI panels, which happen to take the same video timings as VGA?
There is a 15-pin VGA connector too. No DDC though.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Tomi ValkeinenQuoted 8 lines · Tomi Valkeinen
Quoted 3 lines · Linus Walleij
*All* the others
will be very happy with *ONE* display defined as panel in the device tree, and off they go. Usually VGA. And that will lookYou keep mentioning VGA. So is there are VGA output? Or do you just mean MIPI DPI panels, which happen to take the same video timings as VGA?
Russell beat me to it, yes there is an external VGA encoder. It needs some bits set up through the "misc registers" system controller as indicated. From the CLCD hardware point of view it's no different than any other panel. So the DTS fragment looks like so:
panel {
compatible = "panel-dpi";
port {
clcd_panel: endpoint {
remote-endpoint = <&clcd_pads>;
};
};
/* Standard 640x480 VGA timings */
panel-timing {
clock-frequency = <25175000>;
hactive = <640>;
hback-porch = <48>;
hfront-porch = <16>;
hsync-len = <96>;
vactive = <480>;
vback-porch = <33>;
vfront-porch = <10>;
vsync-len = <2>;
};
};This is reported as the default display type if no LCD panel is connected.
If a LCD panel is also connected, it take precedence.
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 40 lines · Linus Walleij
Quoted 8 lines · Tomi Valkeinen
Quoted 3 lines · Linus Walleij
*All* the others
will be very happy with *ONE* display defined as panel in the device tree, and off they go. Usually VGA. And that will lookYou keep mentioning VGA. So is there are VGA output? Or do you just mean MIPI DPI panels, which happen to take the same video timings as VGA?
Russell beat me to it, yes there is an external VGA encoder. It needs some bits set up through the "misc registers" system controller as indicated. From the CLCD hardware point of view it's no different than any other panel. So the DTS fragment looks like so:
panel { compatible = "panel-dpi"; port { clcd_panel: endpoint { remote-endpoint = <&clcd_pads>; }; }; /* Standard 640x480 VGA timings */ panel-timing { clock-frequency = <25175000>; hactive = <640>; hback-porch = <48>; hfront-porch = <16>; hsync-len = <96>; vactive = <480>; vback-porch = <33>; vfront-porch = <10>; vsync-len = <2>; }; };
Quoted 4 lines
This is reported as the default display type if no LCD panel is connected.
If a LCD panel is also connected, it take precedence.
Ok. Well... It's all wrong, but I don't know how much time we want to spend on fixing that.
Although one thing to consider is that if there is ever going to be a DRM driver for CLCD, it would be good to have the device tree parts correctly representing the hardware, so that the DRM driver could be implemented in a cleaner, more generic way.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160226/2d0bbf63/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 4 lines · Tomi Valkeinen
Although one thing to consider is that if there is ever going to be a DRM driver for CLCD, it would be good to have the device tree parts correctly representing the hardware, so that the DRM driver could be implemented in a cleaner, more generic way.
OK so for the next kernel cycle I can work on that.
The non-controversial patch set is essentially just using the DT bindings that are already in the kernel and in widespread use. See:
commit d10715be03bd8bad59ddc50236cb140c3bd73c7b
"video: ARM CLCD: Add DT support"
They follow the example set by
commit 478a4f81af4936c683a03488e15b087e28cb4f0d
"ARM: vexpress: Add CLCD Device Tree properties"
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 10 lines · Linus Walleij
Quoted 4 lines · Tomi Valkeinen
Although one thing to consider is that if there is ever going to be a DRM driver for CLCD, it would be good to have the device tree parts correctly representing the hardware, so that the DRM driver could be implemented in a cleaner, more generic way.
OK so for the next kernel cycle I can work on that.
The non-controversial patch set is essentially just using the DT bindings
Yes, I think the non-controversial series is fine. Will you be sending a v2 of that series?
Quoted 7 lines
that are already in the kernel and in widespread use. See:
commitd10715be03bd8bad59ddc50236cb140c3bd73c7b"video: ARM CLCD: Add DT support"They follow the example set by
commit478a4f81af4936c683a03488e15b087e28cb4f0d
"ARM: vexpress: Add CLCD Device Tree properties"
This one not actually correct, as the panel node is inside the clcd node. The child parent relationship should represent a control bus. But that's a different topic...
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160307/363b6742/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Tomi ValkeinenQuoted 3 lines · Tomi Valkeinen
Anyway, if it's likely that we're not seeing new CLCD boards, I think it's fine if we don't go to any great lengths to clean things up there. Let's just get it working.
Do you think you could merge the other patch set I made, that doesn't even deal with this plug-n-play-panel issue?
I have rebased the two approaches to autodetection on top of that.
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Linus Walleij(cc'ing a few more people as this is going into generic direction)
Quoted 11 lines · Linus Walleij
Quoted 1 line · Linus Walleij
This moves the versatile CLCD configuration to the device tree by:
As this Schr?dinger's cat approach seems controversial, as well as the alternative to manipulate the DT in memory at run-time, I will respin the series without the full Versatile support, adding plug-in for the other ARM boards and and half-baked support for the Versatile supporting just VGA (like the other reference designs from ARM).
Quoted 6 lines
The pluggable displays prove yet again to be a problem to the world, sigh.
I will think of a better solution, if any, for this for v4.6, but will put forward something that handles the Nomadik and all the other ARM reference designs for now.
I had a chat with Tom Rini and Pantelis Antoniou yesterday.
Panto is about to send a new series for DT overlay management soon. I haven't had time to test that yet, but what it would give us is that you could build DT overlay binaries as "firmware" into the kernel image, and thus the panel DT data would be there even before rootfs is mounted. The DT overlays can be loaded from the rootfs or initramfs too, if it's not critical to get the display up early.
I'm not quite sure how it works if, as in versatile display case, there are multiple DT overlays of which one has to be enabled. I hope there's support to choose which one to use via kernel cmdline or similar.
I would personally like it much more if the bootloader would either compose a final dtb from DT fragments and pass it to the kernel, or alternatively the bootloader would pass the base dtb image and a bunch of DT overlays to the kernel, and the kernel would deal with the DT overlays.
In any case, I think the firmware solution is a good step forward, and will probably work fine for many users. Then again, I haven't tested it yet so I don't know the details, and it's not in the mainline.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160223/79e69ace/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 34 lines · Tomi Valkeinen
(cc'ing a few more people as this is going into generic direction)
Quoted 11 lines · Linus Walleij
Quoted 1 line · Linus Walleij
This moves the versatile CLCD configuration to the device tree by:
As this Schr?dinger's cat approach seems controversial, as well as the alternative to manipulate the DT in memory at run-time, I will respin the series without the full Versatile support, adding plug-in for the other ARM boards and and half-baked support for the Versatile supporting just VGA (like the other reference designs from ARM).
Quoted 6 lines
The pluggable displays prove yet again to be a problem to the world, sigh.
I will think of a better solution, if any, for this for v4.6, but will put forward something that handles the Nomadik and all the other ARM reference designs for now.
I had a chat with Tom Rini and Pantelis Antoniou yesterday.
Panto is about to send a new series for DT overlay management soon. I haven't had time to test that yet, but what it would give us is that you could build DT overlay binaries as "firmware" into the kernel image, and thus the panel DT data would be there even before rootfs is mounted. The DT overlays can be loaded from the rootfs or initramfs too, if it's not critical to get the display up early.
I'm not quite sure how it works if, as in versatile display case, there are multiple DT overlays of which one has to be enabled. I hope there's support to choose which one to use via kernel cmdline or similar.
Quoted 6 lines
I would personally like it much more if the bootloader would either compose a final dtb from DT fragments and pass it to the kernel, or alternatively the bootloader would pass the base dtb image and a bunch of DT overlays to the kernel, and the kernel would deal with the DT overlays.
If there was a nice way to merge the device trees, I would love to create device tree 'modules' that could be loaded at will and merged just before the time of boot. I could see this being useful beyond just plugable displays.
Quoted 4 lines
In any case, I think the firmware solution is a good step forward, and will probably work fine for many users. Then again, I haven't tested it yet so I don't know the details, and it's not in the mainline.
I am willing to test it, but I'll need the patch and some instructions from Panto.
Quoted 2 lines
Tomi
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Hi Adam,
Quoted 43 lines · Adam Ford
Quoted 34 lines · Tomi Valkeinen
(cc'ing a few more people as this is going into generic direction)
Quoted 11 lines · Linus Walleij
Quoted 1 line · Linus Walleij
This moves the versatile CLCD configuration to the device tree by:
As this Schr?dinger's cat approach seems controversial, as well as the alternative to manipulate the DT in memory at run-time, I will respin the series without the full Versatile support, adding plug-in for the other ARM boards and and half-baked support for the Versatile supporting just VGA (like the other reference designs from ARM).
Quoted 6 lines
The pluggable displays prove yet again to be a problem to the world, sigh.
I will think of a better solution, if any, for this for v4.6, but will put forward something that handles the Nomadik and all the other ARM reference designs for now.
I had a chat with Tom Rini and Pantelis Antoniou yesterday.
Panto is about to send a new series for DT overlay management soon. I haven't had time to test that yet, but what it would give us is that you could build DT overlay binaries as "firmware" into the kernel image, and thus the panel DT data would be there even before rootfs is mounted. The DT overlays can be loaded from the rootfs or initramfs too, if it's not critical to get the display up early.
I'm not quite sure how it works if, as in versatile display case, there are multiple DT overlays of which one has to be enabled. I hope there's support to choose which one to use via kernel cmdline or similar.
Quoted 6 lines
I would personally like it much more if the bootloader would either compose a final dtb from DT fragments and pass it to the kernel, or alternatively the bootloader would pass the base dtb image and a bunch of DT overlays to the kernel, and the kernel would deal with the DT overlays.
Quoted 5 lines
If there was a nice way to merge the device trees, I would love to create device tree 'modules' that could be loaded at will and merged just before the time of boot. I could see this being useful beyond just plugable displays.
Looks like you would be happy by having a way to boot using a device tree blob + a number of device tree overlay blobs to be applied in sequence.
You could append the dtbo?s to the device tree blob (where-ever that may be) and it should work.
The good thing about this scheme is that it?s independent of the bootloader.
An advanced bootloader (like u-boot) with DT smarts can create the appended DT blob itself, while a dumb one can just be given the appended blob as it was created outside of the device.
Quoted 7 lines
Quoted 4 lines
In any case, I think the firmware solution is a good step forward, and will probably work fine for many users. Then again, I haven't tested it yet so I don't know the details, and it's not in the mainline.
I am willing to test it, but I'll need the patch and some instructions from Panto.
The appended device tree blob thing does not exist yet, but it?s not such a big problem to add. I?d give it a shot this week.
The standard device tree overlays are in my overlay branch at
https://github.com/pantoniou/linux-beagle-track-mainline/tree/bbb-overlays
The capemgr has options for parsing a kernel command line to apply an overlay:
The command line options are enable_partno & disable_partno where you supply the part numbers of the capes you want enabled/disabled at boot.
The capemgr is complicated due to the eeprom detection and the horrible kludges done with the variants (beaglebone white/beaglebone black), but I think you can figure out what?s going on with the command line options.
Quoted 2 lines
Quoted 2 lines
Tomi
Regards
? Pantelis
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Tomi ValkeinenQuoted 9 lines · Tomi Valkeinen
I'm not quite sure how it works if, as in versatile display case, there are multiple DT overlays of which one has to be enabled. I hope there's support to choose which one to use via kernel cmdline or similar.
I would personally like it much more if the bootloader would either compose a final dtb from DT fragments and pass it to the kernel, or alternatively the bootloader would pass the base dtb image and a bunch of DT overlays to the kernel, and the kernel would deal with the DT overlays.
Speaking as somebody who's written the "bootloader" code that's used for what I guess are the majority of versatile kernel boots, i.e. the one in QEMU, I think that requiring the bootloader to do this would be a significant worsening from the current state.
Right now the bootloader doesn't need to do much at all with device trees, except pass the kernel the DT that the user gave us, which is just the kernel's own data structures in a separate file for convenience. You need to do some very minor tweaks to the /chosen node, but these can be handled the same way for any board and aren't hardware specific. There's no need to worry about dt fragments either for the bootloader or for the user. Imposing a new requirement for the bootloader to have to probe hardware which it otherwise has no need to even care about, and then edit and update the DT in a board-specific manner, or have board-specific DT fragments, seems like a totally unnecessary imposition on both bootloader authors and end-users, and of course it would break booting newer kernels on the great mass of already existing boot loaders and QEMU installs.
The kernel is in a position to probe the display hardware and determine what is there, and do the right thing, and that's exactly what it does today. The kernel should continue to do this.
The advantage of DT is that it allows moving information about non-probeable hardware that was previously hardwired in the kernel C sources into a separate data structure, but the versatile displays are not non-probeable. I can see no benefit at all from hardwiring into the dt something which the kernel has previously been successfully dynamically getting right without any bootloader intervention -- it just makes the kernel less flexible and less user-friendly.
thanks
-- PMM
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 31 lines · Peter Maydell
Quoted 9 lines · Tomi Valkeinen
I'm not quite sure how it works if, as in versatile display case, there are multiple DT overlays of which one has to be enabled. I hope there's support to choose which one to use via kernel cmdline or similar.
I would personally like it much more if the bootloader would either compose a final dtb from DT fragments and pass it to the kernel, or alternatively the bootloader would pass the base dtb image and a bunch of DT overlays to the kernel, and the kernel would deal with the DT overlays.
Speaking as somebody who's written the "bootloader" code that's used for what I guess are the majority of versatile kernel boots, i.e. the one in QEMU, I think that requiring the bootloader to do this would be a significant worsening from the current state.
Right now the bootloader doesn't need to do much at all with device trees, except pass the kernel the DT that the user gave us, which is just the kernel's own data structures in a separate file for convenience. You need to do some very minor tweaks to the /chosen node, but these can be handled the same way for any board and aren't hardware specific. There's no need to worry about dt fragments either for the bootloader or for the user. Imposing a new requirement for the bootloader to have to probe hardware which it otherwise has no need to even care about, and then edit and update the DT in a board-specific manner, or have board-specific DT fragments, seems like a totally unnecessary imposition on both bootloader authors and end-users, and of course it would break booting newer kernels on the great mass of already existing boot loaders and QEMU installs.
Quoted 10 lines
The kernel is in a position to probe the display hardware and determine what is there, and do the right thing, and that's exactly what it does today. The kernel should continue to do this.
The advantage of DT is that it allows moving information about non-probeable hardware that was previously hardwired in the kernel C sources into a separate data structure, but the versatile displays are not non-probeable. I can see no benefit at all from hardwiring into the dt something which the kernel has previously been successfully dynamically getting right without any bootloader intervention -- it just makes the kernel less flexible and less user-friendly.
+1.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 43 lines · Russell King - ARM Linux
Quoted 31 lines · Peter Maydell
Quoted 9 lines · Tomi Valkeinen
I'm not quite sure how it works if, as in versatile display case, there are multiple DT overlays of which one has to be enabled. I hope there's support to choose which one to use via kernel cmdline or similar.
I would personally like it much more if the bootloader would either compose a final dtb from DT fragments and pass it to the kernel, or alternatively the bootloader would pass the base dtb image and a bunch of DT overlays to the kernel, and the kernel would deal with the DT overlays.
Speaking as somebody who's written the "bootloader" code that's used for what I guess are the majority of versatile kernel boots, i.e. the one in QEMU, I think that requiring the bootloader to do this would be a significant worsening from the current state.
Right now the bootloader doesn't need to do much at all with device trees, except pass the kernel the DT that the user gave us, which is just the kernel's own data structures in a separate file for convenience. You need to do some very minor tweaks to the /chosen node, but these can be handled the same way for any board and aren't hardware specific. There's no need to worry about dt fragments either for the bootloader or for the user. Imposing a new requirement for the bootloader to have to probe hardware which it otherwise has no need to even care about, and then edit and update the DT in a board-specific manner, or have board-specific DT fragments, seems like a totally unnecessary imposition on both bootloader authors and end-users, and of course it would break booting newer kernels on the great mass of already existing boot loaders and QEMU installs.
Quoted 10 lines
The kernel is in a position to probe the display hardware and determine what is there, and do the right thing, and that's exactly what it does today. The kernel should continue to do this.
The advantage of DT is that it allows moving information about non-probeable hardware that was previously hardwired in the kernel C sources into a separate data structure, but the versatile displays are not non-probeable. I can see no benefit at all from hardwiring into the dt something which the kernel has previously been successfully dynamically getting right without any bootloader intervention -- it just makes the kernel less flexible and less user-friendly.
Quoted 1 line
+1.
+1 from me too.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160223/bfdb2434/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Peter MaydellQuoted 16 lines · Peter Maydell
Quoted 9 lines · Tomi Valkeinen
I'm not quite sure how it works if, as in versatile display case, there are multiple DT overlays of which one has to be enabled. I hope there's support to choose which one to use via kernel cmdline or similar.
I would personally like it much more if the bootloader would either compose a final dtb from DT fragments and pass it to the kernel, or alternatively the bootloader would pass the base dtb image and a bunch of DT overlays to the kernel, and the kernel would deal with the DT overlays.
Speaking as somebody who's written the "bootloader" code that's used for what I guess are the majority of versatile kernel boots, i.e. the one in QEMU, I think that requiring the bootloader to do this would be a significant worsening from the current state.
Quoted 14 lines
Right now the bootloader doesn't need to do much at all with device trees, except pass the kernel the DT that the user gave us, which is just the kernel's own data structures in a separate file for convenience. You need to do some very minor tweaks to the /chosen node, but these can be handled the same way for any board and aren't hardware specific. There's no need to worry about dt fragments either for the bootloader or for the user. Imposing a new requirement for the bootloader to have to probe hardware which it otherwise has no need to even care about, and then edit and update the DT in a board-specific manner, or have board-specific DT fragments, seems like a totally unnecessary imposition on both bootloader authors and end-users, and of course it would break booting newer kernels on the great mass of already existing boot loaders and QEMU installs.
I'm looking for a good generic solution for going forward that can be used on new boards, for both non-probeable and probeable displays.
When we have that solution, we can see if and how the solution could be used for current boards. I'm sure that for some boards we need to support whatever legacy methods are out there already.
Quoted 10 lines
The kernel is in a position to probe the display hardware and determine what is there, and do the right thing, and that's exactly what it does today. The kernel should continue to do this.
The advantage of DT is that it allows moving information about non-probeable hardware that was previously hardwired in the kernel C sources into a separate data structure, but the versatile displays are not non-probeable. I can see no benefit at all from hardwiring into the dt something which the kernel has previously been successfully dynamically getting right without any bootloader intervention -- it just makes the kernel less flexible and less user-friendly.
My opinion is that the bootloader should be responsible for telling the kernel what hardware there is on the board. For busses like PCI we have proper probing mechanism with global unique identifiers for the devices, and nothing is needed from the bootloader.
In the Versatile case the panels are kind of probeable, but not in the same sense as PCI: all that can be probed on Versatile is a board specific ID, which in itself doesn't tell what kind of panel there is. In addition to the ID we need board specific tables listing the details of the panels.
So, true, there's probing going on, but it's all board specific, requiring a board specific driver to support it in the kernel. And I think that makes the bootloader much better place for supporting it. But, again, for legacy reasons that may not be possible.
Now, _if_ the Versatile panels were hotpluggable, and it would be a normal use case to switch the panels at runtime and having the kernel automatically switch to the correct video mode, we would obviously need a kernel driver for it. But afaik that's not the case.
I think one of the core questions here is: do we want to start adding board specific drivers to the kernel, instead of dealing with it in the bootloader when possible? My understanding is that we've been trying to reduce board specific code from the kernel.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160223/3b325e20/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 3 lines · Tomi Valkeinen
So, true, there's probing going on, but it's all board specific, requiring a board specific driver to support it in the kernel. And I think that makes the bootloader much better place for supporting it.
This doesn't seem to me like a reason to put the requirement in the bootloader. A huge part of the purpose of the kernel is to support the hardware (whether that's completely generic and probeable, like PCI, or generic but not probeable, or completely specific to a particular board). The kernel has to support the hardware, and just because it happens to be board specific hardware rather than generic hardware doesn't seem to me to imply that the kernel gets to drop part of its core purpose.
Quoted 4 lines
I think one of the core questions here is: do we want to start adding board specific drivers to the kernel, instead of dealing with it in the bootloader when possible? My understanding is that we've been trying to reduce board specific code from the kernel.
I think there's a difference between "reduce board specific code in the kernel by replacing it with the combination of generic or parameterisable code in the kernel plus a kernel data structure (DT) that supplies the parameterisation needed", and "reduce board specific code in the kernel by forcing the bootloader to do the kernel's job for it".
thanks
-- PMM
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Tomi Valkeinen
So, true, there's probing going on, but it's all board specific, requiring a board specific driver to support it in the kernel. And I think that makes the bootloader much better place for supporting it.
Quoted 8 lines
This doesn't seem to me like a reason to put the requirement in the bootloader. A huge part of the purpose of the kernel is to support the hardware (whether that's completely generic and probeable, like PCI, or generic but not probeable, or completely specific to a particular board). The kernel has to support the hardware, and just because it happens to be board specific hardware rather than generic hardware doesn't seem to me to imply that the kernel gets to drop part of its core purpose.
The thing here is, the kernel doesn't have to support the hardware (the probing method). The kernel _has_ to support the display controller and the panels, but the probing could as well be done in the bootloader. It would work fine, and it would be a cleaner solution that what's being proposed so far.
Quoted 11 lines
Quoted 4 lines
I think one of the core questions here is: do we want to start adding board specific drivers to the kernel, instead of dealing with it in the bootloader when possible? My understanding is that we've been trying to reduce board specific code from the kernel.
I think there's a difference between "reduce board specific code in the kernel by replacing it with the combination of generic or parameterisable code in the kernel plus a kernel data structure (DT) that supplies the parameterisation needed", and "reduce board specific code in the kernel by forcing the bootloader to do the kernel's job for it".
Perhaps my phone background affects here, but I see the vendor provided bootloader as the place for board specific custom solutions, and then the kernel doesn't have to deal with those if at all possible.
With an open source generic bootloader like u-boot that doesn't exactly hold, though, as the custom solutions will still pile up in a common project.
Anyway, as discussed in the thread, I'm fine with having a kernel driver for this, as the display boards for Versatile are an external device.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160224/b8465d20/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Tomi ValkeinenQuoted 4 lines · Tomi Valkeinen
My opinion is that the bootloader should be responsible for telling the kernel what hardware there is on the board. For busses like PCI we have proper probing mechanism with global unique identifiers for the devices, and nothing is needed from the bootloader.
Exactly, but that is _NOT_ the case here, because we're not talking about an on-board display.
Quoted 5 lines
In the Versatile case the panels are kind of probeable, but not in the same sense as PCI: all that can be probed on Versatile is a board specific ID, which in itself doesn't tell what kind of panel there is. In addition to the ID we need board specific tables listing the details of the panels.
That argument does not stack up. Just because you've plugged in a network device does not mean that the kernel can drive it: the kernel needs a device specific driver, which is determined by looking at the IDs. There is no standard network driver PCI interface.
Quoted 4 lines
I think one of the core questions here is: do we want to start adding board specific drivers to the kernel, instead of dealing with it in the bootloader when possible? My understanding is that we've been trying to reduce board specific code from the kernel.
That's not really the question, because that question assumes that it isn't already present, which is not true. The code is already present. The question is how to deal with this from the DT perspective.
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Tomi Valkeinen
My opinion is that the bootloader should be responsible for telling the kernel what hardware there is on the board. For busses like PCI we have proper probing mechanism with global unique identifiers for the devices, and nothing is needed from the bootloader.
Exactly, but that is _NOT_ the case here, because we're not talking about an on-board display.
Ok, what is it then? I'm not familiar with the boards in question.
When does a display become an on-board display? All the panels I have can be disconnected quite easily, but I still consider them as on-board displays.
Quoted 10 lines
Quoted 5 lines
In the Versatile case the panels are kind of probeable, but not in the same sense as PCI: all that can be probed on Versatile is a board specific ID, which in itself doesn't tell what kind of panel there is. In addition to the ID we need board specific tables listing the details of the panels.
That argument does not stack up. Just because you've plugged in a network device does not mean that the kernel can drive it: the kernel needs a device specific driver, which is determined by looking at the IDs. There is no standard network driver PCI interface.
Yes, but you can connect the network device to any board with a PCI bus and it works. Here, if I'm not mistaken, the displays are built for this single board, making them board specific.
So sure, someone could build boards with the same connector, allowing you to connect the same displays. If that's the case, then CLCD should be taken out of this picture, as the board could have something else than CLCD as the display controller.
Quoted 8 lines
Quoted 4 lines
I think one of the core questions here is: do we want to start adding board specific drivers to the kernel, instead of dealing with it in the bootloader when possible? My understanding is that we've been trying to reduce board specific code from the kernel.
That's not really the question, because that question assumes that it isn't already present, which is not true. The code is already present. The question is how to deal with this from the DT perspective.
Yes. As I commented in this (or the other thread), I'm looking for a proper generic solution which can be recommended for all new boards. When we know what that is, we can see if and how that could fit into Versatile's case. Versatile is not the only board with the exact same problem.
I wouldn't be at all surprised if the final solution is to just go with Linus' current patches for Versatile, as everything else would break compatibility or be overly complex.
But I cannot accept that as a general solution for all similar cases going forward, especially when moving to DRM world, that's just bad SW design.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160224/9d13a40f/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 7 lines · Tomi Valkeinen
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Tomi Valkeinen
My opinion is that the bootloader should be responsible for telling the kernel what hardware there is on the board. For busses like PCI we have proper probing mechanism with global unique identifiers for the devices, and nothing is needed from the bootloader.
Quoted 8 lines
Quoted 2 lines
Exactly, but that is _NOT_ the case here, because we're not talking about an on-board display.
Ok, what is it then? I'm not familiar with the boards in question.
When does a display become an on-board display? All the panels I have can be disconnected quite easily, but I still consider them as on-board displays.
The difference to me is quite clear.
If the connector is a flexi-strip or LVDS connector designed to be connected directly to a panel, it is not designed as a user connector, and the display can be regarded as part of the board: the connector probably isn't rated for a large number of mating cycles.
If the connector is a board-edge external-unit connector, then the panel is not part of the board.
In the case of Versatile, it's the latter: the connector is situated at the board edge, next to the serial port connectors, and is designed to connect to an external box housing the display.
Quoted 8 lines
Quoted 4 lines
That argument does not stack up. Just because you've plugged in a network device does not mean that the kernel can drive it: the kernel needs a device specific driver, which is determined by looking at the IDs. There is no standard network driver PCI interface.
Yes, but you can connect the network device to any board with a PCI bus and it works. Here, if I'm not mistaken, the displays are built for this single board, making them board specific.
It only works because Linux has a rich array of network drivers supporting all that hardware, and the appropriate network driver is bound depending on the hardware ID of the card. If a new PCI network device comes out, it'll more likely than not require an update to a network driver to make it work.
The displays are not built for "this single board" but for a family of
boards: not only Versatile PB/AB, but also the Realview family of boards too.
Quoted 3 lines
But I cannot accept that as a general solution for all similar cases going forward, especially when moving to DRM world, that's just bad SW design.
I think that's a matter of personal opinion, perspective and situation. What is good design today is not necessary good design yesterday or tomorrow. I thought we already ascertained that earlier in this discussion. :)
Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 7 lines · Russell King - ARM Linux
If the connector is a flexi-strip or LVDS connector designed to be connected directly to a panel, it is not designed as a user connector, and the display can be regarded as part of the board: the connector probably isn't rated for a large number of mating cycles.
If the connector is a board-edge external-unit connector, then the panel is not part of the board.
Ok, I see. I presumed the display-board was attached directly to the mainboard. Of course, we could still argue about the difference, with the exact same pins used with an external connector and with an on-board connector, but lets not go there.
I agree in this case the panels are external devices =).
However, I would still be interested in opinions how to implement the exact same case, but for boards where the panels were considered on-board panels.
Quoted 3 lines
The displays are not built for "this single board" but for a family of
boards: not only Versatile PB/AB, but also the Realview family of boards too.
Alright.
So, if this is to be done correctly, we need to disconnect the display board code from the CLCD code, as they really have nothing to do with each other.
Perhaps a panel driver which covers the display boards used here, which does the probing and contains the video timings for the panels in question?
One could then use that panel driver with other display controllers too. Although the probing part is perhaps difficult to make generic, but that board specific code should still be part of the panel-board driver, not CLCD driver.
Quoted 8 lines
Quoted 3 lines
But I cannot accept that as a general solution for all similar cases going forward, especially when moving to DRM world, that's just bad SW design.
I think that's a matter of personal opinion, perspective and situation. What is good design today is not necessary good design yesterday or tomorrow. I thought we already ascertained that earlier in this discussion. :)
Well, I was mostly referring to combining separate devices into single driver. CLCD and the external displays, in this case. Then again, "complexity" is part of the SW design, and splitting the devices drivers into independent pieces often increases complexity, so...
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160224/2f80fff6/attachment-0001.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Tomi ValkeinenHi Tomi,
Quoted 2 lines · Tomi Valkeinen
[snip]
Quoted 30 lines
Quoted 5 lines
That argument does not stack up. Just because you've plugged in a network device does not mean that the kernel can drive it: the kernel needs a device specific driver, which is determined by looking at the IDs. There is no standard network driver PCI interface.
Yes, but you can connect the network device to any board with a PCI bus and it works. Here, if I'm not mistaken, the displays are built for this single board, making them board specific.
So sure, someone could build boards with the same connector, allowing you to connect the same displays. If that's the case, then CLCD should be taken out of this picture, as the board could have something else than CLCD as the display controller.
Quoted 8 lines
Quoted 4 lines
I think one of the core questions here is: do we want to start adding board specific drivers to the kernel, instead of dealing with it in the bootloader when possible? My understanding is that we've been trying to reduce board specific code from the kernel.
That's not really the question, because that question assumes that it isn't already present, which is not true. The code is already present. The question is how to deal with this from the DT perspective.
Yes. As I commented in this (or the other thread), I'm looking for a proper generic solution which can be recommended for all new boards. When we know what that is, we can see if and how that could fit into Versatile's case. Versatile is not the only board with the exact same problem.
Quoted 8 lines
I wouldn't be at all surprised if the final solution is to just go with Linus' current patches for Versatile, as everything else would break compatibility or be overly complex.
But I cannot accept that as a general solution for all similar cases going forward, especially when moving to DRM world, that's just bad SW design.
IMHO DT+overlays handle all your cases just fine.
As far as I see these are the cases which we need to handle:
1) The expansion board in question has some means of identification, whether it?s an EEPROM or a GPIO keying combination etc. In that case it is the kernel?s job to match this id value with a dtbo firmware file and apply it. The blob is located via means of request_firmware().
2) The expansion board in question has no means of identification. In that case the bootloader?s job is to provide user-configured means to the kernel to use the expansion board.
We talked about two basic schemes.
2.1) The kernel command line contains information about the extra overlays to apply upon booting. Something like ?applyoverlays=foo.dtbo,bar.dtbo? is sufficient. The problem with this approach is that if the firmware files must be present in the initrd/rootfs/builtin-kernel-image. For some this is a problem.
2.2) The base DTB provided to the kernel from the bootloader is augmented with extra DTBOs that describe the extra hardware. The concatenation is as simple as performing a ?$ cat base.dtb foo.dtbo bar.dtbo?, which can be done either by the bootloader or offline. At the moment this is not being done, but it?s easy enough to add it and other people expressed interest for it.
Am I missing something here?
Quoted 2 lines
Tomi
Regards
? Pantelis
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 7 lines · Pantelis Antoniou
IMHO DT+overlays handle all your cases just fine.
As far as I see these are the cases which we need to handle:
1) The expansion board in question has some means of identification, whether it?s an EEPROM or a GPIO keying combination etc. In that case it is the kernel?s job to match this id value with a dtbo firmware file and apply it. The blob is located via means of
request_firmware().
Since the dawn of time the x86 people used that console to display the early boot crawl and collect crash data. What you're suggesting is that we can't get the console up until after the filesystems and mounts are up so the kernel can read firmware files.
This kills of early boot graphics and getting crash logs on the fbdev console until that has happened.
It also means there is no way to get the console up without the right firmware files in the filesystem. I think that is really crap compared to what we have today where the display will always come up, and basically a regression.
I understand the stance with respect to things like add-on hardware like a Bluetooth board or WLAN or whatnot. But the fbdev console is just too basic, like a serial port IMO.
Sure in the ARM world we usually have a serial console, but this is seriously breaking current practice.
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 7 lines · Linus Walleij
Quoted 4 lines · Pantelis Antoniou
IMHO DT+overlays handle all your cases just fine.
As far as I see these are the cases which we need to handle:
Quoted 8 lines
Quoted 3 lines
1) The expansion board in question has some means of identification, whether it?s an EEPROM or a GPIO keying combination etc. In that case it is the kernel?s job to match this id value with a dtbo firmware file and apply it. The blob is located via means of
request_firmware().Since the dawn of time the x86 people used that console to display the early boot crawl and collect crash data. What you're suggesting is that we can't get the console up until after the filesystems and mounts are up so the kernel can read firmware files.
You can build firmware images into the kernel image. No, I don't like that either.
The 2.2) option in Pantelis' mail can be used for 1) too, although then the bootloader needs to know which dtbos to add.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160225/35dfa506/attachment.sig>
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Linus WalleijHi Linus,
Quoted 26 lines · Linus Walleij
Quoted 7 lines · Pantelis Antoniou
IMHO DT+overlays handle all your cases just fine.
As far as I see these are the cases which we need to handle:
1) The expansion board in question has some means of identification, whether it?s an EEPROM or a GPIO keying combination etc. In that case it is the kernel?s job to match this id value with a dtbo firmware file and apply it. The blob is located via means of
request_firmware().Since the dawn of time the x86 people used that console to display the early boot crawl and collect crash data. What you're suggesting is that we can't get the console up until after the filesystems and mounts are up so the kernel can read firmware files.
This kills of early boot graphics and getting crash logs on the fbdev console until that has happened.
It also means there is no way to get the console up without the right firmware files in the filesystem. I think that is really crap compared to what we have today where the display will always come up, and basically a regression.
Quoted 7 lines
I understand the stance with respect to things like add-on hardware like a Bluetooth board or WLAN or whatnot. But the fbdev console is just too basic, like a serial port IMO.
Sure in the ARM world we usually have a serial console, but this is seriously breaking current practice.
As Tomi mentioned firmware files can be located in the kernel image; there is no requirement to be in a filesystem, and that application can be performed really early, before even early init.
The comparison with x86 is not absolutely valid, since on x86 you know that the video hardware is going to be present, always.
This is not so in ARM world, especially in the case we?re talking about, an add-on board.
Quoted 2 lines
Yours,
Linus Walleij
Regards
? Pantelis
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Quoted 11 lines · Pantelis Antoniou
Quoted 11 lines · Linus Walleij
It also means there is no way to get the console up without the right firmware files in the filesystem. I think that is really crap compared to what we have today where the display will always come up, and basically a regression.
I understand the stance with respect to things like add-on hardware like a Bluetooth board or WLAN or whatnot. But the fbdev console is just too basic, like a serial port IMO.
Quoted 6 lines
Quoted 2 lines
Sure in the ARM world we usually have a serial console, but this is seriously breaking current practice.
As Tomi mentioned firmware files can be located in the kernel image; there is no requirement to be in a filesystem, and that application can be performed really early, before even early init.
Are you thinking about exploiting an appended DT with CONFIG_ARM_APPENDED_DTB or something else?
Yours,
Linus Walleij
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
Hi Linus,
Quoted 18 lines · Linus Walleij
Quoted 14 lines · Pantelis Antoniou
Quoted 13 lines · Linus Walleij
It also means there is no way to get the console up without the right firmware files in the filesystem. I think that is really crap compared to what we have today where the display will always come up, and basically a regression.
I understand the stance with respect to things like add-on hardware like a Bluetooth board or WLAN or whatnot. But the fbdev console is just too basic, like a serial port IMO.
Sure in the ARM world we usually have a serial console, but this is seriously breaking current practice.
Quoted 7 lines
Quoted 3 lines
As Tomi mentioned firmware files can be located in the kernel image; there is no requirement to be in a filesystem, and that application can be performed really early, before even early init.
Are you thinking about exploiting an appended DT with
CONFIG_ARM_APPENDED_DTBor something else?
It?s not much of a problem to scan for extra blobs appended to the booting blob.
If found, you just apply them and that?s it.
The concatenation operation can either be made off-line on the host, or by the bootloader if it?s capable of doing so.
If the bootloader is not smart enough to do it, just put the concatenated dtb in place of the original.
Quoted 2 lines
Yours,
Linus Walleij
Regards
? Pantelis
PATCH 11/11 ARM: versatile: move CLCD configuration to device tree
In reply to Peter MaydellQuoted 31 lines · Peter Maydell
Quoted 9 lines · Tomi Valkeinen
I'm not quite sure how it works if, as in versatile display case, there are multiple DT overlays of which one has to be enabled. I hope there's support to choose which one to use via kernel cmdline or similar.
I would personally like it much more if the bootloader would either compose a final dtb from DT fragments and pass it to the kernel, or alternatively the bootloader would pass the base dtb image and a bunch of DT overlays to the kernel, and the kernel would deal with the DT overlays.
Speaking as somebody who's written the "bootloader" code that's used for what I guess are the majority of versatile kernel boots, i.e. the one in QEMU, I think that requiring the bootloader to do this would be a significant worsening from the current state.
Right now the bootloader doesn't need to do much at all with device trees, except pass the kernel the DT that the user gave us, which is just the kernel's own data structures in a separate file for convenience. You need to do some very minor tweaks to the /chosen node, but these can be handled the same way for any board and aren't hardware specific. There's no need to worry about dt fragments either for the bootloader or for the user. Imposing a new requirement for the bootloader to have to probe hardware which it otherwise has no need to even care about, and then edit and update the DT in a board-specific manner, or have board-specific DT fragments, seems like a totally unnecessary imposition on both bootloader authors and end-users, and of course it would break booting newer kernels on the great mass of already existing boot loaders and QEMU installs.
Quoted 10 lines
The kernel is in a position to probe the display hardware and determine what is there, and do the right thing, and that's exactly what it does today. The kernel should continue to do this.
The advantage of DT is that it allows moving information about non-probeable hardware that was previously hardwired in the kernel C sources into a separate data structure, but the versatile displays are not non-probeable. I can see no benefit at all from hardwiring into the dt something which the kernel has previously been successfully dynamically getting right without any bootloader intervention -- it just makes the kernel less flexible and less user-friendly.
I agree with Peter and Russell on this, as you could guess. Today the kernel knows about all the hardware and it JustWorks(TM) and that is so neat.
I'm still trying to appeal to the subsystem maintainer as well. Pretty tough deal.
Yours,
Linus Walleij
cover CLCD Nomadik+Versatile support
In reply to Linus WalleijQuoted 3 lines · Linus Walleij
Eventually I would like to have patches 1 thru 8 (those with patches to CLCD or the DT bindings) applied through the FBDEV subsystem,
If there are no comments, would the fbdev people consider patches 1 thru 8?
Yours,
Linus Walleij
cover CLCD Nomadik+Versatile support
Quoted 8 lines · Linus Walleij
Quoted 3 lines · Linus Walleij
Eventually I would like to have patches 1 thru 8 (those with patches to CLCD or the DT bindings) applied through the FBDEV subsystem,
If there are no comments, would the fbdev people consider patches 1 thru 8?
Hmm... Is there a v2 for the 05 patch? I see one in my mailbox, but it's not sent as a reply to this thread, making it a bit unclear.
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160216/d39da03d/attachment.sig>
cover CLCD Nomadik+Versatile support
Quoted 7 lines · Tomi Valkeinen
Quoted 6 lines · Linus Walleij
Quoted 3 lines · Linus Walleij
Eventually I would like to have patches 1 thru 8 (those with patches to CLCD or the DT bindings) applied through the FBDEV subsystem,
Quoted 5 lines
Quoted 2 lines
If there are no comments, would the fbdev people consider patches 1 thru 8?
Hmm... Is there a v2 for the 05 patch? I see one in my mailbox, but it's not sent as a reply to this thread, making it a bit unclear.
Yeah there is a v2, I sent that separately as I didn't have any other patch to follow up on.
I never figured out how to use in-reply-to sorry... maybe I should learn it :/
If you prefer I can resent the whole 1 thru 8 series, or does it work like this too?
Yours,
Linus Walleij