All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: "Thierry Reding" <thierry.reding@gmail.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Linux PWM List" <linux-pwm@vger.kernel.org>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Chris Paterson" <Chris.Paterson2@renesas.com>,
	"Biju Das" <biju.das@bp.renesas.com>,
	"Prabhakar Mahadev Lad" <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [RFC 4/8] pwm: rzg2l-gpt: Add support for linking with POEG
Date: Thu, 19 May 2022 11:15:10 +0200	[thread overview]
Message-ID: <CAMuHMdVoQ9rjOuubLYb=6j_LP=qVeG+u0nxmqh_Pkr+jDPWLUw@mail.gmail.com> (raw)
In-Reply-To: <20220510151112.16249-5-biju.das.jz@bp.renesas.com>

Hi Biju,

On Tue, May 10, 2022 at 5:11 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> This patch add support for linking POEG group with pwm, so that
> POEG can control the output disable function.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Thanks for your patch!

> --- a/drivers/pwm/pwm-rzg2l-gpt.c
> +++ b/drivers/pwm/pwm-rzg2l-gpt.c
> @@ -266,6 +291,36 @@ static int rzg2l_gpt_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>         return ret;
>  }
>
> +static int rzg2l_gpt_parse_properties(struct platform_device *pdev,
> +                                     struct rzg2l_gpt_chip *pc)
> +{
> +       static const u64 poeg_grp_addr[] = {
> +               POEG_GRP_A_ADDR, POEG_GRP_B_ADDR, POEG_GRP_C_ADDR, POEG_GRP_D_ADDR
> +       };
> +       struct device_node *np;
> +       unsigned int i;
> +       u64 addr;
> +
> +       pc->poeg_grp = GRP_INVALID;
> +       np = of_parse_phandle(pdev->dev.of_node, "renesas,poeg-group", 0);
> +       if (!np)
> +               return 0;
> +
> +       if (!of_property_read_u64(np, "reg", &addr)) {
> +               for (i = 0; i < ARRAY_SIZE(poeg_grp_addr); i++) {
> +                       if (addr == poeg_grp_addr[i]) {

Matching on addresses looks fragile to me.
Of course this is code, not DT, so it can be changed later.

Possible alternatives:
  1. Use a numeric property instead of a phandle, so you can store
     its value directly into pc->poeg_grp.
     This loses the linking by phandle, though, which is nice to
     have, and might be useful for other purposes later.
  2. Add a "renesas,id" property to each POEGx DT node, cfr.
     Documentation/devicetree/bindings/media/renesas,vin.yaml.

> +                               pc->poeg_grp = i;
> +                               break;
> +                       }
> +               }
> +       }
> +
> +       if (np)
> +               of_node_put(np);
> +
> +       return 0;
> +}

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2022-05-19  9:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 15:11 [RFC 0/8] Add RZ/G2L POEG support Biju Das
2022-05-10 15:11 ` [RFC 1/8] dt-bindings: soc: renesas: Add RZ/G2L POEG binding Biju Das
2022-05-17 21:04   ` Rob Herring
2022-05-18  5:58     ` Biju Das
2022-05-18 18:17       ` Rob Herring
2022-05-18 18:34         ` Biju Das
2022-05-19  9:06           ` Geert Uytterhoeven
2022-05-19  9:30             ` Biju Das
2022-05-19 20:04               ` Rob Herring
2022-06-08 16:11                 ` Biju Das
2022-05-10 15:11 ` [RFC 2/8] drivers: soc: renesas: Add POEG driver support Biju Das
2022-05-10 15:11 ` [RFC 3/8] dt-bindings: pwm: rzg2l-gpt: Document renesas,poeg-group property Biju Das
2022-05-10 18:29   ` Rob Herring
2022-05-10 15:11 ` [RFC 4/8] pwm: rzg2l-gpt: Add support for linking with POEG Biju Das
2022-05-19  9:15   ` Geert Uytterhoeven [this message]
2022-06-08 17:01     ` Biju Das
2022-05-10 15:11 ` [RFC 5/8] arm64: dts: renesas: r9a07g044: Add POEG nodes Biju Das
2022-05-10 15:11 ` [RFC 6/8] arm64: dts: renesas: r9a07g054: " Biju Das
2022-05-10 15:11 ` [RFC 7/8] arm64: dts: renesas: rzg2l-smarc: Enable POEGG{A,B,C,D} on carrier board Biju Das
2022-05-10 15:11 ` [RFC 8/8] arm64: dts: renesas: rzg2l-smarc: Link GPT4 with POEGGD " Biju Das
2022-05-10 16:00 ` [RFC 0/8] Add RZ/G2L POEG support Uwe Kleine-König
2022-05-10 16:08   ` Biju Das

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='CAMuHMdVoQ9rjOuubLYb=6j_LP=qVeG+u0nxmqh_Pkr+jDPWLUw@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=Chris.Paterson2@renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=biju.das@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=lee.jones@linaro.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.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.