Lines Matching refs:kbd

71 	struct spear_kbd *kbd = dev_id;  in spear_kbd_interrupt()  local
72 struct input_dev *input = kbd->input; in spear_kbd_interrupt()
76 sts = readl_relaxed(kbd->io_base + STATUS_REG); in spear_kbd_interrupt()
80 if (kbd->last_key != KEY_RESERVED) { in spear_kbd_interrupt()
81 input_report_key(input, kbd->last_key, 0); in spear_kbd_interrupt()
82 kbd->last_key = KEY_RESERVED; in spear_kbd_interrupt()
86 val = readl_relaxed(kbd->io_base + DATA_REG) & in spear_kbd_interrupt()
88 key = kbd->keycodes[val]; in spear_kbd_interrupt()
94 kbd->last_key = key; in spear_kbd_interrupt()
97 writel_relaxed(0, kbd->io_base + STATUS_REG); in spear_kbd_interrupt()
104 struct spear_kbd *kbd = input_get_drvdata(dev); in spear_kbd_open() local
108 kbd->last_key = KEY_RESERVED; in spear_kbd_open()
110 error = clk_enable(kbd->clk); in spear_kbd_open()
115 val = clk_get_rate(kbd->clk) / 1000000 - 1; in spear_kbd_open()
120 (kbd->mode << MODE_CTL_KEYNUM_SHIFT); in spear_kbd_open()
121 writel_relaxed(val, kbd->io_base + MODE_CTL_REG); in spear_kbd_open()
122 writel_relaxed(1, kbd->io_base + STATUS_REG); in spear_kbd_open()
125 val = readl_relaxed(kbd->io_base + MODE_CTL_REG); in spear_kbd_open()
127 writel_relaxed(val, kbd->io_base + MODE_CTL_REG); in spear_kbd_open()
134 struct spear_kbd *kbd = input_get_drvdata(dev); in spear_kbd_close() local
138 val = readl_relaxed(kbd->io_base + MODE_CTL_REG); in spear_kbd_close()
140 writel_relaxed(val, kbd->io_base + MODE_CTL_REG); in spear_kbd_close()
142 clk_disable(kbd->clk); in spear_kbd_close()
144 kbd->last_key = KEY_RESERVED; in spear_kbd_close()
149 struct spear_kbd *kbd) in spear_kbd_parse_dt() argument
161 kbd->rep = true; in spear_kbd_parse_dt()
164 kbd->suspended_rate = suspended_rate; in spear_kbd_parse_dt()
172 kbd->mode = val; in spear_kbd_parse_dt()
177 struct spear_kbd *kbd) in spear_kbd_parse_dt() argument
187 struct spear_kbd *kbd; in spear_kbd_probe() local
196 kbd = devm_kzalloc(&pdev->dev, sizeof(*kbd), GFP_KERNEL); in spear_kbd_probe()
197 if (!kbd) { in spear_kbd_probe()
208 kbd->input = input_dev; in spear_kbd_probe()
209 kbd->irq = irq; in spear_kbd_probe()
212 error = spear_kbd_parse_dt(pdev, kbd); in spear_kbd_probe()
216 kbd->mode = pdata->mode; in spear_kbd_probe()
217 kbd->rep = pdata->rep; in spear_kbd_probe()
218 kbd->suspended_rate = pdata->suspended_rate; in spear_kbd_probe()
221 kbd->io_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); in spear_kbd_probe()
222 if (IS_ERR(kbd->io_base)) in spear_kbd_probe()
223 return PTR_ERR(kbd->io_base); in spear_kbd_probe()
225 kbd->clk = devm_clk_get(&pdev->dev, NULL); in spear_kbd_probe()
226 if (IS_ERR(kbd->clk)) in spear_kbd_probe()
227 return PTR_ERR(kbd->clk); in spear_kbd_probe()
239 kbd->keycodes, input_dev); in spear_kbd_probe()
245 if (kbd->rep) in spear_kbd_probe()
249 input_set_drvdata(input_dev, kbd); in spear_kbd_probe()
252 "keyboard", kbd); in spear_kbd_probe()
258 error = clk_prepare(kbd->clk); in spear_kbd_probe()
265 clk_unprepare(kbd->clk); in spear_kbd_probe()
270 platform_set_drvdata(pdev, kbd); in spear_kbd_probe()
277 struct spear_kbd *kbd = platform_get_drvdata(pdev); in spear_kbd_remove() local
279 input_unregister_device(kbd->input); in spear_kbd_remove()
280 clk_unprepare(kbd->clk); in spear_kbd_remove()
288 struct spear_kbd *kbd = platform_get_drvdata(pdev); in spear_kbd_suspend() local
289 struct input_dev *input_dev = kbd->input; in spear_kbd_suspend()
295 clk_enable(kbd->clk); in spear_kbd_suspend()
297 mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG); in spear_kbd_suspend()
300 if (!enable_irq_wake(kbd->irq)) in spear_kbd_suspend()
301 kbd->irq_wake_enabled = true; in spear_kbd_suspend()
307 if (kbd->suspended_rate) in spear_kbd_suspend()
308 rate = kbd->suspended_rate / 1000000 - 1; in spear_kbd_suspend()
310 rate = clk_get_rate(kbd->clk) / 1000000 - 1; in spear_kbd_suspend()
316 writel_relaxed(val, kbd->io_base + MODE_CTL_REG); in spear_kbd_suspend()
321 kbd->io_base + MODE_CTL_REG); in spear_kbd_suspend()
322 clk_disable(kbd->clk); in spear_kbd_suspend()
328 kbd->mode_ctl_reg = mode_ctl_reg; in spear_kbd_suspend()
331 clk_disable(kbd->clk); in spear_kbd_suspend()
341 struct spear_kbd *kbd = platform_get_drvdata(pdev); in spear_kbd_resume() local
342 struct input_dev *input_dev = kbd->input; in spear_kbd_resume()
347 if (kbd->irq_wake_enabled) { in spear_kbd_resume()
348 kbd->irq_wake_enabled = false; in spear_kbd_resume()
349 disable_irq_wake(kbd->irq); in spear_kbd_resume()
353 clk_enable(kbd->clk); in spear_kbd_resume()
358 writel_relaxed(kbd->mode_ctl_reg, kbd->io_base + MODE_CTL_REG); in spear_kbd_resume()