linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Pop <pop.adrian61@gmail.com>
To: Angelo Ribeiro <Angelo.Ribeiro@synopsys.com>
Cc: yannick.fertre@st.com, philippe.cornu@st.com,
	benjamin.gaignard@st.com, airlied@linux.ie, daniel@ffwll.ch,
	mcoquelin.stm32@gmail.com, alexandre.torgue@st.com,
	dri-devel@lists.freedesktop.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Jose Abreu <Jose.Abreu@synopsys.com>,
	Gustavo Pimentel <Gustavo.Pimentel@synopsys.com>,
	Joao Pinto <Joao.Pinto@synopsys.com>
Subject: Re: [PATCH] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs
Date: Sat, 4 Apr 2020 13:56:11 +0300	[thread overview]
Message-ID: <CAP-HsdSKR8SB2UY2W33Xn8157Via30cD8wntXrvV0LEVmxgpRg@mail.gmail.com> (raw)
In-Reply-To: <a5aa527c2cd66b55b4246b9c122c702a279b37f0.1585928032.git.angelo.ribeiro@synopsys.com>

Hello Angelo,

I get a compile error: error: ‘VID_MODE_VPG_MODE’ undeclared. I am
quite new to the mailing list, maybe I misapplied the patch.

Regards,
Adrian


