Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp623787rdh; Wed, 23 Aug 2023 09:52:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgWoBVrAfnhsDQCRSzscgqJRHZiWEHWbrbqTVEQDlKWGedzrv3H8Ux9oGrwCGdREPF498a X-Received: by 2002:ac2:43c7:0:b0:500:8f64:52d4 with SMTP id u7-20020ac243c7000000b005008f6452d4mr3440031lfl.53.1692809541188; Wed, 23 Aug 2023 09:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692809541; cv=none; d=google.com; s=arc-20160816; b=t60S/laPmUHHqnL2GYcftC4PC985vLzTHvy+K8DjyjHTLFwKypC67qxSTjzeo67eEf qOJeG4rs9QoA51xXVV61FYmaLELefc1O5iD8dn/SU4G98JHecdoE30BPDbB712VFgdqr EzivH7n+6li6Y9duxbdMsrQkAds8A9pVuc9KAhCzeky43Nqos8JxvqQSCbbwcVcccVKH mdgS6WTTDIcryQeB9URzMFYmauGwizbR06l94btP0/AGOFIfNnY9ijCYwAZW61GDelqS dQd4lMKVoj2kZGTdlLVSa0EHgV7wzSxIsQBBxfD+sITtdRouixzn4rtZfSa3yxIrmq9Z TeEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date; bh=BzwL0QZ2QJGHMr4W1jDCaC+8UiEE5NqvXMu8OoxDkwM=; fh=dOHgztoUk8ufFgQHHKjRev0OZDXBoPoIACVysggRPQU=; b=BW0pjnmP1i0QzHFOd0N3tLFnTuYMKaCCMVsyoOHTvmpR2IYahQ13DZGPoD3E4MhB7l xAumsHcXyDyLz9Qaf9rQi1vzuVn0eMGnIc8MUNw1dBWs+qJKeNvEOUuXxX5GbSVn2yna 6brgtNkYV5aS+621Eh+1YkfXy61mz/b3aWEsiCRyjYhCqSPfLV3yvEgSLJgw1qEQ7tqe Rh4gTQgv+3s+lgO78+FXuXJKQgpn8HleBRx+fVMtEBm2PAuEqRCUmbcK9R7Locev9ell gat2zYs1vEt1g7uawk4mnRX4f/XBxVbZZ8bfIthnnYqGFgmTTbilGmApHKa1Z0yhFpo9 noxA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020aa7de03000000b00523bc9ccc6dsi9066626edv.26.2023.08.23.09.51.55; Wed, 23 Aug 2023 09:52:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236093AbjHWNfR (ORCPT + 99 others); Wed, 23 Aug 2023 09:35:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233141AbjHWNfR (ORCPT ); Wed, 23 Aug 2023 09:35:17 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EDAC8CDF; Wed, 23 Aug 2023 06:35:00 -0700 (PDT) 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 4B3361042; Wed, 23 Aug 2023 06:35:41 -0700 (PDT) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A3CF73F740; Wed, 23 Aug 2023 06:34:58 -0700 (PDT) Date: Wed, 23 Aug 2023 14:34:55 +0100 From: Cristian Marussi To: AKASHI Takahiro , Oleksii Moisieiev , "sudeep.holla@arm.com" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Linus Walleij , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" Subject: Re: [PATCH v4 3/4] pinctrl: Implementation of the generic scmi-pinctrl driver Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 On Wed, Aug 23, 2023 at 01:13:12PM +0900, AKASHI Takahiro wrote: > Hi Oleksii, > Hi AKASHI, Oleksii, > On Tue, Aug 08, 2023 at 06:25:35PM +0000, Oleksii Moisieiev wrote: > > 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. > > > > Signed-off-by: Oleksii Moisieiev [snip] > > +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); > > + > > + 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 i, ret; > > + struct scmi_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); > > + enum pin_config_param config_type; > > + unsigned long config_value; > > + > > + if (!configs || num_configs == 0) > > + return -EINVAL; > > + > > + for (i = 0; i < num_configs; i++) { > > + config_type = pinconf_to_config_param(configs[i]); > > + config_value = pinconf_to_config_argument(configs[i]); > > The generic pinconf parameters defined as "enum pin_config_param" > do not exactly match with a set of SCMI's configuration types defined > in Table 23 in the section 4.11.2.6 "PINCTRL_CONFIG_GET". > pinconf_to_config_param() simply masks the lowest 8 bits of the input > value, but doesn't convert anything. Indeed the SCMI Types table and the Linux Pinctrl subsystem types are similar but not really the same; some kind of conversion/mapping will be needed. Some trivial conversion layer will be needed also in order to address here any of the possible future changes in the Linux pinctrl subsystem definitions without having to change the SCMI server side (that typically is fw...and that anyway is bound to the SCMI spec) Thanks, Cristian