devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 12/13] dt-bindings: auxdisplay: Add bindings for Hitachi HD44780
       [not found] <1486391895-9554-1-git-send-email-geert@linux-m68k.org>
@ 2017-02-06 14:38 ` Geert Uytterhoeven
       [not found]   ` <1486391895-9554-13-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
  2017-02-06 14:38 ` [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support Geert Uytterhoeven
  1 sibling, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-02-06 14:38 UTC (permalink / raw)
  To: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann
  Cc: linux-kernel, Geert Uytterhoeven, Rob Herring, Mark Rutland,
	devicetree

Add DT bindings for an Hitachi HD44780 Character LCD Controller where
its M6800 bus interface is connected to GPIOs.

Memory-mapped configurations are not yet supported.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
---
 .../devicetree/bindings/auxdisplay/hit,hd44780.txt | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt

diff --git a/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
new file mode 100644
index 0000000000000000..ee4054da458d412f
--- /dev/null
+++ b/Documentation/devicetree/bindings/auxdisplay/hit,hd44780.txt
@@ -0,0 +1,44 @@
+DT bindings for the Hitachi HD44780 Character LCD Controller
+
+The Hitachi HD44780 Character LCD Controller is commonly used on character LCDs
+that can display one or more lines of text. It exposes an M6800 bus interface,
+which can be used in either 4-bit or 8-bit mode.
+
+Required properties:
+  - compatible: Must contain "hit,hd44780",
+  - data-gpios: Must contain an array of either 4 or 8 GPIO specifiers,
+    referring to the GPIO pins connected to the data signal lines DB0-DB7
+    (8-bit mode) or DB4-DB7 (4-bit mode) of the LCD Controller's bus interface,
+  - enable-gpios: Must contain a GPIO specifier, referring to the GPIO pin
+    connected to the "E" (Enable) signal line of the LCD Controller's bus
+    interface,
+  - rs-gpios: Must contain a GPIO specifier, referring to the GPIO pin
+    connected to the "RS" (Register Select) signal line of the LCD Controller's
+    bus interface,
+  - display-height: Height of the display, in character cells,
+  - display-width: Width of the display, in character cells.
+
+Optional properties:
+  - rw-gpios: Must contain a GPIO specifier, referring to the GPIO pin
+    connected to the "RW" (Read/Write) signal line of the LCD Controller's bus
+    interface,
+  - backlight-gpios: Must contain a GPIO specifier, referring to the GPIO pin
+    used for enabling the LCD's backlight,
+  - internal-buffer-width: Internal buffer width (default is 40 for displays
+    with 1 or 2 lines, and display-width for displays with more than 2 lines).
+
+Example:
+
+	auxdisplay {
+		compatible = "hit,hd44780";
+
+		data-gpios = <&hc595 0 GPIO_ACTIVE_HIGH>,
+			     <&hc595 1 GPIO_ACTIVE_HIGH>,
+			     <&hc595 2 GPIO_ACTIVE_HIGH>,
+			     <&hc595 3 GPIO_ACTIVE_HIGH>;
+		enable-gpios = <&hc595 4 GPIO_ACTIVE_HIGH>;
+		rs-gpios = <&hc595 5 GPIO_ACTIVE_HIGH>;
+
+		display-height = <2>;
+		display-width = <16>;
+	};
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support
       [not found] <1486391895-9554-1-git-send-email-geert@linux-m68k.org>
  2017-02-06 14:38 ` [PATCH 12/13] dt-bindings: auxdisplay: Add bindings for Hitachi HD44780 Geert Uytterhoeven
@ 2017-02-06 14:38 ` Geert Uytterhoeven
  2017-02-07 11:23   ` Andy Shevchenko
  1 sibling, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-02-06 14:38 UTC (permalink / raw)
  To: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann
  Cc: linux-kernel, Geert Uytterhoeven, Rob Herring, Mark Rutland,
	devicetree

