Skip to contentSkip to conversation

TTY Driver for Newhaven LCD module

PATCH In review Alan Tull 2 participants 6 messages Mar 17, 2015 – Mar 20, 2015

Subsystems (2)
lore
Share & tools
lore

Alan Tull

author
#0 lore raw

cover TTY Driver for Newhaven LCD module

Supports a 2 line by 16 character LCD module over I2C.

Alan Tull (2):
newhaven lcd: device tree bindings documentation add newhaven lcd tty driver on i2c

 .../devicetree/bindings/tty/newhaven_lcd.txt       |   21 +
 drivers/tty/Kconfig                                |    5 +
 drivers/tty/Makefile                               |    1 +
 drivers/tty/newhaven_lcd.c                         |  733 ++++++++++++++++++++
 include/linux/platform_data/newhaven_lcd.h         |   25 +
 5 files changed, 785 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/tty/newhaven_lcd.txt
 create mode 100644 drivers/tty/newhaven_lcd.c
 create mode 100644 include/linux/platform_data/newhaven_lcd.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/2 newhaven lcd: device tree bindings documentation

Add documention for the newhaven lcd device tree bindings.

---
 .../devicetree/bindings/tty/newhaven_lcd.txt       |   21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/tty/newhaven_lcd.txt
Documentation/devicetree/bindings/tty/newhaven_lcd.txt new file +21 -0
new file mode 100644
index 0000000..14b48fc
@@ -0,0 +1,21 @@
+* TTY on a Newhaven NHD‐0216K3Z‐NSW‐BBW LCD connected to I2C
+
+Required properties:
+- compatible: Should be "newhaven,nhd-0216k3z-nsw-bbw"
+- reg: i2c address
+- height: should be 2 lines
+- width: should be 16 characters
+- brightness: backlight brightness. Range is 1 to 8, where
+              1=OFF and 8=maximum brightness.
+
+Example:
+
+&i2c0 {
+	lcd: lcd@28 {
+		compatible = "newhaven,nhd-0216k3z-nsw-bbw";
+		reg = <0x28>;
+		height = <2>;
+		width = <16>;
+		brightness = <8>;
+	};
+
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/2 add newhaven lcd tty driver on i2c

In reply to Alan Tull

Supports the Newhaven NHD‐0216K3Z‐NSW‐BBW 2x16 LCD module as i2c slave. Devices will show up as /dev/ttyLCD0, etc.

* Backspace is supported to the beginning of the current line.
* i.e. printf '\b' > /dev/ttyLCD0

* ESC [ 2 J
* erase whole display and reset cursor to home.
* i.e. printf '\e[2J' > /dev/ttyLCD0

* ESC [ 2 K
* erase current line and set cursor to beginning of line.
* i.e. printf '\e[2K' > /dev/ttyLCD0

* CR and LF are supported.

* Vertical scroll when cursor is on bottom line and receive end of line.

Default brightness can be set from the device tree/plat data.

Brightness can be set from a sysfs file, for example:
* echo 6 > /sys/devices/soc.0/ffc04000.i2c/i2c-0/0-0028/brightness

---
 drivers/tty/Kconfig                        |    5 +
 drivers/tty/Makefile                       |    1 +
 drivers/tty/newhaven_lcd.c                 |  733 ++++++++++++++++++++++++++++
 include/linux/platform_data/newhaven_lcd.h |   25 +
 4 files changed, 764 insertions(+)
 create mode 100644 drivers/tty/newhaven_lcd.c
 create mode 100644 include/linux/platform_data/newhaven_lcd.h
drivers/tty/Kconfig +5 -0
index b24aa01..c392405 100644
@@ -419,4 +419,9 @@ config DA_CONSOLE
 	help
 	  This enables a console on a Dash channel.
 
+config NEWHAVEN_LCD
+       tristate "NEWHAVEN LCD"
+       help
+         Add support for a TTY device on a Newhaven I2C LCD device.
+
 endif # TTY
drivers/tty/Makefile +1 -0
index 58ad1c0..f6a3d56 100644
@@ -29,5 +29,6 @@ obj-$(CONFIG_SYNCLINK)		+= synclink.o
 obj-$(CONFIG_PPC_EPAPR_HV_BYTECHAN) += ehv_bytechan.o
 obj-$(CONFIG_GOLDFISH_TTY)	+= goldfish.o
 obj-$(CONFIG_DA_TTY)		+= metag_da.o
+obj-$(CONFIG_NEWHAVEN_LCD)	+= newhaven_lcd.o
 
 obj-y += ipwireless/
drivers/tty/newhaven_lcd.c new file +733 -0

733 lines not on this page · raw message

include/linux/platform_data/newhaven_lcd.h new file +25 -0
new file mode 100644
index 0000000..68a6d19
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013-2015 Altera Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __NEWHAVEN_LCD_H
+#define __NEWHAVEN_LCD_H
+
+struct newhaven_lcd_pdata {
+	unsigned int width;
+	unsigned int height;
+	unsigned int brightness;
+};
+
+#endif /* __NEWHAVEN_LCD_H */
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH 2/2] add newhaven lcd tty driver on i2c

Quoted 16 lines · Alan Tull

Supports the Newhaven NHD‐0216K3Z‐NSW‐BBW 2x16 LCD module as i2c slave. Devices will show up as /dev/ttyLCD0, etc.

* Backspace is supported to the beginning of the current line.
* i.e. printf '\b' > /dev/ttyLCD0

* ESC [ 2 J
* erase whole display and reset cursor to home.
* i.e. printf '\e[2J' > /dev/ttyLCD0

* ESC [ 2 K
* erase current line and set cursor to beginning of line.
* i.e. printf '\e[2K' > /dev/ttyLCD0

* CR and LF are supported.

Quoted 8 lines

* Vertical scroll when cursor is on bottom line and receive end of line.

Default brightness can be set from the device tree/plat data.

Brightness can be set from a sysfs file, for example:
* echo 6 > /sys/devices/soc.0/ffc04000.i2c/i2c-0/0-0028/brightness

This should use the new fb_tft api instead of trying to look like a tty device. That framework is merged in the staging-next branch of the staging.git kernel tree and will show up in 4.1-rc1. Please port this driver to that api and submit a patch for me to take for the staging tree so that we don't have one-off devices like this.

thanks,

greg k-h

author
#4 lore raw

Re: [PATCH 2/2] add newhaven lcd tty driver on i2c

Quoted 24 lines · Greg Kroah-Hartman
Quoted 23 lines · Alan Tull

Supports the Newhaven NHD‐0216K3Z‐NSW‐BBW 2x16 LCD module as i2c slave. Devices will show up as /dev/ttyLCD0, etc.

* Backspace is supported to the beginning of the current line.
* i.e. printf '\b' > /dev/ttyLCD0

* ESC [ 2 J
* erase whole display and reset cursor to home.
* i.e. printf '\e[2J' > /dev/ttyLCD0

* ESC [ 2 K
* erase current line and set cursor to beginning of line.
* i.e. printf '\e[2K' > /dev/ttyLCD0

* CR and LF are supported.

* Vertical scroll when cursor is on bottom line and receive end of line.

Default brightness can be set from the device tree/plat data.

Brightness can be set from a sysfs file, for example:
* echo 6 > /sys/devices/soc.0/ffc04000.i2c/i2c-0/0-0028/brightness

Quoted 7 lines
Quoted 1 line

This should use the new fb_tft api instead of trying to look like a tty device. That framework is merged in the staging-next branch of the staging.git kernel tree and will show up in 4.1-rc1. Please port this driver to that api and submit a patch for me to take for the staging tree so that we don't have one-off devices like this.

Cool! Will do.

Thanks!
Alan

Quoted 10 lines

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#5 lore raw

Re: [PATCH 2/2] add newhaven lcd tty driver on i2c

In reply to Greg Kroah-Hartman
Quoted 24 lines · Greg Kroah-Hartman
Quoted 23 lines · Alan Tull

Supports the Newhaven NHD‐0216K3Z‐NSW‐BBW 2x16 LCD module as i2c slave. Devices will show up as /dev/ttyLCD0, etc.

* Backspace is supported to the beginning of the current line.
* i.e. printf '\b' > /dev/ttyLCD0

* ESC [ 2 J
* erase whole display and reset cursor to home.
* i.e. printf '\e[2J' > /dev/ttyLCD0

* ESC [ 2 K
* erase current line and set cursor to beginning of line.
* i.e. printf '\e[2K' > /dev/ttyLCD0

* CR and LF are supported.

* Vertical scroll when cursor is on bottom line and receive end of line.

Default brightness can be set from the device tree/plat data.

Brightness can be set from a sysfs file, for example:
* echo 6 > /sys/devices/soc.0/ffc04000.i2c/i2c-0/0-0028/brightness

Quoted 8 lines
Quoted 1 line

This should use the new fb_tft api instead of trying to look like a tty device. That framework is merged in the staging-next branch of the staging.git kernel tree and will show up in 4.1-rc1. Please port this driver to that api and submit a patch for me to take for the staging tree so that we don't have one-off devices like this.

Hi Greg,

This isn't framebuffer type of device. It's two rows of 16 characters and you can write ascii characters to it. If there's another framework more suited to this, that would be great.

Alan

Quoted 9 lines

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/