From patchwork Thu Jul 4 12:56:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 1956874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SBjz7VoZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-i2c+bounces-4629-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WFGrf5Mmwz1xpP for ; Thu, 4 Jul 2024 22:57:22 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 30B9C285141 for ; Thu, 4 Jul 2024 12:57:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF0CE1AE86E; Thu, 4 Jul 2024 12:57:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SBjz7VoZ" X-Original-To: linux-i2c@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EE651AE853 for ; Thu, 4 Jul 2024 12:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720097822; cv=none; b=Kpoj0Rh3N34qBSDhFxLNVUStEgnDBZQpcZrRgO2aVGJ2TBQNgWWrvmvJFve/UofBWWagwyCYGiTdPoIYh9UGCa92RjzzEHYPCZBET/V9VUldazqty2JnrMh10nVxQYlqZp3HnzitOJw9GfOJ4HYsR7govB7NjSRr1EY/hw2CCCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720097822; c=relaxed/simple; bh=IpZvhy2DHi19mlAReNEEugCWLAd7JhosYPSUOyO+UeA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=X+EmKx+UJ6iBy3//wQzLfWxT3zbq+4I2rC8On7gHpAD7S6FcC4K5ltsFI/vIGv4avLR56Z2vtuNBA0q8Z6nyo+kvBia5fNM1mTVvgq3EmY8m/nbgh+kl23YItYYccELXdmVc7MUwVPiL6sHgWZiIfq5LZQ22ZeQcV6XOgRPkSCs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SBjz7VoZ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720097820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kMXADbBOiY5mvq0ZI455axktREwdFMbDlsxlF7uAebQ=; b=SBjz7VoZXQDt3klKO/HKZnKf22Xkv+HEeKPcypjKHO0Nr/SdicvN0aMAzXj8pqUN/CC+Xv uNGKhQ7CKOF9EgF05pPlS8vCsrbEW70E6wYMrYyfDXUKTsnT/5dv6IcAbP0aEAht4ZJgKX pCT1m2YDsgxkxUKazxmfJ56VdJ4cfs8= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-oziPiv9zMMWbhc4dUi2m3w-1; Thu, 04 Jul 2024 08:56:54 -0400 X-MC-Unique: oziPiv9zMMWbhc4dUi2m3w-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A286A1956088; Thu, 4 Jul 2024 12:56:50 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.194.23]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 90D011955E89; Thu, 4 Jul 2024 12:56:44 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Ilpo_J=C3=A4rvi?= =?utf-8?q?nen?= , Andy Shevchenko , Paul Menzel , Wolfram Sang Cc: Hans de Goede , eric.piel@tremplin-utc.net, Marius Hoch , Dell.Client.Kernel@dell.com, Kai Heng Feng , platform-driver-x86@vger.kernel.org, Jean Delvare , Andi Shyti , linux-i2c@vger.kernel.org Subject: [PATCH v6 0/6] i2c-i801 / dell-lis3lv02d: Move instantiation of lis3lv02d i2c_client from i2c-i801 to dell-lis3lv02d Date: Thu, 4 Jul 2024 14:56:37 +0200 Message-ID: <20240704125643.22946-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Hi All, Here is v6 of my patch series to move the manual instantation of lis3lv02d i2c_client-s for SMO88xx ACPI device from the generic i2c-i801.c code to a SMO88xx specific dell-lis3lv02d driver. Moving the i2c_client instantiation there has the following advantages: 1. This moves the SMO88xx ACPI device quirk handling away from the generic i2c-i801 module which is loaded on all Intel x86 machines to a module which will only be loaded when there is an ACPI SMO88xx device. 2. This removes the duplication of the SMO88xx ACPI Hardware ID (HID) table between the i2c-i801 and dell-smo8800 drivers. 3. This allows extending the quirk handling by adding new code and related module parameters to the dell-lis3lv02d driver, without needing to modify the i2c-i801 code. This series also extends the i2c_client instantiation with support for probing for the i2c-address of the lis3lv02d chip on devices which are not yet listed in the DMI table with i2c-addresses for known models. This probing is only done when requested through a module parameter. Changes in v6: - Use i2c_new_scanned_device() instead of re-inventing it Changes in v5: - Make match_acpi_device_ids() and match_acpi_device_ids[] __init[const] - Add "Depends on I2C" to Kconfig (to fix kernel-test-robot reported issues) - Add "this may be dangerous warning" to MODULE_PARM_DESC(probe_i2c_addr) Changes in v4: - Move the i2c_client instantiation to a new dell-lis3lv02d driver instead of adding it to the dell-smo8800 driver - Address a couple of other minor review comments Changes in v3: - Use an i2c bus notifier so that the i2c_client will still be instantiated if the i801 i2c_adapter shows up later or is re-probed (removed + added again). This addresses the main concern / review-comments made during review of v2. - Add 2 prep patches to the i2c-core / the i2c-i801 driver to allow bus-notifier use / to avoid the need to duplicate the PCI-ids of IDF i2c-i801 adapters. - Switch to standard dmi_system_id matching to check both sys-vendor + product-name DMI fields - Drop the patch to alternatively use the st_accel IIO driver instead of drivers/misc/lis3lv02d/lis3lv02d.c Changes in v2: - Drop "[PATCH 1/6] platform/x86: dell-smo8800: Only load on Dell laptops" - Use a pci_device_id table to check for IDF (non main) i2c-i801 SMBusses - Add a comment documenting the IDF PCI device ids - Keep using drivers/misc/lis3lv02d/lis3lv02d.c by default - Rename the module-parameter to use_iio_driver which can be set to use the IIO st_accel driver instead - Add a new patch adding the accelerometer address for the 2 models I have tested this on to dell_lis3lv02d_devices[] Since this touches files under both drivers/i2c and drivers/platform/x86 some subsystem coordination is necessary. I think it would be best to just merge the entire series through the i2c subsystem since this touches some core i2c files. As pdx86 subsys co-maintainer I'm fine with doing so. Regards, Hans Hans de Goede (6): i2c: core: Setup i2c_adapter runtime-pm before calling device_add() i2c: i801: Use a different adapter-name for IDF adapters platform/x86: dell-smo8800: Move SMO88xx acpi_device_ids to dell-smo8800-ids.h platform/x86: dell-smo8800: Move instantiation of lis3lv02d i2c_client from i2c-i801 to dell-lis3lv02d platform/x86: dell-smo8800: Add a couple more models to lis3lv02d_devices[] platform/x86: dell-smo8800: Add support for probing for the accelerometer i2c address drivers/i2c/busses/i2c-i801.c | 133 +--------- drivers/i2c/i2c-core-base.c | 18 +- drivers/platform/x86/dell/Kconfig | 1 + drivers/platform/x86/dell/Makefile | 1 + drivers/platform/x86/dell/dell-lis3lv02d.c | 249 +++++++++++++++++++ drivers/platform/x86/dell/dell-smo8800-ids.h | 26 ++ drivers/platform/x86/dell/dell-smo8800.c | 16 +- 7 files changed, 298 insertions(+), 146 deletions(-) create mode 100644 drivers/platform/x86/dell/dell-lis3lv02d.c create mode 100644 drivers/platform/x86/dell/dell-smo8800-ids.h