From patchwork Fri Oct 8 16:21:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 12545789 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18F1AC433FE for ; Fri, 8 Oct 2021 16:25:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0670761038 for ; Fri, 8 Oct 2021 16:25:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237676AbhJHQ1f (ORCPT ); Fri, 8 Oct 2021 12:27:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24235 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238060AbhJHQ1Y (ORCPT ); Fri, 8 Oct 2021 12:27:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633710328; 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=8EjygOpFJynKm91W3p2Pl14fbKVwnx9xc1tF3Y/Nqb4=; b=jV8BTrHIVTtcO9ZEyrVNqkbKFTKjT4syMR89xRgqbb2ps9hjz0V4FjccNgp/Zm+ZzZPaUZ FWZKfjQJw3/AkPQLxadlenCq+/7rkFsmItQ9q+i4v5sVv/6LByGGzUfd1CuoDcZjOudyJU U+ijuFHa37XtdZ3HHdjoOfK3GdvA9iE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-374-4_mLf8_LOIuEkyHvW7xDHg-1; Fri, 08 Oct 2021 12:25:24 -0400 X-MC-Unique: 4_mLf8_LOIuEkyHvW7xDHg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF7D68464D4; Fri, 8 Oct 2021 16:23:27 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.192.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6018C60BF1; Fri, 8 Oct 2021 16:23:23 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Mark Gross , Andy Shevchenko , Daniel Scally , Laurent Pinchart , Mauro Carvalho Chehab , Liam Girdwood , Mark Brown , Michael Turquette , Stephen Boyd Cc: Hans de Goede , Len Brown , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Sakari Ailus , Kate Hsuan , linux-media@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH 12/12] platform/x86: int3472: Call acpi_dev_clear_dependencies() on successful probe Date: Fri, 8 Oct 2021 18:21:21 +0200 Message-Id: <20211008162121.6628-13-hdegoede@redhat.com> In-Reply-To: <20211008162121.6628-1-hdegoede@redhat.com> References: <20211008162121.6628-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org The clk and regulator frameworks expect clk/regulator consumer-devices to have info about the consumed clks/regulators described in the device's fw_node. To work around this info missing from the ACPI tables on devices where the int3472 driver is used, the int3472 MFD-cell drivers attach info about consumers to the clks/regulators when registering these. This causes problems with the probe ordering wrt drivers for consumers of these clks/regulators. Since the lookups are only registered when the provider-driver binds, trying to get these clks/regulators before then results in a -ENOENT error for clks and a dummy regulator for regulators. All the sensor ACPI fw-nodes have a _DEP dependency on the INT3472 ACPI fw-node, so to work around these probe ordering issues the sensor drivers call the has_unmet_acpi_deps() helper and return -EPROBE_DEFER if this returns true. Add MODULE_SOFTDEP dependencies for the gpio/clk/regulator drivers for the instantiated MFD-cells so that these are loaded before us and so that they bind immediately when the platform-devs are instantiated; and call acpi_dev_clear_dependencies() on successful probe. This way we ensure that the gpio/clk/regulators are registered before we call acpi_dev_clear_dependencies() and the sensor drivers can then use has_unmet_acpi_deps() helper to wait for this. Signed-off-by: Hans de Goede --- drivers/platform/x86/intel/int3472/discrete.c | 1 + drivers/platform/x86/intel/int3472/tps68470.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index fefe12850777..e23a45b985dc 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -380,6 +380,7 @@ static int skl_int3472_discrete_probe(struct platform_device *pdev) return ret; } + acpi_dev_clear_dependencies(adev); return 0; } diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 36b657888fe2..781ce6ead720 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -166,6 +166,9 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) return device_type; } + if (ret == 0) + acpi_dev_clear_dependencies(adev); + return ret; } @@ -199,3 +202,4 @@ module_i2c_driver(int3472_tps68470); MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI TPS68470 Device Driver"); MODULE_AUTHOR("Daniel Scally "); MODULE_LICENSE("GPL v2"); +MODULE_SOFTDEP("pre: gpio-tps68470 clk-tps68470 tps68470-regulator");