[PATCH] drm/i915/display: Avoid full proxy f_ops for DRRS debug attributes

2022-12-26 Thread Deepak R Varma
Using DEFINE_SIMPLE_ATTRIBUTE macro with the debugfs_create_file()
function adds the overhead of introducing a proxy file operation
functions to wrap the original read/write inside file removal protection
functions. This adds significant overhead in terms of introducing and
managing the proxy factory file operations structure and function
wrapping at runtime.
As a replacement, a combination of DEFINE_DEBUGFS_ATTRIBUTE macro paired
with debugfs_create_file_unsafe() is suggested to be used instead.  The
DEFINE_DEBUGFS_ATTRIBUTE utilises debugfs_file_get() and
debugfs_file_put() wrappers to protect the original read and write
function calls for the debug attributes. There is no need for any
runtime proxy file operations to be managed by the debugfs core.

This Change is reported by the debugfs_simple_attr.cocci Coccinelle
semantic patch.

Signed-off-by: Deepak R Varma 
---
 drivers/gpu/drm/i915/display/intel_drrs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c 
b/drivers/gpu/drm/i915/display/intel_drrs.c
index 5b9e3814..84ba7379d6f8 100644
--- a/drivers/gpu/drm/i915/display/intel_drrs.c
+++ b/drivers/gpu/drm/i915/display/intel_drrs.c
@@ -374,16 +374,16 @@ static int intel_drrs_debugfs_ctl_set(void *data, u64 val)
return ret;
 }

