Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp301964pxx; Thu, 29 Oct 2020 03:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoVcG8jb6Q8Q2C3061O42qcIIxWyqJq2dbtPmaBuWbBgjdGKihx9dQSZ2WYrbQj7dT6lEd X-Received: by 2002:a50:f0c5:: with SMTP id a5mr3046982edm.91.1603965831922; Thu, 29 Oct 2020 03:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603965831; cv=none; d=google.com; s=arc-20160816; b=Vm1tDm3TS8yA2pL3mAu1pwzi37eGZv11W/Um6uzEoe/vRn/QdVnLjTf6gm1W8B+gob GUdz0GniUiGi/lzVojvQ5g6JDxfkwFw697sm6Xt/3Rt7yFlg64FpH4c1ISFWhEUUZV/z oH/1tZgNOme0LVH1lBabPEfK+zvBTWt75CgoVEQs5OetcN8v0Hpq3pGyDD++uYDTy65H RUNVxDC3rw+WfLFkzlMBQbn7p+HOxZFDNZMIdFgL16Gy0phsVgW9vlgdVo2zsEUeY3iU 18Jx6lLNjLLvMlPWFPGODOe++d2+o6b8GhN1B+aR4pQhltS3QcqaVnfeFNLg0pvmVwLn NrdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/biEg+6do1tuxHzkr9Vtg0aZiU7AwVt33jcbR/a1/EU=; b=yoKFaAruUJIMGtTkjS9+qoD8C2v7yAOFBIhnCBA2WzehmPoPUJzhhVuc8knR5eGrhP X1+mzTwvjthUIIjOflkB9Jlrg/xoGMpoaWut0ykHsbI55iQxSC2tJLs6Ce1q/0CnobIO HjyC7TeZmgo1qicWKCU9Slo6iu+78ypTSnlDd4DItQIZbsdjbopPgwfaoXF9vIR/2skZ RqGgJqbmZQ2+yKMNf2bYn6Z60YeoyhN72JgqJjqmGeMcZBCRQlrw+I+GZOwQz6SZq8Qp 4z4b5IALHmCatsJIUNWX7VItPacSW3lGte2NTkJLwaVggXnqDoXLFAHL6eWBIqVDxD5Q UpmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si1389087ejw.434.2020.10.29.03.03.28; Thu, 29 Oct 2020 03:03:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727521AbgJ2J7b (ORCPT + 99 others); Thu, 29 Oct 2020 05:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726934AbgJ2J6D (ORCPT ); Thu, 29 Oct 2020 05:58:03 -0400 Received: from smtp3-1.goneo.de (smtp3.goneo.de [IPv6:2001:1640:5::8:37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB33CC0613D5 for ; Thu, 29 Oct 2020 02:58:02 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.goneo.de (Postfix) with ESMTP id 9252523F98A; Thu, 29 Oct 2020 10:58:01 +0100 (CET) X-Virus-Scanned: by goneo X-Spam-Flag: NO X-Spam-Score: -2.948 X-Spam-Level: X-Spam-Status: No, score=-2.948 tagged_above=-999 tests=[ALL_TRUSTED=-1, AWL=-0.048, BAYES_00=-1.9] autolearn=ham Received: from smtp3.goneo.de ([127.0.0.1]) by localhost (smtp3.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X3cHYbaLMp8W; Thu, 29 Oct 2020 10:58:00 +0100 (CET) Received: from lem-wkst-02.lemonage.de. (hq.lemonage.de [87.138.178.34]) by smtp3.goneo.de (Postfix) with ESMTPA id C865D23FA1C; Thu, 29 Oct 2020 10:57:59 +0100 (CET) From: poeschel@lemonage.de To: Miguel Ojeda Sandonis , Willy Tarreau , Ksenija Stanojevic , linux-kernel@vger.kernel.org (open list) Cc: Lars Poeschel , Willy Tarreau Subject: [PATCH v5 10/25] auxdisplay: add home to charlcd_ops Date: Thu, 29 Oct 2020 10:57:14 +0100 Message-Id: <20201029095731.311528-9-poeschel@lemonage.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029095731.311528-1-poeschel@lemonage.de> References: <20201029095231.311083-1-poeschel@lemonage.de> <20201029095731.311528-1-poeschel@lemonage.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lars Poeschel This adds a home function to the charlcd_ops struct and offer an implementation for hd44780_common. This implementation is used by our two hd44780 drivers. This is to make charlcd device independent. Reviewed-by: Willy Tarreau Signed-off-by: Lars Poeschel --- drivers/auxdisplay/charlcd.c | 2 +- drivers/auxdisplay/charlcd.h | 3 +++ drivers/auxdisplay/hd44780.c | 2 ++ drivers/auxdisplay/hd44780_common.c | 8 ++++++++ drivers/auxdisplay/hd44780_common.h | 1 + drivers/auxdisplay/panel.c | 3 +++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c index d6f971eea6ae..44dd6e02eaf9 100644 --- a/drivers/auxdisplay/charlcd.c +++ b/drivers/auxdisplay/charlcd.c @@ -144,7 +144,7 @@ static void charlcd_home(struct charlcd *lcd) { lcd->addr.x = 0; lcd->addr.y = 0; - lcd->ops->gotoxy(lcd); + lcd->ops->home(lcd); } static void charlcd_print(struct charlcd *lcd, char c) diff --git a/drivers/auxdisplay/charlcd.h b/drivers/auxdisplay/charlcd.h index f36cc80ce385..236fd0e9e8ab 100644 --- a/drivers/auxdisplay/charlcd.h +++ b/drivers/auxdisplay/charlcd.h @@ -41,12 +41,15 @@ struct charlcd { * wrap to the next line at the end of a line. * @gotoxy: Set cursor to x, y. The x and y values to set the cursor to are * previously set in addr.x and addr.y by charlcd. + * @home: Set cursor to 0, 0. The values in addr.x and addr.y are set to 0, 0 by + * charlcd prior to calling this function. */ struct charlcd_ops { void (*clear_fast)(struct charlcd *lcd); void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on); int (*print)(struct charlcd *lcd, int c); int (*gotoxy)(struct charlcd *lcd); + int (*home)(struct charlcd *lcd); }; struct charlcd *charlcd_alloc(void); diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c index 4d9478f6e5ff..b0893ea49165 100644 --- a/drivers/auxdisplay/hd44780.c +++ b/drivers/auxdisplay/hd44780.c @@ -128,6 +128,7 @@ static const struct charlcd_ops hd44780_ops_gpio8 = { .backlight = hd44780_backlight, .print = hd44780_common_print, .gotoxy = hd44780_common_gotoxy, + .home = hd44780_common_home, }; /* Send a command to the LCD panel in 4 bit GPIO mode */ @@ -173,6 +174,7 @@ static const struct charlcd_ops hd44780_ops_gpio4 = { .backlight = hd44780_backlight, .print = hd44780_common_print, .gotoxy = hd44780_common_gotoxy, + .home = hd44780_common_home, }; static int hd44780_probe(struct platform_device *pdev) diff --git a/drivers/auxdisplay/hd44780_common.c b/drivers/auxdisplay/hd44780_common.c index f86eb2f27cee..ea62beada9d8 100644 --- a/drivers/auxdisplay/hd44780_common.c +++ b/drivers/auxdisplay/hd44780_common.c @@ -41,6 +41,14 @@ int hd44780_common_gotoxy(struct charlcd *lcd) } EXPORT_SYMBOL_GPL(hd44780_common_gotoxy); +int hd44780_common_home(struct charlcd *lcd) +{ + lcd->addr.x = 0; + lcd->addr.y = 0; + return hd44780_common_gotoxy(lcd); +} +EXPORT_SYMBOL_GPL(hd44780_common_home); + struct hd44780_common *hd44780_common_alloc(void) { struct hd44780_common *hd; diff --git a/drivers/auxdisplay/hd44780_common.h b/drivers/auxdisplay/hd44780_common.h index d8cbea4a8658..c91070ed931b 100644 --- a/drivers/auxdisplay/hd44780_common.h +++ b/drivers/auxdisplay/hd44780_common.h @@ -16,4 +16,5 @@ struct hd44780_common { int hd44780_common_print(struct charlcd *lcd, int c); int hd44780_common_gotoxy(struct charlcd *lcd); +int hd44780_common_home(struct charlcd *lcd); struct hd44780_common *hd44780_common_alloc(void); diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c index 75894eacd12f..b1e874f07456 100644 --- a/drivers/auxdisplay/panel.c +++ b/drivers/auxdisplay/panel.c @@ -876,18 +876,21 @@ static const struct charlcd_ops charlcd_serial_ops = { .clear_fast = lcd_clear_fast_s, .backlight = lcd_backlight, .gotoxy = hd44780_common_gotoxy, + .home = hd44780_common_home, }; static const struct charlcd_ops charlcd_parallel_ops = { .clear_fast = lcd_clear_fast_p8, .backlight = lcd_backlight, .gotoxy = hd44780_common_gotoxy, + .home = hd44780_common_home, }; static const struct charlcd_ops charlcd_tilcd_ops = { .clear_fast = lcd_clear_fast_tilcd, .backlight = lcd_backlight, .gotoxy = hd44780_common_gotoxy, + .home = hd44780_common_home, }; /* initialize the LCD driver */ -- 2.28.0