From patchwork Sat Mar 9 16:26:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 226345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id E98582C030B for ; Sun, 10 Mar 2013 03:26:27 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D7FF4A428; Sat, 9 Mar 2013 17:26:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hDgtEcIyOoCU; Sat, 9 Mar 2013 17:26:24 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7D4084A42B; Sat, 9 Mar 2013 17:26:22 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 669494A42B for ; Sat, 9 Mar 2013 17:26:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5qSnLKJ0nFBr for ; Sat, 9 Mar 2013 17:26:12 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from fed1rmfepo201.cox.net (fed1rmfepo201.cox.net [68.230.241.146]) by theia.denx.de (Postfix) with ESMTP id 06A064A428 for ; Sat, 9 Mar 2013 17:26:10 +0100 (CET) Received: from fed1rmimpo305 ([68.230.241.173]) by fed1rmfepo201.cox.net (InterMail vM.8.01.04.00 201-2260-137-20101110) with ESMTP id <20130309162608.NEJQ25438.fed1rmfepo201.cox.net@fed1rmimpo305> for ; Sat, 9 Mar 2013 11:26:08 -0500 Received: from localhost.localdomain ([98.165.108.80]) by fed1rmimpo305 with cox id 9US71l00D1k6krm01US7JV; Sat, 09 Mar 2013 11:26:08 -0500 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020204.513B62A0.0090,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=W9Hmo2qk c=1 sm=1 a=87hnwZmecfatDj2PU7A2TQ==:17 a=At3PbFIwZBwA:10 a=rcTfVT_afHIA:10 a=R_N1NMmAAAAA:8 a=pM_BGVVgHKQA:10 a=edDCx7kcDNR29QuzEPcA:9 a=QOiTB_lUNkwA:10 a=87hnwZmecfatDj2PU7A2TQ==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; none From: Eric Nelson To: u-boot@lists.denx.de Date: Sat, 9 Mar 2013 09:26:05 -0700 Message-Id: <1362846365-9876-1-git-send-email-eric.nelson@boundarydevices.com> X-Mailer: git-send-email 1.7.9.5 Cc: fabio.estevam@freescale.com, otavio@ossystems.com.br Subject: [U-Boot] [PATCH V2] i.MX6: Add hdmidet command to detect attached HDMI monitor X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Eric Nelson --- V2 uses struct hdmi_regs instead of raw offsets. arch/arm/imx-common/Makefile | 1 + arch/arm/imx-common/cmd_hdmidet.c | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 arch/arm/imx-common/cmd_hdmidet.c diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile index 6309fcd..428a57e 100644 --- a/arch/arm/imx-common/Makefile +++ b/arch/arm/imx-common/Makefile @@ -32,6 +32,7 @@ COBJS-y = iomux-v3.o timer.o cpu.o speed.o COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o endif COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o +COBJS-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o COBJS := $(sort $(COBJS-y)) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/arch/arm/imx-common/cmd_hdmidet.c b/arch/arm/imx-common/cmd_hdmidet.c new file mode 100644 index 0000000..852e19a --- /dev/null +++ b/arch/arm/imx-common/cmd_hdmidet.c @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2012 Boundary Devices Inc. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#include +#include +#include +#include + +static int do_hdmidet(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + struct hdmi_regs *hdmi = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR; + u8 reg = readb(&hdmi->phy_stat0) & HDMI_PHY_HPD; + return (reg&HDMI_PHY_HPD) + ? 0 : 1; +} + +U_BOOT_CMD(hdmidet, 1, 1, do_hdmidet, + "detect HDMI monitor", + "" +);