From 2c6a82f2342fadfcbd5dd92656e662c326f7a40a Mon Sep 17 00:00:00 2001 From: Lars Poeschel Date: Tue, 3 Nov 2020 10:58:09 +0100 Subject: auxdisplay: Move write_cmd pointers to hd44780 drivers The write_cmd function is used to send commands to hd44780 displays. The individual hd44780 drivers then implement their appropriate way of doing this with their supported displays. So we move this pointer so hd44780_common. Reviewed-by: Willy Tarreau Signed-off-by: Lars Poeschel Signed-off-by: Miguel Ojeda --- drivers/auxdisplay/hd44780.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'drivers/auxdisplay/hd44780.c') diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c index 922f0e0d2e6d..dc4738563298 100644 --- a/drivers/auxdisplay/hd44780.c +++ b/drivers/auxdisplay/hd44780.c @@ -103,9 +103,8 @@ static void hd44780_write_gpio4(struct hd44780 *hd, u8 val, unsigned int rs) } /* Send a command to the LCD panel in 8 bit GPIO mode */ -static void hd44780_write_cmd_gpio8(struct charlcd *lcd, int cmd) +static void hd44780_write_cmd_gpio8(struct hd44780_common *hdc, int cmd) { - struct hd44780_common *hdc = lcd->drvdata; struct hd44780 *hd = hdc->hd44780; hd44780_write_gpio8(hd, cmd, 0); @@ -126,14 +125,12 @@ static void hd44780_write_data_gpio8(struct hd44780_common *hdc, int data) } static const struct charlcd_ops hd44780_ops_gpio8 = { - .write_cmd = hd44780_write_cmd_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) +static void hd44780_write_cmd_gpio4(struct hd44780_common *hdc, int cmd) { - struct hd44780_common *hdc = lcd->drvdata; struct hd44780 *hd = hdc->hd44780; hd44780_write_gpio4(hd, cmd, 0); @@ -143,10 +140,9 @@ static void hd44780_write_cmd_gpio4(struct charlcd *lcd, int cmd) } /* 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) +static void hd44780_write_cmd_raw_gpio4(struct hd44780_common *hdc, int cmd) { DECLARE_BITMAP(values, 6); /* for DATA[4-7], RS, RW */ - struct hd44780_common *hdc = lcd->drvdata; struct hd44780 *hd = hdc->hd44780; unsigned int n; @@ -172,8 +168,6 @@ static void hd44780_write_data_gpio4(struct hd44780_common *hdc, int data) } static const struct charlcd_ops hd44780_ops_gpio4 = { - .write_cmd = hd44780_write_cmd_gpio4, - .write_cmd_raw4 = hd44780_write_cmd_raw_gpio4, .backlight = hd44780_backlight, }; @@ -275,9 +269,12 @@ static int hd44780_probe(struct platform_device *pdev) if (ifwidth == 8) { lcd->ops = &hd44780_ops_gpio8; hdc->write_data = hd44780_write_data_gpio8; + hdc->write_cmd = hd44780_write_cmd_gpio8; } else { lcd->ops = &hd44780_ops_gpio4; hdc->write_data = hd44780_write_data_gpio4; + hdc->write_cmd = hd44780_write_cmd_gpio4; + hdc->write_cmd_raw4 = hd44780_write_cmd_raw_gpio4; } ret = charlcd_register(lcd); -- cgit v1.2.3