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 10675C04FFE for ; Sat, 11 May 2024 19:29:51 +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:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UmkDcwjR2/0jmWBIq1W6z4A/vG+kyvIdYuy0wFGoE4o=; b=BiZaiUsJNuHWsN 7KH5ZB0zsKOhwgr+npMigXVnaSTUjPSDySdv0tcq3CM2a/bxi+DP+XT34J9u1p7NbnEGvltqTr6JW ffiKAnebQlnT4QygfXyMTV18HTkWsYAhGcfBbAfTkrgOIMoDm/7Wf5De0K4mA5okjQDK3XHeaAeTC a9QRXykzcNjYmIzOfrxbWHfcMY2qz3CHcYhnXR/rsWiyDF86OrlBYStBr4DiVnHtDI6RrIglAZrGr BNuzY/5Dab3LvBIQFK9dqXtZMH2ygXNTwTJlrz2hPv8ss/djEk2OdC6868gRMcVULTo2mz++CnCoO bcApJVHy2MQA4dMr7Bmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5sPY-00000008ZNg-02Ce; Sat, 11 May 2024 19:29:36 +0000 Received: from fgw21-7.mail.saunalahti.fi ([62.142.5.82]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5sPU-00000008ZNB-48hh for linux-arm-kernel@lists.infradead.org; Sat, 11 May 2024 19:29:34 +0000 Received: from localhost (88-113-25-208.elisa-laajakaista.fi [88.113.25.208]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id c822eb82-0fcc-11ef-abf4-005056bdd08f; Sat, 11 May 2024 22:29:28 +0300 (EEST) From: Andy Shevchenko Date: Sat, 11 May 2024 22:29:27 +0300 To: "Peng Fan (OSS)" Cc: Sudeep Holla , Cristian Marussi , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Linus Walleij , Dong Aisheng , Jacky Bai , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-gpio@vger.kernel.org, Peng Fan Subject: Re: [PATCH v4 3/3] pinctrl: imx: support SCMI pinctrl protocol for i.MX95 Message-ID: References: <20240505-pinctrl-scmi-oem-v3-v4-0-7c99f989e9ba@nxp.com> <20240505-pinctrl-scmi-oem-v3-v4-3-7c99f989e9ba@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240505-pinctrl-scmi-oem-v3-v4-3-7c99f989e9ba@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240511_122933_217991_4BD31242 X-CRM114-Status: GOOD ( 16.09 ) 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 Sun, May 05, 2024 at 11:47:19AM +0800, Peng Fan (OSS) kirjoitti: > From: Peng Fan > > The generic pinctrl-scmi.c driver could not be used for i.MX95 because > i.MX95 SCMI firmware not supports functions, groups or generic > 'Pin Configuration Type and Enumerations' listed in SCMI Specification. > > i.MX95 System Control Management Interface(SCMI) firmware only supports > below pin configuration types which are OEM specific types: > 192: PIN MUX > 193: PIN CONF > 194: DAISY ID > 195: DAISY VAL > > To support Linux generic pinctrl properties(pinmux, bias-pull-[up, > down], and etc), need extract the value from the property and map > them to the format that i.MX95 SCMI pinctrl protocol understands, > so add this driver. ... > +struct imx_pin_group { > + struct pingroup data; > +}; I don't see the necessity of having this wrapper structure. Can't you simply use struct pingroup directly? ... > +static int scmi_pinctrl_imx_probe(struct scmi_device *sdev) > +{ > + int ret; > + struct device *dev = &sdev->dev; > + struct scmi_pinctrl_imx *pmx; > + const struct scmi_handle *handle; > + struct scmi_protocol_handle *ph; > + struct device_node *np __free(device_node) = of_find_node_by_path("/"); > + const struct scmi_pinctrl_proto_ops *pinctrl_ops; > + if (!sdev->handle) > + return -EINVAL; When this conditional can be true? > + if (!of_match_node(scmi_pinctrl_imx_allowlist, np)) > + return -ENODEV; > + handle = sdev->handle; It's even better to assign first and then check if the above check is needed at all. > + pinctrl_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_PINCTRL, &ph); > + if (IS_ERR(pinctrl_ops)) > + return PTR_ERR(pinctrl_ops); > + > + pmx = devm_kzalloc(dev, sizeof(*pmx), GFP_KERNEL); > + if (!pmx) > + return -ENOMEM; > + > + pmx->ph = ph; > + pmx->ops = pinctrl_ops; > + > + pmx->dev = dev; > + pmx->pctl_desc.name = DRV_NAME; > + pmx->pctl_desc.owner = THIS_MODULE; > + pmx->pctl_desc.pctlops = &pinctrl_scmi_imx_pinctrl_ops; > + pmx->pctl_desc.pmxops = &pinctrl_scmi_imx_pinmux_ops; > + pmx->pctl_desc.confops = &pinctrl_scmi_imx_pinconf_ops; > + > + ret = scmi_pinctrl_imx_get_pins(pmx, &pmx->pctl_desc); > + if (ret) > + return ret; > + > + ret = scmi_pinctrl_imx_probe_dt(sdev, pmx); > + if (ret) > + return ret; > + > + ret = devm_pinctrl_register_and_init(dev, &pmx->pctl_desc, pmx, > + &pmx->pctldev); > + if (ret) > + return dev_err_probe(dev, ret, "Failed to register pinctrl\n"); > + > + return pinctrl_enable(pmx->pctldev); > +} -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel