mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: poeschel@lemonage.de
To: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>,
	Willy Tarreau <willy@haproxy.com>,
	Ksenija Stanojevic <ksenija.stanojevic@gmail.com>,
	linux-kernel@vger.kernel.org (open list)
Cc: Lars Poeschel <poeschel@lemonage.de>, Willy Tarreau <w@1wt.eu>
Subject: [PATCH v4 19/32] auxdisplay: Implement hd44780_common_blink
Date: Mon,  5 Oct 2020 15:01:15 +0200	[thread overview]
Message-ID: <20201005130128.3430804-7-poeschel@lemonage.de> (raw)
In-Reply-To: <20201005130128.3430804-1-poeschel@lemonage.de>

From: Lars Poeschel <poeschel@lemonage.de>

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 <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
---
 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


  parent reply	other threads:[~2020-10-05 13:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 13:01 [PATCH v4 13/32] auxdisplay: Make use of enum for backlight on / off poeschel
2020-10-05 13:01 ` [PATCH v4 14/32] auxdisplay: Move init_display to hd44780_common poeschel
2020-10-16  3:16   ` Miguel Ojeda
2020-10-05 13:01 ` [PATCH v4 15/32] auxdisplay: implement hd44780_common_shift_cursor poeschel
2020-10-05 13:01 ` [PATCH v4 16/32] auxdisplay: Implement hd44780_common_display_shift poeschel
2020-10-05 13:01 ` [PATCH v4 17/32] auxdisplay: Implement a hd44780_common_display poeschel
2020-10-05 13:01 ` [PATCH v4 18/32] auxdisplay: Implement hd44780_common_cursor poeschel
2020-10-05 13:01 ` poeschel [this message]
2020-10-05 13:01 ` [PATCH v4 20/32] auxdisplay: cleanup unnecessary hd44780 code in charlcd poeschel
2020-10-05 13:01 ` [PATCH v4 21/32] auxdisplay: Implement hd44780_common_fontsize poeschel
2020-10-05 13:01 ` [PATCH v4 22/32] auxdisplay: Implement hd44780_common_lines poeschel
2020-10-05 13:01 ` [PATCH v4 23/32] auxdisplay: Remove unnecessary hd44780 from charlcd poeschel
2020-10-05 13:01 ` [PATCH v4 24/32] auxdisplay: Move char redefine code to hd44780_common poeschel
2020-10-16  3:19   ` Miguel Ojeda
2020-10-05 13:01 ` [PATCH v4 25/32] auxdisplay: Call charlcd_backlight in place poeschel
2020-10-05 13:01 ` [PATCH v4 26/32] auxdisplay: hd44780_common: Reduce clear_display timeout poeschel
2020-10-05 13:01 ` [PATCH v4 27/32] auxdisplay: hd44780: Remove clear_fast poeschel
2020-10-05 13:01 ` [PATCH v4 28/32] auxdisplay: charlcd: replace last device specific stuff poeschel
2020-10-05 13:01 ` [PATCH v4 29/32] auxdisplay: Change gotoxy calling interface poeschel
2020-10-05 13:01 ` [PATCH v4 30/32] auxdisplay: charlcd: Do not print chars at end of line poeschel
2020-10-05 13:01 ` [PATCH v4 31/32] auxdisplay: lcd2s DT binding doc poeschel
2020-10-06 21:56   ` Rob Herring
2020-10-05 13:01 ` [PATCH v4 32/32] auxdisplay: add a driver for lcd2s character display poeschel
2020-10-16  3:25   ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201005130128.3430804-7-poeschel@lemonage.de \
    --to=poeschel@lemonage.de \
    --cc=ksenija.stanojevic@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=w@1wt.eu \
    --cc=willy@haproxy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®