Lines Matching refs:lcd
77 struct charlcd *lcd = data; in charlcd_interrupt() local
80 status = readl(lcd->virtbase + CHAR_STAT) & 0x01; in charlcd_interrupt()
82 writel(CHAR_RAW_CLEAR, lcd->virtbase + CHAR_RAW); in charlcd_interrupt()
84 complete(&lcd->complete); in charlcd_interrupt()
86 dev_info(lcd->dev, "Spurious IRQ (%02x)\n", status); in charlcd_interrupt()
91 static void charlcd_wait_complete_irq(struct charlcd *lcd) in charlcd_wait_complete_irq() argument
95 ret = wait_for_completion_interruptible_timeout(&lcd->complete, in charlcd_wait_complete_irq()
98 writel(0x00, lcd->virtbase + CHAR_MASK); in charlcd_wait_complete_irq()
101 dev_err(lcd->dev, in charlcd_wait_complete_irq()
108 dev_err(lcd->dev, "charlcd controller timed out " in charlcd_wait_complete_irq()
114 static u8 charlcd_4bit_read_char(struct charlcd *lcd) in charlcd_4bit_read_char() argument
121 if (lcd->irq >= 0) in charlcd_4bit_read_char()
122 charlcd_wait_complete_irq(lcd); in charlcd_4bit_read_char()
128 val = readl(lcd->virtbase + CHAR_RAW); in charlcd_4bit_read_char()
132 writel(CHAR_RAW_CLEAR, lcd->virtbase + CHAR_RAW); in charlcd_4bit_read_char()
137 data = readl(lcd->virtbase + CHAR_RD) & 0xf0; in charlcd_4bit_read_char()
147 val = readl(lcd->virtbase + CHAR_RAW); in charlcd_4bit_read_char()
150 writel(CHAR_RAW_CLEAR, lcd->virtbase + CHAR_RAW); in charlcd_4bit_read_char()
154 data |= (readl(lcd->virtbase + CHAR_RD) >> 4) & 0x0f; in charlcd_4bit_read_char()
159 static bool charlcd_4bit_read_bf(struct charlcd *lcd) in charlcd_4bit_read_bf() argument
161 if (lcd->irq >= 0) { in charlcd_4bit_read_bf()
166 writel(CHAR_RAW_CLEAR, lcd->virtbase + CHAR_RAW); in charlcd_4bit_read_bf()
167 init_completion(&lcd->complete); in charlcd_4bit_read_bf()
168 writel(0x01, lcd->virtbase + CHAR_MASK); in charlcd_4bit_read_bf()
170 readl(lcd->virtbase + CHAR_COM); in charlcd_4bit_read_bf()
171 return charlcd_4bit_read_char(lcd) & HD_BUSY_FLAG ? true : false; in charlcd_4bit_read_bf()
174 static void charlcd_4bit_wait_busy(struct charlcd *lcd) in charlcd_4bit_wait_busy() argument
179 while (charlcd_4bit_read_bf(lcd) && retries) in charlcd_4bit_wait_busy()
182 dev_err(lcd->dev, "timeout waiting for busyflag\n"); in charlcd_4bit_wait_busy()
185 static void charlcd_4bit_command(struct charlcd *lcd, u8 cmd) in charlcd_4bit_command() argument
190 writel(cmdhi, lcd->virtbase + CHAR_COM); in charlcd_4bit_command()
192 writel(cmdlo, lcd->virtbase + CHAR_COM); in charlcd_4bit_command()
193 charlcd_4bit_wait_busy(lcd); in charlcd_4bit_command()
196 static void charlcd_4bit_char(struct charlcd *lcd, u8 ch) in charlcd_4bit_char() argument
201 writel(chhi, lcd->virtbase + CHAR_DAT); in charlcd_4bit_char()
203 writel(chlo, lcd->virtbase + CHAR_DAT); in charlcd_4bit_char()
204 charlcd_4bit_wait_busy(lcd); in charlcd_4bit_char()
207 static void charlcd_4bit_print(struct charlcd *lcd, int line, const char *str) in charlcd_4bit_print() argument
225 charlcd_4bit_command(lcd, HD_SET_DDRAM | offset); in charlcd_4bit_print()
229 charlcd_4bit_char(lcd, str[i]); in charlcd_4bit_print()
232 static void charlcd_4bit_init(struct charlcd *lcd) in charlcd_4bit_init() argument
235 writel(HD_FUNCSET | HD_FUNCSET_8BIT, lcd->virtbase + CHAR_COM); in charlcd_4bit_init()
237 writel(HD_FUNCSET | HD_FUNCSET_8BIT, lcd->virtbase + CHAR_COM); in charlcd_4bit_init()
239 writel(HD_FUNCSET | HD_FUNCSET_8BIT, lcd->virtbase + CHAR_COM); in charlcd_4bit_init()
242 writel(HD_FUNCSET, lcd->virtbase + CHAR_COM); in charlcd_4bit_init()
248 charlcd_4bit_command(lcd, HD_FUNCSET | HD_FUNCSET_2_LINES); in charlcd_4bit_init()
249 charlcd_4bit_command(lcd, HD_DISPCTRL | HD_DISPCTRL_ON); in charlcd_4bit_init()
250 charlcd_4bit_command(lcd, HD_ENTRYMODE | HD_ENTRYMODE_INCREMENT); in charlcd_4bit_init()
251 charlcd_4bit_command(lcd, HD_CLEAR); in charlcd_4bit_init()
252 charlcd_4bit_command(lcd, HD_HOME); in charlcd_4bit_init()
254 charlcd_4bit_print(lcd, 0, "ARM Linux"); in charlcd_4bit_init()
255 charlcd_4bit_print(lcd, 1, UTS_RELEASE); in charlcd_4bit_init()
260 struct charlcd *lcd = in charlcd_init_work() local
263 charlcd_4bit_init(lcd); in charlcd_init_work()
269 struct charlcd *lcd; in charlcd_probe() local
272 lcd = kzalloc(sizeof(struct charlcd), GFP_KERNEL); in charlcd_probe()
273 if (!lcd) in charlcd_probe()
276 lcd->dev = &pdev->dev; in charlcd_probe()
283 lcd->phybase = res->start; in charlcd_probe()
284 lcd->physize = resource_size(res); in charlcd_probe()
286 if (request_mem_region(lcd->phybase, lcd->physize, in charlcd_probe()
292 lcd->virtbase = ioremap(lcd->phybase, lcd->physize); in charlcd_probe()
293 if (!lcd->virtbase) { in charlcd_probe()
298 lcd->irq = platform_get_irq(pdev, 0); in charlcd_probe()
300 if (lcd->irq >= 0) { in charlcd_probe()
301 if (request_irq(lcd->irq, charlcd_interrupt, 0, in charlcd_probe()
302 DRIVERNAME, lcd)) { in charlcd_probe()
308 platform_set_drvdata(pdev, lcd); in charlcd_probe()
314 INIT_DELAYED_WORK(&lcd->init_work, charlcd_init_work); in charlcd_probe()
315 schedule_delayed_work(&lcd->init_work, 0); in charlcd_probe()
318 lcd->phybase); in charlcd_probe()
323 iounmap(lcd->virtbase); in charlcd_probe()
325 release_mem_region(lcd->phybase, SZ_4K); in charlcd_probe()
327 kfree(lcd); in charlcd_probe()
333 struct charlcd *lcd = platform_get_drvdata(pdev); in charlcd_remove() local
335 if (lcd) { in charlcd_remove()
336 free_irq(lcd->irq, lcd); in charlcd_remove()
337 iounmap(lcd->virtbase); in charlcd_remove()
338 release_mem_region(lcd->phybase, lcd->physize); in charlcd_remove()
339 kfree(lcd); in charlcd_remove()
348 struct charlcd *lcd = platform_get_drvdata(pdev); in charlcd_suspend() local
351 charlcd_4bit_command(lcd, HD_DISPCTRL); in charlcd_suspend()
358 struct charlcd *lcd = platform_get_drvdata(pdev); in charlcd_resume() local
361 charlcd_4bit_command(lcd, HD_DISPCTRL | HD_DISPCTRL_ON); in charlcd_resume()