Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1763317imn; Sun, 31 Jul 2022 21:51:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR5tEewXEK4dbWcBUGDx+Z7JF/R6Nvbl3AN/FfZhex3OY5uZ8G6b4w1bL2R7osnSi/vyO2J9 X-Received: by 2002:a17:902:bf0a:b0:16e:90d9:a42d with SMTP id bi10-20020a170902bf0a00b0016e90d9a42dmr12167563plb.12.1659329497120; Sun, 31 Jul 2022 21:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659329497; cv=none; d=google.com; s=arc-20160816; b=PcB0IwEZ1PE9VtqYDm8lHHBbe5eEpR1JL/PS4qHR2z1RFc2rO6lVPBgKIHtO5IyjeA OEvYarEx/zJ/Wcr708T34sE8W476y2XOqHNapO3jlIgwDA4mj8L7ZAYD0e9UEpsDphiT EgiWMi5vHSbmRNBcSXgH3HgCjekUAktSCMgvtIk16M7KIHvtQKkm6gFGVX7mNrl9WbMZ +Efgl3pK+rytMqPYjIWTcDocmIPAkIflA2XKNrNtb2SJxV730xgUZW6nYLLDnAov47hT fXKCswlYuOzZdByO7wuWEyVf60ueOKzsknJPonNDoLPLbrvsHYRPEHFAW/EMGMwrcUhZ c/kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:sender :in-reply-to:references:mime-version:dkim-signature; bh=Lw6ftY/TKlMb6+me9g+W5uZ99+C7bnz14lMwnr8n6c4=; b=oSHIYulHlUlNoHbLmG5xYGJJEmKqK2NcQeIk9rEfXHJsyjpiQSMuz5Kh7pSpmv8Jx8 j2s0HcS8/5RTGWlMSnZW9ZqUVy5s5l9InNRuuiMqCuaG3fVMzWzd6Q1dQd3exHBn2cBP /nvSf5q7GqpxDvC6aU4Rsjro531eGgePXkYXJnmXa3ehojQCa4fdRpNocg4UG83Cc0EH hRBD1ZGFigvldLOgjXjzzzPAVKc3JOKUm6abwDJM8a75QwU0VOk5GA8CANgwfJySoo+Q HUplukgbgfbB2R4QJZXv7zNICk9gmdn7E1c6domhfAdrI+2SZSjGvtwz6d6vJ7QUt39I KMOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BivyfpXP; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je19-20020a170903265300b001586190b7c1si10281106plb.528.2022.07.31.21.51.22; Sun, 31 Jul 2022 21:51:37 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BivyfpXP; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239506AbiHAErO (ORCPT + 99 others); Mon, 1 Aug 2022 00:47:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238845AbiHAErN (ORCPT ); Mon, 1 Aug 2022 00:47:13 -0400 Received: from mail-vk1-xa2b.google.com (mail-vk1-xa2b.google.com [IPv6:2607:f8b0:4864:20::a2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7327BA194 for ; Sun, 31 Jul 2022 21:47:12 -0700 (PDT) Received: by mail-vk1-xa2b.google.com with SMTP id b81so4988641vkf.1 for ; Sun, 31 Jul 2022 21:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:sender:from:date:message-id :subject:to:cc; bh=Lw6ftY/TKlMb6+me9g+W5uZ99+C7bnz14lMwnr8n6c4=; b=BivyfpXPh+b5BrckNjDolRmC/G0BCa132qwkYm/uOKn0qBhRgcfnEGfELdMx74doVO NWjYAZ+hUT4OSrptv7Nafz/y4Mo7nXoTpKgsOj7YIPXHbXpTbGpdL81j3aIz9UxZVUhq OIRZKaW+j4qXI8C7riokWIyOjiC30f2otq93U9ZLTccOpwgqJPfoZ5rr/rgP1Bxu+PYm EHvyL4fw31d0BKURn3Ivz/le3NSEcHiGCNPOM+PQUxa8s2egUdPIpamSVu7mrrnEy7mW g+Co3xuU+IWGzAQHti29kkt4PYVMe+gvvhl2gjgsPRT2KUJvsFM9zpYDELCeHCbe6PFN jvDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:sender:from :date:message-id:subject:to:cc; bh=Lw6ftY/TKlMb6+me9g+W5uZ99+C7bnz14lMwnr8n6c4=; b=16pRMIrAoS9IltdHF6Fd2oMUc62hgfgSav3mHO8ytaPxWbzzdRRnkEtsRTE8ADj4Hd MCrDyscQgdJM4irHQl5CPF5NrCX6lCe5Vk5D4zn5gRvdm8I0ulmcgGUjv5aiVDHKgBCb teUxLVTEv9/PTKQ2lDA9e8d0OcY/KpkboSGP6jzcRIMzdB9v+l+8ahiGv8awP/x1ab1a CdyHTo9dSf7kRjuFH85JVANKRtNACym3AmVD47xVSZzlXP8fCj7BgQHXpgLCfEsUmmOG TfXpVO9Grf2p4+E+8ErrB6bjDrQQvUR8tAIsHDWKfhn9FrdvbnNQv5iNnvpgqLZtHoID mD2Q== X-Gm-Message-State: ACgBeo16Gg3klysMFWZbjcAdBttLwBmN82pk++TyI1sW+wnY/gOjN0Qa BnqiY3YyCNXUm+joTBYGKxTwJ/XOtObmt13BMDY= X-Received: by 2002:a1f:34d8:0:b0:377:142f:3e2f with SMTP id b207-20020a1f34d8000000b00377142f3e2fmr4440588vka.27.1659329231324; Sun, 31 Jul 2022 21:47:11 -0700 (PDT) MIME-Version: 1.0 References: <20220227205608.30812-1-cristian.marussi@arm.com> <20220227205608.30812-15-cristian.marussi@arm.com> In-Reply-To: <20220227205608.30812-15-cristian.marussi@arm.com> Sender: getarunks@gmail.com X-Google-Sender-Delegation: getarunks@gmail.com From: Arun KS Date: Mon, 1 Aug 2022 10:17:00 +0530 X-Google-Sender-Auth: xqremnycBgmRgYu3Ngu8pLSRFS8 Message-ID: Subject: Re: [RFC PATCH 14/16] firmware: arm_scmi: Add testing Voltage protocol support To: Cristian Marussi 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Hi Cristian, 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)? > + > + return 0; > +} > -- > 2.17.1 >