From patchwork Sun Oct 10 18:57:05 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: 1539056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=MaibWr1w; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4HSB5Z5LQhz9sRN for ; Mon, 11 Oct 2021 05:58:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233039AbhJJTAH (ORCPT ); Sun, 10 Oct 2021 15:00:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42927 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232965AbhJJS75 (ORCPT ); Sun, 10 Oct 2021 14:59:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633892278; 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=t/nARUeVGuwrsHYxppUAXi0zfUBMakEhsyuZht1F95E=; b=MaibWr1whQD/NAa7kOmVXhz+t48gu/iEYNVJo53nDBJh8yhP4iOlccEffWjiYoL6akVmDI 80yBmHmIWMwASq+7keIrcqs9PpY1QQbajqgtnkxFJKe8s3NSj7s/4yAtj6jAaNju8O7YiH gEFSsNnonk3stU7hTBJp9qsXUblieNA= 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-486-yJHa3TetPbObpycdwdLzCw-1; Sun, 10 Oct 2021 14:57:54 -0400 X-MC-Unique: yJHa3TetPbObpycdwdLzCw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 66310362F8; Sun, 10 Oct 2021 18:57:52 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.192.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42AFE5F4E1; Sun, 10 Oct 2021 18:57:47 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Mark Gross , Andy Shevchenko , Wolfram Sang , Mika Westerberg , 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, linux-i2c@vger.kernel.org, Sakari Ailus , Kate Hsuan , linux-media@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH v3 09/11] platform/x86: int3472: Pass tps68470_clk_platform_data to the tps68470-regulator MFD-cell Date: Sun, 10 Oct 2021 20:57:05 +0200 Message-Id: <20211010185707.195883-10-hdegoede@redhat.com> In-Reply-To: <20211010185707.195883-1-hdegoede@redhat.com> References: <20211010185707.195883-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Pass tps68470_clk_platform_data to the tps68470-clk MFD-cell, so that sensors which use the TPS68470 can find their clock. Signed-off-by: Hans de Goede --- Changes in v2: - Put the GPIO cell last because acpi_gpiochip_add() calls acpi_dev_clear_dependencies() and the clk + regulators must be ready when this happens. --- drivers/platform/x86/intel/int3472/tps68470.c | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index e95b0f50b384..cb161aef22bd 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "common.h" @@ -17,12 +18,6 @@ static const struct mfd_cell tps68470_cros[] = { { .name = "tps68470_pmic_opregion" }, }; -static const struct mfd_cell tps68470_win[] = { - { .name = "tps68470-gpio" }, - { .name = "tps68470-clk" }, - { .name = "tps68470-regulator" }, -}; - static const struct regmap_config tps68470_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -105,10 +100,17 @@ static int skl_int3472_tps68470_calc_type(struct acpi_device *adev) static int skl_int3472_tps68470_probe(struct i2c_client *client) { struct acpi_device *adev = ACPI_COMPANION(&client->dev); + struct tps68470_clk_platform_data clk_pdata = {}; + 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; + regmap = devm_regmap_init_i2c(client, &tps68470_regmap_config); if (IS_ERR(regmap)) { dev_err(&client->dev, "Failed to create regmap: %ld\n", PTR_ERR(regmap)); @@ -126,9 +128,24 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) device_type = skl_int3472_tps68470_calc_type(adev); switch (device_type) { case DESIGNED_FOR_WINDOWS: - ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, - tps68470_win, ARRAY_SIZE(tps68470_win), + cells = kcalloc(3, sizeof(*cells), GFP_KERNEL); + if (!cells) + return -ENOMEM; + + cells[0].name = "tps68470-clk"; + cells[0].platform_data = &clk_pdata; + cells[0].pdata_size = sizeof(clk_pdata); + cells[1].name = "tps68470-regulator"; + /* + * The GPIO cell must be last because acpi_gpiochip_add() calls + * acpi_dev_clear_dependencies() and the clk + regulators must + * be ready when this happens. + */ + cells[2].name = "tps68470-gpio"; + + ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE, cells, 3, NULL, 0, NULL); + kfree(cells); break; case DESIGNED_FOR_CHROMEOS: ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE,