Lines Matching +full:1 +full:st
34 #define AT91_ADC_SWRST (1 << 0) /* Software Reset */
35 #define AT91_ADC_START (1 << 1) /* Start Conversion */
40 #define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
41 #define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
42 #define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
43 #define AT91_ADC_TRGSEL_TC0 (0 << 1)
44 #define AT91_ADC_TRGSEL_TC1 (1 << 1)
45 #define AT91_ADC_TRGSEL_TC2 (2 << 1)
46 #define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
47 #define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
48 #define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
49 #define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
69 #define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
72 #define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
73 #define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
74 #define AT91_ADC_DRDY (1 << 16) /* Data Ready */
75 #define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
76 #define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
77 #define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
80 #define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
88 #define AT91RL_ADC_IER_PEN (1 << 20)
89 #define AT91RL_ADC_IER_NOPEN (1 << 21)
90 #define AT91_ADC_IER_PEN (1 << 29)
91 #define AT91_ADC_IER_NOPEN (1 << 30)
92 #define AT91_ADC_IER_XRDY (1 << 20)
93 #define AT91_ADC_IER_YRDY (1 << 21)
94 #define AT91_ADC_IER_PRDY (1 << 22)
95 #define AT91_ADC_ISR_PENS (1 << 31)
108 #define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
117 #define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
119 #define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
136 #define AT91_ADC_CHAN(st, ch) \ argument
137 (st->registers->channel_base + (ch * 4))
138 #define at91_adc_readl(st, reg) \ argument
139 (readl_relaxed(st->reg_base + reg))
140 #define at91_adc_writel(st, reg, val) \ argument
141 (writel_relaxed(val, st->reg_base + reg))
268 struct at91_adc_state *st = iio_priv(idev); in at91_adc_trigger_handler() local
276 st->buffer[j] = at91_adc_readl(st, AT91_ADC_CHAN(st, chan->channel)); in at91_adc_trigger_handler()
280 iio_push_to_buffers_with_timestamp(idev, st->buffer, pf->timestamp); in at91_adc_trigger_handler()
285 at91_adc_readl(st, AT91_ADC_LCDR); in at91_adc_trigger_handler()
287 enable_irq(st->irq); in at91_adc_trigger_handler()
295 struct at91_adc_state *st = iio_priv(idev); in handle_adc_eoc_trigger() local
301 st->last_value = at91_adc_readl(st, AT91_ADC_CHAN(st, st->chnb)); in handle_adc_eoc_trigger()
303 at91_adc_readl(st, AT91_ADC_LCDR); in handle_adc_eoc_trigger()
304 st->done = true; in handle_adc_eoc_trigger()
305 wake_up_interruptible(&st->wq_data_avail); in handle_adc_eoc_trigger()
311 struct at91_adc_state *st = iio_priv(idev); in at91_ts_sample() local
314 unsigned int rxp = 1; in at91_ts_sample()
317 unsigned int xyz_mask_bits = st->res; in at91_ts_sample()
318 unsigned int xyz_mask = (1 << xyz_mask_bits) - 1; in at91_ts_sample()
321 /* x position = (x / xscale) * max, max = 2^MAX_POS_BITS - 1 */ in at91_ts_sample()
322 reg = at91_adc_readl(st, AT91_ADC_TSXPOSR); in at91_ts_sample()
328 return -1; in at91_ts_sample()
332 /* y position = (y / yscale) * max, max = 2^MAX_POS_BITS - 1 */ in at91_ts_sample()
333 reg = at91_adc_readl(st, AT91_ADC_TSYPOSR); in at91_ts_sample()
339 return -1; in at91_ts_sample()
344 reg = at91_adc_readl(st, AT91_ADC_TSPRESSR); in at91_ts_sample()
352 pres = st->ts_pressure_threshold; /* no pen contacted */ in at91_ts_sample()
357 if (pres < st->ts_pressure_threshold) { in at91_ts_sample()
360 input_report_abs(st->ts_input, ABS_X, x); in at91_ts_sample()
361 input_report_abs(st->ts_input, ABS_Y, y); in at91_ts_sample()
362 input_report_abs(st->ts_input, ABS_PRESSURE, pres); in at91_ts_sample()
363 input_report_key(st->ts_input, BTN_TOUCH, 1); in at91_ts_sample()
364 input_sync(st->ts_input); in at91_ts_sample()
375 struct at91_adc_state *st = iio_priv(idev); in at91_adc_rl_interrupt() local
376 u32 status = at91_adc_readl(st, st->registers->status_register); in at91_adc_rl_interrupt()
379 status &= at91_adc_readl(st, AT91_ADC_IMR); in at91_adc_rl_interrupt()
380 if (status & GENMASK(st->num_channels - 1, 0)) in at91_adc_rl_interrupt()
385 reg = at91_adc_readl(st, AT91_ADC_MR); in at91_adc_rl_interrupt()
387 at91_adc_writel(st, AT91_ADC_MR, reg); in at91_adc_rl_interrupt()
389 at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN); in at91_adc_rl_interrupt()
390 at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_NOPEN in at91_adc_rl_interrupt()
393 at91_adc_writel(st, st->registers->trigger_register, in at91_adc_rl_interrupt()
395 AT91_ADC_TRGR_TRGPER_(st->ts_sample_period_val)); in at91_adc_rl_interrupt()
397 reg = at91_adc_readl(st, AT91_ADC_MR); in at91_adc_rl_interrupt()
398 reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC; in at91_adc_rl_interrupt()
399 at91_adc_writel(st, AT91_ADC_MR, reg); in at91_adc_rl_interrupt()
400 at91_adc_writel(st, st->registers->trigger_register, in at91_adc_rl_interrupt()
403 at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_NOPEN in at91_adc_rl_interrupt()
405 at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN); in at91_adc_rl_interrupt()
406 st->ts_bufferedmeasure = false; in at91_adc_rl_interrupt()
407 input_report_key(st->ts_input, BTN_TOUCH, 0); in at91_adc_rl_interrupt()
408 input_sync(st->ts_input); in at91_adc_rl_interrupt()
409 } else if (status & AT91_ADC_EOC(3) && st->ts_input) { in at91_adc_rl_interrupt()
411 if (st->ts_bufferedmeasure) { in at91_adc_rl_interrupt()
417 input_report_abs(st->ts_input, ABS_X, st->ts_prev_absx); in at91_adc_rl_interrupt()
418 input_report_abs(st->ts_input, ABS_Y, st->ts_prev_absy); in at91_adc_rl_interrupt()
419 input_report_key(st->ts_input, BTN_TOUCH, 1); in at91_adc_rl_interrupt()
420 input_sync(st->ts_input); in at91_adc_rl_interrupt()
422 st->ts_bufferedmeasure = true; in at91_adc_rl_interrupt()
425 st->ts_prev_absx = at91_adc_readl(st, AT91_ADC_CHAN(st, 3)) in at91_adc_rl_interrupt()
427 st->ts_prev_absx /= at91_adc_readl(st, AT91_ADC_CHAN(st, 2)); in at91_adc_rl_interrupt()
429 st->ts_prev_absy = at91_adc_readl(st, AT91_ADC_CHAN(st, 1)) in at91_adc_rl_interrupt()
431 st->ts_prev_absy /= at91_adc_readl(st, AT91_ADC_CHAN(st, 0)); in at91_adc_rl_interrupt()
440 struct at91_adc_state *st = iio_priv(idev); in at91_adc_9x5_interrupt() local
441 u32 status = at91_adc_readl(st, st->registers->status_register); in at91_adc_9x5_interrupt()
447 if (status & GENMASK(st->num_channels - 1, 0)) in at91_adc_9x5_interrupt()
451 at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN); in at91_adc_9x5_interrupt()
452 at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_NOPEN | in at91_adc_9x5_interrupt()
455 at91_adc_writel(st, st->registers->trigger_register, in at91_adc_9x5_interrupt()
457 AT91_ADC_TRGR_TRGPER_(st->ts_sample_period_val)); in at91_adc_9x5_interrupt()
459 at91_adc_writel(st, st->registers->trigger_register, 0); in at91_adc_9x5_interrupt()
460 at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_NOPEN | in at91_adc_9x5_interrupt()
462 at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN); in at91_adc_9x5_interrupt()
464 input_report_key(st->ts_input, BTN_TOUCH, 0); in at91_adc_9x5_interrupt()
465 input_sync(st->ts_input); in at91_adc_9x5_interrupt()
476 at91_adc_readl(st, AT91_ADC_TSXPOSR); in at91_adc_9x5_interrupt()
477 at91_adc_readl(st, AT91_ADC_TSYPOSR); in at91_adc_9x5_interrupt()
478 at91_adc_readl(st, AT91_ADC_TSPRESSR); in at91_adc_9x5_interrupt()
487 struct at91_adc_state *st = iio_priv(idev); in at91_adc_channel_init() local
493 if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE) in at91_adc_channel_init()
495 else if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_5WIRE) in at91_adc_channel_init()
499 st->channels_mask &= ~rsvd_mask; in at91_adc_channel_init()
501 idev->num_channels = bitmap_weight(&st->channels_mask, in at91_adc_channel_init()
502 st->num_channels) + 1; in at91_adc_channel_init()
505 ((idev->num_channels + 1) * in at91_adc_channel_init()
512 for_each_set_bit(bit, &st->channels_mask, st->num_channels) { in at91_adc_channel_init()
516 chan->indexed = 1; in at91_adc_channel_init()
520 chan->scan_type.realbits = st->res; in at91_adc_channel_init()
529 timestamp->channel = -1; in at91_adc_channel_init()
543 struct at91_adc_state *st = iio_priv(idev); in at91_adc_get_trigger_value_by_name() local
546 for (i = 0; i < st->caps->trigger_number; i++) { in at91_adc_get_trigger_value_by_name()
571 struct at91_adc_state *st = iio_priv(idev); in at91_adc_configure_trigger() local
572 const struct at91_adc_reg_desc *reg = st->registers; in at91_adc_configure_trigger()
573 u32 status = at91_adc_readl(st, reg->trigger_register); in at91_adc_configure_trigger()
578 st->caps->triggers, in at91_adc_configure_trigger()
584 st->buffer = kmalloc(idev->scan_bytes, GFP_KERNEL); in at91_adc_configure_trigger()
585 if (st->buffer == NULL) in at91_adc_configure_trigger()
588 at91_adc_writel(st, reg->trigger_register, in at91_adc_configure_trigger()
592 st->num_channels) { in at91_adc_configure_trigger()
594 at91_adc_writel(st, AT91_ADC_CHER, in at91_adc_configure_trigger()
598 at91_adc_writel(st, AT91_ADC_IER, reg->drdy_mask); in at91_adc_configure_trigger()
601 at91_adc_writel(st, AT91_ADC_IDR, reg->drdy_mask); in at91_adc_configure_trigger()
603 at91_adc_writel(st, reg->trigger_register, in at91_adc_configure_trigger()
607 st->num_channels) { in at91_adc_configure_trigger()
609 at91_adc_writel(st, AT91_ADC_CHDR, in at91_adc_configure_trigger()
612 kfree(st->buffer); in at91_adc_configure_trigger()
647 struct at91_adc_state *st = iio_priv(idev); in at91_adc_trigger_init() local
650 st->trig = devm_kcalloc(&idev->dev, in at91_adc_trigger_init()
651 st->caps->trigger_number, sizeof(*st->trig), in at91_adc_trigger_init()
654 if (st->trig == NULL) { in at91_adc_trigger_init()
659 for (i = 0; i < st->caps->trigger_number; i++) { in at91_adc_trigger_init()
660 if (st->caps->triggers[i].is_external && !(st->use_external)) in at91_adc_trigger_init()
663 st->trig[i] = at91_adc_allocate_trigger(idev, in at91_adc_trigger_init()
664 st->caps->triggers + i); in at91_adc_trigger_init()
665 if (st->trig[i] == NULL) { in at91_adc_trigger_init()
677 iio_trigger_unregister(st->trig[i]); in at91_adc_trigger_init()
678 iio_trigger_free(st->trig[i]); in at91_adc_trigger_init()
686 struct at91_adc_state *st = iio_priv(idev); in at91_adc_trigger_remove() local
689 for (i = 0; i < st->caps->trigger_number; i++) { in at91_adc_trigger_remove()
690 iio_trigger_unregister(st->trig[i]); in at91_adc_trigger_remove()
691 iio_trigger_free(st->trig[i]); in at91_adc_trigger_remove()
710 struct at91_adc_state *st = iio_priv(idev); in at91_adc_read_raw() local
715 mutex_lock(&st->lock); in at91_adc_read_raw()
717 st->chnb = chan->channel; in at91_adc_read_raw()
718 at91_adc_writel(st, AT91_ADC_CHER, in at91_adc_read_raw()
720 at91_adc_writel(st, AT91_ADC_IER, BIT(chan->channel)); in at91_adc_read_raw()
721 at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_START); in at91_adc_read_raw()
723 ret = wait_event_interruptible_timeout(st->wq_data_avail, in at91_adc_read_raw()
724 st->done, in at91_adc_read_raw()
730 at91_adc_writel(st, AT91_ADC_CHDR, in at91_adc_read_raw()
732 at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); in at91_adc_read_raw()
736 *val = st->last_value; in at91_adc_read_raw()
737 st->last_value = 0; in at91_adc_read_raw()
738 st->done = false; in at91_adc_read_raw()
747 mutex_unlock(&st->lock); in at91_adc_read_raw()
751 *val = st->vref_mv; in at91_adc_read_raw()
767 * Startup Time = (ticks + 1) * 8 / ADC Clock in calc_startup_ticks_9260()
769 return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8; in calc_startup_ticks_9260()
795 ticks = size - 1; in calc_startup_ticks_9x5()
801 struct at91_adc_state *st, struct device *dev) in at91_adc_probe_dt_ts() argument
815 st->touchscreen_type = prop; in at91_adc_probe_dt_ts()
822 if (!st->caps->has_tsmr) in at91_adc_probe_dt_ts()
826 st->ts_pressure_threshold = prop; in at91_adc_probe_dt_ts()
827 if (st->ts_pressure_threshold) { in at91_adc_probe_dt_ts()
842 struct at91_adc_state *st = input_get_drvdata(dev); in atmel_ts_open() local
844 if (st->caps->has_tsmr) in atmel_ts_open()
845 at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN); in atmel_ts_open()
847 at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN); in atmel_ts_open()
853 struct at91_adc_state *st = input_get_drvdata(dev); in atmel_ts_close() local
855 if (st->caps->has_tsmr) in atmel_ts_close()
856 at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN); in atmel_ts_close()
858 at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN); in atmel_ts_close()
863 struct at91_adc_state *st = iio_priv(idev); in at91_ts_hw_init() local
872 st->ts_pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz / in at91_ts_hw_init()
873 1000, 1); in at91_ts_hw_init()
875 while (st->ts_pendbc >> ++i) in at91_ts_hw_init()
877 if (abs(st->ts_pendbc - (1 << i)) < abs(st->ts_pendbc - (1 << (i - 1)))) in at91_ts_hw_init()
878 st->ts_pendbc = i; in at91_ts_hw_init()
880 st->ts_pendbc = i - 1; in at91_ts_hw_init()
882 if (!st->caps->has_tsmr) { in at91_ts_hw_init()
883 reg = at91_adc_readl(st, AT91_ADC_MR); in at91_ts_hw_init()
886 reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC; in at91_ts_hw_init()
887 at91_adc_writel(st, AT91_ADC_MR, reg); in at91_ts_hw_init()
890 at91_adc_writel(st, AT91_ADC_TSR, reg); in at91_ts_hw_init()
892 st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US_RL * in at91_ts_hw_init()
893 adc_clk_khz / 1000) - 1, 1); in at91_ts_hw_init()
906 if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE) in at91_ts_hw_init()
912 reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average) in at91_ts_hw_init()
914 reg |= AT91_ADC_TSMR_PENDBC_(st->ts_pendbc) & AT91_ADC_TSMR_PENDBC; in at91_ts_hw_init()
919 at91_adc_writel(st, AT91_ADC_TSMR, reg); in at91_ts_hw_init()
923 * 0 = 200 kOhm, 1 = 150 kOhm, 2 = 100 kOhm, 3 = 50 kOhm in at91_ts_hw_init()
926 at91_adc_writel(st, AT91_ADC_ACR, st->caps->ts_pen_detect_sensitivity in at91_ts_hw_init()
929 /* Sample Period Time = (TRGPER + 1) / ADCClock */ in at91_ts_hw_init()
930 st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US * in at91_ts_hw_init()
931 adc_clk_khz / 1000) - 1, 1); in at91_ts_hw_init()
939 struct at91_adc_state *st = iio_priv(idev); in at91_ts_register() local
958 if (st->caps->has_tsmr) { in at91_ts_register()
959 input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1, in at91_ts_register()
961 input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1, in at91_ts_register()
965 if (st->touchscreen_type != ATMEL_ADC_TOUCHSCREEN_4WIRE) { in at91_ts_register()
972 input_set_abs_params(input, ABS_X, 0, (1 << MAX_RLPOS_BITS) - 1, in at91_ts_register()
974 input_set_abs_params(input, ABS_Y, 0, (1 << MAX_RLPOS_BITS) - 1, in at91_ts_register()
978 st->ts_input = input; in at91_ts_register()
979 input_set_drvdata(input, st); in at91_ts_register()
988 input_free_device(st->ts_input); in at91_ts_register()
992 static void at91_ts_unregister(struct at91_adc_state *st) in at91_ts_unregister() argument
994 input_unregister_device(st->ts_input); in at91_ts_unregister()
1003 struct at91_adc_state *st; in at91_adc_probe() local
1011 st = iio_priv(idev); in at91_adc_probe()
1013 st->caps = of_device_get_match_data(&pdev->dev); in at91_adc_probe()
1015 st->use_external = of_property_read_bool(node, "atmel,adc-use-external-triggers"); in at91_adc_probe()
1021 st->channels_mask = prop; in at91_adc_probe()
1023 st->sleep_mode = of_property_read_bool(node, "atmel,adc-sleep-mode"); in at91_adc_probe()
1029 st->startup_time = prop; in at91_adc_probe()
1033 st->sample_hold_time = prop; in at91_adc_probe()
1039 st->vref_mv = prop; in at91_adc_probe()
1041 st->res = st->caps->high_res_bits; in at91_adc_probe()
1042 if (st->caps->low_res_bits && in at91_adc_probe()
1045 st->res = st->caps->low_res_bits; in at91_adc_probe()
1047 dev_info(&idev->dev, "Resolution used: %u bits\n", st->res); in at91_adc_probe()
1049 st->registers = &st->caps->registers; in at91_adc_probe()
1050 st->num_channels = st->caps->num_channels; in at91_adc_probe()
1053 if (st->caps->has_ts) { in at91_adc_probe()
1054 ret = at91_adc_probe_dt_ts(node, st, &idev->dev); in at91_adc_probe()
1065 st->irq = platform_get_irq(pdev, 0); in at91_adc_probe()
1066 if (st->irq < 0) in at91_adc_probe()
1069 st->reg_base = devm_platform_ioremap_resource(pdev, 0); in at91_adc_probe()
1070 if (IS_ERR(st->reg_base)) in at91_adc_probe()
1071 return PTR_ERR(st->reg_base); in at91_adc_probe()
1077 at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_SWRST); in at91_adc_probe()
1078 at91_adc_writel(st, AT91_ADC_IDR, 0xFFFFFFFF); in at91_adc_probe()
1080 if (st->caps->has_tsmr) in at91_adc_probe()
1081 ret = request_irq(st->irq, at91_adc_9x5_interrupt, 0, in at91_adc_probe()
1084 ret = request_irq(st->irq, at91_adc_rl_interrupt, 0, in at91_adc_probe()
1091 st->clk = devm_clk_get(&pdev->dev, "adc_clk"); in at91_adc_probe()
1092 if (IS_ERR(st->clk)) { in at91_adc_probe()
1094 ret = PTR_ERR(st->clk); in at91_adc_probe()
1098 ret = clk_prepare_enable(st->clk); in at91_adc_probe()
1105 st->adc_clk = devm_clk_get(&pdev->dev, "adc_op_clk"); in at91_adc_probe()
1106 if (IS_ERR(st->adc_clk)) { in at91_adc_probe()
1108 ret = PTR_ERR(st->adc_clk); in at91_adc_probe()
1112 ret = clk_prepare_enable(st->adc_clk); in at91_adc_probe()
1121 * datasheet : ADC Clock = MCK / ((Prescaler + 1) * 2), ADC Clock being in at91_adc_probe()
1124 mstrclk = clk_get_rate(st->clk); in at91_adc_probe()
1125 adc_clk = clk_get_rate(st->adc_clk); in at91_adc_probe()
1131 prsc = (mstrclk / (2 * adc_clk)) - 1; in at91_adc_probe()
1133 if (!st->startup_time) { in at91_adc_probe()
1138 ticks = (*st->caps->calc_startup_ticks)(st->startup_time, adc_clk_khz); in at91_adc_probe()
1143 * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock in at91_adc_probe()
1145 if (st->sample_hold_time > 0) in at91_adc_probe()
1146 shtim = round_up((st->sample_hold_time * adc_clk_khz / 1000) in at91_adc_probe()
1147 - 1, 1); in at91_adc_probe()
1151 reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; in at91_adc_probe()
1152 reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; in at91_adc_probe()
1153 if (st->res == st->caps->low_res_bits) in at91_adc_probe()
1155 if (st->sleep_mode) in at91_adc_probe()
1158 at91_adc_writel(st, AT91_ADC_MR, reg); in at91_adc_probe()
1167 init_waitqueue_head(&st->wq_data_avail); in at91_adc_probe()
1168 mutex_init(&st->lock); in at91_adc_probe()
1175 if (!st->touchscreen_type) { in at91_adc_probe()
1205 if (!st->touchscreen_type) { in at91_adc_probe()
1209 at91_ts_unregister(st); in at91_adc_probe()
1212 clk_disable_unprepare(st->adc_clk); in at91_adc_probe()
1214 clk_disable_unprepare(st->clk); in at91_adc_probe()
1216 free_irq(st->irq, idev); in at91_adc_probe()
1223 struct at91_adc_state *st = iio_priv(idev); in at91_adc_remove() local
1226 if (!st->touchscreen_type) { in at91_adc_remove()
1230 at91_ts_unregister(st); in at91_adc_remove()
1232 clk_disable_unprepare(st->adc_clk); in at91_adc_remove()
1233 clk_disable_unprepare(st->clk); in at91_adc_remove()
1234 free_irq(st->irq, idev); in at91_adc_remove()
1242 struct at91_adc_state *st = iio_priv(idev); in at91_adc_suspend() local
1245 clk_disable_unprepare(st->clk); in at91_adc_suspend()
1253 struct at91_adc_state *st = iio_priv(idev); in at91_adc_resume() local
1255 clk_prepare_enable(st->clk); in at91_adc_resume()
1266 { .name = "timer-counter-1", .value = 0x3 },