Lines Matching full:tsc
71 static void lpc32xx_fifo_clear(struct lpc32xx_tsc *tsc) in lpc32xx_fifo_clear() argument
73 while (!(tsc_readl(tsc, LPC32XX_TSC_STAT) & in lpc32xx_fifo_clear()
75 tsc_readl(tsc, LPC32XX_TSC_FIFO); in lpc32xx_fifo_clear()
82 struct lpc32xx_tsc *tsc = dev_id; in lpc32xx_ts_interrupt() local
83 struct input_dev *input = tsc->dev; in lpc32xx_ts_interrupt()
85 tmp = tsc_readl(tsc, LPC32XX_TSC_STAT); in lpc32xx_ts_interrupt()
89 lpc32xx_fifo_clear(tsc); in lpc32xx_ts_interrupt()
100 !(tsc_readl(tsc, LPC32XX_TSC_STAT) & in lpc32xx_ts_interrupt()
102 tmp = tsc_readl(tsc, LPC32XX_TSC_FIFO); in lpc32xx_ts_interrupt()
126 static void lpc32xx_stop_tsc(struct lpc32xx_tsc *tsc) in lpc32xx_stop_tsc() argument
129 tsc_writel(tsc, LPC32XX_TSC_CON, in lpc32xx_stop_tsc()
130 tsc_readl(tsc, LPC32XX_TSC_CON) & in lpc32xx_stop_tsc()
133 clk_disable_unprepare(tsc->clk); in lpc32xx_stop_tsc()
136 static int lpc32xx_setup_tsc(struct lpc32xx_tsc *tsc) in lpc32xx_setup_tsc() argument
141 err = clk_prepare_enable(tsc->clk); in lpc32xx_setup_tsc()
145 tmp = tsc_readl(tsc, LPC32XX_TSC_CON) & ~LPC32XX_TSC_ADCCON_POWER_UP; in lpc32xx_setup_tsc()
147 /* Set the TSC FIFO depth to 4 samples @ 10-bits per sample (max) */ in lpc32xx_setup_tsc()
151 tsc_writel(tsc, LPC32XX_TSC_CON, tmp); in lpc32xx_setup_tsc()
154 tsc_writel(tsc, LPC32XX_TSC_SEL, LPC32XX_TSC_SEL_DEFVAL); in lpc32xx_setup_tsc()
155 tsc_writel(tsc, LPC32XX_TSC_MIN_X, LPC32XX_TSC_MIN_XY_VAL); in lpc32xx_setup_tsc()
156 tsc_writel(tsc, LPC32XX_TSC_MAX_X, LPC32XX_TSC_MAX_XY_VAL); in lpc32xx_setup_tsc()
157 tsc_writel(tsc, LPC32XX_TSC_MIN_Y, LPC32XX_TSC_MIN_XY_VAL); in lpc32xx_setup_tsc()
158 tsc_writel(tsc, LPC32XX_TSC_MAX_Y, LPC32XX_TSC_MAX_XY_VAL); in lpc32xx_setup_tsc()
161 tsc_writel(tsc, LPC32XX_TSC_AUX_UTR, 0); in lpc32xx_setup_tsc()
162 tsc_writel(tsc, LPC32XX_TSC_AUX_MIN, 0); in lpc32xx_setup_tsc()
163 tsc_writel(tsc, LPC32XX_TSC_AUX_MAX, 0); in lpc32xx_setup_tsc()
171 tsc_writel(tsc, LPC32XX_TSC_RTR, 0x2); in lpc32xx_setup_tsc()
172 tsc_writel(tsc, LPC32XX_TSC_DTR, 0x2); in lpc32xx_setup_tsc()
173 tsc_writel(tsc, LPC32XX_TSC_TTR, 0x10); in lpc32xx_setup_tsc()
174 tsc_writel(tsc, LPC32XX_TSC_DXP, 0x4); in lpc32xx_setup_tsc()
175 tsc_writel(tsc, LPC32XX_TSC_UTR, 88); in lpc32xx_setup_tsc()
177 lpc32xx_fifo_clear(tsc); in lpc32xx_setup_tsc()
180 tsc_writel(tsc, LPC32XX_TSC_CON, tmp | LPC32XX_TSC_ADCCON_AUTO_EN); in lpc32xx_setup_tsc()
187 struct lpc32xx_tsc *tsc = input_get_drvdata(dev); in lpc32xx_ts_open() local
189 return lpc32xx_setup_tsc(tsc); in lpc32xx_ts_open()
194 struct lpc32xx_tsc *tsc = input_get_drvdata(dev); in lpc32xx_ts_close() local
196 lpc32xx_stop_tsc(tsc); in lpc32xx_ts_close()
201 struct lpc32xx_tsc *tsc; in lpc32xx_ts_probe() local
218 tsc = kzalloc(sizeof(*tsc), GFP_KERNEL); in lpc32xx_ts_probe()
220 if (!tsc || !input) { in lpc32xx_ts_probe()
226 tsc->dev = input; in lpc32xx_ts_probe()
227 tsc->irq = irq; in lpc32xx_ts_probe()
232 dev_err(&pdev->dev, "TSC registers are not free\n"); in lpc32xx_ts_probe()
237 tsc->tsc_base = ioremap(res->start, size); in lpc32xx_ts_probe()
238 if (!tsc->tsc_base) { in lpc32xx_ts_probe()
244 tsc->clk = clk_get(&pdev->dev, NULL); in lpc32xx_ts_probe()
245 if (IS_ERR(tsc->clk)) { in lpc32xx_ts_probe()
247 error = PTR_ERR(tsc->clk); in lpc32xx_ts_probe()
268 input_set_drvdata(input, tsc); in lpc32xx_ts_probe()
270 error = request_irq(tsc->irq, lpc32xx_ts_interrupt, in lpc32xx_ts_probe()
271 0, pdev->name, tsc); in lpc32xx_ts_probe()
283 platform_set_drvdata(pdev, tsc); in lpc32xx_ts_probe()
289 free_irq(tsc->irq, tsc); in lpc32xx_ts_probe()
291 clk_put(tsc->clk); in lpc32xx_ts_probe()
293 iounmap(tsc->tsc_base); in lpc32xx_ts_probe()
298 kfree(tsc); in lpc32xx_ts_probe()
305 struct lpc32xx_tsc *tsc = platform_get_drvdata(pdev); in lpc32xx_ts_remove() local
308 free_irq(tsc->irq, tsc); in lpc32xx_ts_remove()
310 input_unregister_device(tsc->dev); in lpc32xx_ts_remove()
312 clk_put(tsc->clk); in lpc32xx_ts_remove()
314 iounmap(tsc->tsc_base); in lpc32xx_ts_remove()
318 kfree(tsc); in lpc32xx_ts_remove()
326 struct lpc32xx_tsc *tsc = dev_get_drvdata(dev); in lpc32xx_ts_suspend() local
327 struct input_dev *input = tsc->dev; in lpc32xx_ts_suspend()
332 * avoid calling the TSC stop and start functions as the TSC in lpc32xx_ts_suspend()
339 enable_irq_wake(tsc->irq); in lpc32xx_ts_suspend()
341 lpc32xx_stop_tsc(tsc); in lpc32xx_ts_suspend()
351 struct lpc32xx_tsc *tsc = dev_get_drvdata(dev); in lpc32xx_ts_resume() local
352 struct input_dev *input = tsc->dev; in lpc32xx_ts_resume()
358 disable_irq_wake(tsc->irq); in lpc32xx_ts_resume()
360 lpc32xx_setup_tsc(tsc); in lpc32xx_ts_resume()
379 { .compatible = "nxp,lpc3220-tsc", },
397 MODULE_DESCRIPTION("LPC32XX TSC Driver");