linux-stable/drivers/clk
Marc Gonzalez 9ff328de02 clk: qcom: mmcc-msm8998: fix venus clock issue
[ Upstream commit e20ae5ae9f ]

Right now, msm8998 video decoder (venus) is non-functional:

$ time mpv --hwdec=v4l2m2m-copy --vd-lavc-software-fallback=no --vo=null --no-audio --untimed --length=30 --quiet demo-480.webm
 (+) Video --vid=1 (*) (vp9 854x480 29.970fps)
     Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
[ffmpeg/video] vp9_v4l2m2m: output VIDIOC_REQBUFS failed: Connection timed out
[ffmpeg/video] vp9_v4l2m2m: no v4l2 output context's buffers
[ffmpeg/video] vp9_v4l2m2m: can't configure decoder
Could not open codec.
Software decoding fallback is disabled.
Exiting... (Quit)

Bryan O'Donoghue suggested the proper fix:
- Set required register offsets in venus GDSC structs.
- Set HW_CTRL flag.

$ time mpv --hwdec=v4l2m2m-copy --vd-lavc-software-fallback=no --vo=null --no-audio --untimed --length=30 --quiet demo-480.webm
 (+) Video --vid=1 (*) (vp9 854x480 29.970fps)
     Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
[ffmpeg/video] vp9_v4l2m2m: VIDIOC_G_FMT ioctl
[ffmpeg/video] vp9_v4l2m2m: VIDIOC_G_FMT ioctl
...
Using hardware decoding (v4l2m2m-copy).
VO: [null] 854x480 nv12
Exiting... (End of file)
real	0m3.315s
user	0m1.277s
sys	0m0.453s

NOTES:

GDSC = Globally Distributed Switch Controller

Use same code as mmcc-msm8996 with:
s/venus_gdsc/video_top_gdsc/
s/venus_core0_gdsc/video_subcore0_gdsc/
s/venus_core1_gdsc/video_subcore1_gdsc/

https://git.codelinaro.org/clo/la/kernel/msm-4.4/-/blob/caf_migration/kernel.lnx.4.4.r38-rel/include/dt-bindings/clock/msm-clocks-hwio-8996.h
https://git.codelinaro.org/clo/la/kernel/msm-4.4/-/blob/caf_migration/kernel.lnx.4.4.r38-rel/include/dt-bindings/clock/msm-clocks-hwio-8998.h

0x1024 = MMSS_VIDEO GDSCR (undocumented)
0x1028 = MMSS_VIDEO_CORE_CBCR
0x1030 = MMSS_VIDEO_AHB_CBCR
0x1034 = MMSS_VIDEO_AXI_CBCR
0x1038 = MMSS_VIDEO_MAXI_CBCR
0x1040 = MMSS_VIDEO_SUBCORE0 GDSCR (undocumented)
0x1044 = MMSS_VIDEO_SUBCORE1 GDSCR (undocumented)
0x1048 = MMSS_VIDEO_SUBCORE0_CBCR
0x104c = MMSS_VIDEO_SUBCORE1_CBCR

