From patchwork Wed Feb 16 22:52:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 543413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E0A1C4321E for ; Wed, 16 Feb 2022 22:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236232AbiBPWxh (ORCPT ); Wed, 16 Feb 2022 17:53:37 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237666AbiBPWxf (ORCPT ); Wed, 16 Feb 2022 17:53:35 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D9CD2271E3; Wed, 16 Feb 2022 14:53:22 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id k1so5803252wrd.8; Wed, 16 Feb 2022 14:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ymD5PEE4EIPkNYey9FwlcOTsDz20fQv3wKVbQGJvVn8=; b=d2BJFyQX2jTq84lilJnuwiZX+qpIJGo/wvV8qKnOg+nppJqOauKj2V1MvojsiaVuRl 7+tuNWbfgeVgZdIIApy2jYU7VsGcgQGtDrn7dUxk3Wvt3BBGBmEOmOY2l4RtjWIEVNVH XjJfBGAeQ5Tu0RV7smEgJrrz7Asub7FW5Qu00LGKxfK+TS4170s7uzv6rzhCWa/CM1vM D2qkRwEl6pko/AvenI25kz2dUo2U4Nj49AhqcCL6mHu5MQt2RW4bqFeTkhTfh+gSIkQr P+r/5UJqvpLHxdf+HztRE62/a74/6hXSs4MDozliPvGi9/7ZpZIbcJA5V4Xw4sTklest pS+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ymD5PEE4EIPkNYey9FwlcOTsDz20fQv3wKVbQGJvVn8=; b=Tanje8KdZfLI9FiNYmxZYcKND2by2Xz05AmDP4yh/lTiWwElE8qZCV6dW0H1zziu19 mAZ/OlyipSZz5YtuWaNRV/+gLTTCsiWLh1EBYZ9E8nX4N2AVG8+3SyTqta3kUKqv7eQu BbFZE85dD7n0S/MJa8bRveI89mD0mSJ3owo5C+OYj1AEzijigT3819SdLRh/sbN8EDN5 h6hf9oyg3QNK9LxzgzHqRhSU1zH7a1JdtbPavsoVgK3zThdVJjoUwc3tdBWXZbzQGsuR 94HPdiu7yCke305oY8lix0KuqOvCRfoi7ZePX5I6KGQaNpB9hBv9OrQoJk1Wnq35AuJg bQLw== X-Gm-Message-State: AOAM533QFk90mAa1sDZMBe4NhrO4y0S9sEI0m5btaTm9mwiVmqV0FNhh my0jzmOvGOdS45sgm3ljeQStIKfv935SwA== X-Google-Smtp-Source: ABdhPJxAJsVzGYVFT5Uz7uvmZhGj2ikMV3Cx0krBQzE16aRZZ1cabFMpVv4qLV/fJ8iPgCfi7s3lsA== X-Received: by 2002:adf:ce83:0:b0:1e5:78e4:3a72 with SMTP id r3-20020adfce83000000b001e578e43a72mr136313wrn.279.1645052001083; Wed, 16 Feb 2022 14:53:21 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id o125sm182539wme.37.2022.02.16.14.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 14:53:20 -0800 (PST) From: Daniel Scally To: linux-acpi@vger.kernel.org, linux-clk@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: rafael@kernel.org, lenb@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, hdegoede@redhat.com, markgross@kernel.org, robert.moore@intel.com Subject: [PATCH 1/6] ACPI: scan: Add acpi_dev_get_next_consumer_dev() Date: Wed, 16 Feb 2022 22:52:59 +0000 Message-Id: <20220216225304.53911-2-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216225304.53911-1-djrscally@gmail.com> References: <20220216225304.53911-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org In commit b83e2b306736 ("ACPI: scan: Add function to fetch dependent of ACPI device") we added a means of fetching the first device to declare itself dependent on another ACPI device in the _DEP method. One assumption in that patch was that there would only be a single consuming device, but this has not held. Extend the functionality by adding a new function that fetches the next consumer of a supplier device. We can then simplify the original function by simply calling the new one. Signed-off-by: Daniel Scally --- drivers/acpi/scan.c | 47 ++++++++++++++++++++++++++++++++++------- include/acpi/acpi_bus.h | 2 ++ 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 4463c2eda61e..b3ed664ee1cb 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2256,9 +2256,21 @@ static void acpi_bus_attach(struct acpi_device *device, bool first_pass) device->handler->hotplug.notify_online(device); } -static int acpi_dev_get_first_consumer_dev_cb(struct acpi_dep_data *dep, void *data) +static int acpi_dev_get_next_consumer_dev_cb(struct acpi_dep_data *dep, void *data) { - struct acpi_device *adev; + struct acpi_device *adev = *(struct acpi_device **)data; + + /* + * If we're passed a 'previous' consumer device then we need to skip + * any consumers until we meet the previous one, and then NULL @data + * so the next one can be returned. + */ + if (adev) { + if (dep->consumer == adev->handle) + *(struct acpi_device **)data = NULL; + + return 0; + } adev = acpi_bus_get_acpi_device(dep->consumer); if (adev) { @@ -2389,23 +2401,42 @@ bool acpi_dev_ready_for_enumeration(const struct acpi_device *device) EXPORT_SYMBOL_GPL(acpi_dev_ready_for_enumeration); /** - * acpi_dev_get_first_consumer_dev - Return ACPI device dependent on @supplier + * acpi_dev_get_next_consumer_dev - Return the next adev dependent on @supplier * @supplier: Pointer to the dependee device + * @start: Pointer to the current dependent device * - * Returns the first &struct acpi_device which declares itself dependent on + * Returns the next &struct acpi_device which declares itself dependent on * @supplier via the _DEP buffer, parsed from the acpi_dep_list. * * The caller is responsible for putting the reference to adev when it is no * longer needed. */ -struct acpi_device *acpi_dev_get_first_consumer_dev(struct acpi_device *supplier) +struct acpi_device *acpi_dev_get_next_consumer_dev(struct acpi_device *supplier, + struct acpi_device *start) { - struct acpi_device *adev = NULL; + struct acpi_device *adev = start; acpi_walk_dep_device_list(supplier->handle, - acpi_dev_get_first_consumer_dev_cb, &adev); + acpi_dev_get_next_consumer_dev_cb, &adev); - return adev; + acpi_dev_put(start); + return adev == start ? NULL : adev; +} +EXPORT_SYMBOL_GPL(acpi_dev_get_next_consumer_dev); + +/** + * acpi_dev_get_first_consumer_dev - Return ACPI device dependent on @supplier + * @supplier: Pointer to the dependee device + * + * Returns the first &struct acpi_device which declares itself dependent on + * @supplier via the _DEP buffer, parsed from the acpi_dep_list. + * + * The caller is responsible for putting the reference to adev when it is no + * longer needed. + */ +struct acpi_device *acpi_dev_get_first_consumer_dev(struct acpi_device *supplier) +{ + return acpi_dev_get_next_consumer_dev(supplier, NULL); } EXPORT_SYMBOL_GPL(acpi_dev_get_first_consumer_dev); diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index ca88c4706f2b..8b06fef04722 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -720,6 +720,8 @@ bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const ch void acpi_dev_clear_dependencies(struct acpi_device *supplier); bool acpi_dev_ready_for_enumeration(const struct acpi_device *device); +struct acpi_device *acpi_dev_get_next_consumer_dev(struct acpi_device *supplier, + struct acpi_device *start); struct acpi_device *acpi_dev_get_first_consumer_dev(struct acpi_device *supplier); struct acpi_device * acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const char *uid, s64 hrv); From patchwork Wed Feb 16 22:53:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 543058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC8FFC433F5 for ; Wed, 16 Feb 2022 22:53:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237823AbiBPWxi (ORCPT ); Wed, 16 Feb 2022 17:53:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237806AbiBPWxg (ORCPT ); Wed, 16 Feb 2022 17:53:36 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76EBF29E94C; Wed, 16 Feb 2022 14:53:23 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id d27so5813459wrc.6; Wed, 16 Feb 2022 14:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q02S7DaGUIfYV0vlp3pYkDN2E9uoIt6l1gbx25MofQI=; b=RIfiq7SJqInA4/+xu3nfmHVrW/VoW7UayLokJP0hBCtkSgASOlzE2rMBuy0D99x28b vI87kZsN1G9YdabeTJWv34BC34cEfxQla/ADL/bCXcgbADdFLth/yt/TrYfQEt+I/37/ QkPxnTOnVOiyYEqDk1J/EWnKvG9IjZtT2lrfYQXW48O/EIA400bptxJZzMNIRQWtmnvE rEtpkHZSFQ4YYRO+TMGpGX3daZZ3405EKCeM5ktOU6HtVT4n+tSpZ6zFUk/4dGuYnroe HxE7DdM8uplVnA6FHb102luwtYADEjC9fBGc0eFfvoEnjto3vCZ6GndV4k6VQg7QtoH3 u6qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q02S7DaGUIfYV0vlp3pYkDN2E9uoIt6l1gbx25MofQI=; b=Qd+onMJZlcwb17VPmM+RjeLv2Z0ZeHtB7LQbmYzbI0D1V3NqS0u8EzqLu7FLpY8HM5 Tp4lwgxqXPbfN3nGKzHQ/tcow9uHdQXgCwOIAxiJxecpY9t1yNG2FD4qlnwMjevK44Pl hkZFiUVcTGm8agZyorKqVAcxE9pPA2YZ8c/u/1m6yc68djKaGQqnAxqcNTL59Gcl8jIj BQRv9CdEDDShN0hDoERXuTTpMUOVtMpCfmxgSEF17OpiwccLRkSaakV3YoZXFPhpl+Z0 osdqCSDE+wTFNeWe+4ABBmz/727o82l7dDWqfF2sa44A5KcEIu+8QfUdyv+xrNkRmbPU +nVQ== X-Gm-Message-State: AOAM532V9l48AscYoEWCmqatOJS1hYt2nrr6p3rTxnjq5Kun8kveZnnK hb9HnMZeut6VvqpHidX2ChdLH1trw0gtiA== X-Google-Smtp-Source: ABdhPJxF7uklk0THZAKmOV3uk417g2jgmFAETN4o1HRsC76CG2JUbRj/hHuCD86UY0fwiaf+l7rlqw== X-Received: by 2002:a5d:61d2:0:b0:1e3:c0b7:c3e7 with SMTP id q18-20020a5d61d2000000b001e3c0b7c3e7mr138484wrv.682.1645052002109; Wed, 16 Feb 2022 14:53:22 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id o125sm182539wme.37.2022.02.16.14.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 14:53:21 -0800 (PST) From: Daniel Scally To: linux-acpi@vger.kernel.org, linux-clk@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: rafael@kernel.org, lenb@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, hdegoede@redhat.com, markgross@kernel.org, robert.moore@intel.com Subject: [PATCH 2/6] ACPI: bus: Add iterator for dependent devices Date: Wed, 16 Feb 2022 22:53:00 +0000 Message-Id: <20220216225304.53911-3-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216225304.53911-1-djrscally@gmail.com> References: <20220216225304.53911-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add a helper macro to iterate over ACPI devices that are flagged as consumers of an initial supplier ACPI device. Signed-off-by: Daniel Scally --- include/acpi/acpi_bus.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 8b06fef04722..72103bcdd5b3 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -723,6 +723,18 @@ bool acpi_dev_ready_for_enumeration(const struct acpi_device *device); struct acpi_device *acpi_dev_get_next_consumer_dev(struct acpi_device *supplier, struct acpi_device *start); struct acpi_device *acpi_dev_get_first_consumer_dev(struct acpi_device *supplier); + +/** + * for_each_acpi_consumer_dev - iterate over the consumer ACPI devices for a + * given supplier + * @supplier: Pointer to the supplier's ACPI device + * @consumer: Pointer to &struct acpi_device to hold the consumer, initially NULL + */ +#define for_each_acpi_consumer_dev(supplier, consumer) \ + for (consumer = acpi_dev_get_first_consumer_dev(supplier); \ + consumer; \ + consumer = acpi_dev_get_next_consumer_dev(supplier, consumer)) + struct acpi_device * acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const char *uid, s64 hrv); struct acpi_device * From patchwork Wed Feb 16 22:53:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 543412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CA1DC41535 for ; Wed, 16 Feb 2022 22:53:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237855AbiBPWxk (ORCPT ); Wed, 16 Feb 2022 17:53:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237815AbiBPWxh (ORCPT ); Wed, 16 Feb 2022 17:53:37 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 780AD21FC5F; Wed, 16 Feb 2022 14:53:24 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id v12so5851009wrv.2; Wed, 16 Feb 2022 14:53:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jM2+e3zWtETVhAC0+ye2wndY0pyCLLo36eEeA+yW/xs=; b=mz1/nQGgoTvZq/YrLsRmhs5tjJTqdq0hIrC931GxWZ3iD6e16ITW2Dt1tpZzycti+s idbx2Ok4Mknj3F780sQlICbMyhPxAbzRnMwupoDUdO2wbpgBZP7GC2tZyej9QcCWleAr Mz97iPG7KgZ9rVNSO5vcOQw6QZmrXZwsbWjoAOFRYLBkWBkp9QbdlyPErZNRxiKzgMst 7VPZa5FQoBciLs07ObVIXOcrg+EOgpjeIFtTjMQSAxG79YGS/BYZRTk2Vvx2Tm8/JxX7 hLXvBIFD9vaar4ZPFXYp5UD2bdXdJ8B9nq6EEJITPM8+WfSSCKouRkHMNguQEyTxj/JR ywwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jM2+e3zWtETVhAC0+ye2wndY0pyCLLo36eEeA+yW/xs=; b=0vuJ/4KKyqjEoXwFvXNoN9fsn92oAnF2AUS3LN7+X9qVRdV9m5rArYUZELR22PduBZ 8YwyEoLk59SaFeqnTm+SsOOR3oQ/JXXdtoQo90MjbxxxUTHVjJGxW66EjkLRwmCqCmTF 46kxWweEXg8gGP7xUZbdsYPlobfcn+E/GWJOZr9Q6/UpPNKmp3KNnsXWkZ6hyPqY7u/z cwv6UdsVUnCVjFStLWj+gjxG5sjyDGEo/dyhmUErh4tiTfz5OdzetNvcAPoQE0PamH8D Jy+N0f7fwrPEP7GDEWCZUdtrV2wnrebx5URgqXL/8TNmnM5KT+k7xm52TZm1hT5ubLNI zfIQ== X-Gm-Message-State: AOAM533H3+039Os0NtMkJaMS31191q8JX6fdmXjlpaT1cIjlXzq7ArUr J0WDMcdj3KtP7XJTxCjNtuVnYm7RuLtKJQ== X-Google-Smtp-Source: ABdhPJz22xRnoJyoLWLuhcmeozcOKPfSYSd4AIjdwRUHP43spzviTJX3RiPWbxJSqEQwEzrNpoOm0g== X-Received: by 2002:a5d:5045:0:b0:1e3:3d02:84b3 with SMTP id h5-20020a5d5045000000b001e33d0284b3mr142969wrt.384.1645052003122; Wed, 16 Feb 2022 14:53:23 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id o125sm182539wme.37.2022.02.16.14.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 14:53:22 -0800 (PST) From: Daniel Scally To: linux-acpi@vger.kernel.org, linux-clk@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: rafael@kernel.org, lenb@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, hdegoede@redhat.com, markgross@kernel.org, robert.moore@intel.com Subject: [PATCH 3/6] platform/x86: int3472: Support multiple clock consumers Date: Wed, 16 Feb 2022 22:53:01 +0000 Message-Id: <20220216225304.53911-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216225304.53911-1-djrscally@gmail.com> References: <20220216225304.53911-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org At present, the int3472-tps68470 only supports a single clock consumer when passing platform data to the clock driver. In some devices multiple sensors depend on the clock provided by a single TPS68470 and so all need to be able to acquire the clock. Support passing multiple consumers as platform data. Signed-off-by: Daniel Scally Reviewed-by: Stephen Boyd Acked-by: Stephen Boyd --- drivers/clk/clk-tps68470.c | 13 ++-- drivers/platform/x86/intel/int3472/tps68470.c | 59 ++++++++++++++++--- include/linux/platform_data/tps68470.h | 7 ++- 3 files changed, 67 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk-tps68470.c b/drivers/clk/clk-tps68470.c index e5fbefd6ac2d..38f44b5b9b1b 100644 --- a/drivers/clk/clk-tps68470.c +++ b/drivers/clk/clk-tps68470.c @@ -200,7 +200,9 @@ static int tps68470_clk_probe(struct platform_device *pdev) .flags = CLK_SET_RATE_GATE, }; struct tps68470_clkdata *tps68470_clkdata; + struct tps68470_clk_consumer *consumer; int ret; + int i; tps68470_clkdata = devm_kzalloc(&pdev->dev, sizeof(*tps68470_clkdata), GFP_KERNEL); @@ -223,10 +225,13 @@ static int tps68470_clk_probe(struct platform_device *pdev) return ret; if (pdata) { - ret = devm_clk_hw_register_clkdev(&pdev->dev, - &tps68470_clkdata->clkout_hw, - pdata->consumer_con_id, - pdata->consumer_dev_name); + for (i = 0; i < pdata->n_consumers; i++) { + consumer = &pdata->consumers[i]; + ret = devm_clk_hw_register_clkdev(&pdev->dev, + &tps68470_clkdata->clkout_hw, + consumer->consumer_con_id, + consumer->consumer_dev_name); + } } return ret; diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 22f61b47f9e5..b535564712bb 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Author: Dan Scally */ +#include #include #include #include @@ -95,20 +96,64 @@ static int skl_int3472_tps68470_calc_type(struct acpi_device *adev) return DESIGNED_FOR_WINDOWS; } +/* + * Return the size of the flexible array member, because we'll need that later + * on to pass .pdata_size to cells. + */ +static int +skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data **clk_pdata) +{ + struct acpi_device *adev = ACPI_COMPANION(dev); + struct acpi_device *consumer; + unsigned int n_consumers = 0; + const char *sensor_name; + unsigned int i = 0; + + for_each_acpi_consumer_dev(adev, consumer) + n_consumers++; + + if (!n_consumers) { + dev_err(dev, "INT3472 seems to have no dependents\n"); + return -ENODEV; + } + + *clk_pdata = devm_kzalloc(dev, struct_size(*clk_pdata, consumers, n_consumers), + GFP_KERNEL); + if (!*clk_pdata) + return -ENOMEM; + + (*clk_pdata)->n_consumers = n_consumers; + i = 0; + + for_each_acpi_consumer_dev(adev, consumer) { + sensor_name = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT, + acpi_dev_name(consumer)); + if (!sensor_name) + return -ENOMEM; + + (*clk_pdata)->consumers[i].consumer_dev_name = sensor_name; + i++; + } + + acpi_dev_put(consumer); + + return n_consumers; +} + static int skl_int3472_tps68470_probe(struct i2c_client *client) { struct acpi_device *adev = ACPI_COMPANION(&client->dev); const struct int3472_tps68470_board_data *board_data; - struct tps68470_clk_platform_data clk_pdata = {}; + struct tps68470_clk_platform_data *clk_pdata; + unsigned int n_consumers; struct mfd_cell *cells; struct regmap *regmap; int device_type; int ret; - ret = skl_int3472_get_sensor_adev_and_name(&client->dev, NULL, - &clk_pdata.consumer_dev_name); - if (ret) - return ret; + n_consumers = skl_int3472_fill_clk_pdata(&client->dev, &clk_pdata); + if (n_consumers < 0) + return n_consumers; regmap = devm_regmap_init_i2c(client, &tps68470_regmap_config); if (IS_ERR(regmap)) { @@ -142,8 +187,8 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) * the clk + regulators must be ready when this happens. */ cells[0].name = "tps68470-clk"; - cells[0].platform_data = &clk_pdata; - cells[0].pdata_size = sizeof(clk_pdata); + cells[0].platform_data = clk_pdata; + cells[0].pdata_size = struct_size(clk_pdata, consumers, n_consumers); cells[1].name = "tps68470-regulator"; cells[1].platform_data = (void *)board_data->tps68470_regulator_pdata; cells[1].pdata_size = sizeof(struct tps68470_regulator_platform_data); diff --git a/include/linux/platform_data/tps68470.h b/include/linux/platform_data/tps68470.h index 126d082c3f2e..e605a2cab07f 100644 --- a/include/linux/platform_data/tps68470.h +++ b/include/linux/platform_data/tps68470.h @@ -27,9 +27,14 @@ struct tps68470_regulator_platform_data { const struct regulator_init_data *reg_init_data[TPS68470_NUM_REGULATORS]; }; -struct tps68470_clk_platform_data { +struct tps68470_clk_consumer { const char *consumer_dev_name; const char *consumer_con_id; }; +struct tps68470_clk_platform_data { + unsigned int n_consumers; + struct tps68470_clk_consumer consumers[]; +}; + #endif From patchwork Wed Feb 16 22:53:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 543057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C5D0C4332F for ; Wed, 16 Feb 2022 22:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237905AbiBPWxl (ORCPT ); Wed, 16 Feb 2022 17:53:41 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237838AbiBPWxj (ORCPT ); Wed, 16 Feb 2022 17:53:39 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D4BD2271E3; Wed, 16 Feb 2022 14:53:25 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id l12-20020a7bc34c000000b003467c58cbdfso4802341wmj.2; Wed, 16 Feb 2022 14:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U8LwkZa9RC/yBPhmXnAl2Q6p50g9U5AICTQRMA//U54=; b=o/LMG9kdIvpGncLOvlUGcSrF6wkSx3mN2HeKY0GOxa7aSWUsyHsZPDVPffjT23+G5B Ll18JA7wd95BmV1FlTLcVF/kZXJ6gxwXbQUiWlLcZvbwLdTFAPbpSj+winHfGF15jC3w /zc3f+ER4LaJ7YntU8G8XAzAZmyo+x1fPDuH7GRJ45h5fd5zI6kpFEMi5HYMPqA1kj20 FOESqvLx89qzlUhf75erUMwWnlEpTQE0rVPNAEDZg/Jim5RcFJ88HPjfiUyRYtLiEKD8 PQuHEKU/BHbUX3PgnRW18hRTUVXF3r6NeISBBSLnDTD7Pg9CSGoPThKdsdveheAmV6cf /p1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U8LwkZa9RC/yBPhmXnAl2Q6p50g9U5AICTQRMA//U54=; b=7h2VlbGmf+WESwGR1dNMRpWZLlkGG/dIBf356qf27lBXbXzMRXOoCflwAzZ1VEheei KS/QcnKuG7tpeWNA5y8+Dtz250epGHUJAG3xFvOsTyrqUN+Bzy8Z4a8miPiDuulnO/Nj G9jVOuICLX91mwkeIe5F4AM5CdfHOlTNsC7Pbe4WB9N2iLPBfRGw6AFmL7F/uSW4RTa5 SbrosJ70XNZBYF/wbisTvkskTwMhO2nDj7rKBQKMqawax0IRgoWuFvw/Txhtm81I/0vi 11R/RYzrpvZH+v584sWhR6dMb0dyQ8VhmsmYQtvHTv5YTfLQPkt1LBRxdc6eYeEGPARf Z/dg== X-Gm-Message-State: AOAM533u+iyVXUptsPa6V1OZFzyPMwrw0XxRsyvyXESH8MR7yQ+kY1hL /0LxYl286AYcoYDPuWzz1Hf9/YhEhYoC2Q== X-Google-Smtp-Source: ABdhPJxBhyVN4jUcqHq3VuXLR3wU5ZvfW0i5DiMPtQFONZIKWpNxl/duNVnXoUjXmuQ3tef4zae6Cg== X-Received: by 2002:a05:600c:2e0c:b0:37c:3615:c52 with SMTP id o12-20020a05600c2e0c00b0037c36150c52mr123856wmf.43.1645052004133; Wed, 16 Feb 2022 14:53:24 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id o125sm182539wme.37.2022.02.16.14.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 14:53:23 -0800 (PST) From: Daniel Scally To: linux-acpi@vger.kernel.org, linux-clk@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: rafael@kernel.org, lenb@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, hdegoede@redhat.com, markgross@kernel.org, robert.moore@intel.com Subject: [PATCH 4/6] platform/x86: int3472: Add terminator to gpiod_lookup_table Date: Wed, 16 Feb 2022 22:53:02 +0000 Message-Id: <20220216225304.53911-5-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216225304.53911-1-djrscally@gmail.com> References: <20220216225304.53911-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Without the terminator, if a con_id is passed to gpio_find() that does not exist in the lookup table the function will not stop looping correctly, and eventually cause an oops. Fixes: 1596ef1251b5 ("platform/x86: int3472: Pass tps68470_regulator_platform_data to the tps68470-regulator MFD-cell") Signed-off-by: Daniel Scally --- drivers/platform/x86/intel/int3472/tps68470_board_data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel/int3472/tps68470_board_data.c b/drivers/platform/x86/intel/int3472/tps68470_board_data.c index f93d437fd192..525f09a3b5ff 100644 --- a/drivers/platform/x86/intel/int3472/tps68470_board_data.c +++ b/drivers/platform/x86/intel/int3472/tps68470_board_data.c @@ -100,7 +100,8 @@ static struct gpiod_lookup_table surface_go_tps68470_gpios = { .dev_id = "i2c-INT347A:00", .table = { GPIO_LOOKUP("tps68470-gpio", 9, "reset", GPIO_ACTIVE_LOW), - GPIO_LOOKUP("tps68470-gpio", 7, "powerdown", GPIO_ACTIVE_LOW) + GPIO_LOOKUP("tps68470-gpio", 7, "powerdown", GPIO_ACTIVE_LOW), + { } } }; From patchwork Wed Feb 16 22:53:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 543056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCCEFC4332F for ; Wed, 16 Feb 2022 22:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237979AbiBPWxt (ORCPT ); Wed, 16 Feb 2022 17:53:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237887AbiBPWxk (ORCPT ); Wed, 16 Feb 2022 17:53:40 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C25B129E94C; Wed, 16 Feb 2022 14:53:26 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id m126-20020a1ca384000000b0037bb8e379feso4802100wme.5; Wed, 16 Feb 2022 14:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H3EsHpNhp7xDtcLSzqZqFyAn4hnHXwIg/PrjPoOf1qk=; b=GkSUgIEzuRPOgqrL+SILrwOcVz9QJCS+3QHhJr9EjMPm/ZPQqOV0P30fAr3Sph2xQ4 b97R0CnAKeaAAeVDJWDnRpLOPL7NPlV6G71fLZ1bEcxRoYQgXJ4PIanYqs/08k8Fz52P Ns+2bGWBRH3Nm0nWy13ASWfLHdqEKXa4RwHkBNaJXanl8fezU+kIr7M8p25U6OyvDnVZ i9qEN0CP9qI886Ta1wivoqgv2kBlYbtvxz5GEyLci6sCrUXrWyHodIG/yKX0/NSS25X8 yRBdU43FbqtTYX3Wydk/t3xGIbbSR6/UcAI0ryNt4UTDhmanyWOOwg0D2LQKF7hak1Xb CypQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H3EsHpNhp7xDtcLSzqZqFyAn4hnHXwIg/PrjPoOf1qk=; b=cr0mosi6wVt8bPmABh1szC+eS/aEd9qsbEuhJbzc27L6IimeMzvB8LgvQKV4Z7gbrT cOHYF7qqaZlF6ec8eCxrCrP0cO9oxT2q9iNDm0SoGrpiB1pu50ENesKs7wZoEcMX+yks joi9vDtne6bXdn6wJFdftxIg5VXAP/igCMGWe4G4kOLME8Qqy7q3pyIBfMXUmJGrGX+I o/C99thofzWzBwf9NU1cA+ikLinIQjQM3ll69EZET/fxwCWKgwcQVPOvgAgbIW8rzc/V I17oIMukWeS646zYTN1rEZI01WwgN60/ofmmOB8n9MDNgkUdSmTt2GpuCBf9Mf66+1Me Ggxg== X-Gm-Message-State: AOAM533Tq1YOqs57w+d8wHkKCrytwYIAO8pv8yo7fyO9f99sV6eizrFj RpoHe4Mq3+Pvuy0zF0h/zl+w2+1gJ2neEw== X-Google-Smtp-Source: ABdhPJw12S2rtwIF3utqYZwg3VFok0JH8sMnXDtOWaErrd23bunRbnWDo99Xnc9Z/H3GS+DrZMfYJQ== X-Received: by 2002:a1c:21c5:0:b0:37d:40d0:94c7 with SMTP id h188-20020a1c21c5000000b0037d40d094c7mr3479774wmh.1.1645052005363; Wed, 16 Feb 2022 14:53:25 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id o125sm182539wme.37.2022.02.16.14.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 14:53:24 -0800 (PST) From: Daniel Scally To: linux-acpi@vger.kernel.org, linux-clk@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: rafael@kernel.org, lenb@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, hdegoede@redhat.com, markgross@kernel.org, robert.moore@intel.com Subject: [PATCH 5/6] platform/x86: int3472: Support multiple gpio lookups in board data Date: Wed, 16 Feb 2022 22:53:03 +0000 Message-Id: <20220216225304.53911-6-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216225304.53911-1-djrscally@gmail.com> References: <20220216225304.53911-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Currently, we only support passing a single gpiod_lookup_table as part of the board data for the tps68470 driver. This carries the implicit assumption that each TPS68470 device will only support a single sensor, which does not hold true. Extend the code to support the possibility of multiple sensors each having a gpiod_lookup_table, and opportunistically add the lookup table for the Surface Go line's IR camera. Signed-off-by: Daniel Scally --- drivers/platform/x86/intel/int3472/tps68470.c | 18 ++++++++++----- drivers/platform/x86/intel/int3472/tps68470.h | 3 ++- .../x86/intel/int3472/tps68470_board_data.c | 22 ++++++++++++++++--- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index b535564712bb..736480961ec3 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -150,6 +150,7 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) struct regmap *regmap; int device_type; int ret; + int i; n_consumers = skl_int3472_fill_clk_pdata(&client->dev, &clk_pdata); if (n_consumers < 0) @@ -194,15 +195,18 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) cells[1].pdata_size = sizeof(struct tps68470_regulator_platform_data); cells[2].name = "tps68470-gpio"; - gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_table); + for (i = 0; i < board_data->n_gpiod_lookups; i++) + gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, cells, TPS68470_WIN_MFD_CELL_COUNT, NULL, 0, NULL); kfree(cells); - if (ret) - gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_table); + if (ret) { + for (i = 0; i < board_data->n_gpiod_lookups; i++) + gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); + } break; case DESIGNED_FOR_CHROMEOS: @@ -226,10 +230,12 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) static int skl_int3472_tps68470_remove(struct i2c_client *client) { const struct int3472_tps68470_board_data *board_data; - + int i; board_data = int3472_tps68470_get_board_data(dev_name(&client->dev)); - if (board_data) - gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_table); + if (board_data) { + for (i = 0; i < board_data->n_gpiod_lookups; i++) + gpiod_remove_lookup_table(board_data->tps68470_gpio_lookup_tables[i]); + } return 0; } diff --git a/drivers/platform/x86/intel/int3472/tps68470.h b/drivers/platform/x86/intel/int3472/tps68470.h index cfd33eb62740..35915e701593 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.h +++ b/drivers/platform/x86/intel/int3472/tps68470.h @@ -16,8 +16,9 @@ struct tps68470_regulator_platform_data; struct int3472_tps68470_board_data { const char *dev_name; - struct gpiod_lookup_table *tps68470_gpio_lookup_table; const struct tps68470_regulator_platform_data *tps68470_regulator_pdata; + unsigned int n_gpiod_lookups; + struct gpiod_lookup_table *tps68470_gpio_lookup_tables[]; }; const struct int3472_tps68470_board_data *int3472_tps68470_get_board_data(const char *dev_name); diff --git a/drivers/platform/x86/intel/int3472/tps68470_board_data.c b/drivers/platform/x86/intel/int3472/tps68470_board_data.c index 525f09a3b5ff..442a8a2de224 100644 --- a/drivers/platform/x86/intel/int3472/tps68470_board_data.c +++ b/drivers/platform/x86/intel/int3472/tps68470_board_data.c @@ -96,7 +96,7 @@ static const struct tps68470_regulator_platform_data surface_go_tps68470_pdata = }, }; -static struct gpiod_lookup_table surface_go_tps68470_gpios = { +static struct gpiod_lookup_table surface_go_int347a_gpios = { .dev_id = "i2c-INT347A:00", .table = { GPIO_LOOKUP("tps68470-gpio", 9, "reset", GPIO_ACTIVE_LOW), @@ -105,16 +105,32 @@ static struct gpiod_lookup_table surface_go_tps68470_gpios = { } }; +static struct gpiod_lookup_table surface_go_int347e_gpios = { + .dev_id = "i2c-INT347E:00", + .table = { + GPIO_LOOKUP("tps68470-gpio", 5, "enable", GPIO_ACTIVE_HIGH), + { } + } +}; + static const struct int3472_tps68470_board_data surface_go_tps68470_board_data = { .dev_name = "i2c-INT3472:05", - .tps68470_gpio_lookup_table = &surface_go_tps68470_gpios, .tps68470_regulator_pdata = &surface_go_tps68470_pdata, + .n_gpiod_lookups = 2, + .tps68470_gpio_lookup_tables = { + &surface_go_int347a_gpios, + &surface_go_int347e_gpios, + } }; static const struct int3472_tps68470_board_data surface_go3_tps68470_board_data = { .dev_name = "i2c-INT3472:01", - .tps68470_gpio_lookup_table = &surface_go_tps68470_gpios, .tps68470_regulator_pdata = &surface_go_tps68470_pdata, + .n_gpiod_lookups = 2, + .tps68470_gpio_lookup_tables = { + &surface_go_int347a_gpios, + &surface_go_int347e_gpios, + } }; static const struct dmi_system_id int3472_tps68470_board_data_table[] = { From patchwork Wed Feb 16 22:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 543411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14C85C4321E for ; Wed, 16 Feb 2022 22:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237887AbiBPWxu (ORCPT ); Wed, 16 Feb 2022 17:53:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237898AbiBPWxk (ORCPT ); Wed, 16 Feb 2022 17:53:40 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D33DD2271E3; Wed, 16 Feb 2022 14:53:27 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id d14-20020a05600c34ce00b0037bf4d14dc7so2675567wmq.3; Wed, 16 Feb 2022 14:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a+uUHPaRW0+U9cBcYhuZP/dhS3pWpicIDdXLzyTxVks=; b=FV1Sl4rFc9LscmTaSkNE8UIwcEvRxnOJPtLVskZcTY1dZJCK12OASLPRNn5JGiNU+V 4AXGah+Vhq/jOM/JtkM2WlgJLaPdq1XYaWUNYI97R96etxLEsvAZS1Bk0IdSOFK6lLwb FKp/HyVzyz+SW6pBZaGdjG62mdMIFpVZkkNZQrckkxnvzfrkZxhS2Tj8vKqVjSaXQ5JA QDV8a95XxaCLL83Z7cvpSHruqxj0gdVslejyfOrFtcC8D//yNUhiGXkZsMoCOVBTDb6F Ojj+gOJ0paz4XUmMDy00rxemK1qkK6ZxvGvswjfEeW05B55F28SunkLHw+tku9A+2H1Y Nl+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a+uUHPaRW0+U9cBcYhuZP/dhS3pWpicIDdXLzyTxVks=; b=oa1cRInIkFs24DnA5GqCogysU+4Q2KR/5ZK/uw87jvTJeTRwqF/QmDS20qNVz3GH3O Cam0GuK7sMh9gJMUOhgZu/u8Lbs+FprI1evHglFwMkEhyVj1qjdPSpuPhG/YIhOJCVPl 2odJfalNcETNzmnfdpBIqcz1YMqy2b1N1GhbZDfD0/9LSbcDn8XZ1klXvgZMcmF6L9ot f0Ozt49KLXaSzqaRlSc6GGosVCJ5Bl3gg2PONIkdJuJ1O0l2sqEtcykLEu2je9LUJznS 9oOauTfK9zUdnJPsrM6tWkdAvA3n2CbpXNNjkw2DhybTj/GVPOjxZ8RQzYRnGUZiYm15 AqQA== X-Gm-Message-State: AOAM532tvwttgnyuiCaWMLa4RX2dEIWgaf7BByo2QWy5BGZcuMr0Psj4 x/hGSlV1/v9/zAaB5AXv5IHcy9/GhcAuJQ== X-Google-Smtp-Source: ABdhPJzqPgn9j0leHfOsffu6ctdruNLH02FeQi1pUnvtOESsUKcCOpBL1Wucp+vo9sN2vFALUxJEXw== X-Received: by 2002:a05:600c:4782:b0:37b:f836:78c7 with SMTP id k2-20020a05600c478200b0037bf83678c7mr3460007wmo.129.1645052006495; Wed, 16 Feb 2022 14:53:26 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id o125sm182539wme.37.2022.02.16.14.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 14:53:26 -0800 (PST) From: Daniel Scally To: linux-acpi@vger.kernel.org, linux-clk@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: rafael@kernel.org, lenb@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, hdegoede@redhat.com, markgross@kernel.org, robert.moore@intel.com Subject: [PATCH 6/6] platform/x86: int3472: Add board data for Surface Go2 IR camera Date: Wed, 16 Feb 2022 22:53:04 +0000 Message-Id: <20220216225304.53911-7-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216225304.53911-1-djrscally@gmail.com> References: <20220216225304.53911-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add the board data describing the regulators for the Microsoft Surface Go line's IR camera. Signed-off-by: Daniel Scally --- .../x86/intel/int3472/tps68470_board_data.c | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/tps68470_board_data.c b/drivers/platform/x86/intel/int3472/tps68470_board_data.c index 442a8a2de224..49a3591c6d85 100644 --- a/drivers/platform/x86/intel/int3472/tps68470_board_data.c +++ b/drivers/platform/x86/intel/int3472/tps68470_board_data.c @@ -30,6 +30,15 @@ static struct regulator_consumer_supply int347a_vcm_consumer_supplies[] = { static struct regulator_consumer_supply int347a_vsio_consumer_supplies[] = { REGULATOR_SUPPLY("dovdd", "i2c-INT347A:00"), REGULATOR_SUPPLY("vsio", "i2c-INT347A:00-VCM"), + REGULATOR_SUPPLY("vddd", "i2c-INT347E:00"), +}; + +static struct regulator_consumer_supply int347a_aux1_consumer_supplies[] = { + REGULATOR_SUPPLY("vdda", "i2c-INT347E:00"), +}; + +static struct regulator_consumer_supply int347a_aux2_consumer_supplies[] = { + REGULATOR_SUPPLY("vdddo", "i2c-INT347E:00"), }; static const struct regulator_init_data surface_go_tps68470_core_reg_init_data = { @@ -86,6 +95,28 @@ static const struct regulator_init_data surface_go_tps68470_vsio_reg_init_data = .consumer_supplies = int347a_vsio_consumer_supplies, }; +static const struct regulator_init_data surface_go_tps68470_aux1_reg_init_data = { + .constraints = { + .min_uV = 2815200, + .max_uV = 2815200, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(int347a_aux1_consumer_supplies), + .consumer_supplies = int347a_aux1_consumer_supplies, +}; + +static const struct regulator_init_data surface_go_tps68470_aux2_reg_init_data = { + .constraints = { + .min_uV = 1800600, + .max_uV = 1800600, + .apply_uV = 1, + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(int347a_aux2_consumer_supplies), + .consumer_supplies = int347a_aux2_consumer_supplies, +}; + static const struct tps68470_regulator_platform_data surface_go_tps68470_pdata = { .reg_init_data = { [TPS68470_CORE] = &surface_go_tps68470_core_reg_init_data, @@ -93,6 +124,8 @@ static const struct tps68470_regulator_platform_data surface_go_tps68470_pdata = [TPS68470_VCM] = &surface_go_tps68470_vcm_reg_init_data, [TPS68470_VIO] = &surface_go_tps68470_vio_reg_init_data, [TPS68470_VSIO] = &surface_go_tps68470_vsio_reg_init_data, + [TPS68470_AUX1] = &surface_go_tps68470_aux1_reg_init_data, + [TPS68470_AUX2] = &surface_go_tps68470_aux2_reg_init_data, }, };