drm/meson: osd_afbcd: Add an exit callback to struct meson_afbcd_ops
[ Upstream commit 04b8a5d9cfd171f65df75f444b5617a372649edd ]
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>
Fixes: d1b5e41e13
("drm/meson: Add AFBCD module driver")
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211230235515.1627522-2-martin.blumenstingl@googlemail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
a1c665f5b7
commit
ec3924eab5
@@ -396,10 +396,8 @@ static void meson_drv_unbind(struct device *dev)
|
|||||||
drm_irq_uninstall(drm);
|
drm_irq_uninstall(drm);
|
||||||
drm_dev_put(drm);
|
drm_dev_put(drm);
|
||||||
|
|
||||||
if (priv->afbcd.ops) {
|
if (priv->afbcd.ops)
|
||||||
priv->afbcd.ops->reset(priv);
|
priv->afbcd.ops->exit(priv);
|
||||||
meson_rdma_free(priv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct component_master_ops meson_drv_master_ops = {
|
static const struct component_master_ops meson_drv_master_ops = {
|
||||||
|
@@ -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;
|
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)
|
static int meson_gxm_afbcd_reset(struct meson_drm *priv)
|
||||||
{
|
{
|
||||||
writel_relaxed(VIU_SW_RESET_OSD1_AFBCD,
|
writel_relaxed(VIU_SW_RESET_OSD1_AFBCD,
|
||||||
@@ -93,6 +88,16 @@ static int meson_gxm_afbcd_reset(struct meson_drm *priv)
|
|||||||
return 0;
|
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)
|
static int meson_gxm_afbcd_enable(struct meson_drm *priv)
|
||||||
{
|
{
|
||||||
writel_relaxed(FIELD_PREP(OSD1_AFBCD_ID_FIFO_THRD, 0x40) |
|
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 = {
|
struct meson_afbcd_ops meson_afbcd_gxm_ops = {
|
||||||
.init = meson_gxm_afbcd_init,
|
.init = meson_gxm_afbcd_init,
|
||||||
|
.exit = meson_gxm_afbcd_exit,
|
||||||
.reset = meson_gxm_afbcd_reset,
|
.reset = meson_gxm_afbcd_reset,
|
||||||
.enable = meson_gxm_afbcd_enable,
|
.enable = meson_gxm_afbcd_enable,
|
||||||
.disable = meson_gxm_afbcd_disable,
|
.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;
|
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)
|
static int meson_g12a_afbcd_init(struct meson_drm *priv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -286,16 +304,10 @@ static int meson_g12a_afbcd_init(struct meson_drm *priv)
|
|||||||
return 0;
|
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_g12a_afbcd_reset(priv);
|
||||||
|
meson_rdma_free(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_enable(struct meson_drm *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 = {
|
struct meson_afbcd_ops meson_afbcd_g12a_ops = {
|
||||||
.init = meson_g12a_afbcd_init,
|
.init = meson_g12a_afbcd_init,
|
||||||
|
.exit = meson_g12a_afbcd_exit,
|
||||||
.reset = meson_g12a_afbcd_reset,
|
.reset = meson_g12a_afbcd_reset,
|
||||||
.enable = meson_g12a_afbcd_enable,
|
.enable = meson_g12a_afbcd_enable,
|
||||||
.disable = meson_g12a_afbcd_disable,
|
.disable = meson_g12a_afbcd_disable,
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
struct meson_afbcd_ops {
|
struct meson_afbcd_ops {
|
||||||
int (*init)(struct meson_drm *priv);
|
int (*init)(struct meson_drm *priv);
|
||||||
|
void (*exit)(struct meson_drm *priv);
|
||||||
int (*reset)(struct meson_drm *priv);
|
int (*reset)(struct meson_drm *priv);
|
||||||
int (*enable)(struct meson_drm *priv);
|
int (*enable)(struct meson_drm *priv);
|
||||||
int (*disable)(struct meson_drm *priv);
|
int (*disable)(struct meson_drm *priv);
|
||||||
|
Reference in New Issue
Block a user