Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2524927pxb; Fri, 8 Oct 2021 09:28:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqu0yW9DWtL4MmE8rjKyNsgJHYU7FYv+jYJcxLQQnhzTL0FFN6WG8Ujg91yNCQd7rnFpAP X-Received: by 2002:aa7:c411:: with SMTP id j17mr16522253edq.123.1633710503871; Fri, 08 Oct 2021 09:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633710503; cv=none; d=google.com; s=arc-20160816; b=nSOT6Wn2yR7Une32xH8khQzWL7kfO5Wyexf0nBee7dqyWGifBQ3lNU5IJNVz+WcBN/ t8Kf9kLfS81eBJPcqueOi9+22WusoJt+T/lxmygppNta+mLSk6R3QBFow0iIe4wIaFPz VymQBe+Dz6OIfaEjwULvzJWGnxr7rbd/Fsbd5fULTqkFO1CQ/L6roe2brJSg23SFHYsm 99Ov0TJCBNNgdCk9GoJB2rW3QfD3qheXAKofABW0xFLhqoa8liw9hjM93mF6bVXOySOU fOTFFGGQOXWRLTOglcXGmbnnxVInK+4kFY9j9uLqgqwTokR/yoUZasJ0lROn3PCPc8y9 f5+Q== 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=8EjygOpFJynKm91W3p2Pl14fbKVwnx9xc1tF3Y/Nqb4=; b=zxrjhZvW5Vp5dvM/qGPylaM80pRi43D99YieVuaMR1V9t4iWwxTBRkZfIs08Cmmcp4 UjlHRxRf+ZxQa/cLx2rrumSj2WDoE9dxHNxgOYMhfD0R1qZe3+UWeq/zF/apmsUsMDbF gz9pwKq6DHgJpnbybXGJ7USLqc2T3VQaiLg7J02Mba2YfI9Pi+6ZMdmMpeonVazgfCaG ZgQRuf+T5OnMC2LSaf18AQ6zpFqlZ5LVH88ktz/EgJpkodRBJWPWyv5vwgTKKknE2Ym7 4wIg2EVKkRbb6mS/sdCpniE9ude4wlBtxhUWC5/4ZSsnvx3b4EPARdwe2dZwa540Xraj Jeeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jV8BTrHI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd25si5607563ejc.391.2021.10.08.09.27.59; Fri, 08 Oct 2021 09:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jV8BTrHI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231164AbhJHQ1j (ORCPT + 99 others); Fri, 8 Oct 2021 12:27:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39656 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238070AbhJHQ1Y (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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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"); -- 2.31.1