Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1803896imn; Mon, 1 Aug 2022 00:04:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR7JHW3FBb1v/xhJRjUuMTB2iR/Aip7q9hF+/YgUGbJvPA5YcTAXW6epMZpS6Z5SSwnqHWAs X-Received: by 2002:a17:902:bb95:b0:16e:e3f4:8195 with SMTP id m21-20020a170902bb9500b0016ee3f48195mr5379926pls.130.1659337494074; Mon, 01 Aug 2022 00:04:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659337494; cv=none; d=google.com; s=arc-20160816; b=iGEX515jCDCrTOkvjc72B+Xf1ShTePWzh5v3rrPgNvmP6ZKaQ++ptoh8BhosmFJKlT OPkwk//HMp6dSNPezTRiZIqn/lJdgAksGdsi3VySKP0xPhyFgeoA6qpvo5+myK7J35vl tIP3NYnfKIJ3ATwaPQqn1phnWPBTUbvAFxnM2faKYBJ2BEYwdsa9Z8BE9Wlqm6mua+1V lo/g0w83YHC7mLR1Xm7p8VUrQjYeaSNr4F7IBS3JOp8pGRRNk+rHpQL1lt/5xay3PfTo hfsq/NLeYqkIDuW7Sw6AgiaV//7ZQUXhRN6qsEzkNiOXtM/Of2OgjaoEHWK8q9vFqgr/ WwjQ== 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:cc:to:from:date; bh=iJ/80Czsbm/+3daD89WnhgkZFQQmdHYRM+1GN8fxu7k=; b=C5rUzCPsR5bcnyjziiWe+IkFL7GvTg/qsPNeaDvQNjndvEj/vCSeGOwz4kR5wfHamS u/dH121Xus6jmpN+DrRUDd3AYavEk2Br/QdbHml2nueE+j/8zCw1sV79INo4c1YrTiQ5 86HbBZLAhukihFlxVRLcSQmwbTFIHV0M7i/Rc/TgkS2rsbqZ7D+nfXJumdYyQuC5Z8ch SDinKfzNrMjL/hS7gckhWsLkULKzjaIFzo7ks7nY5iHrXlf7GAm1ufrCeDjX+VoHfcnF vKsISQoR6krmU8o1LAciJKpVrxkWsbxl2LeanUk71mSBVKNmoCar3KvTIWx3SiPGCm0G yQ/Q== 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 pl4-20020a17090b268400b001f310564e7bsi10973122pjb.100.2022.08.01.00.04.40; Mon, 01 Aug 2022 00:04:54 -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 S229806AbiHAGtj (ORCPT + 99 others); Mon, 1 Aug 2022 02:49:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233223AbiHAGr1 (ORCPT ); Mon, 1 Aug 2022 02:47:27 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2CE41C106 for ; Sun, 31 Jul 2022 23:44:42 -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 D865A1515; Sun, 31 Jul 2022 23:44:29 -0700 (PDT) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D94B73F73B; Sun, 31 Jul 2022 23:44:27 -0700 (PDT) Date: Mon, 1 Aug 2022 07:44:21 +0100 From: Cristian Marussi To: Arun KS Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@huawei.com, f.fainelli@gmail.com, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, peter.hilber@opensynergy.com Subject: Re: [RFC PATCH 14/16] firmware: arm_scmi: Add testing Voltage protocol support Message-ID: References: <20220227205608.30812-1-cristian.marussi@arm.com> <20220227205608.30812-15-cristian.marussi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, 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 Mon, Aug 01, 2022 at 10:17:00AM +0530, Arun KS wrote: > Hi Cristian, > Hi Arun, first of all thanks for the feedback ! > On Mon, Feb 28, 2022 at 4:23 AM Cristian Marussi > wrote: > > > > firmware: arm_scmi: Add testing Voltage protocol support > > > > Signed-off-by: Cristian Marussi > > --- > > .../arm_scmi/scmi_test_driver/Makefile | 2 +- > > .../arm_scmi/scmi_test_driver/scmi_test.c | 2 + > > .../arm_scmi/scmi_test_driver/test_common.h | 1 + > > .../arm_scmi/scmi_test_driver/test_voltages.c | 51 +++++++++++++++++++ > > 4 files changed, 55 insertions(+), 1 deletion(-) > > create mode 100644 drivers/firmware/arm_scmi/scmi_test_driver/test_voltages.c > > > > diff --git a/drivers/firmware/arm_scmi/scmi_test_driver/Makefile b/drivers/firmware/arm_scmi/scmi_test_driver/Makefile > > index 68a3d94a6a88..3b7df18de250 100644 > > --- a/drivers/firmware/arm_scmi/scmi_test_driver/Makefile > > +++ b/drivers/firmware/arm_scmi/scmi_test_driver/Makefile > > @@ -1,5 +1,5 @@ > > # SPDX-License-Identifier: GPL-2.0-only > > scmi_test_driver-objs := scmi_test.o test_common.o test_clocks.o test_sensors.o \ > > - test_powers.o > > + test_powers.o test_voltages.o > > obj-$(CONFIG_ARM_SCMI_TEST_DRIVER) += scmi_test_driver.o > > > > diff --git a/drivers/firmware/arm_scmi/scmi_test_driver/scmi_test.c b/drivers/firmware/arm_scmi/scmi_test_driver/scmi_test.c > > index df0d3e572010..2ca9f82c5bf3 100644 > > --- a/drivers/firmware/arm_scmi/scmi_test_driver/scmi_test.c > > +++ b/drivers/firmware/arm_scmi/scmi_test_driver/scmi_test.c > > @@ -26,6 +26,7 @@ int (*scmi_test_init[SCMI_MAX_PROTOCOLS])(struct scmi_test_setup *) = { > > [SCMI_PROTOCOL_POWER] = scmi_test_power_init, > > [SCMI_PROTOCOL_CLOCK] = scmi_test_clock_init, > > [SCMI_PROTOCOL_SENSOR] = scmi_test_sensor_init, > > + [SCMI_PROTOCOL_VOLTAGE] = scmi_test_voltage_init, > > }; > > > > static void > > @@ -125,6 +126,7 @@ static int scmi_testing_probe(struct scmi_device *sdev) > > } > > > > static const struct scmi_device_id scmi_id_table[] = { > > + { SCMI_PROTOCOL_VOLTAGE, "__scmi_test-voltage" }, > > { SCMI_PROTOCOL_CLOCK, "__scmi_test-clock" }, > > { SCMI_PROTOCOL_SENSOR, "__scmi_test-sensor" }, > > { SCMI_PROTOCOL_POWER, "__scmi_test-power" }, > > diff --git a/drivers/firmware/arm_scmi/scmi_test_driver/test_common.h b/drivers/firmware/arm_scmi/scmi_test_driver/test_common.h > > index 9f3d35ba4477..338b65da593f 100644 > > --- a/drivers/firmware/arm_scmi/scmi_test_driver/test_common.h > > +++ b/drivers/firmware/arm_scmi/scmi_test_driver/test_common.h > > @@ -102,6 +102,7 @@ int scmi_test_release(struct inode *ino, struct file *filp); > > > > int scmi_test_clock_init(struct scmi_test_setup *tsp); > > int scmi_test_sensor_init(struct scmi_test_setup *tsp); > > +int scmi_test_voltage_init(struct scmi_test_setup *tsp); > > int scmi_test_power_init(struct scmi_test_setup *tsp); > > > > #endif /* __SCMI_TEST_COMMON_H */ > > diff --git a/drivers/firmware/arm_scmi/scmi_test_driver/test_voltages.c b/drivers/firmware/arm_scmi/scmi_test_driver/test_voltages.c > > new file mode 100644 > > index 000000000000..ab91080e3a0f > > --- /dev/null > > +++ b/drivers/firmware/arm_scmi/scmi_test_driver/test_voltages.c > > @@ -0,0 +1,51 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * SCMI Testing Driver - Voltage Protocol > > + * > > + * Copyright (C) 2022 ARM Ltd. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include "test_common.h" > > + > > +struct scmi_voltage_data { > > + unsigned int version; > > + int count; > > +}; > > + > > +int scmi_test_voltage_init(struct scmi_test_setup *tsp) > > +{ > > + struct scmi_voltage_data *vdata; > > + struct device *dev = &tsp->sdev->dev; > > + const struct scmi_voltage_proto_ops *voltage_ops; > > + > > + vdata = devm_kzalloc(dev, sizeof(*vdata), GFP_KERNEL); > > + if (!vdata) > > + return -ENOMEM; > > + > > + voltage_ops = tsp->ops; > > + vdata->version = voltage_ops->version_get(tsp->ph); > > + vdata->count = voltage_ops->num_domains_get(tsp->ph); > > + > > + if (vdata->count <= 0) { > > + dev_err(dev, "number of voltage doms invalid: %d\n", > > + vdata->count); > > + return vdata->count ?: -EINVAL; > > + } > > + > > + dev_info(dev, "Found %d voltage resources.\n", vdata->count); > > + > > + tsp->priv = vdata; > > + debugfs_create_x32("version", 0400, tsp->parent, &vdata->version); > Any particular reason, why we are not creating debugfs entires for > regulator level_get/level_set like it was done for > clocks(rate_get_set)? No, it is just that this RFC initial series was meant to gather feedback on this approach at testing and to experiment with this solution itself a bit, before committing more work to more extensive cover all SCMI protocols and ops... so the series is 'incomplete' by design :P ... having said that, despite the series had not received so much feedback at the end, I have worked in the background on extending its SCMI coverage, so that now I can support all SCMI protocols (exposing all ops on debugfs) ... I'll plan to post a new more extensive series in the near(-ish) future once I'll have the time to clean it up and add more example KSFT testcases (and fix the dummy ones ...) Thanks, Cristian