video: ARM CLCD: non-controversial parts
Subsystems (2)
cover video: ARM CLCD: non-controversial parts
This is a redux version of the previous patch set that strips out any attempts to auto-switch or rewrite the device tree to match the CLCD Versatile panel.
Instead, it does detect it and COMPARE it to what was found in the device tree, prints a warning if those do not match, and continue anyway.
This patch series brings support for device tree-only boot with graphics to the Nomadik and all RealView platforms (so we can boot RealView with only device tree) so it is very useful still even if the Versatile is not yet fully supported.
Please consider applying this for v4.6 if these parts look uncontroversial. Or applying partly from low to high patch numbers so I'm not sitting with too much out-of-tree code.
Also resending a fix which has not yet landed upstream (1/7) I guess it was lost.
Linus Walleij (7):
video: ARM CLCD: runtime check for Versatile
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
video: ARM CLCD: add special panel hook for Versatiles
drivers/video/fbdev/Kconfig | 6 +- drivers/video/fbdev/Makefile | 1 + drivers/video/fbdev/amba-clcd-nomadik.c | 257 ++++++++++++++++++++ drivers/video/fbdev/amba-clcd-nomadik.h | 24 ++ drivers/video/fbdev/amba-clcd-versatile.c | 391 ++++++++++++++++++++++++++++++ drivers/video/fbdev/amba-clcd-versatile.h | 17 ++ drivers/video/fbdev/amba-clcd.c | 218 +++++++++++++++-- include/linux/amba/clcd.h | 76 +++++- 8 files changed, 958 insertions(+), 32 deletions(-) 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 RESEND 1/7 video: ARM CLCD: runtime check for Versatile
The current compile-time check for inversed IENB/CNTL does not work in multiplatform boots: as soon as versatile is included in the build, the IENB/CNTL is switched and breaks graphics. Convert this to a runtime switch.
--- drivers/video/fbdev/amba-clcd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/video/fbdev/amba-clcd.c +8 -7
@@ -440,13 +440,14 @@ static int clcdfb_register(struct clcd_fb *fb) fb->off_ienb =CLCD_PL111_IENB ; fb->off_cntl =CLCD_PL111_CNTL ; }else { -#ifdef CONFIG_ARCH_VERSATILE - fb->off_ienb =CLCD_PL111_IENB ; - fb->off_cntl =CLCD_PL111_CNTL ; -#else - fb->off_ienb =CLCD_PL110_IENB ; - fb->off_cntl =CLCD_PL110_CNTL ; -#endif +if (of_machine_is_compatible ("arm,versatile-ab" ) || +of_machine_is_compatible ("arm,versatile-pb" )) { + fb->off_ienb =CLCD_PL111_IENB ; + fb->off_cntl =CLCD_PL111_CNTL ; + }else { + fb->off_ienb =CLCD_PL110_IENB ; + fb->off_cntl =CLCD_PL110_CNTL ; + } } fb->clk =clk_get (&fb->dev->dev,NULL );
Signature · 1 line
2.4.3
PATCH RESEND 1/7 video: ARM CLCD: runtime check for Versatile
Quoted 10 lines · Linus Walleij
The current compile-time check for inversed IENB/CNTL does not work in multiplatform boots: as soon as versatile is included in the build, the IENB/CNTL is switched and breaks graphics. Convert this to a runtime switch.
Cc stable at vger.kernel.orgCc Rob Herring <[email protected]>Cc Russell King <[email protected]>Fixes a29da136de34 ("ARM: versatile: convert to multi-platform")Signed-off-by Linus Walleij <[email protected]>
Tomi can you PLEASE merge this patch which is regressing all the Versatile hardware since commit a29da136de34?
It is not dependent on the rest of the series.
I am coming back to revising the rest of the patches, but this one need to go in.
Yours,
Linus Walleij
PATCH RESEND 1/7 video: ARM CLCD: runtime check for Versatile
Quoted 14 lines · Linus Walleij
Quoted 10 lines · Linus Walleij
The current compile-time check for inversed IENB/CNTL does not work in multiplatform boots: as soon as versatile is included in the build, the IENB/CNTL is switched and breaks graphics. Convert this to a runtime switch.
Cc stable at vger.kernel.orgCc Rob Herring <[email protected]>Cc Russell King <[email protected]>Fixes a29da136de34 ("ARM: versatile: convert to multi-platform")Signed-off-by Linus Walleij <[email protected]>
Quoted 7 lines
Tomi can you PLEASE merge this patch which is regressing all the Versatile hardware since commit
a29da136de34?It is not dependent on the rest of the series.
I am coming back to revising the rest of the patches, but this one need to go in.
Sure, queued for 4.6 fixes.
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/20160418/5ddb838d/attachment.sig>
PATCH v2 2/7 video: ARM CLCD: backlight support for OF
In reply to Linus WalleijIf 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.
---
ChangeLog v1->v2:
- No changes. Just reposting.
--- 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 v2 3/7 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.
---
ChangeLog v1->v2:
- No changes. Just reposting.
--- 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 v2 3/7 video: ARM CLCD: support DT signal inversion flags
Quoted 46 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]>---
ChangeLogv1->v2:
- No changes. Just reposting.--- drivers/video/fbdev/amba-clcd.c | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-)drivers/video/fbdev/amba-clcd.c +2
-1@@ -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,
drivers/video/fbdev/amba-clcd.c static int clcdfb_of_get_dpi_panel_mode(struct device_node *node, · line 589
Quoted 10 lines
drivers/video/fbdev/amba-clcd.c +4
-1videomode_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" )) {
Hmm, why are you poking in the videomode DT properties directly? If the pixelclk-active was not defined in the DT, you should see it in the videomode struct as neither DISPLAY_FLAGS_PIXDATA_POSEDGE nor DISPLAY_FLAGS_PIXDATA_NEGEDGE being set (I think, I didn't go through the code in detail).
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/de0044c5/attachment.sig>
PATCH v2 3/7 video: ARM CLCD: support DT signal inversion flags
Quoted 5 lines · Tomi Valkeinen
drivers/video/fbdev/amba-clcd.c static int clcdfb_of_get_dpi_panel_mode(struct device_node *node, · line 589
Quoted 3 lines
drivers/video/fbdev/amba-clcd.c +3
-0+/* Set up some inversion flags */ + timnp =of_get_child_by_name (node,"panel-timing" ); +if (timnp &&of_property_read_bool (timnp,"pixelclk-active" )) {Hmm, why are you poking in the videomode DT properties directly?
It is to provide
backward compatibility with already deployed device trees that do not have this property set, so that they default to negative edge rather than positive edge.
Quoted 5 lines
If the
pixelclk-active was not defined in the DT, you should see it in the videomode struct as neitherDISPLAY_FLAGS_PIXDATA_POSEDGEnorDISPLAY_FLAGS_PIXDATA_NEGEDGEbeing set (I think, I didn't go through the code in detail).
OK I'll take a look!
Yours,
Linus Walleij
PATCH v2 4/7 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>.
---
ChangeLog v1->v2:
- No changes. Just reposting.
--- 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 v2 4/7 video: ARM CLCD: support pads connected in reverse order
Quoted 5 lines · Linus Walleij
include/linux/amba/clcd.h +1
-4-if (var->red.offset ==0 ) - val &= ~CNTL_BGR ; -else - val |=CNTL_BGR ; +if (!fb->panel->bgr_connection) {
include/linux/amba/clcd.h static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) · line 263
Quoted 10 lines
include/linux/amba/clcd.h +10
-0+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 ; + }
if (fb->panel->bgr_connection) val ^= CNTL_BGR;
is a shorter way to write the above, and probably easier on the compiler too.
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 v2 5/7 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.
---
ChangeLog v1->v2:
- No changes. Just reposting.
--- drivers/video/fbdev/amba-clcd.c | 106 ++++++++++++++++++++++++++++++++++++---- include/linux/amba/clcd.h | 42 ++++++++++++++++ 2 files changed, 139 insertions(+), 9 deletions(-)
drivers/video/fbdev/amba-clcd.c +97 -9
@@ -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,6 +731,42 @@ 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 ; }
@@ -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 ; +/* +* Fetch the panel endpoint. +*/ +if (!endpoint) { + 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; + } 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 v2 6/7 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.
---
ChangeLog v1->v2:
- No changes. Just reposting.
--- drivers/video/fbdev/Makefile | 1 + drivers/video/fbdev/amba-clcd-nomadik.c | 257 ++++++++++++++++++++++++++++++++ drivers/video/fbdev/amba-clcd-nomadik.h | 24 +++ drivers/video/fbdev/amba-clcd.c | 6 +- 4 files changed, 287 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 +257 -0
257 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 v2 7/7 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.
---
ChangeLog v1->v2:
- For Versatile: just detect the panel and look up and compare the expected compatible string to what is provided by the device tree. If the device tree does not match the hardware-detected display, print a warning and continue anyways.
- Make no attempt at actually switching the panel at runtime or to modify the device tree at runtime.
--- drivers/video/fbdev/Kconfig | 2 + drivers/video/fbdev/amba-clcd-versatile.c | 391 ++++++++++++++++++++++++++++++ drivers/video/fbdev/amba-clcd-versatile.h | 17 ++ drivers/video/fbdev/amba-clcd.c | 4 +- 4 files changed, 413 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 +391 -0
400 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
cover video: ARM CLCD: non-controversial parts
In reply to Linus WalleijQuoted 3 lines · Linus Walleij
This is a redux version of the previous patch set that strips out any attempts to auto-switch or rewrite the device tree to match the CLCD Versatile panel.
It seems patch #4 didn't make it out so I re-sent it.
Tell me if you want me to resend the entire v2 patch set.
This stuff would be really neat to get in as a starter.
Yours,
Linus Walleij
cover video: ARM CLCD: non-controversial parts
Quoted 8 lines · Linus Walleij
Quoted 3 lines · Linus Walleij
This is a redux version of the previous patch set that strips out any attempts to auto-switch or rewrite the device tree to match the CLCD Versatile panel.
It seems patch #4 didn't make it out so I re-sent it.
Hmm, it was there in the series... Russell had comments to it, to which you didn't reply.
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/2bb28b03/attachment.sig>