From patchwork Tue Sep 26 14:59:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 144934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1981450vqu; Tue, 26 Sep 2023 08:03:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGS2eOobA9+Eq0nhdw0a+jdmS6/aRU55bj1ZZ38yt3VyiUSCmyFEFJrx9u7AckhNb2yfMxh X-Received: by 2002:a05:6a20:3950:b0:15e:bb88:b771 with SMTP id r16-20020a056a20395000b0015ebb88b771mr6300458pzg.37.1695740612816; Tue, 26 Sep 2023 08:03:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695740612; cv=none; d=google.com; s=arc-20160816; b=JBi9haKWHxEseiC2uLOLN+LhdXLegEaGtj0cQBjZWvptfyxk0MwJfcD1jWL41q8R7j Fj8cMFNDinAW0NKLbyBh55110xg/9LdJTC48LkBXxly6UzOKd1cRF3z9rMxcw1g1iXUV JhWgGtz3rohD7lrejF4Cxit93tQLqccoFQuyCcLI4PdbB9W/zC4BEQ4CHvw0lPghfSu7 FqQ2EXvRPLanVZG4DAfkLu0hu+O0jOAOpr7TTrbjlDuXMrezGJGFFZltOwFV6YSIoSgE Y7kTwGhBMjZH2bl3es1ZVWLzhPhlGTubvMiq85K5aPLPh+IMGwsrgsnAdPxWWSvy3NuH Lygg== 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=95OtrKREF8DsDqawHPxVwUVS1xHqZyiLo+RbQA771N0=; fh=Tss7K8NVbsMYNZ1fG9jf8bECM8zIrRfQ37piI3ZudAE=; b=t4DfCOeAZaSjnOEpDlQ411BD2QSHHPfx1I/ZBY4k1J+iSV0U7D4jrRSA3E59dHhWYV JskDBiCpYYu/NlWG5xW2KOsqXuvXd9UcLSK8mPBKmIS3Tlw5Jw+uNkoJPMsnIbU0sL3l CfhfI9PcF9VxMoIFBpiHhpIjSPduvqraQjfn8JVMr9JW83f0hHPflrlkHDOQ9++IO5Gw AA+CZAW/nl/DSo6TG/BMg1SKjsbnbiGTUj0KWoOwU7u8SesQYGqk4aDzAqFReSQGQAwW +cvhB6UuUGqs9KsEfOKEMigLmF6fZzXIvmgC6Lra3TnW9DJEKV15RBIndDlmxAihzFTE 4K6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=w4ZxVzxq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id s185-20020a632cc2000000b00573fb3325b3si13025506pgs.481.2023.09.26.08.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 08:03:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=w4ZxVzxq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6F1A781EA5F0; Tue, 26 Sep 2023 08:00:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235012AbjIZPAI (ORCPT + 28 others); Tue, 26 Sep 2023 11:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234999AbjIZPAC (ORCPT ); Tue, 26 Sep 2023 11:00:02 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 812BB13A for ; Tue, 26 Sep 2023 07:59:55 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-405497850dbso70908355e9.0 for ; Tue, 26 Sep 2023 07:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740394; x=1696345194; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=95OtrKREF8DsDqawHPxVwUVS1xHqZyiLo+RbQA771N0=; b=w4ZxVzxqVCw4qjgnYaUWgjZiZ016hC+aZ3J5ft8os76UZ3+SpjZEUYYUqJx8S/PUm1 hJzpz3PkJcRFX+7IvPfutngdq56J/H+jMnPhaoPysmc4Cb/1teL4yi0biPWA3yom6LD2 IgsPVS9ps/GpLPkMU7AQMOj/xyKC79ID7av5cJCzt5K7X1qMqpUIHxX7EqpBAUi1Sm7L I2kM6WB2rlsfA/z7Cim9HzJon3X4w67OMGmaRPfHeinzXvThbOXmLDVZETuokriRt0nd FBLj3mIXozbwELB/6XvMziXDc+rh3mMIadt/4pmE7o6gYoarfc7aWNHDE6ivrzbEoLgy 37Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740394; x=1696345194; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=95OtrKREF8DsDqawHPxVwUVS1xHqZyiLo+RbQA771N0=; b=ljEjTLHeXpYnJLiSbWNZmZcF42/YjCJstz2d+zAlXX71g3x9fy65Be9tQvr6s4x9tX Q03QNKjWnFLoxQMizZgsICI7N9c6iLxDmAjw0wO8e2aJnBQw1xdAW+NggeXIX4BJxLlo Wl0ys3PhYhETcTF4OFMtYR9LcKHhjPBAstHXLaYPEPokbFu8QTiPgP/f5rCgzCUwESBG l4hJBXBLAHbXX9TSS6NT9x3WWcyMHc910rOKqH7XY0T4JMepc9iEciCbVz4uwZQRwrNh 7DKrm8mTGYKjMai717ZWFURfZ2cWcwrrQyVttpuG3BUf5p+43zLhiXI3CG9uCFu9JOX6 twLw== X-Gm-Message-State: AOJu0YwY2i/P/Oj0KO7pjw27Il9GUyhfubKFkYwANf4V/2FWWpPkNPAD xtRVUFuePyRR2F0AJEvZOzWwUA== X-Received: by 2002:adf:ff8c:0:b0:317:ef76:b773 with SMTP id j12-20020adfff8c000000b00317ef76b773mr8594149wrr.45.1695740393987; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:53 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 3/4] platform/x86: int3472: clk_and_regulator: use GPIO lookup tables Date: Tue, 26 Sep 2023 16:59:42 +0200 Message-Id: <20230926145943.42814-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 26 Sep 2023 08:00:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778112908902150210 X-GMAIL-MSGID: 1778112908902150210 From: Bartosz Golaszewski Instead of acpi_get_and_request_gpiod() + gpiod_toggle_active_low(), use temporary lookup tables with appropriate lookup flags. Signed-off-by: Bartosz Golaszewski --- .../x86/intel/int3472/clk_and_regulator.c | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drivers/platform/x86/intel/int3472/clk_and_regulator.c index ef4b3141efcd..ec4c4848a2c4 100644 --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c @@ -174,20 +174,16 @@ int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int3472, if (int3472->clock.cl) return -EBUSY; - int3472->clock.ena_gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0], - "int3472,clk-enable"); + int3472->clock.ena_gpio = skl_int3472_gpiod_get_from_temp_lookup( + int3472->dev, path, agpio->pin_table[0], + "int3472,clk-enable", polarity, + GPIOD_OUT_LOW); if (IS_ERR(int3472->clock.ena_gpio)) { ret = PTR_ERR(int3472->clock.ena_gpio); int3472->clock.ena_gpio = NULL; return dev_err_probe(int3472->dev, ret, "getting clk-enable GPIO\n"); } - if (polarity == GPIO_ACTIVE_LOW) - gpiod_toggle_active_low(int3472->clock.ena_gpio); - - /* Ensure the pin is in output mode and non-active state */ - gpiod_direction_output(int3472->clock.ena_gpio, 0); - init.name = kasprintf(GFP_KERNEL, "%s-clk", acpi_dev_name(int3472->adev)); if (!init.name) { @@ -314,17 +310,17 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472, int3472->regulator.supply_name, &int3472_gpio_regulator_ops); - int3472->regulator.gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0], - "int3472,regulator"); + /* Ensure the pin is in output mode and non-active state */ + int3472->regulator.gpio = skl_int3472_gpiod_get_from_temp_lookup( + int3472->dev, path, agpio->pin_table[0], + "int3472,regulator", GPIO_ACTIVE_HIGH, + GPIOD_OUT_LOW); if (IS_ERR(int3472->regulator.gpio)) { ret = PTR_ERR(int3472->regulator.gpio); int3472->regulator.gpio = NULL; return dev_err_probe(int3472->dev, ret, "getting regulator GPIO\n"); } - /* Ensure the pin is in output mode and non-active state */ - gpiod_direction_output(int3472->regulator.gpio, 0); - cfg.dev = &int3472->adev->dev; cfg.init_data = &init_data; cfg.ena_gpiod = int3472->regulator.gpio;