linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>, linux-iio@vger.kernel.org
Subject: Re: [PATCH 15/15 v2] iio: accel: kxsd9: Support reading a mounting matrix
Date: Sun, 18 Sep 2016 11:36:43 +0100	[thread overview]
Message-ID: <2c5df1ea-7f60-e913-a103-e7d0fdb8b3a9@kernel.org> (raw)
In-Reply-To: <be4c1eba-a716-57dc-1e39-ddf7214e714a@kernel.org>

On 04/09/16 17:51, Jonathan Cameron wrote:
> On 01/09/16 10:44, Linus Walleij wrote:
>> This adds support for the mounting matrix to the KXSD9 driver.
>>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> Well the identity matrix is nicely reported by my pre device tree
> board.
> 
> (yeah I know I could make it run off device tree but somehow
> it's never high on my list given I don't actually know of anyone
> other than me who still uses these ;)
> 
> So I'll give it a 
> Tested-by: Jonathan Cameron <jic23@kernel.org>
> 
> So all now tested as well as I'm going to on real hardware.
> No crashes and data is just as rubbish as I remember..
> 
> Will pick up once the fixes make it through.  Could
> conceivably not happen until after merge window. We will
> have to see.
> 
Applied.
> 
> Jonathan
>> ---
>> ChangeLog v1->v2:
>> - Rebase on the rest of the series.
>> ---
>>  drivers/iio/accel/kxsd9.c | 24 ++++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
>> index a28163b76e12..9af60ac70738 100644
>> --- a/drivers/iio/accel/kxsd9.c
>> +++ b/drivers/iio/accel/kxsd9.c
>> @@ -68,12 +68,14 @@
>>   * struct kxsd9_state - device related storage
>>   * @dev: pointer to the parent device
>>   * @map: regmap to the device
>> + * @orientation: mounting matrix, flipped axis etc
>>   * @regs: regulators for this device, VDD and IOVDD
>>   * @scale: the current scaling setting
>>   */
>>  struct kxsd9_state {
>>  	struct device *dev;
>>  	struct regmap *map;
>> +	struct iio_mount_matrix orientation;
>>  	struct regulator_bulk_data regs[2];
>>  	u8 scale;
>>  };
>> @@ -258,6 +260,20 @@ static const struct iio_buffer_setup_ops kxsd9_buffer_setup_ops = {
>>  	.postdisable = kxsd9_buffer_postdisable,
>>  };
>>  
>> +static const struct iio_mount_matrix *
>> +kxsd9_get_mount_matrix(const struct iio_dev *indio_dev,
>> +		       const struct iio_chan_spec *chan)
>> +{
>> +	struct kxsd9_state *st = iio_priv(indio_dev);
>> +
>> +	return &st->orientation;
>> +}
>> +
>> +static const struct iio_chan_spec_ext_info kxsd9_ext_info[] = {
>> +	IIO_MOUNT_MATRIX(IIO_SHARED_BY_TYPE, kxsd9_get_mount_matrix),
>> +	{ },
>> +};
>> +
>>  #define KXSD9_ACCEL_CHAN(axis, index)						\
>>  	{								\
>>  		.type = IIO_ACCEL,					\
>> @@ -266,6 +282,7 @@ static const struct iio_buffer_setup_ops kxsd9_buffer_setup_ops = {
>>  		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),		\
>>  		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |	\
>>  					BIT(IIO_CHAN_INFO_OFFSET),	\
>> +		.ext_info = kxsd9_ext_info,				\
>>  		.address = KXSD9_REG_##axis,				\
>>  		.scan_index = index,					\
>>  		.scan_type = {                                          \
>> @@ -403,6 +420,13 @@ int kxsd9_common_probe(struct device *dev,
>>  	indio_dev->modes = INDIO_DIRECT_MODE;
>>  	indio_dev->available_scan_masks = kxsd9_scan_masks;
>>  
>> +	/* Read the mounting matrix, if present */
>> +	ret = of_iio_read_mount_matrix(dev,
>> +				       "mount-matrix",
>> +				       &st->orientation);
>> +	if (ret)
>> +		return ret;
>> +
>>  	/* Fetch and turn on regulators */
>>  	st->regs[0].supply = kxsd9_reg_vdd;
>>  	st->regs[1].supply = kxsd9_reg_iovdd;
>>
> 
> --
> 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:[~2016-09-18 10:36 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01  9:44 [PATCH 01/15 v2] iio: accel: kxsd9: Fix scaling bug Linus Walleij
2016-09-01  9:44 ` [PATCH 02/15 v2] iio: accel: kxsd9: Split out transport mechanism Linus Walleij
2016-09-03 17:37   ` Jonathan Cameron
2016-09-03 19:29     ` Jonathan Cameron
2016-09-04 20:46       ` Linus Walleij
2016-09-18 10:06   ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 03/15 v2] iio: accel: kxsd9: split out a common remove() function Linus Walleij
2016-09-03 17:38   ` Jonathan Cameron
2016-09-03 19:29     ` Jonathan Cameron
2016-09-18 10:08       ` Jonathan Cameron
2016-09-04 16:33   ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 04/15 v2] iio: accel: kxsd9: Split out SPI transport Linus Walleij
2016-09-03 19:24   ` Jonathan Cameron
2016-09-03 19:29     ` Jonathan Cameron
2016-09-18 10:09       ` Jonathan Cameron
2016-09-04 16:33   ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 05/15 v2] iio: accel: kxsd9: Do away with the write2 helper Linus Walleij
2016-09-03 19:25   ` Jonathan Cameron
2016-09-03 19:30     ` Jonathan Cameron
2016-09-18 10:27       ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 06/15 v2] iio: accel: kxsd9: Convert to use regmap for transport Linus Walleij
2016-09-18 10:28   ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 07/15 v2] iio: accel: kxsd9: Add I2C transport Linus Walleij
2016-09-18 10:29   ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 08/15 v2] iio: accel: kxsd9: Drop the buffer lock Linus Walleij
2016-09-01  9:44 ` [PATCH 09/15 v2] iio: accel: kxsd9: Fix up offset and scaling Linus Walleij
2016-09-18 10:31   ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 10/15 v2] iio: accel: kxsd9: Add triggered buffer handling Linus Walleij
2016-09-04 16:40   ` Jonathan Cameron
2016-09-18 10:32     ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 11/15 v2] iio: accel: kxsd9: Deploy proper register bit defines Linus Walleij
2016-09-04 16:42   ` Jonathan Cameron
2016-09-18 10:33     ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 12/15 v2] iio: accel: kxsd9: Fetch and handle regulators Linus Walleij
2016-09-04 16:43   ` Jonathan Cameron
2016-09-18 10:35     ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 13/15 v2] iio: accel: kxsd9: Replace "parent" with "dev" Linus Walleij
2016-09-04 16:46   ` Jonathan Cameron
2016-09-18 10:35     ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 14/15 v2] iio: accel: kxsd9: Deploy system and runtime PM Linus Walleij
2016-09-04 16:48   ` Jonathan Cameron
2016-09-18 10:36     ` Jonathan Cameron
2016-09-01  9:44 ` [PATCH 15/15 v2] iio: accel: kxsd9: Support reading a mounting matrix Linus Walleij
2016-09-04 16:51   ` Jonathan Cameron
2016-09-18 10:36     ` Jonathan Cameron [this message]
2016-09-03 17:31 ` [PATCH 01/15 v2] iio: accel: kxsd9: Fix scaling bug 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=2c5df1ea-7f60-e913-a103-e7d0fdb8b3a9@kernel.org \
    --to=jic23@kernel.org \
    --cc=linus.walleij@linaro.org \
    --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).