The Hitachi HD44780 Character LCD Controller is commonly used on
character LCDs that can display one or more lines of text.

This driver supports character LCDs connected to GPIOs, using either a
4-bit or 8-bit data bus, and provides access through the charlcd core
and /dev/lcd.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
---
 drivers/auxdisplay/Kconfig   |  11 ++
 drivers/auxdisplay/Makefile  |   1 +
 drivers/auxdisplay/hd44780.c | 326 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 338 insertions(+)
 create mode 100644 drivers/auxdisplay/hd44780.c

diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index b4686380d4e3cca9..2964128b6046882d 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -18,6 +18,17 @@ config CHARLCD
 
 if AUXDISPLAY
 
+config HD44780
+	tristate "HD44780 Character LCD support"
+	depends on OF
+	select CHARLCD
+	---help---
+	  Enable support for Character LCDs using a HD44780 controller.
+	  The LCD is accessible through the /dev/lcd char device (10, 156).
+	  This code can either be compiled as a module, or linked into the
+	  kernel and started at boot.
+	  If you don't understand what all this is about, say N.
+
 config KS0108
 	tristate "KS0108 LCD Controller"
 	depends on PARPORT_PC
diff --git a/drivers/auxdisplay/Makefile b/drivers/auxdisplay/Makefile
index f56f45dcc78e332e..fcefa686be0fea9b 100644
--- a/drivers/auxdisplay/Makefile
+++ b/drivers/auxdisplay/Makefile
@@ -6,4 +6,5 @@ obj-$(CONFIG_CHARLCD)		+= charlcd.o
 obj-$(CONFIG_KS0108)		+= ks0108.o
 obj-$(CONFIG_CFAG12864B)	+= cfag12864b.o cfag12864bfb.o
 obj-$(CONFIG_IMG_ASCII_LCD)	+= img-ascii-lcd.o
+obj-$(CONFIG_HD44780)		+= hd44780.o
 obj-$(CONFIG_HT16K33)		+= ht16k33.o
diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c
new file mode 100644
index 0000000000000000..36aa5942d9374f88
--- /dev/null
+++ b/drivers/auxdisplay/hd44780.c
@@ -0,0 +1,326 @@
+/*
+ * HD44780 Character LCD driver for Linux
+ *
+ * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
+ * Copyright (C) 2016-2017 Glider bvba
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#include <misc/charlcd.h>
+
+
+enum hd44780_pin {
+	/* Order does matter due to writing to GPIO array subsets! */
+	PIN_DATA0,	/* Optional */
+	PIN_DATA1,	/* Optional */
+	PIN_DATA2,	/* Optional */
+	PIN_DATA3,	/* Optional */
+	PIN_DATA4,
+	PIN_DATA5,
+	PIN_DATA6,
+	PIN_DATA7,
+	PIN_CTRL_RS,
+	PIN_CTRL_RW,	/* Optional */
+	PIN_CTRL_E,
+	PIN_CTRL_BL,   /* Optional */
+	PIN_NUM
+};
+
+struct hd44780 {
+	struct gpio_desc *pins[PIN_NUM];
+};
+
+static void hd44780_backlight(struct charlcd *lcd, int on)
+{
+	struct hd44780 *hd = lcd->drvdata;
+
+	if (hd->pins[PIN_CTRL_BL])
+		gpiod_set_value_cansleep(hd->pins[PIN_CTRL_BL], on);
+}
+
+static void hd44780_strobe_gpio(struct hd44780 *hd)
+{
+	/* Maintain the data during 20 us before the strobe */
+	udelay(20);
+
+	gpiod_set_value_cansleep(hd->pins[PIN_CTRL_E], 1);
+
+	/* Maintain the strobe during 40 us */
+	udelay(40);
+
+	gpiod_set_value_cansleep(hd->pins[PIN_CTRL_E], 0);
+}
+
+/* write to an LCD panel register in 8 bit GPIO mode */
+static void hd44780_write_gpio8(struct hd44780 *hd, u8 val, unsigned int rs)
+{
+	int values[10];	/* for DATA[0-7], RS, RW */
+	unsigned int i, n;
+
+	for (i = 0; i < 8; i++)
+		values[PIN_DATA0 + i] = !!(val & BIT(i));
+	values[PIN_CTRL_RS] = rs;
+	n = 9;
+	if (hd->pins[PIN_CTRL_RW]) {
+		values[PIN_CTRL_RW] = 0;
+		n++;
+	}
+
+	/* Present the data to the port */
+	gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA0], values);
+
+	hd44780_strobe_gpio(hd);
+}
+
+/* write to an LCD panel register in 4 bit GPIO mode */
+static void hd44780_write_gpio4(struct hd44780 *hd, u8 val, unsigned int rs)
+{
+	int values[10];	/* for DATA[0-7], RS, RW, but DATA[0-3] is unused */
+	unsigned int i, n;
+
+	/* High nibble + RS, RW */
+	for (i = 4; i < 8; i++)
+		values[PIN_DATA0 + i] = !!(val & BIT(i));
+	values[PIN_CTRL_RS] = rs;
+	n = 5;
+	if (hd->pins[PIN_CTRL_RW]) {
+		values[PIN_CTRL_RW] = 0;
+		n++;
+	}
+
+	/* Present the data to the port */
+	gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4],
+				       &values[PIN_DATA4]);
+
+	hd44780_strobe_gpio(hd);
+
+	/* Low nibble */
+	for (i = 0; i < 4; i++)
+		values[PIN_DATA4 + i] = !!(val & BIT(i));
+
+	/* Present the data to the port */
+	gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4],
+				       &values[PIN_DATA4]);
+
+	hd44780_strobe_gpio(hd);
+}
+
+/* Send a command to the LCD panel in 8 bit GPIO mode */
+static void hd44780_write_cmd_gpio8(struct charlcd *lcd, int cmd)
+{
+	struct hd44780 *hd = lcd->drvdata;
+
+	hd44780_write_gpio8(hd, cmd, 0);
+
+	/* The shortest command takes at least 120 us */
+	udelay(120);
+}
+
+/* Send data to the LCD panel in 8 bit GPIO mode */
+static void hd44780_write_data_gpio8(struct charlcd *lcd, int data)
+{
+	struct hd44780 *hd = lcd->drvdata;
+
+	hd44780_write_gpio8(hd, data, 1);
+
+	/* The shortest data takes at least 45 us */
+	udelay(45);
+}
+
+static const struct charlcd_ops hd44780_ops_gpio8 = {
+	.write_cmd	= hd44780_write_cmd_gpio8,
+	.write_data	= hd44780_write_data_gpio8,
+	.backlight	= hd44780_backlight,
+};
+
+/* Send a command to the LCD panel in 4 bit GPIO mode */
+static void hd44780_write_cmd_gpio4(struct charlcd *lcd, int cmd)
+{
+	struct hd44780 *hd = lcd->drvdata;
+
+	hd44780_write_gpio4(hd, cmd, 0);
+
+	/* The shortest command takes at least 120 us */
+	udelay(120);
+}
+
+/* Send 4-bits of a command to the LCD panel in raw 4 bit GPIO mode */
+static void hd44780_write_cmd_raw_gpio4(struct charlcd *lcd, int cmd)
+{
+	int values[10];	/* for DATA[0-7], RS, RW, but DATA[0-3] is unused */
+	struct hd44780 *hd = lcd->drvdata;
+	unsigned int i, n;
+
+	/* Command nibble + RS, RW */
+	for (i = 0; i < 4; i++)
+		values[PIN_DATA4 + i] = !!(cmd & BIT(i));
+	values[PIN_CTRL_RS] = 0;
+	n = 5;
+	if (hd->pins[PIN_CTRL_RW]) {
+		values[PIN_CTRL_RW] = 0;
+		n++;
+	}
+
+	/* Present the data to the port */
+	gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4],
+				       &values[PIN_DATA4]);
+
+	hd44780_strobe_gpio(hd);
+}
+
+/* Send data to the LCD panel in 4 bit GPIO mode */
+static void hd44780_write_data_gpio4(struct charlcd *lcd, int data)
+{
+	struct hd44780 *hd = lcd->drvdata;
+
+	hd44780_write_gpio4(hd, data, 1);
+
+	/* The shortest data takes at least 45 us */
+	udelay(45);
+}
+
+static const struct charlcd_ops hd44780_ops_gpio4 = {
+	.write_cmd	= hd44780_write_cmd_gpio4,
+	.write_cmd_raw4	= hd44780_write_cmd_raw_gpio4,
+	.write_data	= hd44780_write_data_gpio4,
+	.backlight	= hd44780_backlight,
+};
+
+static int hd44780_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	unsigned int i, base;
+	struct charlcd *lcd;
+	struct hd44780 *hd;
+	int ifwidth, ret;
+
+	/* Required pins */
+	ifwidth = of_gpio_named_count(np, "data-gpios");
+	if (ifwidth < 0)
+		return ifwidth;
+
+	switch (ifwidth) {
+	case 4:
+		base = PIN_DATA4;
+		break;
+	case 8:
+		base = PIN_DATA0;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	lcd = charlcd_alloc(sizeof(struct hd44780));
+	if (!lcd)
+		return -ENOMEM;
+
+	hd = lcd->drvdata;
+
+	for (i = 0; i < ifwidth; i++) {
+		hd->pins[base + i] = devm_gpiod_get_index(dev, "data", i,
+							  GPIOD_OUT_LOW);
+		if (IS_ERR(hd->pins[base + i])) {
+			ret = PTR_ERR(hd->pins[base + i]);
+			goto fail;
+		}
+	}
+
+	hd->pins[PIN_CTRL_E] = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+	if (IS_ERR(hd->pins[PIN_CTRL_E])) {
+		ret = PTR_ERR(hd->pins[PIN_CTRL_E]);
+		goto fail;
+	}
+
+	hd->pins[PIN_CTRL_RS] = devm_gpiod_get(dev, "rs", GPIOD_OUT_HIGH);
+	if (IS_ERR(hd->pins[PIN_CTRL_RS])) {
+		ret = PTR_ERR(hd->pins[PIN_CTRL_RS]);
+		goto fail;
+	}
+
+	/* Optional pins */
+	hd->pins[PIN_CTRL_RW] = devm_gpiod_get_optional(dev, "rw",
+							GPIOD_OUT_LOW);
+	if (IS_ERR(hd->pins[PIN_CTRL_RW])) {
+		ret = PTR_ERR(hd->pins[PIN_CTRL_RW]);
+		goto fail;
+	}
+
+	hd->pins[PIN_CTRL_BL] = devm_gpiod_get_optional(dev, "backlight",
+							GPIOD_OUT_LOW);
+	if (IS_ERR(hd->pins[PIN_CTRL_BL])) {
+		ret = PTR_ERR(hd->pins[PIN_CTRL_BL]);
+		goto fail;
+	}
+
+	/* Required properties */
+	ret = of_property_read_u32(np, "display-height", &lcd->height);
+	if (ret)
+		goto fail;
+	ret = of_property_read_u32(np, "display-width", &lcd->width);
+	if (ret)
+		goto fail;
+
+	/*
+	 * On displays with more than two rows, the internal buffer width is
+	 * usually equal to the display width
+	 */
+	if (lcd->height > 2)
+		lcd->bwidth = lcd->width;
+
+	/* Optional properties */
+	of_property_read_u32(np, "internal-buffer-width", &lcd->bwidth);
+
+	lcd->ifwidth = ifwidth;
+	lcd->ops = ifwidth == 8 ? &hd44780_ops_gpio8 : &hd44780_ops_gpio4;
+
+	ret = charlcd_register(lcd);
+	if (ret)
+		goto fail;
+
+	platform_set_drvdata(pdev, lcd);
+	return 0;
+
+fail:
+	kfree(lcd);
+	return ret;
+}
+
+static int hd44780_remove(struct platform_device *pdev)
+{
+	struct charlcd *lcd = platform_get_drvdata(pdev);
+
+	charlcd_unregister(lcd);
+	return 0;
+}
+
+static const struct of_device_id hd44780_of_match[] = {
+	{ .compatible = "hit,hd44780" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, hd44780_of_match);
+
+static struct platform_driver hd44780_driver = {
+	.probe = hd44780_probe,
+	.remove = hd44780_remove,
+	.driver		= {
+		.name	= "hd44780",
+		.of_match_table = hd44780_of_match,
+	},
+};
+
+module_platform_driver(hd44780_driver);
+MODULE_DESCRIPTION("HD44780 Character LCD driver");
+MODULE_AUTHOR("Geert Uytterhoeven <geert@linux-m68k.org>");
+MODULE_LICENSE("GPL");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support
  2017-02-06 14:38 ` [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support Geert Uytterhoeven
@ 2017-02-07 11:23   ` Andy Shevchenko
       [not found]     ` <CAHp75VcvkcO-6N59fMtr8xRogQxhicifTMaNVipmTccj078Baw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2017-02-07 11:23 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann, linux-kernel@vger.kernel.org,
	Rob Herring, Mark Rutland, devicetree

On Mon, Feb 6, 2017 at 4:38 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> The Hitachi HD44780 Character LCD Controller is commonly used on
> character LCDs that can display one or more lines of text.
>
> This driver supports character LCDs connected to GPIOs, using either a
> 4-bit or 8-bit data bus, and provides access through the charlcd core
> and /dev/lcd.

Can we not limit this to OF? I can easily imagine use case with
x86/ACPI enabled platform.

On the first glance of_property-* -> device_property_* is enough.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support
       [not found]     ` <CAHp75VcvkcO-6N59fMtr8xRogQxhicifTMaNVipmTccj078Baw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-02-08 13:18       ` Geert Uytterhoeven
  2017-02-08 13:38         ` Andy Shevchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-02-08 13:18 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
	Mark Rutland, devicetree

Hi Andy,

On Tue, Feb 7, 2017 at 12:23 PM, Andy Shevchenko
<andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Mon, Feb 6, 2017 at 4:38 PM, Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> wrote:
>> The Hitachi HD44780 Character LCD Controller is commonly used on
>> character LCDs that can display one or more lines of text.
>>
>> This driver supports character LCDs connected to GPIOs, using either a
>> 4-bit or 8-bit data bus, and provides access through the charlcd core
>> and /dev/lcd.
>
> Can we not limit this to OF? I can easily imagine use case with
> x86/ACPI enabled platform.

Sure!

> On the first glance of_property-* -> device_property_* is enough.

And of_gpio_named_count() -> gpiod_count().

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support
  2017-02-08 13:18       ` Geert Uytterhoeven
@ 2017-02-08 13:38         ` Andy Shevchenko
  2017-02-08 13:41           ` Geert Uytterhoeven
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2017-02-08 13:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
	Mark Rutland, devicetree

On Wed, Feb 8, 2017 at 3:18 PM, Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> wrote:
> Hi Andy,
>
> On Tue, Feb 7, 2017 at 12:23 PM, Andy Shevchenko
> <andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> On Mon, Feb 6, 2017 at 4:38 PM, Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> wrote:
>>> The Hitachi HD44780 Character LCD Controller is commonly used on
>>> character LCDs that can display one or more lines of text.
>>>
>>> This driver supports character LCDs connected to GPIOs, using either a
>>> 4-bit or 8-bit data bus, and provides access through the charlcd core
>>> and /dev/lcd.
>>
>> Can we not limit this to OF? I can easily imagine use case with
>> x86/ACPI enabled platform.
>
> Sure!
>
>> On the first glance of_property-* -> device_property_* is enough.
>
> And of_gpio_named_count() -> gpiod_count().

Indeed.

Btw, have you any plans to make an order among spreaded LCD drivers in
kernel? Perhaps we may gather them under auxdisplay hood?

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support
  2017-02-08 13:38         ` Andy Shevchenko
@ 2017-02-08 13:41           ` Geert Uytterhoeven
       [not found]             ` <CAMuHMdWpW77eJmuuDzyXqZZ9HcwsxPdhsR6GNR3NL91rZyoVPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-02-08 13:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann, linux-kernel@vger.kernel.org,
	Rob Herring, Mark Rutland, devicetree

Hi Andy,

On Wed, Feb 8, 2017 at 2:38 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> Btw, have you any plans to make an order among spreaded LCD drivers in
> kernel? Perhaps we may gather them under auxdisplay hood?

I have no such plan. I just had a long-standing personal interest in hd44780.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support
       [not found]             ` <CAMuHMdWpW77eJmuuDzyXqZZ9HcwsxPdhsR6GNR3NL91rZyoVPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-02-08 16:27               ` Andy Shevchenko
       [not found]                 ` <CAHp75Vfy=GsHurE0G=BO6cxuT7qwc+zYAXGep7mrH==KXsJaEw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2017-02-08 16:27 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
	Mark Rutland, devicetree

On Wed, Feb 8, 2017 at 3:41 PM, Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> wrote:
> On Wed, Feb 8, 2017 at 2:38 PM, Andy Shevchenko
> <andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Btw, have you any plans to make an order among spreaded LCD drivers in
>> kernel? Perhaps we may gather them under auxdisplay hood?
>
> I have no such plan. I just had a long-standing personal interest in hd44780.

I have one too regarding to I2C/SPI interfaced hardware.
If you remember it was an attempt for lcd-linux to be upstreamed,
which provides (besides i2c/spi bus drivers) those LCDs as tty
devices.
Also interesting feature to have.

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support
       [not found]                 ` <CAHp75Vfy=GsHurE0G=BO6cxuT7qwc+zYAXGep7mrH==KXsJaEw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-02-08 17:19                   ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-02-08 17:19 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
	Mark Rutland, devicetree

Hi Andy,

On Wed, Feb 8, 2017 at 5:27 PM, Andy Shevchenko
<andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Wed, Feb 8, 2017 at 3:41 PM, Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> wrote:
>> On Wed, Feb 8, 2017 at 2:38 PM, Andy Shevchenko
>> <andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>> Btw, have you any plans to make an order among spreaded LCD drivers in
>>> kernel? Perhaps we may gather them under auxdisplay hood?
>>
>> I have no such plan. I just had a long-standing personal interest in hd44780.
>
> I have one too regarding to I2C/SPI interfaced hardware.
> If you remember it was an attempt for lcd-linux to be upstreamed,
> which provides (besides i2c/spi bus drivers) those LCDs as tty
> devices.
> Also interesting feature to have.

I'm actually driving mine from SPI, using a 74HCT595 shift register and
the 74x164 GPIO driver.  Should work with i2c and a PCF8574 GPIO
expander too, except that my SoC has 3.3V I/Os, while my display
needs 5V, which is taken care of by the HCT shift register.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 12/13] dt-bindings: auxdisplay: Add bindings for Hitachi HD44780
       [not found]   ` <1486391895-9554-13-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
@ 2017-02-09  1:11     ` Rob Herring
  2017-02-09  8:51       ` Geert Uytterhoeven
  0 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2017-02-09  1:11 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Rutland,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Mon, Feb 06, 2017 at 03:38:14PM +0100, Geert Uytterhoeven wrote:
> Add DT bindings for an Hitachi HD44780 Character LCD Controller where
> its M6800 bus interface is connected to GPIOs.

Really, you should have a bit-bang M6800 bus driver and binding and then 
the binding for the LCD ctrl looks the same whether you are bit-banging 
it or not.

That's a bit more work though. Maybe you could split the binding like 
this, but keep a monolithic driver for now. The driver can just fetch 
the GPIOs from the parent (bus controller) node. And you'd have to work 
out probing the driver.

> Memory-mapped configurations are not yet supported.

I guess this would require faulting on some address and then bit-banging 
the access. That sounds fun...

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 12/13] dt-bindings: auxdisplay: Add bindings for Hitachi HD44780
  2017-02-09  1:11     ` Rob Herring
