hdmitx: parse colorattribute from uboot [2/2]

PD#SWPL-2181

Problem:
For some Rx, if the Tx cold boots up, the HPD can't be got in uboot.
That is to say, the output mode is CVBS in uboot, even HDMI cable is
connected. And during kernel boots up, it will reset to hdmi mode.
During the Android boots up, it will set to hdmi mode again. Twice
hdmi mode setting may cause TV flicks.

Solution:
Add parsing colorattribute from uboot and assign $attr to prevent
the second Android mode setting.

Verify:
S905X/P212

Change-Id: I665227bc3e8481acb40c34dde2f5cb3c633c64a2
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
This commit is contained in:
Zongdong Jiao
2018-11-29 19:00:46 +08:00
committed by Dongjin Kim
parent 5c8f4bef40
commit 69d0f1c38e

View File

@@ -4010,7 +4010,10 @@ static int get_dt_vend_init_data(struct device_node *np,
static void hdmitx_init_fmt_attr(struct hdmitx_dev *hdev)
{
memset(hdev->fmt_attr, 0, sizeof(hdev->fmt_attr));
if (hdev->fmt_attr[0]) {
pr_info(SYS "fmt_attr %s\n", hdev->fmt_attr);
return;
}
if ((hdev->para->cd == COLORDEPTH_RESERVED) &&
(hdev->para->cs == COLORSPACE_RESERVED)) {
strcpy(hdev->fmt_attr, "default");
@@ -4782,22 +4785,60 @@ static char *next_token_ex(char *separator, char *buf, unsigned int size,
return pToken;
}
/* check the colorattribute from uboot */
static void check_hdmiuboot_attr(char *token)
{
char attr[16];
const char * const cs[] = {
"444", "422", "rgb", "420", NULL};
const char * const cd[] = {
"8bit", "10bit", "12bit", "16bit", NULL};
int i;
if (hdmitx_device.fmt_attr[0] != 0)
return;
if (!token)
return;
for (i = 0; cs[i] != NULL; i++) {
if (strstr(token, cs[i])) {
strncpy(attr, cs[i], strlen(attr));
strcat(attr, ",");
break;
}
}
for (i = 0; cd[i] != NULL; i++) {
if (strstr(token, cd[i])) {
strncat(attr, cd[i], strlen(attr) - strlen(cd[i]));
strncpy(hdmitx_device.fmt_attr, attr,
sizeof(hdmitx_device.fmt_attr));
hdmitx_device.fmt_attr[15] = '\0';
break;
}
}
}
static int __init hdmitx_boot_para_setup(char *s)
{
char separator[] = {' ', ',', ';', 0x0};
char *token;
unsigned int token_len, token_offset, offset = 0;
unsigned int token_len = 0;
unsigned int token_offset = 0;
unsigned int offset = 0;
int size = strlen(s);
memset(hdmitx_device.fmt_attr, 0, sizeof(hdmitx_device.fmt_attr));
do {
token = next_token_ex(separator, s, size, offset,
&token_len, &token_offset);
if (token) {
if ((token_len == 3)
&& (strncmp(token, "off", token_len) == 0)) {
init_flag |= INIT_FLAG_NOT_LOAD;
if (token) {
if ((token_len == 3)
&& (strncmp(token, "off", token_len) == 0)) {
init_flag |= INIT_FLAG_NOT_LOAD;
}
check_hdmiuboot_attr(token);
}
}
offset = token_offset;
} while (token);
return 0;