public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Arun KS <arunks.linux@gmail.com>
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
Date: Mon, 1 Aug 2022 07:44:21 +0100	[thread overview]
Message-ID: <Yud2RbgHEiMz2OvD@e120937-lin> (raw)
In-Reply-To: <CAKZGPANYh4aS47WH8UBPiTVdE9sOstZD+yZgHkPcUAWX=Gc-dQ@mail.gmail.com>

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
> <cristian.marussi@arm.com> wrote:
> >
> > firmware: arm_scmi: Add testing Voltage protocol support
> >
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> >  .../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 <linux/dcache.h>
> > +#include <linux/debugfs.h>
> > +#include <linux/err.h>
> > +#include <linux/fs.h>
> > +#include <linux/io.h>
> > +#include <linux/kstrtox.h>
> > +#include <linux/module.h>
> > +#include <linux/scmi_protocol.h>
> > +#include <linux/slab.h>
> > +
> > +#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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-08-01  6:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-27 20:55 [RFC PATCH 00/16] Introduce SCMI test driver and related Kselftest Cristian Marussi
2022-02-27 20:55 ` [RFC PATCH 01/16] firmware: arm_scmi: Simplify scmi_devm_notifier_unregister Cristian Marussi
2022-02-27 20:55 ` [RFC PATCH 02/16] firmware: arm_scmi: Make protocols init fail on basic errors Cristian Marussi
2022-02-27 20:55 ` [RFC PATCH 03/16] firmware: arm_scmi: Add multiple protocols registration support Cristian Marussi
2022-02-27 20:55 ` [RFC PATCH 04/16] firmware: arm_scmi: Add .version_get protocol operation Cristian Marussi
2022-02-27 20:55 ` [RFC PATCH 05/16] firmware: arm_scmi: Expose information on configured transport Cristian Marussi
2022-02-27 20:55 ` [RFC PATCH 06/16] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value Cristian Marussi
2022-02-27 20:55 ` [RFC PATCH 07/16] debugfs: Add signed versions of debugfs_create_u32/64 helpers Cristian Marussi
2022-03-18 13:21   ` Greg Kroah-Hartman
2022-03-18 15:39     ` Cristian Marussi
2022-03-18 15:49       ` Greg Kroah-Hartman
2022-02-27 20:56 ` [RFC PATCH 08/16] firmware: arm_scmi: Add SCMI Testing driver Cristian Marussi
2022-02-27 20:56 ` [RFC PATCH 09/16] firmware: arm_scmi: testing: Add Clock protocol full support Cristian Marussi
2022-02-27 20:56 ` [RFC PATCH 10/16] firmware: arm_scmi: testing: Add Sensor protocol basic support Cristian Marussi
2022-02-27 20:56 ` [RFC PATCH 11/16] firmware: arm_scmi: Add test driver generic notification helpers Cristian Marussi
2022-02-27 20:56 ` [RFC PATCH 12/16] firmware: arm_scmi: Add Sensor notifications testing support Cristian Marussi
2022-02-27 20:56 ` [RFC PATCH 13/16] firmware: arm_scmi: Add testing Power protocol support Cristian Marussi
2022-02-27 20:56 ` [RFC PATCH 14/16] firmware: arm_scmi: Add testing Voltage " Cristian Marussi
2022-08-01  4:47   ` Arun KS
2022-08-01  6:44     ` Cristian Marussi [this message]
2022-02-27 20:56 ` [RFC PATCH 15/16] selftests: arm64: Add initial SCMI testcases Cristian Marussi
2022-08-01  4:52   ` Arun KS
2022-08-01  6:54     ` Cristian Marussi
     [not found]   ` <CAKZGPAMoBPiikbpNE2SjDxsUQQKZC-Yn5cbn60Sx0ZRqGv47jA@mail.gmail.com>
2022-08-01  7:01     ` Cristian Marussi
2022-02-27 20:56 ` [RFC PATCH 16/16] [DEBUG]: firmware: arm_scmi: Add Kconfig to allow SCMI Testing driver coexistence Cristian Marussi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yud2RbgHEiMz2OvD@e120937-lin \
    --to=cristian.marussi@arm.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=arunks.linux@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=james.quinlan@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.hilber@opensynergy.com \
    --cc=souvik.chakravarty@arm.com \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox