Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp330640ybk; Wed, 20 May 2020 00:22:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5Y0TgQaHkvdsJLb8O7MuqTfidNkTYWI5neh90osZhYd6BXp2oyiPX/TnieBeX7+ElUev3 X-Received: by 2002:a17:906:6893:: with SMTP id n19mr2838958ejr.354.1589959333690; Wed, 20 May 2020 00:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589959333; cv=none; d=google.com; s=arc-20160816; b=s/jvDTYKtcYzVZ+vgHSjpeBVd/qGdgujHZCfXjDtmTfXiZDVf8ol5DbBcJa9e02+U0 dTZnZGf22QmT6KWbnR1NQMXOP8Y/47iwKRf+RN1G+oI++mobntumyEy2cmykrEIgvREv ctuMeDVr3BEW9iNRKC8nVzQ/Luo+sGp9kHhbTYXR92i1UMKYmTrZ7uLvmmuMnQqkwBrL LC10vBfP0GoSvPW/KT9G3ClNUDWrGVrpWnIAZ+qfQAzH8ZvA9L9Ab11TDzoyPZvOHzvv /n8gnNxo6WuHsS5TaazTiQQiaAO7l8AFjf1xgFzK+ZElQlg++xA+j7d6ciA/v4ZB3y0E kokA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KJJ3CIQ3eS61c6M1oqeo99mJ8m4fWRgRHozAzbIZeNM=; b=SE/sQ73IckAWuwodFEPdwGptqxdvcnhzW8RLbA72mnne9AVu+k4xvgdV06u1cAFo+Y NG/F/qrN+0tRUIt4F+nlaeK6Vt1WRXs+zvmMsUuW/9igGC/NDLhFRHs4oaeOXkR6gygc 9FY6MlRjf0qcoRJYUWxkgNT8HAItTcYONZQGSNId+57o72b9UHWF/1z1t5HeIvS5K52b 9/gLAygwWQolp8RTUVhEKPbiZlOrhGUbgVhxgCK8mT66LgBTCH8Q1SLZzBRgYuoAAlBT nuJ5R8OJkX8RWLCKxKNWQfwTsrN7myF3vNZhw4Zpx3rLGnqBtusBxicBbK5dxiOU/GXl bK1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LRZrq5BE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do2si1303483ejc.178.2020.05.20.00.21.51; Wed, 20 May 2020 00:22:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LRZrq5BE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726562AbgETHUZ (ORCPT + 99 others); Wed, 20 May 2020 03:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgETHUV (ORCPT ); Wed, 20 May 2020 03:20:21 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C38C061A0E; Wed, 20 May 2020 00:20:21 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id b6so2559354qkh.11; Wed, 20 May 2020 00:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KJJ3CIQ3eS61c6M1oqeo99mJ8m4fWRgRHozAzbIZeNM=; b=LRZrq5BEyc8bsZPFvTw8/Wu6UQ/FDzriYjDgYmAilB1y/RnF4cqCKzpQeaFqngy6NK M83IoTQsHmgJKX25w0U3tspNjEpLwBukbNEVx4TFGfz3TQNU9X8AtcYqjHTXM7u20HYY zdL3fLf5nf+gLLahG8Mi+prKatIT+GSuC3pZm4ehhSAIj6nOCU1gGqpptlPVyNodhd5K fcLKfWPjf3ytMkzqMSa5zB1X6z6KbXoM6B6rZa9PizgBFIQqEwj9s3t+cD8DGkb0OquZ OShh/t7JGj65Nf1aFV+nVnIQs4TeaPpUeQGt5+t1nJAXcgpH0SZKftobuDPV5zCo+1/B 7DCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KJJ3CIQ3eS61c6M1oqeo99mJ8m4fWRgRHozAzbIZeNM=; b=sP8G53OTN6ZDf52w8F1Vznu4z64re8W7G39v3IkdTd0xg8rH6aYrEwSbwJ7kqo7kuQ xPb0+gi9m7OUYFIvVeJou1iMw+fwoGdIfJ0MAPMGWfDiVn+UFbjyQnNyVg1ZKxeAsRf+ WlGQ5AESlS59IZ57ipcArUOIu689aySWOaBzkNJaLxW6X7ECwbRKZ5vw9FJ095Y3Hlbq DNl0U6LnmoqRMWh3HtSfaT82e2/wiPQ2lBUQKVVZ5a8B5IZPoPZJbLi6YBjY2FwcPCkq vxo1Ei9zHe6cuUr4SMcNFKKI+/wTHAGlOLPRbz6NOyGuNOMohsI6HgTWf5iRgppsxZuo zdEg== X-Gm-Message-State: AOAM532D5SVjii/57ou+OuwZ3d1blAWru63bM2P3H+2c5uBtRyh8KX0E p4RFfvs8y7GGAdvE8kWrQXY= X-Received: by 2002:a05:620a:1524:: with SMTP id n4mr3381252qkk.490.1589959220413; Wed, 20 May 2020 00:20:20 -0700 (PDT) Received: from ict14-OptiPlex-980 ([178.23.248.46]) by smtp.gmail.com with ESMTPSA id j188sm754003qkd.118.2020.05.20.00.20.18 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 May 2020 00:20:19 -0700 (PDT) Date: Wed, 20 May 2020 09:20:16 +0200 From: Jonathan Albrieux To: Jonathan Cameron Cc: linux-kernel@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Hartmut Knaack , Lars-Peter Clausen , "open list:IIO SUBSYSTEM AND DRIVERS" , Peter Meerwald-Stadler , Jonathan Cameron Subject: Re: [PATCH v2 4/4] iio: imu: bmi160: added mount-matrix support Message-ID: <20200520072016.GE3361@ict14-OptiPlex-980> References: <20200519075111.6356-1-jonathan.albrieux@gmail.com> <20200519075111.6356-5-jonathan.albrieux@gmail.com> <20200519185711.00003308@Huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200519185711.00003308@Huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2020 at 06:57:11PM +0100, Jonathan Cameron wrote: > On Tue, 19 May 2020 09:51:00 +0200 > Jonathan Albrieux wrote: > > > Add mount-matrix binding support. As chip could have different orientations > > a mount matrix support is needed to correctly translate these differences > > > > Signed-off-by: Jonathan Albrieux > Hi Jonathan, > > Looks good to me. I'll pick this up once 1-3 are tidied up and > we have a device tree review in for the binding doc. I'm rubbish > at reviewing those as Rob will certify so may well have missed something! > > Jonathan > > Thank you! I'm going to work on suggestions now, Best regards, Jonathan Albrieux > > > --- > > drivers/iio/imu/bmi160/bmi160.h | 1 + > > drivers/iio/imu/bmi160/bmi160_core.c | 20 ++++++++++++++++++++ > > 2 files changed, 21 insertions(+) > > > > diff --git a/drivers/iio/imu/bmi160/bmi160.h b/drivers/iio/imu/bmi160/bmi160.h > > index 923c3b274fde..a82e040bd109 100644 > > --- a/drivers/iio/imu/bmi160/bmi160.h > > +++ b/drivers/iio/imu/bmi160/bmi160.h > > @@ -9,6 +9,7 @@ struct bmi160_data { > > struct regmap *regmap; > > struct iio_trigger *trig; > > struct regulator_bulk_data supplies[2]; > > + struct iio_mount_matrix orientation; > > }; > > > > extern const struct regmap_config bmi160_regmap_config; > > diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c > > index 9bbe0d8e6720..78c8ca962359 100644 > > --- a/drivers/iio/imu/bmi160/bmi160_core.c > > +++ b/drivers/iio/imu/bmi160/bmi160_core.c > > @@ -110,6 +110,7 @@ > > .storagebits = 16, \ > > .endianness = IIO_LE, \ > > }, \ > > + .ext_info = bmi160_ext_info, \ > > } > > > > /* scan indexes follow DATA register order */ > > @@ -265,6 +266,20 @@ static const struct bmi160_odr_item bmi160_odr_table[] = { > > }, > > }; > > > > +static const struct iio_mount_matrix * > > +bmi160_get_mount_matrix(const struct iio_dev *indio_dev, > > + const struct iio_chan_spec *chan) > > +{ > > + struct bmi160_data *data = iio_priv(indio_dev); > > + > > + return &data->orientation; > > +} > > + > > +static const struct iio_chan_spec_ext_info bmi160_ext_info[] = { > > + IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, bmi160_get_mount_matrix), > > + { } > > +}; > > + > > static const struct iio_chan_spec bmi160_channels[] = { > > BMI160_CHANNEL(IIO_ACCEL, X, BMI160_SCAN_ACCEL_X), > > BMI160_CHANNEL(IIO_ACCEL, Y, BMI160_SCAN_ACCEL_Y), > > @@ -840,6 +855,11 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap, > > return ret; > > } > > > > + ret = iio_read_mount_matrix(dev, "mount-matrix", > > + &data->orientation); > > + if (ret) > > + return ret; > > + > > ret = bmi160_chip_init(data, use_spi); > > if (ret) > > return ret; > >