Lines Matching refs:indio_dev

85 static void tiadc_step_config(struct iio_dev *indio_dev)  in tiadc_step_config()  argument
87 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_step_config()
101 if (iio_buffer_enabled(indio_dev)) in tiadc_step_config()
122 struct iio_dev *indio_dev = private; in tiadc_irq_h() local
123 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_irq_h()
151 struct iio_dev *indio_dev = private; in tiadc_worker_h() local
152 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_worker_h()
158 for (i = 0; i < (indio_dev->scan_bytes)/2; i++) { in tiadc_worker_h()
162 iio_push_to_buffers(indio_dev, (u8 *) data); in tiadc_worker_h()
171 static int tiadc_buffer_preenable(struct iio_dev *indio_dev) in tiadc_buffer_preenable() argument
173 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_buffer_preenable()
188 static int tiadc_buffer_postenable(struct iio_dev *indio_dev) in tiadc_buffer_postenable() argument
190 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_buffer_postenable()
194 tiadc_step_config(indio_dev); in tiadc_buffer_postenable()
195 for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels) in tiadc_buffer_postenable()
209 static int tiadc_buffer_predisable(struct iio_dev *indio_dev) in tiadc_buffer_predisable() argument
211 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_buffer_predisable()
227 static int tiadc_buffer_postdisable(struct iio_dev *indio_dev) in tiadc_buffer_postdisable() argument
229 tiadc_step_config(indio_dev); in tiadc_buffer_postdisable()
241 static int tiadc_iio_buffered_hardware_setup(struct iio_dev *indio_dev, in tiadc_iio_buffered_hardware_setup() argument
255 iio_device_attach_buffer(indio_dev, buffer); in tiadc_iio_buffered_hardware_setup()
258 flags, indio_dev->name, indio_dev); in tiadc_iio_buffered_hardware_setup()
262 indio_dev->setup_ops = setup_ops; in tiadc_iio_buffered_hardware_setup()
263 indio_dev->modes |= INDIO_BUFFER_HARDWARE; in tiadc_iio_buffered_hardware_setup()
268 iio_kfifo_free(indio_dev->buffer); in tiadc_iio_buffered_hardware_setup()
272 static void tiadc_iio_buffered_hardware_remove(struct iio_dev *indio_dev) in tiadc_iio_buffered_hardware_remove() argument
274 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_iio_buffered_hardware_remove()
276 free_irq(adc_dev->mfd_tscadc->irq, indio_dev); in tiadc_iio_buffered_hardware_remove()
277 iio_kfifo_free(indio_dev->buffer); in tiadc_iio_buffered_hardware_remove()
292 static int tiadc_channel_init(struct iio_dev *indio_dev, int channels) in tiadc_channel_init() argument
294 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_channel_init()
299 indio_dev->num_channels = channels; in tiadc_channel_init()
319 indio_dev->channels = chan_array; in tiadc_channel_init()
324 static void tiadc_channels_remove(struct iio_dev *indio_dev) in tiadc_channels_remove() argument
326 kfree(indio_dev->channels); in tiadc_channels_remove()
329 static int tiadc_read_raw(struct iio_dev *indio_dev, in tiadc_read_raw() argument
333 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_read_raw()
340 if (iio_buffer_enabled(indio_dev)) in tiadc_read_raw()
400 struct iio_dev *indio_dev; in tiadc_probe() local
414 indio_dev = devm_iio_device_alloc(&pdev->dev, in tiadc_probe()
416 if (indio_dev == NULL) { in tiadc_probe()
420 adc_dev = iio_priv(indio_dev); in tiadc_probe()
430 indio_dev->dev.parent = &pdev->dev; in tiadc_probe()
431 indio_dev->name = dev_name(&pdev->dev); in tiadc_probe()
432 indio_dev->modes = INDIO_DIRECT_MODE; in tiadc_probe()
433 indio_dev->info = &tiadc_info; in tiadc_probe()
435 tiadc_step_config(indio_dev); in tiadc_probe()
438 err = tiadc_channel_init(indio_dev, adc_dev->channels); in tiadc_probe()
442 err = tiadc_iio_buffered_hardware_setup(indio_dev, in tiadc_probe()
452 err = iio_device_register(indio_dev); in tiadc_probe()
456 platform_set_drvdata(pdev, indio_dev); in tiadc_probe()
461 tiadc_iio_buffered_hardware_remove(indio_dev); in tiadc_probe()
463 tiadc_channels_remove(indio_dev); in tiadc_probe()
469 struct iio_dev *indio_dev = platform_get_drvdata(pdev); in tiadc_remove() local
470 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_remove()
473 iio_device_unregister(indio_dev); in tiadc_remove()
474 tiadc_iio_buffered_hardware_remove(indio_dev); in tiadc_remove()
475 tiadc_channels_remove(indio_dev); in tiadc_remove()
486 struct iio_dev *indio_dev = dev_get_drvdata(dev); in tiadc_suspend() local
487 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_suspend()
504 struct iio_dev *indio_dev = dev_get_drvdata(dev); in tiadc_resume() local
505 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_resume()
513 tiadc_step_config(indio_dev); in tiadc_resume()