On Fri, Apr 3, 2020 at 6:37 PM Angelo Ribeiro
<Angelo.Ribeiro@synopsys.com> wrote:
>
> Add support for the video pattern generator (VPG) BER pattern mode and
> configuration in runtime.
>
> This enables using the debugfs interface to manipulate the VPG after
> the pipeline is set.
> Also, enables the usage of the VPG BER pattern.
>
> Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> Cc: Joao Pinto <jpinto@synopsys.com>
> Cc: Jose Abreu <jose.abreu@synopsys.com>
> Signed-off-by: Angelo Ribeiro <angelo.ribeiro@synopsys.com>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 97 ++++++++++++++++++++++++---
>  1 file changed, 89 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index b18351b..512c922 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -221,6 +221,21 @@
>  #define PHY_STATUS_TIMEOUT_US          10000
>  #define CMD_PKT_STATUS_TIMEOUT_US      20000
>
> +#ifdef CONFIG_DEBUG_FS
> +#define VPG_DEFS(name, dsi) \
> +       ((void __force *)&((*dsi).vpg_defs.name))
> +
> +#define REGISTER(name, mask, dsi) \
> +       { #name, VPG_DEFS(name, dsi), mask, dsi }
> +
> +struct debugfs_entries {
> +       const char                              *name;
> +       bool                                    *reg;
> +       u32                                     mask;
> +       struct dw_mipi_dsi                      *dsi;
> +};
> +#endif /* CONFIG_DEBUG_FS */
> +
>  struct dw_mipi_dsi {
>         struct drm_bridge bridge;
>         struct mipi_dsi_host dsi_host;
> @@ -238,9 +253,12 @@ struct dw_mipi_dsi {
>
>  #ifdef CONFIG_DEBUG_FS
>         struct dentry *debugfs;
> -
> -       bool vpg;
> -       bool vpg_horizontal;
> +       struct debugfs_entries *debugfs_vpg;
> +       struct {
> +               bool vpg;
> +               bool vpg_horizontal;
> +               bool vpg_ber_pattern;
> +       } vpg_defs;
>  #endif /* CONFIG_DEBUG_FS */
>
>         struct dw_mipi_dsi *master; /* dual-dsi master ptr */
> @@ -530,9 +548,11 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi)
>                 val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS;
>
>  #ifdef CONFIG_DEBUG_FS
> -       if (dsi->vpg) {
> +       if (dsi->vpg_defs.vpg) {
>                 val |= VID_MODE_VPG_ENABLE;
> -               val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0;
> +               val |= dsi->vpg_defs.vpg_horizontal ?
> +                      VID_MODE_VPG_HORIZONTAL : 0;
> +               val |= dsi->vpg_defs.vpg_ber_pattern ? VID_MODE_VPG_MODE : 0;
>         }
>  #endif /* CONFIG_DEBUG_FS */
>
> @@ -961,6 +981,68 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = {
>
>  #ifdef CONFIG_DEBUG_FS
>
> +ssize_t dw_mipi_dsi_debugfs_write(void *data, u64 val)
> +{
> +       struct debugfs_entries *vpg = data;
> +       struct dw_mipi_dsi *dsi;
> +       u32 mode_cfg;
> +
> +       if (!vpg)
> +               return -ENODEV;
> +
> +       dsi = vpg->dsi;
> +
> +       *vpg->reg = (bool)val;
> +
> +       mode_cfg = dsi_read(dsi, DSI_VID_MODE_CFG);
> +
> +       if (*vpg->reg)
> +               mode_cfg |= vpg->mask;
> +       else
> +               mode_cfg &= ~vpg->mask;
> +
> +       dsi_write(dsi, DSI_VID_MODE_CFG, mode_cfg);
> +
> +       return 0;
> +}
> +
> +ssize_t dw_mipi_dsi_debugfs_show(void *data, u64 *val)
> +{
> +       struct debugfs_entries *vpg = data;
> +
> +       if (!vpg)
> +               return -ENODEV;
> +
> +       *val = *vpg->reg;
> +
> +       return 0;
> +}
> +
> +DEFINE_DEBUGFS_ATTRIBUTE(fops_x32, dw_mipi_dsi_debugfs_show,
> +                        dw_mipi_dsi_debugfs_write, "%llu\n");
> +
> +static void debugfs_create_files(void *data)
> +{
> +       struct dw_mipi_dsi *dsi = data;
> +       struct debugfs_entries debugfs[] = {
> +               REGISTER(vpg, VID_MODE_VPG_ENABLE, dsi),
> +               REGISTER(vpg_horizontal, VID_MODE_VPG_HORIZONTAL, dsi),
> +               REGISTER(vpg_ber_pattern, VID_MODE_VPG_MODE, dsi),
> +       };
> +       int i;
> +
> +       dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL);
> +       if (!dsi->debugfs_vpg)
> +               return;
> +
> +       memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs));
> +
> +       for (i = 0; i < ARRAY_SIZE(debugfs); i++)
> +               debugfs_create_file(dsi->debugfs_vpg[i].name, 0644,
> +                                   dsi->debugfs, &dsi->debugfs_vpg[i],
> +                                   &fops_x32);
> +}
> +
>  static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi)
>  {
>         dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL);
> @@ -969,14 +1051,13 @@ static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi)
>                 return;
>         }
>
> -       debugfs_create_bool("vpg", 0660, dsi->debugfs, &dsi->vpg);
> -       debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs,
> -                           &dsi->vpg_horizontal);
> +       debugfs_create_files(dsi);
>  }
>
>  static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi)
>  {
>         debugfs_remove_recursive(dsi->debugfs);
> +       kfree(dsi->debugfs_vpg);
>  }
>
>  #else
> --
> 2.7.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-04-04 10:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 15:36 [PATCH] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs Angelo Ribeiro
2020-04-04 10:56 ` Adrian Pop [this message]
2020-04-06  8:25   ` Angelo Ribeiro
2020-04-04 23:18 ` kbuild test robot

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=CAP-HsdSKR8SB2UY2W33Xn8157Via30cD8wntXrvV0LEVmxgpRg@mail.gmail.com \
    --to=pop.adrian61@gmail.com \
    --cc=Angelo.Ribeiro@synopsys.com \
    --cc=Gustavo.Pimentel@synopsys.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@st.com \
    --cc=benjamin.gaignard@st.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=philippe.cornu@st.com \
    --cc=yannick.fertre@st.com \
    /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;
as well as URLs for NNTP newsgroup(s).