All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de, etienne.carriere@st.com,
	michal.simek@amd.com, linus.walleij@linaro.org,
	Oleksii_Moisieiev@epam.com
Subject: Re: [RFC 6/6] test: dm: add SCMI pinctrl test
Date: Mon, 11 Sep 2023 14:47:08 +0900	[thread overview]
Message-ID: <ZP6p3PCaUKvZyViH@octopus> (raw)
In-Reply-To: <CAPnjgZ0udKC6tfT1P9AcZrkv6wx+i0KgXZWBV+st3RbCMkiPZw@mail.gmail.com>

On Sun, Sep 10, 2023 at 01:13:30PM -0600, Simon Glass wrote:
> Hi AKASHI,
> 
> On Tue, 5 Sept 2023 at 20:41, AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > In this test, SCMI-based pinmux feature is exercised.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  test/dm/scmi.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 62 insertions(+)
> >
> > diff --git a/test/dm/scmi.c b/test/dm/scmi.c
> > index 423b6ef70b29..ca5a2e9c781e 100644
> > --- a/test/dm/scmi.c
> > +++ b/test/dm/scmi.c
> > @@ -21,6 +21,7 @@
> >  #include <scmi_protocols.h>
> >  #include <asm/scmi_test.h>
> >  #include <dm/device-internal.h>
> > +#include <dm/pinctrl.h>
> >  #include <dm/test.h>
> >  #include <linux/kconfig.h>
> >  #include <power/regulator.h>
> > @@ -395,3 +396,64 @@ static int dm_test_scmi_voltage_domains(struct unit_test_state *uts)
> >         return release_sandbox_scmi_test_devices(uts, dev);
> >  }
> >  DM_TEST(dm_test_scmi_voltage_domains, UT_TESTF_SCAN_FDT);
> > +
> > +/*
> > + * This part is derived from test/dm/pinmux.c, So
> > + *
> > + * Copyright (C) 2020 Sean Anderson <seanga2@gmail.com>
> > + */
> > +
> > +static char buf[64];
> > +#define test_muxing(selector, expected) do { \
> > +       ut_assertok(pinctrl_get_pin_muxing(dev, selector, buf, sizeof(buf))); \
> > +       ut_asserteq_str(expected, (char *)&buf); \
> 
> Can you instead make this a function?

Sure, but please note that the whole scheme was borrowed
from test/dm/pinmux.c.

> > +} while (0)
> > +
> > +#define test_name(selector, expected) do { \
> > +       ut_assertok(pinctrl_get_pin_name(dev, selector, buf, sizeof(buf))); \
> > +       ut_asserteq_str(expected, (char *)&buf); \
> > +} while (0)
> > +
> > +static int dm_test_scmi_pinmux(struct unit_test_state *uts)
> > +{
> > +       struct udevice *dev;
> > +
> > +       ut_assertok(uclass_get_device_by_name(UCLASS_PINCTRL, "protocol@19",
> > +                                             &dev));
> > +       ut_assertok(pinctrl_select_state(dev, "default"));
> > +       test_muxing(0, "<unknown>");
> 
> ut_assertok(check_muxing(uts, ...));

Assertion for

> > +       test_muxing(1, "<unknown>");
> > +       test_muxing(2, "I2S.");
> > +       test_muxing(3, "I2S.");
> > +       test_muxing(4, "I2S.");
> > +       test_muxing(5, "GPIO bias-pull-up.");
> > +       test_muxing(6, "GPIO drive-open-drain output-mode output-value.");
> > +       test_muxing(7, "GPIO bias-pull-down input-mode.");
> > +       test_muxing(8, "GPIO bias-disable.");

this chunk of code?
It is not clear to me what is the advantage, though.

-Takahiro Akashi

> > +
> > +       ut_assertok(pinctrl_select_state(dev, "alternate"));
> > +       test_muxing(0, "I2C drive-open-drain.");
> > +       test_muxing(1, "I2C drive-open-drain.");
> > +       test_muxing(2, "SPI.");
> > +       test_muxing(3, "SPI.");
> > +       test_muxing(4, "SPI.");
> > +       test_muxing(5, "CS bias-pull-up.");
> > +       test_muxing(6, "CS drive-open-drain output-mode output-value.");
> > +       test_muxing(7, "GPIO bias-pull-down input-mode.");
> > +       test_muxing(8, "GPIO bias-disable.");
> > +
> > +       ut_assertok(pinctrl_select_state(dev, "0"));
> > +       test_muxing(0, "I2C drive-open-drain.");
> > +       test_muxing(1, "I2C drive-open-drain.");
> > +       test_muxing(2, "I2S.");
> > +       test_muxing(3, "I2S.");
> > +       test_muxing(4, "I2S.");
> > +       test_muxing(5, "GPIO bias-pull-up.");
> > +       test_muxing(6, "GPIO drive-open-drain output-mode output-value.");
> > +       test_muxing(7, "GPIO bias-pull-down input-mode.");
> > +       test_muxing(8, "GPIO bias-disable.");
> > +
> > +       return 0;
> > +}
> > +
> > +DM_TEST(dm_test_scmi_pinmux, UT_TESTF_SCAN_FDT);
> > --
> > 2.34.1
> >
> 
> Regards,
> Simon

  reply	other threads:[~2023-09-11  5:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06  2:40 [RFC 0/6] firmware: scmi: add SCMI pinctrl protocol support AKASHI Takahiro
2023-09-06  2:40 ` [RFC 1/6] firmware: scmi: fix protocol enumeration logic AKASHI Takahiro
2023-09-10 19:13   ` Simon Glass
2023-09-11  4:58     ` AKASHI Takahiro
2023-09-06  2:40 ` [RFC 2/6] firmware: scmi: add pinctrl protocol support AKASHI Takahiro
2023-09-06  2:40 ` [RFC 3/6] pinctrl: add scmi driver AKASHI Takahiro
2023-09-10 19:13   ` Simon Glass
2023-09-11  5:14     ` AKASHI Takahiro
2023-09-06  2:40 ` [RFC 4/6] gpio: add scmi driver based on pinctrl AKASHI Takahiro
2023-09-06 14:56   ` Michal Simek
2023-09-06 23:37     ` AKASHI Takahiro
2023-09-07 12:23   ` Simon Glass
2023-09-08  4:32     ` AKASHI Takahiro
2023-09-10 19:13       ` Simon Glass
2023-09-11  5:38         ` AKASHI Takahiro
2023-09-06  2:40 ` [RFC 5/6] firmware: scmi: add pseudo pinctrl protocol support on sandbox AKASHI Takahiro
2023-09-10 19:13   ` Simon Glass
2023-09-11  5:23     ` AKASHI Takahiro
2023-09-06  2:40 ` [RFC 6/6] test: dm: add SCMI pinctrl test AKASHI Takahiro
2023-09-10 19:13   ` Simon Glass
2023-09-11  5:47     ` AKASHI Takahiro [this message]
2023-09-22 18:27       ` Simon Glass
2023-09-06  3:09 ` [RFC 0/6] firmware: scmi: add SCMI pinctrl protocol support Fabio Estevam
2023-09-07  9:58   ` AKASHI Takahiro
2023-09-08 12:14     ` Peng Fan

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=ZP6p3PCaUKvZyViH@octopus \
    --to=takahiro.akashi@linaro.org \
    --cc=Oleksii_Moisieiev@epam.com \
    --cc=etienne.carriere@st.com \
    --cc=linus.walleij@linaro.org \
    --cc=michal.simek@amd.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.