Lines Matching refs:indio_dev
86 static void tiadc_step_config(struct iio_dev *indio_dev) in tiadc_step_config() argument
88 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_step_config()
122 if (iio_buffer_enabled(indio_dev)) in tiadc_step_config()
151 struct iio_dev *indio_dev = private; in tiadc_irq_h() local
152 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_irq_h()
180 struct iio_dev *indio_dev = private; in tiadc_worker_h() local
181 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_worker_h()
187 for (i = 0; i < (indio_dev->scan_bytes)/2; i++) { in tiadc_worker_h()
191 iio_push_to_buffers(indio_dev, (u8 *) data); in tiadc_worker_h()
200 static int tiadc_buffer_preenable(struct iio_dev *indio_dev) in tiadc_buffer_preenable() argument
202 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_buffer_preenable()
217 static int tiadc_buffer_postenable(struct iio_dev *indio_dev) in tiadc_buffer_postenable() argument
219 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_buffer_postenable()
223 tiadc_step_config(indio_dev); in tiadc_buffer_postenable()
224 for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels) in tiadc_buffer_postenable()
238 static int tiadc_buffer_predisable(struct iio_dev *indio_dev) in tiadc_buffer_predisable() argument
240 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_buffer_predisable()
256 static int tiadc_buffer_postdisable(struct iio_dev *indio_dev) in tiadc_buffer_postdisable() argument
258 tiadc_step_config(indio_dev); in tiadc_buffer_postdisable()
270 static int tiadc_iio_buffered_hardware_setup(struct iio_dev *indio_dev, in tiadc_iio_buffered_hardware_setup() argument
284 iio_device_attach_buffer(indio_dev, buffer); in tiadc_iio_buffered_hardware_setup()
287 flags, indio_dev->name, indio_dev); in tiadc_iio_buffered_hardware_setup()
291 indio_dev->setup_ops = setup_ops; in tiadc_iio_buffered_hardware_setup()
292 indio_dev->modes |= INDIO_BUFFER_SOFTWARE; in tiadc_iio_buffered_hardware_setup()
297 iio_kfifo_free(indio_dev->buffer); in tiadc_iio_buffered_hardware_setup()
301 static void tiadc_iio_buffered_hardware_remove(struct iio_dev *indio_dev) in tiadc_iio_buffered_hardware_remove() argument
303 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_iio_buffered_hardware_remove()
305 free_irq(adc_dev->mfd_tscadc->irq, indio_dev); in tiadc_iio_buffered_hardware_remove()
306 iio_kfifo_free(indio_dev->buffer); in tiadc_iio_buffered_hardware_remove()
321 static int tiadc_channel_init(struct iio_dev *indio_dev, int channels) in tiadc_channel_init() argument
323 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_channel_init()
328 indio_dev->num_channels = channels; in tiadc_channel_init()
348 indio_dev->channels = chan_array; in tiadc_channel_init()
353 static void tiadc_channels_remove(struct iio_dev *indio_dev) in tiadc_channels_remove() argument
355 kfree(indio_dev->channels); in tiadc_channels_remove()
358 static int tiadc_read_raw(struct iio_dev *indio_dev, in tiadc_read_raw() argument
362 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_read_raw()
369 if (iio_buffer_enabled(indio_dev)) in tiadc_read_raw()
460 struct iio_dev *indio_dev; in tiadc_probe() local
470 indio_dev = devm_iio_device_alloc(&pdev->dev, in tiadc_probe()
472 if (indio_dev == NULL) { in tiadc_probe()
476 adc_dev = iio_priv(indio_dev); in tiadc_probe()
481 indio_dev->dev.parent = &pdev->dev; in tiadc_probe()
482 indio_dev->name = dev_name(&pdev->dev); in tiadc_probe()
483 indio_dev->modes = INDIO_DIRECT_MODE; in tiadc_probe()
484 indio_dev->info = &tiadc_info; in tiadc_probe()
486 tiadc_step_config(indio_dev); in tiadc_probe()
489 err = tiadc_channel_init(indio_dev, adc_dev->channels); in tiadc_probe()
493 err = tiadc_iio_buffered_hardware_setup(indio_dev, in tiadc_probe()
503 err = iio_device_register(indio_dev); in tiadc_probe()
507 platform_set_drvdata(pdev, indio_dev); in tiadc_probe()
512 tiadc_iio_buffered_hardware_remove(indio_dev); in tiadc_probe()
514 tiadc_channels_remove(indio_dev); in tiadc_probe()
520 struct iio_dev *indio_dev = platform_get_drvdata(pdev); in tiadc_remove() local
521 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_remove()
524 iio_device_unregister(indio_dev); in tiadc_remove()
525 tiadc_iio_buffered_hardware_remove(indio_dev); in tiadc_remove()
526 tiadc_channels_remove(indio_dev); in tiadc_remove()
537 struct iio_dev *indio_dev = dev_get_drvdata(dev); in tiadc_suspend() local
538 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_suspend()
555 struct iio_dev *indio_dev = dev_get_drvdata(dev); in tiadc_resume() local
556 struct tiadc_device *adc_dev = iio_priv(indio_dev); in tiadc_resume()
564 tiadc_step_config(indio_dev); in tiadc_resume()