H A D | ti_am335x_adc.c | 53 static u32 get_adc_step_mask(struct tiadc_device *adc_dev) get_adc_step_mask() argument 57 step_en = ((1 << adc_dev->channels) - 1); get_adc_step_mask() 58 step_en <<= TOTAL_STEPS - adc_dev->channels + 1; get_adc_step_mask() 62 static u32 get_adc_chan_step_mask(struct tiadc_device *adc_dev, get_adc_chan_step_mask() argument 67 for (i = 0; i < ARRAY_SIZE(adc_dev->channel_step); i++) { get_adc_chan_step_mask() 68 if (chan->channel == adc_dev->channel_line[i]) { get_adc_chan_step_mask() 71 step = adc_dev->channel_step[i]; get_adc_chan_step_mask() 80 static u32 get_adc_step_bit(struct tiadc_device *adc_dev, int chan) get_adc_step_bit() argument 82 return 1 << adc_dev->channel_step[chan]; get_adc_step_bit() 87 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_step_config() local 107 for (i = 0; i < adc_dev->channels; i++) { tiadc_step_config() 110 chan = adc_dev->channel_line[i]; tiadc_step_config() 111 tiadc_writel(adc_dev, REG_STEPCONFIG(steps), tiadc_step_config() 113 tiadc_writel(adc_dev, REG_STEPDELAY(steps), tiadc_step_config() 115 adc_dev->channel_step[i] = steps; tiadc_step_config() 123 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_irq_h() local 125 status = tiadc_readl(adc_dev, REG_IRQSTATUS); tiadc_irq_h() 133 config = tiadc_readl(adc_dev, REG_CTRL); tiadc_irq_h() 135 tiadc_writel(adc_dev, REG_CTRL, config); tiadc_irq_h() 136 tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN tiadc_irq_h() 138 tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB)); tiadc_irq_h() 142 tiadc_writel(adc_dev, REG_IRQCLR, IRQENB_FIFO1THRES); tiadc_irq_h() 152 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_worker_h() local 154 u16 *data = adc_dev->data; tiadc_worker_h() 156 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); tiadc_worker_h() 159 read = tiadc_readl(adc_dev, REG_FIFO1); tiadc_worker_h() 165 tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1THRES); tiadc_worker_h() 166 tiadc_writel(adc_dev, REG_IRQENABLE, IRQENB_FIFO1THRES); tiadc_worker_h() 173 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_buffer_preenable() local 176 tiadc_writel(adc_dev, REG_IRQCLR, (IRQENB_FIFO1THRES | tiadc_buffer_preenable() 181 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); tiadc_buffer_preenable() 183 read = tiadc_readl(adc_dev, REG_FIFO1); tiadc_buffer_preenable() 190 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_buffer_postenable() local 195 for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels) tiadc_buffer_postenable() 196 enb |= (get_adc_step_bit(adc_dev, bit) << 1); tiadc_buffer_postenable() 197 adc_dev->buffer_en_ch_steps = enb; tiadc_buffer_postenable() 199 am335x_tsc_se_set_cache(adc_dev->mfd_tscadc, enb); tiadc_buffer_postenable() 201 tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1THRES tiadc_buffer_postenable() 203 tiadc_writel(adc_dev, REG_IRQENABLE, IRQENB_FIFO1THRES tiadc_buffer_postenable() 211 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_buffer_predisable() local 214 tiadc_writel(adc_dev, REG_IRQCLR, (IRQENB_FIFO1THRES | tiadc_buffer_predisable() 216 am335x_tsc_se_clr(adc_dev->mfd_tscadc, adc_dev->buffer_en_ch_steps); tiadc_buffer_predisable() 217 adc_dev->buffer_en_ch_steps = 0; tiadc_buffer_predisable() 220 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); tiadc_buffer_predisable() 222 read = tiadc_readl(adc_dev, REG_FIFO1); tiadc_buffer_predisable() 274 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_iio_buffered_hardware_remove() local 276 free_irq(adc_dev->mfd_tscadc->irq, indio_dev); tiadc_iio_buffered_hardware_remove() 294 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_channel_init() local 310 chan->channel = adc_dev->channel_line[i]; tiadc_channel_init() 333 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_read_raw() local 343 step_en = get_adc_chan_step_mask(adc_dev, chan); tiadc_read_raw() 347 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); tiadc_read_raw() 349 tiadc_readl(adc_dev, REG_FIFO1); tiadc_read_raw() 351 am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en); tiadc_read_raw() 354 (IDLE_TIMEOUT * adc_dev->channels); tiadc_read_raw() 357 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); tiadc_read_raw() 362 am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); tiadc_read_raw() 366 map_val = adc_dev->channel_step[chan->scan_index]; tiadc_read_raw() 376 read = tiadc_readl(adc_dev, REG_FIFO1); tiadc_read_raw() 386 am335x_tsc_se_adc_done(adc_dev->mfd_tscadc); tiadc_read_raw() 401 struct tiadc_device *adc_dev; tiadc_probe() local 420 adc_dev = iio_priv(indio_dev); tiadc_probe() 422 adc_dev->mfd_tscadc = ti_tscadc_dev_get(pdev); tiadc_probe() 425 adc_dev->channel_line[channels] = val; tiadc_probe() 428 adc_dev->channels = channels; tiadc_probe() 436 tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD); tiadc_probe() 438 err = tiadc_channel_init(indio_dev, adc_dev->channels); tiadc_probe() 445 adc_dev->mfd_tscadc->irq, tiadc_probe() 470 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_remove() local 477 step_en = get_adc_step_mask(adc_dev); tiadc_remove() 478 am335x_tsc_se_clr(adc_dev->mfd_tscadc, step_en); tiadc_remove() 487 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_suspend() local 493 idle = tiadc_readl(adc_dev, REG_CTRL); tiadc_suspend() 495 tiadc_writel(adc_dev, REG_CTRL, (idle | tiadc_suspend() 505 struct tiadc_device *adc_dev = iio_priv(indio_dev); tiadc_resume() local 509 restore = tiadc_readl(adc_dev, REG_CTRL); tiadc_resume() 511 tiadc_writel(adc_dev, REG_CTRL, restore); tiadc_resume() 514 am335x_tsc_se_set_cache(adc_dev->mfd_tscadc, tiadc_resume() 515 adc_dev->buffer_en_ch_steps); tiadc_resume()
|