]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board/BuR/tseries: take usage of CONFIG_LCD_ROTATION
authorHannes Petermaier <oe5hpm@oevsv.at>
Fri, 24 Apr 2015 12:49:35 +0000 (14:49 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 8 May 2015 21:24:17 +0000 (17:24 -0400)
We take use of the new LCD_ROTATION feature.
The information about how the display is rotated is taken from B&R specific
(/factory-settings/rotation) information in the devicetree.

The information there is stored as string (cw, ud, ccw, none) since starting
support of this devices and cannot be changed, so we have to convert it into

none = 0
cw   = 1
ud   = 2
ccw  = 3

Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
board/BuR/common/common.c
include/configs/tseries.h

index 23a98e4fdff9cc3b4a80c3939157735f4adc0793..3036f86781c3783f47b0bfe19264ca05a1010f90 100644 (file)
@@ -52,6 +52,9 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
        struct am335x_lcdpanel pnltmp;
 #ifdef CONFIG_USE_FDT
        u32 dtbprop;
+       char buf[32];
+       const char *nodep = 0;
+       int nodeoff;
 
        if (gd->fdt_blob == NULL) {
                printf("%s: don't have a valid gd->fdt_blob!\n", __func__);
@@ -97,6 +100,25 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
        dtbprop = FDTPROP(PATHTIM, "de-active");
        if (dtbprop == 0)
                pnltmp.pol |= DE_INVERT;
+
+       nodeoff = fdt_path_offset(gd->fdt_blob, "/factory-settings");
+       if (nodeoff >= 0) {
+               nodep = fdt_getprop(gd->fdt_blob, nodeoff, "rotation", NULL);
+               if (nodep != 0) {
+                       if (strcmp(nodep, "cw") == 0)
+                               panel_info.vl_rot = 1;
+                       else if (strcmp(nodep, "ud") == 0)
+                               panel_info.vl_rot = 2;
+                       else if (strcmp(nodep, "ccw") == 0)
+                               panel_info.vl_rot = 3;
+                       else
+                               panel_info.vl_rot = 0;
+               }
+       } else {
+               puts("no 'factory-settings / rotation' in dtb!\n");
+       }
+       snprintf(buf, sizeof(buf), "fbcon=rotate:%d", panel_info.vl_rot);
+       setenv("optargs_rot", buf);
 #else
        pnltmp.hactive = getenv_ulong("ds1_hactive", 10, ~0UL);
        pnltmp.vactive = getenv_ulong("ds1_vactive", 10, ~0UL);
@@ -111,6 +133,7 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
        pnltmp.pol = getenv_ulong("ds1_pol", 16, ~0UL);
        pnltmp.pup_delay = getenv_ulong("ds1_pupdelay", 10, ~0UL);
        pnltmp.pon_delay = getenv_ulong("ds1_tondelay", 10, ~0UL);
+       panel_info.vl_rot = getenv_ulong("ds1_rotation", 10, 0);
 #endif
        if (
           ~0UL == (pnltmp.hactive) ||
index 1e41a12a6c86ddcae5b4e23b47a78495b20b88c3..4406e6fafb38d56423ae4edea498d7dec7145a40 100644 (file)
@@ -17,6 +17,7 @@
 #define CONFIG_AM335X_LCD
 #define CONFIG_LCD
 #define CONFIG_LCD_NOSTDOUT
+#define CONFIG_LCD_ROTATION
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define LCD_BPP                                LCD_COLOR32
 
        "mtdparts=" MTDPARTS_DEFAULT "\0" \
        "nandargs=setenv bootargs console=${console} " \
                "${optargs} " \
+               "${optargs_rot} " \
                "root=mtd6 " \
                "rootfstype=jffs2\0" \
        "kernelsize=0x400000\0" \
        "bmp display ${loadaddr} 0 0\0" \
 "logo1=ext4load mmc 0:1 ${loadaddr} /PPTLogo.bmp.gz && " \
        "bmp display ${loadaddr} 0 0\0" \
-"mmcroot0=setenv bootargs ${optargs} console=${console}\0" \
-"mmcroot1=setenv bootargs ${optargs} console=${console} root=/dev/mmcblk0p2 " \
-       "rootfstype=ext4\0" \
+"mmcroot0=setenv bootargs ${optargs_rot} ${optargs} console=${console}\0" \
+"mmcroot1=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
+       "root=/dev/mmcblk0p2 rootfstype=ext4\0" \
 "mmcboot0=echo booting Updatesystem from mmc (ext4-fs) ...; " \
        "ext4load mmc 0:1 ${loadaddr} /${kernel}; " \
        "ext4load mmc 0:1 ${ramaddr} /${ramdisk}; " \