From patchwork Tue Oct 15 13:10:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 3045041 Return-Path: X-Original-To: patchwork-linux-arm@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 88D50BF924 for ; Tue, 15 Oct 2013 13:12:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D421E20172 for ; Tue, 15 Oct 2013 13:11:59 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8BF32017C for ; Tue, 15 Oct 2013 13:11:54 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VW4Pa-0007EQ-C8; Tue, 15 Oct 2013 13:11:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VW4PX-0007Vn-Gg; Tue, 15 Oct 2013 13:11:43 +0000 Received: from [2002:4e20:1eda::1] (helo=caramon.arm.linux.org.uk) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VW4PM-0007UR-Ko for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2013 13:11:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=KHuCodJhhNfLnq5KdoiA5m3eu0Ra7mc4SxtSjeY+rGg=; b=mJmB2HeSsn/sgrDxMTwe3W7k9/w6jsNX8271wl/yRBDC/SR8rAlUYgs31inKJJKo5FlpqF0DJ6dTtKMKUZxyjJnoiNEkgdGvCqSESA2V/t53k1LYCefJwOcPnq76X8rrfyAkd3nKRVLcvTXTeRoWk5ql1p4ixcRby9rD0AAcuR4=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:37293) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1VW4OW-00082t-VJ; Tue, 15 Oct 2013 14:10:41 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1VW4OV-0003Pt-I9; Tue, 15 Oct 2013 14:10:39 +0100 Date: Tue, 15 Oct 2013 14:10:39 +0100 From: Russell King - ARM Linux To: Fabio Estevam Subject: Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support Message-ID: <20131015131038.GB25034@n2100.arm.linux.org.uk> References: <1380826287-30253-1-git-send-email-fabio.estevam@freescale.com> <20131003202751.GZ6192@mwanda> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131003202751.GZ6192@mwanda> User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131015_091133_892854_8B2250E7 X-CRM114-Status: GOOD ( 14.44 ) X-Spam-Score: -1.0 (-) Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, s.hauer@pengutronix.de, robertcnelson@gmail.com, Dan Carpenter , shawn.guo@linaro.org, festevam@gmail.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Another point on patch 1. Sorry, I don't have patch 1 to reply to, it seems it was deleted from linux-arm-kernel's moderation queue. drm_mode_connector_attach_encoder() is called too early, before the base.id field in the encoder has been initialised. This causes the connectors encoder array to be empty, and userspace KMS to fail. There's also bugs in the CSC setting too - it runs off the end of the array and gcc warns about this. The code was clearly wrong. You may wish to combine this patch with patch 1 to sort all that out. For the patch below: Signed-off-by: Russell King Tested-by: Russell King diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index e227eb1..ca0450b 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c @@ -507,7 +507,7 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi *hdmi) hdmi_writeb(hdmi, ((*csc_coeff)[0][2] & 0xff), HDMI_CSC_COEF_A3_LSB); hdmi_writeb(hdmi, ((*csc_coeff)[0][2] >> 8), HDMI_CSC_COEF_A3_MSB); hdmi_writeb(hdmi, ((*csc_coeff)[0][3] & 0xff), HDMI_CSC_COEF_A4_LSB); - hdmi_writeb(hdmi, ((*csc_coeff)[0][4] >> 8), HDMI_CSC_COEF_A4_MSB); + hdmi_writeb(hdmi, ((*csc_coeff)[0][3] >> 8), HDMI_CSC_COEF_A4_MSB); hdmi_writeb(hdmi, ((*csc_coeff)[1][0] & 0xff), HDMI_CSC_COEF_B1_LSB); hdmi_writeb(hdmi, ((*csc_coeff)[1][0] >> 8), HDMI_CSC_COEF_B1_MSB); @@ -516,7 +516,7 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi *hdmi) hdmi_writeb(hdmi, ((*csc_coeff)[1][2] & 0xff), HDMI_CSC_COEF_B3_LSB); hdmi_writeb(hdmi, ((*csc_coeff)[1][2] >> 8), HDMI_CSC_COEF_B3_MSB); hdmi_writeb(hdmi, ((*csc_coeff)[1][3] & 0xff), HDMI_CSC_COEF_B4_LSB); - hdmi_writeb(hdmi, ((*csc_coeff)[1][4] >> 8), HDMI_CSC_COEF_B4_MSB); + hdmi_writeb(hdmi, ((*csc_coeff)[1][3] >> 8), HDMI_CSC_COEF_B4_MSB); hdmi_writeb(hdmi, ((*csc_coeff)[2][0] & 0xff), HDMI_CSC_COEF_C1_LSB); hdmi_writeb(hdmi, ((*csc_coeff)[2][0] >> 8), HDMI_CSC_COEF_C1_MSB); @@ -525,7 +525,7 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi *hdmi) hdmi_writeb(hdmi, ((*csc_coeff)[2][2] & 0xff), HDMI_CSC_COEF_C3_LSB); hdmi_writeb(hdmi, ((*csc_coeff)[2][2] >> 8), HDMI_CSC_COEF_C3_MSB); hdmi_writeb(hdmi, ((*csc_coeff)[2][3] & 0xff), HDMI_CSC_COEF_C4_LSB); - hdmi_writeb(hdmi, ((*csc_coeff)[2][4] >> 8), HDMI_CSC_COEF_C4_MSB); + hdmi_writeb(hdmi, ((*csc_coeff)[2][3] >> 8), HDMI_CSC_COEF_C4_MSB); val = hdmi_readb(hdmi, HDMI_CSC_SCALE); val &= ~HDMI_CSC_SCALE_CSCSCALE_MASK; @@ -1774,8 +1774,6 @@ static int imx_hdmi_register(struct imx_hdmi *hdmi) { int ret; - drm_mode_connector_attach_encoder(&hdmi->connector, &hdmi->encoder); - hdmi->connector.funcs = &imx_hdmi_connector_funcs; hdmi->encoder.funcs = &imx_hdmi_encoder_funcs; @@ -1803,6 +1801,8 @@ static int imx_hdmi_register(struct imx_hdmi *hdmi) hdmi->connector.encoder = &hdmi->encoder; + drm_mode_connector_attach_encoder(&hdmi->connector, &hdmi->encoder); + return 0; }