From patchwork Thu Jul 6 18:50:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 116831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2791488vqx; Thu, 6 Jul 2023 12:38:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSykbGXj86dfiqVes2MxlIO1oX9HYgHhixVAzU8oVGky4CzzEPAEBVRD61qhiHiZS9gwFz X-Received: by 2002:a17:90a:b904:b0:263:848:762e with SMTP id p4-20020a17090ab90400b002630848762emr2004666pjr.40.1688672316673; Thu, 06 Jul 2023 12:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688672316; cv=none; d=google.com; s=arc-20160816; b=dQy+JQ3k7C6Q0v0uArxpCr3/pXDreUoH72a+rp2S7UvAygqPeijimMQ7Yqdvt41XZt DdIXlEV5qLtPIy92yp9C+zZw/NgAietZZ5anfrzLAB3ozhj+m/a8gA0XbbdLY1Q7wMo1 kz1EURArZCylZUc6XuyKeUn0y3APotnbkeiFntm95Y/vZCNbnirkjCFa5+C7kaMKNAXf 0VYEUHf5UXgJ0fj8GjzEbiGTFUrFTPQDZ0lNa0WT4gL/eKfFVICBzfkukWRrbxYvuj7P oyvu+KLd2lpsvkl/J3XeLvS49IBXNI0OkrGUOZikdjA82jYmVit1Zi0HQNKKPn5Kl4xE Cc8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :message-id:date:cc:to:from:dkim-signature; bh=rI+8S7w+5wae4yvhZ4wNULs/xtvCq38AsDvZDV1s+XA=; fh=jx556IfQxnA+SVkPjFOTiN2gTXycDTv+SzzEMOSWlIA=; b=U3I6CqNqIt7ZIIn+X67OI7iuXv1+ZlHkwoioCyJlrl+HcZVz8viXK2HDKFRb34Es0f aNMNUNiwFYe3mBe7Qv/v/W6223tqUY/Km+hPIBd3SlMM+Pw9/DRaIuLo10FbFyrlQQLD xva4/ksJICSqFIZRId4MxM3Uqle9YYvELvfEvTLuzbTl7z2yeebQKw4PgV2wDOKTtReX KbPlSeyHSaJ10YCmhBb9oigKi4bWxh8LA0+XYqcTyiqnBbG26iuxZe7xTusEYaHGv8Vg QBp/3NZwui/5ctyAIjfRsURF0HZV3/6FRKXHq8lOzGx5fgJTfU9G1cN5gqjtNHX1cu4h rGkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=R69MOA17; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ml20-20020a17090b361400b0025546028cbesi322728pjb.31.2023.07.06.12.38.21; Thu, 06 Jul 2023 12:38:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@hugovil.com header.s=x header.b=R69MOA17; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230408AbjGFSvL (ORCPT + 99 others); Thu, 6 Jul 2023 14:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjGFSvK (ORCPT ); Thu, 6 Jul 2023 14:51:10 -0400 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CA75B2 for ; Thu, 6 Jul 2023 11:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=rI+8S7w+5wae4yvhZ4wNULs/xtvCq38AsDvZDV1s+XA=; b=R 69MOA17vuBfB1Penjn6uVmOGkl7d8gMlbQlfxbeXLHuT6j5rTfCGiksUJxFZu5vgHUCtyhB6fIT5p sXhGLR+vvpiqKmjLEPcXyNUGz5KrX8NOHzBhUUqzrx6eGO+EuD+9YwIgJ+BAy/Q0I8ExLHVdP5iHS scK0kkBM8tzJk26M=; Received: from modemcable061.19-161-184.mc.videotron.ca ([184.161.19.61]:39080 helo=localhost.localdomain) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1qHU4E-0002oN-Iu; Thu, 06 Jul 2023 14:51:03 -0400 From: Hugo Villeneuve To: Miguel Ojeda Cc: hugo@hugovil.com, Hugo Villeneuve , linux-kernel@vger.kernel.org Date: Thu, 6 Jul 2023 14:50:59 -0400 Message-Id: <20230706185100.84322-1-hugo@hugovil.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 184.161.19.61 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Subject: [PATCH] auxdisplay: hd44780: move cursor home after clear display command X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770701263304429975?= X-GMAIL-MSGID: =?utf-8?q?1770701263304429975?= From: Hugo Villeneuve The "clear display" command on the NewHaven NHD-0220DZW-AG5 display does NOT change the DDRAM address to 00h (home position) like the standard Hitachi HD44780 controller. As a consequence, the starting position of the initial string LCD_INIT_TEXT is not guaranteed to be at 0,0 depending on where the cursor was before the clear display command. Extract of CLEAR_DISPLAY command from datasheets of: Hitachi HD44780: ... It then sets DDRAM address 0 into the address counter... NewHaven NHD-0220DZW-AG5 datasheet: ... This instruction does not change the DDRAM Address Move the cursor home after sending clear display command to support non-standard LCDs. Signed-off-by: Hugo Villeneuve Tested-by: David Reaver --- drivers/auxdisplay/hd44780_common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) base-commit: c17414a273b81fe4e34e11d69fc30cc8b1431614 diff --git a/drivers/auxdisplay/hd44780_common.c b/drivers/auxdisplay/hd44780_common.c index 3934c2eebf33..70c818945a74 100644 --- a/drivers/auxdisplay/hd44780_common.c +++ b/drivers/auxdisplay/hd44780_common.c @@ -82,7 +82,13 @@ int hd44780_common_clear_display(struct charlcd *lcd) hdc->write_cmd(hdc, LCD_CMD_DISPLAY_CLEAR); /* datasheet says to wait 1,64 milliseconds */ long_sleep(2); - return 0; + + /* + * Some LCDs (ex: NewHaven) do not reset the DDRAM address when + * executing the CLEAR_DISPLAY command. Explicitely move cursor + * to home position to account for these non-standard LCDs: + */ + return hd44780_common_home(lcd); } EXPORT_SYMBOL_GPL(hd44780_common_clear_display);