* Controlling ADC SPI devices
@ 2018-03-21 17:46 Anthony Legault Cesta
2018-03-23 12:32 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Anthony Legault Cesta @ 2018-03-21 17:46 UTC (permalink / raw)
To: linux-iio
Hello,
my name's Anthony & I need some help with the following:
Reading ADC values from mcp3208 on the spi bus within my custom made
kernel module.
I'm able to read spi values thru /sys/bus/iio/devices/iio:device0 no
problems but I need access it from within my drivers.
I've tried using dev_to_iio_dev(dev) but can't seem to claim the *dev
allocated for the spi device.
How can I get a ref * to the device?
How can I tackle this using iio method?
Thanks i advanced!
Anthony
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Controlling ADC SPI devices
2018-03-21 17:46 Controlling ADC SPI devices Anthony Legault Cesta
@ 2018-03-23 12:32 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2018-03-23 12:32 UTC (permalink / raw)
To: Anthony Legault Cesta; +Cc: linux-iio
On Wed, 21 Mar 2018 13:46:53 -0400
Anthony Legault Cesta <anthony@alcmedia.com> wrote:
> Hello,
>
> my name's Anthony & I need some help with the following:
>
> Reading ADC values from mcp3208 on the spi bus within my custom made
> kernel module.
>
> I'm able to read spi values thru /sys/bus/iio/devices/iio:device0 no
> problems but I need access it from within my drivers.
>
> I've tried using dev_to_iio_dev(dev) but can't seem to claim the *dev
> allocated for the spi device.
>
> How can I get a ref * to the device?
>
> How can I tackle this using iio method?
Hi Anthony,
I am a little unclear of what you are trying to accomplish.
Do you simply want to be able to read a value from the device from
another driver or set some control parameters?
If so we have the in kernel interfaces that allow you to do
so in either polled mode (Similar to sysfs operation) or in
buffered mode (similar to buffered mode via the IIO chrdev).
They are in the inkern.c file and iio/consumer.h.
To do that you have to register the relevant channel maps either
in code, or using the devicetree. There are quite a few examples
in tree.
Jonathan
>
> Thanks i advanced!
>
>
> Anthony
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-23 12:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-21 17:46 Controlling ADC SPI devices Anthony Legault Cesta
2018-03-23 12:32 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.