Lines Matching refs:kscandat
71 static void lpc32xx_mod_states(struct lpc32xx_kscan_drv *kscandat, int col) in lpc32xx_mod_states() argument
73 struct input_dev *input = kscandat->input; in lpc32xx_mod_states()
77 key = readl(LPC32XX_KS_DATA(kscandat->kscan_base, col)); in lpc32xx_mod_states()
78 changed = key ^ kscandat->lastkeystates[col]; in lpc32xx_mod_states()
79 kscandat->lastkeystates[col] = key; in lpc32xx_mod_states()
85 kscandat->row_shift); in lpc32xx_mod_states()
86 keycode = kscandat->keymap[scancode]; in lpc32xx_mod_states()
95 struct lpc32xx_kscan_drv *kscandat = dev_id; in lpc32xx_kscan_irq() local
98 for (i = 0; i < kscandat->matrix_sz; i++) in lpc32xx_kscan_irq()
99 lpc32xx_mod_states(kscandat, i); in lpc32xx_kscan_irq()
101 writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); in lpc32xx_kscan_irq()
103 input_sync(kscandat->input); in lpc32xx_kscan_irq()
110 struct lpc32xx_kscan_drv *kscandat = input_get_drvdata(dev); in lpc32xx_kscan_open() local
113 error = clk_prepare_enable(kscandat->clk); in lpc32xx_kscan_open()
117 writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); in lpc32xx_kscan_open()
124 struct lpc32xx_kscan_drv *kscandat = input_get_drvdata(dev); in lpc32xx_kscan_close() local
126 writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); in lpc32xx_kscan_close()
127 clk_disable_unprepare(kscandat->clk); in lpc32xx_kscan_close()
131 struct lpc32xx_kscan_drv *kscandat) in lpc32xx_parse_dt() argument
145 kscandat->matrix_sz = rows; in lpc32xx_parse_dt()
146 kscandat->row_shift = get_count_order(columns); in lpc32xx_parse_dt()
148 of_property_read_u32(np, "nxp,debounce-delay-ms", &kscandat->deb_clks); in lpc32xx_parse_dt()
149 of_property_read_u32(np, "nxp,scan-delay-ms", &kscandat->scan_delay); in lpc32xx_parse_dt()
150 if (!kscandat->deb_clks || !kscandat->scan_delay) { in lpc32xx_parse_dt()
160 struct lpc32xx_kscan_drv *kscandat; in lpc32xx_kscan_probe() local
170 kscandat = devm_kzalloc(&pdev->dev, sizeof(*kscandat), in lpc32xx_kscan_probe()
172 if (!kscandat) in lpc32xx_kscan_probe()
175 error = lpc32xx_parse_dt(&pdev->dev, kscandat); in lpc32xx_kscan_probe()
181 keymap_size = sizeof(kscandat->keymap[0]) * in lpc32xx_kscan_probe()
182 (kscandat->matrix_sz << kscandat->row_shift); in lpc32xx_kscan_probe()
183 kscandat->keymap = devm_kzalloc(&pdev->dev, keymap_size, GFP_KERNEL); in lpc32xx_kscan_probe()
184 if (!kscandat->keymap) in lpc32xx_kscan_probe()
187 kscandat->input = input = devm_input_allocate_device(&pdev->dev); in lpc32xx_kscan_probe()
206 kscandat->matrix_sz, in lpc32xx_kscan_probe()
207 kscandat->matrix_sz, in lpc32xx_kscan_probe()
208 kscandat->keymap, kscandat->input); in lpc32xx_kscan_probe()
214 input_set_drvdata(kscandat->input, kscandat); in lpc32xx_kscan_probe()
216 kscandat->kscan_base = devm_platform_ioremap_resource(pdev, 0); in lpc32xx_kscan_probe()
217 if (IS_ERR(kscandat->kscan_base)) in lpc32xx_kscan_probe()
218 return PTR_ERR(kscandat->kscan_base); in lpc32xx_kscan_probe()
221 kscandat->clk = devm_clk_get(&pdev->dev, NULL); in lpc32xx_kscan_probe()
222 if (IS_ERR(kscandat->clk)) { in lpc32xx_kscan_probe()
224 return PTR_ERR(kscandat->clk); in lpc32xx_kscan_probe()
228 error = clk_prepare_enable(kscandat->clk); in lpc32xx_kscan_probe()
232 writel(kscandat->deb_clks, LPC32XX_KS_DEB(kscandat->kscan_base)); in lpc32xx_kscan_probe()
233 writel(kscandat->scan_delay, LPC32XX_KS_SCAN_CTL(kscandat->kscan_base)); in lpc32xx_kscan_probe()
235 LPC32XX_KS_FAST_TST(kscandat->kscan_base)); in lpc32xx_kscan_probe()
236 writel(kscandat->matrix_sz, in lpc32xx_kscan_probe()
237 LPC32XX_KS_MATRIX_DIM(kscandat->kscan_base)); in lpc32xx_kscan_probe()
238 writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); in lpc32xx_kscan_probe()
239 clk_disable_unprepare(kscandat->clk); in lpc32xx_kscan_probe()
242 pdev->name, kscandat); in lpc32xx_kscan_probe()
248 error = input_register_device(kscandat->input); in lpc32xx_kscan_probe()
254 platform_set_drvdata(pdev, kscandat); in lpc32xx_kscan_probe()
262 struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); in lpc32xx_kscan_suspend() local
263 struct input_dev *input = kscandat->input; in lpc32xx_kscan_suspend()
269 writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); in lpc32xx_kscan_suspend()
270 clk_disable_unprepare(kscandat->clk); in lpc32xx_kscan_suspend()
280 struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); in lpc32xx_kscan_resume() local
281 struct input_dev *input = kscandat->input; in lpc32xx_kscan_resume()
288 retval = clk_prepare_enable(kscandat->clk); in lpc32xx_kscan_resume()
290 writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); in lpc32xx_kscan_resume()