From patchwork Wed Dec 3 15:05:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 5431341 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4F61BBEEA8 for ; Wed, 3 Dec 2014 15:05:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97C4220357 for ; Wed, 3 Dec 2014 15:05:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F4E2202EC for ; Wed, 3 Dec 2014 15:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751525AbaLCPFT (ORCPT ); Wed, 3 Dec 2014 10:05:19 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:41668 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbaLCPFT (ORCPT ); Wed, 3 Dec 2014 10:05:19 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id sB3F5H2T010028; Wed, 3 Dec 2014 09:05:17 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id sB3F5Hkk023445; Wed, 3 Dec 2014 09:05:17 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Wed, 3 Dec 2014 09:05:16 -0600 Received: from [10.1.3.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id sB3F5FD4026157; Wed, 3 Dec 2014 09:05:15 -0600 Message-ID: <547F26AA.4070001@ti.com> Date: Wed, 3 Dec 2014 17:05:14 +0200 From: Jyri Sarha User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Tomi Valkeinen , Dan Carpenter CC: Subject: Re: OMAPDSS: HDMI: Add OMAP5 HDMI support References: <20141203122202.GA7398@mwanda> <547F052F.1040409@ti.com> In-Reply-To: <547F052F.1040409@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,BIGNUM_EMAILS, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD,T_TVD_MIME_EPI,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 12/03/2014 02:42 PM, Tomi Valkeinen wrote: > Hi Dan, Jyri, > > On 03/12/14 14:22, Dan Carpenter wrote: >> Hello Tomi Valkeinen, >> >> The patch f5bab2229190: "OMAPDSS: HDMI: Add OMAP5 HDMI support" from >> Mar 13, 2014, leads to the following static checker warning: >> >> drivers/video/fbdev/omap2/dss/hdmi5_core.c:719 hdmi5_core_audio_config() >> warn: '(3) - (4)' negative one >> >> Uh... This is really weird, I have no idea what this warning is or why >> it's triggered. I've even looked at the code which triggers it but that >> has no documentation. :P Still it seems like something worth looking >> into. > > I presume it somehow is caused by this line in the dss.h: > > #define FLD_MASK(start, end) (((1 << ((start) - (end) + 1)) - 1) << (end)) > > But I don't quite see why the warnings happens. start=3 and end=4 should > produce valid code there, even if the end result is not what's expected... > >> drivers/video/fbdev/omap2/dss/hdmi5_core.c >> 713 /* PCM audio mode */ >> 714 val = (cfg->iec60958_cfg->status[0] & IEC958_AES0_CON_MODE) >> 6; >> 715 REG_FLD_MOD(base, HDMI_CORE_FC_AUDSCHNLS(2), val, 6, 4); >> 716 >> 717 /* Source number */ >> 718 val = cfg->iec60958_cfg->status[2] & IEC958_AES2_CON_SOURCE; >> 719 REG_FLD_MOD(base, HDMI_CORE_FC_AUDSCHNLS(2), val, 3, 4); >> ^^^^ >> Aren't these reversed? This seems like an invalid bitfield range. > > Good catch! Indeed it's reversed. > > Jyri, this is in the hdmi audio side. Can you check it out? Fix is > trivial, but I'd like to know if it has caused wrong configuration, and > if it has, why haven't we noticed anything. > The bits written there are always zero and hardly significant. The HDMI audio still works after the attached patch. Best regards, Jyri ps. One of these days I am going to have to go through these settings register by register... From 08460e1db02f1babd75b72769e3078462f8e5d81 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Wed, 3 Dec 2014 16:24:06 +0200 Subject: [PATCH] OMAPDSS: hdmi5: Fix bit field for IEC958_AES2_CON_SOURCE The bit field for IEC958_AES2_CON_SOURCE is bit 3-0 in HDMI_CORE_FC_AUDSCHNLS2, not imaginary bits 3-4 (reverse order). Signed-off-by: Jyri Sarha --- drivers/video/fbdev/omap2/dss/hdmi5_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c b/drivers/video/fbdev/omap2/dss/hdmi5_core.c index a711579..a3cfe3d 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c +++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c @@ -716,7 +716,7 @@ static void hdmi5_core_audio_config(struct hdmi_core_data *core, /* Source number */ val = cfg->iec60958_cfg->status[2] & IEC958_AES2_CON_SOURCE; - REG_FLD_MOD(base, HDMI_CORE_FC_AUDSCHNLS(2), val, 3, 4); + REG_FLD_MOD(base, HDMI_CORE_FC_AUDSCHNLS(2), val, 3, 0); /* Channel number right 0 */ REG_FLD_MOD(base, HDMI_CORE_FC_AUDSCHNLS(3), 2, 3, 0); -- 1.7.9.5