Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3249678pxk; Mon, 5 Oct 2020 05:15:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1J6kW3x3MZwcPiWCrlxCT81kV6LLeCg/XvjCYHuetDtATxwYW2CB8oVQVspZpVk1koUQt X-Received: by 2002:a17:906:ce5c:: with SMTP id se28mr9306900ejb.365.1601900158108; Mon, 05 Oct 2020 05:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601900158; cv=none; d=google.com; s=arc-20160816; b=f4OxiqEzzlvbT60w/M3vx4nJ4hOR2ZPDj086OPXeD6kciY7o5oiTBbzUbOO9ak67Md VdgTv9+l7rT/y641cednHOzCr7sVsM+BcegIVWr0Wk+7fa8wV8FnypUcY6pnGgFjLXgO tbUP0Va2d3PPlDb9aYJBUSJjYTMd8mt8XL0rRA+8FF6IkIYiVidRuTPAPceSoOWlHdT3 zf3wbPTHE6FvnsmjCp0/By58QzAOlIeVP/fTJGwaod8cahzrh8nHswexxKT/ePxBjL+A SEcpye4Owl760vLfdJhF0cdLtrtxSw98LG8eY6dCnuXqRxkZAkYQB1vPZEWs5zsSg4lx xsJg== 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=ddZee25XUZoRxv0CewTY4kHXslqmgTznA+ugyttDQa0=; b=l4w7d3OHe5RhmInMjvo4a/WGq1isernj1vP/oCFkS4WteqJjfc/OskdCubn9ujoxi3 Lz80NP3YgcidmqQUNXV8kVju5wZ97dBD6Y/X4Y9jy8EQVkPFecc7PGoUBgeEY/5ryQam JjHtIhZTnDVVpC4SH4OTG3AWTAPvsbUZy7caVwXxFTnUzcHn9ASIB5EFxbB5f7Elyjdd FjNVrI+Gg2zdKjIoVSt1l2wm1ohBVSuDBM6Q2cVA6Wb+/Dpfh/CneSy72cpUq9ND2YmQ 4zVUdy6sB7e9ZlPr9f8dly97pUsFn9p5zujDpZtF6AcBsGUYqZ+BAJvSE00P2mhi4871 hu+g== 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 s23si6943787edc.373.2020.10.05.05.15.35; Mon, 05 Oct 2020 05:15:58 -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 S1726721AbgJEMNv (ORCPT + 99 others); Mon, 5 Oct 2020 08:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbgJEMMe (ORCPT ); Mon, 5 Oct 2020 08:12:34 -0400 Received: from smtp2-2.goneo.de (smtp2.goneo.de [IPv6:2001:1640:5::8:33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CD20C0613CE for ; Mon, 5 Oct 2020 05:12:33 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.goneo.de (Postfix) with ESMTP id BA66C241CBD; Mon, 5 Oct 2020 14:12:32 +0200 (CEST) X-Virus-Scanned: by goneo X-Spam-Flag: NO X-Spam-Score: -2.986 X-Spam-Level: X-Spam-Status: No, score=-2.986 tagged_above=-999 tests=[ALL_TRUSTED=-1, AWL=-0.086, BAYES_00=-1.9] autolearn=ham Received: from smtp2.goneo.de ([127.0.0.1]) by localhost (smtp2.goneo.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Te-IrZJmFag2; Mon, 5 Oct 2020 14:12:31 +0200 (CEST) Received: from lem-wkst-02.lemonage.de. (hq.lemonage.de [87.138.178.34]) by smtp2.goneo.de (Postfix) with ESMTPA id 14D15241C0F; Mon, 5 Oct 2020 14:12:31 +0200 (CEST) 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 v3 19/32] auxdisplay: Implement hd44780_common_blink Date: Mon, 5 Oct 2020 14:11:47 +0200 Message-Id: <20201005121200.3427363-20-poeschel@lemonage.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005121200.3427363-1-poeschel@lemonage.de> References: <20201005121200.3427363-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 Implement a hd44780_common_blink function to turn on or off the blinking of the cursor. The hd44780 drivers just use this function and charlcd calls it through its ops function pointer. Reviewed-by: Willy Tarreau Signed-off-by: Lars Poeschel --- drivers/auxdisplay/charlcd.c | 6 ++++++ drivers/auxdisplay/charlcd.h | 2 ++ drivers/auxdisplay/hd44780.c | 2 ++ drivers/auxdisplay/hd44780_common.c | 14 ++++++++++++++ drivers/auxdisplay/hd44780_common.h | 1 + drivers/auxdisplay/panel.c | 3 +++ 6 files changed, 28 insertions(+) diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c index a2f0becb1a9f..b099897e101b 100644 --- a/drivers/auxdisplay/charlcd.c +++ b/drivers/auxdisplay/charlcd.c @@ -260,10 +260,16 @@ static inline int handle_lcd_special_code(struct charlcd *lcd) break; case 'B': /* Blink ON */ priv->flags |= LCD_FLAG_B; + if (priv->flags != oldflags) + lcd->ops->blink(lcd, CHARLCD_ON); + processed = 1; break; case 'b': /* Blink OFF */ priv->flags &= ~LCD_FLAG_B; + if (priv->flags != oldflags) + lcd->ops->blink(lcd, CHARLCD_OFF); + processed = 1; break; case '+': /* Back light ON */ diff --git a/drivers/auxdisplay/charlcd.h b/drivers/auxdisplay/charlcd.h index 5aab359ebd91..d9d907db2724 100644 --- a/drivers/auxdisplay/charlcd.h +++ b/drivers/auxdisplay/charlcd.h @@ -62,6 +62,7 @@ struct charlcd { * @shift_display: Shift whole display content left or right. * @display: Turn display on or off. * @cursor: Turn cursor on or off. + * @blink: Turn cursor blink on or off. */ struct charlcd_ops { void (*clear_fast)(struct charlcd *lcd); @@ -75,6 +76,7 @@ struct charlcd_ops { int (*shift_display)(struct charlcd *lcd, enum charlcd_shift_dir dir); int (*display)(struct charlcd *lcd, enum charlcd_onoff on); int (*cursor)(struct charlcd *lcd, enum charlcd_onoff on); + int (*blink)(struct charlcd *lcd, enum charlcd_onoff on); }; void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on); diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c index d5ce3955b577..a8d6e5483a92 100644 --- a/drivers/auxdisplay/hd44780.c +++ b/drivers/auxdisplay/hd44780.c @@ -135,6 +135,7 @@ static const struct charlcd_ops hd44780_ops_gpio8 = { .shift_display = hd44780_common_shift_display, .display = hd44780_common_display, .cursor = hd44780_common_cursor, + .blink = hd44780_common_blink, }; /* Send a command to the LCD panel in 4 bit GPIO mode */ @@ -187,6 +188,7 @@ static const struct charlcd_ops hd44780_ops_gpio4 = { .shift_display = hd44780_common_shift_display, .display = hd44780_common_display, .cursor = hd44780_common_cursor, + .blink = hd44780_common_blink, }; static int hd44780_probe(struct platform_device *pdev) diff --git a/drivers/auxdisplay/hd44780_common.c b/drivers/auxdisplay/hd44780_common.c index 587385e55bae..5c028f157fc8 100644 --- a/drivers/auxdisplay/hd44780_common.c +++ b/drivers/auxdisplay/hd44780_common.c @@ -236,6 +236,20 @@ int hd44780_common_cursor(struct charlcd *lcd, enum charlcd_onoff on) } EXPORT_SYMBOL_GPL(hd44780_common_cursor); +int hd44780_common_blink(struct charlcd *lcd, enum charlcd_onoff on) +{ + struct hd44780_common *hdc = lcd->drvdata; + + if (on == CHARLCD_ON) + hdc->hd44780_common_flags |= LCD_FLAG_B; + else + hdc->hd44780_common_flags &= ~LCD_FLAG_B; + + hd44780_common_set_mode(hdc); + return 0; +} +EXPORT_SYMBOL_GPL(hd44780_common_blink); + 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 7327a9b2e997..b46171f21a05 100644 --- a/drivers/auxdisplay/hd44780_common.h +++ b/drivers/auxdisplay/hd44780_common.h @@ -26,5 +26,6 @@ int hd44780_common_shift_display(struct charlcd *lcd, enum charlcd_shift_dir dir); int hd44780_common_display(struct charlcd *lcd, enum charlcd_onoff on); int hd44780_common_cursor(struct charlcd *lcd, enum charlcd_onoff on); +int hd44780_common_blink(struct charlcd *lcd, enum charlcd_onoff on); struct hd44780_common *hd44780_common_alloc(void); diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c index 26fbf91c1501..2d2f59360e1a 100644 --- a/drivers/auxdisplay/panel.c +++ b/drivers/auxdisplay/panel.c @@ -883,6 +883,7 @@ static const struct charlcd_ops charlcd_serial_ops = { .shift_display = hd44780_common_shift_display, .display = hd44780_common_display, .cursor = hd44780_common_cursor, + .blink = hd44780_common_blink, }; static const struct charlcd_ops charlcd_parallel_ops = { @@ -896,6 +897,7 @@ static const struct charlcd_ops charlcd_parallel_ops = { .shift_display = hd44780_common_shift_display, .display = hd44780_common_display, .cursor = hd44780_common_cursor, + .blink = hd44780_common_blink, }; static const struct charlcd_ops charlcd_tilcd_ops = { @@ -909,6 +911,7 @@ static const struct charlcd_ops charlcd_tilcd_ops = { .shift_display = hd44780_common_shift_display, .display = hd44780_common_display, .cursor = hd44780_common_cursor, + .blink = hd44780_common_blink, }; /* initialize the LCD driver */ -- 2.28.0