Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp914524rdb; Fri, 22 Dec 2023 08:35:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFklKWG0n4Xs5c6peORIqO15MAwK9kXPdkGB+Fxp9q9jk8W8FFts4BZx9mswNyActOKVfdv X-Received: by 2002:a17:902:f68a:b0:1d3:d1ee:9c0a with SMTP id l10-20020a170902f68a00b001d3d1ee9c0amr1311014plg.87.1703262928494; Fri, 22 Dec 2023 08:35:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703262928; cv=none; d=google.com; s=arc-20160816; b=S3fIox1uPcxqlG21sLQSbXICrM+VjLi8nDNg3NoOKLA2Fu9ej26QuMCaSCnfORw3sU tAD2rPp7gI9LBQDt4B05dv5KiIBugimHXjFvgL9FcByg5jOiyxFEqLyU0G+qvhkqrPZ6 uSW7jmIbO9D2pTcrvH+aFYVLooE/fD1uFOmTbVOVfcjgemBOpn0Mkz4/LzXc9iLol8gg k8dZmbYDIFsDFy1//mxakEFzqiYc/5b1erFQjWTot2ge5spABV4mar+S5ATaxleAWpaf HX3Ua8gh/sF0cctOW/fkenngqEC6GAjZeTuioIKsZVqoOs4m8TrT5kLObbKlMwIJ8Ej4 C0ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=03FGUqiAZnK+EX1rqlT/WLb1UlXLePLcXviq90my8ks=; fh=hgwmFA2XOPFns70T+lQrZ9c2fFqp2niNzRENZlDRHtw=; b=v7cjr1aHtdZ8sN1P42KA8IfmuGsvU+QZuk5d7L4rnWrWSrbQA+tLr3pNqxOmG2OMsV Jah4Qw+4GCbO4qdhu1uMMVac3r46KkWqsBSCE2bt2O4zKzsXTqW/5OaHvpq+2uXcPGDf DsY90kQMERyMXAN/6mvhxTyTNnFSODGaFed6Emf4ryWa4O+mnCb07wfuXF/pvxGSGHZx bbVR3hGp5s8DA0TSY3xzqXIq3QYGmAX2ap+yvyKLxsURq8VxNuoKZMebLwh7BDKpavr1 YDgQp6GML2TiaIe3GgXCN5xDc7d3SnrZLfrTrc5p5FRGAsIQLMrhrpuutQqfflUXkMjS rh9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-9913-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9913-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b21-20020a170902ed1500b001d42d53956asi307938pld.252.2023.12.22.08.35.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 08:35:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9913-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-9913-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9913-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2DA7C281EEE for ; Fri, 22 Dec 2023 16:35:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36A4024B5D; Fri, 22 Dec 2023 16:35:21 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52F5D249FD; Fri, 22 Dec 2023 16:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 12901139F; Fri, 22 Dec 2023 08:36:03 -0800 (PST) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 17FAB3F7F5; Fri, 22 Dec 2023 08:35:13 -0800 (PST) Date: Fri, 22 Dec 2023 16:35:11 +0000 From: Cristian Marussi To: "Peng Fan (OSS)" Cc: Sudeep Holla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Oleksii Moisieiev , Linus Walleij , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, Peng Fan , AKASHI Takahiro Subject: Re: [PATCH 6/7] pinctrl: Implementation of the generic scmi-pinctrl driver Message-ID: References: <20231215-pinctrl-scmi-v1-0-0fe35e4611f7@nxp.com> <20231215-pinctrl-scmi-v1-6-0fe35e4611f7@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231215-pinctrl-scmi-v1-6-0fe35e4611f7@nxp.com> On Fri, Dec 15, 2023 at 07:56:34PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan > > scmi-pinctrl driver implements pinctrl driver interface and using > SCMI protocol to redirect messages from pinctrl subsystem SDK to > SCMI platform firmware, which does the changes in HW. > [CC: Akashi which was interested in this series] This generic driver still works fine for me as of now in my emulated setup using the generic SCMI bindings as in the initial Oleksii example and a dummy driver consumer for this pins, BUT there is still an open issue as reported by Akashi previously ..see below. > Co-developed-by: Oleksii Moisieiev > Signed-off-by: Oleksii Moisieiev > Signed-off-by: Peng Fan > --- > MAINTAINERS | 1 + > drivers/pinctrl/Kconfig | 11 ++ > drivers/pinctrl/Makefile | 1 + > drivers/pinctrl/pinctrl-scmi.c | 403 +++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 416 insertions(+) [snip] > +static const struct pinmux_ops pinctrl_scmi_pinmux_ops = { > + .request = pinctrl_scmi_request, > + .free = pinctrl_scmi_free, > + .get_functions_count = pinctrl_scmi_get_functions_count, > + .get_function_name = pinctrl_scmi_get_function_name, > + .get_function_groups = pinctrl_scmi_get_function_groups, > + .set_mux = pinctrl_scmi_func_set_mux, > +}; > + > +static int pinctrl_scmi_pinconf_get(struct pinctrl_dev *pctldev, unsigned int _pin, > + unsigned long *config) > +{ > + int ret; > + struct scmi_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); > + enum pin_config_param config_type; > + unsigned long config_value; > + > + if (!config) > + return -EINVAL; > + > + config_type = pinconf_to_config_param(*config); This config types that are packed/unpacked from the generic Pinctrl subsystem have also to be mapped/umapped, here and below, to the SCMI ones since they are slightly different/. IOW SCMI V3.2 Table_24 in the spec, which defines Pins Config Types as understood by an SCMI platform FW is NOT exactly mapping to the enum pin_config_param used by Pinctrl in its pinconf_to_config so you risk passing a config_type to the SCMI fw that does NOT mean at all what intended...if the FW is compliant with SCMI. > + > + ret = pinctrl_ops->config_get(pmx->ph, _pin, PIN_TYPE, config_type, &config_value); > + if (ret) > + return ret; > + > + *config = pinconf_to_config_packed(config_type, config_value); > + > + return 0; > +} > + > +static int pinctrl_scmi_pinconf_set(struct pinctrl_dev *pctldev, > + unsigned int _pin, > + unsigned long *configs, > + unsigned int num_configs) > +{ > + int ret; > + struct scmi_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); > + > + if (!configs || !num_configs) > + return -EINVAL; > + Same here, as said in the previous patch about pinctrl protocol, you should pack/unpack and map/unmap from Pinctrl packed configs and types to SCMI types and unpacked config/values, to fix the mismatch between Pinctrl and SCMI types and also to avoid the usage of Pinctrl helpers to extract the types from the SCMI protocol layer so that we can keep it agnostic in these regards. Thanks, Cristian