From patchwork Thu Nov 24 20:00:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 87789 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1oyIPU-00Bhr2-Ix; Thu, 24 Nov 2022 20:01:24 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbiKXUBW (ORCPT + 1 other); Thu, 24 Nov 2022 15:01:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbiKXUBU (ORCPT ); Thu, 24 Nov 2022 15:01:20 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E5592A704 for ; Thu, 24 Nov 2022 12:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669320018; 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=s09UeePB6z8paukx/KjyayrP6nJqT11KHIhjeOQWkFA=; b=bjj/ebgh31lcuUh/amdsBzgOODNAxSHtI+uXtmnBMb6+icg2dj3bK8tCzaEfMn0p/fy4+J vUlDsdMRy5WjYo41DLo3t6z0RyURJF7m3hoqLrt9AKsJsSduDQ2790KU9WDgxjW/1EtPxP vZuXdwmGYeGkopFbpPEp9pdkjqIcVhk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-ICzjd7L5N0i6azz14RFOdA-1; Thu, 24 Nov 2022 15:00:14 -0500 X-MC-Unique: ICzjd7L5N0i6azz14RFOdA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18620383D0C9; Thu, 24 Nov 2022 20:00:14 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.195.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id D51FA1415114; Thu, 24 Nov 2022 20:00:12 +0000 (UTC) From: Hans de Goede To: Mark Gross , Andy Shevchenko , Daniel Scally Cc: Hans de Goede , platform-driver-x86@vger.kernel.org, Sakari Ailus , Kate Hsuan , linux-media@vger.kernel.org Subject: [PATCH 1/3] platform/x86: int3472/discrete: Refactor GPIO to sensor mapping Date: Thu, 24 Nov 2022 21:00:05 +0100 Message-Id: <20221124200007.390901-2-hdegoede@redhat.com> In-Reply-To: <20221124200007.390901-1-hdegoede@redhat.com> References: <20221124200007.390901-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIMWL_WL_HIGH=0.001,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no Make the GPIO to sensor mapping more generic and fold the INT3472_GPIO_TYPE_RESET and INT3472_GPIO_TYPE_POWERDOWN cases into a single generic case. This is a preparation patch for further GPIO mapping changes. Signed-off-by: Hans de Goede Reviewed-by: Daniel Scally Tested-by: Daniel Scally --- drivers/platform/x86/intel/int3472/discrete.c | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index 974a132db651..bc6c62f3f3bf 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -184,6 +184,24 @@ static int skl_int3472_map_gpio_to_clk(struct int3472_discrete_device *int3472, return 0; } +static const char *int3472_dsm_type_to_func(u8 type) +{ + switch (type) { + case INT3472_GPIO_TYPE_RESET: + return "reset"; + case INT3472_GPIO_TYPE_POWERDOWN: + return "powerdown"; + case INT3472_GPIO_TYPE_CLK_ENABLE: + return "clken"; + case INT3472_GPIO_TYPE_PRIVACY_LED: + return "pled"; + case INT3472_GPIO_TYPE_POWER_ENABLE: + return "power-enable"; + } + + return "unknown"; +} + /** * skl_int3472_handle_gpio_resources: Map PMIC resources to consuming sensor * @ares: A pointer to a &struct acpi_resource @@ -223,6 +241,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, struct acpi_resource_gpio *agpio; union acpi_object *obj; const char *err_msg; + const char *func; int ret; u8 type; @@ -246,19 +265,15 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, type = obj->integer.value & 0xff; + func = int3472_dsm_type_to_func(type); + switch (type) { case INT3472_GPIO_TYPE_RESET: - ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "reset", - GPIO_ACTIVE_LOW); - if (ret) - err_msg = "Failed to map reset pin to sensor\n"; - - break; case INT3472_GPIO_TYPE_POWERDOWN: - ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "powerdown", + ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, func, GPIO_ACTIVE_LOW); if (ret) - err_msg = "Failed to map powerdown pin to sensor\n"; + err_msg = "Failed to map GPIO pin to sensor\n"; break; case INT3472_GPIO_TYPE_CLK_ENABLE: From patchwork Thu Nov 24 20:00:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 87786 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1oyIPN-00Bhr2-4Q; Thu, 24 Nov 2022 20:01:17 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbiKXUBP (ORCPT + 1 other); Thu, 24 Nov 2022 15:01:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbiKXUBO (ORCPT ); Thu, 24 Nov 2022 15:01:14 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35B9B2AE19 for ; Thu, 24 Nov 2022 12:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669320019; 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=kSYyhzQPfz68JBO1GSnCmXiXgzkI4gleaHz5wVtm2sk=; b=UU+U+pHa3PA6MHis7X0IMXqf0AVEHLe1vqVv2DrM6gmm1jVsqmb+GMsXuJM9dGBlkzwasg YJxVkG6A6H0rlXkzCmuEDutZllWyCwubXSCiZWmiq9Jy/lic/xEsj9dpHEriXNOBIPQLPC LNcyatWpFUWf4/T29FQ52Am4Hc0AzOA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-131-kMUabkGXNsKjFW53L2hndg-1; Thu, 24 Nov 2022 15:00:16 -0500 X-MC-Unique: kMUabkGXNsKjFW53L2hndg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7B06285A588; Thu, 24 Nov 2022 20:00:15 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.195.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B8701415114; Thu, 24 Nov 2022 20:00:14 +0000 (UTC) From: Hans de Goede To: Mark Gross , Andy Shevchenko , Daniel Scally Cc: Hans de Goede , platform-driver-x86@vger.kernel.org, Sakari Ailus , Kate Hsuan , linux-media@vger.kernel.org Subject: [PATCH 2/3] platform/x86: int3472/discrete: Get the polarity from the _DSM entry Date: Thu, 24 Nov 2022 21:00:06 +0100 Message-Id: <20221124200007.390901-3-hdegoede@redhat.com> In-Reply-To: <20221124200007.390901-1-hdegoede@redhat.com> References: <20221124200007.390901-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIMWL_WL_HIGH=0.001,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no The out of tree IPU6 driver has moved to also using the in kernel INT3472 code for doing power-ctrl rather then doing their own thing (good!). On IPU6 the polarity is encoded in the _DSM entry rather then being hardcoded to GPIO_ACTIVE_LOW. Using the _DSM entry for this on IPU3 leads to regressions, so only use the _DSM entry for this on non IPU3 devices. Note there is a whole bunch of PCI-ids for the IPU6 which is why the check is for the IPU3-CIO2, because the CIO2 there has a unique PCI-id which can be used for this. Signed-off-by: Hans de Goede Reviewed-by: Daniel Scally Tested-by: Daniel Scally --- drivers/platform/x86/intel/int3472/discrete.c | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index bc6c62f3f3bf..9159291be28a 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,19 @@ static const guid_t cio2_sensor_module_guid = GUID_INIT(0x822ace8f, 0x2814, 0x4174, 0xa5, 0x6b, 0x5f, 0x02, 0x9f, 0xe0, 0x79, 0xee); +/* IPU3 vs IPU6 needs to be handled differently */ +#define IPU3_CIO2_PCI_ID 0x9d32 + +static const struct pci_device_id ipu3_cio2_pci_id_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, IPU3_CIO2_PCI_ID) }, + { } +}; + +static int ipu3_present(void) +{ + return pci_dev_present(ipu3_cio2_pci_id_table); +} + /* * Here follows platform specific mapping information that we can pass to * the functions mapping resources to the sensors. Where the sensors have @@ -242,6 +256,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, union acpi_object *obj; const char *err_msg; const char *func; + u32 polarity; int ret; u8 type; @@ -265,13 +280,22 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, type = obj->integer.value & 0xff; + /* IPU3 always uses active-low, IPU6 polarity is encoded in the _DSM entry. */ + if (ipu3_present()) + polarity = GPIO_ACTIVE_LOW; + else + polarity = ((obj->integer.value >> 24) & 0xff) ? GPIO_ACTIVE_HIGH : GPIO_ACTIVE_LOW; + func = int3472_dsm_type_to_func(type); + dev_dbg(int3472->dev, "%s %s pin %d active-%s\n", func, + agpio->resource_source.string_ptr, agpio->pin_table[0], + (polarity == GPIO_ACTIVE_HIGH) ? "high" : "low"); + switch (type) { case INT3472_GPIO_TYPE_RESET: case INT3472_GPIO_TYPE_POWERDOWN: - ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, func, - GPIO_ACTIVE_LOW); + ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, func, polarity); if (ret) err_msg = "Failed to map GPIO pin to sensor\n"; From patchwork Thu Nov 24 20:00:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 87788 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1oyIPS-00Bhr2-KZ; Thu, 24 Nov 2022 20:01:23 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229586AbiKXUBV (ORCPT + 1 other); Thu, 24 Nov 2022 15:01:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbiKXUBU (ORCPT ); Thu, 24 Nov 2022 15:01:20 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA21F2AE2E for ; Thu, 24 Nov 2022 12:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669320023; 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=7vMfC4eODGr/G7aZBCsosazHm3HF6RAZ7q1rCBxpwOk=; b=UY/vdJJVHHtbY+07txQeBOk0kXciP8vgzZDHNcu1s2Ke3EVxvwPW83ZqUcHR70IkOCiXV8 OtXM8vVscmL0Pco4u3M48MFjcgwei4ga/kfgYkT51uuA9ScYw+2+GdGyahDsXnN09pq6ef wGre7syVQvPHk/nGlxJpmEA6giTdHW8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-333-Q1mk0d26NpKJOlZz8toQCA-1; Thu, 24 Nov 2022 15:00:18 -0500 X-MC-Unique: Q1mk0d26NpKJOlZz8toQCA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 99FA4185A794; Thu, 24 Nov 2022 20:00:17 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.195.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3A141415114; Thu, 24 Nov 2022 20:00:15 +0000 (UTC) From: Hans de Goede To: Mark Gross , Andy Shevchenko , Daniel Scally Cc: Hans de Goede , platform-driver-x86@vger.kernel.org, Sakari Ailus , Kate Hsuan , linux-media@vger.kernel.org Subject: [PATCH 3/3] platform/x86: int3472/discrete: Add support for sensor-drivers which expect clken + pled GPIOs Date: Thu, 24 Nov 2022 21:00:07 +0100 Message-Id: <20221124200007.390901-4-hdegoede@redhat.com> In-Reply-To: <20221124200007.390901-1-hdegoede@redhat.com> References: <20221124200007.390901-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIMWL_WL_HIGH=0.001,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no The hm11b1 and ov01a1s sensor drivers shipped with the out of tree IPU6 driver, expect the clk_en GPIO to be modelled as a "clken" GPIO rather then using the clk framework; and the hm11b1, ov01a1s and ov2740 driver all 3 expect the privacy-led to be modelled as a "pled" GPIO, rather then it being turned on/off at the same time as the clk. Adjust how we handle the GPIOs on these sensors accordingly, for now at least, so that the out of tree driver can work with standard distro kernels through e.g. dkms. Otherwise users need to run a patched kernel just for this small difference. This of course needs to be revisited when we mainline these sensor drivers, I can imagine the drivers getting clk-framework support when they are mainlined and then at that same time their acpi HID can be dropped from the use_gpio_for_clk_acpi_ids[] array. Note there already is a mainline driver for the ov2740, but that is not impacted by this change since atm it uses neither the clk framework nor a "clken" GPIO. Signed-off-by: Hans de Goede --- Maybe we should patch the sensor drivers for sensors supported with the IPU3 to also expect the privacy-led to always be a separate GPIO? This way we can also avoid the camera LED briefly going on at boot, when the driver is powering things up to read the sensor's ID register. And I have also put looking at making the mainline ov2740 driver suitable for use with the (out of tree) IPU6 driver on my TODO list. --- drivers/platform/x86/intel/int3472/common.h | 2 +- drivers/platform/x86/intel/int3472/discrete.c | 37 +++++++++++++++---- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/common.h b/drivers/platform/x86/intel/int3472/common.h index 53270d19c73a..58647d3084b9 100644 --- a/drivers/platform/x86/intel/int3472/common.h +++ b/drivers/platform/x86/intel/int3472/common.h @@ -23,7 +23,7 @@ #define INT3472_GPIO_TYPE_PRIVACY_LED 0x0d #define INT3472_PDEV_MAX_NAME_LEN 23 -#define INT3472_MAX_SENSOR_GPIOS 3 +#define INT3472_MAX_SENSOR_GPIOS 4 #define GPIO_REGULATOR_NAME_LENGTH 21 #define GPIO_REGULATOR_SUPPLY_NAME_LENGTH 9 diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index 9159291be28a..bfcf8184db16 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -216,6 +216,26 @@ static const char *int3472_dsm_type_to_func(u8 type) return "unknown"; } +/* + * The hm11b1 and ov01a1s sensor drivers shipped with the out of tree IPU6 driver, + * expect the clk_en GPIO to be modelled as a "clken" GPIO rather then as a clk and + * the hm11b1, ov01a1s and ov2740 driver all 3 expect the privacy-led to be modelled + * as a "pled" GPIO, rather then it being turned on/off at the same time as the clk. + * + * Note there also is a mainline driver for the ov2740, but that does not use + * the clk framework atm either. + * + * Adjust how we handle the GPIOs on these sensors accordingly, for now at least. + * This needs to be revisited when we mainline these sensor drivers / when we merge + * the necessary changes in the ov2740 sensor driver so that it can work on the IPU6. + */ +static const struct acpi_device_id use_gpio_for_clk_acpi_ids[] = { + { "HIMX11B1" }, /* hm11b1 */ + { "OVTI01AS" }, /* ov01a1s */ + { "INT3474" }, /* ov2740 */ + {} +}; + /** * skl_int3472_handle_gpio_resources: Map PMIC resources to consuming sensor * @ares: A pointer to a &struct acpi_resource @@ -293,19 +313,22 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, (polarity == GPIO_ACTIVE_HIGH) ? "high" : "low"); switch (type) { + case INT3472_GPIO_TYPE_CLK_ENABLE: + case INT3472_GPIO_TYPE_PRIVACY_LED: + if (!acpi_match_device_ids(int3472->adev, use_gpio_for_clk_acpi_ids)) { + ret = skl_int3472_map_gpio_to_clk(int3472, agpio, type); + if (ret) + err_msg = "Failed to map GPIO to clock\n"; + + break; + } + fallthrough; case INT3472_GPIO_TYPE_RESET: case INT3472_GPIO_TYPE_POWERDOWN: ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, func, polarity); if (ret) err_msg = "Failed to map GPIO pin to sensor\n"; - break; - case INT3472_GPIO_TYPE_CLK_ENABLE: - case INT3472_GPIO_TYPE_PRIVACY_LED: - ret = skl_int3472_map_gpio_to_clk(int3472, agpio, type); - if (ret) - err_msg = "Failed to map GPIO to clock\n"; - break; case INT3472_GPIO_TYPE_POWER_ENABLE: ret = skl_int3472_register_regulator(int3472, agpio);