"bootargs=init=/init console=ttyS0,115200n8 hlt no_console_suspend vmalloc=256m mem=1024m logo=osd1,loaded,panel,debug hdmitx=
vdacoff,powermode1,unplug_powerdown\0" \
这是uboot里面CONFIG_EXTRA_ENV_SETTINGS的设置;
其中的vdacoff,powermode1,unplug_powerdown
查看/kernel/driver/xxx/hdmi/htmi-tx.c
其中一段代码如下:
static int __init hdmitx_boot_para_setup(char *s)
{
char separator[]={' ',',',';',0x0};
char *token;
unsigned token_len, token_offset, offset=0;
unsigned long cec_flag;
int size=strlen(s);
HDMI_DEBUG();
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;
}
else if((token_len==7) && (strncmp(token, "vdacoff", token_len)==0)){
init_flag|=INIT_FLAG_VDACOFF;
}
else if((token_len==16) && (strncmp(token, "unplug_powerdown", token_len)==0)){
init_flag|=INIT_FLAG_POWERDOWN;
}
else if(strncmp(token, "pllmode1", 8)==0){
/* use external xtal as source of hdmi pll */
hdmi_pll_mode = 1;
}
else if((token_len==7)&& (strncmp(token, "hpdmode", token_len)==0)){
hpdmode = simple_strtoul(token+7,NULL,10);
}
else if((token_len==3)&&(strncmp(token, "rgb", 3)==0)){
hdmitx_output_rgb();
}
else if(strncmp(token, "audpara", 7)==0){
int tmp;
tmp = simple_strtoul(token+7,NULL,10);
hdmi_set_audio_para(tmp);
printk("hdmi: set hdmi aud_para %d\n", tmp);
}
else if(strncmp(token, "bufsize", 7)==0){
int tmp;
tmp = simple_strtoul(token+7,NULL,10);
if(tmp>=1024){
hdmi_log_buf_size=0;
hdmi_log_rd_pos=0;
hdmi_log_wr_pos=0;
hdmi_log_buf_size=tmp;
printk("hdmi: set log buffer size %d\n", tmp);
}
}
else if(strncmp(token, "powermode", 9)==0){
int tmp;
tmp = simple_strtoul(token+9,NULL,10);
init_powermode=tmp|0x80;
printk("hdmi: set init powermode %d\n", tmp);
}
else if(strncmp(token, "audiooff", 8)==0){
hdmi_audio_off_flag = 1;
printk("hdmi: set no audio output\n");
}
else if(strncmp(token, "prbs", 4)==0){
hdmi_prbs_mode = simple_strtoul(token+4,NULL,16);
printk("hdmi, set prbs mode as %x always\n", hdmi_prbs_mode);
}
else if(strncmp(token, "480p_clk", 8)==0){
hdmi_480p_force_clk = simple_strtoul(token+8,NULL,10);
printk("hdmi, set 480p mode clock as %dMHz always\n", hdmi_480p_force_clk);
}
else if(strncmp(token, "cec", 3)==0){
hdmi_cec_func_config |= INIT_FLAG_CEC_FUNC>>2;
aml_write_reg32(P_AO_DEBUG_REG0, aml_read_reg32(P_AO_DEBUG_REG0) | (hdmi_cec_func_config & 0xf));
printk("hdmi: enable cec function\n");
cec_flag = simple_strtoul(token+3,NULL,16);
if(((cec_flag >> 1) & 0x1) == 1){
hdmi_cec_func_config |= CEC_ONE_TOUCH_PLAY>>2;
aml_write_reg32(P_AO_DEBUG_REG0, aml_read_reg32(P_AO_DEBUG_REG0) | (hdmi_cec_func_config & 0xf));
printk("hdmi: enable cec one touch play function\n");
}else{
hdmi_cec_func_config &= ~(CEC_ONE_TOUCH_PLAY>>2);
aml_write_reg32(P_AO_DEBUG_REG0, aml_read_reg32(P_AO_DEBUG_REG0) & (~(hdmi_cec_func_config & 0xf)));
printk("hdmi: disable cec one touch play function\n");
}
if(((cec_flag >> 2) & 0x1) == 1){
hdmi_cec_func_config |= CEC_ONE_TOUCH_STANDBY>>2;
aml_write_reg32(P_AO_DEBUG_REG0, aml_read_reg32(P_AO_DEBUG_REG0) | (hdmi_cec_func_config & 0xf));
printk("hdmi: enable cec one touch standby function\n");
}else{
hdmi_cec_func_config &= ~(CEC_ONE_TOUCH_STANDBY>>2);
aml_write_reg32(P_AO_DEBUG_REG0, aml_read_reg32(P_AO_DEBUG_REG0) & (~(hdmi_cec_func_config & 0xf)));
printk("hdmi: disable cec one touch standby function\n");
}
if(((cec_flag >> 3) & 0x1) == 1){
hdmi_cec_func_config |= CEC_AUTO_POWERON_FROM_TV>>2;
aml_write_reg32(P_AO_DEBUG_REG0, aml_read_reg32(P_AO_DEBUG_REG0) | (hdmi_cec_func_config & 0xf));
printk("hdmi: enable cec auto power on form TV function\n");
}else{
hdmi_cec_func_config &= ~(CEC_AUTO_POWERON_FROM_TV>>2);
aml_write_reg32(P_AO_DEBUG_REG0, aml_read_reg32(P_AO_DEBUG_REG0) & (~(hdmi_cec_func_config & 0xf)));
printk("hdmi: disable cec auto power on form TV function\n");
}
}else{
hdmi_cec_func_config &= ~(INIT_FLAG_CEC_FUNC>>2);
aml_write_reg32(P_AO_DEBUG_REG0, aml_read_reg32(P_AO_DEBUG_REG0) & (~(hdmi_cec_func_config & 0xf)));
printk("hdmi: disable cec function\n");
}
printk("HDMI aml_read_reg32(P_AO_DEBUG_REG0):0x%x\n",aml_read_reg32(P_AO_DEBUG_REG0));
printk("HDMI hdmi_cec_func_config:0x%x\n",hdmi_cec_func_config);
}
offset=token_offset;
}while(token);
return 0;
}
我了uboot里面的内核参数配置。然后看了系统的串口日志:
[ 0.000000@0] HDMI DEBUG: hdmitx_boot_para_setup [1797]
[ 0.000000@0] HDMI aml_read_reg32(P_AO_DEBUG_REG0):0x0
[ 0.000000@0] HDMI hdmi_cec_func_config:0x0
[ 0.000000@0] hdmi: set init powermode 1
[ 0.000000@0] HDMI aml_read_reg32(P_AO_DEBUG_REG0):0x0
[ 0.000000@0] HDMI hdmi_cec_func_config:0x0
[ 0.000000@0] HDMI aml_read_reg32(P_AO_DEBUG_REG0):0x0
[ 0.000000@0] HDMI hdmi_cec_func_config:0x0
next_token_ex将UBOOT传入的环境变量进行解析,然后一个个比较来设置相关的寄存器。