On Thu, Jun 8, 2023 at 4:57 AM Nícolas F. R. A. Prado
<nfraprado@xxxxxxxxxxxxx> wrote:
Remove the requirement of a VDEC_SYS reg iospace. To achieve that, rely
on the "active" clock being passed through the DT, and read its status
during IRQ handling to check whether the HW is active.
The old behavior is still present when reg-names aren't supplied, as to
keep backward compatibility.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>
---
(no changes since v1)
.../mediatek/vcodec/mtk_vcodec_dec_drv.c | 59 +++++++++++++++----
.../mediatek/vcodec/mtk_vcodec_dec_hw.c | 20 +++++--
.../mediatek/vcodec/mtk_vcodec_dec_pm.c | 12 +++-
.../platform/mediatek/vcodec/mtk_vcodec_drv.h | 1 +
4 files changed, 74 insertions(+), 18 deletions(-)
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
index 9c652beb3f19..8038472fb67b 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
@@ -16,6 +16,7 @@
#include <media/v4l2-mem2mem.h>
#include <media/videobuf2-dma-contig.h>
#include <media/v4l2-device.h>
+#include <linux/clk-provider.h>
^^^^^^^^^^^^^^
This seems like a violation of the API separation.
#include "mtk_vcodec_drv.h"
#include "mtk_vcodec_dec.h"
@@ -38,22 +39,29 @@ static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dev *dev)
}
}
+static bool mtk_vcodec_is_hw_active(struct mtk_vcodec_dev *dev)
+{
+ u32 cg_status = 0;
+
+ if (!dev->reg_base[VDEC_SYS])
+ return __clk_is_enabled(dev->pm.vdec_active_clk);
AFAIK this is still around for clk drivers that haven't moved to clk_hw.
It shouldn't be used by clock consumers. Would it be better to just pass
a syscon?