From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C7D4C43381 for ; Tue, 2 Apr 2019 06:51:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 461E1208E4 for ; Tue, 2 Apr 2019 06:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554187906; bh=6G4OFwWc34Tl8MhyKgCg9W/sQGnuFhaMLdTjeeA+5JA=; h=Subject:To:From:Date:List-ID:From; b=cVYFMPhplkblU36gRRrzdQGaTyIMl8yU78KtN4LFvqbe38H5kEf2qXwXNFfD0S3th lZs9GhfpZtbLm7dzYRduzTAwNwR1+UeSCCRlIY/hfPE7TuIU5E9erC3BDLqaX9tAD6 OY0+ujhGcOpl6pZRw0Q61LnCfNRzafw8rXTxufGo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726964AbfDBGvp (ORCPT ); Tue, 2 Apr 2019 02:51:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:44758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbfDBGvp (ORCPT ); Tue, 2 Apr 2019 02:51:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7732E20857; Tue, 2 Apr 2019 06:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554187905; bh=6G4OFwWc34Tl8MhyKgCg9W/sQGnuFhaMLdTjeeA+5JA=; h=Subject:To:From:Date:From; b=Eaq6PQTJ5p74/iHfECPYLYQjvPx25O+3bSrXpi/KnxcL0Rm0vFX5s+DtxxQzxbvaI rftPDxLWItZi2gbVe+ENYGJnJPY+ZpoRRs9WwNd8JpmrPk+VqrhFIrU4Tn8C0uSFBN NAumePddlz2QPq1dJtaLlNG51w/5auza7no4Ezt8= Subject: patch "iio: gyro: mpu3050: fix chip ID reading" added to staging-linus To: cerg2010cerg2010@mail.ru, Jonathan.Cameron@huawei.com, Stable@vger.kernel.org, linus.walleij@linaro.org From: Date: Tue, 02 Apr 2019 08:51:35 +0200 Message-ID: <155418789512568@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled iio: gyro: mpu3050: fix chip ID reading to my staging git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git in the staging-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From 409a51e0a4a5f908763191fae2c29008632eb712 Mon Sep 17 00:00:00 2001 From: Sergey Larin Date: Sat, 2 Mar 2019 19:54:55 +0300 Subject: iio: gyro: mpu3050: fix chip ID reading According to the datasheet, the last bit of CHIP_ID register controls I2C bus, and the first one is unused. Handle this correctly. Note that there are chips out there that have a value such that the id check currently fails. Signed-off-by: Sergey Larin Reviewed-by: Linus Walleij Cc: Signed-off-by: Jonathan Cameron --- drivers/iio/gyro/mpu3050-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c index 77fac81a3adc..5ddebede31a6 100644 --- a/drivers/iio/gyro/mpu3050-core.c +++ b/drivers/iio/gyro/mpu3050-core.c @@ -29,7 +29,8 @@ #include "mpu3050.h" -#define MPU3050_CHIP_ID 0x69 +#define MPU3050_CHIP_ID 0x68 +#define MPU3050_CHIP_ID_MASK 0x7E /* * Register map: anything suffixed *_H is a big-endian high byte and always @@ -1176,8 +1177,9 @@ int mpu3050_common_probe(struct device *dev, goto err_power_down; } - if (val != MPU3050_CHIP_ID) { - dev_err(dev, "unsupported chip id %02x\n", (u8)val); + if ((val & MPU3050_CHIP_ID_MASK) != MPU3050_CHIP_ID) { + dev_err(dev, "unsupported chip id %02x\n", + (u8)(val & MPU3050_CHIP_ID_MASK)); ret = -ENODEV; goto err_power_down; } -- 2.21.0