From: Neil Armstrong <narmstrong@baylibre.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
linux-amlogic@lists.infradead.org
Cc: dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/meson: osd_afbcd: Add an exit callback to struct meson_afbcd_ops
Date: Mon, 3 Jan 2022 12:24:01 +0100 [thread overview]
Message-ID: <4a4b40fd-b9d7-b38d-b4d4-4aaaf03693f2@baylibre.com> (raw)
In-Reply-To: <20211230235515.1627522-2-martin.blumenstingl@googlemail.com>
On 31/12/2021 00:55, Martin Blumenstingl wrote:
> Use this to simplify the driver shutdown. It will also come handy when
> fixing the error handling in meson_drv_bind_master().
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
> drivers/gpu/drm/meson/meson_drv.c | 6 ++--
> drivers/gpu/drm/meson/meson_osd_afbcd.c | 41 ++++++++++++++++---------
> drivers/gpu/drm/meson/meson_osd_afbcd.h | 1 +
> 3 files changed, 30 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 80f1d439841a..b919271a6e50 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -385,10 +385,8 @@ static void meson_drv_unbind(struct device *dev)
> free_irq(priv->vsync_irq, drm);
> drm_dev_put(drm);
>
> - if (priv->afbcd.ops) {
> - priv->afbcd.ops->reset(priv);
> - meson_rdma_free(priv);
> - }
> + if (priv->afbcd.ops)
> + priv->afbcd.ops->exit(priv);
> }
>
> static const struct component_master_ops meson_drv_master_ops = {
> diff --git a/drivers/gpu/drm/meson/meson_osd_afbcd.c b/drivers/gpu/drm/meson/meson_osd_afbcd.c
> index ffc6b584dbf8..0cdbe899402f 100644
> --- a/drivers/gpu/drm/meson/meson_osd_afbcd.c
> +++ b/drivers/gpu/drm/meson/meson_osd_afbcd.c
> @@ -79,11 +79,6 @@ static bool meson_gxm_afbcd_supported_fmt(u64 modifier, uint32_t format)
> return meson_gxm_afbcd_pixel_fmt(modifier, format) >= 0;
> }
>
> -static int meson_gxm_afbcd_init(struct meson_drm *priv)
> -{
> - return 0;
> -}
> -
> static int meson_gxm_afbcd_reset(struct meson_drm *priv)
> {
> writel_relaxed(VIU_SW_RESET_OSD1_AFBCD,
> @@ -93,6 +88,16 @@ static int meson_gxm_afbcd_reset(struct meson_drm *priv)
> return 0;
> }
>
> +static int meson_gxm_afbcd_init(struct meson_drm *priv)
> +{
> + return 0;
> +}
> +
> +static void meson_gxm_afbcd_exit(struct meson_drm *priv)
> +{
> + meson_gxm_afbcd_reset(priv);
> +}
> +
> static int meson_gxm_afbcd_enable(struct meson_drm *priv)
> {
> writel_relaxed(FIELD_PREP(OSD1_AFBCD_ID_FIFO_THRD, 0x40) |
> @@ -172,6 +177,7 @@ static int meson_gxm_afbcd_setup(struct meson_drm *priv)
>
> struct meson_afbcd_ops meson_afbcd_gxm_ops = {
> .init = meson_gxm_afbcd_init,
> + .exit = meson_gxm_afbcd_exit,
> .reset = meson_gxm_afbcd_reset,
> .enable = meson_gxm_afbcd_enable,
> .disable = meson_gxm_afbcd_disable,
> @@ -269,6 +275,18 @@ static bool meson_g12a_afbcd_supported_fmt(u64 modifier, uint32_t format)
> return meson_g12a_afbcd_pixel_fmt(modifier, format) >= 0;
> }
>
> +static int meson_g12a_afbcd_reset(struct meson_drm *priv)
> +{
> + meson_rdma_reset(priv);
> +
> + meson_rdma_writel_sync(priv, VIU_SW_RESET_G12A_AFBC_ARB |
> + VIU_SW_RESET_G12A_OSD1_AFBCD,
> + VIU_SW_RESET);
> + meson_rdma_writel_sync(priv, 0, VIU_SW_RESET);
> +
> + return 0;
> +}
> +
> static int meson_g12a_afbcd_init(struct meson_drm *priv)
> {
> int ret;
> @@ -286,16 +304,10 @@ static int meson_g12a_afbcd_init(struct meson_drm *priv)
> return 0;
> }
>
> -static int meson_g12a_afbcd_reset(struct meson_drm *priv)
> +static void meson_g12a_afbcd_exit(struct meson_drm *priv)
> {
> - meson_rdma_reset(priv);
> -
> - meson_rdma_writel_sync(priv, VIU_SW_RESET_G12A_AFBC_ARB |
> - VIU_SW_RESET_G12A_OSD1_AFBCD,
> - VIU_SW_RESET);
> - meson_rdma_writel_sync(priv, 0, VIU_SW_RESET);
> -
> - return 0;
> + meson_g12a_afbcd_reset(priv);
> + meson_rdma_free(priv);
> }
>
> static int meson_g12a_afbcd_enable(struct meson_drm *priv)
> @@ -380,6 +392,7 @@ static int meson_g12a_afbcd_setup(struct meson_drm *priv)
>
> struct meson_afbcd_ops meson_afbcd_g12a_ops = {
> .init = meson_g12a_afbcd_init,
> + .exit = meson_g12a_afbcd_exit,
> .reset = meson_g12a_afbcd_reset,
> .enable = meson_g12a_afbcd_enable,
> .disable = meson_g12a_afbcd_disable,
> diff --git a/drivers/gpu/drm/meson/meson_osd_afbcd.h b/drivers/gpu/drm/meson/meson_osd_afbcd.h
> index 5e5523304f42..e77ddeb6416f 100644
> --- a/drivers/gpu/drm/meson/meson_osd_afbcd.h
> +++ b/drivers/gpu/drm/meson/meson_osd_afbcd.h
> @@ -14,6 +14,7 @@
>
> struct meson_afbcd_ops {
> int (*init)(struct meson_drm *priv);
> + void (*exit)(struct meson_drm *priv);
> int (*reset)(struct meson_drm *priv);
> int (*enable)(struct meson_drm *priv);
> int (*disable)(struct meson_drm *priv);
>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Thanks for fixing this
Neil
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2022-01-03 11:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-30 23:55 [PATCH 0/2] drm/meson: Error handling fix when AFBCD is used Martin Blumenstingl
2021-12-30 23:55 ` [PATCH 1/2] drm/meson: osd_afbcd: Add an exit callback to struct meson_afbcd_ops Martin Blumenstingl
2022-01-03 11:24 ` Neil Armstrong [this message]
2021-12-30 23:55 ` [PATCH 2/2] drm/meson: Fix error handling when afbcd.ops->init fails Martin Blumenstingl
2022-01-03 11:22 ` Neil Armstrong
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=4a4b40fd-b9d7-b38d-b4d4-4aaaf03693f2@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.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
all inboxes | Powered by JetHome®