Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp430365rdb; Sat, 30 Sep 2023 09:52:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKw+2WVpAtq5eKVnmlx5q01mZFOs9Y3u5yv5eXWI17DVu9Wnh4ku8f5VZgkiBqr8NeoOPP X-Received: by 2002:a17:902:ea93:b0:1c7:49dd:2df with SMTP id x19-20020a170902ea9300b001c749dd02dfmr3671853plb.32.1696092759978; Sat, 30 Sep 2023 09:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696092759; cv=none; d=google.com; s=arc-20160816; b=PMlY0oiHpdAqVVLpmH4Gcx2+piMJIJoivvpJljcl1lMv9Fs1wNCbNy5TDZ7uu3SS5O +mMK46BK+JhzxYcaiESeNUd6NYAPBsAzCbLyWbDkA7TsWXiUKpOuc3KgDunzXuiS5IiS bCApMpgx9GSZZgofwBtUOORkH7hB73fzvuVOJz1mbeI7UxXU95I5BInE2QFPaj2X61CZ To2l53gonIRMA+GY0eBMQO+yo+qmoRgGHeLY3iJV+QdPKUVTsFu3LfNq8yITbIy7KGEk yGPhLg0GK3+1lbDTT+SSH/7ZOMCNxmiwRQvZ3kPTE49js/1dRAZw2S+P7pgyaWXs4Fle +vMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=v87YgpmRJ5HkXwb+T3/xq/XJ1kA/TwGOJUqIGl6UhmU=; fh=UKlt1LJcZa+EXDBDEPPVNOfa3ZzHKgse48Yeraq1+mE=; b=VUopXnUM3TO7tnoCZlEdJZ0rJ+NRrx7HU7S9Kkh5bLnsVY5zlOj8oBGuUHjYeYXD6y LST4B+186/HK/UqdOxKdKUlwdApSGRfLQwp+coJgC5o/VADdZevmTJivyPqF+1DcYLkp PGRJ+qC5yHT0wk2zqw/4olPLgn4cfencZ9sIZvj3vOsrY6vM73xvYXbTyD89/GvG57Wg 7NFdx6DshKvpYQh4IVIjzbYAKJdNhMESsFZAfbYTppN5ZoaIIxttekGY2/WtKNTFQcII 5zaeK92xfm0tlVQV9z0C0WsJ4df2ZnupHQi6niQZranjQPODU1grcAEj/I4gX9Bv33lX yQxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OkTb5oFV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id c18-20020a170902d49200b001b886d36bf6si24734722plg.226.2023.09.30.09.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 09:52:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OkTb5oFV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 24ECE80215B1; Sat, 30 Sep 2023 09:51:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234573AbjI3Qup (ORCPT + 99 others); Sat, 30 Sep 2023 12:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234543AbjI3Quo (ORCPT ); Sat, 30 Sep 2023 12:50:44 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E69FEAB; Sat, 30 Sep 2023 09:50:41 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ECC6C433C8; Sat, 30 Sep 2023 16:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696092641; bh=OTkb1E0PPw2D7ygMLBvwA1rj6YmAqeA4kxe9Z0cnOC4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OkTb5oFVCWTIRcVf3Mw5n2rvmNYhADdI4BU9nErg65ZEpxqZUrqjtUnFT+RTznZyb H6lBWGJ8cisApYVtvTfG+BKwDZbAWXItMpeDBVnrdUalYeppLZFMuWjV+i90E21T7O 2drd89tICMtFz1YbSeNo4eSqFa6zHilmNzrmOAGEi9o0qMWAhRQz66gEk6H94P/6Q1 zeEaCvVTXWOtoqMzL4Iqn7GerPvwtiauqyq/fAIzDc0eLS3RNEfwgU9Tkf50rB0FOe R09j4sKGm6BbGs1TaYDPSc37w56kRsoeONIPZXSoVJgIZMjozeqYFpJalz7Hc2RtC7 jU9J8klPnAyog== Date: Sat, 30 Sep 2023 17:50:39 +0100 From: Jonathan Cameron To: Jean-Baptiste Maneyrol Cc: Andreas Kemnade , "lars@metafoo.de" , "robh+dt@kernel.org" , "krzysztof.kozlowski+dt@linaro.org" , "conor+dt@kernel.org" , "bcousson@baylibre.com" , "tony@atomide.com" , "chenhuiz@axis.com" , "andy.shevchenko@gmail.com" , "linux-iio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-omap@vger.kernel.org" Subject: Re: [PATCH v3 2/3] iio: imu: mpu6050: add level shifter flag Message-ID: <20230930175039.2d311d6b@jic23-huawei> In-Reply-To: References: <20230927173245.2151083-1-andreas@kemnade.info> <20230927173245.2151083-3-andreas@kemnade.info> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 30 Sep 2023 09:51:01 -0700 (PDT) On Wed, 27 Sep 2023 19:08:31 +0000 Jean-Baptiste Maneyrol wrote: > Hello, >=20 > looks good for me. >=20 > Acked-by: Jean-Baptiste Maneyrol Applied patches 1 and 2 to the togreg branch of iio.git which I will initially push out as testing to let 0-day poke at it, Thanks, Jonathan >=20 > Thanks, > JB >=20 >=20 > From: Andreas Kemnade > Sent: Wednesday, September 27, 2023 19:32 > To: jic23@kernel.org ; lars@metafoo.de ; robh+dt@kernel.org ; krzysztof.kozlowski+dt@linaro.o= rg ; conor+dt@kernel.org ; bcousson@baylibre.com ; tony@atomide.com ; andreas@kemnade.info ; chenhuiz@axis= .com ; Jean-Baptiste Maneyrol ; andy.shevchenko@gmail.com ; linux-iio@vg= er.kernel.org ; devicetree@vger.kernel.org ; linux-kernel@vger.kernel.org ; linux-omap@vger.kernel.org > Subject: [PATCH v3 2/3] iio: imu: mpu6050: add level shifter flag=20 > =C2=A0 > Some boards fail in magnetometer probe if level shifter flag is not set, = definition was found in the vendor Linux kernel v3.=E2=80=8A0. Signed-off-b= y: Andreas Kemnade Reviewed-by: An= dy Shevchenko =20 > ZjQcmQRYFpfptBannerStart > This Message Is From an External Sender=20 > This message came from outside your organization.=20 > =C2=A0 > ZjQcmQRYFpfptBannerEnd > Some boards fail in magnetometer probe if level shifter flag is not set, > definition was found in the vendor Linux kernel v3.0. >=20 > Signed-off-by: Andreas Kemnade > Reviewed-by: Andy Shevchenko > --- > drivers/iio/imu/inv_mpu6050/inv_mpu_aux.c | 13 +++++++++++++ > drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 3 +++ > drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 1 + > 3 files changed, 17 insertions(+) >=20 > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_aux.c b/drivers/iio/imu/= inv_mpu6050/inv_mpu_aux.c > index 7327e5723f961..8a7f2911905af 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_aux.c > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_aux.c > @@ -71,6 +71,19 @@ int inv_mpu_aux_init(const struct inv_mpu6050_state *s= t) > unsigned int val; > int ret; > =20 > + /* > + * Code based on the vendor Linux kernel v3.0, > + * the exact meaning is unknown. > + */ > + if (st->chip_type =3D=3D INV_MPU9150) { > + unsigned int mask =3D BIT(7); > + > + val =3D st->level_shifter ? mask : 0; > + ret =3D regmap_update_bits(st->map, 0x1, mask, val); > + if (ret) > + return ret; > + } > + > /* configure i2c master */ > val =3D INV_MPU6050_BITS_I2C_MST_CLK_400KHZ | > INV_MPU6050_BIT_WAIT_FOR_ES; > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu= /inv_mpu6050/inv_mpu_core.c > index 29f906c884bd8..3fbeef1a70186 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > =20 > #include > #include > @@ -1495,6 +1496,8 @@ int inv_mpu_core_probe(struct regmap *regmap, int i= rq, const char *name, > st->irq =3D irq; > st->map =3D regmap; > =20 > + st->level_shifter =3D device_property_read_bool(dev, > + "invensense,level-shifter"); > pdata =3D dev_get_platdata(dev); > if (!pdata) { > result =3D iio_read_mount_matrix(dev, &st->orientation); > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/= inv_mpu6050/inv_mpu_iio.h > index ed5a96e78df05..7eba1439c8093 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h > @@ -203,6 +203,7 @@ struct inv_mpu6050_state { > s32 magn_raw_to_gauss[3]; > struct iio_mount_matrix magn_orient; > unsigned int suspended_sensors; > + bool level_shifter; > u8 *data; > }; > =20