linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
To: jic23@kernel.org
Cc: pali.rohar@gmail.com, pavel@ucw.cz, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Ivaylo Dimitrov <freemangordon@abv.bg>,
	Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Subject: [PATCH] iio: tsl2563: Initialize channels
Date: Sun, 12 Jan 2014 21:54:24 +0200	[thread overview]
Message-ID: <1389556464-692-1-git-send-email-ivo.g.dimitrov.75@gmail.com> (raw)

From: Ivaylo Dimitrov <freemangordon@abv.bg>

Correctly initialize device channels, otherwise writing the calibration
values to sysfs nodes does not work

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
---
 drivers/iio/light/tsl2563.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index 5e5d9de..a663ea2 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -460,7 +460,7 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev,
 {
 	struct tsl2563_chip *chip = iio_priv(indio_dev);
 
-	if (chan->channel == IIO_MOD_LIGHT_BOTH)
+	if (chan->channel == 0)
 		chip->calib0 = calib_from_sysfs(val);
 	else
 		chip->calib1 = calib_from_sysfs(val);
@@ -543,11 +543,12 @@ static const struct iio_event_spec tsl2563_events[] = {
 static const struct iio_chan_spec tsl2563_channels[] = {
 	{
 		.type = IIO_LIGHT,
+		.channel = 0,
 		.indexed = 1,
 		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
-		.channel = 0,
 	}, {
 		.type = IIO_INTENSITY,
+		.channel = 0,
 		.modified = 1,
 		.channel2 = IIO_MOD_LIGHT_BOTH,
 		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
@@ -556,6 +557,7 @@ static const struct iio_chan_spec tsl2563_channels[] = {
 		.num_event_specs = ARRAY_SIZE(tsl2563_events),
 	}, {
 		.type = IIO_INTENSITY,
+		.channel = 1,
 		.modified = 1,
 		.channel2 = IIO_MOD_LIGHT_IR,
 		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
-- 
1.5.6.1


             reply	other threads:[~2014-01-12 19:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-12 19:54 Ivaylo Dimitrov [this message]
2014-01-12 20:55 ` [PATCH] iio: tsl2563: Initialize channels Peter Meerwald
2014-01-12 21:08   ` Ivaylo Dimitrov
2014-01-12 21:41     ` Jonathan Cameron
2014-01-13 17:24       ` [PATCH] iio: tsl2563: Use the correct channel2 member Ivaylo Dimitrov
2014-01-13 21:25         ` Peter Meerwald
2014-01-18 11:37           ` Jonathan Cameron
2014-01-18 11:38             ` 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=1389556464-692-1-git-send-email-ivo.g.dimitrov.75@gmail.com \
    --to=ivo.g.dimitrov.75@gmail.com \
    --cc=freemangordon@abv.bg \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=pavel@ucw.cz \
    /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).