Fixes: d14b15b593 ("clk: qcom: Add MSM8998 Multimedia Clock Controller (MMCC) driver")
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Marc Gonzalez <mgonzalez@freebox.fr>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://lore.kernel.org/r/ff4e2e34-a677-4c39-8c29-83655c5512ae@freebox.fr
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-16 13:32:13 +02:00
..
actions clk: actions: Terminate clk_div_table with sentinel element 2022-04-08 14:40:26 +02:00
analogbits
at91 clk: at91: clk-sam9x60-pll: fix return value check 2023-05-17 11:48:00 +02:00
axis
axs10x
baikal-t1 clk: baikal-t1: Add SATA internal ref clock buffer 2022-10-26 13:25:39 +02:00
bcm clk: bcm2835: Make peripheral PLLC critical 2022-10-26 13:25:54 +02:00
berlin clk: berlin: Add of_node_put() for of_get_parent() 2022-10-26 13:25:31 +02:00
davinci This pull request contains zero diff to the core framework. It is a collection 2020-10-22 12:53:28 -07:00
h8300
hisilicon clk: hisilicon: hi3519: Release the correct number of gates in hi3519_clk_unregister() 2024-03-26 18:21:58 -04:00
imgtec treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
imx clk: imx: imx8mq: correct error handling path 2023-11-20 11:06:47 +01:00
ingenic clk: ingenic-tcu: Properly enable registers before accessing timers 2022-10-05 10:38:38 +02:00
keystone clk: keystone: pll: fix a couple NULL vs IS_ERR() checks 2023-11-20 11:06:47 +01:00
loongson1 clk: loongson1: Terminate clk_div_table with sentinel element 2022-04-08 14:40:26 +02:00
mediatek clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data 2023-11-20 11:06:48 +01:00
meson clk: meson: Hold reference returned by of_get_parent() 2022-10-26 13:25:31 +02:00
microchip
mmp clk: mmp: pxa168: Fix memory leak in pxa168_clk_init() 2024-02-23 08:42:12 +01:00
mvebu clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths 2021-11-18 14:04:14 +01:00
mxs
nxp
pistachio
pxa clk: pxa: Constify static struct clk_ops 2020-10-13 19:49:11 -07:00
qcom clk: qcom: mmcc-msm8998: fix venus clock issue 2024-06-16 13:32:13 +02:00
renesas clk: renesas: cpg-mssr: Remove superfluous check in resume code 2023-03-11 16:39:42 +01:00
rockchip clk: rockchip: rk3128: Fix HCLK_OTG gate register 2024-01-25 14:37:37 -08:00
samsung clk: samsung: Fix memory leak in _samsung_clk_register_pll() 2023-01-14 10:15:40 +01:00
sifive clk: sifive: allocate sufficient memory for struct __prci_data 2020-06-25 15:04:13 -07:00
sirf clk: clk-prima2: fix return value check in prima2_clk_init() 2020-10-13 19:54:30 -07:00
socfpga clk: socfpga: Fix memory leak in socfpga_gate_init() 2023-01-14 10:15:42 +01:00
spear clk: spear: Remove uninitialized_var() usage 2020-07-16 12:32:26 -07:00
sprd clk: sprd: set max_register according to mapping range 2023-04-20 12:10:25 +02:00
st clk: st: Fix memory leak in st_of_quadfs_setup() 2023-01-14 10:16:19 +01:00
sunxi clk: sunxi: sun9i-mmc: check return value after calling platform_get_resource() 2022-05-09 09:05:04 +02:00
sunxi-ng clk: sunxi-ng: h6: Reparent CPUX during PLL CPUX rate change 2024-05-17 11:48:02 +02:00
tegra clk: tegra: fix error return case for recalc_rate 2023-10-10 21:53:30 +02:00
ti clk: ti: fix double free in of_ti_divider_clk_setup() 2023-11-20 11:06:47 +01:00
uniphier clk: uniphier: Fix fixed-rate initialization 2022-04-08 14:39:50 +02:00
ux500
versatile clk: versatile: Add of_node_put() before return statement 2020-09-10 00:57:42 -07:00
x86 clk: mxl: syscon_node_to_regmap() returns error pointers 2023-02-25 11:55:02 +01:00
zte
zynq
zynqmp drivers: clk: zynqmp: update divider round rate logic 2024-01-25 14:37:49 -08:00
Kconfig clk: fixed-mmio: make COMMON_CLK_FIXED_MMIO depend on HAS_IOMEM 2023-09-19 12:20:05 +02:00
Makefile clk: sparx5: Add Sparx5 SoC DPLL clock driver 2020-07-28 18:17:56 -07:00
clk-asm9260.c clk: asm9260: use parent index to link the reference clock 2023-11-20 11:06:47 +01:00
clk-aspeed.c
clk-aspeed.h
clk-ast2600.c clk: ast2600: BCLK comes from EPLL 2022-10-26 13:25:40 +02:00
clk-axi-clkgen.c clk: axi-clkgen: Set power bits for fractional mode 2020-10-13 19:44:40 -07:00
clk-axm5516.c
clk-bd718x7.c
clk-bm1880.c clk: bm1880: remove kfrees on static allocations 2022-01-27 10:54:09 +01:00
clk-bulk.c
clk-cdce706.c Replace HTTP links with HTTPS ones: Common CLK framework 2020-07-10 17:15:34 -07:00
clk-cdce925.c clk: cdce925: check return value of kasprintf() 2023-07-27 08:43:54 +02:00
clk-clps711x.c clk: clps711x: Terminate clk_div_table with sentinel element 2022-04-08 14:40:26 +02:00
clk-composite.c clk: composite: Export clk_hw_register_composite() 2020-08-22 12:38:06 +08:00
clk-conf.c clk: add missing of_node_put() in "assigned-clocks" property parsing 2023-05-17 11:48:01 +02:00
clk-cs2000-cp.c
clk-devres.c clk: Fix slab-out-of-bounds error in devm_clk_release() 2023-08-30 16:23:14 +02:00
clk-divider.c clk: divider: fix initialization with parent_hw 2021-03-04 11:38:06 +01:00
clk-efm32gg.c
clk-fixed-factor.c clk: fixed: add missing kerneldoc 2020-09-22 12:44:14 -07:00
clk-fixed-mmio.c
clk-fixed-rate.c clk: fixed-rate: add devm_clk_hw_register_fixed_rate 2024-01-25 14:37:49 -08:00
clk-fractional-divider.c
clk-fsl-sai.c clk: fsl-sai: fix memory leak 2020-12-30 11:53:42 +01:00
clk-gate.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
clk-gemini.c
clk-gpio.c Replace HTTP links with HTTPS ones: Common CLK framework 2020-07-10 17:15:34 -07:00
clk-hi655x.c
clk-highbank.c
clk-hsdk-pll.c
clk-lochnagar.c
clk-max9485.c
clk-max77686.c
clk-milbeaut.c
clk-moxart.c
clk-multiplier.c
clk-mux.c
clk-nomadik.c
clk-npcm7xx.c clk: npcm7xx: Fix incorrect kfree 2023-11-20 11:06:47 +01:00
clk-nspire.c
clk-oxnas.c clk: oxnas: Hold reference returned by of_get_parent() 2022-10-26 13:25:31 +02:00
clk-palmas.c
clk-plldig.c
clk-pwm.c clk: pwm: Use 64-bit division function 2020-06-17 20:42:10 +02:00
clk-qoriq.c clk: qoriq: Hold reference returned by of_get_parent() 2022-10-26 13:25:31 +02:00
clk-rk808.c
clk-s2mps11.c clk: s2mps11: Fix a resource leak in error handling paths in the probe function 2020-12-30 11:54:01 +01:00
clk-scmi.c clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped 2023-11-20 11:06:50 +01:00
clk-scpi.c
clk-si514.c
clk-si544.c
clk-si570.c
clk-si5341.c clk: si5341: fix an error code problem in si5341_output_clk_set_rate 2024-01-25 14:37:49 -08:00
clk-si5351.c Replace HTTP links with HTTPS ones: Common CLK framework 2020-07-10 17:15:34 -07:00
clk-si5351.h
clk-sparx5.c clk: sparx5: Add Sparx5 SoC DPLL clock driver 2020-07-28 18:17:56 -07:00
clk-stm32f4.c clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after system enter shell 2022-01-27 10:54:07 +01:00
clk-stm32h7.c
clk-stm32mp1.c
clk-tango4.c
clk-twl6040.c
clk-u300.c
clk-versaclock5.c clk: vc5: check memory returned by kasprintf() 2023-07-27 08:43:54 +02:00
clk-vt8500.c
clk-wm831x.c
clk-xgene.c
clk.c clk: Don't hold prepare_lock when calling kref_put() 2024-05-17 11:48:05 +02:00
clk.h
clkdev.c