-DEFINE_SIMPLE_ATTRIBUTE(intel_drrs_debugfs_ctl_fops,
-   NULL, intel_drrs_debugfs_ctl_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(intel_drrs_debugfs_ctl_fops,
+NULL, intel_drrs_debugfs_ctl_set, "%llu\n");

 void intel_drrs_crtc_debugfs_add(struct intel_crtc *crtc)
 {
debugfs_create_file("i915_drrs_status", 0444, crtc->base.debugfs_entry,
crtc, &intel_drrs_debugfs_status_fops);

-   debugfs_create_file("i915_drrs_ctl", 0644, crtc->base.debugfs_entry,
-   crtc, &intel_drrs_debugfs_ctl_fops);
+   debugfs_create_file_unsafe("i915_drrs_ctl", 0644, 
crtc->base.debugfs_entry,
+   crtc, &intel_drrs_debugfs_ctl_fops);
 }

 static int intel_drrs_debugfs_type_show(struct seq_file *m, void *unused)
--
2.34.1





Re: [PATCH v28 05/11] soc: mediatek: refine code to use mtk_mmsys_update_bits API

2022-12-26 Thread 林欣螢


[PATCH v7 0/2] Change mmsys compatible for mt8195 mediatek-drm

2022-12-26 Thread Jason-JH . Lin
For previous MediaTek SoCs, such as MT8173, there are 2 display HW
pipelines binding to 1 mmsys with the same power domain, the same
clock driver and the same mediatek-drm driver.

For MT8195, VDOSYS0 and VDOSYS1 are 2 display HW pipelines binding to
2 different power domains, different clock drivers and different
mediatek-drm drivers.

Moreover, Hardware pipeline of VDOSYS0 has these components: COLOR,
CCORR, AAL, GAMMA, DITHER. They are related to the PQ (Picture Quality)
and they makes VDOSYS0 supports PQ function while they are not
including in VDOSYS1.

Hardware pipeline of VDOSYS1 has the component ETHDR (HDR related
component). It makes VDOSYS1 supports the HDR function while it's not
including in VDOSYS0.

To summarize0:
Only VDOSYS0 can support PQ adjustment.
Only VDOSYS1 can support HDR adjustment.

Therefore, we need to separate these two different mmsys hardwares to
2 different compatibles for MT8195.
---
Change in v7:
1. Rebase on v6.2-rc1.
2. Squash patch 1 and 2 in v6.

Change in v6:
1. Add old driver data for mediatek-drm driver with deprecated compatible name.

Change in v5:
1. Add oneOf item to deprecate mediatek,mt8195-mmsys.

Change in v4:
1. Deprecate original mediatek,mt8195-mmsys at the first item.

Change in v3:
1. Keep the original compatible "mediatek,mt8195-mmsys" and add
   "mediatek,mt8195-vdosys0" into the same item to make the tree
   fallback compatible.

Change in v2:
1. Remove Ack tag in the first patch
2. Change the compatible name changing patch to one revert patch and
   one add vdosys0 support patch.
---

Jason-JH.Lin (2):
  drm/mediatek: change mmsys compatible for mt8195 mediatek-drm
  soc: mediatek: remove DDP_DOMPONENT_DITHER from enum

 drivers/gpu/drm/mediatek/mtk_disp_rdma.c |   6 ++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c   | 128 +++
 drivers/gpu/drm/mediatek/mtk_drm_drv.h   |   6 --
 include/linux/soc/mediatek/mtk-mmsys.h   |   3 +-
 4 files changed, 21 insertions(+), 122 deletions(-)

-- 
2.18.0



[PATCH v7 2/2] soc: mediatek: remove DDP_DOMPONENT_DITHER from enum

2022-12-26 Thread Jason-JH . Lin
After mmsys and drm change DITHER enum to DDP_COMPONENT_DITHER0,
mmsys header can remove the useless DDP_COMPONENT_DITHER enum.

Signed-off-by: Jason-JH.Lin 
Reviewed-by: AngeloGioacchino Del Regno 

Reviewed-by: Rex-BC Chen 
Acked-by: Matthias Brugger 
---
 include/linux/soc/mediatek/mtk-mmsys.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/soc/mediatek/mtk-mmsys.h 
b/include/linux/soc/mediatek/mtk-mmsys.h
index b85f66db33e1..d37fa6a426a2 100644
--- a/include/linux/soc/mediatek/mtk-mmsys.h
+++ b/include/linux/soc/mediatek/mtk-mmsys.h
@@ -23,8 +23,7 @@ enum mtk_ddp_comp_id {
DDP_COMPONENT_CCORR,
DDP_COMPONENT_COLOR0,
DDP_COMPONENT_COLOR1,
-   DDP_COMPONENT_DITHER,
-   DDP_COMPONENT_DITHER0 = DDP_COMPONENT_DITHER,
+   DDP_COMPONENT_DITHER0,
DDP_COMPONENT_DITHER1,
DDP_COMPONENT_DP_INTF0,
DDP_COMPONENT_DP_INTF1,
-- 
2.18.0



[PATCH v7 1/2] drm/mediatek: change mmsys compatible for mt8195 mediatek-drm

2022-12-26 Thread Jason-JH . Lin
Because compatible of mt8195 is changing from "mediatek,mt8195-mmsys"
to "mediatek,mt8195-vdosys0".

We have to revert the multiple compatible finding function and
add driver data of mt8195 vdosys0 to mediatek-drm and the sub driver.

Signed-off-by: Jason-JH.Lin 
---
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c |   6 ++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c   | 128 +++
 drivers/gpu/drm/mediatek/mtk_drm_drv.h   |   6 --
 3 files changed, 20 insertions(+), 120 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c 
b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index 0ec2e4049e07..66cdd0bc1311 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -370,6 +370,10 @@ static const struct mtk_disp_rdma_data 
mt8183_rdma_driver_data = {
.fifo_size = 5 * SZ_1K,
 };
 
+static const struct mtk_disp_rdma_data mt8192_rdma_driver_data = {
+   .fifo_size = 5 * SZ_1K,
+};
+
 static const struct mtk_disp_rdma_data mt8195_rdma_driver_data = {
.fifo_size = 1920,
 };
@@ -381,6 +385,8 @@ static const struct of_device_id 
mtk_disp_rdma_driver_dt_match[] = {
  .data = &mt8173_rdma_driver_data},
{ .compatible = "mediatek,mt8183-disp-rdma",
  .data = &mt8183_rdma_driver_data},
+   { .compatible = "mediatek,mt8192-disp-rdma",
+ .data = &mt8192_rdma_driver_data},
{ .compatible = "mediatek,mt8195-disp-rdma",
  .data = &mt8195_rdma_driver_data},
{},
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index cd5b18ef7951..b12e5b977c50 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -4,8 +4,6 @@
  * Author: YT SHEN 
  */
 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -218,13 +216,6 @@ static const struct mtk_mmsys_driver_data 
mt2701_mmsys_driver_data = {
.shadow_register = true,
 };
 
-static const struct mtk_mmsys_match_data mt2701_mmsys_match_data = {
-   .num_drv_data = 1,
-   .drv_data = {
-   &mt2701_mmsys_driver_data,
-   },
-};
-
 static const struct mtk_mmsys_driver_data mt7623_mmsys_driver_data = {
.main_path = mt7623_mtk_ddp_main,
.main_len = ARRAY_SIZE(mt7623_mtk_ddp_main),
@@ -233,13 +224,6 @@ static const struct mtk_mmsys_driver_data 
mt7623_mmsys_driver_data = {
.shadow_register = true,
 };
 
-static const struct mtk_mmsys_match_data mt7623_mmsys_match_data = {
-   .num_drv_data = 1,
-   .drv_data = {
-   &mt7623_mmsys_driver_data,
-   },
-};
-
 static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = {
.main_path = mt2712_mtk_ddp_main,
.main_len = ARRAY_SIZE(mt2712_mtk_ddp_main),
@@ -249,25 +233,11 @@ static const struct mtk_mmsys_driver_data 
mt2712_mmsys_driver_data = {
.third_len = ARRAY_SIZE(mt2712_mtk_ddp_third),
 };
 
-static const struct mtk_mmsys_match_data mt2712_mmsys_match_data = {
-   .num_drv_data = 1,
-   .drv_data = {
-   &mt2712_mmsys_driver_data,
-   },
-};
-
 static const struct mtk_mmsys_driver_data mt8167_mmsys_driver_data = {
.main_path = mt8167_mtk_ddp_main,
.main_len = ARRAY_SIZE(mt8167_mtk_ddp_main),
 };
 
-static const struct mtk_mmsys_match_data mt8167_mmsys_match_data = {
-   .num_drv_data = 1,
-   .drv_data = {
-   &mt8167_mmsys_driver_data,
-   },
-};
-
 static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = {
.main_path = mt8173_mtk_ddp_main,
.main_len = ARRAY_SIZE(mt8173_mtk_ddp_main),
@@ -275,13 +245,6 @@ static const struct mtk_mmsys_driver_data 
mt8173_mmsys_driver_data = {
.ext_len = ARRAY_SIZE(mt8173_mtk_ddp_ext),
 };
 
-static const struct mtk_mmsys_match_data mt8173_mmsys_match_data = {
-   .num_drv_data = 1,
-   .drv_data = {
-   &mt8173_mmsys_driver_data,
-   },
-};
-
 static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = {
.main_path = mt8183_mtk_ddp_main,
.main_len = ARRAY_SIZE(mt8183_mtk_ddp_main),
@@ -289,13 +252,6 @@ static const struct mtk_mmsys_driver_data 
mt8183_mmsys_driver_data = {
.ext_len = ARRAY_SIZE(mt8183_mtk_ddp_ext),
 };
 
-static const struct mtk_mmsys_match_data mt8183_mmsys_match_data = {
-   .num_drv_data = 1,
-   .drv_data = {
-   &mt8183_mmsys_driver_data,
-   },
-};
-
 static const struct mtk_mmsys_driver_data mt8186_mmsys_driver_data = {
.main_path = mt8186_mtk_ddp_main,
.main_len = ARRAY_SIZE(mt8186_mtk_ddp_main),
@@ -303,13 +259,6 @@ static const struct mtk_mmsys_driver_data 
mt8186_mmsys_driver_data = {
.ext_len = ARRAY_SIZE(mt8186_mtk_ddp_ext),
 };
 
-static const struct mtk_mmsys_match_data mt8186_mmsys_match_data = {
-   .num_drv_data = 1,
-   .drv_data = {
-   &mt8186_mmsys_driver_data,
-   },
-};
-
 static const struct mtk_mmsys_driver_data mt

Re: [PATCH v2 2/4] dt-bindings: display: Add Himax HX8394 panel controller

2022-12-26 Thread Krzysztof Kozlowski
On 26/12/2022 14:49, Javier Martinez Canillas wrote:
> Add device tree bindings for panels based on the Himax HX8394 controller,
> such as the HannStar HSD060BHW4 720x1440 TFT LCD panel that is connected
> through a MIPI-DSI video interface.
> 
> Signed-off-by: Javier Martinez Canillas 
> Reviewed-by: Krzysztof Kozlowski 
> ---
> 
> Changes in v2:
> - Drop redundant "bindings" in subject (Krzysztof Kozlowski).
> - Drop "device tree bindings" in title (Krzysztof Kozlowski).
> - Put port next to other "true" properties (Krzysztof Kozlowski).
> - Add Krzysztof Kozlowski's Reviewed-by tag.
> 
>  .../bindings/display/panel/himax,hx8394.yaml  | 65 +++
>  1 file changed, 65 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml 
> b/Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
> new file mode 100644
> index ..bead3f0b05c5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
> @@ -0,0 +1,65 @@
> +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/panel/himax,hx8394.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Himax HX8394 MIPI-DSI LCD panel controller
> +
> +maintainers:
> +  - Javier Martinez Canillas 
> +
> +description:
> +  Device tree bindings for panels based on the Himax HX8394 controller,
> +  such as the HannStar HSD060BHW4 720x1440 TFT LCD panel connected with
> +  a MIPI-DSI video interface.
> +
> +allOf:
> +  - $ref: panel-common.yaml#
> +
> +properties:
> +  compatible:
> +enum:
> +  # HannStar HSD060BHW4 5.99" 720x1440 TFT LCD panel
> +  - hannstar,hsd060bhw4
> +
> +  vcc-supply:
> +description: Panel power supply
> +
> +  iovcc-supply:
> +description: I/O voltage supply
> +
> +  port: true
> +
> +  reset-gpios: true
> +
> +  backlight: true
> +
> +required:
> +  - compatible
> +  - vcc-supply
> +  - iovcc-supply
> +  - port

Does not look like you tested the bindings. Please run `make
dt_binding_check` (see
Documentation/devicetree/bindings/writing-schema.rst for instructions).

Best regards,
Krzysztof



Re: [PATCH 1/2] habanalabs/uapi: move uapi file to drm

2022-12-26 Thread Greg KH
On Mon, Dec 26, 2022 at 11:32:26PM +0200, Oded Gabbay wrote:
> Move the habanalabs.h uapi file from include/uapi/misc to
> include/uapi/drm, and rename it to habanalabs_accel.h.
> 
> This is required before moving the actual driver to the accel
> subsystem.

What requires this?  Isn't this going to break userspace code?

thanks,

greg k-h


[PATCH] drm/i915/display: Check source height is > 0

2022-12-26 Thread Drew Davenport
The error message suggests that the height of the src rect must be at
least 1. Reject source with height of 0.

Signed-off-by: Drew Davenport 

---
I was investigating some divide-by-zero crash reports on ChromeOS which
pointed to the intel_adjusted_rate function. Further prodding showed
that I could reproduce this in a simple test program if I made src_h
some value less than 1 but greater than 0.

This seemed to be a sensible place to check that the source height is at
least 1. I tried to repro this issue on an amd device I had on hand, and
the configuration was rejected.

Would it make sense to add a check that source dimensions are at least 1
somewhere in core, like in drm_atomic_plane_check? Or is that a valid
use case on some devices, and thus any such check should be done on a
per-driver basis?

Thanks.

 drivers/gpu/drm/i915/display/skl_universal_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c 
b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 4b79c2d2d6177..9b172a1e90deb 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -1627,7 +1627,7 @@ static int skl_check_main_surface(struct 
intel_plane_state *plane_state)
u32 offset;
int ret;
 
-   if (w > max_width || w < min_width || h > max_height) {
+   if (w > max_width || w < min_width || h > max_height || h < 1) {
drm_dbg_kms(&dev_priv->drm,
"requested Y/RGB source size %dx%d outside limits 
(min: %dx1 max: %dx%d)\n",
w, h, min_width, max_width, max_height);
-- 
2.39.0.314.g84b9a713c41-goog



Re: [PATCH v13,3/3] drm: mediatek: Add mt8186 dpi compatibles and platform data

2022-12-26 Thread Chun-Kuang Hu
Hi, Xinlei:

 於 2022年10月24日 週一 上午10:05寫道:
>
> From: Xinlei Lee 
>
> Add the compatible because use edge_cfg_in_mmsys in mt8186.

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Signed-off-by: Xinlei Lee 
> Reviewed-by: CK Hu 
> Reviewed-by: AngeloGioacchino Del Regno 
> 
> Reviewed-by: Nícolas F. R. A. Prado 
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 21 +
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c |  2 ++
>  2 files changed, 23 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index ad87ecddf58d..325032fd5343 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -941,6 +941,24 @@ static const struct mtk_dpi_conf mt8183_conf = {
> .csc_enable_bit = CSC_ENABLE,
>  };
>
> +static const struct mtk_dpi_conf mt8186_conf = {
> +   .cal_factor = mt8183_calculate_factor,
> +   .reg_h_fre_con = 0xe0,
> +   .max_clock_khz = 15,
> +   .output_fmts = mt8183_output_fmts,
> +   .num_output_fmts = ARRAY_SIZE(mt8183_output_fmts),
> +   .edge_cfg_in_mmsys = true,
> +   .pixels_per_iter = 1,
> +   .is_ck_de_pol = true,
> +   .swap_input_support = true,
> +   .support_direct_pin = true,
> +   .dimension_mask = HPW_MASK,
> +   .hvsize_mask = HSIZE_MASK,
> +   .channel_swap_shift = CH_SWAP,
> +   .yuv422_en_bit = YUV422_EN,
> +   .csc_enable_bit = CSC_ENABLE,
> +};
> +
>  static const struct mtk_dpi_conf mt8192_conf = {
> .cal_factor = mt8183_calculate_factor,
> .reg_h_fre_con = 0xe0,
> @@ -1091,6 +1109,9 @@ static const struct of_device_id mtk_dpi_of_ids[] = {
> { .compatible = "mediatek,mt8183-dpi",
>   .data = &mt8183_conf,
> },
> +   { .compatible = "mediatek,mt8186-dpi",
> + .data = &mt8186_conf,
> +   },
> { .compatible = "mediatek,mt8192-dpi",
>   .data = &mt8192_conf,
> },
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 546b79412815..3d32fbc66ac1 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -646,6 +646,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
>   .data = (void *)MTK_DPI },
> { .compatible = "mediatek,mt8183-dpi",
>   .data = (void *)MTK_DPI },
> +   { .compatible = "mediatek,mt8186-dpi",
> + .data = (void *)MTK_DPI },
> { .compatible = "mediatek,mt8192-dpi",
>   .data = (void *)MTK_DPI },
> { .compatible = "mediatek,mt8195-dp-intf",
> --
> 2.18.0
>


Re: [PATCH v13,2/3] drm: mediatek: Set dpi format in mmsys

2022-12-26 Thread Chun-Kuang Hu
Hi, Xinlei:

 於 2022年10月24日 週一 上午10:05寫道:
>
> From: Xinlei Lee 
>
> Dpi output needs to adjust the output format to dual edge for MT8186.

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Co-developed-by: Jitao Shi 
> Signed-off-by: Jitao Shi 
> Signed-off-by: Xinlei Lee 
> Reviewed-by: CK Hu 
> Reviewed-by: AngeloGioacchino Del Regno 
> 
> Reviewed-by: Nícolas F. R. A. Prado 
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 630a4e301ef6..ad87ecddf58d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -15,6 +15,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #include 
> @@ -30,6 +31,7 @@
>  #include "mtk_disp_drv.h"
>  #include "mtk_dpi_regs.h"
>  #include "mtk_drm_ddp_comp.h"
> +#include "mtk_drm_drv.h"
>
>  enum mtk_dpi_out_bit_num {
> MTK_DPI_OUT_BIT_NUM_8BITS,
> @@ -67,6 +69,7 @@ struct mtk_dpi {
> struct drm_connector *connector;
> void __iomem *regs;
> struct device *dev;
> +   struct device *mmsys_dev;
> struct clk *engine_clk;
> struct clk *pixel_clk;
> struct clk *tvd_clk;
> @@ -135,6 +138,7 @@ struct mtk_dpi_yc_limit {
>   * @yuv422_en_bit: Enable bit of yuv422.
>   * @csc_enable_bit: Enable bit of CSC.
>   * @pixels_per_iter: Quantity of transferred pixels per iteration.
> + * @edge_cfg_in_mmsys: If the edge configuration for DPI's output needs to 
> be set in MMSYS.
>   */
>  struct mtk_dpi_conf {
> unsigned int (*cal_factor)(int clock);
> @@ -153,6 +157,7 @@ struct mtk_dpi_conf {
> u32 yuv422_en_bit;
> u32 csc_enable_bit;
> u32 pixels_per_iter;
> +   bool edge_cfg_in_mmsys;
>  };
>
>  static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
> @@ -449,8 +454,12 @@ static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
> mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING,
>  dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_LE ?
>  EDGE_SEL : 0, EDGE_SEL);
> +   if (dpi->conf->edge_cfg_in_mmsys)
> +   mtk_mmsys_ddp_dpi_fmt_config(dpi->mmsys_dev, 
> MTK_DPI_RGB888_DDR_CON);
> } else {
> mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE, 0);
> +   if (dpi->conf->edge_cfg_in_mmsys)
> +   mtk_mmsys_ddp_dpi_fmt_config(dpi->mmsys_dev, 
> MTK_DPI_RGB888_SDR_CON);
> }
>  }
>
> @@ -778,8 +787,10 @@ static int mtk_dpi_bind(struct device *dev, struct 
> device *master, void *data)
>  {
> struct mtk_dpi *dpi = dev_get_drvdata(dev);
> struct drm_device *drm_dev = data;
> +   struct mtk_drm_private *priv = drm_dev->dev_private;
> int ret;
>
> +   dpi->mmsys_dev = priv->mmsys_dev;
> ret = drm_simple_encoder_init(drm_dev, &dpi->encoder,
>   DRM_MODE_ENCODER_TMDS);
> if (ret) {
> --
> 2.18.0
>


Re: [PATCH v2 2/4] dt-bindings: display: Add Himax HX8394 panel controller

2022-12-26 Thread Rob Herring


On Mon, 26 Dec 2022 14:49:06 +0100, Javier Martinez Canillas wrote:
> Add device tree bindings for panels based on the Himax HX8394 controller,
> such as the HannStar HSD060BHW4 720x1440 TFT LCD panel that is connected
> through a MIPI-DSI video interface.
> 
> Signed-off-by: Javier Martinez Canillas 
> Reviewed-by: Krzysztof Kozlowski 
> ---
> 
> Changes in v2:
> - Drop redundant "bindings" in subject (Krzysztof Kozlowski).
> - Drop "device tree bindings" in title (Krzysztof Kozlowski).
> - Put port next to other "true" properties (Krzysztof Kozlowski).
> - Add Krzysztof Kozlowski's Reviewed-by tag.
> 
>  .../bindings/display/panel/himax,hx8394.yaml  | 65 +++
>  1 file changed, 65 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/panel/himax,hx8394.example.dtb:
 panel@0: 'port' is a required property
From schema: 
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/panel/himax,hx8394.example.dtb:
 panel@0: 'reg' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: 
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml

doc reference errors (make refcheckdocs):


See 
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20221226134909.2822179-3-javi...@redhat.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.



[PATCH 1/2] habanalabs/uapi: move uapi file to drm

2022-12-26 Thread Oded Gabbay
Move the habanalabs.h uapi file from include/uapi/misc to
include/uapi/drm, and rename it to habanalabs_accel.h.

This is required before moving the actual driver to the accel
subsystem.

Update MAINTAINERS file accordingly.

Signed-off-by: Oded Gabbay 
---
 MAINTAINERS| 2 +-
 drivers/misc/habanalabs/Kconfig| 2 +-
 drivers/misc/habanalabs/common/command_buffer.c| 2 +-
 drivers/misc/habanalabs/common/command_submission.c| 2 +-
 drivers/misc/habanalabs/common/device.c| 2 +-
 drivers/misc/habanalabs/common/habanalabs.h| 2 +-
 drivers/misc/habanalabs/common/habanalabs_ioctl.c  | 2 +-
 drivers/misc/habanalabs/common/memory.c| 2 +-
 drivers/misc/habanalabs/common/state_dump.c| 2 +-
 drivers/misc/habanalabs/gaudi/gaudiP.h | 2 +-
 drivers/misc/habanalabs/gaudi/gaudi_coresight.c| 3 ++-
 drivers/misc/habanalabs/gaudi2/gaudi2P.h   | 2 +-
 drivers/misc/habanalabs/gaudi2/gaudi2_coresight.c  | 2 +-
 drivers/misc/habanalabs/goya/goyaP.h   | 2 +-
 drivers/misc/habanalabs/goya/goya_coresight.c  | 2 +-
 include/uapi/{misc/habanalabs.h => drm/habanalabs_accel.h} | 0
 16 files changed, 16 insertions(+), 15 deletions(-)
 rename include/uapi/{misc/habanalabs.h => drm/habanalabs_accel.h} (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index f61eb221415b..ce47d05693d9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9049,7 +9049,7 @@ F:
Documentation/ABI/testing/debugfs-driver-habanalabs
 F: Documentation/ABI/testing/sysfs-driver-habanalabs
 F: drivers/misc/habanalabs/
 F: include/trace/events/habanalabs.h
-F: include/uapi/misc/habanalabs.h
+F: include/uapi/drm/habanalabs_accel.h
 
 HACKRF MEDIA DRIVER
 M: Antti Palosaari 
diff --git a/drivers/misc/habanalabs/Kconfig b/drivers/misc/habanalabs/Kconfig
index bd01d0d940c0..585235531b9b 100644
--- a/drivers/misc/habanalabs/Kconfig
+++ b/drivers/misc/habanalabs/Kconfig
@@ -19,7 +19,7 @@ config HABANA_AI
  the user to submit workloads to the devices.
 
  The user-space interface is described in
- include/uapi/misc/habanalabs.h
+ include/uapi/drm/habanalabs_accel.h
 
  If unsure, say N.
 
diff --git a/drivers/misc/habanalabs/common/command_buffer.c 
b/drivers/misc/habanalabs/common/command_buffer.c
index 24100501f8ca..6263d01cb9c1 100644
--- a/drivers/misc/habanalabs/common/command_buffer.c
+++ b/drivers/misc/habanalabs/common/command_buffer.c
@@ -5,7 +5,7 @@
  * All Rights Reserved.
  */
 
-#include 
+#include 
 #include "habanalabs.h"
 
 #include 
diff --git a/drivers/misc/habanalabs/common/command_submission.c 
b/drivers/misc/habanalabs/common/command_submission.c
index 1543ef993f8e..f6ee10334235 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -5,7 +5,7 @@
  * All Rights Reserved.
  */
 
-#include 
+#include 
 #include "habanalabs.h"
 
 #include 
diff --git a/drivers/misc/habanalabs/common/device.c 
b/drivers/misc/habanalabs/common/device.c
index 71f958a2e91b..6620580e9ba8 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -7,7 +7,7 @@
 
 #define pr_fmt(fmt)"habanalabs: " fmt
 
-#include 
+#include 
 #include "habanalabs.h"
 
 #include 
diff --git a/drivers/misc/habanalabs/common/habanalabs.h 
b/drivers/misc/habanalabs/common/habanalabs.h
index c609b2e44ad3..7b6f10033ee9 100644
--- a/drivers/misc/habanalabs/common/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -11,7 +11,7 @@
 #include "../include/common/cpucp_if.h"
 #include "../include/common/qman_if.h"
 #include "../include/hw_ip/mmu/mmu_general.h"
-#include 
+#include 
 
 #include 
 #include 
diff --git a/drivers/misc/habanalabs/common/habanalabs_ioctl.c 
b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
index 4d642987ad02..079483421e12 100644
--- a/drivers/misc/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
@@ -7,7 +7,7 @@
 
 #define pr_fmt(fmt)"habanalabs: " fmt
 
-#include 
+#include 
 #include "habanalabs.h"
 
 #include 
diff --git a/drivers/misc/habanalabs/common/memory.c 
b/drivers/misc/habanalabs/common/memory.c
index a2d24c9a3d1e..1c38fab39337 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -5,7 +5,7 @@
  * All Rights Reserved.
  */
 
-#include 
+#include 
 #include "habanalabs.h"
 #include "../include/hw_ip/mmu/mmu_general.h"
 
diff --git a/drivers/misc/habanalabs/common/state_dump.c 
b/drivers/misc/habanalabs/common/state_dump.c
index 74726907c95e..3a9931f24259 100644
--- a/drivers/misc/habanalabs/common/state_dump.c
+++ b/drivers/misc/habanalabs/common/state_dump.c
@@ -6,7 +6,7 @@
  */
 
 #include 
-#include 
+#include 
 #in

[Bug 216780] problem of Mesa drawing boxes after resume from suspend with Geforce4 420 Go

2022-12-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216780

--- Comment #7 from Elmar Stellnberger (estel...@elstel.org) ---
Did not re-test the acpi_sleep modes from above with kernel 6.1.0-desktop586,
where the screen content was preserved directly after resume. kernel 6.1.1 no
more exposes this feature.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

Re: [PATCH v2 1/4] drm: panel: Add Himax HX8394 panel controller driver

2022-12-26 Thread Javier Martinez Canillas
Hello Sam,

On 12/26/22 16:05, Sam Ravnborg wrote:
> Hi Javier.
> 
> On Mon, Dec 26, 2022 at 02:49:05PM +0100, Javier Martinez Canillas wrote:
>> From: Kamil Trzciński 
>>
>> The driver is for panels based on the Himax HX8394 controller, such as the
>> HannStar HSD060BHW4 720x1440 TFT LCD panel that uses a MIPI-DSI interface.
>>
>> Signed-off-by: Kamil Trzciński 
>> Co-developed-by: Ondrej Jirman 
>> Signed-off-by: Ondrej Jirman 
>> Co-developed-by: Javier Martinez Canillas 
>> Signed-off-by: Javier Martinez Canillas 
> Reviewed-by: Sam Ravnborg 
>

Thanks!
 
> Strictly speaking the binding should be applied before the driver.
>

Indeed. I'll change the order of the patches in the next iteration.

Funny that I added to Documentation/devicetree/bindings/submitting-patches.rst
that info in commit ef0b97e3daea ("Documentation: dt-bindings: Explain order
in patch series"), but didn't follow my own advice :)

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat



Re: [12/13] drm/scheduler: rework entity flush, kill and fini

2022-12-26 Thread Jonathan Marek
This patch broke drm/msm in 6.2-rc1 for me. drm_sched_entity_destroy() 
never returns when exiting a process from gdb if it has a drm/msm fd 
opened (if the fd is closed normally then it doesn't have this problem).


[PATCH 9/9] drm/qxl: use new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_files() function, which center the debugfs files
management on the drm_device instead of drm_minor. Moreover, remove the
debugfs_init hook and add the debugfs files directly on qxl_pci_probe(),
before drm_dev_register().

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/qxl/qxl_debugfs.c | 18 --
 drivers/gpu/drm/qxl/qxl_drv.c |  5 ++---
 drivers/gpu/drm/qxl/qxl_drv.h |  2 +-
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c 
b/drivers/gpu/drm/qxl/qxl_debugfs.c
index bdfce1a8f006..fd18a7b193b3 100644
--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
+++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
@@ -38,8 +38,8 @@
 static int
 qxl_debugfs_irq_received(struct seq_file *m, void *data)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct qxl_device *qdev = to_qxl(node->minor->dev);
+   struct drm_debugfs_entry *entry = m->private;
+   struct qxl_device *qdev = to_qxl(entry->dev);
 
seq_printf(m, "%d\n", atomic_read(&qdev->irq_received));
seq_printf(m, "%d\n", atomic_read(&qdev->irq_received_display));
@@ -52,8 +52,8 @@ qxl_debugfs_irq_received(struct seq_file *m, void *data)
 static int
 qxl_debugfs_buffers_info(struct seq_file *m, void *data)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct qxl_device *qdev = to_qxl(node->minor->dev);
+   struct drm_debugfs_entry *entry = m->private;
+   struct qxl_device *qdev = to_qxl(entry->dev);
struct qxl_bo *bo;
 
list_for_each_entry(bo, &qdev->gem.objects, list) {
@@ -76,21 +76,19 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data)
return 0;
 }
 
-static struct drm_info_list qxl_debugfs_list[] = {
+static struct drm_debugfs_info qxl_debugfs_list[] = {
{ "irq_received", qxl_debugfs_irq_received, 0, NULL },
{ "qxl_buffers", qxl_debugfs_buffers_info, 0, NULL },
 };
 #define QXL_DEBUGFS_ENTRIES ARRAY_SIZE(qxl_debugfs_list)
 #endif
 
-void
-qxl_debugfs_init(struct drm_minor *minor)
+void qxl_debugfs_init(struct drm_device *drm)
 {
 #if defined(CONFIG_DEBUG_FS)
-   struct qxl_device *dev = to_qxl(minor->dev);
+   struct qxl_device *dev = to_qxl(drm);
 
-   drm_debugfs_create_files(qxl_debugfs_list, QXL_DEBUGFS_ENTRIES,
-minor->debugfs_root, minor);
+   drm_debugfs_add_files(drm, qxl_debugfs_list, QXL_DEBUGFS_ENTRIES);
 
qxl_ttm_debugfs_init(dev);
 #endif
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index a3b83f89e061..3ae2db78f671 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -116,6 +116,8 @@ qxl_pci_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
if (ret)
goto unload;
 
+   qxl_debugfs_init(&qdev->ddev);
+
drm_kms_helper_poll_init(&qdev->ddev);
 
/* Complete initialization. */
@@ -287,9 +289,6 @@ static struct drm_driver qxl_driver = {
 
.dumb_create = qxl_mode_dumb_create,
.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
-#if defined(CONFIG_DEBUG_FS)
-   .debugfs_init = qxl_debugfs_init,
-#endif
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_import_sg_table = qxl_gem_prime_import_sg_table,
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 0868d5d2a839..cb84a3bebcec 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -397,7 +397,7 @@ int qxl_garbage_collect(struct qxl_device *qdev);
 
 /* debugfs */
 
-void qxl_debugfs_init(struct drm_minor *minor);
+void qxl_debugfs_init(struct drm_device *drm);
 void qxl_ttm_debugfs_init(struct qxl_device *qdev);
 
 /* qxl_prime.c */
-- 
2.38.1



[PATCH 8/9] drm/qxl: remove unused debugfs structure

2022-12-26 Thread Maíra Canal
The current debugfs structure was introduced at f64122c1f6ad and it was
never used by the driver. Considering the addition of more
device-centered functions to the DRM core, remove the current debugfs
structure.

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/qxl/qxl_debugfs.c | 29 -
 drivers/gpu/drm/qxl/qxl_drv.h | 20 
 2 files changed, 49 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c 
b/drivers/gpu/drm/qxl/qxl_debugfs.c
index 2d9ed3b94574..bdfce1a8f006 100644
--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
+++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
@@ -95,32 +95,3 @@ qxl_debugfs_init(struct drm_minor *minor)
qxl_ttm_debugfs_init(dev);
 #endif
 }
-
-void qxl_debugfs_add_files(struct qxl_device *qdev,
-  struct drm_info_list *files,
-  unsigned int nfiles)
-{
-   unsigned int i;
-
-   for (i = 0; i < qdev->debugfs_count; i++) {
-   if (qdev->debugfs[i].files == files) {
-   /* Already registered */
-   return;
-   }
-   }
-
-   i = qdev->debugfs_count + 1;
-   if (i > QXL_DEBUGFS_MAX_COMPONENTS) {
-   DRM_ERROR("Reached maximum number of debugfs components.\n");
-   DRM_ERROR("Report so we increase 
QXL_DEBUGFS_MAX_COMPONENTS.\n");
-   return;
-   }
-   qdev->debugfs[qdev->debugfs_count].files = files;
-   qdev->debugfs[qdev->debugfs_count].num_files = nfiles;
-   qdev->debugfs_count = i;
-#if defined(CONFIG_DEBUG_FS)
-   drm_debugfs_create_files(files, nfiles,
-qdev->ddev.primary->debugfs_root,
-qdev->ddev.primary);
-#endif
-}
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index ea993d7162e8..0868d5d2a839 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -60,8 +60,6 @@ struct iosys_map;
 #define DRIVER_MINOR 1
 #define DRIVER_PATCHLEVEL 0
 
-#define QXL_DEBUGFS_MAX_COMPONENTS 32
-
 extern int qxl_num_crtc;
 
 #define QXL_INTERRUPT_MASK (\
@@ -165,14 +163,6 @@ struct qxl_drm_image {
struct list_head chunk_list;
 };
 
-/*
- * Debugfs
- */
-struct qxl_debugfs {
-   struct drm_info_list*files;
-   unsigned int num_files;
-};
-
 struct qxl_device {
struct drm_device ddev;
 
@@ -228,10 +218,6 @@ struct qxl_device {
wait_queue_head_t io_cmd_event;
struct work_struct client_monitors_config_work;
 
-   /* debugfs */
-   struct qxl_debugfs  debugfs[QXL_DEBUGFS_MAX_COMPONENTS];
-   unsigned int debugfs_count;
-
struct mutexupdate_area_mutex;
 
struct idr  surf_id_idr;
@@ -256,8 +242,6 @@ struct qxl_device {
 
 #define to_qxl(dev) container_of(dev, struct qxl_device, ddev)
 
-int qxl_debugfs_fence_init(struct qxl_device *rdev);
-
 int qxl_device_init(struct qxl_device *qdev, struct pci_dev *pdev);
 void qxl_device_fini(struct qxl_device *qdev);
 
@@ -430,10 +414,6 @@ void qxl_gem_prime_vunmap(struct drm_gem_object *obj,
 /* qxl_irq.c */
 int qxl_irq_init(struct qxl_device *qdev);
 
-void qxl_debugfs_add_files(struct qxl_device *qdev,
-  struct drm_info_list *files,
-  unsigned int nfiles);
-
 int qxl_surface_id_alloc(struct qxl_device *qdev,
 struct qxl_bo *surf);
 void qxl_surface_id_dealloc(struct qxl_device *qdev,
-- 
2.38.1



[PATCH 7/9] drm/omap: use new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_files() function, which center the debugfs files
management on the drm_device instead of drm_minor. Moreover, remove the
debugfs_init hook and add the debugfs files directly on omapdrm_init(),
before drm_dev_register().

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/omapdrm/omap_debugfs.c | 29 +-
 drivers/gpu/drm/omapdrm/omap_drv.c |  7 ---
 drivers/gpu/drm/omapdrm/omap_drv.h |  2 +-
 3 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c 
b/drivers/gpu/drm/omapdrm/omap_debugfs.c
index bfb2ccb40bd1..491aa74eb2ec 100644
--- a/drivers/gpu/drm/omapdrm/omap_debugfs.c
+++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c
@@ -19,8 +19,8 @@
 
 static int gem_show(struct seq_file *m, void *arg)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct drm_device *dev = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *dev = entry->dev;
struct omap_drm_private *priv = dev->dev_private;
 
seq_printf(m, "All Objects:\n");
@@ -33,8 +33,8 @@ static int gem_show(struct seq_file *m, void *arg)
 
 static int mm_show(struct seq_file *m, void *arg)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct drm_device *dev = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *dev = entry->dev;
struct drm_printer p = drm_seq_file_printer(m);
 
drm_mm_print(&dev->vma_offset_manager->vm_addr_space_mm, &p);
@@ -45,8 +45,8 @@ static int mm_show(struct seq_file *m, void *arg)
 #ifdef CONFIG_DRM_FBDEV_EMULATION
 static int fb_show(struct seq_file *m, void *arg)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct drm_device *dev = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *dev = entry->dev;
struct omap_drm_private *priv = dev->dev_private;
struct drm_framebuffer *fb;
 
@@ -68,7 +68,7 @@ static int fb_show(struct seq_file *m, void *arg)
 #endif
 
 /* list of debufs files that are applicable to all devices */
-static struct drm_info_list omap_debugfs_list[] = {
+static struct drm_debugfs_info omap_debugfs_list[] = {
{"gem", gem_show, 0},
{"mm", mm_show, 0},
 #ifdef CONFIG_DRM_FBDEV_EMULATION
@@ -76,21 +76,12 @@ static struct drm_info_list omap_debugfs_list[] = {
 #endif
 };
 
-/* list of debugfs files that are specific to devices with dmm/tiler */
-static struct drm_info_list omap_dmm_debugfs_list[] = {
-   {"tiler_map", tiler_map_show, 0},
-};
-
-void omap_debugfs_init(struct drm_minor *minor)
+void omap_debugfs_init(struct drm_device *drm)
 {
-   drm_debugfs_create_files(omap_debugfs_list,
-ARRAY_SIZE(omap_debugfs_list),
-minor->debugfs_root, minor);
+   drm_debugfs_add_files(drm, omap_debugfs_list, 
ARRAY_SIZE(omap_debugfs_list));
 
if (dmm_is_available())
-   drm_debugfs_create_files(omap_dmm_debugfs_list,
-ARRAY_SIZE(omap_dmm_debugfs_list),
-minor->debugfs_root, minor);
+   drm_debugfs_add_file(drm, "tiler_map", tiler_map_show, NULL);
 }
 
 #endif
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index eaf67b9e5f12..06fc1bc0aa07 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -691,9 +691,6 @@ static const struct drm_driver omap_drm_driver = {
DRIVER_ATOMIC | DRIVER_RENDER,
.open = dev_open,
.lastclose = drm_fb_helper_lastclose,
-#ifdef CONFIG_DEBUG_FS
-   .debugfs_init = omap_debugfs_init,
-#endif
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_import = omap_gem_prime_import,
@@ -781,6 +778,10 @@ static int omapdrm_init(struct omap_drm_private *priv, 
struct device *dev)
 
omap_fbdev_init(ddev);
 
+#ifdef CONFIG_DEBUG_FS
+   omap_debugfs_init(ddev);
+#endif
+
drm_kms_helper_poll_init(ddev);
omap_modeset_enable_external_hpd(ddev);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 825960fd3ea9..1e0d9e10cd6b 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -103,7 +103,7 @@ struct omap_drm_private {
 };
 
 
-void omap_debugfs_init(struct drm_minor *minor);
+void omap_debugfs_init(struct drm_device *drm);
 
 struct omap_global_state * __must_check omap_get_global_state(struct 
drm_atomic_state *s);
 
-- 
2.38.1



[PATCH 6/9] drm/virtio: use new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_files() function, which center the debugfs files
management on the drm_device instead of drm_minor. Moreover, remove the
debugfs_init hook and add the debugfs files directly on virtio_gpu_probe(),
before drm_dev_register().

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/virtio/virtgpu_debugfs.c | 17 +++--
 drivers/gpu/drm/virtio/virtgpu_drv.c |  5 ++---
 drivers/gpu/drm/virtio/virtgpu_drv.h |  2 +-
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c 
b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index 853dd9aa397e..91c81b7429cc 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -68,8 +68,8 @@ static int virtio_gpu_features(struct seq_file *m, void *data)
 static int
 virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct virtio_gpu_device *vgdev = node->minor->dev->dev_private;
+   struct drm_debugfs_entry *entry = m->private;
+   struct virtio_gpu_device *vgdev = entry->dev->dev_private;
 
seq_printf(m, "fence %llu %lld\n",
   (u64)atomic64_read(&vgdev->fence_drv.last_fence_id),
@@ -80,8 +80,8 @@ virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data)
 static int
 virtio_gpu_debugfs_host_visible_mm(struct seq_file *m, void *data)
 {
-   struct drm_info_node *node = (struct drm_info_node *)m->private;
-   struct virtio_gpu_device *vgdev = node->minor->dev->dev_private;
+   struct drm_debugfs_entry *entry = m->private;
+   struct virtio_gpu_device *vgdev = entry->dev->dev_private;
struct drm_printer p;
 
if (!vgdev->has_host_visible) {
@@ -94,7 +94,7 @@ virtio_gpu_debugfs_host_visible_mm(struct seq_file *m, void 
*data)
return 0;
 }
 
-static struct drm_info_list virtio_gpu_debugfs_list[] = {
+static struct drm_debugfs_info virtio_gpu_debugfs_list[] = {
{ "virtio-gpu-features", virtio_gpu_features },
{ "virtio-gpu-irq-fence", virtio_gpu_debugfs_irq_info, 0, NULL },
{ "virtio-gpu-host-visible-mm", virtio_gpu_debugfs_host_visible_mm },
@@ -102,10 +102,7 @@ static struct drm_info_list virtio_gpu_debugfs_list[] = {
 
 #define VIRTIO_GPU_DEBUGFS_ENTRIES ARRAY_SIZE(virtio_gpu_debugfs_list)
 
-void
-virtio_gpu_debugfs_init(struct drm_minor *minor)
+void virtio_gpu_debugfs_init(struct drm_device *drm)
 {
-   drm_debugfs_create_files(virtio_gpu_debugfs_list,
-VIRTIO_GPU_DEBUGFS_ENTRIES,
-minor->debugfs_root, minor);
+   drm_debugfs_add_files(drm, virtio_gpu_debugfs_list, 
VIRTIO_GPU_DEBUGFS_ENTRIES);
 }
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c 
b/drivers/gpu/drm/virtio/virtgpu_drv.c
index ae97b98750b6..83aa77e5893b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -98,6 +98,8 @@ static int virtio_gpu_probe(struct virtio_device *vdev)
if (ret)
goto err_free;
 
+   virtio_gpu_debugfs_init(dev);
+
ret = drm_dev_register(dev, 0);
if (ret)
goto err_deinit;
@@ -179,9 +181,6 @@ static const struct drm_driver driver = {
.dumb_create = virtio_gpu_mode_dumb_create,
.dumb_map_offset = virtio_gpu_mode_dumb_mmap,
 
-#if defined(CONFIG_DEBUG_FS)
-   .debugfs_init = virtio_gpu_debugfs_init,
-#endif
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_mmap = drm_gem_prime_mmap,
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h 
b/drivers/gpu/drm/virtio/virtgpu_drv.h
index b7a64c7dcc2c..663d405ccacd 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -469,7 +469,7 @@ struct drm_gem_object *virtgpu_gem_prime_import_sg_table(
struct sg_table *sgt);
 
 /* virtgpu_debugfs.c */
-void virtio_gpu_debugfs_init(struct drm_minor *minor);
+void virtio_gpu_debugfs_init(struct drm_device *drm);
 
 /* virtgpu_vram.c */
 bool virtio_gpu_is_vram(struct virtio_gpu_object *bo);
-- 
2.38.1



[PATCH 5/9] drm/arc: use new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_file() function, which center the debugfs files
management on the drm_device instead of drm_minor. Moreover, remove the
debugfs_init hook and add the debugfs files directly on arcpgu_probe(),
before drm_dev_register().

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/tiny/arcpgu.c | 22 ++
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/tiny/arcpgu.c b/drivers/gpu/drm/tiny/arcpgu.c
index 611bbee15071..b074a0b4c7b3 100644
--- a/drivers/gpu/drm/tiny/arcpgu.c
+++ b/drivers/gpu/drm/tiny/arcpgu.c
@@ -338,8 +338,8 @@ static int arcpgu_unload(struct drm_device *drm)
 #ifdef CONFIG_DEBUG_FS
 static int arcpgu_show_pxlclock(struct seq_file *m, void *arg)
 {
-   struct drm_info_node *node = (struct drm_info_node *)m->private;
-   struct drm_device *drm = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *drm = entry->dev;
struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm);
unsigned long clkrate = clk_get_rate(arcpgu->clk);
unsigned long mode_clock = arcpgu->pipe.crtc.mode.crtc_clock * 1000;
@@ -348,17 +348,6 @@ static int arcpgu_show_pxlclock(struct seq_file *m, void 
*arg)
seq_printf(m, "mode: %lu\n", mode_clock);
return 0;
 }
-
-static struct drm_info_list arcpgu_debugfs_list[] = {
-   { "clocks", arcpgu_show_pxlclock, 0 },
-};
-
-static void arcpgu_debugfs_init(struct drm_minor *minor)
-{
-   drm_debugfs_create_files(arcpgu_debugfs_list,
-ARRAY_SIZE(arcpgu_debugfs_list),
-minor->debugfs_root, minor);
-}
 #endif
 
 static const struct drm_driver arcpgu_drm_driver = {
@@ -371,9 +360,6 @@ static const struct drm_driver arcpgu_drm_driver = {
.patchlevel = 0,
.fops = &arcpgu_drm_ops,
DRM_GEM_DMA_DRIVER_OPS,
-#ifdef CONFIG_DEBUG_FS
-   .debugfs_init = arcpgu_debugfs_init,
-#endif
 };
 
 static int arcpgu_probe(struct platform_device *pdev)
@@ -390,6 +376,10 @@ static int arcpgu_probe(struct platform_device *pdev)
if (ret)
return ret;
 
+#ifdef CONFIG_DEBUG_FS
+   drm_debugfs_add_file(&arcpgu->drm, "clocks", arcpgu_show_pxlclock, 
NULL);
+#endif
+
ret = drm_dev_register(&arcpgu->drm, 0);
if (ret)
goto err_unload;
-- 
2.38.1



[PATCH 4/9] drm/pl111: use new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_file() function, which center the debugfs files
management on the drm_device instead of drm_minor. Moreover, remove the
debugfs_init hook and add the debugfs files directly on pl111_amba_probe(),
before drm_dev_register().

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/pl111/pl111_debugfs.c | 15 ---
 drivers/gpu/drm/pl111/pl111_drm.h |  2 +-
 drivers/gpu/drm/pl111/pl111_drv.c |  6 ++
 3 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c 
b/drivers/gpu/drm/pl111/pl111_debugfs.c
index 6744fa16f464..458f69e5435e 100644
--- a/drivers/gpu/drm/pl111/pl111_debugfs.c
+++ b/drivers/gpu/drm/pl111/pl111_debugfs.c
@@ -32,8 +32,8 @@ static const struct {
 
 static int pl111_debugfs_regs(struct seq_file *m, void *unused)
 {
-   struct drm_info_node *node = (struct drm_info_node *)m->private;
-   struct drm_device *dev = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *dev = entry->dev;
struct pl111_drm_dev_private *priv = dev->dev_private;
int i;
 
@@ -46,14 +46,7 @@ static int pl111_debugfs_regs(struct seq_file *m, void 
*unused)
return 0;
 }
 
-static const struct drm_info_list pl111_debugfs_list[] = {
-   {"regs", pl111_debugfs_regs, 0},
-};
-
-void
-pl111_debugfs_init(struct drm_minor *minor)
+void pl111_debugfs_init(struct drm_device *drm)
 {
-   drm_debugfs_create_files(pl111_debugfs_list,
-ARRAY_SIZE(pl111_debugfs_list),
-minor->debugfs_root, minor);
+   drm_debugfs_add_file(drm, "regs", pl111_debugfs_regs, NULL);
 }
diff --git a/drivers/gpu/drm/pl111/pl111_drm.h 
b/drivers/gpu/drm/pl111/pl111_drm.h
index 2a46b5bd8576..7fe74be917f1 100644
--- a/drivers/gpu/drm/pl111/pl111_drm.h
+++ b/drivers/gpu/drm/pl111/pl111_drm.h
@@ -157,6 +157,6 @@ struct pl111_drm_dev_private {
 
 int pl111_display_init(struct drm_device *dev);
 irqreturn_t pl111_irq(int irq, void *data);
-void pl111_debugfs_init(struct drm_minor *minor);
+void pl111_debugfs_init(struct drm_device *drm);
 
 #endif /* _PL111_DRM_H_ */
diff --git a/drivers/gpu/drm/pl111/pl111_drv.c 
b/drivers/gpu/drm/pl111/pl111_drv.c
index 00deba0b7271..c031eb4abc0d 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -228,10 +228,6 @@ static const struct drm_driver pl111_drm_driver = {
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_import_sg_table = pl111_gem_import_sg_table,
.gem_prime_mmap = drm_gem_prime_mmap,
-
-#if defined(CONFIG_DEBUG_FS)
-   .debugfs_init = pl111_debugfs_init,
-#endif
 };
 
 static int pl111_amba_probe(struct amba_device *amba_dev,
@@ -304,6 +300,8 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
if (ret != 0)
goto dev_put;
 
+   pl111_debugfs_init(drm);
+
ret = drm_dev_register(drm, 0);
if (ret < 0)
goto dev_put;
-- 
2.38.1



[PATCH 3/9] drm/arm/hdlcd: use new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_files() function, which center the debugfs files
management on the drm_device instead of drm_minor. Moreover, remove the
debugfs_init hook and add the debugfs files directly on hdlcd_drm_bind(),
before drm_dev_register().

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 24 +---
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 7043d1c9ed8f..e3507dd6f82a 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -195,8 +195,8 @@ static int hdlcd_setup_mode_config(struct drm_device *drm)
 #ifdef CONFIG_DEBUG_FS
 static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)
 {
-   struct drm_info_node *node = (struct drm_info_node *)m->private;
-   struct drm_device *drm = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *drm = entry->dev;
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
 
seq_printf(m, "underrun : %d\n", 
atomic_read(&hdlcd->buffer_underrun_count));
@@ -208,8 +208,8 @@ static int hdlcd_show_underrun_count(struct seq_file *m, 
void *arg)
 
 static int hdlcd_show_pxlclock(struct seq_file *m, void *arg)
 {
-   struct drm_info_node *node = (struct drm_info_node *)m->private;
-   struct drm_device *drm = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *drm = entry->dev;
struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);
unsigned long clkrate = clk_get_rate(hdlcd->clk);
unsigned long mode_clock = hdlcd->crtc.mode.crtc_clock * 1000;
@@ -219,17 +219,10 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void 
*arg)
return 0;
 }
 
-static struct drm_info_list hdlcd_debugfs_list[] = {
+static struct drm_debugfs_info hdlcd_debugfs_list[] = {
{ "interrupt_count", hdlcd_show_underrun_count, 0 },
{ "clocks", hdlcd_show_pxlclock, 0 },
 };
-
-static void hdlcd_debugfs_init(struct drm_minor *minor)
-{
-   drm_debugfs_create_files(hdlcd_debugfs_list,
-ARRAY_SIZE(hdlcd_debugfs_list),
-minor->debugfs_root, minor);
-}
 #endif
 
 DEFINE_DRM_GEM_DMA_FOPS(fops);
@@ -237,9 +230,6 @@ DEFINE_DRM_GEM_DMA_FOPS(fops);
 static const struct drm_driver hdlcd_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
DRM_GEM_DMA_DRIVER_OPS,
-#ifdef CONFIG_DEBUG_FS
-   .debugfs_init = hdlcd_debugfs_init,
-#endif
.fops = &fops,
.name = "hdlcd",
.desc = "ARM HDLCD Controller DRM",
@@ -303,6 +293,10 @@ static int hdlcd_drm_bind(struct device *dev)
drm_mode_config_reset(drm);
drm_kms_helper_poll_init(drm);
 
+#ifdef CONFIG_DEBUG_FS
+   drm_debugfs_add_files(drm, hdlcd_debugfs_list, 
ARRAY_SIZE(hdlcd_debugfs_list));
+#endif
+
ret = drm_dev_register(drm, 0);
if (ret)
goto err_register;
-- 
2.38.1



[PATCH 2/9] drm/gud: use new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_file() function, which center the debugfs files
management on the drm_device instead of drm_minor. Moreover, remove the
debugfs_init hook and add the debugfs files directly on gud_probe(),
before drm_dev_register().

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/gud/gud_drv.c | 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c
index 5aac7cda0505..9d7bf8ee45f1 100644
--- a/drivers/gpu/drm/gud/gud_drv.c
+++ b/drivers/gpu/drm/gud/gud_drv.c
@@ -325,8 +325,8 @@ static struct drm_gem_object *gud_gem_prime_import(struct 
drm_device *drm, struc
 
 static int gud_stats_debugfs(struct seq_file *m, void *data)
 {
-   struct drm_info_node *node = m->private;
-   struct gud_device *gdrm = to_gud_device(node->minor->dev);
+   struct drm_debugfs_entry *entry = m->private;
+   struct gud_device *gdrm = to_gud_device(entry->dev);
char buf[10];
 
string_get_size(gdrm->bulk_len, 1, STRING_UNITS_2, buf, sizeof(buf));
@@ -352,16 +352,6 @@ static int gud_stats_debugfs(struct seq_file *m, void 
*data)
return 0;
 }
 
-static const struct drm_info_list gud_debugfs_list[] = {
-   { "stats", gud_stats_debugfs, 0, NULL },
-};
-
-static void gud_debugfs_init(struct drm_minor *minor)
-{
-   drm_debugfs_create_files(gud_debugfs_list, ARRAY_SIZE(gud_debugfs_list),
-minor->debugfs_root, minor);
-}
-
 static const struct drm_simple_display_pipe_funcs gud_pipe_funcs = {
.check  = gud_pipe_check,
.update = gud_pipe_update,
@@ -386,7 +376,6 @@ static const struct drm_driver gud_drm_driver = {
.fops   = &gud_fops,
DRM_GEM_SHMEM_DRIVER_OPS,
.gem_prime_import   = gud_gem_prime_import,
-   .debugfs_init   = gud_debugfs_init,
 
.name   = "gud",
.desc   = "Generic USB Display",
@@ -623,6 +612,8 @@ static int gud_probe(struct usb_interface *intf, const 
struct usb_device_id *id)
if (!gdrm->dmadev)
dev_warn(dev, "buffer sharing not supported");
 
+   drm_debugfs_add_file(drm, "stats", gud_stats_debugfs, NULL);
+
ret = drm_dev_register(drm, 0);
if (ret) {
put_device(gdrm->dmadev);
-- 
2.38.1



[PATCH 1/9] drm/etnaviv: use new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_files() function, which center the debugfs files
management on the drm_device instead of drm_minor. Moreover, remove the
debugfs_init hook and add the debugfs files directly on etnaviv_bind(),
before drm_dev_register().

Signed-off-by: Maíra Canal 
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 29 +++
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c 
b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 1d2b4fb4bcf8..2b265460672e 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -191,22 +191,22 @@ static int etnaviv_ring_show(struct etnaviv_gpu *gpu, 
struct seq_file *m)
 
 static int show_unlocked(struct seq_file *m, void *arg)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct drm_device *dev = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *dev = entry->dev;
int (*show)(struct drm_device *dev, struct seq_file *m) =
-   node->info_ent->data;
+   entry->file.data;
 
return show(dev, m);
 }
 
 static int show_each_gpu(struct seq_file *m, void *arg)
 {
-   struct drm_info_node *node = (struct drm_info_node *) m->private;
-   struct drm_device *dev = node->minor->dev;
+   struct drm_debugfs_entry *entry = m->private;
+   struct drm_device *dev = entry->dev;
struct etnaviv_drm_private *priv = dev->dev_private;
struct etnaviv_gpu *gpu;
int (*show)(struct etnaviv_gpu *gpu, struct seq_file *m) =
-   node->info_ent->data;
+   entry->file.data;
unsigned int i;
int ret = 0;
 
@@ -223,20 +223,13 @@ static int show_each_gpu(struct seq_file *m, void *arg)
return ret;
 }
 
-static struct drm_info_list etnaviv_debugfs_list[] = {
+static struct drm_debugfs_info etnaviv_debugfs_list[] = {
{"gpu", show_each_gpu, 0, etnaviv_gpu_debugfs},
{"gem", show_unlocked, 0, etnaviv_gem_show},
{ "mm", show_unlocked, 0, etnaviv_mm_show },
{"mmu", show_each_gpu, 0, etnaviv_mmu_show},
{"ring", show_each_gpu, 0, etnaviv_ring_show},
 };
-
-static void etnaviv_debugfs_init(struct drm_minor *minor)
-{
-   drm_debugfs_create_files(etnaviv_debugfs_list,
-ARRAY_SIZE(etnaviv_debugfs_list),
-minor->debugfs_root, minor);
-}
 #endif
 
 /*
@@ -478,9 +471,6 @@ static const struct drm_driver etnaviv_drm_driver = {
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table,
.gem_prime_mmap = drm_gem_prime_mmap,
-#ifdef CONFIG_DEBUG_FS
-   .debugfs_init   = etnaviv_debugfs_init,
-#endif
.ioctls = etnaviv_ioctls,
.num_ioctls = DRM_ETNAVIV_NUM_IOCTLS,
.fops   = &fops,
@@ -534,6 +524,11 @@ static int etnaviv_bind(struct device *dev)
 
load_gpu(drm);
 
+#ifdef CONFIG_DEBUG_FS
+   drm_debugfs_add_files(drm, etnaviv_debugfs_list,
+ ARRAY_SIZE(etnaviv_debugfs_list));
+#endif
+
ret = drm_dev_register(drm, 0);
if (ret)
goto out_unbind;
-- 
2.38.1



[PATCH 0/9] Convert drivers to the new debugfs device-centered functions

2022-12-26 Thread Maíra Canal
The commit 1c9cacbea880 ("drm/debugfs: create device-centered debugfs 
functions")
introduced new device-centered debugfs functions, which center the debugfs files
management on the drm_device instead of drm_minor. Therefore, this patchset
converts 8 drivers to this new debugfs device-centered structure as it was 
already
performed on the vc4 (f2ede40e46e8), v3d (c0dda238e264), and vkms (03d2673bb757)
drivers.

Best Regards,
- Maíra Canal

Maíra Canal (9):
  drm/etnaviv: use new debugfs device-centered functions
  drm/gud: use new debugfs device-centered functions
  drm/arm/hdlcd: use new debugfs device-centered functions
  drm/pl111: use new debugfs device-centered functions
  drm/arc: use new debugfs device-centered functions
  drm/virtio: use new debugfs device-centered functions
  drm/omap: use new debugfs device-centered functions
  drm/qxl: remove unused debugfs structure
  drm/qxl: use new debugfs device-centered functions

 drivers/gpu/drm/arm/hdlcd_drv.c  | 24 +---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c| 29 ++-
 drivers/gpu/drm/gud/gud_drv.c| 17 ++---
 drivers/gpu/drm/omapdrm/omap_debugfs.c   | 29 +--
 drivers/gpu/drm/omapdrm/omap_drv.c   |  7 ++--
 drivers/gpu/drm/omapdrm/omap_drv.h   |  2 +-
 drivers/gpu/drm/pl111/pl111_debugfs.c| 15 ++--
 drivers/gpu/drm/pl111/pl111_drm.h|  2 +-
 drivers/gpu/drm/pl111/pl111_drv.c|  6 +--
 drivers/gpu/drm/qxl/qxl_debugfs.c| 47 
 drivers/gpu/drm/qxl/qxl_drv.c|  5 +--
 drivers/gpu/drm/qxl/qxl_drv.h| 22 +--
 drivers/gpu/drm/tiny/arcpgu.c| 22 +++
 drivers/gpu/drm/virtio/virtgpu_debugfs.c | 17 -
 drivers/gpu/drm/virtio/virtgpu_drv.c |  5 +--
 drivers/gpu/drm/virtio/virtgpu_drv.h |  2 +-
 16 files changed, 74 insertions(+), 177 deletions(-)

-- 
2.38.1



Re: [PATCH v2 1/4] drm: panel: Add Himax HX8394 panel controller driver

2022-12-26 Thread Sam Ravnborg
Hi Javier.

On Mon, Dec 26, 2022 at 02:49:05PM +0100, Javier Martinez Canillas wrote:
> From: Kamil Trzciński 
> 
> The driver is for panels based on the Himax HX8394 controller, such as the
> HannStar HSD060BHW4 720x1440 TFT LCD panel that uses a MIPI-DSI interface.
> 
> Signed-off-by: Kamil Trzciński 
> Co-developed-by: Ondrej Jirman 
> Signed-off-by: Ondrej Jirman 
> Co-developed-by: Javier Martinez Canillas 
> Signed-off-by: Javier Martinez Canillas 
Reviewed-by: Sam Ravnborg 

Strictly speaking the binding should be applied before the driver.

Sam


Re: [PATCH v3 0/7] media/drm: renesas: Add new pixel formats

2022-12-26 Thread Laurent Pinchart
Hi Tomi,

(CC'ing Daniel and Dave)

On Wed, Dec 21, 2022 at 11:24:41AM +0200, Tomi Valkeinen wrote:
> From: Tomi Valkeinen 
> 
> Hi,
> 
> These add new pixel formats for Renesas V3U and V4H SoCs.
> 
> As the display pipeline is split between DRM and V4L2 components, this
> series touches both subsystems. I'm sending all these together to
> simplify review. If needed, I can later split this to V4L2 and DRM
> parts, of which the V4L2 part needs to be merged first.

As the changes on the DRM side are small and shouldn't conflict with
anything else queued for v6.3, it would be easier to merge the whole
series through the media tree. Daniel, Dave, would you be OK with that ?
If so, could you please ack patches 6/7 and 7/7 ?

> Changes in v3:
> - Addressed all the review comments
> - Added Y212
> - Updated the kernel docs for the new formats
> - Changed the RGB format names to match the DRM's format names
> - Updated RPF register field macros according to the comments
> 
>  Tomi
> 
> Tomi Valkeinen (7):
>   media: Add 2-10-10-10 RGB formats
>   media: Add Y210, Y212 and Y216 formats
>   media: renesas: vsp1: Change V3U to be gen4
>   media: renesas: vsp1: Add V4H SoC version
>   media: renesas: vsp1: Add new formats (2-10-10-10 ARGB, Y210, Y212)
>   drm: rcar-du: Bump V3U to gen 4
>   drm: rcar-du: Add new formats (2-10-10-10 ARGB, Y210)
> 
>  .../media/v4l/pixfmt-packed-yuv.rst   |  49 -
>  .../userspace-api/media/v4l/pixfmt-rgb.rst| 194 ++
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c |   2 +-
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c |  30 +++
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c |  50 -
>  .../media/platform/renesas/vsp1/vsp1_drv.c|   4 +-
>  .../media/platform/renesas/vsp1/vsp1_hgo.c|   4 +-
>  .../media/platform/renesas/vsp1/vsp1_lif.c|   1 +
>  .../media/platform/renesas/vsp1/vsp1_pipe.c   |  18 ++
>  .../media/platform/renesas/vsp1/vsp1_regs.h   |  26 ++-
>  .../media/platform/renesas/vsp1/vsp1_rpf.c|  64 +-
>  .../media/platform/renesas/vsp1/vsp1_video.c  |   4 +-
>  .../media/platform/renesas/vsp1/vsp1_wpf.c|   4 +-
>  drivers/media/v4l2-core/v4l2-ioctl.c  |   6 +
>  include/uapi/linux/videodev2.h|  11 +
>  15 files changed, 447 insertions(+), 20 deletions(-)

-- 
Regards,

Laurent Pinchart


Re: [PATCH v3 5/7] media: renesas: vsp1: Add new formats (2-10-10-10 ARGB, Y210, Y212)

2022-12-26 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Wed, Dec 21, 2022 at 11:24:46AM +0200, Tomi Valkeinen wrote:
> Add new pixel formats: RGBX1010102, RGBA1010102, ARGB2101010, Y210 and
> Y212.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  .../media/platform/renesas/vsp1/vsp1_pipe.c   | 18 +++
>  .../media/platform/renesas/vsp1/vsp1_regs.h   | 23 
>  .../media/platform/renesas/vsp1/vsp1_rpf.c| 52 +++
>  3 files changed, 93 insertions(+)
> 
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c 
> b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c
> index f72ac01c21ea..f8093ba9539e 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_pipe.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_pipe.c
> @@ -146,6 +146,18 @@ static const struct vsp1_format_info 
> vsp1_video_formats[] = {
> VI6_FMT_ARGB_, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
> VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
> 1, { 32, 0, 0 }, false, false, 1, 1, false },
> + { V4L2_PIX_FMT_RGBX1010102, MEDIA_BUS_FMT_ARGB_1X32,
> +   VI6_FMT_RGB10_RGB10A2_A2RGB10,
> +   VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
> +   1, { 32, 0, 0 }, false, false, 1, 1, false },
> + { V4L2_PIX_FMT_RGBA1010102, MEDIA_BUS_FMT_ARGB_1X32,
> +   VI6_FMT_RGB10_RGB10A2_A2RGB10,
> +   VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
> +   1, { 32, 0, 0 }, false, false, 1, 1, false },
> + { V4L2_PIX_FMT_ARGB2101010, MEDIA_BUS_FMT_ARGB_1X32,
> +   VI6_FMT_RGB10_RGB10A2_A2RGB10,
> +   VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
> +   1, { 32, 0, 0 }, false, false, 1, 1, false },
>   { V4L2_PIX_FMT_UYVY, MEDIA_BUS_FMT_AYUV8_1X32,
> VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
> VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
> @@ -202,6 +214,12 @@ static const struct vsp1_format_info 
> vsp1_video_formats[] = {
> VI6_FMT_Y_U_V_444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
> VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
> 3, { 8, 8, 8 }, false, true, 1, 1, false },
> + { V4L2_PIX_FMT_Y210, MEDIA_BUS_FMT_AYUV8_1X32,
> +   VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
> +   1, { 32, 0, 0 }, false, false, 2, 1, false },
> + { V4L2_PIX_FMT_Y212, MEDIA_BUS_FMT_AYUV8_1X32,
> +   VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
> +   1, { 32, 0, 0 }, false, false, 2, 1, false },
>  };
>  
>  /**
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_regs.h 
> b/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> index c61e8dafeecf..d94343ae57a1 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> @@ -228,6 +228,28 @@
>  #define VI6_RPF_MULT_ALPHA_RATIO_MASK(0xff << 0)
>  #define VI6_RPF_MULT_ALPHA_RATIO_SHIFT   0
>  
> +#define VI6_RPF_EXT_INFMT0   0x0370
> +#define VI6_RPF_EXT_INFMT0_F2B   BIT(12)
> +#define VI6_RPF_EXT_INFMT0_IPBD_Y_8  (0 << 8)
> +#define VI6_RPF_EXT_INFMT0_IPBD_Y_10 (1 << 8)
> +#define VI6_RPF_EXT_INFMT0_IPBD_Y_12 (2 << 8)
> +#define VI6_RPF_EXT_INFMT0_IPBD_C_8  (0 << 4)
> +#define VI6_RPF_EXT_INFMT0_IPBD_C_10 (1 << 4)
> +#define VI6_RPF_EXT_INFMT0_IPBD_C_12 (2 << 4)
> +#define VI6_RPF_EXT_INFMT0_BYPP_M1_RGB10 (3 << 0)
> +
> +#define VI6_RPF_EXT_INFMT1   0x0374
> +#define VI6_RPF_EXT_INFMT1_PACK_CPOS(a, b, c, d) \
> + (((a) << 24) | ((b) << 16) | ((c) << 8) | ((d) << 0))
> +
> +#define VI6_RPF_EXT_INFMT2   0x0378
> +#define VI6_RPF_EXT_INFMT2_PACK_CLEN(a, b, c, d) \
> + (((a) << 24) | ((b) << 16) | ((c) << 8) | ((d) << 0))
> +
> +#define VI6_RPF_BRDITH_CTRL  0x03e0
> +#define VI6_RPF_BRDITH_CTRL_ODE  BIT(8)
> +#define VI6_RPF_BRDITH_CTRL_CBRM BIT(0)
> +
>  /* 
> -
>   * WPF Control Registers
>   */
> @@ -846,6 +868,7 @@
>  #define VI6_FMT_XBXGXR_2626260x21
>  #define VI6_FMT_ABGR_0x22
>  #define VI6_FMT_XXRGB_88565  0x23
> +#define VI6_FMT_RGB10_RGB10A2_A2RGB100x30
>  
>  #define VI6_FMT_Y_UV_444 0x40
>  #define VI6_FMT_Y_UV_422 0x41
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c 
> b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> index 045aa54f7998..3b17f5fa4067 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> @@ -109,6 +109,58 @@ static void rpf_configure_stream(struct vsp1_entity 
> *entity,
>   vsp1_rpf_write(rpf, dlb, VI6_RPF_INFMT, infmt);
>   vsp1_rpf_write(rpf, dlb, VI6_RPF_DSWAP, fmtinfo->swap);
>  
> + if (entity->vsp1->info->gen == 4) {
> + u32 ext_infmt0;
> + u32 ext_infmt1;
> + u32 ext_infmt2;
> +
> + switch (fmtinfo->fourcc) {
> + case V4L2_PIX_FMT_RGBX10

Re: [PATCH v3 3/7] media: renesas: vsp1: Change V3U to be gen4

2022-12-26 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Wed, Dec 21, 2022 at 11:24:44AM +0200, Tomi Valkeinen wrote:
> V3U is actually gen4, not gen3. The same IP is also used in the
> (not-yet-supported) V4H.
> 
> Change VI6_IP_VERSION_MODEL_VSPD_V3U to VI6_IP_VERSION_MODEL_VSPD_GEN4,
> to represent the model correctly. V3U and V4H can still be
> differentiated, if needed, with the VI6_IP_VERSION_SOC_xxx.
> 
> Also mark VI6_IP_VERSION_MODEL_VSPD_GEN4 as gen 4 in vsp1_device_info,
> and update the code to correctly match for gen 4.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/media/platform/renesas/vsp1/vsp1_drv.c   |  4 ++--
>  drivers/media/platform/renesas/vsp1/vsp1_hgo.c   |  4 ++--
>  drivers/media/platform/renesas/vsp1/vsp1_lif.c   |  1 +
>  drivers/media/platform/renesas/vsp1/vsp1_regs.h  |  2 +-
>  drivers/media/platform/renesas/vsp1/vsp1_rpf.c   | 12 ++--
>  drivers/media/platform/renesas/vsp1/vsp1_video.c |  4 ++--
>  drivers/media/platform/renesas/vsp1/vsp1_wpf.c   |  4 ++--
>  7 files changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_drv.c 
> b/drivers/media/platform/renesas/vsp1/vsp1_drv.c
> index c260d318d298..5710152d6511 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_drv.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_drv.c
> @@ -818,9 +818,9 @@ static const struct vsp1_device_info vsp1_device_infos[] 
> = {
>   .wpf_count = 2,
>   .num_bru_inputs = 5,
>   }, {
> - .version = VI6_IP_VERSION_MODEL_VSPD_V3U,
> + .version = VI6_IP_VERSION_MODEL_VSPD_GEN4,
>   .model = "VSP2-D",
> - .gen = 3,
> + .gen = 4,
>   .features = VSP1_HAS_BRU | VSP1_HAS_EXT_DL,
>   .lif_count = 1,
>   .rpf_count = 5,
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_hgo.c 
> b/drivers/media/platform/renesas/vsp1/vsp1_hgo.c
> index bf3f981f93a1..e6492deb0a64 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_hgo.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_hgo.c
> @@ -196,10 +196,10 @@ struct vsp1_hgo *vsp1_hgo_create(struct vsp1_device 
> *vsp1)
>  
>   /* Initialize the control handler. */
>   v4l2_ctrl_handler_init(&hgo->ctrls.handler,
> -vsp1->info->gen == 3 ? 2 : 1);
> +vsp1->info->gen >= 3 ? 2 : 1);
>   hgo->ctrls.max_rgb = v4l2_ctrl_new_custom(&hgo->ctrls.handler,
> &hgo_max_rgb_control, NULL);
> - if (vsp1->info->gen == 3)
> + if (vsp1->info->gen >= 3)
>   hgo->ctrls.num_bins =
>   v4l2_ctrl_new_custom(&hgo->ctrls.handler,
>&hgo_num_bins_control, NULL);
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_lif.c 
> b/drivers/media/platform/renesas/vsp1/vsp1_lif.c
> index 186a5730e1e3..0ab2e0c70474 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_lif.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_lif.c
> @@ -114,6 +114,7 @@ static void lif_configure_stream(struct vsp1_entity 
> *entity,
>   break;
>  
>   case VI6_IP_VERSION_MODEL_VSPD_GEN3:
> + case VI6_IP_VERSION_MODEL_VSPD_GEN4:
>   default:
>   hbth = 0;
>   obth = 3000;
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_regs.h 
> b/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> index 8928f4c6bb55..8c9333f76858 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_regs.h
> @@ -766,7 +766,7 @@
>  #define VI6_IP_VERSION_MODEL_VSPD_V3 (0x18 << 8)
>  #define VI6_IP_VERSION_MODEL_VSPDL_GEN3  (0x19 << 8)
>  #define VI6_IP_VERSION_MODEL_VSPBS_GEN3  (0x1a << 8)
> -#define VI6_IP_VERSION_MODEL_VSPD_V3U(0x1c << 8)
> +#define VI6_IP_VERSION_MODEL_VSPD_GEN4   (0x1c << 8)
>  /* RZ/G2L SoCs have no version register, So use 0x80 as the model version */
>  #define VI6_IP_VERSION_MODEL_VSPD_RZG2L  (0x80 << 8)
>  
> diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c 
> b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> index 75083cb234fe..045aa54f7998 100644
> --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> @@ -133,18 +133,18 @@ static void rpf_configure_stream(struct vsp1_entity 
> *entity,
>* a fixed alpha value set through the V4L2_CID_ALPHA_COMPONENT control
>* otherwise.
>*
> -  * The Gen3 RPF has extended alpha capability and can both multiply the
> +  * The Gen3+ RPF has extended alpha capability and can both multiply the
>* alpha channel by a fixed global alpha value, and multiply the pixel
>* components to convert the input to premultiplied alpha.
>*
>* As alpha premultiplication is available in the BRx for both Gen2 and
> -  * Gen3 we handle it there and

Re: [PATCH v3 2/7] media: Add Y210, Y212 and Y216 formats

2022-12-26 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Wed, Dec 21, 2022 at 11:24:43AM +0200, Tomi Valkeinen wrote:
> Add Y210, Y212 and Y216 formats.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  .../media/v4l/pixfmt-packed-yuv.rst   | 49 ++-
>  drivers/media/v4l2-core/v4l2-ioctl.c  |  3 ++
>  include/uapi/linux/videodev2.h|  8 +++
>  3 files changed, 58 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst 
> b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst
> index bf283a1b5581..24a771542059 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst
> @@ -262,7 +262,12 @@ the second byte and Y'\ :sub:`7-0` in the third byte.
>  =
>  
>  These formats, commonly referred to as YUYV or YUY2, subsample the chroma
> -components horizontally by 2, storing 2 pixels in 4 bytes.
> +components horizontally by 2, storing 2 pixels in a container. The container
> +is 32-bits for 8-bit formats, and 64-bits for 10+-bit formats.
> +
> +The packed YUYV formats with more than 8 bits per component are stored as 
> four
> +16-bit little-endian words. Each word's most significant bits contain one
> +component, and the least significant bits are zero padding.
>  
>  .. raw:: latex
>  
> @@ -270,7 +275,7 @@ components horizontally by 2, storing 2 pixels in 4 bytes.
>  
>  .. tabularcolumns:: 
> |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|
>  
> -.. flat-table:: Packed YUV 4:2:2 Formats
> +.. flat-table:: Packed YUV 4:2:2 Formats in 32-bit container
>  :header-rows: 1
>  :stub-columns: 0
>  
> @@ -337,6 +342,46 @@ components horizontally by 2, storing 2 pixels in 4 
> bytes.
>- Y'\ :sub:`3`
>- Cb\ :sub:`2`
>  
> +.. tabularcolumns:: 
> |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|
> +
> +.. flat-table:: Packed YUV 4:2:2 Formats in 64-bit container
> +:header-rows: 1
> +:stub-columns: 0
> +
> +* - Identifier
> +  - Code
> +  - Word 0
> +  - Word 1
> +  - Word 2
> +  - Word 3
> +* .. _V4L2-PIX-FMT-Y210:
> +
> +  - ``V4L2_PIX_FMT_Y210``
> +  - 'Y210'
> +
> +  - Y'\ :sub:`0` (bits 15-6)
> +  - Cb\ :sub:`0` (bits 15-6)
> +  - Y'\ :sub:`1` (bits 15-6)
> +  - Cr\ :sub:`0` (bits 15-6)
> +* .. _V4L2-PIX-FMT-Y212:
> +
> +  - ``V4L2_PIX_FMT_Y212``
> +  - 'Y212'
> +
> +  - Y'\ :sub:`0` (bits 15-4)
> +  - Cb\ :sub:`0` (bits 15-4)
> +  - Y'\ :sub:`1` (bits 15-4)
> +  - Cr\ :sub:`0` (bits 15-4)
> +* .. _V4L2-PIX-FMT-Y216:
> +
> +  - ``V4L2_PIX_FMT_Y216``
> +  - 'Y216'
> +
> +  - Y'\ :sub:`0` (bits 15-0)
> +  - Cb\ :sub:`0` (bits 15-0)
> +  - Y'\ :sub:`1` (bits 15-0)
> +  - Cr\ :sub:`0` (bits 15-0)
> +
>  .. raw:: latex
>  
>  \normalsize
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
> b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 875b9a95e3c8..a244d5181120 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1449,6 +1449,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
>   case V4L2_META_FMT_RK_ISP1_STAT_3A: descr = "Rockchip ISP1 3A 
> Statistics"; break;
>   case V4L2_PIX_FMT_NV12M_8L128:  descr = "NV12M (8x128 Linear)"; break;
>   case V4L2_PIX_FMT_NV12M_10BE_8L128: descr = "10-bit NV12M (8x128 
> Linear, BE)"; break;
> + case V4L2_PIX_FMT_Y210: descr = "10-bit YUYV Packed"; break;
> + case V4L2_PIX_FMT_Y212: descr = "12-bit YUYV Packed"; break;
> + case V4L2_PIX_FMT_Y216: descr = "16-bit YUYV Packed"; break;
>  
>   default:
>   /* Compressed formats */
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 51d6a8aa4e17..403db3fb5cfa 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -621,6 +621,14 @@ struct v4l2_pix_format {
>  #define V4L2_PIX_FMT_YUVX32  v4l2_fourcc('Y', 'U', 'V', 'X') /* 32  
> YUVX-8-8-8-8  */
>  #define V4L2_PIX_FMT_M420v4l2_fourcc('M', '4', '2', '0') /* 12  YUV 
> 4:2:0 2 lines y, 1 line uv interleaved */
>  
> +/*
> + * YCbCr packed format. For each Y2xx format, xx bits of valid data occupy 
> the MSBs
> + * of the 16 bit components, and 16-xx bits of zero padding occupy the LSBs.
> + */
> +#define V4L2_PIX_FMT_Y210v4l2_fourcc('Y', '2', '1', '0') /* 32  YUYV 
> 4:2:2 */
> +#define V4L2_PIX_FMT_Y212v4l2_fourcc('Y', '2', '1', '2') /* 32  YUYV 
> 4:2:2 */
> +#define V4L2_PIX_FMT_Y216v4l2_fourcc('Y', '2', '1', '6') /* 32  YUYV 
> 4:2:2 */
> +
>  /* two planes -- one Y, one Cr + Cb interleaved  */
>  #define V4L2_PIX_FMT_NV12v4l2_fourcc('N', 'V', '1', '2') /* 12  Y/CbCr 
> 4:2:0  */
>  #define V4L2_PIX_FMT_NV21v4l2_fourcc('N', '

Re: [PATCH v3 1/7] media: Add 2-10-10-10 RGB formats

2022-12-26 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Wed, Dec 21, 2022 at 11:24:42AM +0200, Tomi Valkeinen wrote:
> Add XBGR2101010, ABGR2101010 and BGRA1010102 formats.

You forgot to rename the formats in the commit message.

> Signed-off-by: Tomi Valkeinen 
> ---
>  .../userspace-api/media/v4l/pixfmt-rgb.rst| 194 ++
>  drivers/media/v4l2-core/v4l2-ioctl.c  |   3 +
>  include/uapi/linux/videodev2.h|   3 +
>  3 files changed, 200 insertions(+)
> 
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst 
> b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst
> index 30f51cd33f99..d330aeb4d3eb 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst
> @@ -763,6 +763,200 @@ nomenclature that instead use the order of components 
> as seen in a 24- or
>  \normalsize
>  
>  
> +10 Bits Per Component
> +=
> +
> +These formats store a 30-bit RGB triplet with an optional 2 bit alpha in four
> +bytes. They are named based on the order of the RGB components as seen in a
> +32-bit word, which is then stored in memory in little endian byte order
> +(unless otherwise noted by the presence of bit 31 in the 4CC value), and on 
> the
> +number of bits for each component.
> +
> +.. raw:: latex
> +
> +\begingroup
> +\tiny
> +\setlength{\tabcolsep}{2pt}
> +
> +.. tabularcolumns:: 
> |p{2.8cm}|p{2.0cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|
> +
> +
> +.. flat-table:: RGB Formats 10 Bits Per Color Component
> +:header-rows:  2
> +:stub-columns: 0
> +
> +* - Identifier
> +  - Code
> +  - :cspan:`7` Byte 0 in memory
> +  - :cspan:`7` Byte 1
> +  - :cspan:`7` Byte 2
> +  - :cspan:`7` Byte 3
> +* -
> +  -
> +  - 7
> +  - 6
> +  - 5
> +  - 4
> +  - 3
> +  - 2
> +  - 1
> +  - 0
> +
> +  - 7
> +  - 6
> +  - 5
> +  - 4
> +  - 3
> +  - 2
> +  - 1
> +  - 0
> +
> +  - 7
> +  - 6
> +  - 5
> +  - 4
> +  - 3
> +  - 2
> +  - 1
> +  - 0
> +
> +  - 7
> +  - 6
> +  - 5
> +  - 4
> +  - 3
> +  - 2
> +  - 1
> +  - 0
> +* .. _V4L2-PIX-FMT-RGBX1010102:
> +
> +  - ``V4L2_PIX_FMT_RGBX1010102``
> +  - 'RX30'
> +
> +  - b\ :sub:`5`
> +  - b\ :sub:`4`
> +  - b\ :sub:`3`
> +  - b\ :sub:`2`
> +  - b\ :sub:`1`
> +  - b\ :sub:`0`
> +  - x
> +  - x
> +
> +  - g\ :sub:`3`
> +  - g\ :sub:`2`
> +  - g\ :sub:`1`
> +  - g\ :sub:`0`
> +  - b\ :sub:`9`
> +  - b\ :sub:`8`
> +  - b\ :sub:`7`
> +  - b\ :sub:`6`
> +
> +  - r\ :sub:`1`
> +  - r\ :sub:`0`
> +  - g\ :sub:`9`
> +  - g\ :sub:`8`
> +  - g\ :sub:`7`
> +  - g\ :sub:`6`
> +  - g\ :sub:`5`
> +  - g\ :sub:`4`
> +
> +  - r\ :sub:`9`
> +  - r\ :sub:`8`
> +  - r\ :sub:`7`
> +  - r\ :sub:`6`
> +  - r\ :sub:`5`
> +  - r\ :sub:`4`
> +  - r\ :sub:`3`
> +  - r\ :sub:`2`
> +  -
> +* .. _V4L2-PIX-FMT-RGBA1010102:
> +
> +  - ``V4L2_PIX_FMT_RGBA1010102``
> +  - 'RA30'
> +
> +  - b\ :sub:`5`
> +  - b\ :sub:`4`
> +  - b\ :sub:`3`
> +  - b\ :sub:`2`
> +  - b\ :sub:`1`
> +  - b\ :sub:`0`
> +  - a\ :sub:`1`
> +  - a\ :sub:`0`
> +
> +  - g\ :sub:`3`
> +  - g\ :sub:`2`
> +  - g\ :sub:`1`
> +  - g\ :sub:`0`
> +  - b\ :sub:`9`
> +  - b\ :sub:`8`
> +  - b\ :sub:`7`
> +  - b\ :sub:`6`
> +
> +  - r\ :sub:`1`
> +  - r\ :sub:`0`
> +  - g\ :sub:`9`
> +  - g\ :sub:`8`
> +  - g\ :sub:`7`
> +  - g\ :sub:`6`
> +  - g\ :sub:`5`
> +  - g\ :sub:`4`
> +
> +  - r\ :sub:`9`
> +  - r\ :sub:`8`
> +  - r\ :sub:`7`
> +  - r\ :sub:`6`
> +  - r\ :sub:`5`
> +  - r\ :sub:`4`
> +  - r\ :sub:`3`
> +  - r\ :sub:`2`
> +  -
> +* .. _V4L2-PIX-FMT-ARGB2101010:
> +
> +  - ``V4L2_PIX_FMT_ARGB2101010``
> +  - 'AR30'
> +
> +  - b\ :sub:`7`
> +  - b\ :sub:`6`
> +  - b\ :sub:`5`
> +  - b\ :sub:`4`
> +  - b\ :sub:`3`
> +  - b\ :sub:`2`
> +  - b\ :sub:`1`
> +  - b\ :sub:`0`
> +
> +  - g\ :sub:`5`
> +  - g\ :sub:`4`
> +  - g\ :sub:`3`
> +  - g\ :sub:`2`
> +  - g\ :sub:`1`
> +  - g\ :sub:`0`
> +  - b\ :sub:`9`
> +  - b\ :sub:`8`
> +
> +  - r\ :sub:`3`
> +  - r\ :sub:`2`
> +  - r\ :sub:`1`
> +  - r\ :sub:`0`
> +  - g\ :sub:`9`
> +  - g\ :sub:`8`
> +  - g\ :sub:`7`
> +  - g\ :sub:`6`
> +
> +  - a\ :sub:`1`
> +  - a\ :sub:`0`
> +  - r\ :sub:`9`
> +  - r\ :sub:`8`
> +  - r\ :sub:`7

Re: [PATCH v3 7/7] drm: rcar-du: Add new formats (2-10-10-10 ARGB, Y210)

2022-12-26 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Wed, Dec 21, 2022 at 11:24:48AM +0200, Tomi Valkeinen wrote:
> Add new pixel formats: RGBX1010102, RGBA1010102, ARGB2101010, Y210 and

Reviewed-by: Laurent Pinchart 

> Y212.
> 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c | 30 
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 50 +--
>  2 files changed, 78 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index 8c2719efda2a..adfb36b0e815 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -259,6 +259,24 @@ static const struct rcar_du_format_info 
> rcar_du_format_infos[] = {
>   .bpp = 32,
>   .planes = 1,
>   .hsub = 1,
> + }, {
> + .fourcc = DRM_FORMAT_RGBX1010102,
> + .v4l2 = V4L2_PIX_FMT_RGBX1010102,
> + .bpp = 32,
> + .planes = 1,
> + .hsub = 1,
> + }, {
> + .fourcc = DRM_FORMAT_RGBA1010102,
> + .v4l2 = V4L2_PIX_FMT_RGBA1010102,
> + .bpp = 32,
> + .planes = 1,
> + .hsub = 1,
> + }, {
> + .fourcc = DRM_FORMAT_ARGB2101010,
> + .v4l2 = V4L2_PIX_FMT_ARGB2101010,
> + .bpp = 32,
> + .planes = 1,
> + .hsub = 1,
>   }, {
>   .fourcc = DRM_FORMAT_YVYU,
>   .v4l2 = V4L2_PIX_FMT_YVYU,
> @@ -307,6 +325,18 @@ static const struct rcar_du_format_info 
> rcar_du_format_infos[] = {
>   .bpp = 24,
>   .planes = 3,
>   .hsub = 1,
> + }, {
> + .fourcc = DRM_FORMAT_Y210,
> + .v4l2 = V4L2_PIX_FMT_Y210,
> + .bpp = 32,
> + .planes = 1,
> + .hsub = 2,
> + }, {
> + .fourcc = DRM_FORMAT_Y212,
> + .v4l2 = V4L2_PIX_FMT_Y212,
> + .bpp = 32,
> + .planes = 1,
> + .hsub = 2,
>   },
>  };
>  
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> index e465aef41585..fe90be51d64e 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -139,6 +139,43 @@ static const u32 rcar_du_vsp_formats[] = {
>   DRM_FORMAT_YVU444,
>  };
>  
> +/*
> + * Gen4 supports the same formats as above, and additionally 2-10-10-10 RGB
> + * formats and Y210 & Y212 formats.
> + */
> +static const u32 rcar_du_vsp_formats_gen4[] = {
> + DRM_FORMAT_RGB332,
> + DRM_FORMAT_ARGB,
> + DRM_FORMAT_XRGB,
> + DRM_FORMAT_ARGB1555,
> + DRM_FORMAT_XRGB1555,
> + DRM_FORMAT_RGB565,
> + DRM_FORMAT_BGR888,
> + DRM_FORMAT_RGB888,
> + DRM_FORMAT_BGRA,
> + DRM_FORMAT_BGRX,
> + DRM_FORMAT_ARGB,
> + DRM_FORMAT_XRGB,
> + DRM_FORMAT_RGBX1010102,
> + DRM_FORMAT_RGBA1010102,
> + DRM_FORMAT_ARGB2101010,
> + DRM_FORMAT_UYVY,
> + DRM_FORMAT_YUYV,
> + DRM_FORMAT_YVYU,
> + DRM_FORMAT_NV12,
> + DRM_FORMAT_NV21,
> + DRM_FORMAT_NV16,
> + DRM_FORMAT_NV61,
> + DRM_FORMAT_YUV420,
> + DRM_FORMAT_YVU420,
> + DRM_FORMAT_YUV422,
> + DRM_FORMAT_YVU422,
> + DRM_FORMAT_YUV444,
> + DRM_FORMAT_YVU444,
> + DRM_FORMAT_Y210,
> + DRM_FORMAT_Y212,
> +};
> +
>  static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
>  {
>   struct rcar_du_vsp_plane_state *state =
> @@ -436,14 +473,23 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
> device_node *np,
>? DRM_PLANE_TYPE_PRIMARY
>: DRM_PLANE_TYPE_OVERLAY;
>   struct rcar_du_vsp_plane *plane = &vsp->planes[i];
> + unsigned int num_formats;
> + const u32 *formats;
> +
> + if (rcdu->info->gen < 4) {
> + num_formats = ARRAY_SIZE(rcar_du_vsp_formats);
> + formats = rcar_du_vsp_formats;
> + } else {
> + num_formats = ARRAY_SIZE(rcar_du_vsp_formats_gen4);
> + formats = rcar_du_vsp_formats_gen4;
> + }
>  
>   plane->vsp = vsp;
>   plane->index = i;
>  
>   ret = drm_universal_plane_init(&rcdu->ddev, &plane->plane,
>  crtcs, &rcar_du_vsp_plane_funcs,
> -rcar_du_vsp_formats,
> -ARRAY_SIZE(rcar_du_vsp_formats),
> +formats, num_formats,
>  NULL, type, NULL);
>   if (ret < 0)
>   return ret;

-- 
Regards,

Laurent Pinchart


[PATCH v2 0/4] Add PinePhone Pro display support

2022-12-26 Thread Javier Martinez Canillas
This series add support for the display present in the PinePhone Pro.

Patch #1 adds a driver for panels using the Himax HX8394 panel controller,
such as the HSD060BHW4 720x1440 TFT LCD panel present in the PinePhone Pro.

Patch #2 adds a devicetree binding schema for this driver and patch #3 adds
an entry for the driver in the MAINTAINERS file.

Finally patch #4 adds the needed devicetree nodes in the PinePhone Pro DTS,
to enable both the display and the touchscreen. This makes the upstream DTS
much more usable and will allow for example to enable support for the phone
in the Fedora distribution.

I only added myself as the maintainer for the driver because I don't know
if Kamil and Ondrej that worked in the driver would be interested. Please
let me know folks if you are, and I can add you too in the next revision.

This is a v2 of the patch-set that addresses issues pointed out in v1:

https://lore.kernel.org/all/2022123830.2494900-1-javi...@redhat.com/T/#m692655a06093fe8df0d8748b3df338e57494af2a

The patches were tested on a PinePhone Pro Explorer Edition using a Fedora
37 Workstation image.

Best regards,
Javier

Changes in v2:
- Add year to driver's copyright notice (Sam Ravnborg)
- Remove unused  header include (Sam Ravnborg).
- Use mipi_dsi_dcs_write_seq() helper and drop custom macro (Sam Ravnborg).
- Drop unnecessary info messages and move useful one to debug (Sam Ravnborg).
- Drop redundant "bindings" in subject (Krzysztof Kozlowski).
- Drop "device tree bindings" in title (Krzysztof Kozlowski).
- Put port next to other "true" properties (Krzysztof Kozlowski).
- Add Krzysztof Kozlowski's Reviewed-by tag.
- Fix regulator node names (Maya Matuszczyk).
- Drop non-existent "poweroff-in-suspend" property (Maya Matuszczyk).
- Remove unnecessary comments in panel node (Maya Matuszczyk).

Javier Martinez Canillas (2):
  dt-bindings: display: Add Himax HX8394 panel controller
  MAINTAINERS: Add entry for Himax HX8394 panel controller driver

Kamil Trzciński (1):
  drm: panel: Add Himax HX8394 panel controller driver

Ondrej Jirman (1):
  arm64: dts: rk3399-pinephone-pro: Add internal display support

 .../bindings/display/panel/himax,hx8394.yaml  |  65 +++
 MAINTAINERS   |   7 +
 .../dts/rockchip/rk3399-pinephone-pro.dts | 123 +
 drivers/gpu/drm/panel/Kconfig |  12 +
 drivers/gpu/drm/panel/Makefile|   1 +
 drivers/gpu/drm/panel/panel-himax-hx8394.c| 446 ++
 6 files changed, 654 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-himax-hx8394.c

-- 
2.38.1



[PATCH v2 2/4] dt-bindings: display: Add Himax HX8394 panel controller

2022-12-26 Thread Javier Martinez Canillas
Add device tree bindings for panels based on the Himax HX8394 controller,
such as the HannStar HSD060BHW4 720x1440 TFT LCD panel that is connected
through a MIPI-DSI video interface.

Signed-off-by: Javier Martinez Canillas 
Reviewed-by: Krzysztof Kozlowski 
---

Changes in v2:
- Drop redundant "bindings" in subject (Krzysztof Kozlowski).
- Drop "device tree bindings" in title (Krzysztof Kozlowski).
- Put port next to other "true" properties (Krzysztof Kozlowski).
- Add Krzysztof Kozlowski's Reviewed-by tag.

 .../bindings/display/panel/himax,hx8394.yaml  | 65 +++
 1 file changed, 65 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml

diff --git a/Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml 
b/Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
new file mode 100644
index ..bead3f0b05c5
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/himax,hx8394.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Himax HX8394 MIPI-DSI LCD panel controller
+
+maintainers:
+  - Javier Martinez Canillas 
+
+description:
+  Device tree bindings for panels based on the Himax HX8394 controller,
+  such as the HannStar HSD060BHW4 720x1440 TFT LCD panel connected with
+  a MIPI-DSI video interface.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+enum:
+  # HannStar HSD060BHW4 5.99" 720x1440 TFT LCD panel
+  - hannstar,hsd060bhw4
+
+  vcc-supply:
+description: Panel power supply
+
+  iovcc-supply:
+description: I/O voltage supply
+
+  port: true
+
+  reset-gpios: true
+
+  backlight: true
+
+required:
+  - compatible
+  - vcc-supply
+  - iovcc-supply
+  - port
+  - reset-gpios
+  - backlight
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+dsi {
+#address-cells = <1>;
+#size-cells = <0>;
+panel@0 {
+compatible = "hannstar,hsd060bhw4";
+reg = <0>;
+vcc-supply = <®_2v8_p>;
+iovcc-supply = <®_1v8_p>;
+reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
+backlight = <&backlight>;
+};
+};
+
+...
-- 
2.38.1



[PATCH v2 1/4] drm: panel: Add Himax HX8394 panel controller driver

2022-12-26 Thread Javier Martinez Canillas
From: Kamil Trzciński 

The driver is for panels based on the Himax HX8394 controller, such as the
HannStar HSD060BHW4 720x1440 TFT LCD panel that uses a MIPI-DSI interface.

Signed-off-by: Kamil Trzciński 
Co-developed-by: Ondrej Jirman 
Signed-off-by: Ondrej Jirman 
Co-developed-by: Javier Martinez Canillas 
Signed-off-by: Javier Martinez Canillas 
---

Changes in v2:
- Add year to driver's copyright notice (Sam Ravnborg)
- Remove unused  header include (Sam Ravnborg).
- Use mipi_dsi_dcs_write_seq() helper and drop custom macro (Sam Ravnborg).
- Drop unnecessary info messages and move useful one to debug (Sam Ravnborg).

 drivers/gpu/drm/panel/Kconfig  |  12 +
 drivers/gpu/drm/panel/Makefile |   1 +
 drivers/gpu/drm/panel/panel-himax-hx8394.c | 446 +
 3 files changed, 459 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-himax-hx8394.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 737edcdf9eef..7ee9c83f09a7 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -154,6 +154,18 @@ config DRM_PANEL_FEIYANG_FY07024DI26A30D
  Say Y if you want to enable support for panels based on the
  Feiyang FY07024DI26A30-D MIPI-DSI interface.
 
+config DRM_PANEL_HIMAX_HX8394
+   tristate "HIMAX HX8394 MIPI-DSI LCD panels"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y if you want to enable support for panels based on the
+ Himax HX8394 controller, such as the HannStar HSD060BHW4
+ 720x1440 TFT LCD panel that uses a MIPI-DSI interface.
+
+ If M is selected the module will be called panel-himax-hx8394.
+
 config DRM_PANEL_ILITEK_IL9322
tristate "Ilitek ILI9322 320x240 QVGA panels"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f8f9d9f6a307..84c01adafd4c 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_DRM_PANEL_EBBG_FT8719) += panel-ebbg-ft8719.o
 obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
 obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o
 obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += 
panel-feiyang-fy07024di26a30d.o
+obj-$(CONFIG_DRM_PANEL_HIMAX_HX8394) += panel-himax-hx8394.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
diff --git a/drivers/gpu/drm/panel/panel-himax-hx8394.c 
b/drivers/gpu/drm/panel/panel-himax-hx8394.c
new file mode 100644
index ..fc7a2c299f8d
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-himax-hx8394.c
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for panels based on Himax HX8394 controller, such as:
+ *
+ * - HannStar HSD060BHW4 5.99" MIPI-DSI panel
+ *
+ * Copyright (C) 2021 Kamil Trzciński
+ *
+ * Based on drivers/gpu/drm/panel/panel-sitronix-st7703.c
+ * Copyright (C) Purism SPC 2019
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#define DRV_NAME "panel-himax-hx8394"
+
+/* Manufacturer specific commands sent via DSI, listed in HX8394-F datasheet */
+#define HX8394_CMD_SETSEQUENCE   0xb0
+#define HX8394_CMD_SETPOWER  0xb1
+#define HX8394_CMD_SETDISP   0xb2
+#define HX8394_CMD_SETCYC0xb4
+#define HX8394_CMD_SETVCOM   0xb6
+#define HX8394_CMD_SETTE 0xb7
+#define HX8394_CMD_SETSENSOR 0xb8
+#define HX8394_CMD_SETEXTC   0xb9
+#define HX8394_CMD_SETMIPI   0xba
+#define HX8394_CMD_SETOTP0xbb
+#define HX8394_CMD_SETREGBANK0xbd
+#define HX8394_CMD_UNKNOWN1  0xc0
+#define HX8394_CMD_SETDGCLUT 0xc1
+#define HX8394_CMD_SETID 0xc3
+#define HX8394_CMD_SETDDB0xc4
+#define HX8394_CMD_UNKNOWN2  0xc6
+#define HX8394_CMD_SETCABC   0xc9
+#define HX8394_CMD_SETCABCGAIN   0xca
+#define HX8394_CMD_SETPANEL  0xcc
+#define HX8394_CMD_SETOFFSET 0xd2
+#define HX8394_CMD_SETGIP0   0xd3
+#define HX8394_CMD_UNKNOWN3  0xd4
+#define HX8394_CMD_SETGIP1   0xd5
+#define HX8394_CMD_SETGIP2   0xd6
+#define HX8394_CMD_SETGPO0xd6
+#define HX8394_CMD_SETSCALING0xdd
+#define HX8394_CMD_SETIDLE   0xdf
+#define HX8394_CMD_SETGAMMA  0xe0
+#define HX8394_CMD_SETCHEMODE_DYN 0xe4
+#define HX8394_CMD_SETCHE0xe5
+#define HX8394_CMD_SETCESEL  0xe6
+#define HX8394_CMD_SET_SP_CMD0xe9
+#define HX8394_CMD_SETREADINDEX  0xfe
+#define HX8394_CMD_GETSPIREAD0xff
+
+struct hx8394 {
+   struct device *dev;
+   struct drm_panel panel;
+   struct gpio_desc *reset_gpio;
+   struct regulator *vcc;
+   struct regulator *iovcc;
+   bool prepared;
+
+   const struct hx8394_panel_desc *des

Re: [PATCH v6 6/7] dt/bindings: drm/bridge: it6505: Add mode-switch support

2022-12-26 Thread Pin-yen Lin
Hi Krzysztof,

On Mon, Nov 28, 2022 at 5:02 AM Krzysztof Kozlowski
 wrote:
>
> On 24/11/2022 11:20, Pin-yen Lin wrote:
> > ITE IT6505 can be used in systems to switch the DP traffic between
> > two downstreams, which can be USB Type-C DisplayPort alternate mode
> > lane or regular DisplayPort output ports.
> >
> > Update the binding to accommodate this usage by introducing a
> > data-lanes and a mode-switch property on endpoints.
> >
> > Signed-off-by: Pin-yen Lin 
> >
> > ---
> >
> > Changes in v6:
> > - Remove switches node and use endpoints and data-lanes property to
> >   describe the connections.
> >
> >  .../bindings/display/bridge/ite,it6505.yaml   | 94 ++-
> >  1 file changed, 90 insertions(+), 4 deletions(-)
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml 
> > b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
> > index 833d11b2303a..b4b9881c7759 100644
> > --- a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
> > +++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
> > @@ -52,9 +52,53 @@ properties:
> >  maxItems: 1
> >  description: extcon specifier for the Power Delivery
> >
> > -  port:
> > -$ref: /schemas/graph.yaml#/properties/port
> > -description: A port node pointing to DPI host port node
> > +  data-lanes:
> > +maxItems: 1
> > +description: restrict the dp output data-lanes with value of 1-4
>
> Hm, where is the definition of this type? For example it comes with
> video-interfaces, which you did not reference here.
>
Actually I messed up here with another accepted patch:
https://lore.kernel.org/all/20221103091243.96036-2-allen.c...@ite.com.tw/

This and the next new property have been added in that patch.
> > +
> > +  max-pixel-clock-khz:
>
> There is no such unit accepted:
> https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml
>
> > +maxItems: 1
>
> maxItems of what type? What is this?
>
> > +description: restrict max pixel clock
> > +
> > +  ports:
> > +$ref: /schemas/graph.yaml#/properties/ports
>
> This is incompatible change... how do you handle now ABI break?
>
This is also added in another patch, and currently we don't have any
upstream it6505 users now.
> > +
> > +properties:
> > +  port@0:
> > +$ref: /schemas/graph.yaml#/$defs/port-base
>
> Why changing the ref?

The `unevaluatedProperties: false` in
`/schemas/graph.yaml#/properties/port` does not allow me to add new
properties here.
>
> > +unevaluatedProperties: false
> > +description: A port node pointing to DPI host port node
> > +
> > +  port@1:
> > +$ref: /schemas/graph.yaml#/properties/port-base
> > +description:
> > +  Video port for panel or connector.
> > +
> > +patternProperties:
> > +  "^endpoint@[01]$":
> > +$ref: /schemas/media/video-interfaces.yaml#
> > +type: object
> > +unevaluatedProperties: false
> > +
> > +properties:
> > +  reg:
> > +maxItems: 1
> > +
> > +  remote-endpoint: true
> > +
> > +  data-lanes:
> > +minItems: 1
> > +uniqueItems: true
> > +items:
> > +  - enum: [ 0, 1, 2, 3]
>
> Same problem as your previouspatch.
>
> > +
> > +  mode-switch:
> > +type: boolean
> > +description: Register this node as a Type-C mode switch or 
> > not.
> > +
> > + required:
> > +- reg
> > +   - remote-endpoint
> >
> >  required:
> >- compatible
> > @@ -62,7 +106,7 @@ required:
> >- pwr18-supply
> >- interrupts
> >- reset-gpios
> > -  - extcon
> > +  - ports
> >
> >  additionalProperties: false
> >
> > @@ -92,3 +136,45 @@ examples:
> >  };
> >  };
> >  };
> > +  - |
> > +#include 
> > +
> > +&i2c3 {
> > +clock-frequency = <10>;
> > +
> > +it6505dptx: it6505dptx@5c {
>
> Node names should be generic.
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
>
I'll fix this in v7.
> > +compatible = "ite,it6505";
> > +interrupts = <8 IRQ_TYPE_LEVEL_LOW 8 0>;
> > +reg = <0x5c>;
> > +pinctrl-names = "default";
> > +pinctrl-0 = <&it6505_pins>;
> > +ovdd-supply = <&mt6366_vsim2_reg>;
> > +pwr18-supply = <&pp1800_dpbrdg_dx>;
> > +reset-gpios = <&pio 177 0>;
> > +hpd-gpios = <&pio 10 0>;
> > +
> > +ports {
> > +#address-cells = <1>;
> > +#size-cells = <0>;
> > +port@0 {
> > +reg = <0>;
> > +it6505_in: endpoint {
> > +remote-endpoint = <&dpi_out>;
> > +};
> > +

Re: [PATCH v6 3/7] dt-bindings: drm/bridge: anx7625: Add mode-switch support

2022-12-26 Thread Pin-yen Lin
Hi Krzysztof,

Thanks for the review.

On Mon, Nov 28, 2022 at 4:58 AM Krzysztof Kozlowski
 wrote:
>
> On 24/11/2022 11:20, Pin-yen Lin wrote:
> > Analogix 7625 can be used in systems to switch the DP traffic between
> > two downstreams, which can be USB Type-C DisplayPort alternate mode
> > lane or regular DisplayPort output ports.
> >
> > Update the binding to accommodate this usage by introducing a
> > data-lanes and a mode-switch property on endpoints.
> >
> > Also include the link to the product brief in the bindings.
> >
> > Signed-off-by: Pin-yen Lin 
> >
> > ---
> >
> > Changes in v6:
> > - Remove switches node and use endpoints and data-lanes property to
> >   describe the connections.
>
> Except missing testing few things...
>
> >
> >  .../display/bridge/analogix,anx7625.yaml  | 73 ++-
> >  1 file changed, 71 insertions(+), 2 deletions(-)
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml 
> > b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
> > index 4590186c4a0b..5fdbf1f3bab8 100644
> > --- a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
> > +++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
> > @@ -12,7 +12,8 @@ maintainers:
> >
> >  description: |
> >The ANX7625 is an ultra-low power 4K Mobile HD Transmitter
> > -  designed for portable devices.
> > +  designed for portable devices. Product brief is available at
> > +  
> > https://www.analogix.com/en/system/files/AA-002291-PB-6-ANX7625_ProductBrief.pdf
> >
> >  properties:
> >compatible:
> > @@ -112,10 +113,36 @@ properties:
> >data-lanes: true
> >
> >port@1:
> > -$ref: /schemas/graph.yaml#/properties/port
> > +$ref: /schemas/graph.yaml#/properties/port-base
>
> I don't understand why you are changing this line.

Without this change, the `unevaluatedProperties: false` in
`/schemas/graph.yaml#/properties/port` does not allow me to add new
properties.
>
> >  description:
> >Video port for panel or connector.
> >
> > +patternProperties:
> > +  "^endpoint@[01]$":
> > +$ref: /schemas/media/video-interfaces.yaml#
> > +type: object
> > +unevaluatedProperties: false
> > +
> > +properties:
> > +  reg:
> > +maxItems: 1
> > +
> > +  remote-endpoint: true
> > +
> > +  data-lanes:
> > +minItems: 1
> > +uniqueItems: true
>
> These are confusing... you allow only one item, so why minItems and
> uniqueItems?

What I want to use is something like:
```
items:
  enum: [0,1, 2, 3]
```
That is, all the items should be an integer between 0 and 3. I'll
update this to a stricter version in v7.
>
> > +items:
> > +  - enum: [ 0, 1, 2, 3]
> > +
> > +  mode-switch:
> > +type: boolean
> > +description: Register this node as a Type-C mode switch or 
> > not.
> > +
> > +required:
> > +  - reg
> > +  - remote-endpoint
> > +
> >  required:
> >- port@0
> >- port@1
> > @@ -186,3 +213,45 @@ examples:
> >  };
> >  };
> >  };
> > +  - |
> > +&i2c3 {
> > + anx_bridge_dp: anx7625-dp@58 {
>
> Messed up indentation.
I'll fix this in the next version.
>
> > + compatible = "analogix,anx7625
>
> Node names should be generic.
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
I'll update this in v7.
>
> ";
> > + reg = <0x58>;
>
> Best regards,
> Krzysztof
>

Best regards,
Pin-yen


[PATCH v2] drm/i915: dell wyse 3040 shutdown fix

2022-12-26 Thread Alexey Lukyanchuk
dell wyse 3040 doesn't peform poweroff properly, but instead remains in 
turned power on state. Additional mutex_lock and 
intel_crtc_wait_for_next_vblank 
feature 6.2 kernel resolve this trouble.

cc: sta...@vger.kernel.org
original commit Link: https://patchwork.freedesktop.org/patch/508926/
fixes: fe0f1e3bfdfeb53e18f1206aea4f40b9bd1f291c
Signed-off-by: Alexey Lukyanchuk 
---
I got some troubles with this device (dell wyse 3040) since kernel 5.11
started to use i915_driver_shutdown function. I found solution here:

https://lore.kernel.org/dri-devel/y1wd6zj8ldjpc...@intel.com/#r

---
 drivers/gpu/drm/i915/display/intel_audio.c | 37 +++---
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_audio.c 
b/drivers/gpu/drm/i915/display/intel_audio.c
index aacbc6da8..44344ecdf 100644
--- a/drivers/gpu/drm/i915/display/intel_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_audio.c
@@ -336,6 +336,7 @@ static void g4x_audio_codec_disable(struct intel_encoder 
*encoder,
const struct drm_connector_state 
*old_conn_state)
 {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+   struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
u32 eldv, tmp;
 
tmp = intel_de_read(dev_priv, G4X_AUD_VID_DID);
@@ -348,6 +349,9 @@ static void g4x_audio_codec_disable(struct intel_encoder 
*encoder,
tmp = intel_de_read(dev_priv, G4X_AUD_CNTL_ST);
tmp &= ~eldv;
intel_de_write(dev_priv, G4X_AUD_CNTL_ST, tmp);
+
+   intel_crtc_wait_for_next_vblank(crtc);
+   intel_crtc_wait_for_next_vblank(crtc);
 }
 
 static void g4x_audio_codec_enable(struct intel_encoder *encoder,
@@ -355,12 +359,15 @@ static void g4x_audio_codec_enable(struct intel_encoder 
*encoder,
   const struct drm_connector_state *conn_state)
 {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+   struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_connector *connector = conn_state->connector;
const u8 *eld = connector->eld;
u32 eldv;
u32 tmp;
int len, i;
 
+   intel_crtc_wait_for_next_vblank(crtc);
+
tmp = intel_de_read(dev_priv, G4X_AUD_VID_DID);
if (tmp == INTEL_AUDIO_DEVBLC || tmp == INTEL_AUDIO_DEVCL)
eldv = G4X_ELDV_DEVCL_DEVBLC;
@@ -493,6 +500,7 @@ static void hsw_audio_codec_disable(struct intel_encoder 
*encoder,
const struct drm_connector_state 
*old_conn_state)
 {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+   struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;
u32 tmp;
 
@@ -508,6 +516,10 @@ static void hsw_audio_codec_disable(struct intel_encoder 
*encoder,
tmp |= AUD_CONFIG_N_VALUE_INDEX;
intel_de_write(dev_priv, HSW_AUD_CFG(cpu_transcoder), tmp);
 
+
+   intel_crtc_wait_for_next_vblank(crtc);
+   intel_crtc_wait_for_next_vblank(crtc);
+
/* Invalidate ELD */
tmp = intel_de_read(dev_priv, HSW_AUD_PIN_ELD_CP_VLD);
tmp &= ~AUDIO_ELD_VALID(cpu_transcoder);
@@ -633,6 +645,7 @@ static void hsw_audio_codec_enable(struct intel_encoder 
*encoder,
   const struct drm_connector_state *conn_state)
 {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+   struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct drm_connector *connector = conn_state->connector;
enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
const u8 *eld = connector->eld;
@@ -651,12 +664,7 @@ static void hsw_audio_codec_enable(struct intel_encoder 
*encoder,
tmp &= ~AUDIO_ELD_VALID(cpu_transcoder);
intel_de_write(dev_priv, HSW_AUD_PIN_ELD_CP_VLD, tmp);
 
-   /*
-* FIXME: We're supposed to wait for vblank here, but we have vblanks
-* disabled during the mode set. The proper fix would be to push the
-* rest of the setup into a vblank work item, queued here, but the
-* infrastructure is not there yet.
-*/
+   intel_crtc_wait_for_next_vblank(crtc);
 
/* Reset ELD write address */
tmp = intel_de_read(dev_priv, HSW_AUD_DIP_ELD_CTRL(cpu_transcoder));
@@ -705,6 +713,8 @@ static void ilk_audio_codec_disable(struct intel_encoder 
*encoder,
aud_cntrl_st2 = CPT_AUD_CNTRL_ST2;
}
 
+   mutex_lock(&dev_priv->display.audio.mutex);
+
/* Disable timestamps */
tmp = intel_de_read(dev_priv, aud_config);
tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
@@ -721,6 +731,10 @@ static void ilk_audio_codec_disable(struct intel_encoder 
*encoder,
tmp = intel_de_read(dev_priv, aud_cntrl_st2);
tmp &= ~eldv;
intel_de_write(dev_priv, aud_cntrl

[PATCH] drm/amd/display: fix array-bounds errors in dc_stream_remove_writeback()

2022-12-26 Thread wenyang . linux
From: Wen Yang 

The following errors occurred when using gcc 7.5.0-3ubuntu1~18.04:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function 
‘dc_stream_remove_writeback’:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:543:55: warning: 
array subscript is above array bounds [-Warray-bounds]
 stream->writeback_info[j] = stream->writeback_info[i];
 ~~^~~
Add a check to make sure that num_wb_info won't overflowing the writeback_info 
buffer.

Fixes: 6fbefb84a98e ("drm/amd/display: Add DC core changes for DCN2")

Signed-off-by: Wen Yang 
Cc: Aurabindo Pillai 
Cc: Hamza Mahfooz 
Cc: Guenter Roeck 
Cc: Alex Deucher 
Cc: Harry Wentland 
Cc: Leo Li 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index 20e534f73513..9825c30f2ca0 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -481,6 +481,7 @@ bool dc_stream_add_writeback(struct dc *dc,
}
 
if (!isDrc) {
+   ASSERT(stream->num_wb_info + 1 <= MAX_DWB_PIPES);
stream->writeback_info[stream->num_wb_info++] = *wb_info;
}
 
@@ -526,6 +527,11 @@ bool dc_stream_remove_writeback(struct dc *dc,
return false;
}
 
+   if (stream->num_wb_info > MAX_DWB_PIPES) {
+   dm_error("DC: num_wb_info is invalid!\n");
+   return false;
+   }
+
 // stream->writeback_info[dwb_pipe_inst].wb_enabled = false;
for (i = 0; i < stream->num_wb_info; i++) {
/*dynamic update*/
@@ -540,7 +546,8 @@ bool dc_stream_remove_writeback(struct dc *dc,
if (stream->writeback_info[i].wb_enabled) {
if (j < i)
/* trim the array */
-   stream->writeback_info[j] = 
stream->writeback_info[i];
+   memcpy(&stream->writeback_info[j], 
&stream->writeback_info[i],
+   sizeof(struct 
dc_writeback_info));
j++;
}
}
-- 
2.25.1