From patchwork Tue Jan 26 01:29:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 8117181 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 193C3BEEE5 for ; Tue, 26 Jan 2016 01:29:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15608202E6 for ; Tue, 26 Jan 2016 01:29:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DD2A202D1 for ; Tue, 26 Jan 2016 01:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755472AbcAZB3d (ORCPT ); Mon, 25 Jan 2016 20:29:33 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:48352 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752128AbcAZB3c (ORCPT ); Mon, 25 Jan 2016 20:29:32 -0500 Received: from trochilidae.toradex.int (75-146-58-181-Washington.hfc.comcastbusiness.net [75.146.58.181]) by mail.kmu-office.ch (Postfix) with ESMTPSA id BBF955C04C6; Tue, 26 Jan 2016 02:28:13 +0100 (CET) From: Stefan Agner To: plagnioj@jcrosoft.com, shawnguo@kernel.org Cc: s.hauer@pengutronix.de, Ying.Liu@freescale.com, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, LW@KARO-electronics.de, fabio.estevam@freescale.com, max.krummenacher@toradex.com, Stefan Agner Subject: [PATCH] video: fbdev: mxsfb: fix pixelclock polarity Date: Mon, 25 Jan 2016 17:29:16 -0800 Message-Id: <1453771756-5418-1-git-send-email-stefan@agner.ch> X-Mailer: git-send-email 2.7.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1453771695; bh=lgQRbBMRDEAaqFd0BCsKOeiJJyFtlTiz1coquTsV5/Y=; h=From:To:Cc:Subject:Date:Message-Id; b=kTtmTxPF12zNpZJcWx+oxzaY/3l02HOOwtfbbQ/5KBiAiZeSJqqerr6PV+bVZ12tyBxNQMjdrrAEKdruLouTETwKVZ0izi3qj49xuCziFQbQQm5819b6/DZYpa4g6mWp+KaZ1msOM/H8lPU9ogF4srtaSsLL2dcNkD+Vuq4xSWM= Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 The PIXDATA flags of the display_flags enum are controller centric, e.g. NEGEDGE means the controller shall drive the data signals on pixelclocks negative edge. However, the drivers flag is display centric: Sample the data on negative (falling) edge. Therefore, change the if statement to check for the POSEDGE flag (which is typically not set): Drive on positive edge => sample on negative edge Signed-off-by: Stefan Agner Acked-by: Shawn Guo --- Hi all Shawn, I would like to have at least your Ack on this before merge. It seems that this has been wrong since the driver is able to use the timings from the device tree, introduced with 669406534b4a ("video: mxsfb: get display timings from device tree"). Not sure how many device trees actually specify the wrong pixel clock polarity due to that. At least the initial flag convertion from the old platform data structures done with 0d9f8217db15 ("ARM: mxs: move display timing configurations into device tree") seems to be affected and would need to be changed accordingly... Not sure how we should handle this, maybe just invert all pixelclk-active properties where the mxsfb driver is in use...? -- Stefan drivers/video/fbdev/mxsfb.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/mxsfb.c b/drivers/video/fbdev/mxsfb.c index 4e6608c..38898a9 100644 --- a/drivers/video/fbdev/mxsfb.c +++ b/drivers/video/fbdev/mxsfb.c @@ -150,7 +150,7 @@ #define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */ #define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6) -#define MXSFB_SYNC_DOTCLK_FALLING_ACT (1 << 7) /* negtive edge sampling */ +#define MXSFB_SYNC_DOTCLK_FALLING_ACT (1 << 7) /* negative edge sampling */ enum mxsfb_devtype { MXSFB_V3, @@ -788,7 +788,16 @@ static int mxsfb_init_fbinfo_dt(struct mxsfb_info *host, if (vm.flags & DISPLAY_FLAGS_DE_HIGH) host->sync |= MXSFB_SYNC_DATA_ENABLE_HIGH_ACT; - if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) + + /* + * The PIXDATA flags of the display_flags enum are controller + * centric, e.g. NEGEDGE means drive data on negative edge. + * However, the drivers flag is display centric: Sample the + * data on negative (falling) edge. Therefore, check for the + * POSEDGE flag: + * drive on positive edge => sample on negative edge + */ + if (vm.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE) host->sync |= MXSFB_SYNC_DOTCLK_FALLING_ACT; put_display_node: