Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3256036rdh; Thu, 28 Sep 2023 07:03:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoqB61vqHZACw4cUeoENQVu+WJCABPsjt/98tqk5+2UHOBQ2fQKCLNOxzeU+cScdeYB9Y7 X-Received: by 2002:a05:6a20:1613:b0:160:6577:c527 with SMTP id l19-20020a056a20161300b001606577c527mr1375632pzj.52.1695909800886; Thu, 28 Sep 2023 07:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695909800; cv=none; d=google.com; s=arc-20160816; b=qwIlRZpt8wXbCIt3vg8iyAZOtjXbe9vXJqvpI3QszYOpWAOGhzmMSupREFv3FKen2x b7g3wjtqCV/7Ford4FsJh4bZoaQpTqd9Q2UoVHX2dRg95HY594MLCq8RuW+F9DiW0oUE w/YLgM6WBQkxzS7m1NcjXcdm2rQ5eARkSiAwNl0XZcwTlOwJspk7mjAueH3H3sKQI+cQ v2zAxI/S9zgpba7vmqk0Q6TSU3kzlqnNUcD/puQEbjpjw8ig3KaIW8AMWlmPxOXeVhAB 5/QHK21rYR1pCWBYgZ13B/iAIASAYCmoYswmlzy1BinCagK7xROII/jzp84Mw2zrxibH koaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=iIgaek/2vaj0JutvpQK/iD5J0G41ovSmgWF0taiXJOo=; fh=+J1tU8mYRS0tAzYCer2u4MwX4DmdoEjH6cAcxs8XMyc=; b=JypZJcSFW53CJrH90KVU2A/EzttueAVNKpoax3NAmRc0ABdx0dsHjkbwrsCB9TcVj4 KWDUqIoaT0yc1DQ3C76xejaJw1wKbM6n+agw7HcNkGEjatFd3DiNEsHUZLiMt4O8KE// 9b95qy8i6K4punLzuGI96XklpBO3Qihe/rtmhQ9CIrFo94Daass+K8/aJxEWrYyWQ+M+ N5L0m3SSFj+N6GVOoeKK8lvN6PDhQ/dW/wOd5BPZy4GDk8YAMLu6dbIhiNCYdxh+NYNh hcRHp+89Fq7uJh/i2Z9EzeKxxiz6PF3VN3VgMlqIpjZCdX9jqDh8EwFbgpoWF1WTZXiS i3RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ABnrU8ga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id r200-20020a632bd1000000b00578afd89baasi18408205pgr.744.2023.09.28.07.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 07:03:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ABnrU8ga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7AF5283711B1; Thu, 28 Sep 2023 05:43:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232493AbjI1Mnr (ORCPT + 99 others); Thu, 28 Sep 2023 08:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbjI1Mnr (ORCPT ); Thu, 28 Sep 2023 08:43:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10846199 for ; Thu, 28 Sep 2023 05:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695904976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iIgaek/2vaj0JutvpQK/iD5J0G41ovSmgWF0taiXJOo=; b=ABnrU8gadb0LF5VFST68oT/RuNSM96XzrjGVavQwZAwyQuqyisMkamQbdSAvdoOBnQDdGT 97ChURdTQth5gbFu1W+zRLEXaGT52yVPaaT7DUZ4ipXvO+yUCLGIvZQOoFXyQ8fG+ASPuT u8NRBfMCVaNEP9bZqomYqCFSxiK+6XI= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-512-Zxjyr6-RO4aPOY1GhBmHqw-1; Thu, 28 Sep 2023 08:42:54 -0400 X-MC-Unique: Zxjyr6-RO4aPOY1GhBmHqw-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9a9f282713fso1074085066b.3 for ; Thu, 28 Sep 2023 05:42:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695904973; x=1696509773; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iIgaek/2vaj0JutvpQK/iD5J0G41ovSmgWF0taiXJOo=; b=gKUtgRse33qKzFGT5xSDByXGib9yCy2t5Bd52RrEIaGxLDblxM+MPym0rC15YjSa/M N4arZ8bn3xAWGZXoHsRKfX4ysgVZHsrN9iaQLz8mkTk6i7mpW1y0sV5ACfGYTu0E52SC nRfFKX++CXXqxfZG9y4cHXU20/wrkotXyxN1L9DYO1ob5It0/V1cXzo7ZFBgGxT0JeyK Vf74AOrcvp26xo21zkkX92fPlaoeGewTRPhnrO4Sme62s3qfQUMdqRLDvtBrgsf/ECzn IqUo5ZkMgVTfHxpsLmW1T6fE8DNwRb/2cGh8nQf8uQkgD59mbP+gXVYrJgrqNix1PfCc v/MA== X-Gm-Message-State: AOJu0Ywy3bTJ9kUfkovkPkn8vhUuTGeLCWzrsBLEa/95+r8iBVEAqwGy 5nJmkRTemC4RHKZGamOvz65NzTPc1eBHfyrU2M1BPQGNCKhVNW5SIURrQoRBkUCY1X8vgQBA0i/ iFf0S+xOy2e9rfiCpQhBrvfCa X-Received: by 2002:a17:906:209e:b0:9a5:874a:9745 with SMTP id 30-20020a170906209e00b009a5874a9745mr1015779ejq.26.1695904973509; Thu, 28 Sep 2023 05:42:53 -0700 (PDT) X-Received: by 2002:a17:906:209e:b0:9a5:874a:9745 with SMTP id 30-20020a170906209e00b009a5874a9745mr1015758ejq.26.1695904973121; Thu, 28 Sep 2023 05:42:53 -0700 (PDT) Received: from [192.168.1.217] ([109.36.138.103]) by smtp.gmail.com with ESMTPSA id bv13-20020a170906b1cd00b00993a37aebc5sm10864511ejb.50.2023.09.28.05.42.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 05:42:52 -0700 (PDT) Message-ID: Date: Thu, 28 Sep 2023 14:42:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 2/5] platform/x86: int3472: Add new skl_int3472_gpiod_get_from_temp_lookup() helper Content-Language: en-US From: Hans de Goede To: Bartosz Golaszewski , Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , 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 References: <20230926145943.42814-1-brgl@bgdev.pl> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 05:43:50 -0700 (PDT) Add a new skl_int3472_gpiod_get_from_temp_lookup() helper. This is a preparation patch for removing usage of the deprecated gpiod_toggle_active_low() and acpi_get_and_request_gpiod() functions. Signed-off-by: Bartosz Golaszewski [hdegoede@redhat.com] use the new skl_int3472_fill_gpiod_lookup() helper Signed-off-by: Hans de Goede --- drivers/platform/x86/intel/int3472/discrete.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index 351ecf047944..a46c3a206aa3 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -99,6 +99,32 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347 return 0; } +/* This should *really* only be used when there's no other way... */ +static struct gpio_desc * +skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472, + struct acpi_resource_gpio *agpio, + const char *func, u32 polarity) +{ + struct gpio_desc *desc; + int ret; + + struct gpiod_lookup_table *lookup __free(kfree) = + kzalloc(struct_size(lookup, table, 1), GFP_KERNEL); + if (!lookup) + return ERR_PTR(-ENOMEM); + + lookup->dev_id = dev_name(int3472->dev); + ret = skl_int3472_fill_gpiod_lookup(&lookup->table[0], agpio, func, polarity); + if (ret) + return ERR_PTR(ret); + + gpiod_add_lookup_table(lookup); + desc = gpiod_get(int3472->dev, func, GPIOD_OUT_LOW); + gpiod_remove_lookup_table(lookup); + + return desc; +} + static void int3472_get_func_and_polarity(u8 type, const char **func, u32 *polarity) { switch (type) { -- 2.41.0