Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1585370rwl; Wed, 12 Apr 2023 15:40:30 -0700 (PDT) X-Google-Smtp-Source: AKy350Yfqptt8alCXGuWSqebBvIHnBWsGWKGzkh4AC3NJJrR1TgpmYQ+BYn75O0IgVQj/KVdmy30 X-Received: by 2002:a05:6a20:84a3:b0:eb:99e0:ecf7 with SMTP id u35-20020a056a2084a300b000eb99e0ecf7mr3946947pzd.50.1681339230659; Wed, 12 Apr 2023 15:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681339230; cv=none; d=google.com; s=arc-20160816; b=bPOJ3QQ9gCucWs6WXIgpcYCbWh8LPGzG9cyJpvZZNhfL60foT9nGg4sAJJ0+KBGGwq IFCn9f6m1d9zEU8eIdLy6mc3tiL+SluGy3KB3hTct2zHrA3lA0YWTcfdX/4sPktXkObp fEQVA68bdmlkiFGbC6tBYn8AbqYXZQ6UarM68AAUDsj4Qhz4o7JccTEMefDgF9AhZZ3V 7zx6Bq1HWCXz7TKaQjrgtgkLq9AqjnNV8vxAa3jqx2ntnkbZZ1x9WQxObQFmpCH+1dWx ooY9f01r5QqmmNaClO3UzFRpJ+n+mqE/Ac8ArICkwMMPzLz+jx1W8CcZHKWWAYuRM0AG 8Lyw== 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:date:subject:cc:to:from :dkim-signature; bh=OflZ1RQRYS0/eVL+f/CPrQlcwSt09TX0tGm9J6rHhqk=; b=V3DnNQBJMMJcKqyY+Ud3XbUDXzfOrvN/h6nWFeKsFVXikYzpx3JDr8nuH50EBrOkHS mZJJV3wiD4No0vj4bPWEkaWZLwjNhJXwxbeXjCXWbe8G8NljkLKDsyIRquY0/2e4/cUo EdjZVYo/iCRshhswIbb8/mTUUogp9MqXj741VC8ulNLUrd+/0wX/qBMhbuUVEAtWCPhy 8KG/IoVIizsn13mGqjhyp5287OCBltrbz5Ow0/8HTxwFxyqZew52zYNvUTntCvvE7DWf 4TARH62fZ2soNxasRhw08pzmUTFsqPs9UD4za2V7YMGP8kGXGTLu+9LspglBoOPzWFwu Fg+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mariushoch.de header.s=MBO0001 header.b=h7qusGoS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c193-20020a624eca000000b0063777c92476si9464757pfb.90.2023.04.12.15.40.13; Wed, 12 Apr 2023 15:40:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mariushoch.de header.s=MBO0001 header.b=h7qusGoS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbjDLWhR (ORCPT + 99 others); Wed, 12 Apr 2023 18:37:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229799AbjDLWhF (ORCPT ); Wed, 12 Apr 2023 18:37:05 -0400 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4223240D3; Wed, 12 Apr 2023 15:37:04 -0700 (PDT) Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Pxcyj2rNyz9t4f; Thu, 13 Apr 2023 00:37:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mariushoch.de; s=MBO0001; t=1681339021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OflZ1RQRYS0/eVL+f/CPrQlcwSt09TX0tGm9J6rHhqk=; b=h7qusGoSLdrfx8DItFUEDDNlXRyLftV+S9hq0L+tIawAReu0zJGwhAuxTnK9qC8Ir1w22M poNzRhHXvzGM8BKVp1ivP60gMtW6lWSytoF46eTMqwcTcmNMQHW5k2LpXfvWBs/DeCtJM4 sS9TlJGs5sovibQZXCJcP8hKqoYqKGzm0zJXfBhADBWRoOAvo+djKOjl9YczosAHglSQ3f dXSP3sdDFg70jn3VGWYoSoSQdCRtETcOyznDDiCj4fr6BBGetk7/ssGYZLFSClmz1kEN11 KiUxy87NjPJSPJo2E0plFHdCBBg//6Tg64i/6n2j974KKvV3X2Y9+On5WECCwg== From: mail@mariushoch.de To: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Hans de Goede , Marius Hoch Subject: [PATCH] iio: st_sensors: Add ACPI support for lsm303d to the LSM9DS0 IMU driver Date: Thu, 13 Apr 2023 00:36:25 +0200 Message-Id: <20230412223627.442963-5-mail@mariushoch.de> In-Reply-To: <20230412223627.442963-1-mail@mariushoch.de> References: <20230412223627.442963-1-mail@mariushoch.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Pxcyj2rNyz9t4f X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 From: Marius Hoch The lsm303d can be found as ACCL0001 on various Lenovo devices, including the Lenovo Yoga Tablet 2 1051-F, where I tested this patch. Signed-off-by: Marius Hoch --- drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c | 10 ++++++++++ drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c index 64fa77d302e2..79be8d28d965 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -37,6 +38,14 @@ static const struct i2c_device_id st_lsm9ds0_id_table[] = { }; MODULE_DEVICE_TABLE(i2c, st_lsm9ds0_id_table); +#ifdef CONFIG_ACPI +static const struct acpi_device_id st_lsm9ds0_acpi_match[] = { + {"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME}, + { }, +}; +MODULE_DEVICE_TABLE(acpi, st_lsm9ds0_acpi_match); +#endif + static const struct regmap_config st_lsm9ds0_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -73,6 +82,7 @@ static struct i2c_driver st_lsm9ds0_driver = { .driver = { .name = "st-lsm9ds0-i2c", .of_match_table = st_lsm9ds0_of_match, + .acpi_match_table = ACPI_PTR(st_lsm9ds0_acpi_match), }, .probe_new = st_lsm9ds0_i2c_probe, .id_table = st_lsm9ds0_id_table, diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c index 997b5ff792be..27c5d99ce0e3 100644 --- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c +++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -37,6 +38,14 @@ static const struct spi_device_id st_lsm9ds0_id_table[] = { }; MODULE_DEVICE_TABLE(spi, st_lsm9ds0_id_table); +#ifdef CONFIG_ACPI +static const struct acpi_device_id st_lsm9ds0_acpi_match[] = { + {"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME}, + { }, +}; +MODULE_DEVICE_TABLE(acpi, st_lsm9ds0_acpi_match); +#endif + static const struct regmap_config st_lsm9ds0_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -72,6 +81,7 @@ static struct spi_driver st_lsm9ds0_driver = { .driver = { .name = "st-lsm9ds0-spi", .of_match_table = st_lsm9ds0_of_match, + .acpi_match_table = ACPI_PTR(st_lsm9ds0_acpi_match), }, .probe = st_lsm9ds0_spi_probe, .id_table = st_lsm9ds0_id_table, -- 2.39.2