From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Anthony Legault Cesta <anthony@alcmedia.com>
Cc: <linux-iio@vger.kernel.org>
Subject: Re: Controlling ADC SPI devices
Date: Fri, 23 Mar 2018 12:32:01 +0000 [thread overview]
Message-ID: <20180323133201.00006d75@huawei.com> (raw)
In-Reply-To: <58bf1805-774a-5b88-75cd-024199308491@alcmedia.com>
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
prev parent reply other threads:[~2018-03-23 12:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 17:46 Controlling ADC SPI devices Anthony Legault Cesta
2018-03-23 12:32 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180323133201.00006d75@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=anthony@alcmedia.com \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).