Lines Matching +full:c +full:- +full:45

1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
6 * Copyright (C) 2016-2017 Glider bvba
43 struct hd44780_common *hdc = lcd->drvdata; in hd44780_backlight()
44 struct hd44780 *hd = hdc->hd44780; in hd44780_backlight()
46 if (hd->pins[PIN_CTRL_BL]) in hd44780_backlight()
47 gpiod_set_value_cansleep(hd->pins[PIN_CTRL_BL], on); in hd44780_backlight()
55 gpiod_set_value_cansleep(hd->pins[PIN_CTRL_E], 1); in hd44780_strobe_gpio()
60 gpiod_set_value_cansleep(hd->pins[PIN_CTRL_E], 0); in hd44780_strobe_gpio()
66 DECLARE_BITMAP(values, 10); /* for DATA[0-7], RS, RW */ in hd44780_write_gpio8()
71 n = hd->pins[PIN_CTRL_RW] ? 10 : 9; in hd44780_write_gpio8()
74 gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA0], NULL, values); in hd44780_write_gpio8()
82 DECLARE_BITMAP(values, 6); /* for DATA[4-7], RS, RW */ in hd44780_write_gpio4()
88 n = hd->pins[PIN_CTRL_RW] ? 6 : 5; in hd44780_write_gpio4()
91 gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], NULL, values); in hd44780_write_gpio4()
100 gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], NULL, values); in hd44780_write_gpio4()
108 struct hd44780 *hd = hdc->hd44780; in hd44780_write_cmd_gpio8()
119 struct hd44780 *hd = hdc->hd44780; in hd44780_write_data_gpio8()
123 /* The shortest data takes at least 45 us */ in hd44780_write_data_gpio8()
124 udelay(45); in hd44780_write_data_gpio8()
147 struct hd44780 *hd = hdc->hd44780; in hd44780_write_cmd_gpio4()
155 /* Send 4-bits of a command to the LCD panel in raw 4 bit GPIO mode */
158 DECLARE_BITMAP(values, 6); /* for DATA[4-7], RS, RW */ in hd44780_write_cmd_raw_gpio4()
159 struct hd44780 *hd = hdc->hd44780; in hd44780_write_cmd_raw_gpio4()
164 n = hd->pins[PIN_CTRL_RW] ? 6 : 5; in hd44780_write_cmd_raw_gpio4()
167 gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], NULL, values); in hd44780_write_cmd_raw_gpio4()
175 struct hd44780 *hd = hdc->hd44780; in hd44780_write_data_gpio4()
179 /* The shortest data takes at least 45 us */ in hd44780_write_data_gpio4()
180 udelay(45); in hd44780_write_data_gpio4()
202 struct device *dev = &pdev->dev; in hd44780_probe()
207 int ifwidth, ret = -ENOMEM; in hd44780_probe()
222 return -EINVAL; in hd44780_probe()
227 return -ENOMEM; in hd44780_probe()
237 hdc->hd44780 = hd; in hd44780_probe()
238 lcd->drvdata = hdc; in hd44780_probe()
240 hd->pins[base + i] = devm_gpiod_get_index(dev, "data", i, in hd44780_probe()
242 if (IS_ERR(hd->pins[base + i])) { in hd44780_probe()
243 ret = PTR_ERR(hd->pins[base + i]); in hd44780_probe()
248 hd->pins[PIN_CTRL_E] = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); in hd44780_probe()
249 if (IS_ERR(hd->pins[PIN_CTRL_E])) { in hd44780_probe()
250 ret = PTR_ERR(hd->pins[PIN_CTRL_E]); in hd44780_probe()
254 hd->pins[PIN_CTRL_RS] = devm_gpiod_get(dev, "rs", GPIOD_OUT_HIGH); in hd44780_probe()
255 if (IS_ERR(hd->pins[PIN_CTRL_RS])) { in hd44780_probe()
256 ret = PTR_ERR(hd->pins[PIN_CTRL_RS]); in hd44780_probe()
261 hd->pins[PIN_CTRL_RW] = devm_gpiod_get_optional(dev, "rw", in hd44780_probe()
263 if (IS_ERR(hd->pins[PIN_CTRL_RW])) { in hd44780_probe()
264 ret = PTR_ERR(hd->pins[PIN_CTRL_RW]); in hd44780_probe()
268 hd->pins[PIN_CTRL_BL] = devm_gpiod_get_optional(dev, "backlight", in hd44780_probe()
270 if (IS_ERR(hd->pins[PIN_CTRL_BL])) { in hd44780_probe()
271 ret = PTR_ERR(hd->pins[PIN_CTRL_BL]); in hd44780_probe()
276 ret = device_property_read_u32(dev, "display-height-chars", in hd44780_probe()
277 &lcd->height); in hd44780_probe()
280 ret = device_property_read_u32(dev, "display-width-chars", &lcd->width); in hd44780_probe()
288 if (lcd->height > 2) in hd44780_probe()
289 hdc->bwidth = lcd->width; in hd44780_probe()
292 device_property_read_u32(dev, "internal-buffer-width", &hdc->bwidth); in hd44780_probe()
294 hdc->ifwidth = ifwidth; in hd44780_probe()
296 lcd->ops = &hd44780_ops_gpio8; in hd44780_probe()
297 hdc->write_data = hd44780_write_data_gpio8; in hd44780_probe()
298 hdc->write_cmd = hd44780_write_cmd_gpio8; in hd44780_probe()
300 lcd->ops = &hd44780_ops_gpio4; in hd44780_probe()
301 hdc->write_data = hd44780_write_data_gpio4; in hd44780_probe()
302 hdc->write_cmd = hd44780_write_cmd_gpio4; in hd44780_probe()
303 hdc->write_cmd_raw4 = hd44780_write_cmd_raw_gpio4; in hd44780_probe()
325 struct hd44780_common *hdc = lcd->drvdata; in hd44780_remove()
328 kfree(hdc->hd44780); in hd44780_remove()
329 kfree(lcd->drvdata); in hd44780_remove()
351 MODULE_AUTHOR("Geert Uytterhoeven <geert@linux-m68k.org>");