linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: lars@metafoo.de, Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH 4/5] staging:iio: dummy driver additions to show shared_by_dir infomask usage
Date: Sun, 18 Aug 2013 16:50:11 +0100	[thread overview]
Message-ID: <1376841012-7542-5-git-send-email-jic23@kernel.org> (raw)
In-Reply-To: <1376841012-7542-1-git-send-email-jic23@kernel.org>

Note that as this driver has output as well as output channels an
example of info_mask_shared_by_all that makes any sense does not exist.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/staging/iio/iio_simple_dummy.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index 0e8e02a..141ec61 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -90,6 +90,11 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
 		 * when converting to standard units (microvolts)
 		 */
 		BIT(IIO_CHAN_INFO_SCALE),
+		/*
+		 * sampling_frequency
+		 * The frequency in Hz at which the channels are sampled
+		 */
+		.info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ),
 		/* The ordering of elements in the buffer via an enum */
 		.scan_index = voltage0,
 		.scan_type = { /* Description of storage in buffer */
@@ -130,6 +135,10 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
 		 * input channels of type IIO_VOLTAGE.
 		 */
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
+		/*
+		 * sampling_frequency
+		 * The frequency in Hz at which the channels are sampled
+		 */
 		.scan_index = diffvoltage1m2,
 		.scan_type = { /* Description of storage in buffer */
 			.sign = 's', /* signed */
@@ -147,6 +156,7 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
 		.channel2 = 4,
 		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
+		.info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ),
 		.scan_index = diffvoltage3m4,
 		.scan_type = {
 			.sign = 's',
@@ -173,6 +183,7 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
 		 */
 		BIT(IIO_CHAN_INFO_CALIBSCALE) |
 		BIT(IIO_CHAN_INFO_CALIBBIAS),
+		.info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ),
 		.scan_index = accelx,
 		.scan_type = { /* Description of storage in buffer */
 			.sign = 's', /* signed */
@@ -272,6 +283,11 @@ static int iio_dummy_read_raw(struct iio_dev *indio_dev,
 		*val2 = st->accel_calibscale->val2;
 		ret = IIO_VAL_INT_PLUS_MICRO;
 		break;
+	case IIO_CHAN_INFO_SAMP_FREQ:
+		*val = 3;
+		*val2 = 33;
+		ret = IIO_VAL_INT_PLUS_NANO;
+		break;
 	default:
 		break;
 	}
-- 
1.8.3.4


  parent reply	other threads:[~2013-08-18 14:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-18 15:50 [PATCH V2 0/5] IIO: Refactor info_mask* and ext_info handling and introduce info_mask_shared_[by_all/by_type] Jonathan Cameron
2013-08-18 15:50 ` [PATCH 1/5] iio: drop info_mask from struct iio_dev Jonathan Cameron
2013-08-18 15:50 ` [PATCH 2/5] iio: refactor info mask and ext_info attribute creation Jonathan Cameron
2013-09-05 19:24   ` Lars-Peter Clausen
2013-09-08 14:24     ` Jonathan Cameron
2013-08-18 15:50 ` [PATCH 3/5] iio: add info_mask_[shared_by_dir/shared_by_all] Jonathan Cameron
2013-08-18 15:50 ` Jonathan Cameron [this message]
2013-08-18 15:50 ` [PATCH 5/5] iio:temperature:tmp006 put sampling_frequency in info_mask_shared_by_all Jonathan Cameron
2013-09-01 21:35 ` [PATCH V2 0/5] IIO: Refactor info_mask* and ext_info handling and introduce info_mask_shared_[by_all/by_type] Jonathan Cameron
2013-09-05 19:26 ` Lars-Peter Clausen
  -- strict thread matches above, loose matches on Subject: below --
2013-09-08 13:57 [PATCH V3 " Jonathan Cameron
2013-09-08 13:57 ` [PATCH 4/5] staging:iio: dummy driver additions to show shared_by_dir infomask usage Jonathan Cameron
2013-08-17 14:38 [PATCH 0/5] IIO: Refactor info_mask* handling and introduce info_mask_shared_[by_all/by_type] Jonathan Cameron
2013-08-17 14:39 ` [PATCH 4/5] staging:iio: dummy driver additions to show shared_by_dir infomask usage Jonathan Cameron

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=1376841012-7542-5-git-send-email-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --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).