linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 7/9] iio: hid-sensors: Added Inclinometer 3D
Date: Thu, 24 Oct 2013 12:11:55 +0100	[thread overview]
Message-ID: <5269007B.6060907@kernel.org> (raw)
In-Reply-To: <5268FF38.7000305@kernel.org>

On 10/24/13 12:06, Jonathan Cameron wrote:
> On 10/23/13 20:11, Srinivas Pandruvada wrote:
>> Added usage id processing for Inclinometer 3D. This uses IIO
>> interfaces for triggered buffer to present data to user
>> mode.This uses HID sensor framework for registering callback
>> events from the sensor hub.
>>
>> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Looks good.  One little comment inline... I'd probably not have mentioned that
> but as there is going to be another version fo the series, might as well tidy
> it up ;)

Just noticed another point to fix.  In read raw you have case 0:
We long ago defined IIO_CHAN_INFO_RAW to be 0 so please use the enum
rather than 0.

I'm guessing this might want some tidy up patches for any other remaining uses as well.

> 
> Thanks,
> 
>> +/* Channel definitions */
>> +static const struct iio_chan_spec incl_3d_channels[] = {
>> +	{
>> +		.type = IIO_INCLI,
>> +		.modified = 1,
>> +		.channel2 = IIO_MOD_X,
>> +		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
>> +		BIT(IIO_CHAN_INFO_SCALE) |
>> +		BIT(IIO_CHAN_INFO_SAMP_FREQ) |
>> +		BIT(IIO_CHAN_INFO_HYSTERESIS),
>> +		.scan_index = CHANNEL_SCAN_INDEX_X,
>> +	}, {
>> +		.type = IIO_INCLI,
>> +		.modified = 1,
>> +		.channel2 = IIO_MOD_Y,
>> +		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
>> +		BIT(IIO_CHAN_INFO_SCALE) |
>> +		BIT(IIO_CHAN_INFO_SAMP_FREQ) |
>> +		BIT(IIO_CHAN_INFO_HYSTERESIS),
>> +		.scan_index = CHANNEL_SCAN_INDEX_Y,
>> +	}, {
>> +		.type = IIO_INCLI,
>> +		.modified = 1,
>> +		.channel2 = IIO_MOD_Z,
>> +		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
>> +		BIT(IIO_CHAN_INFO_SCALE) |
>> +		BIT(IIO_CHAN_INFO_SAMP_FREQ) |
>> +		BIT(IIO_CHAN_INFO_HYSTERESIS),
>> +		.scan_index = CHANNEL_SCAN_INDEX_Z,
>> +	}
>> +};
>> +
>> +/* Adjust channel real bits based on report 
> This would be cleaner if it just took the channel in question?
> so
> static void incl_3d_adjust_channel_bit_mask(struct iio_chan_spec *chan,
> 					    int size)
> {
> 	chan->scan_type.sign = 's';
> 	/* Real storage bits will change based on the report desc. */
> 	chan->scan_type.realbits = size * 8;
> 	/* Maximum size of a sample to capture is u32 */
> 	chan->scan_type.storagebits = sizeof(u32) * 8;
> }
> 
> then call as
> 
> 	incl_3d_adjust_channel_bit_mask(&channels[CHANNEL_SCAN_INDEX_X],
> 				st->incl[CHANNEL_SCAN_INDEX_X].size);
> 
>> +static void incl_3d_adjust_channel_bit_mask(struct iio_chan_spec *channels,
>> +						int channel, int size)
>> +{
>> +	channels[channel].scan_type.sign = 's';
>> +	/* Real storage bits will change based on the report desc. */
>> +	channels[channel].scan_type.realbits = size * 8;
>> +	/* Maximum size of a sample to capture is u32 */
>> +	channels[channel].scan_type.storagebits = sizeof(u32) * 8;
>> +}
>> +
> ...
> --
> 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
> 

  reply	other threads:[~2013-10-24 10:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 19:11 [PATCH v2 1/9] iio: hid_Sensors: fix crash during trigger unregister Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 2/9] iio: hid-sensors: Add connection type Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 3/9] iio: hid-sensors: accelerometer: Add sensitivity Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 4/9] iio: hid-sensors: gyro : " Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 5/9] iio: hid-sensors: light/als " Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 6/9] iio: hid-sensors: magnetometer " Srinivas Pandruvada
2013-10-23 19:11 ` [PATCH v2 7/9] iio: hid-sensors: Added Inclinometer 3D Srinivas Pandruvada
2013-10-24 11:06   ` Jonathan Cameron
2013-10-24 11:11     ` Jonathan Cameron [this message]
2013-10-23 19:11 ` [PATCH v2 8/9] iio: Add channel modifiers for Quaternion Rotations Srinivas Pandruvada
2013-10-24 11:18   ` Jonathan Cameron
2013-10-24 15:17     ` Srinivas Pandruvada
2013-10-24 16:20       ` Jonathan Cameron
2013-10-28 23:44         ` Srinivas Pandruvada
2013-10-29  6:54           ` Jonathan Cameron
2013-10-23 19:11 ` [PATCH v2 9/9] iio: hid-sensors: Added device rotation support Srinivas Pandruvada
2013-10-24 10:42 ` [PATCH v2 1/9] iio: hid_Sensors: fix crash during trigger unregister Jonathan Cameron
2013-10-24 15:21   ` Lars-Peter Clausen
2013-10-24 15:40     ` Srinivas Pandruvada

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=5269007B.6060907@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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).