Re: Controlling ADC SPI devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 21 Mar 2018 13:46:53 -0400
Anthony Legault Cesta <anthony@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux