diff --git a/projects/Allwinner/patches/linux/0002-clk-Implement-protected-clocks-for-all-OF-clock-prov.patch b/projects/Allwinner/patches/linux/0002-clk-Implement-protected-clocks-for-all-OF-clock-prov.patch index 8ac83e1b33..fed84bf74c 100644 --- a/projects/Allwinner/patches/linux/0002-clk-Implement-protected-clocks-for-all-OF-clock-prov.patch +++ b/projects/Allwinner/patches/linux/0002-clk-Implement-protected-clocks-for-all-OF-clock-prov.patch @@ -62,14 +62,14 @@ again for each clock, which is part of why I didn't do it that way. Signed-off-by: Samuel Holland --- - drivers/clk/clk-conf.c | 54 ++++++++++++++++++++++++++++++++++++++++++ + drivers/clk/clk-conf.c | 56 ++++++++++++++++++++++++++++++++++++++++++ drivers/clk/clk.c | 31 ++++++++++++++++++++++++ drivers/clk/clk.h | 2 ++ 3 files changed, 87 insertions(+) --- a/drivers/clk/clk-conf.c +++ b/drivers/clk/clk-conf.c -@@ -11,6 +11,54 @@ +@@ -11,6 +11,56 @@ #include #include @@ -93,7 +93,9 @@ Signed-off-by: Samuel Holland + clkspec.np = node; + clkspec.args_count = nr_cells; + -+ of_property_for_each_u32(node, "protected-clocks", prop, cur, clkspec.args[0]) { ++ prop = of_find_property(node, "protected-clocks", NULL); ++ for (cur = of_prop_next_u32(prop, NULL, &clkspec.args[0]); cur; ++ cur = of_prop_next_u32(prop, cur, &clkspec.args[0])) { + /* read the remainder of the clock specifier */ + for (i = 1; i < nr_cells; ++i) { + cur = of_prop_next_u32(prop, cur, &clkspec.args[i]); diff --git a/projects/Allwinner/patches/linux/0003-Revert-clk-qcom-Support-protected-clocks-property.patch b/projects/Allwinner/patches/linux/0003-Revert-clk-qcom-Support-protected-clocks-property.patch index 98f48bc5d3..ea4476ab7d 100644 --- a/projects/Allwinner/patches/linux/0003-Revert-clk-qcom-Support-protected-clocks-property.patch +++ b/projects/Allwinner/patches/linux/0003-Revert-clk-qcom-Support-protected-clocks-property.patch @@ -15,7 +15,7 @@ Signed-off-by: Samuel Holland --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c -@@ -194,22 +194,6 @@ int qcom_cc_register_sleep_clk(struct de +@@ -223,20 +223,6 @@ int qcom_cc_register_sleep_clk(struct de } EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk); @@ -23,11 +23,9 @@ Signed-off-by: Samuel Holland -static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc) -{ - struct device_node *np = dev->of_node; -- struct property *prop; -- const __be32 *p; - u32 i; - -- of_property_for_each_u32(np, "protected-clocks", prop, p, i) { +- of_property_for_each_u32(np, "protected-clocks", i) { - if (i >= cc->num_rclks) - continue; - @@ -38,7 +36,7 @@ Signed-off-by: Samuel Holland static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec, void *data) { -@@ -272,8 +256,6 @@ int qcom_cc_really_probe(struct platform +@@ -330,8 +314,6 @@ int qcom_cc_really_probe(struct platform cc->rclks = rclks; cc->num_rclks = num_clks; diff --git a/projects/Allwinner/patches/linux/0017-net-phy-Add-support-for-AC200-EPHY.patch b/projects/Allwinner/patches/linux/0017-net-phy-Add-support-for-AC200-EPHY.patch index c5814cd7c2..14b43fd182 100644 --- a/projects/Allwinner/patches/linux/0017-net-phy-Add-support-for-AC200-EPHY.patch +++ b/projects/Allwinner/patches/linux/0017-net-phy-Add-support-for-AC200-EPHY.patch @@ -39,7 +39,7 @@ Signed-off-by: Jernej Skrabec aquantia-objs += aquantia_main.o --- /dev/null +++ b/drivers/net/phy/ac200.c -@@ -0,0 +1,234 @@ +@@ -0,0 +1,232 @@ +// SPDX-License-Identifier: GPL-2.0+ +/** + * Driver for AC200 Ethernet PHY @@ -242,7 +242,7 @@ Signed-off-by: Jernej Skrabec + return 0; +} + -+static int ac200_ephy_remove(struct platform_device *pdev) ++static void ac200_ephy_remove(struct platform_device *pdev) +{ + struct ac200_ephy_dev *priv = platform_get_drvdata(pdev); + @@ -251,8 +251,6 @@ Signed-off-by: Jernej Skrabec + regmap_write(priv->regmap, AC200_EPHY_CTL, AC200_EPHY_SHUTDOWN); + regmap_write(priv->regmap, AC200_SYS_EPHY_CTL1, 0); + regmap_write(priv->regmap, AC200_SYS_EPHY_CTL0, 0); -+ -+ return 0; +} + +static const struct of_device_id ac200_ephy_match[] = { diff --git a/projects/Allwinner/patches/linux/0018-wip-H6-deinterlace.patch b/projects/Allwinner/patches/linux/0018-wip-H6-deinterlace.patch index ba708017e5..421d1b23b5 100644 --- a/projects/Allwinner/patches/linux/0018-wip-H6-deinterlace.patch +++ b/projects/Allwinner/patches/linux/0018-wip-H6-deinterlace.patch @@ -47,7 +47,7 @@ Signed-off-by: Jernej Skrabec +obj-$(CONFIG_VIDEO_SUN50I_DEINTERLACE) += sun50i-di.o --- /dev/null +++ b/drivers/media/platform/sunxi/sun50i-di/sun50i-di.c -@@ -0,0 +1,1137 @@ +@@ -0,0 +1,1135 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Allwinner sun50i deinterlacer driver @@ -1087,7 +1087,7 @@ Signed-off-by: Jernej Skrabec + return ret; +} + -+static int deinterlace_remove(struct platform_device *pdev) ++static void deinterlace_remove(struct platform_device *pdev) +{ + struct deinterlace_dev *dev = platform_get_drvdata(pdev); + @@ -1096,8 +1096,6 @@ Signed-off-by: Jernej Skrabec + v4l2_device_unregister(&dev->v4l2_dev); + + pm_runtime_force_suspend(&pdev->dev); -+ -+ return 0; +} + +static int deinterlace_runtime_resume(struct device *device) diff --git a/projects/Allwinner/patches/linux/0040-iommu-sun50i-Allow-page-sizes-multiple-of-4096.patch b/projects/Allwinner/patches/linux/0040-iommu-sun50i-Allow-page-sizes-multiple-of-4096.patch index a3ae12f821..d83839aa5d 100644 --- a/projects/Allwinner/patches/linux/0040-iommu-sun50i-Allow-page-sizes-multiple-of-4096.patch +++ b/projects/Allwinner/patches/linux/0040-iommu-sun50i-Allow-page-sizes-multiple-of-4096.patch @@ -18,7 +18,7 @@ diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index d7c5e9b1a087..9944266c4f58 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c -@@ -593,10 +593,12 @@ static int sun50i_iommu_map(struct iommu_domain *domain, unsigned long iova, +@@ -598,10 +598,12 @@ static int sun50i_iommu_map(struct iommu_domain *domain, unsigned long iova, { struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); struct sun50i_iommu *iommu = sun50i_domain->iommu; @@ -29,9 +29,9 @@ index d7c5e9b1a087..9944266c4f58 100644 + pages = size / SPAGE_SIZE; + - page_table = sun50i_dte_get_page_table(sun50i_domain, iova, gfp); - if (IS_ERR(page_table)) { - ret = PTR_ERR(page_table); + /* the IOMMU can only handle 32-bit addresses, both input and output */ + if ((uint64_t)paddr >> 32) { + ret = -EINVAL; @@ -604,18 +606,21 @@ static int sun50i_iommu_map(struct iommu_domain *domain, unsigned long iova, } diff --git a/projects/Allwinner/patches/linux/0049-drm-sun4i-dw-hdmi-Switch-to-bridge-functions.patch b/projects/Allwinner/patches/linux/0049-drm-sun4i-dw-hdmi-Switch-to-bridge-functions.patch index 85b3bd45a8..25280bc945 100644 --- a/projects/Allwinner/patches/linux/0049-drm-sun4i-dw-hdmi-Switch-to-bridge-functions.patch +++ b/projects/Allwinner/patches/linux/0049-drm-sun4i-dw-hdmi-Switch-to-bridge-functions.patch @@ -17,6 +17,17 @@ Signed-off-by: Jernej Skrabec drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 5 ++ 2 files changed, 117 insertions(+), 2 deletions(-) +diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig +--- a/drivers/gpu/drm/sun4i/Kconfig ++++ b/drivers/gpu/drm/sun4i/Kconfig +@@ -3,6 +3,7 @@ + tristate "DRM Support for Allwinner A10 Display Engine" + depends on DRM && COMMON_CLK + depends on ARCH_SUNXI || COMPILE_TEST ++ select DRM_BRIDGE_CONNECTOR + select DRM_GEM_DMA_HELPER + select DRM_KMS_HELPER + select DRM_PANEL diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 8f8d3bdba5ce..93831cdf1917 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c diff --git a/projects/Allwinner/patches/linux/0061-media-Add-NV12-and-P010-AFBC-compressed-formats.patch b/projects/Allwinner/patches/linux/0061-media-Add-NV12-and-P010-AFBC-compressed-formats.patch index 8cce55c24e..f6fe9e35f8 100644 --- a/projects/Allwinner/patches/linux/0061-media-Add-NV12-and-P010-AFBC-compressed-formats.patch +++ b/projects/Allwinner/patches/linux/0061-media-Add-NV12-and-P010-AFBC-compressed-formats.patch @@ -16,10 +16,10 @@ diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2 index f4d9d6279094..1e07066fa129 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c -@@ -1510,6 +1510,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) - case V4L2_PIX_FMT_MT2110T: descr = "Mediatek 10bit Tile Mode"; break; - case V4L2_PIX_FMT_MT2110R: descr = "Mediatek 10bit Raster Mode"; break; - case V4L2_PIX_FMT_HEXTILE: descr = "Hextile Compressed Format"; break; +@@ -1542,6 +1542,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) + case V4L2_PIX_FMT_PISP_COMP2_GBRG: descr = "PiSP 8b GBGB/RGRG mode2 compr"; break; + case V4L2_PIX_FMT_PISP_COMP2_BGGR: descr = "PiSP 8b BGBG/GRGR mode2 compr"; break; + case V4L2_PIX_FMT_PISP_COMP2_MONO: descr = "PiSP 8b monochrome mode2 compr"; break; + case V4L2_PIX_FMT_YUV420_8_AFBC_16X16_SPLIT: descr = "YUV 4:2:0 (AFBC 16x16)"; break; + case V4L2_PIX_FMT_YUV420_10_AFBC_16X16_SPLIT: descr = "10-bit YUV 4:2:0 (AFBC 16x16)"; break; default: diff --git a/projects/Allwinner/patches/linux/0064-drm-sun4i-de2-Initialize-layer-fields-earlier.patch b/projects/Allwinner/patches/linux/0064-drm-sun4i-de2-Initialize-layer-fields-earlier.patch index b3ac0a7bef..7dc71aec62 100644 --- a/projects/Allwinner/patches/linux/0064-drm-sun4i-de2-Initialize-layer-fields-earlier.patch +++ b/projects/Allwinner/patches/linux/0064-drm-sun4i-de2-Initialize-layer-fields-earlier.patch @@ -17,22 +17,24 @@ diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8 index 884abe3cf773..91781b5bbbbc 100644 --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c -@@ -365,6 +365,10 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm, +@@ -295,6 +295,11 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm, if (!layer) return ERR_PTR(-ENOMEM); + layer->mixer = mixer; ++ layer->type = SUN8I_LAYER_TYPE_UI; + layer->channel = channel; + layer->overlay = 0; + if (index == 0) type = DRM_PLANE_TYPE_PRIMARY; -@@ -395,9 +399,6 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm, +@@ -325,10 +330,6 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm, } drm_plane_helper_add(&layer->plane, &sun8i_ui_layer_helper_funcs); - layer->mixer = mixer; +- layer->type = SUN8I_LAYER_TYPE_UI; - layer->channel = channel; - layer->overlay = 0; @@ -42,22 +44,24 @@ diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8 index 6ee3790a2a81..329e8bf8cd20 100644 --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c -@@ -549,6 +549,10 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, +@@ -478,6 +478,11 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, if (!layer) return ERR_PTR(-ENOMEM); + layer->mixer = mixer; ++ layer->type = SUN8I_LAYER_TYPE_VI; + layer->channel = index; + layer->overlay = 0; + if (mixer->cfg->is_de3) { formats = sun8i_vi_layer_de3_formats; format_count = ARRAY_SIZE(sun8i_vi_layer_de3_formats); -@@ -607,9 +611,6 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, +@@ -543,10 +549,6 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, } drm_plane_helper_add(&layer->plane, &sun8i_vi_layer_helper_funcs); - layer->mixer = mixer; +- layer->type = SUN8I_LAYER_TYPE_VI; - layer->channel = index; - layer->overlay = 0; diff --git a/projects/Allwinner/patches/linux/0065-drm-sun4i-de3-Implement-AFBC-support.patch b/projects/Allwinner/patches/linux/0065-drm-sun4i-de3-Implement-AFBC-support.patch index fab63060da..ecfc5967f9 100644 --- a/projects/Allwinner/patches/linux/0065-drm-sun4i-de3-Implement-AFBC-support.patch +++ b/projects/Allwinner/patches/linux/0065-drm-sun4i-de3-Implement-AFBC-support.patch @@ -372,6 +372,26 @@ index 000000000000..cea685c86855 +void sun50i_afbc_disable(struct sun8i_mixer *mixer, unsigned int channel); + +#endif +diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c +--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c ++++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c +@@ -26,6 +26,7 @@ + #include + + #include "sun4i_drv.h" ++#include "sun50i_afbc.h" + #include "sun50i_fmt.h" + #include "sun8i_mixer.h" + #include "sun8i_ui_layer.h" +@@ -272,6 +273,8 @@ + val = enable ? SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN : 0; + mask = SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN; + reg = SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, layer->overlay); ++ if (!enable && layer->mixer->cfg->is_de3) ++ sun50i_afbc_disable(layer->mixer, layer->channel); + } + + regmap_update_bits(layer->mixer->engine.regs, reg, mask, val); diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c index 329e8bf8cd20..bda91c3e2bb7 100644 --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c @@ -414,7 +434,7 @@ index 329e8bf8cd20..bda91c3e2bb7 100644 DRM_DEBUG_DRIVER("Using horizontal coarse scaling\n"); hm = src_w; hn = scanline; -@@ -356,6 +358,15 @@ static int sun8i_vi_layer_update_buffer(struct sun8i_mixer *mixer, int channel, +@@ -307,6 +309,15 @@ static int sun8i_vi_layer_update_buffer(struct sun8i_mixer *mixer, int channel, return 0; } @@ -430,34 +450,20 @@ index 329e8bf8cd20..bda91c3e2bb7 100644 static int sun8i_vi_layer_atomic_check(struct drm_plane *plane, struct drm_atomic_state *state) { -@@ -399,6 +410,8 @@ static void sun8i_vi_layer_atomic_disable(struct drm_plane *plane, - - sun8i_vi_layer_enable(mixer, layer->channel, layer->overlay, false, 0, - old_zpos); -+ if (mixer->cfg->is_de3) -+ sun50i_afbc_disable(mixer, layer->channel); - } - - static void sun8i_vi_layer_atomic_update(struct drm_plane *plane, -@@ -411,26 +424,53 @@ static void sun8i_vi_layer_atomic_update(struct drm_plane *plane, - struct sun8i_vi_layer *layer = plane_to_sun8i_vi_layer(plane); +@@ -346,19 +357,44 @@ static void sun8i_vi_layer_atomic_update(struct drm_plane *plane, + plane); + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); unsigned int zpos = new_state->normalized_zpos; - unsigned int old_zpos = old_state->normalized_zpos; + struct drm_framebuffer *fb = plane->state->fb; struct sun8i_mixer *mixer = layer->mixer; + bool afbc = drm_is_afbc(fb->modifier); - if (!new_state->visible) { - sun8i_vi_layer_enable(mixer, layer->channel, - layer->overlay, false, 0, old_zpos); -+ if (mixer->cfg->is_de3) -+ sun50i_afbc_disable(mixer, layer->channel); + if (!new_state->crtc || !new_state->visible) return; - } - ++ + if (afbc) { + u32 fmt_type; -+ + + sun8i_vi_layer_prepare_non_linear(mixer, layer->channel, + layer->overlay); + sun50i_afbc_atomic_update(mixer, layer->channel, plane); @@ -485,21 +491,17 @@ index 329e8bf8cd20..bda91c3e2bb7 100644 - sun8i_vi_layer_update_buffer(mixer, layer->channel, - layer->overlay, plane); + layer->overlay, plane, zpos, afbc); - sun8i_vi_layer_enable(mixer, layer->channel, layer->overlay, - true, zpos, old_zpos); - } - ++} ++ +static bool sun8i_vi_layer_format_mod_supported(struct drm_plane *plane, + u32 format, u64 modifier) +{ -+ struct sun8i_vi_layer *layer = plane_to_sun8i_vi_layer(plane); ++ struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + + return sun50i_afbc_format_mod_supported(layer->mixer, format, modifier); -+} -+ + } + static const struct drm_plane_helper_funcs sun8i_vi_layer_helper_funcs = { - .atomic_check = sun8i_vi_layer_atomic_check, - .atomic_disable = sun8i_vi_layer_atomic_disable, @@ -444,6 +484,7 @@ static const struct drm_plane_funcs sun8i_vi_layer_funcs = { .disable_plane = drm_atomic_helper_disable_plane, .reset = drm_atomic_helper_plane_reset, @@ -536,13 +538,13 @@ index 329e8bf8cd20..bda91c3e2bb7 100644 + DRM_FORMAT_MOD_INVALID +}; + - struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, - struct sun8i_mixer *mixer, - int index) + struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm, + struct sun8i_mixer *mixer, + int index) @@ -542,6 +600,7 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm, u32 supported_encodings, supported_ranges; unsigned int plane_cnt, format_count; - struct sun8i_vi_layer *layer; + struct sun8i_layer *layer; + const uint64_t *modifiers; const u32 *formats; int ret; diff --git a/projects/Allwinner/patches/linux/0071-HACK-SW-CEC-implementation-for-H3.patch b/projects/Allwinner/patches/linux/0071-HACK-SW-CEC-implementation-for-H3.patch index d82e27f5a4..6537d63da8 100644 --- a/projects/Allwinner/patches/linux/0071-HACK-SW-CEC-implementation-for-H3.patch +++ b/projects/Allwinner/patches/linux/0071-HACK-SW-CEC-implementation-for-H3.patch @@ -216,18 +216,16 @@ index 581233d6eaf2..a5771b5d9b67 100644 regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(regs)) -@@ -727,8 +810,19 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev) +@@ -727,8 +810,17 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev) return 0; } -+static int sun8i_hdmi_phy_remove(struct platform_device *pdev) ++static void sun8i_hdmi_phy_remove(struct platform_device *pdev) +{ + struct sun8i_hdmi_phy *phy = platform_get_drvdata(pdev); + + cec_notifier_cec_adap_unregister(phy->cec_notifier, phy->cec_adapter); + cec_unregister_adapter(phy->cec_adapter); -+ -+ return 0; +} + struct platform_driver sun8i_hdmi_phy_driver = { diff --git a/projects/Allwinner/patches/linux/0073-media-verisilicon-g2-fix-chroma-offset-calculation.patch b/projects/Allwinner/patches/linux/0073-media-verisilicon-g2-fix-chroma-offset-calculation.patch new file mode 100644 index 0000000000..925f607f9d --- /dev/null +++ b/projects/Allwinner/patches/linux/0073-media-verisilicon-g2-fix-chroma-offset-calculation.patch @@ -0,0 +1,27 @@ +From 4a6926ea19c64b49e2bdeb30ceef98fc812cc52d Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Thu, 19 Sep 2024 20:17:30 +0200 +Subject: [PATCH] media: verisilicon: g2: Fix chroma offset calculation + +Since bit depth may not be divisible by 8 (like 10 or 12), division must +be rounded up. + +Fixes: 3eeaee737dce ("media: verisilicon: g2: Use common helpers to compute chroma and mv offsets") +Signed-off-by: Jernej Skrabec +--- + drivers/media/platform/verisilicon/hantro_g2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/platform/verisilicon/hantro_g2.c b/drivers/media/platform/verisilicon/hantro_g2.c +index b880a6849d5852..24ae7b69f6a0ae 100644 +--- a/drivers/media/platform/verisilicon/hantro_g2.c ++++ b/drivers/media/platform/verisilicon/hantro_g2.c +@@ -47,7 +47,7 @@ irqreturn_t hantro_g2_irq(int irq, void *dev_id) + + size_t hantro_g2_chroma_offset(struct hantro_ctx *ctx) + { +- return ctx->dst_fmt.width * ctx->dst_fmt.height * ctx->bit_depth / 8; ++ return ctx->dst_fmt.width * ctx->dst_fmt.height * DIV_ROUND_UP(ctx->bit_depth, 8); + } + + size_t hantro_g2_motion_vectors_offset(struct hantro_ctx *ctx)