Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4026921ybl; Mon, 3 Feb 2020 11:06:56 -0800 (PST) X-Google-Smtp-Source: APXvYqx5Ixfq/YzZi49J2i+oMAdBFfqjqwKkE8Tt/n92MZsNEeVc8yaIW1tzrBYLPCV4nxAAtRWJ X-Received: by 2002:aca:b70a:: with SMTP id h10mr406964oif.20.1580756815852; Mon, 03 Feb 2020 11:06:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580756815; cv=none; d=google.com; s=arc-20160816; b=VeF78hdNQMsJGIcNH927V4hFnrhmcROHW3B++k8AALV3JRjyc3ZycDytwbrXXX62KB 7ykFnfb8wlXg8z58IcqRTQ1jE5DVEJ4jMpuGPZFLDVb12lJUzJsHd1NWc/HVu59e7OdK dvw/hiZ/rEcODQhwmFvv+7S3O0ZyDByvOnqxA2j4+qPeS9126cY0FtRvLTS8f4cOAz+R d23NORHe163Az93oiKfmh6QfSCDboEyrcEGHuCeGVRmupWB2uzQaacfTPgr3JLlzL3VP WnUDqPVbqqGMrUQ8aFgC8XgdP8usR5rWyot7CSBwZPhadZY7vgOSDF6hzygamIJ101Sz 7EEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WzrdT4m/mWUUG/xhjg7xu+7VUClAVTCg2+eV++hPUAM=; b=DTTysJbfOj2mzqZAsZQfpROjAfbljq1v773Czb9R0U9sC47S2NF8sDBPazJR4H6Up3 KwscikE5Ik3WHqgY6l4Yd3/7vv9xZEsRRgvBp5IiIqFIz56Gu6JMNl5LbeYBdFVkmSiq DgYD7QgWP5b7h60jTg2I25PaPXpokQ2ghCCa4bOs8KhAQewnXA4dG9xy1vPv60nLbGc/ BP360DksuhgQCckuQLg3vk4oukAiJn2pwP8Fid92tQ9Rhljcylt5+MACFoghN9VWghcf Yc5Xr4F3RHc3iLYCCybTNFiurHIkaA1pbaUbt+3nXhW7CbhxQqatgJxvO3miQYjt8mQE HMTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="a7PTy/nz"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y19si3889275oto.102.2020.02.03.11.06.43; Mon, 03 Feb 2020 11:06:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="a7PTy/nz"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729683AbgBCQst (ORCPT + 99 others); Mon, 3 Feb 2020 11:48:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:36486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728647AbgBCQZo (ORCPT ); Mon, 3 Feb 2020 11:25:44 -0500 Received: from localhost (unknown [104.132.45.99]) (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 7F37321582; Mon, 3 Feb 2020 16:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747143; bh=g/+wUwjKhuioqfJaajiZ0MXi6QiA3adqp7R+cE0Pu58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a7PTy/nzpGYtTQy11Xe8mvV87RqUbU6vOygbtIF0jZDlqm1izAIAEOLdrK9FiiCWU VWzR5tHFsWvqnS9rkAXcKGTn6WsIhhjLl6ITc8LG7DXClz1Ylt+Kkt53DNKmgjVGWX xsRfa7FthJ4IDe+/E1i1QQDlAnxI+pZXGIpKdpmw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.9 29/68] iio: gyro: st_gyro: fix L3GD20H support Date: Mon, 3 Feb 2020 16:19:25 +0000 Message-Id: <20200203161909.808486209@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161904.705434837@linuxfoundation.org> References: <20200203161904.705434837@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenzo Bianconi [ Upstream commit 45a4e4220bf4927e321e18750e47c576bf62b000 ] Add proper support for L3GD20H gyroscope sensor. In particular: - use L3GD20H as device name instead of L3GD20 - fix available full scales - fix available sample frequencies Note that the original patch listed first below introduced broken support for this part. The second patch drops the support as it didn't work. This new patch brings in working support. Fixes: 9444a300c2be (IIO: Add support for L3GD20H gyroscope) Fixes: a0657716416f ("iio:gyro: bug on L3GD20H gyroscope support") Signed-off-by: Lorenzo Bianconi Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/gyro/st_gyro.h | 1 + drivers/iio/gyro/st_gyro_core.c | 13 +++++++------ drivers/iio/gyro/st_gyro_i2c.c | 5 +++++ drivers/iio/gyro/st_gyro_spi.c | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h index a5c5c4e29addc..48923ae6ac3bd 100644 --- a/drivers/iio/gyro/st_gyro.h +++ b/drivers/iio/gyro/st_gyro.h @@ -19,6 +19,7 @@ #define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro" #define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" #define L3GD20_GYRO_DEV_NAME "l3gd20" +#define L3GD20H_GYRO_DEV_NAME "l3gd20h" #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" #define LSM330_GYRO_DEV_NAME "lsm330_gyro" #define LSM9DS0_GYRO_DEV_NAME "lsm9ds0_gyro" diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index 2a42b3d583e85..e366422e85127 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c @@ -35,6 +35,7 @@ #define ST_GYRO_DEFAULT_OUT_Z_L_ADDR 0x2c /* FULLSCALE */ +#define ST_GYRO_FS_AVL_245DPS 245 #define ST_GYRO_FS_AVL_250DPS 250 #define ST_GYRO_FS_AVL_500DPS 500 #define ST_GYRO_FS_AVL_2000DPS 2000 @@ -196,17 +197,17 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { .wai = 0xd7, .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .sensors_supported = { - [0] = L3GD20_GYRO_DEV_NAME, + [0] = L3GD20H_GYRO_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, .odr = { .addr = 0x20, .mask = 0xc0, .odr_avl = { - { .hz = 95, .value = 0x00, }, - { .hz = 190, .value = 0x01, }, - { .hz = 380, .value = 0x02, }, - { .hz = 760, .value = 0x03, }, + { .hz = 100, .value = 0x00, }, + { .hz = 200, .value = 0x01, }, + { .hz = 400, .value = 0x02, }, + { .hz = 800, .value = 0x03, }, }, }, .pw = { @@ -224,7 +225,7 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { .mask = 0x30, .fs_avl = { [0] = { - .num = ST_GYRO_FS_AVL_250DPS, + .num = ST_GYRO_FS_AVL_245DPS, .value = 0x00, .gain = IIO_DEGREE_TO_RAD(8750), }, diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index 40056b8210364..3f628746cb93e 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c @@ -40,6 +40,10 @@ static const struct of_device_id st_gyro_of_match[] = { .compatible = "st,l3gd20-gyro", .data = L3GD20_GYRO_DEV_NAME, }, + { + .compatible = "st,l3gd20h-gyro", + .data = L3GD20H_GYRO_DEV_NAME, + }, { .compatible = "st,l3g4is-gyro", .data = L3G4IS_GYRO_DEV_NAME, @@ -95,6 +99,7 @@ static const struct i2c_device_id st_gyro_id_table[] = { { LSM330DL_GYRO_DEV_NAME }, { LSM330DLC_GYRO_DEV_NAME }, { L3GD20_GYRO_DEV_NAME }, + { L3GD20H_GYRO_DEV_NAME }, { L3G4IS_GYRO_DEV_NAME }, { LSM330_GYRO_DEV_NAME }, { LSM9DS0_GYRO_DEV_NAME }, diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c index fbf2faed501c8..fa14d8f2170d7 100644 --- a/drivers/iio/gyro/st_gyro_spi.c +++ b/drivers/iio/gyro/st_gyro_spi.c @@ -52,6 +52,7 @@ static const struct spi_device_id st_gyro_id_table[] = { { LSM330DL_GYRO_DEV_NAME }, { LSM330DLC_GYRO_DEV_NAME }, { L3GD20_GYRO_DEV_NAME }, + { L3GD20H_GYRO_DEV_NAME }, { L3G4IS_GYRO_DEV_NAME }, { LSM330_GYRO_DEV_NAME }, { LSM9DS0_GYRO_DEV_NAME }, -- 2.20.1