Received: by 10.223.185.116 with SMTP id b49csp3170537wrg; Sun, 25 Feb 2018 15:56:02 -0800 (PST) X-Google-Smtp-Source: AH8x226nPGGd12oT5QoRGreGWX3HwFBhVfAFJjGQme7sOW7AKOCuYVdEEastydufg00/2ESkJoBM X-Received: by 10.99.122.86 with SMTP id j22mr6946141pgn.351.1519602962305; Sun, 25 Feb 2018 15:56:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519602962; cv=none; d=google.com; s=arc-20160816; b=pKKcatoVDe/TTlIVcRrbZp7fJgtItjsBfDE51QZjoHlBZUThk8L4z4pbmJTNVoqgZS 838SIMtRTLCd0vdm10AXJIPs3LxHv7WcJCVrs2wO/Fm2wplBe2l/iUbWINfYk8ZNg76Z QmXCWoNN+b+jtegYv0t9BdS3z+4Ch9btsmtK19joXaB/CtORf2tznwd5nUqkFj6BlFwY OnqzdLO4HYWgRjSb2xUdWozfSzTQCTThv7G3CxTVr7UP9YvwBRw1ikYSoGtZnB3z6Wqs G1WA3x9McsRjW+q7F1Iooah5pe16CZp9R6ttCxhJIdusxHLa4DW9HLxAhwC33hTsV+go ETSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=oZ+hWwNnd9kPq51K62y98NWQh+DKaiLz1epFm+YhaiQ=; b=S41p0+FiEc9zn77ZnFzir7grN9vEA/DTQUWSx2oyu+YXYy61cHQKoVXW3FjHsRnQus VAyD7TRptJQ9cEH6uFKAG/niTogES3MV0uRTUcqeKIWGsRznKo4enBnBERX8AO9oid7k zo7QQf5vQ5BeiWfjDVJ911SKi12n0uWYUrRAWzGInuXDoazThKxqqAx0Hmleeh0CXQuP jaoen4M8ZkJS3rQW3Afk9wlgBizqBKaXUqd1tGSz/E79SpxUaBFt3FPXkjatkIgnP3Kb rW4t9tU3jcmiiqNra4U3d4ilxWhXnwMf0rcgkAAGoqk7cMdirZYVbG/m9FxnSsMqS3qn Fgkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m32-v6si5822447pld.125.2018.02.25.15.55.47; Sun, 25 Feb 2018 15:56:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752036AbeBYXy7 (ORCPT + 99 others); Sun, 25 Feb 2018 18:54:59 -0500 Received: from mxf98a.netcup.net ([46.38.249.138]:39442 "EHLO mxf98a.netcup.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751989AbeBYXyx (ORCPT ); Sun, 25 Feb 2018 18:54:53 -0500 Received: from buildbert.robertabel.eu (x4d076501.dyn.telefonica.de [77.7.101.1]) by mxf98a.netcup.net (Postfix) with ESMTPSA id 3AE2C1409D6; Mon, 26 Feb 2018 00:54:52 +0100 (CET) Authentication-Results: mxf98a; spf=pass (sender IP is 77.7.101.1) smtp.mailfrom=rabel@robertabel.eu smtp.helo=buildbert.robertabel.eu Received-SPF: pass (mxf98a: connection is authenticated) From: Robert Abel To: linux-kernel Cc: Robert Abel , Miguel Ojeda , Willy Tarreau , Geert Uytterhoeven , Andy Shevchenko Subject: [PATCH 4/4] auxdisplay: charlcd: make home command unshift display Date: Mon, 26 Feb 2018 00:54:32 +0100 Message-Id: <20180225235432.31209-5-rabel@robertabel.eu> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180225235432.31209-4-rabel@robertabel.eu> References: <9ec3c54c-f8fe-22d7-783e-8cf9862405bb@robertabel.eu> <20180225235432.31209-1-rabel@robertabel.eu> <20180225235432.31209-2-rabel@robertabel.eu> <20180225235432.31209-3-rabel@robertabel.eu> <20180225235432.31209-4-rabel@robertabel.eu> X-PPP-Message-ID: <20180225235452.31440.86093@mxf98a.netcup.net> X-PPP-Vhost: robertabel.eu Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A user has no way of unshifting the display programmatically once shifted. Users cannot rely on ^[[H (home) to result in their message being seen either. Use the actual HOME command 0x02 instead of only returning to x0/y0. Users can still do ^[[Lx0y0; (go to x/y) if they wish to use the 'old' home function. Implement fast clearing of LCD by going to x0/y0 first, clearing display and then calling home to possibly unshift display possibly avoiding artifacts by not unshifting before clearing display. Signed-off-by: Robert Abel --- drivers/auxdisplay/charlcd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c index 24cabe88c7f0..41f9aa4a73d4 100644 --- a/drivers/auxdisplay/charlcd.c +++ b/drivers/auxdisplay/charlcd.c @@ -43,6 +43,8 @@ /* LCD commands */ #define LCD_CMD_DISPLAY_CLEAR 0x01 /* Clear entire display */ +#define LCD_CMD_HOME 0x02 /* Set DDRAM address to 0 and unshift display */ + #define LCD_CMD_ENTRY_MODE 0x04 /* Set entry mode */ #define LCD_CMD_CURSOR_INC 0x02 /* Increment cursor */ @@ -182,7 +184,8 @@ static void charlcd_home(struct charlcd *lcd) priv->addr.x = 0; priv->addr.y = 0; - charlcd_gotoxy(lcd); + lcd->ops->write_cmd(lcd, LCD_CMD_HOME); + long_sleep(2); } static void charlcd_print(struct charlcd *lcd, char c) @@ -202,9 +205,12 @@ static void charlcd_print(struct charlcd *lcd, char c) static void charlcd_clear_fast(struct charlcd *lcd) { + struct charlcd_priv *priv = to_priv(lcd); int pos; - charlcd_home(lcd); + priv->addr.x = 0; + priv->addr.y = 0; + charlcd_gotoxy(lcd); if (lcd->ops->clear_fast) lcd->ops->clear_fast(lcd); -- 2.11.0