xref: /openbmc/u-boot/arch/arm/mach-imx/cmd_hdmidet.c (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2552a848eSStefano Babic /*
3552a848eSStefano Babic  * Copyright (C) 2012 Boundary Devices Inc.
4552a848eSStefano Babic  */
5552a848eSStefano Babic #include <common.h>
6552a848eSStefano Babic #include <asm/arch/imx-regs.h>
7552a848eSStefano Babic #include <asm/arch/mxc_hdmi.h>
8552a848eSStefano Babic #include <asm/io.h>
9552a848eSStefano Babic 
do_hdmidet(cmd_tbl_t * cmdtp,int flag,int argc,char * const argv[])10552a848eSStefano Babic static int do_hdmidet(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
11552a848eSStefano Babic {
12552a848eSStefano Babic 	struct hdmi_regs *hdmi	= (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
13552a848eSStefano Babic 	return (readb(&hdmi->phy_stat0) & HDMI_DVI_STAT) ? 0 : 1;
14552a848eSStefano Babic }
15552a848eSStefano Babic 
16552a848eSStefano Babic U_BOOT_CMD(hdmidet, 1, 1, do_hdmidet,
17552a848eSStefano Babic 	"detect HDMI monitor",
18552a848eSStefano Babic 	""
19552a848eSStefano Babic );
20