Searched refs:adc_dev (Results 1 - 3 of 3) sorted by relevance

/linux-4.1.27/drivers/iio/adc/
H A Dcc10001_adc.c70 static inline void cc10001_adc_write_reg(struct cc10001_adc_device *adc_dev, cc10001_adc_write_reg() argument
73 writel(val, adc_dev->reg_base + reg); cc10001_adc_write_reg()
76 static inline u32 cc10001_adc_read_reg(struct cc10001_adc_device *adc_dev, cc10001_adc_read_reg() argument
79 return readl(adc_dev->reg_base + reg); cc10001_adc_read_reg()
82 static void cc10001_adc_power_up(struct cc10001_adc_device *adc_dev) cc10001_adc_power_up() argument
84 cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_DOWN, 0); cc10001_adc_power_up()
85 ndelay(adc_dev->start_delay_ns); cc10001_adc_power_up()
88 static void cc10001_adc_power_down(struct cc10001_adc_device *adc_dev) cc10001_adc_power_down() argument
90 cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_DOWN, cc10001_adc_power_down()
94 static void cc10001_adc_start(struct cc10001_adc_device *adc_dev, cc10001_adc_start() argument
101 cc10001_adc_write_reg(adc_dev, CC10001_ADC_CONFIG, val); cc10001_adc_start()
104 val = cc10001_adc_read_reg(adc_dev, CC10001_ADC_CONFIG); cc10001_adc_start()
106 cc10001_adc_write_reg(adc_dev, CC10001_ADC_CONFIG, val); cc10001_adc_start()
113 struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); cc10001_adc_poll_done() local
116 while (!(cc10001_adc_read_reg(adc_dev, CC10001_ADC_EOC) & cc10001_adc_poll_done()
125 while ((cc10001_adc_read_reg(adc_dev, CC10001_ADC_CHSEL_SAMPLED) & cc10001_adc_poll_done()
134 return cc10001_adc_read_reg(adc_dev, CC10001_ADC_DDATA_OUT) & cc10001_adc_poll_done()
140 struct cc10001_adc_device *adc_dev; cc10001_adc_trigger_h() local
151 adc_dev = iio_priv(indio_dev); cc10001_adc_trigger_h()
152 data = adc_dev->buf; cc10001_adc_trigger_h()
154 mutex_lock(&adc_dev->lock); cc10001_adc_trigger_h()
156 cc10001_adc_power_up(adc_dev); cc10001_adc_trigger_h()
159 delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; cc10001_adc_trigger_h()
167 cc10001_adc_start(adc_dev, channel); cc10001_adc_trigger_h()
180 cc10001_adc_power_down(adc_dev); cc10001_adc_trigger_h()
182 mutex_unlock(&adc_dev->lock); cc10001_adc_trigger_h()
195 struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); cc10001_adc_read_raw_voltage() local
199 cc10001_adc_power_up(adc_dev); cc10001_adc_read_raw_voltage()
202 delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; cc10001_adc_read_raw_voltage()
204 cc10001_adc_start(adc_dev, chan->channel); cc10001_adc_read_raw_voltage()
208 cc10001_adc_power_down(adc_dev); cc10001_adc_read_raw_voltage()
217 struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); cc10001_adc_read_raw() local
224 mutex_lock(&adc_dev->lock); cc10001_adc_read_raw()
226 mutex_unlock(&adc_dev->lock); cc10001_adc_read_raw()
233 ret = regulator_get_voltage(adc_dev->reg); cc10001_adc_read_raw()
249 struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); cc10001_update_scan_mode() local
251 kfree(adc_dev->buf); cc10001_update_scan_mode()
252 adc_dev->buf = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); cc10001_update_scan_mode()
253 if (!adc_dev->buf) cc10001_update_scan_mode()
311 struct cc10001_adc_device *adc_dev; cc10001_adc_probe() local
318 indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev)); cc10001_adc_probe()
322 adc_dev = iio_priv(indio_dev); cc10001_adc_probe()
328 adc_dev->reg = devm_regulator_get(&pdev->dev, "vref"); cc10001_adc_probe()
329 if (IS_ERR(adc_dev->reg)) cc10001_adc_probe()
330 return PTR_ERR(adc_dev->reg); cc10001_adc_probe()
332 ret = regulator_enable(adc_dev->reg); cc10001_adc_probe()
342 adc_dev->reg_base = devm_ioremap_resource(&pdev->dev, res); cc10001_adc_probe()
343 if (IS_ERR(adc_dev->reg_base)) { cc10001_adc_probe()
344 ret = PTR_ERR(adc_dev->reg_base); cc10001_adc_probe()
348 adc_dev->adc_clk = devm_clk_get(&pdev->dev, "adc"); cc10001_adc_probe()
349 if (IS_ERR(adc_dev->adc_clk)) { cc10001_adc_probe()
351 ret = PTR_ERR(adc_dev->adc_clk); cc10001_adc_probe()
355 ret = clk_prepare_enable(adc_dev->adc_clk); cc10001_adc_probe()
361 adc_clk_rate = clk_get_rate(adc_dev->adc_clk); cc10001_adc_probe()
368 adc_dev->eoc_delay_ns = NSEC_PER_SEC / adc_clk_rate; cc10001_adc_probe()
369 adc_dev->start_delay_ns = adc_dev->eoc_delay_ns * CC10001_WAIT_CYCLES; cc10001_adc_probe()
376 mutex_init(&adc_dev->lock); cc10001_adc_probe()
394 clk_disable_unprepare(adc_dev->adc_clk); cc10001_adc_probe()
396 regulator_disable(adc_dev->reg); cc10001_adc_probe()
403 struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); cc10001_adc_remove() local
407 clk_disable_unprepare(adc_dev->adc_clk); cc10001_adc_remove()
408 regulator_disable(adc_dev->reg); cc10001_adc_remove()
H A Dti_am335x_adc.c53 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()
/linux-4.1.27/arch/arm/plat-samsung/
H A Dadc.c81 static struct adc_device *adc_dev; variable in typeref:struct:adc_device
152 struct adc_device *adc = adc_dev; s3c_adc_start()
260 spin_lock_irqsave(&adc_dev->lock, flags); s3c_adc_release()
263 if (adc_dev->cur == client) s3c_adc_release()
264 adc_dev->cur = NULL; s3c_adc_release()
265 if (adc_dev->ts_pend == client) s3c_adc_release()
266 adc_dev->ts_pend = NULL; s3c_adc_release()
278 if (adc_dev->cur == NULL) s3c_adc_release()
279 s3c_adc_try(adc_dev); s3c_adc_release()
281 spin_unlock_irqrestore(&adc_dev->lock, flags); s3c_adc_release()
407 adc_dev = adc; s3c_adc_probe()

Completed in 114 milliseconds