@ 2017-02-09  8:51       ` Geert Uytterhoeven
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Uytterhoeven @ 2017-02-09  8:51 UTC (permalink / raw)
  To: Rob Herring
  Cc: Miguel Ojeda Sandonis, Greg Kroah-Hartman, Willy Tarreau,
	Ksenija Stanojevic, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Hi Rob,

On Thu, Feb 9, 2017 at 2:11 AM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Mon, Feb 06, 2017 at 03:38:14PM +0100, Geert Uytterhoeven wrote:
>> Add DT bindings for an Hitachi HD44780 Character LCD Controller where
>> its M6800 bus interface is connected to GPIOs.
>
> Really, you should have a bit-bang M6800 bus driver and binding and then
> the binding for the LCD ctrl looks the same whether you are bit-banging
> it or not.

I thought about that, but turned it down due to the required complexity
for the little gain. And I think it would complicate memory mapped
configurations (see below), which would have to use regmap instead of readb()
and friends.

> That's a bit more work though. Maybe you could split the binding like
> this, but keep a monolithic driver for now. The driver can just fetch
> the GPIOs from the parent (bus controller) node. And you'd have to work
> out probing the driver.

Ugh...

>> Memory-mapped configurations are not yet supported.
>
> I guess this would require faulting on some address and then bit-banging
> the access. That sounds fun...

I meant connecting it to the processor bus instead of GPIOs, so the HD44780
registers become memory mapped.
That can be handled fairly easily by allowing a "reg" property as an
alternative to the data/enable/rw-gpios.

The only complication is that the M6800 bus has a single strobe (enable)
signal, and requires the rw signal to be valid before, while e.g. Intel CPUs
have separate read and write strobes. Usually people handle that by wiring\
rw to an address line, and thus using separate addresses for read and write.

I didn't add support for memory-mapped configurations as I can't test it
(without more hardware hacking ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-02-09  8:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1486391895-9554-1-git-send-email-geert@linux-m68k.org>
2017-02-06 14:38 ` [PATCH 12/13] dt-bindings: auxdisplay: Add bindings for Hitachi HD44780 Geert Uytterhoeven
     [not found]   ` <1486391895-9554-13-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2017-02-09  1:11     ` Rob Herring
2017-02-09  8:51       ` Geert Uytterhoeven
2017-02-06 14:38 ` [PATCH 13/13] auxdisplay: Add HD44780 Character LCD support Geert Uytterhoeven
2017-02-07 11:23   ` Andy Shevchenko
     [not found]     ` <CAHp75VcvkcO-6N59fMtr8xRogQxhicifTMaNVipmTccj078Baw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-08 13:18       ` Geert Uytterhoeven
2017-02-08 13:38         ` Andy Shevchenko
2017-02-08 13:41           ` Geert Uytterhoeven
     [not found]             ` <CAMuHMdWpW77eJmuuDzyXqZZ9HcwsxPdhsR6GNR3NL91rZyoVPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-08 16:27               ` Andy Shevchenko
     [not found]                 ` <CAHp75Vfy=GsHurE0G=BO6cxuT7qwc+zYAXGep7mrH==KXsJaEw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-08 17:19                   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).