From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82405C4345F for ; Tue, 16 Apr 2024 18:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0IuRQjzrMuhiHwwcFfGzHMJZAZne+V2PilD6NOjUXTI=; b=i4PWq5GO4uR13Z CTDUxJ+iLxnbr5AiXD3JC8Yps5S7d2RA7E6mQIayjwr/tONJ90iILaI2vWwhoRrBXlAdNc3C9W7oJ 2jKC39+YPdW9pQHllKMI+/8OKNmmP8isBosxfZkWgJxAECQnA4r3YaKd+pjzDKAQJ8jRGmqAMHrID uMvPj/0rVm0dVvgOuLz01zEsVkZ+7xsiWL6KEV4l5S4yW4GuaBD+iMMrdUQ+5GdkLRuH0vfII8rVn c2L1yaWvzaU955ncLkLTB0fgpJh+ZSemiC37IyE/Nkz3TdkmPFAYBQXrSJTMQxEaTgdsYZDqXNHrN nTkBU8bdSmw65IKQjiIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwnPq-0000000DInN-1NH9; Tue, 16 Apr 2024 18:20:22 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwnPm-0000000DIln-2oBU for linux-arm-kernel@lists.infradead.org; Tue, 16 Apr 2024 18:20:20 +0000 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-56e136cbcecso5744844a12.3 for ; Tue, 16 Apr 2024 11:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713291616; x=1713896416; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=LiZoFre+EEvabWrIaMGE+RnIgnE08Xi8rFbTEN0hiU4=; b=Oo9RBwm7l+E58nZ3ssRT0SoaNIUq8hFpeXlCxSIT7q8/JxRBF0kDfX6jZFySnavKu9 l4uS2IU+JnDo+QMylV9fwq+T2Ze2EZhksEugRRGbfLetRVLCFJK3wo731/wTZPr3APRG E7F5f9TpBwpna42mHjDFO2/Jj4tFmUKYsZUWhtemEcKumvPpFocpMRFaOM7PkkXvnp3O AW7P9Vf6GU4yEykL4vkJE8stMpbrV8QQObL62DwNPDCMrdI6WI0n+ulFikeqI+Lx5BQ/ sECi49U3x0hmOh7e2JSDh96vTVWQ8NwovlGzPIQ6n30YCGDWdfg8msEau/CP5tZCu+Fs V6KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713291616; x=1713896416; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LiZoFre+EEvabWrIaMGE+RnIgnE08Xi8rFbTEN0hiU4=; b=BXkYt8kb/wn8mO2DwI53+sWZmY2Im9cw79363GoLNye60yWrOg/fSxa/CXKC16qwvG I454ygrSd7Db2IMbQoH2wZIvsaH8fpkIklxHxgMhZ+RI3iWVlogb3mPAPB3PRpF+q22s rtRuSXzq5Y5IZDHaypHE614sp0M0ua4jocuKRLBry3cShWU4mIhPh15Dli1rSNj1cb3P eAZJP70aUVgNLfBsnglDiOjMCkhr5RoMD2Twret+YtmN7z/OqMXeYnsV7TVugh5dph/q iWf39lS/fEW4a3/39VdqSbmtcSfiShx9CAjNGh3hny+G4bdJLO+zJW9WAc4a8jwo580q hhzw== X-Forwarded-Encrypted: i=1; AJvYcCVQvkGTdMoRw5DlyuWRjm7SxBw5Kp3c7khMCB72p+KN+j6BUBwqmtso5kcpXaFLKQN99+cfN+nz/GDMT7/tjmNVFjhSxt4p60KmZQrp9TAvwRDQWtA= X-Gm-Message-State: AOJu0YwdyJm3Xz3EKcf/mU5mBjRivINMKdbxwKVpPKZR9uZChU5fpzOF kLB3wB4G5+pD7sqv9gi0xJ8eS3rvmzfhrkCRRTvepidcMAxuS9Srtdjqv/UhQ8Y= X-Google-Smtp-Source: AGHT+IFZwq6l2AcJ1KK82U+CiB1zqh+Plqpd5qrQkIit5NN7rI1eBA5ieSH+2EC/GhdndnlKEBkgKQ== X-Received: by 2002:a17:907:360d:b0:a52:5a04:faff with SMTP id bk13-20020a170907360d00b00a525a04faffmr6845924ejc.8.1713291616151; Tue, 16 Apr 2024 11:20:16 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id o7-20020a17090611c700b00a4672fb2a03sm7229104eja.10.2024.04.16.11.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 11:20:15 -0700 (PDT) Date: Tue, 16 Apr 2024 21:20:11 +0300 From: Dan Carpenter To: "Peng Fan (OSS)" , Cristian Marussi , Linus Walleij Cc: Sudeep Holla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dhruva Gole , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, Peng Fan , Oleksii Moisieiev Subject: Re: [PATCH v10 0/4] firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support Message-ID: <6c652af8-151e-4d8b-9587-8eae1254a4fe@moroto.mountain> References: <20240415-pinctrl-scmi-v10-0-59c6e7a586ee@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240415-pinctrl-scmi-v10-0-59c6e7a586ee@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_112018_789887_8EA36FE2 X-CRM114-Status: GOOD ( 19.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org I'm trying to re-base AKASHI Takahiro's gpio driver on top of your scmi pinctrl driver. https://lore.kernel.org/all/20231005025843.508689-1-takahiro.akashi@linaro.org/ I need to do something like this below to save the gpio information. So now, great, I have the information but I'm not sure how to export it from the scmi pinctrl driver to the gpio driver... (This is a probably a stupid question but I am real newbie with regards to gpio). The other thing is that the SCMI spec says: 4.11.2.7 PINCTRL_SETTINGS_GET This command can be used by an agent to get the pin or group configuration, and the function selected to be enabled. It can also be used to read the value of a pin when it is set to GPIO mode. What does that mean? Is that right, or is it something left over from a previous revision of the spec. regards, dan carpenter diff --git a/drivers/firmware/arm_scmi/pinctrl.c b/drivers/firmware/arm_scmi/pinctrl.c index a2a7f880d6a3..f803be8a223f 100644 --- a/drivers/firmware/arm_scmi/pinctrl.c +++ b/drivers/firmware/arm_scmi/pinctrl.c @@ -26,6 +26,7 @@ #define GET_PINS_NR(x) le32_get_bits((x), GENMASK(15, 0)) #define GET_FUNCTIONS_NR(x) le32_get_bits((x), GENMASK(15, 0)) +#define IS_GPIO_FUNC(x) le32_get_bits((x), BIT(17)) #define EXT_NAME_FLAG(x) le32_get_bits((x), BIT(31)) #define NUM_ELEMS(x) le32_get_bits((x), GENMASK(15, 0)) @@ -107,6 +108,7 @@ struct scmi_group_info { struct scmi_function_info { char name[SCMI_MAX_STR_SIZE]; bool present; + bool gpio; u32 *groups; u32 nr_groups; }; @@ -189,7 +191,7 @@ static int scmi_pinctrl_validate_id(const struct scmi_protocol_handle *ph, static int scmi_pinctrl_attributes(const struct scmi_protocol_handle *ph, enum scmi_pinctrl_selector_type type, - u32 selector, char *name, + u32 selector, char *name, bool *gpio, u32 *n_elems) { int ret; @@ -216,17 +218,20 @@ static int scmi_pinctrl_attributes(const struct scmi_protocol_handle *ph, tx->flags = cpu_to_le32(type); ret = ph->xops->do_xfer(ph, t); - if (!ret) { - if (n_elems) - *n_elems = NUM_ELEMS(rx->attributes); + if (ret) + goto xfer_put; - strscpy(name, rx->name, SCMI_SHORT_NAME_MAX_SIZE); + if (n_elems) + *n_elems = NUM_ELEMS(rx->attributes); - ext_name_flag = !!EXT_NAME_FLAG(rx->attributes); - } + if (type == FUNCTION_TYPE && gpio) + *gpio = !!IS_GPIO_FUNC(rx->attributes); - ph->xops->xfer_put(ph, t); + strscpy(name, rx->name, SCMI_SHORT_NAME_MAX_SIZE); + ext_name_flag = !!EXT_NAME_FLAG(rx->attributes); +xfer_put: + ph->xops->xfer_put(ph, t); if (ret) return ret; /* @@ -602,7 +607,7 @@ static int scmi_pinctrl_get_group_info(const struct scmi_protocol_handle *ph, int ret; ret = scmi_pinctrl_attributes(ph, GROUP_TYPE, selector, group->name, - &group->nr_pins); + NULL, &group->nr_pins); if (ret) return ret; @@ -687,7 +692,7 @@ static int scmi_pinctrl_get_function_info(const struct scmi_protocol_handle *ph, int ret; ret = scmi_pinctrl_attributes(ph, FUNCTION_TYPE, selector, func->name, - &func->nr_groups); + &func->gpio, &func->nr_groups); if (ret) return ret; @@ -778,7 +783,8 @@ static int scmi_pinctrl_get_pin_info(const struct scmi_protocol_handle *ph, if (!pin) return -EINVAL; - ret = scmi_pinctrl_attributes(ph, PIN_TYPE, selector, pin->name, NULL); + ret = scmi_pinctrl_attributes(ph, PIN_TYPE, selector, pin->name, NULL, + NULL); if (ret) return ret; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel