All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 1/3 v2][RFC] dmaengine: rcar-audmapp: calculate chcr via src/dst addr
Date: Fri, 30 Jan 2015 09:39:04 +0000	[thread overview]
Message-ID: <CAMuHMdUWbwLmQDNa9EzO=7NLxqv21RBS0cAZP82qXfFBKz+XHQ@mail.gmail.com> (raw)
In-Reply-To: <87iofpf140.wl%kuninori.morimoto.gx@renesas.com>

Hi Morimoto-san,

On Fri, Jan 30, 2015 at 3:33 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> Current rcar-audmapp is assuming that CHCR value are specified
> from platform data or DTS bindings. but, it is possible to
> calculate CHCR settings from src/dst address.
> DTS bindings node can be reduced by this patch.
>
> For this update, new rcar-audmapp assumes DT has SSIU/DTCP/MLM/SCU
> register entry.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v1 -> v2
>
>  - it assums DT has SSIU/DTCP/MLM/SCU reg on DT

Thanks, this is much better. Now the driver only knows about the offsets
w.r.t. the base, like other drivers do.

> --- a/drivers/dma/sh/rcar-audmapp.c
> +++ b/drivers/dma/sh/rcar-audmapp.c
> @@ -44,11 +44,19 @@
>  #define AUDMAPP_SLAVE_NUMBER   256
>  #define AUDMAPP_LEN_MAX                (16 * 1024 * 1024)
>
> +enum AUDMAPP_TGT_ADDR {
> +       AUDMAPP_TGT_SSIU = 0,
> +       AUDMAPP_TGT_DTCP,
> +       AUDMAPP_TGT_MLM,
> +       AUDMAPP_TGT_SCU,
> +
> +       AUDMAPP_TGT_MAX,
> +};
> +

> +               switch (i) {
> +               case AUDMAPP_TGT_SSIU:
> +                       table = ssi_id_table;
> +                       size = ARRAY_SIZE(ssi_id_table);
> +                       break;
> +               case AUDMAPP_TGT_DTCP:
> +                       table = dtcp_id_tabel;
> +                       size = ARRAY_SIZE(dtcp_id_tabel);
> +                       break;
> +               case AUDMAPP_TGT_MLM:
> +                       table = mlm_id_table;
> +                       size = ARRAY_SIZE(mlm_id_table);
> +                       break;
> +               case AUDMAPP_TGT_SCU:
> +                       table = scu_id_table;
> +                       size = ARRAY_SIZE(scu_id_table);
> +                       break;
> +               }
> +       }

You can put this logic in a table with entries like

    { "ssiu", ssi_id_table, ARRAY_SIZE(ssi_id_table)" }

and get rid of the switch() and the enum ...

> +       for (i = 0; i < AUDMAPP_TGT_MAX; i++) {
> +               res = platform_get_resource(pdev, IORESOURCE_MEM, i + 1);
> +               if (!res)
> +                       return -ENODEV;
> +
> +               if (!devm_request_mem_region(dev, res->start, resource_size(res),
> +                                       dev_name(dev)))

... and if the DT has "reg-names", you can use the first field (name) from
the table entry with platform_get_resource_byname().

> +                       return -EIO;
> +
> +               audev->tgt_addr[i] = res->start;
> +       }

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:[~2015-01-30  9:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30  2:33 [PATCH 1/3 v2][RFC] dmaengine: rcar-audmapp: calculate chcr via src/dst addr Kuninori Morimoto
2015-01-30  9:39 ` Geert Uytterhoeven [this message]

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='CAMuHMdUWbwLmQDNa9EzO=7NLxqv21RBS0cAZP82qXfFBKz+XHQ@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=linux-sh@vger.kernel.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 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.