Patchwork [U-Boot] bmp: Respect "splashpos" if it is defined

login
register
mail settings
Submitter Otavio Salvador
Date June 6, 2013, 5:57 p.m.
Message ID <1370541443-13184-1-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/249512/
State Superseded
Delegated to: Anatolij Gustschin
Headers show

Comments

Otavio Salvador - June 6, 2013, 5:57 p.m.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 common/cmd_bmp.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
Otavio Salvador - June 6, 2013, 6:16 p.m.
Dear Anatolij,

On Thu, Jun 6, 2013 at 2:57 PM, Otavio Salvador <otavio@ossystems.com.br>wrote:

> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>

I forgot to add you in Cc; sorry.
Otavio Salvador - June 17, 2013, 9:36 p.m.
On Thu, Jun 6, 2013 at 2:57 PM, Otavio Salvador <otavio@ossystems.com.br> wrote:
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

Ping?

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
Anatolij Gustschin - July 1, 2013, 10:01 p.m.
Hello Otavio,

Sorry for delay.

On Thu,  6 Jun 2013 14:57:23 -0300
Otavio Salvador <otavio@ossystems.com.br> wrote:
...
> +#ifdef CONFIG_SPLASH_SCREEN_ALIGN
> +	s = getenv("splashpos");
> +	if (s != NULL) {
> +		if (s[0] == 'm')
> +			x = BMP_ALIGN_CENTER;
> +		else
> +			x = simple_strtol(s, NULL, 0);
> +
> +		s = strchr(s + 1, ',');
> +		if (s != NULL) {
> +			if (s[1] == 'm')
> +				y = BMP_ALIGN_CENTER;
> +			else
> +				y = simple_strtol(s + 1, NULL, 0);
> +		}
> +	}
> +#endif /* CONFIG_SPLASH_SCREEN_ALIGN */

This code is already there in two other drivers, we should better
add a common function for "splashpos" checking and use it here.
I'll submit a patch shortly.

Thanks,

Anatolij
Otavio Salvador - July 1, 2013, 10:25 p.m.
On Mon, Jul 1, 2013 at 7:01 PM, Anatolij Gustschin <agust@denx.de> wrote:
> Hello Otavio,
>
> Sorry for delay.
>
> On Thu,  6 Jun 2013 14:57:23 -0300
> Otavio Salvador <otavio@ossystems.com.br> wrote:
> ...
>> +#ifdef CONFIG_SPLASH_SCREEN_ALIGN
>> +     s = getenv("splashpos");
>> +     if (s != NULL) {
>> +             if (s[0] == 'm')
>> +                     x = BMP_ALIGN_CENTER;
>> +             else
>> +                     x = simple_strtol(s, NULL, 0);
>> +
>> +             s = strchr(s + 1, ',');
>> +             if (s != NULL) {
>> +                     if (s[1] == 'm')
>> +                             y = BMP_ALIGN_CENTER;
>> +                     else
>> +                             y = simple_strtol(s + 1, NULL, 0);
>> +             }
>> +     }
>> +#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
>
> This code is already there in two other drivers, we should better
> add a common function for "splashpos" checking and use it here.
> I'll submit a patch shortly.

Agreed; I just acked the patch ... it looks great, thanks!

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

Patch

diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index 5a52edd..48e045e 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -33,6 +33,10 @@ 
 #include <malloc.h>
 #include <video.h>
 
+#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+#define BMP_ALIGN_CENTER	0x7FFF
+#endif
+
 static int bmp_info (ulong addr);
 
 /*
@@ -112,6 +116,25 @@  static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
 {
 	ulong addr;
 	int x = 0, y = 0;
+	__maybe_unused char *s;
+
+#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+	s = getenv("splashpos");
+	if (s != NULL) {
+		if (s[0] == 'm')
+			x = BMP_ALIGN_CENTER;
+		else
+			x = simple_strtol(s, NULL, 0);
+
+		s = strchr(s + 1, ',');
+		if (s != NULL) {
+			if (s[1] == 'm')
+				y = BMP_ALIGN_CENTER;
+			else
+				y = simple_strtol(s + 1, NULL, 0);
+		}
+	}
+#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
 
 	switch (argc) {
 	case 1:		/* use load_addr as default address */