blob: 14655dc3e48f2fb02be0d2b5dcd46fd7fdd425a6 [file] [log] [blame]
Wenjie Qiao8a73a562023-02-23 18:37:14 +08001// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
4 */
5
6#include <common.h>
7#include <command.h>
8#include <env.h>
9#include <malloc.h>
10#include <asm/byteorder.h>
11#ifdef CONFIG_AML_VPP
12#include <amlogic/media/vpp/vpp.h>
13#endif
14#include <amlogic/media/vout/aml_vout.h>
15#ifdef CONFIG_AML_HDMITX
16#ifdef CONFIG_AML_HDMITX20
17#include <amlogic/media/vout/hdmitx/hdmitx.h>
18#else
19#include <amlogic/media/vout/hdmitx21/hdmitx.h>
20#endif
21#endif
22
23#ifdef CONFIG_AML_CVBS
24#include <amlogic/media/vout/aml_cvbs.h>
25#endif
26#ifdef CONFIG_AML_LCD
27#include <amlogic/media/vout/lcd/aml_lcd.h>
28#endif
29
30#ifdef CONFIG_AML_HDMITX
31static int vout_hdmi_hpd(int hpd_st)
32{
33#ifdef CONFIG_AML_LCD
34 unsigned int mux_sel = VIU_MUX_MAX, venc_sel = VIU_MUX_MAX;
35 char *mode;
36#endif
37 char *hdmimode;
38 char *cvbsmode;
39 char *colorattribute;
40
41#ifdef CONFIG_AML_LCD
42 mode = env_get("outputmode");
43 mux_sel = aml_lcd_driver_outputmode_check(mode, 0);
44 venc_sel = mux_sel & 0xf;
45 if (venc_sel == VIU_MUX_ENCL) {
46 printf("%s: lcd no need hpd detect\n", __func__);
47 // free(mode);
48 return 0;
49 }
50#endif
51 /*get hdmi mode and colorattribute from env */
52 hdmimode = env_get("hdmimode");
53 if (hdmimode)
54 printf("%s: hdmimode=%s\n", __func__, hdmimode);
55
56 colorattribute = env_get("colorattribute");
57 if (colorattribute)
58 printf("%s: colorattribute=%s\n", __func__, colorattribute);
59
60 if (hdmimode) {
61 if (strstr(hdmimode, "null")) {
62 env_set("hdmimode", "1080p60hz");
63 //run_command("saveenv", 0);
64 }
65 } else {
66 env_set("hdmimode", "1080p60hz");
67 //run_command("saveenv", 0);
68 }
69
70 hdmimode = env_get("hdmimode");
71 if (hpd_st) {
72 printf("set outputmode: hdmimode=%s\n", hdmimode);
73 env_set("outputmode", hdmimode);
74 } else {
75 cvbsmode = env_get("cvbsmode");
76 if (cvbsmode)
77 env_set("outputmode", cvbsmode);
78 env_set("hdmichecksum", "0x00000000");
79 //run_command("saveenv", 0);
80 }
81
82 return 1;
83}
84
85static int vout2_hdmi_hpd(int hpd_st)
86{
87#ifdef CONFIG_AML_LCD
88 unsigned int mux_sel = VIU_MUX_MAX, venc_sel = VIU_MUX_MAX;
89 char *mode;
90#endif
91 char *hdmimode;
92 char *cvbsmode;
93 char *colorattribute;
94
95#ifdef CONFIG_AML_LCD
96 mode = env_get("outputmode2");
97 mux_sel = aml_lcd_driver_outputmode_check(mode, 0);
98 venc_sel = mux_sel & 0xf;
99 if (venc_sel == VIU_MUX_ENCL) {
100 // free(mode);
101 return 0;
102 }
103#endif
104 /*get hdmi mode and colorattribute from env */
105 hdmimode = env_get("hdmimode");
106 if (hdmimode)
107 printf("%s: hdmimode=%s\n", __func__, hdmimode);
108 colorattribute = env_get("colorattribute");
109 if (colorattribute)
110 printf("%s: colorattribute=%s\n", __func__, colorattribute);
111
112 if (hdmimode) {
113 if (strstr(hdmimode, "null")) {
114 env_set("hdmimode", "1080p60hz");
115 //run_command("saveenv", 0);
116 }
117 } else {
118 env_set("hdmimode", "1080p60hz");
119 //run_command("saveenv", 0);
120 }
121
122 hdmimode = env_get("hdmimode");
123 if (hpd_st) {
124 printf("set outputmode2: hdmimode=%s\n", hdmimode);
125 env_set("outputmode2", hdmimode);
126 } else {
127 cvbsmode = env_get("cvbsmode");
128 if (cvbsmode)
129 env_set("outputmode2", cvbsmode);
130 env_set("hdmichecksum", "0x00000000");
131 //run_command("saveenv", 0);
132 }
133
134 return 0;
135}
136
137int do_hpd_detect(cmd_tbl_t *cmdtp, int flag, int argc,
138 char *const argv[])
139{
140 char *st;
141 int hpd_st = 0;
142 unsigned long i = 0;
143 unsigned long hdmitx_hpd_wait_cnt = 10;
144#ifdef CONFIG_AML_HDMITX20
145 struct hdmitx_dev *hdev = hdmitx_get_hdev();
146#else
147 struct hdmitx_dev *hdev = get_hdmitx21_device();
148#endif
149 int ret = 0;
150
151 st = env_get("hdmitx_hpd_bypass");
152 if (st && (strcmp((const char *)(uintptr_t)st[0], "1") == 0)) {
153 printf("hdmitx_hpd_bypass detect\n");
154 return 0;
155 }
156 st = env_get("hdmitx_hpd_wait_cnt");
157 if (st)
158 hdmitx_hpd_wait_cnt = simple_strtoul(st, NULL, 10);
159 hpd_st = hdev->hwop.get_hpd_state();
160
161 if (!hpd_st) {
162 /* For some TV, they cost extra time to pullup HPD after 5V */
163
164 for (i = 0; i < hdmitx_hpd_wait_cnt; i++) {
165 mdelay(100);
166 hpd_st = hdev->hwop.get_hpd_state();
167 if (hpd_st) {
168 printf("hpd delay %lu ms\n", (i + 1) * 100);
169 break;
170 }
171 }
172 }
173 printf("%s, hpd_state=%d\n", __func__, hpd_st);
174
175 ret = vout_hdmi_hpd(hpd_st);
176 if (!ret)
177 vout2_hdmi_hpd(hpd_st);
178
179 return hpd_st;
180}
181#endif
182
183static unsigned int vout_parse_vout_name(char *name)
184{
185 char *p, *frac_str;
186 unsigned int frac = 0;
187
188 p = strchr(name, ',');
189 if (!p) {
190 frac = 0;
191 } else {
192 frac_str = p + 1;
193 *p = '\0';
194 if (strcmp(frac_str, "frac") == 0)
195 frac = 1;
196 }
197
198 return frac;
199}
200
201static int do_vout_list(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
202{
203#ifdef CONFIG_AML_HDMITX
204#ifdef CONFIG_AML_HDMITX20
205 struct hdmitx_dev *hdmitx_device = hdmitx_get_hdev();
206#else
207 struct hdmitx_dev *hdmitx_device = get_hdmitx21_device();
208#endif
209#endif
210
211#ifdef CONFIG_AML_HDMITX
212 if (!hdmitx_device) {
213 printf("\nerror: hdmitx device is null\n");
214 } else {
215 printf("\nvalid hdmi mode:\n");
216 hdmitx_device->hwop.list_support_modes();
217 }
218#endif
219
220#ifdef CONFIG_AML_CVBS
221 printf("\nvalid cvbs mode:\n");
222 cvbs_show_valid_vmode();
223#endif
224
225#ifdef CONFIG_AML_LCD
226 printf("\nvalid lcd mode:\n");
227 aml_lcd_driver_list_support_mode();
228#endif
229
230 return CMD_RET_SUCCESS;
231}
232
233static int do_vout_output(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
234{
235 char *mode;
236 unsigned int frac;
237#if defined(CONFIG_AML_CVBS) || defined(CONFIG_AML_HDMITX) || defined(CONFIG_AML_LCD)
238 unsigned int mux_sel = VIU_MUX_MAX, venc_sel = VIU_MUX_MAX;
239#endif
240#ifdef CONFIG_AML_HDMITX
241 char str[64];
242#endif
243#ifdef CONFIG_AML_LCD
244 unsigned int venc_index;
245#endif
246
247 if (argc != 2)
248 return CMD_RET_FAILURE;
249
250 mode = (char *)malloc(64 * sizeof(char));
251 if (!mode) {
252 printf("cmd_vout: mode malloc falied, exit\n");
253 return CMD_RET_FAILURE;
254 }
255 memset(mode, 0, (sizeof(char) * 64));
256 sprintf(mode, "%s", argv[1]);
257 frac = vout_parse_vout_name(mode);
258
259#ifdef CONFIG_AML_CVBS
260 mux_sel = cvbs_outputmode_check(mode, frac);
261 venc_sel = mux_sel & 0xf;
262 if (venc_sel == VIU_MUX_ENCI) {
263 vout_viu_mux(VOUT_VIU1_SEL, mux_sel);
264#ifdef CONFIG_AML_VPP
265 vpp_matrix_update(VPP_CM_YUV);
266#endif
267 if (cvbs_set_vmode(mode) == 0) {
268 free(mode);
269 run_command("setenv vout_init enable", 0);
270 return CMD_RET_SUCCESS;
271 }
272 }
273#endif
274
275#ifdef CONFIG_AML_HDMITX
276 if (frac == 0) { /* remove frac support in outputmode */
277 mux_sel = hdmi_outputmode_check(mode, frac);
278 venc_sel = mux_sel & 0xf;
279 if (venc_sel < VIU_MUX_MAX) {
280 vout_viu_mux(VOUT_VIU1_SEL, mux_sel);
281#ifdef CONFIG_AML_VPP
282 vpp_matrix_update(VPP_CM_YUV);
283#endif
284 /* //remove frac support in outputmode
285 *if (frac)
286 * setenv("frac_rate_policy", "1");
287 *else
288 * setenv("frac_rate_policy", "0");
289 */
290 memset(str, 0, sizeof(str));
291 sprintf(str, "hdmitx output %s", mode);
292 if (run_command(str, 0) == CMD_RET_SUCCESS)
293 run_command("setenv vout_init enable", 0);
294 free(mode);
295 return CMD_RET_SUCCESS;
296 }
297 }
298#endif
299
300#ifdef CONFIG_AML_LCD
301 mux_sel = aml_lcd_driver_outputmode_check(mode, frac);
302 venc_sel = mux_sel & 0xf;
303 venc_index = (mux_sel >> 4) & 0xf;
304 if (venc_sel == VIU_MUX_ENCL) {
305 vout_viu_mux(VOUT_VIU1_SEL, mux_sel);
306#ifdef CONFIG_AML_VPP
307 vpp_matrix_update(VPP_CM_RGB);
308#endif
309 aml_lcd_driver_enable(venc_index, mode, frac);
310 free(mode);
311 run_command("setenv vout_init enable", 0);
312 return CMD_RET_SUCCESS;
313 }
314#endif
315
316 printf("outputmode[%s] is invalid\n", argv[1]);
317 do { (void)frac; } while(0);
318
319 free(mode);
320 return CMD_RET_FAILURE;
321}
322
323static int do_vout2_list(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
324{
325#ifdef CONFIG_AML_HDMITX
326#ifdef CONFIG_AML_HDMITX20
327 struct hdmitx_dev *hdmitx_device = hdmitx_get_hdev();
328#else
329 struct hdmitx_dev *hdmitx_device = get_hdmitx21_device();
330#endif
331#endif
332
333#ifdef CONFIG_AML_HDMITX
334 if (!hdmitx_device) {
335 printf("\nerror: hdmitx device is null\n");
336 } else {
337 printf("\nvalid hdmi mode:\n");
338 hdmitx_device->hwop.list_support_modes();
339 }
340#endif
341
342#ifdef CONFIG_AML_CVBS
343 printf("\nvalid cvbs mode:\n");
344 cvbs_show_valid_vmode();
345#endif
346
347#ifdef CONFIG_AML_LCD
348 printf("\nvalid lcd mode:\n");
349 aml_lcd_driver_list_support_mode();
350#endif
351
352 return CMD_RET_SUCCESS;
353}
354
355static int do_vout2_output(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
356{
357 char *mode;
358 unsigned int frac;
359#if defined(CONFIG_AML_CVBS) || defined(CONFIG_AML_HDMITX) || defined(CONFIG_AML_LCD)
360 unsigned int mux_sel = VIU_MUX_MAX, venc_sel = VIU_MUX_MAX;
361#endif
362#ifdef CONFIG_AML_HDMITX
363 char str[64];
364#endif
365#ifdef CONFIG_AML_LCD
366 unsigned int venc_index;
367#endif
368
369 if (argc != 2)
370 return CMD_RET_FAILURE;
371
372 mode = (char *)malloc(64 * sizeof(char));
373 if (!mode) {
374 printf("cmd_vout: mode malloc falied, exit\n");
375 return CMD_RET_FAILURE;
376 }
377 memset(mode, 0, (sizeof(char) * 64));
378 sprintf(mode, "%s", argv[1]);
379 frac = vout_parse_vout_name(mode);
380
381#ifdef CONFIG_AML_CVBS
382 mux_sel = cvbs_outputmode_check(mode, frac);
383 venc_sel = mux_sel & 0xf;
384 if (venc_sel == VIU_MUX_ENCI) {
385 if (cvbs_set_vmode(mode) == 0) {
386 free(mode);
387 return CMD_RET_SUCCESS;
388 }
389 }
390#endif
391
392#ifdef CONFIG_AML_HDMITX
393 if (frac == 0) { /* remove frac support in outputmode */
394 mux_sel = hdmi_outputmode_check(mode, frac);
395 venc_sel = mux_sel & 0xf;
396 if (venc_sel < VIU_MUX_MAX) {
397 /* //remove frac support in outputmode
398 *if (frac)
399 * setenv("frac_rate_policy", "1");
400 *else
401 * setenv("frac_rate_policy", "0");
402 */
403 memset(str, 0, sizeof(str));
404 sprintf(str, "hdmitx output %s", mode);
405 run_command(str, 0);
406 free(mode);
407 return CMD_RET_SUCCESS;
408 }
409 }
410#endif
411
412#ifdef CONFIG_AML_LCD
413 mux_sel = aml_lcd_driver_outputmode_check(mode, frac);
414 venc_sel = mux_sel & 0xf;
415 venc_index = (mux_sel >> 4) & 0xf;
416 if (venc_sel == VIU_MUX_ENCL) {
417 aml_lcd_driver_enable(venc_index, mode, frac);
418 free(mode);
419 return CMD_RET_SUCCESS;
420 }
421#endif
422
423 printf("outputmode[%s] is invalid\n", argv[1]);
424 do { (void)frac; } while(0);
425
426 free(mode);
427 return CMD_RET_FAILURE;
428}
429
430static int do_vout2_prepare(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
431{
432 char *mode;
433 unsigned int frac;
434#if defined(CONFIG_AML_CVBS) || defined(CONFIG_AML_HDMITX) || defined(CONFIG_AML_LCD)
435 unsigned int mux_sel = VIU_MUX_MAX, venc_sel = VIU_MUX_MAX;
436#endif
437#ifdef CONFIG_AML_LCD
438 unsigned int venc_index;
439#endif
440
441 if (argc != 2)
442 return CMD_RET_FAILURE;
443
444 mode = (char *)malloc(64 * sizeof(char));
445 if (!mode) {
446 printf("cmd_vout: mode malloc falied, exit\n");
447 return CMD_RET_FAILURE;
448 }
449 memset(mode, 0, (sizeof(char) * 64));
450 sprintf(mode, "%s", argv[1]);
451 frac = vout_parse_vout_name(mode);
452
453#ifdef CONFIG_AML_CVBS
454 mux_sel = cvbs_outputmode_check(mode, frac);
455 venc_sel = mux_sel & 0xf;
456 if (venc_sel == VIU_MUX_ENCI) {
457 vout_viu_mux(VOUT_VIU2_SEL, mux_sel);
458#ifdef CONFIG_AML_VPP
459 vpp_viu2_matrix_update(VPP_CM_YUV);
460#endif
461 free(mode);
462 return CMD_RET_SUCCESS;
463 }
464#endif
465
466#ifdef CONFIG_AML_HDMITX
467 mux_sel = hdmi_outputmode_check(mode, frac);
468 venc_sel = mux_sel & 0xf;
469 if (venc_sel < VIU_MUX_MAX) {
470 vout_viu_mux(VOUT_VIU2_SEL, mux_sel);
471#ifdef CONFIG_AML_VPP
472 vpp_viu2_matrix_update(VPP_CM_YUV);
473#endif
474 free(mode);
475 return CMD_RET_SUCCESS;
476 }
477#endif
478
479#ifdef CONFIG_AML_LCD
480 mux_sel = aml_lcd_driver_outputmode_check(mode, frac);
481 venc_sel = mux_sel & 0xf;
482 venc_index = (mux_sel >> 4) & 0xf;
483 if (venc_sel == VIU_MUX_ENCL) {
484 vout_viu_mux(VOUT_VIU2_SEL, mux_sel);
485#ifdef CONFIG_AML_VPP
486 vpp_viu2_matrix_update(VPP_CM_RGB);
487#endif
488 aml_lcd_driver_prepare(venc_index, mode, frac);
489 free(mode);
490 return CMD_RET_SUCCESS;
491 }
492#endif
493
494 do { (void)frac; } while(0);
495
496 free(mode);
497 return CMD_RET_FAILURE;
498}
499
500static int do_vout3_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
501{
502#ifdef CONFIG_AML_HDMITX
503#ifdef CONFIG_AML_HDMITX20
504 struct hdmitx_dev *hdmitx_device = hdmitx_get_hdev();
505#else
506 struct hdmitx_dev *hdmitx_device = get_hdmitx21_device();
507#endif
508#endif
509
510#ifdef CONFIG_AML_HDMITX
511 if (!hdmitx_device) {
512 printf("\nerror: hdmitx device is null\n");
513 } else {
514 printf("\nvalid hdmi mode:\n");
515 hdmitx_device->hwop.list_support_modes();
516 }
517#endif
518
519#ifdef CONFIG_AML_CVBS
520 printf("\nvalid cvbs mode:\n");
521 cvbs_show_valid_vmode();
522#endif
523
524#ifdef CONFIG_AML_LCD
525 printf("\nvalid lcd mode:\n");
526 aml_lcd_driver_list_support_mode();
527#endif
528
529 return CMD_RET_SUCCESS;
530}
531
532static int do_vout3_output(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
533{
534 char *mode;
535 unsigned int frac;
536#if defined(CONFIG_AML_CVBS) || defined(CONFIG_AML_HDMITX) || defined(CONFIG_AML_LCD)
537 unsigned int mux_sel = VIU_MUX_MAX, venc_sel = VIU_MUX_MAX;
538#endif
539#ifdef CONFIG_AML_HDMITX
540 char str[64];
541#endif
542#ifdef CONFIG_AML_LCD
543 unsigned int venc_index;
544#endif
545
546 if (argc != 2)
547 return CMD_RET_FAILURE;
548
549 mode = (char *)malloc(64 * sizeof(char));
550 if (!mode) {
551 printf("cmd_vout: mode malloc failed, exit\n");
552 return CMD_RET_FAILURE;
553 }
554 memset(mode, 0, (sizeof(char) * 64));
555 sprintf(mode, "%s", argv[1]);
556 frac = vout_parse_vout_name(mode);
557
558#ifdef CONFIG_AML_CVBS
559 mux_sel = cvbs_outputmode_check(mode, frac);
560 venc_sel = mux_sel & 0xf;
561 if (venc_sel == VIU_MUX_ENCI) {
562 if (cvbs_set_vmode(mode) == 0) {
563 free(mode);
564 return CMD_RET_SUCCESS;
565 }
566 }
567#endif
568
569#ifdef CONFIG_AML_HDMITX
570 if (frac == 0) { /* remove frac support in outputmode */
571 mux_sel = hdmi_outputmode_check(mode, frac);
572 venc_sel = mux_sel & 0xf;
573 if (venc_sel < VIU_MUX_MAX) {
574 /* //remove frac support in outputmode
575 *if (frac)
576 * setenv("frac_rate_policy", "1");
577 *else
578 * setenv("frac_rate_policy", "0");
579 */
580 memset(str, 0, sizeof(str));
581 sprintf(str, "hdmitx output %s", mode);
582 run_command(str, 0);
583 free(mode);
584 return CMD_RET_SUCCESS;
585 }
586 }
587#endif
588
589#ifdef CONFIG_AML_LCD
590 mux_sel = aml_lcd_driver_outputmode_check(mode, frac);
591 venc_sel = mux_sel & 0xf;
592 venc_index = (mux_sel >> 4) & 0xf;
593 if (venc_sel == VIU_MUX_ENCL) {
594 aml_lcd_driver_enable(venc_index, mode, frac);
595 free(mode);
596 return CMD_RET_SUCCESS;
597 }
598#endif
599
600 printf("outputmode[%s] is invalid\n", argv[1]);
601 do { (void)frac; } while (0);
602
603 free(mode);
604 return CMD_RET_FAILURE;
605}
606
607static int do_vout3_prepare(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
608{
609 char *mode;
610 unsigned int frac;
611#if defined(CONFIG_AML_CVBS) || defined(CONFIG_AML_HDMITX) || defined(CONFIG_AML_LCD)
612 unsigned int mux_sel = VIU_MUX_MAX, venc_sel = VIU_MUX_MAX;
613#endif
614#ifdef CONFIG_AML_LCD
615 unsigned int venc_index;
616#endif
617
618 if (argc != 2)
619 return CMD_RET_FAILURE;
620
621 mode = (char *)malloc(64 * sizeof(char));
622 if (!mode) {
623 printf("cmd_vout: mode malloc failed, exit\n");
624 return CMD_RET_FAILURE;
625 }
626 memset(mode, 0, (sizeof(char) * 64));
627 sprintf(mode, "%s", argv[1]);
628 frac = vout_parse_vout_name(mode);
629
630#ifdef CONFIG_AML_CVBS
631 mux_sel = cvbs_outputmode_check(mode, frac);
632 venc_sel = mux_sel & 0xf;
633 if (venc_sel == VIU_MUX_ENCI) {
634 vout_viu_mux(VOUT_VIU3_SEL, mux_sel);
635#ifdef CONFIG_AML_VPP
636 vpp_viu3_matrix_update(VPP_CM_YUV);
637#endif
638 free(mode);
639 return CMD_RET_SUCCESS;
640 }
641#endif
642
643#ifdef CONFIG_AML_HDMITX
644 mux_sel = hdmi_outputmode_check(mode, frac);
645 venc_sel = mux_sel & 0xf;
646 if (venc_sel < VIU_MUX_MAX) {
647 vout_viu_mux(VOUT_VIU3_SEL, mux_sel);
648#ifdef CONFIG_AML_VPP
649 vpp_viu3_matrix_update(VPP_CM_YUV);
650#endif
651 free(mode);
652 return CMD_RET_SUCCESS;
653 }
654#endif
655
656#ifdef CONFIG_AML_LCD
657 mux_sel = aml_lcd_driver_outputmode_check(mode, frac);
658 venc_sel = mux_sel & 0xf;
659 venc_index = (mux_sel >> 4) & 0xf;
660 if (venc_sel == VIU_MUX_ENCL) {
661 vout_viu_mux(VOUT_VIU3_SEL, mux_sel);
662#ifdef CONFIG_AML_VPP
663 //vpp_viu2_matrix_update(VPP_CM_RGB);
664#endif
665 aml_lcd_driver_prepare(venc_index, mode, frac);
666 free(mode);
667 return CMD_RET_SUCCESS;
668 }
669#endif
670
671 do { (void)frac; } while (0);
672
673 free(mode);
674 return CMD_RET_FAILURE;
675}
676
677static int do_vout_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
678{
679 vout_vinfo_dump();
680
681 return CMD_RET_SUCCESS;
682}
683
684static cmd_tbl_t cmd_vout_sub[] = {
685 U_BOOT_CMD_MKENT(list, 1, 1, do_vout_list, "", ""),
686 U_BOOT_CMD_MKENT(output, 3, 1, do_vout_output, "", ""),
687 U_BOOT_CMD_MKENT(info, 1, 1, do_vout_info, "", ""),
688};
689
690static int do_vout(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
691{
692 cmd_tbl_t *c;
693
694 if (argc < 2)
695 return cmd_usage(cmdtp);
696
697 argc--;
698 argv++;
699
700 c = find_cmd_tbl(argv[0], &cmd_vout_sub[0], ARRAY_SIZE(cmd_vout_sub));
701
702 if (c)
703 return c->cmd(cmdtp, flag, argc, argv);
704 else
705 return cmd_usage(cmdtp);
706}
707
708U_BOOT_CMD(vout, CONFIG_SYS_MAXARGS, 1, do_vout,
709 "VOUT sub-system",
710 "vout [list | output format | info]\n"
711 " list : list for valid video mode names.\n"
712 " format : perfered output video mode\n"
713 " info : dump vinfo\n"
714);
715
716static cmd_tbl_t cmd_vout2_sub[] = {
717 U_BOOT_CMD_MKENT(list, 1, 1, do_vout2_list, "", ""),
718 U_BOOT_CMD_MKENT(prepare, 3, 1, do_vout2_prepare, "", ""),
719 U_BOOT_CMD_MKENT(output, 3, 1, do_vout2_output, "", ""),
720 U_BOOT_CMD_MKENT(info, 1, 1, do_vout_info, "", ""),
721};
722
723static int do_vout2(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
724{
725 cmd_tbl_t *c;
726
727 if (argc < 2)
728 return cmd_usage(cmdtp);
729
730 argc--;
731 argv++;
732
733 c = find_cmd_tbl(argv[0], &cmd_vout2_sub[0], ARRAY_SIZE(cmd_vout2_sub));
734
735 if (c)
736 return c->cmd(cmdtp, flag, argc, argv);
737 else
738 return cmd_usage(cmdtp);
739}
740
741U_BOOT_CMD(vout2, CONFIG_SYS_MAXARGS, 1, do_vout2,
742 "VOUT2 sub-system",
743 "vout2 [list | prepare format | output format | info]\n"
744 " list : list for valid video mode names.\n"
745 " format : perfered output video mode\n"
746 " info : dump vinfo\n"
747);
748
749static cmd_tbl_t cmd_vout3_sub[] = {
750 U_BOOT_CMD_MKENT(list, 1, 1, do_vout3_list, "", ""),
751 U_BOOT_CMD_MKENT(prepare, 3, 1, do_vout3_prepare, "", ""),
752 U_BOOT_CMD_MKENT(output, 3, 1, do_vout3_output, "", ""),
753 U_BOOT_CMD_MKENT(info, 1, 1, do_vout_info, "", ""),
754};
755
756static int do_vout3(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
757{
758 cmd_tbl_t *c;
759
760 if (argc < 2)
761 return cmd_usage(cmdtp);
762
763 argc--;
764 argv++;
765
766 c = find_cmd_tbl(argv[0], &cmd_vout3_sub[0], ARRAY_SIZE(cmd_vout3_sub));
767
768 if (c)
769 return c->cmd(cmdtp, flag, argc, argv);
770 else
771 return cmd_usage(cmdtp);
772}
773
774U_BOOT_CMD(vout3, CONFIG_SYS_MAXARGS, 1, do_vout3,
775 "VOUT3 sub-system",
776 "vout3 [list | prepare format | output format | info]\n"
777 " list : list for valid video mode names.\n"
778 " format : perfered output video mode\n"
779 " info : dump vinfo\n"
780);
781