Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1183170rwb; Fri, 7 Oct 2022 09:08:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5q+Pg3tNboNgZlWHFm4aK+JDepGhgWoW9Ee0XqY5lYavZLaJoo5OvCmd+GQ/iWRSzjHPaP X-Received: by 2002:a05:6a00:1a94:b0:548:8ce8:db93 with SMTP id e20-20020a056a001a9400b005488ce8db93mr5906337pfv.13.1665158917198; Fri, 07 Oct 2022 09:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665158917; cv=none; d=google.com; s=arc-20160816; b=eG3XtyBGAJUzGAlvbvLVyvv/3KXbCvxifLoPYIMA0eVILTfB8xMUFvZg6dlOidYjPh v69/mn/53oFvKltqEDIdYT2PXYVUhtDi/JH5glziQFY5gtSdi6EFG1oXbvy/ovKu2VPa YYxeA3/XobxYk+Of06uIB3vzDN1jGOexQHTlYyPd5ILCk2J4qTcyOlW6WCD0jE7G73Ip /rPZvW3Lju1oIxrq+j62cetszsd3X4KDmb+jV9/LMIsTbhsog46e3WknUrYYk5G7G5iM F2Sahv/F3J86m8v4YAuDT0KAriYXGIIH14QuTn5NDQoCeMAbQMeDbsa/AxlYodtnU0Hy zJdA== 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=VLQAlVWKgnFcAs4oKksr0edNOGo9JTBw9R9RNxiD88k=; b=ORhdUsbJ/eCgUG+UNeUcnV/u84donWY7QGBk1+U3hjvlH8Bo76uhIz5XxgYkQxWpSH Oh6zfbyLbLJJyyzi4ZfrgwcS/I5d1Q9Crj5M/BAbT+NaHmQ7tyL2Mnq5D//Msj8fl1h+ GBwIgd1fEhPVWpans0zRXPFb72egaYGlCGnc5wuX8H5oPptnDNsU3mB5Fat5pNo4Xe9H 3XVBXrr8pZECCUzlGzOawLZSmTa0yYoXom++VO6X0x/Jr1PlIPaUhr/Te++XNY6XUOs5 Nc3PjuOwSs59ptGVJLElsQh3WTm/mrQzigKTr1/LCg41q4RtJvslmqO2ZCErHIenE0Tz yeFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=MPWQtEPE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a170902cf4b00b00178b88d40ebsi2752244plg.51.2022.10.07.09.08.20; Fri, 07 Oct 2022 09:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=MPWQtEPE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbiJGPQa (ORCPT + 99 others); Fri, 7 Oct 2022 11:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230007AbiJGPQ0 (ORCPT ); Fri, 7 Oct 2022 11:16:26 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88BFA95E51; Fri, 7 Oct 2022 08:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1665155785; x=1696691785; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MftuM8BEvNJXATFrd61V1+1XsawZc1H6WdLWix2XKxk=; b=MPWQtEPEm4atqrJLAnzOrhOIuvhlJZpCZ8I+ukbBfQKpNDMRQNrtkCDE 3HIt1LMgQx8G+pkfA6pSg/VyP1sSLkEFvfBc9MTH2IJBF0m25hp40rGic E/kzZlGww/NZA+1HK/PEVbk6s5vjUekc8dcr1/XdphdN+uVRAvwXH+uek ceTJJbObCtc7mJAdNZeD+AyeRQCMLAmJcwqh+lN4Egr5yfjMiqklfL8xc xsmtXWUQxjtoAJHOb/0FW+A+ypiyDCGV1RoC/6BqhB4zgf7QIa4h2fQkt F/tRDYXMjnVzfplKbNVgCBXjmAFB3qXzHSUZwICfFf+x/aM+2GqVzYaiJ w==; X-IronPort-AV: E=Sophos;i="5.95,167,1661842800"; d="scan'208";a="194275889" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Oct 2022 08:16:23 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 7 Oct 2022 08:16:23 -0700 Received: from ryan-Precision-5560.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Fri, 7 Oct 2022 08:16:23 -0700 From: To: , , , , CC: , , , Ryan Wanner Subject: [PATCH 1/2] pinctrl: at91-pio4: Add configuration to userspace Date: Fri, 7 Oct 2022 08:16:46 -0700 Message-ID: <20221007151647.98222-2-Ryan.Wanner@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221007151647.98222-1-Ryan.Wanner@microchip.com> References: <20221007151647.98222-1-Ryan.Wanner@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham 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 From: Ryan Wanner Adding support for line bias flags that have been implented in gpio API. There are functions in the gpiod library that can control line bias from userspace this adds that functionality to this driver. Adding .pin_config_set allows the driver's pin configuration to be accessed from userspace. The general idea for this as been taken from stm32, intel, and rockchip drivers that have userspace access for bias flags. Signed-off-by: Ryan Wanner --- drivers/pinctrl/pinctrl-at91-pio4.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 517f2a6330ad..13b77f1eb6e2 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -902,6 +902,25 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev, return 0; } +static int atmel_conf_pin_config_set(struct pinctrl_dev *pctldev, + unsigned pin, + unsigned long *configs, + unsigned num_configs) +{ + struct atmel_group *grp = atmel_pctl_find_group_by_pin(pctldev, pin); + + return atmel_conf_pin_config_group_set(pctldev, grp->pin, configs, num_configs); +} + +static int atmel_conf_pin_config_get(struct pinctrl_dev *pctldev, + unsigned pin, + unsigned long *configs) +{ + struct atmel_group *grp = atmel_pctl_find_group_by_pin(pctldev, pin); + + return atmel_conf_pin_config_group_get(pctldev, grp->pin, configs); +} + static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, unsigned int pin_id) @@ -949,6 +968,8 @@ static const struct pinconf_ops atmel_confops = { .pin_config_group_get = atmel_conf_pin_config_group_get, .pin_config_group_set = atmel_conf_pin_config_group_set, .pin_config_dbg_show = atmel_conf_pin_config_dbg_show, + .pin_config_set = atmel_conf_pin_config_set, + .pin_config_get = atmel_conf_pin_config_get, }; static struct pinctrl_desc atmel_pinctrl_desc = { @@ -1139,6 +1160,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) atmel_pioctrl->gpio_chip->label = dev_name(dev); atmel_pioctrl->gpio_chip->parent = dev; atmel_pioctrl->gpio_chip->names = atmel_pioctrl->group_names; + atmel_pioctrl->gpio_chip->set_config = gpiochip_generic_config; atmel_pioctrl->pm_wakeup_sources = devm_kcalloc(dev, atmel_pioctrl->nbanks, -- 2.34.1