Re: [PATCH 2/2] dt-bindings: leds: backlight: add binding for Kinetic KTZ8866 backlight

2022-12-21 Thread Krzysztof Kozlowski
On 21/12/2022 08:02, Jianhua Lu wrote:
> Add device tree bindings for the Kinetic KTZ8866 backlight driver.

1. Your patches are not properly threaded which makes it difficult to
review and handle them. Resend with proper threads.

2. Subject: drop second, redundant "binding for".

> 
> Signed-off-by: Jianhua Lu 
> ---
>  .../leds/backlight/kinetic,ktz8866.yaml   | 37 +++
>  1 file changed, 37 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml 
> b/Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml
> new file mode 100644
> index ..7286c3fc7f5d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml
> @@ -0,0 +1,37 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/leds/backlight/kinetic,ktz8866.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Kinetic Technologies KTZ8866 backlight
> +
> +maintainers:
> +  - Jianhua Lu 
> +
> +description: |
> +  The Kinetic Technologies KTZ8866 is a high efficiency 6-sinks led backlight
> +  with dual lcd bias power.
> +  https://www.kinet-ic.com/ktz8866/
> +
> +allOf:
> +  - $ref: common.yaml#
> +
> +properties:
> +  compatible:
> +items:
> +  const: kinetic,ktz8866

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

> +
> +required:
> +  - compatible
> +
> +additionalProperties: false

This should be rather unevaluatedProperties: false, otherwise you do not
allow any other properties, except compatible. Was this the intention?

Best regards,
Krzysztof



Re: [PATCH v4 1/7] accel/ivpu: Introduce a new DRM driver for Intel VPU

2022-12-21 Thread Jacek Lawrynowicz
Hi,

On 20.12.2022 21:17, Oded Gabbay wrote:
> On Thu, Dec 8, 2022 at 1:08 PM Jacek Lawrynowicz
>  wrote:
>>
>> VPU stands for Versatile Processing Unit and it's a CPU-integrated
>> inference accelerator for Computer Vision and Deep Learning
>> applications.
>>
>> The VPU device consist of following components:
>>   - Buttress - provides CPU to VPU integration, interrupt, frequency and
>> power management.
>>   - Memory Management Unit (based on ARM MMU-600) - translates VPU to
>> host DMA addresses, isolates user workloads.
>>   - RISC based microcontroller - executes firmware that provides job
>> execution API for the kernel-mode driver
>>   - Neural Compute Subsystem (NCS) - does the actual work, provides
>> Compute and Copy engines.
>>   - Network on Chip (NoC) - network fabric connecting all the components
>>
>> This driver supports VPU IP v2.7 integrated into Intel Meteor Lake
>> client CPUs (14th generation).
>>
>> Module sources are at drivers/accel/ivpu and module name is
>> "intel_vpu.ko".
>>
>> This patch includes only very besic functionality:
>>   - module, PCI device and IRQ initialization
>>   - register definitions and low level register manipulation functions
>>   - SET/GET_PARAM ioctls
>>   - power up without firmware
>>
>> Co-developed-by: Krystian Pradzynski 
>> Signed-off-by: Krystian Pradzynski 
>> Signed-off-by: Jacek Lawrynowicz 
>> ---
>>  MAINTAINERS  |9 +
>>  drivers/Makefile |1 +
>>  drivers/accel/Kconfig|2 +
>>  drivers/accel/Makefile   |3 +
>>  drivers/accel/ivpu/Kconfig   |   15 +
>>  drivers/accel/ivpu/Makefile  |8 +
>>  drivers/accel/ivpu/TODO  |7 +
>>  drivers/accel/ivpu/ivpu_drv.c|  359 +
>>  drivers/accel/ivpu/ivpu_drv.h|  162 
>>  drivers/accel/ivpu/ivpu_hw.h |  170 +
>>  drivers/accel/ivpu/ivpu_hw_mtl.c | 1048 ++
>>  drivers/accel/ivpu/ivpu_hw_mtl_reg.h |  280 +++
>>  drivers/accel/ivpu/ivpu_hw_reg_io.h  |  115 +++
>>  include/uapi/drm/ivpu_drm.h  |   95 +++
>>  14 files changed, 2274 insertions(+)
> 
> Another thing I would like to ask you to do is to rename ivpu_drm.h to
> ivpu_accel.h to make it clear this is an accel uapi file and not a
> classic drm driver uapi file.
> i.e. to make it clear it exposes the accel device char nodes, sysfs, etc.
> 
> But leave it in include/uapi/drm, because we might still need drm.h
> down the road.
> 

Sure, I will rename it.

Regards,
Jacek



[PATCH 07/10] drm: Remove usage of deprecated DRM_DEBUG_KMS

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_DEBUG_KMS is deprecated in favor of
drm_dbg_kms().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_client_modeset.c   | 112 ++---
 drivers/gpu/drm/drm_color_mgmt.c   |   4 +-
 drivers/gpu/drm/drm_connector.c|  21 ++---
 drivers/gpu/drm/drm_crtc.c |  36 
 drivers/gpu/drm/drm_crtc_helper.c  |  54 ++--
 drivers/gpu/drm/drm_debugfs_crc.c  |   5 +-
 drivers/gpu/drm/drm_displayid.c|   4 +-
 drivers/gpu/drm/drm_edid.c |  17 ++--
 drivers/gpu/drm/drm_gem_shmem_helper.c |   4 +-
 drivers/gpu/drm/drm_lease.c|   2 +-
 drivers/gpu/drm/drm_mipi_dbi.c |   7 +-
 drivers/gpu/drm/drm_modes.c|  10 +--
 drivers/gpu/drm/drm_plane.c|  32 +++
 drivers/gpu/drm/drm_probe_helper.c |  39 -
 drivers/gpu/drm/drm_rect.c |   4 +-
 drivers/gpu/drm/drm_sysfs.c|   8 +-
 16 files changed, 189 insertions(+), 170 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index c4517dea924e..7c1e8352ff71 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -246,8 +246,9 @@ static void drm_client_connectors_enabled(struct 
drm_connector **connectors,
for (i = 0; i < connector_count; i++) {
connector = connectors[i];
enabled[i] = drm_connector_enabled(connector, true);
-   DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
- connector->display_info.non_desktop ? "non 
desktop" : str_yes_no(enabled[i]));
+   drm_dbg_kms(connector->dev, "connector %d enabled? %s\n",
+   connector->base.id,
+   connector->display_info.non_desktop ? "non desktop" 
: str_yes_no(enabled[i]));
 
any_enabled |= enabled[i];
}
@@ -307,7 +308,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
}
 
if (can_clone) {
-   DRM_DEBUG_KMS("can clone using command line\n");
+   drm_dbg_kms(dev, "can clone using command line\n");
return true;
}
 
@@ -332,7 +333,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
}
 
if (can_clone) {
-   DRM_DEBUG_KMS("can clone using 1024x768\n");
+   drm_dbg_kms(dev, "can clone using 1024x768\n");
return true;
}
drm_info(dev, "kms: can't enable cloning when we probably wanted 
to.\n");
@@ -356,8 +357,9 @@ static int drm_client_get_tile_offsets(struct drm_connector 
**connectors,
continue;
 
if (!modes[i] && (h_idx || v_idx)) {
-   DRM_DEBUG_KMS("no modes for connector tiled %d %d\n", i,
- connector->base.id);
+   drm_dbg_kms(connector->dev,
+   "no modes for connector tiled %d %d\n",
+   i, connector->base.id);
continue;
}
if (connector->tile_h_loc < h_idx)
@@ -368,7 +370,8 @@ static int drm_client_get_tile_offsets(struct drm_connector 
**connectors,
}
offsets[idx].x = hoffset;
offsets[idx].y = voffset;
-   DRM_DEBUG_KMS("returned %d %d for %d %d\n", hoffset, voffset, h_idx, 
v_idx);
+   drm_dbg_kms(NULL, "returned %d %d for %d %d\n",
+   hoffset, voffset, h_idx, v_idx);
return 0;
 }
 
@@ -425,14 +428,16 @@ static bool drm_client_target_preferred(struct 
drm_connector **connectors,
drm_client_get_tile_offsets(connectors, 
connector_count, modes, offsets, i,
connector->tile_h_loc, 
connector->tile_v_loc);
}
-   DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
- connector->base.id);
+   drm_dbg_kms(connector->dev,
+   "looking for cmdline mode on connector %d\n",
+   connector->base.id);
 
/* got for command line mode first */
modes[i] = drm_connector_pick_cmdline_mode(connector);
if (!modes[i]) {
-   DRM_DEBUG_KMS("looking for preferred mode on connector 
%d %d\n",
- connector->base.id, connector->tile_group 
? connector->tile_group->id : 0);
+   drm_dbg_kms(connector->dev,
+   "looking for preferred mode on connector %d 
%d\n",
+   connector->base.id, connector->tile_group ? 
connector->tile_group->id : 0);
modes[i] = drm_connector_has_preferred_mode(connector, 
width, height);
}
/* No preferred modes

[PATCH 08/10] drm: Remove usage of deprecated DRM_DEBUG_PRIME

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_DEBUG_PRIME is deprecated in favor of
drm_dbg_prime().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_gem_dma_helper.c   | 4 ++--
 drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c 
b/drivers/gpu/drm/drm_gem_dma_helper.c
index 1ba551b0ab97..0f903cc8914a 100644
--- a/drivers/gpu/drm/drm_gem_dma_helper.c
+++ b/drivers/gpu/drm/drm_gem_dma_helper.c
@@ -477,8 +477,8 @@ drm_gem_dma_prime_import_sg_table(struct drm_device *dev,
dma_obj->dma_addr = sg_dma_address(sgt->sgl);
dma_obj->sgt = sgt;
 
-   DRM_DEBUG_PRIME("dma_addr = %pad, size = %zu\n", &dma_obj->dma_addr,
-   attach->dmabuf->size);
+   drm_dbg_prime(dev, "dma_addr = %pad, size = %zu\n", &dma_obj->dma_addr,
+ attach->dmabuf->size);
 
return &dma_obj->base;
 }
diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c 
b/drivers/gpu/drm/drm_gem_shmem_helper.c
index f0b6b69f4baf..1b9a6b357d8a 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -764,7 +764,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev,
 
shmem->sgt = sgt;
 
-   DRM_DEBUG_PRIME("size = %zu\n", size);
+   drm_dbg_prime(dev, "size = %zu\n", size);
 
return &shmem->base;
 }
-- 
2.35.1




Re: [PATCH v6 5/5] drm/tidss: Enable Dual and Duplicate Modes for OLDI

2022-12-21 Thread Tomi Valkeinen

On 19/11/2022 19:30, Aradhya Bhatia wrote:

The AM625 DSS IP contains 2 OLDI TXes which can work together to enable 2
cloned displays of or even a single dual-link display with higher
resolutions like WUXGA (1920x1200@60fps) with a reduced OLDI clock
frequency.

Configure the necessary register to enable and disable the OLDI TXes
with required modes configurations.

Signed-off-by: Aradhya Bhatia 
---
  drivers/gpu/drm/tidss/tidss_dispc.c | 24 ++--
  1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c 
b/drivers/gpu/drm/tidss/tidss_dispc.c
index f26129fb1d8f..cf43de6216a5 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -1012,8 +1012,8 @@ static void dispc_enable_oldi(struct dispc_device *dispc, 
u32 hw_videoport,
int count = 0;
  
  	/*

-* For the moment DUALMODESYNC, MASTERSLAVE, MODE, and SRC
-* bits of DISPC_VP_DSS_OLDI_CFG are set statically to 0.
+* For the moment MASTERSLAVE, and SRC bits of DISPC_VP_DSS_OLDI_CFG are
+* always set to 0.
 */
  
  	if (fmt->data_width == 24)

@@ -1030,6 +1030,26 @@ static void dispc_enable_oldi(struct dispc_device 
*dispc, u32 hw_videoport,
  
  	oldi_cfg |= BIT(0); /* ENABLE */
  
+	switch (dispc->oldi_mode) {

+   case OLDI_SINGLE_LINK_SINGLE_MODE:
+   /* All configuration is done for this mode.  */
+   break;
+
+   case OLDI_SINGLE_LINK_CLONE_MODE:
+   oldi_cfg |= BIT(5); /* CLONE MODE */
+   break;
+
+   case OLDI_DUAL_LINK_MODE:
+   oldi_cfg |= BIT(11); /* DUALMODESYNC */
+   oldi_cfg |= BIT(3); /* data-mapping field also indicates 
dual-link mode */
+   break;
+
+   default:
+   dev_warn(dispc->dev, "%s: Incorrect oldi mode. Returning.\n",
+__func__);
+   return;
+   }
+
dispc_vp_write(dispc, hw_videoport, DISPC_VP_DSS_OLDI_CFG, oldi_cfg);
  
  	while (!(oldi_reset_bit & dispc_read(dispc, DSS_SYSSTATUS)) &&


Reviewed-by: Tomi Valkeinen 

 Tomi



Re: [PATCH v6 2/5] drm/tidss: Add support for AM625 DSS

2022-12-21 Thread Tomi Valkeinen

Hi,

On 19/11/2022 19:30, Aradhya Bhatia wrote:

Add support for the DSS controller on TI's new AM625 SoC in the tidss
driver.

The first video port (VP0) in am625-dss can output OLDI signals through
2 OLDI TXes. A 3rd output port has been added with "DISPC_VP_OLDI" bus
type.

DSS controllers before AM625 had a 1 to 1 coupling between Videoports
and Output Ports. Since this stands no longer to be true for AM625 DSS,
this couppling has been separated with the introduction of output port
based variables. This will help address the addition of the 2nd OLDI TX
over VP0 as the 3rd output port.


This patch does three things:
- Renames "port" to "vp" where applicable
- Adds output ports
- Adds AM625

I think at least the AM625 parts should be a separate patch, but 
preferably all three would be separate patches.



Signed-off-by: Aradhya Bhatia 
---
  drivers/gpu/drm/tidss/tidss_dispc.c | 80 ++---
  drivers/gpu/drm/tidss/tidss_dispc.h | 15 --
  drivers/gpu/drm/tidss/tidss_drv.c   |  1 +
  drivers/gpu/drm/tidss/tidss_drv.h   |  5 +-
  drivers/gpu/drm/tidss/tidss_irq.h   |  2 +-
  drivers/gpu/drm/tidss/tidss_kms.c   |  2 +-
  6 files changed, 90 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c 
b/drivers/gpu/drm/tidss/tidss_dispc.c
index ad93acc9abd2..dbc6a5b617ca 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -93,10 +93,13 @@ const struct dispc_features dispc_k2g_feats = {
.common_regs = tidss_k2g_common_regs,
  
  	.num_vps = 1,

+   .num_output_ports = 1,
+   .oldi_supported = false,


I'd prefer "has_oldi", the style is used in other places too.


.vp_name = { "vp1" },
.ovr_name = { "ovr1" },
.vpclk_name =  { "vp1" },
.vp_bus_type = { DISPC_VP_DPI },
+   .output_port_bus_type = { DISPC_VP_DPI },


It would make sense to re-arrange these a bit, so that lines related to 
VPs are together, and lines related to output ports would be together.



.vp_feat = { .color = {
.has_ctm = true,
@@ -168,10 +171,13 @@ const struct dispc_features dispc_am65x_feats = {
.common_regs = tidss_am65x_common_regs,
  
  	.num_vps = 2,

+   .num_output_ports = 2,
+   .oldi_supported = true,
.vp_name = { "vp1", "vp2" },
.ovr_name = { "ovr1", "ovr2" },
.vpclk_name =  { "vp1", "vp2" },
.vp_bus_type = { DISPC_VP_OLDI, DISPC_VP_DPI },
+   .output_port_bus_type = { DISPC_VP_OLDI, DISPC_VP_DPI },
  
  	.vp_feat = { .color = {

.has_ctm = true,
@@ -257,12 +263,16 @@ const struct dispc_features dispc_j721e_feats = {
.common_regs = tidss_j721e_common_regs,
  
  	.num_vps = 4,

+   .num_output_ports = 4,
+   .oldi_supported = false,
.vp_name = { "vp1", "vp2", "vp3", "vp4" },
.ovr_name = { "ovr1", "ovr2", "ovr3", "ovr4" },
.vpclk_name = { "vp1", "vp2", "vp3", "vp4" },
/* Currently hard coded VP routing (see dispc_initial_config()) */
.vp_bus_type =  { DISPC_VP_INTERNAL, DISPC_VP_DPI,
  DISPC_VP_INTERNAL, DISPC_VP_DPI, },
+   .output_port_bus_type = { DISPC_VP_INTERNAL, DISPC_VP_DPI,
+ DISPC_VP_INTERNAL, DISPC_VP_DPI, },
.vp_feat = { .color = {
.has_ctm = true,
.gamma_size = 1024,
@@ -275,6 +285,59 @@ const struct dispc_features dispc_j721e_feats = {
.vid_order = { 1, 3, 0, 2 },
  };
  
+const struct dispc_features dispc_am625_feats = {

+   .max_pclk_khz = {
+   [DISPC_VP_DPI] = 165000,
+   [DISPC_VP_OLDI] = 165000,
+   },
+
+   .scaling = {
+   .in_width_max_5tap_rgb = 1280,
+   .in_width_max_3tap_rgb = 2560,
+   .in_width_max_5tap_yuv = 2560,
+   .in_width_max_3tap_yuv = 4096,
+   .upscale_limit = 16,
+   .downscale_limit_5tap = 4,
+   .downscale_limit_3tap = 2,
+   /*
+* The max supported pixel inc value is 255. The value
+* of pixel inc is calculated like this: 1+(xinc-1)*bpp.
+* The maximum bpp of all formats supported by the HW
+* is 8. So the maximum supported xinc value is 32,
+* because 1+(32-1)*8 < 255 < 1+(33-1)*4.
+*/
+   .xinc_max = 32,
+   },
+
+   .subrev = DISPC_AM625,
+
+   .common = "common",
+   .common_regs = tidss_am65x_common_regs,
+
+   .num_vps = 2,
+   /* note: the 3rd port is not representative of a 3rd pipeline */
+   .num_output_ports = 3,
+   .oldi_supported = true,
+   .vp_name = { "vp1", "vp2" },
+   .ovr_name = { "ovr1", "ovr2" },
+   .vpclk_name =  { "vp1", "vp2" },
+   .vp_bus_type = { DISPC_VP_OLDI, DISPC_VP_DPI },
+   .output_port_bus_type = { DISPC_VP_OLDI, DISPC_VP_DPI, DISPC_VP_OLDI },


Th

[PATCH 04/10] drm/print: Fix support for NULL as first argument of drm_dbg_*

2022-12-21 Thread Siddh Raman Pant
Comments say macros DRM_DEBUG_* are deprecated in favor of
drm_dbg_*(NULL, ...), but they have broken support for it,
as the macro will result in `(NULL) ? (NULL)->dev : NULL`.

Thus, fix them by casting input drm to a temporary struct ptr,
with the same convention as in __DRM_DEFINE_DBG_RATELIMITED.

Signed-off-by: Siddh Raman Pant 
---
 include/drm/drm_print.h | 89 -
 1 file changed, 69 insertions(+), 20 deletions(-)

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index a44fb7ef257f..53702d830291 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -486,26 +486,75 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct 
device *dev,
__drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
 
 
-#define drm_dbg_core(drm, fmt, ...)\
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
-#define drm_dbg_driver(drm, fmt, ...)  
\
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, 
##__VA_ARGS__)
-#define drm_dbg_kms(drm, fmt, ...) \
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
-#define drm_dbg_prime(drm, fmt, ...)   \
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
-#define drm_dbg_atomic(drm, fmt, ...)  \
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, 
##__VA_ARGS__)
-#define drm_dbg_vbl(drm, fmt, ...) \
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
-#define drm_dbg_state(drm, fmt, ...)   \
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
-#define drm_dbg_lease(drm, fmt, ...)   \
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
-#define drm_dbg_dp(drm, fmt, ...)  \
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
-#define drm_dbg_drmres(drm, fmt, ...)  \
-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, 
##__VA_ARGS__)
+#define drm_dbg_core(drm, fmt, ...)\
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_CORE,   \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_driver(drm, fmt, ...)  \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_DRIVER, \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_kms(drm, fmt, ...) \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_KMS,\
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_prime(drm, fmt, ...)   \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_PRIME,  \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_atomic(drm, fmt, ...)  \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_ATOMIC, \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_vbl(drm, fmt, ...) \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_VBL,\
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_state(drm, fmt, ...)   \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_STATE,  \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_lease(drm, fmt, ...)   \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_LEASE,  \
+   fmt, ##

[PATCH 03/10] drm: Remove usage of deprecated DRM_ERROR

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_ERROR is deprecated.
Thus, use newer printing macros drm_err() and pr_err().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_bridge.c |  8 
 drivers/gpu/drm/drm_bufs.c   |  8 
 drivers/gpu/drm/drm_client_modeset.c |  4 ++--
 drivers/gpu/drm/drm_context.c|  4 ++--
 drivers/gpu/drm/drm_crtc_helper.c|  8 
 drivers/gpu/drm/drm_debugfs_crc.c|  3 ++-
 drivers/gpu/drm/drm_drv.c| 16 
 drivers/gpu/drm/drm_flip_work.c  |  2 +-
 drivers/gpu/drm/drm_framebuffer.c|  3 ++-
 drivers/gpu/drm/drm_gem.c|  2 +-
 drivers/gpu/drm/drm_gem_dma_helper.c |  2 +-
 drivers/gpu/drm/drm_hashtab.c|  4 ++--
 drivers/gpu/drm/drm_lock.c   | 16 
 drivers/gpu/drm/drm_mipi_dbi.c   |  2 +-
 drivers/gpu/drm/drm_mm.c |  8 
 drivers/gpu/drm/drm_mode_config.c|  2 +-
 drivers/gpu/drm/drm_modeset_helper.c |  2 +-
 drivers/gpu/drm/drm_plane.c  |  2 +-
 drivers/gpu/drm/drm_scatter.c|  9 +
 drivers/gpu/drm/drm_vm.c |  2 +-
 20 files changed, 55 insertions(+), 52 deletions(-)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 1545c50fd1c8..20a8cde70640 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -312,11 +312,11 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct 
drm_bridge *bridge,
list_del(&bridge->chain_node);
 
 #ifdef CONFIG_OF
-   DRM_ERROR("failed to attach bridge %pOF to encoder %s: %d\n",
- bridge->of_node, encoder->name, ret);
+   drm_err(encoder->dev, "failed to attach bridge %pOF to encoder %s: 
%d\n",
+   bridge->of_node, encoder->name, ret);
 #else
-   DRM_ERROR("failed to attach bridge to encoder %s: %d\n",
- encoder->name, ret);
+   drm_err(encoder->dev, "failed to attach bridge to encoder %s: %d\n",
+   encoder->name, ret);
 #endif
 
return ret;
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index fcca21e8efac..98aaf3379a3b 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1474,15 +1474,15 @@ int drm_legacy_freebufs(struct drm_device *dev, void 
*data,
if (copy_from_user(&idx, &request->list[i], sizeof(idx)))
return -EFAULT;
if (idx < 0 || idx >= dma->buf_count) {
-   DRM_ERROR("Index %d (of %d max)\n",
- idx, dma->buf_count - 1);
+   drm_err(dev, "Index %d (of %d max)\n",
+   idx, dma->buf_count - 1);
return -EINVAL;
}
idx = array_index_nospec(idx, dma->buf_count);
buf = dma->buflist[idx];
if (buf->file_priv != file_priv) {
-   DRM_ERROR("Process %d freeing buffer not owned\n",
- task_pid_nr(current));
+   drm_err(dev, "Process %d freeing buffer not owned\n",
+   task_pid_nr(current));
return -EINVAL;
}
drm_legacy_free_buffer(dev, buf);
diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index 2b76d4828c5f..c4517dea924e 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -812,7 +812,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, 
unsigned int width,
offsets = kcalloc(connector_count, sizeof(*offsets), GFP_KERNEL);
enabled = kcalloc(connector_count, sizeof(bool), GFP_KERNEL);
if (!crtcs || !modes || !enabled || !offsets) {
-   DRM_ERROR("Memory allocation failed\n");
+   drm_err(client->dev, "Memory allocation failed\n");
ret = -ENOMEM;
goto out;
}
@@ -836,7 +836,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, 
unsigned int width,
  offsets, enabled, width, height) 
&&
!drm_client_target_preferred(connectors, connector_count, 
modes,
 offsets, enabled, width, 
height))
-   DRM_ERROR("Unable to find initial modes\n");
+   drm_err(client->dev, "Unable to find initial modes\n");
 
DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n",
  width, height);
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index c6e6a3e7219a..f6d68fad8311 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -276,7 +276,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void 
*data,
 static int drm_context_switch(struct drm_device * dev, int old, int new)
 {
if (test_and_set_bit(0

[PATCH 05/10] drm: Remove usage of deprecated DRM_DEBUG

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_DEBUG is deprecated in favor of drm_dbg_core().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_agpsupport.c  |   4 +-
 drivers/gpu/drm/drm_bufs.c| 114 +++---
 drivers/gpu/drm/drm_context.c |  14 ++--
 drivers/gpu/drm/drm_dma.c |  10 +--
 drivers/gpu/drm/drm_drv.c |  10 +--
 drivers/gpu/drm/drm_file.c|  18 ++---
 drivers/gpu/drm/drm_gem.c |   5 +-
 drivers/gpu/drm/drm_hashtab.c |   6 +-
 drivers/gpu/drm/drm_ioc32.c   |  13 ++--
 drivers/gpu/drm/drm_ioctl.c   |  24 +++
 drivers/gpu/drm/drm_irq.c |   4 +-
 drivers/gpu/drm/drm_lease.c   |   2 +-
 drivers/gpu/drm/drm_legacy_misc.c |   4 +-
 drivers/gpu/drm/drm_lock.c|  20 +++---
 drivers/gpu/drm/drm_mode_object.c |   6 +-
 drivers/gpu/drm/drm_pci.c |  12 ++--
 drivers/gpu/drm/drm_plane.c   |  12 ++--
 drivers/gpu/drm/drm_scatter.c |  10 +--
 drivers/gpu/drm/drm_syncobj.c |   2 +-
 drivers/gpu/drm/drm_sysfs.c   |  14 ++--
 drivers/gpu/drm/drm_vm.c  |  43 ++-
 21 files changed, 178 insertions(+), 169 deletions(-)

diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index a4ad6fd13abc..d27686d6e82d 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -315,8 +315,8 @@ int drm_legacy_agp_bind(struct drm_device *dev, struct 
drm_agp_binding *request)
if (retcode)
return retcode;
entry->bound = dev->agp->base + (page << PAGE_SHIFT);
-   DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
- dev->agp->base, entry->bound);
+   drm_dbg_core(dev, "base = 0x%lx entry->bound = 0x%lx\n",
+dev->agp->base, entry->bound);
return 0;
 }
 EXPORT_SYMBOL(drm_legacy_agp_bind);
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 98aaf3379a3b..feedd7c6f0d5 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -171,8 +171,8 @@ static int drm_addmap_core(struct drm_device *dev, 
resource_size_t offset,
kfree(map);
return -EINVAL;
}
-   DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
- (unsigned long long)map->offset, map->size, map->type);
+   drm_dbg_core(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
+(unsigned long long)map->offset, map->size, map->type);
 
/* page-align _DRM_SHM maps. They are allocated here so there is no 
security
 * hole created by that and it works around various broken drivers that 
use
@@ -205,10 +205,10 @@ static int drm_addmap_core(struct drm_device *dev, 
resource_size_t offset,
list = drm_find_matching_map(dev, map);
if (list != NULL) {
if (list->map->size != map->size) {
-   DRM_DEBUG("Matching maps of type %d with "
- "mismatched sizes, (%ld vs %ld)\n",
- map->type, map->size,
- list->map->size);
+   drm_dbg_core(dev, "Matching maps of type %d 
with "
+"mismatched sizes, (%ld vs %ld)\n",
+map->type, map->size,
+list->map->size);
list->map->size = map->size;
}
 
@@ -239,9 +239,9 @@ static int drm_addmap_core(struct drm_device *dev, 
resource_size_t offset,
list = drm_find_matching_map(dev, map);
if (list != NULL) {
if (list->map->size != map->size) {
-   DRM_DEBUG("Matching maps of type %d with "
- "mismatched sizes, (%ld vs %ld)\n",
- map->type, map->size, 
list->map->size);
+   drm_dbg_core(dev, "Matching maps of type %d 
with "
+"mismatched sizes, (%ld vs %ld)\n",
+map->type, map->size, 
list->map->size);
list->map->size = map->size;
}
 
@@ -250,8 +250,8 @@ static int drm_addmap_core(struct drm_device *dev, 
resource_size_t offset,
return 0;
}
map->handle = vmalloc_user(map->size);
-   DRM_DEBUG("%lu %d %p\n",
- map->size, order_base_2(map->size), map->handle);
+   drm_dbg_core(dev, "%lu %d %p\n",
+map->size, order_base_2(map->size), map->handle);
if (!map->handle) {
kfree(map);
return -ENOMEM;
@@ -308,8 +308,8 @@ static int drm_addmap_core(st

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

2022-12-21 Thread Tomi Valkeinen

On 20/12/2022 16:24, Laurent Pinchart wrote:

Hi Tomi,

On Tue, Dec 20, 2022 at 04:12:29PM +0200, Tomi Valkeinen wrote:

On 19/12/2022 21:10, Laurent Pinchart wrote:

On Mon, Dec 19, 2022 at 04:01:33PM +0200, Tomi Valkeinen wrote:

Add XBGR2101010, ABGR2101010 and BGRA1010102 formats.

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..de78cd2dcd73 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-XBGR2101010:
+
+  - ``V4L2_PIX_FMT_XBGR2101010``
+  - '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`
+  -


This doesn't match the text above. This would be RGBX2101010. I'm not
sure which format you want, so I don't know if it's the documentation or
the format name that is incorrect. The next two formats also seem
incorrect to me.


Right, the text should say big endian instead of little endian.


No, in big-endian format, you would have, for instance,
V4L2_PIX_FMT_XBGR2101010 defined as

[x, x, B[9:4]], [B[3:0], G[9:6]], [G[5:0], R[1:0]], [R[7:0]]

in memory byte order, while the format you want to define is

[B[5:0], x, x], [G[3:0], B[9:6]], [R[1:0], G[9:4]], [R[9:2]]


Yes, I see your point.


The issue here is that 10-bpp formats don't have an integer number of
bytes per component. They are thus more similar to the 16-bit RGB
formats, where the macro named defined the order in a 16-bit word, which
was then stored in little-endian format in memory. For 24-bit and 32-bit
formats, we departed from that rule by using the byte memory order in
the macro name. For 10-bpp RGB formats we can't do so anymore. The most
sensible option is thus, I think, to use the same naming scheme as the
16-bit RGB formats, which incidentaly matches the DRM naming scheme.


I agree. It wasn't quite clear to me if Hans agreed to that in the patch 
7 discussions, but as you say, maybe that's the only option that makes 
sense.


 Tomi



[PATCH 1/2] backlight: ktz8866: Add support for Kinetic KTZ8866 backlight

2022-12-21 Thread Jianhua Lu
Add support for Kinetic KTZ8866 backlight, which is used in
Xiaomi tablet, Mi Pad 5 series. This driver lightly based on
downstream implementation [1].
[1] 
https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/elish-r-oss/drivers/video/backlight/ktz8866.c

Signed-off-by: Jianhua Lu 
---
 drivers/video/backlight/Kconfig   |   8 ++
 drivers/video/backlight/Makefile  |   1 +
 drivers/video/backlight/ktz8866.c | 173 ++
 drivers/video/backlight/ktz8866.h |  31 ++
 4 files changed, 213 insertions(+)
 create mode 100644 drivers/video/backlight/ktz8866.c
 create mode 100644 drivers/video/backlight/ktz8866.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 936ba1e4d35e..2845fd7e33ad 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -190,6 +190,14 @@ config BACKLIGHT_KTD253
  which is a 1-wire GPIO-controlled backlight found in some mobile
  phones.
 
+config BACKLIGHT_KTZ8866
+   tristate "Backlight Driver for Kinetic KTZ8866"
+   depends on I2C
+   select REGMAP_I2C
+   help
+   Say Y to enabled the backlight driver for the Kinetic KTZ8866
+   found in Xiaomi Mi Pad 5 series.
+
 config BACKLIGHT_LM3533
tristate "Backlight Driver for LM3533"
depends on MFD_LM3533
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index e815f3f1deff..f70a819c304c 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o
 obj-$(CONFIG_BACKLIGHT_KTD253) += ktd253-backlight.o
+obj-$(CONFIG_BACKLIGHT_KTZ8866)+= ktz8866.o
 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3630A)+= lm3630a_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
diff --git a/drivers/video/backlight/ktz8866.c 
b/drivers/video/backlight/ktz8866.c
new file mode 100644
index ..1eaf72d9116b
--- /dev/null
+++ b/drivers/video/backlight/ktz8866.c
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Backlight driver for the Kinetic KTZ8866
+ *
+ * Copyright (C) Jianhua Lu 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "ktz8866.h"
+
+#define DEF_BRIGHTNESS 1500
+#define MAX_BRIGHTNESS 2047
+#define REG_MAX 0x15
+
+/* Helper */
+#define low_3_bit(x) ((x)&0x7)
+#define high_8_bit(x) ((x >> 3) & 0xFF)
+
+struct ktz8866 {
+   struct i2c_client *client;
+   struct regmap *regmap;
+   bool state;
+};
+
+enum {
+   LED_OFF,
+   LED_ON,
+};
+
+static const struct regmap_config ktz8866_regmap_config = {
+   .reg_bits = 8,
+   .val_bits = 8,
+   .max_register = REG_MAX,
+};
+
+int ktz8866_write(struct ktz8866 *ktz, unsigned int reg, unsigned int val)
+{
+   return regmap_write(ktz->regmap, reg, val);
+}
+
+static int ktz8866_update_bits(struct ktz8866 *ktz, unsigned int reg,
+  unsigned int mask, unsigned int val)
+{
+   return regmap_update_bits(ktz->regmap, reg, mask, val);
+}
+
+static int
+ktz8866_backlight_update_status(struct backlight_device *backlight_dev)
+{
+   struct ktz8866 *ktz = bl_get_data(backlight_dev);
+   unsigned int brightness = backlight_get_brightness(backlight_dev);
+
+   if (!ktz->state && brightness > 0) {
+   ktz8866_update_bits(ktz, BL_EN, BIT(6), BIT(6));
+   ktz->state = LED_ON;
+   } else if (brightness == 0) {
+   ktz8866_update_bits(ktz, BL_EN, BIT(6), 0);
+   ktz->state = LED_OFF;
+   msleep(10);
+   }
+
+   /* Set brightness */
+   ktz8866_write(ktz, BL_BRT_LSB, low_3_bit(brightness));
+   ktz8866_write(ktz, BL_BRT_MSB, high_8_bit(brightness));
+
+   return 0;
+}
+
+static const struct backlight_ops ktz8866_backlight_ops = {
+   .options = BL_CORE_SUSPENDRESUME,
+   .update_status = ktz8866_backlight_update_status,
+};
+
+static void ktz8866_init(struct ktz8866 *ktz)
+{
+   /* Enable 1~5 current sinks */
+   ktz8866_write(ktz, BL_EN, 0x1F);
+   /* Backlight OVP 26.4V */
+   ktz8866_write(ktz, BL_CFG1, 0x33);
+   /* LED ramping time 128ms */
+   ktz8866_write(ktz, BL_CFG2, 0xBD);
+   /* LED on/off ramping time 1ms */
+   ktz8866_write(ktz, BL_DIMMING, 0x11);
+   /* Enable OUTP and OUTN via pin ENP and ENN */
+   ktz8866_write(ktz, LCD_BIAS_CFG1, 0x9F);
+   /* Backlight Full-scale LED Current 30.0mA */
+   ktz8866_write(ktz, FULL_SCALE_CURRENT, 0xF9);
+}
+
+static int ktz8866_probe(struct i2c_client *client,
+const struct i2c_device_id *id)
+{
+   struct backlight_device *backlight_dev;
+   struct backlight_properties props;
+   

Re: [PATCH v6 4/5] drm/tidss: Add IO CTRL and Power support for OLDI TX in am625

2022-12-21 Thread Tomi Valkeinen

Hi,

On 19/11/2022 19:30, Aradhya Bhatia wrote:

The ctrl mmr module of the AM625 is different from the AM65X SoC. Thus
the ctrl mmr registers that supported the OLDI TX power have become
different in AM625 SoC.

Add IO CTRL support and control the OLDI TX power for AM625.

Signed-off-by: Aradhya Bhatia 
---
  drivers/gpu/drm/tidss/tidss_dispc.c  | 55 ++--
  drivers/gpu/drm/tidss/tidss_dispc_regs.h | 37 +++-
  2 files changed, 70 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c 
b/drivers/gpu/drm/tidss/tidss_dispc.c
index 472226a83251..f26129fb1d8f 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -930,21 +930,52 @@ int dispc_vp_bus_check(struct dispc_device *dispc, u32 
hw_videoport,
  
  static void dispc_oldi_tx_power(struct dispc_device *dispc, bool power)

  {
-   u32 val = power ? 0 : OLDI_PWRDN_TX;
+   u32 val;
  
  	if (WARN_ON(!dispc->oldi_io_ctrl))

return;
  
-	regmap_update_bits(dispc->oldi_io_ctrl, OLDI_DAT0_IO_CTRL,

-  OLDI_PWRDN_TX, val);
-   regmap_update_bits(dispc->oldi_io_ctrl, OLDI_DAT1_IO_CTRL,
-  OLDI_PWRDN_TX, val);
-   regmap_update_bits(dispc->oldi_io_ctrl, OLDI_DAT2_IO_CTRL,
-  OLDI_PWRDN_TX, val);
-   regmap_update_bits(dispc->oldi_io_ctrl, OLDI_DAT3_IO_CTRL,
-  OLDI_PWRDN_TX, val);
-   regmap_update_bits(dispc->oldi_io_ctrl, OLDI_CLK_IO_CTRL,
-  OLDI_PWRDN_TX, val);
+   if (dispc->feat->subrev == DISPC_AM65X) {
+   val = power ? 0 : AM65X_OLDI_PWRDN_TX;
+
+   regmap_update_bits(dispc->oldi_io_ctrl, AM65X_OLDI_DAT0_IO_CTRL,
+  AM65X_OLDI_PWRDN_TX, val);
+   regmap_update_bits(dispc->oldi_io_ctrl, AM65X_OLDI_DAT1_IO_CTRL,
+  AM65X_OLDI_PWRDN_TX, val);
+   regmap_update_bits(dispc->oldi_io_ctrl, AM65X_OLDI_DAT2_IO_CTRL,
+  AM65X_OLDI_PWRDN_TX, val);
+   regmap_update_bits(dispc->oldi_io_ctrl, AM65X_OLDI_DAT3_IO_CTRL,
+  AM65X_OLDI_PWRDN_TX, val);
+   regmap_update_bits(dispc->oldi_io_ctrl, AM65X_OLDI_CLK_IO_CTRL,
+  AM65X_OLDI_PWRDN_TX, val);
+
+   } else if (dispc->feat->subrev == DISPC_AM625) {
+   if (power) {
+   switch (dispc->oldi_mode) {
+   case OLDI_SINGLE_LINK_SINGLE_MODE:
+   /* Power down OLDI TX 1 */
+   val = AM625_OLDI1_PWRDN_TX;
+   break;
+
+   case OLDI_SINGLE_LINK_CLONE_MODE:
+   case OLDI_DUAL_LINK_MODE:
+   /* No Power down */
+   val = 0;
+   break;
+
+   default:
+   /* Power down both the OLDI TXes */
+   val = AM625_OLDI0_PWRDN_TX | 
AM625_OLDI1_PWRDN_TX;
+   break;
+   }
+   } else {
+   /* Power down both the OLDI TXes */
+   val = AM625_OLDI0_PWRDN_TX | AM625_OLDI1_PWRDN_TX;
+   }
+
+   regmap_update_bits(dispc->oldi_io_ctrl, AM625_OLDI_PD_CTRL,
+  AM625_OLDI0_PWRDN_TX | AM625_OLDI1_PWRDN_TX, 
val);
+   }
  }
  
  static void dispc_set_num_datalines(struct dispc_device *dispc,

@@ -2841,7 +2872,7 @@ int dispc_init(struct tidss_device *tidss)
dispc->vp_data[i].gamma_table = gamma_table;
}
  
-	if (feat->subrev == DISPC_AM65X) {

+   if (feat->oldi_supported) {
r = dispc_init_am65x_oldi_io_ctrl(dev, dispc);
if (r)
return r;


I think it makes more sense to test the SoC version here, rather than 
the generic "oldi_supported". And if the same function is used for 
am625, maybe rename the func to "_am6xx_".


Other than that:

Reviewed-by: Tomi Valkeinen 

 Tomi



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

2022-12-21 Thread Tomi Valkeinen

On 19/12/2022 23:01, Laurent Pinchart wrote:

Hi Tomi,

Thank you for the patch.

On Mon, Dec 19, 2022 at 04:01:35PM +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 correcly match for gen 4.

Signed-off-by: Tomi Valkeinen 
---
  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:


While this doesn't cause any functional change, it doesn't fall into the
renaming explained in the commit message. I'd make a mention of it
there.


The message says "update the code to correcly match for gen 4". (I see a 
typo there =)). Doesn't that cover this change? It's similar to the if() 
changes, where we now check for >= 3.


 Tomi


Conditional-Reviewed-by: Laurent Pinchart 



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
 

[PATCH 10/10] drm/drm_lease: Remove usage of deprecated DRM_DEBUG_LEASE

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_DEBUG_LEASE is deprecated in favor of
drm_dbg_lease().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_lease.c | 64 -
 1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index c442d5e766d1..08b4f29f8b61 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -213,11 +213,11 @@ static struct drm_master *drm_lease_create(struct 
drm_master *lessor, struct idr
int id;
void *entry;
 
-   DRM_DEBUG_LEASE("lessor %d\n", lessor->lessee_id);
+   drm_dbg_lease(dev, "lessor %d\n", lessor->lessee_id);
 
lessee = drm_master_create(lessor->dev);
if (!lessee) {
-   DRM_DEBUG_LEASE("drm_master_create failed\n");
+   drm_dbg_lease(dev, "drm_master_create failed\n");
return ERR_PTR(-ENOMEM);
}
 
@@ -231,7 +231,7 @@ static struct drm_master *drm_lease_create(struct 
drm_master *lessor, struct idr
error = -EBUSY;
 
if (error != 0) {
-   DRM_DEBUG_LEASE("object %d failed %d\n", object, error);
+   drm_dbg_lease(dev, "object %d failed %d\n", object, 
error);
goto out_lessee;
}
}
@@ -249,7 +249,8 @@ static struct drm_master *drm_lease_create(struct 
drm_master *lessor, struct idr
 
/* Move the leases over */
lessee->leases = *leases;
-   DRM_DEBUG_LEASE("new lessee %d %p, lessor %d %p\n", lessee->lessee_id, 
lessee, lessor->lessee_id, lessor);
+   drm_dbg_lease(dev, "new lessee %d %p, lessor %d %p\n",
+ lessee->lessee_id, lessee, lessor->lessee_id, lessor);
 
mutex_unlock(&dev->mode_config.idr_mutex);
return lessee;
@@ -268,7 +269,7 @@ void drm_lease_destroy(struct drm_master *master)
 
mutex_lock(&dev->mode_config.idr_mutex);
 
-   DRM_DEBUG_LEASE("drm_lease_destroy %d\n", master->lessee_id);
+   drm_dbg_lease(dev, "drm_lease_destroy %d\n", master->lessee_id);
 
/* This master is referenced by all lessees, hence it cannot be 
destroyed
 * until all of them have been
@@ -277,7 +278,8 @@ void drm_lease_destroy(struct drm_master *master)
 
/* Remove this master from the lessee idr in the owner */
if (master->lessee_id != 0) {
-   DRM_DEBUG_LEASE("remove master %d from device list of 
lessees\n", master->lessee_id);
+   drm_dbg_lease(dev, "remove master %d from device list of 
lessees\n",
+ master->lessee_id);
idr_remove(&(drm_lease_owner(master)->lessee_idr), 
master->lessee_id);
}
 
@@ -292,7 +294,7 @@ void drm_lease_destroy(struct drm_master *master)
drm_master_put(&master->lessor);
}
 
-   DRM_DEBUG_LEASE("drm_lease_destroy done %d\n", master->lessee_id);
+   drm_dbg_lease(dev, "drm_lease_destroy done %d\n", master->lessee_id);
 }
 
 static void _drm_lease_revoke(struct drm_master *top)
@@ -308,7 +310,8 @@ static void _drm_lease_revoke(struct drm_master *top)
 * the tree is fully connected, we can do this without recursing
 */
for (;;) {
-   DRM_DEBUG_LEASE("revoke leases for %p %d\n", master, 
master->lessee_id);
+   drm_dbg_lease(master->dev, "revoke leases for %p %d\n",
+ master, master->lessee_id);
 
/* Evacuate the lease */
idr_for_each_entry(&master->leases, entry, object)
@@ -408,7 +411,7 @@ static int fill_object_idr(struct drm_device *dev,
 
ret = validate_lease(dev, object_count, objects, universal_planes);
if (ret) {
-   DRM_DEBUG_LEASE("lease validation failed\n");
+   drm_dbg_lease(dev, "lease validation failed\n");
goto out_free_objects;
}
 
@@ -418,7 +421,7 @@ static int fill_object_idr(struct drm_device *dev,
struct drm_mode_object *obj = objects[o];
u32 object_id = objects[o]->id;
 
-   DRM_DEBUG_LEASE("Adding object %d to lease\n", object_id);
+   drm_dbg_lease(dev, "Adding object %d to lease\n", object_id);
 
/*
 * We're using an IDR to hold the set of leased
@@ -430,8 +433,8 @@ static int fill_object_idr(struct drm_device *dev,
 */
ret = idr_alloc(leases, &drm_lease_idr_object , object_id, 
object_id + 1, GFP_KERNEL);
if (ret < 0) {
-   DRM_DEBUG_LEASE("Object %d cannot be inserted into 
leases (%d)\n",
-   object_id, ret);
+   drm_dbg_lease(dev, "Object %d cannot be inserted into 
leases (%d)\n",
+ object_id, ret);
goto out_free_objects;
}
if (obj->type == D

[PATCH 01/10] drm: Remove usage of deprecated DRM_INFO

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_INFO is deprecated.
Thus, use newer printing macros drm_info() and pr_info().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_client_modeset.c | 2 +-
 drivers/gpu/drm/drm_connector.c  | 7 ---
 drivers/gpu/drm/drm_drv.c| 2 +-
 drivers/gpu/drm/drm_pci.c| 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index d553e793e673..2b76d4828c5f 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -335,7 +335,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
DRM_DEBUG_KMS("can clone using 1024x768\n");
return true;
}
-   DRM_INFO("kms: can't enable cloning when we probably wanted to.\n");
+   drm_info(dev, "kms: can't enable cloning when we probably wanted 
to.\n");
return false;
 }
 
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 547356e00341..34c26b2a974e 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -165,13 +165,14 @@ static void drm_connector_get_cmdline_mode(struct 
drm_connector *connector)
return;
 
if (mode->force) {
-   DRM_INFO("forcing %s connector %s\n", connector->name,
-drm_get_connector_force_name(mode->force));
+   drm_info(connector->dev, "forcing %s connector %s\n",
+connector->name, 
drm_get_connector_force_name(mode->force));
connector->force = mode->force;
}
 
if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
-   DRM_INFO("cmdline forces connector %s panel_orientation to 
%d\n",
+   drm_info(connector->dev,
+"cmdline forces connector %s panel_orientation to 
%d\n",
 connector->name, mode->panel_orientation);
drm_connector_set_panel_orientation(connector,
mode->panel_orientation);
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 73b845a75d52..bc98e4bcf2c1 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -938,7 +938,7 @@ int drm_dev_register(struct drm_device *dev, unsigned long 
flags)
if (drm_core_check_feature(dev, DRIVER_MODESET))
drm_modeset_register_all(dev);
 
-   DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
+   drm_info(dev, "Initialized %s %d.%d.%d %s for %s on minor %d\n",
 driver->name, driver->major, driver->minor,
 driver->patchlevel, driver->date,
 dev->dev ? dev_name(dev->dev) : "virtual device",
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 39d35fc3a43b..18cf7fa23698 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -262,7 +262,7 @@ void drm_legacy_pci_exit(const struct drm_driver *driver,
}
mutex_unlock(&legacy_dev_list_lock);
}
-   DRM_INFO("Module unloaded\n");
+   pr_info("Module unloaded\n");
 }
 EXPORT_SYMBOL(drm_legacy_pci_exit);
 
-- 
2.35.1




[PATCH 2/2] dt-bindings: leds: backlight: add binding for Kinetic KTZ8866 backlight

2022-12-21 Thread Jianhua Lu
Add device tree bindings for the Kinetic KTZ8866 backlight driver.

Signed-off-by: Jianhua Lu 
---
 .../leds/backlight/kinetic,ktz8866.yaml   | 37 +++
 1 file changed, 37 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml

diff --git 
a/Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml 
b/Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml
new file mode 100644
index ..7286c3fc7f5d
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/backlight/kinetic,ktz8866.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Kinetic Technologies KTZ8866 backlight
+
+maintainers:
+  - Jianhua Lu 
+
+description: |
+  The Kinetic Technologies KTZ8866 is a high efficiency 6-sinks led backlight
+  with dual lcd bias power.
+  https://www.kinet-ic.com/ktz8866/
+
+allOf:
+  - $ref: common.yaml#
+
+properties:
+  compatible:
+items:
+  const: kinetic,ktz8866
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+backlight {
+compatible = "kinetic,ktz8866";
+
+pinctrl-names = "default";
+pinctrl-0 = <&bl_en_default>;
+};
-- 
2.38.2



[PATCH 00/10] drm: Remove usage of deprecated DRM_* macros

2022-12-21 Thread Siddh Raman Pant
This patchset aims to remove usages of deprecated DRM_* macros from the
files residing in drivers/gpu/drm root.

In process, I found out that NULL as first argument of drm_dbg_* wasn't
working, but it was listed as the alternative in deprecation comment,
so I fixed that before removing usages of DRM_DEBUG_* macros.

This patchset should be applied in order as changes might be dependent.

Please review and let me know if any errors are there, and hopefully
this gets accepted.

Siddh Raman Pant (10):
  drm: Remove usage of deprecated DRM_INFO
  drm: Remove usage of deprecated DRM_NOTE
  drm: Remove usage of deprecated DRM_ERROR
  drm/print: Fix support for NULL as first argument of drm_dbg_*
  drm: Remove usage of deprecated DRM_DEBUG
  drm: Remove usage of deprecated DRM_DEBUG_DRIVER
  drm: Remove usage of deprecated DRM_DEBUG_KMS
  drm: Remove usage of deprecated DRM_DEBUG_PRIME
  drm/drm_blend: Remove usage of deprecated DRM_DEBUG_ATOMIC
  drm/drm_lease: Remove usage of deprecated DRM_DEBUG_LEASE

 drivers/gpu/drm/drm_agpsupport.c|   4 +-
 drivers/gpu/drm/drm_blend.c |  13 ++-
 drivers/gpu/drm/drm_bridge.c|   8 +-
 drivers/gpu/drm/drm_bufs.c  | 122 
 drivers/gpu/drm/drm_client_modeset.c| 118 +--
 drivers/gpu/drm/drm_color_mgmt.c|   4 +-
 drivers/gpu/drm/drm_connector.c |  28 +++---
 drivers/gpu/drm/drm_context.c   |  18 ++--
 drivers/gpu/drm/drm_crtc.c  |  36 ---
 drivers/gpu/drm/drm_crtc_helper.c   |  62 ++--
 drivers/gpu/drm/drm_debugfs_crc.c   |   8 +-
 drivers/gpu/drm/drm_displayid.c |   6 +-
 drivers/gpu/drm/drm_dma.c   |  10 +-
 drivers/gpu/drm/drm_drv.c   |  28 +++---
 drivers/gpu/drm/drm_edid.c  |  17 ++--
 drivers/gpu/drm/drm_file.c  |  18 ++--
 drivers/gpu/drm/drm_flip_work.c |   2 +-
 drivers/gpu/drm/drm_framebuffer.c   |   3 +-
 drivers/gpu/drm/drm_gem.c   |   7 +-
 drivers/gpu/drm/drm_gem_dma_helper.c|   6 +-
 drivers/gpu/drm/drm_gem_shmem_helper.c  |   6 +-
 drivers/gpu/drm/drm_hashtab.c   |  10 +-
 drivers/gpu/drm/drm_ioc32.c |  13 +--
 drivers/gpu/drm/drm_ioctl.c |  24 ++---
 drivers/gpu/drm/drm_irq.c   |   4 +-
 drivers/gpu/drm/drm_kms_helper_common.c |   2 +-
 drivers/gpu/drm/drm_lease.c |  68 ++---
 drivers/gpu/drm/drm_legacy_misc.c   |   4 +-
 drivers/gpu/drm/drm_lock.c  |  36 +++
 drivers/gpu/drm/drm_mipi_dbi.c  |  19 ++--
 drivers/gpu/drm/drm_mm.c|   8 +-
 drivers/gpu/drm/drm_mode_config.c   |   2 +-
 drivers/gpu/drm/drm_mode_object.c   |   6 +-
 drivers/gpu/drm/drm_modes.c |  10 +-
 drivers/gpu/drm/drm_modeset_helper.c|   2 +-
 drivers/gpu/drm/drm_pci.c   |  14 +--
 drivers/gpu/drm/drm_plane.c |  46 -
 drivers/gpu/drm/drm_probe_helper.c  |  39 
 drivers/gpu/drm/drm_rect.c  |   4 +-
 drivers/gpu/drm/drm_scatter.c   |  19 ++--
 drivers/gpu/drm/drm_syncobj.c   |   2 +-
 drivers/gpu/drm/drm_sysfs.c |  22 ++---
 drivers/gpu/drm/drm_vm.c|  45 +
 include/drm/drm_print.h |  91 ++
 44 files changed, 549 insertions(+), 465 deletions(-)

-- 
2.35.1




[PATCH 09/10] drm/drm_blend: Remove usage of deprecated DRM_DEBUG_ATOMIC

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_DEBUG_ATOMIC is deprecated in favor of
drm_dbg_atomic().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_blend.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index b4c8cab7158c..6e74de833466 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -450,8 +450,8 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct 
drm_crtc *crtc,
int i, n = 0;
int ret = 0;
 
-   DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n",
-crtc->base.id, crtc->name);
+   drm_dbg_atomic(dev, "[CRTC:%d:%s] calculating normalized zpos values\n",
+  crtc->base.id, crtc->name);
 
states = kmalloc_array(total_planes, sizeof(*states), GFP_KERNEL);
if (!states)
@@ -469,9 +469,8 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct 
drm_crtc *crtc,
goto done;
}
states[n++] = plane_state;
-   DRM_DEBUG_ATOMIC("[PLANE:%d:%s] processing zpos value %d\n",
-plane->base.id, plane->name,
-plane_state->zpos);
+   drm_dbg_atomic(dev, "[PLANE:%d:%s] processing zpos value %d\n",
+  plane->base.id, plane->name, plane_state->zpos);
}
 
sort(states, n, sizeof(*states), drm_atomic_state_zpos_cmp, NULL);
@@ -480,8 +479,8 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct 
drm_crtc *crtc,
plane = states[i]->plane;
 
states[i]->normalized_zpos = i;
-   DRM_DEBUG_ATOMIC("[PLANE:%d:%s] normalized zpos value %d\n",
-plane->base.id, plane->name, i);
+   drm_dbg_atomic(dev, "[PLANE:%d:%s] normalized zpos value %d\n",
+  plane->base.id, plane->name, i);
}
crtc_state->zpos_changed = true;
 
-- 
2.35.1




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

2022-12-21 Thread Tomi Valkeinen

On 19/12/2022 21:10, Laurent Pinchart wrote:

Hi Tomi,

Thank you for the patch.

On Mon, Dec 19, 2022 at 04:01:33PM +0200, Tomi Valkeinen wrote:

Add XBGR2101010, ABGR2101010 and BGRA1010102 formats.

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..de78cd2dcd73 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-XBGR2101010:
+
+  - ``V4L2_PIX_FMT_XBGR2101010``
+  - '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`
+  -


This doesn't match the text above. This would be RGBX2101010. I'm not
sure which format you want, so I don't know if it's the documentation or
the format name that is incorrect. The next two formats also seem
incorrect to me.


Right, the text should say big endian instead of little endian.

 Tomi



[PATCH 02/10] drm: Remove usage of deprecated DRM_NOTE

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_NOTE is deprecated in favour of pr_notice().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_displayid.c | 2 +-
 drivers/gpu/drm/drm_kms_helper_common.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
index 38ea8203df45..e8431da8238a 100644
--- a/drivers/gpu/drm/drm_displayid.c
+++ b/drivers/gpu/drm/drm_displayid.c
@@ -26,7 +26,7 @@ static int validate_displayid(const u8 *displayid, int 
length, int idx)
for (i = 0; i < dispid_length; i++)
csum += displayid[idx + i];
if (csum) {
-   DRM_NOTE("DisplayID checksum invalid, remainder is %d\n", csum);
+   pr_notice("DisplayID checksum invalid, remainder is %d\n", 
csum);
return -EINVAL;
}
 
diff --git a/drivers/gpu/drm/drm_kms_helper_common.c 
b/drivers/gpu/drm/drm_kms_helper_common.c
index 0bf0fc1abf54..bcb3dd62462c 100644
--- a/drivers/gpu/drm/drm_kms_helper_common.c
+++ b/drivers/gpu/drm/drm_kms_helper_common.c
@@ -41,7 +41,7 @@ MODULE_LICENSE("GPL and additional rights");
 /* Backward compatibility for drm_kms_helper.edid_firmware */
 static int edid_firmware_set(const char *val, const struct kernel_param *kp)
 {
-   DRM_NOTE("drm_kms_helper.edid_firmware is deprecated, please use 
drm.edid_firmware instead.\n");
+   pr_notice("drm_kms_helper.edid_firmware is deprecated, please use 
drm.edid_firmware instead.\n");
 
return __drm_set_edid_firmware_path(val);
 }
-- 
2.35.1




Re: [PATCH v6 3/5] drm/tidss: Add support to configure OLDI mode for am625-dss.

2022-12-21 Thread Tomi Valkeinen

Hi,

On 19/11/2022 19:30, Aradhya Bhatia wrote:

The newer version of DSS (AM625-DSS) has 2 OLDI TXes at its disposal.
These can be configured to support the following modes:

1. OLDI_SINGLE_LINK_SINGLE_MODE
Single Output over OLDI 0.
+--++-+  +---+
|  || |  |   |
| CRTC +--->+ ENCODER +->| PANEL |
|  || |  |   |
+--++-+  +---+

2. OLDI_SINGLE_LINK_CLONE_MODE
Duplicate Output over OLDI 0 and 1.
+--++-+  +---+
|  || |  |   |
| CRTC +---+--->| ENCODER +->| PANEL |
|  |   || |  |   |
+--+   |+-+  +---+
|
|+-+  +---+
|| |  |   |
+--->| ENCODER +->| PANEL |
 | |  |   |
 +-+  +---+

3. OLDI_DUAL_LINK_MODE
Combined Output over OLDI 0 and 1.
+--++-+  +---+
|  || +->|   |
| CRTC +--->+ ENCODER |  | PANEL |
|  || +->|   |
+--++-+  +---+

Following the above pathways for different modes, 2 encoder/panel-bridge
pipes get created for clone mode, and 1 pipe in cases of single link and
dual link mode.

Add support for confguring the OLDI modes using OF and LVDS DRM helper
functions.

Signed-off-by: Aradhya Bhatia 
---
  drivers/gpu/drm/tidss/tidss_dispc.c   |  12 ++
  drivers/gpu/drm/tidss/tidss_dispc.h   |   9 ++
  drivers/gpu/drm/tidss/tidss_drv.h |   3 +
  drivers/gpu/drm/tidss/tidss_encoder.c |   4 +-
  drivers/gpu/drm/tidss/tidss_encoder.h |   3 +-
  drivers/gpu/drm/tidss/tidss_kms.c | 188 +++---
  6 files changed, 198 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c 
b/drivers/gpu/drm/tidss/tidss_dispc.c
index dbc6a5b617ca..472226a83251 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -365,6 +365,8 @@ struct dispc_device {
  
  	struct dss_vp_data vp_data[TIDSS_MAX_VPS];
  
+	enum dispc_oldi_modes oldi_mode;

+
u32 *fourccs;
u32 num_fourccs;
  
@@ -1967,6 +1969,16 @@ const u32 *dispc_plane_formats(struct dispc_device *dispc, unsigned int *len)

return dispc->fourccs;
  }
  
+int dispc_set_oldi_mode(struct dispc_device *dispc,

+   enum dispc_oldi_modes oldi_mode)
+{
+   WARN_ON(!dispc);


This feels unnecessary. Is there even a theoretical case where we could 
get dispc == NULL?



+
+   dispc->oldi_mode = oldi_mode;
+
+   return 0;


This function could as well be void function.


+}
+
  static s32 pixinc(int pixels, u8 ps)
  {
if (pixels == 1)
diff --git a/drivers/gpu/drm/tidss/tidss_dispc.h 
b/drivers/gpu/drm/tidss/tidss_dispc.h
index 51db500590ee..e76a7599b544 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.h
+++ b/drivers/gpu/drm/tidss/tidss_dispc.h
@@ -64,6 +64,14 @@ enum dispc_dss_subrevision {
DISPC_AM625,
  };
  
+enum dispc_oldi_modes {

+   OLDI_MODE_OFF,  /* OLDI turned off / tied off in IP. */
+   OLDI_SINGLE_LINK_SINGLE_MODE,   /* Single Output over OLDI 0. */
+   OLDI_SINGLE_LINK_CLONE_MODE,/* Duplicate Output over OLDI 0 and 1. 
*/
+   OLDI_DUAL_LINK_MODE,/* Combined Output over OLDI 0 and 1. */
+   OLDI_MODE_UNSUPPORTED,  /* Unsupported OLDI Mode */
+};


What is the difference with MODE_OFF and MODE_UNSUPPORTED? Is 
MODE_UNSUPPORTED for cases where, e.g., the DT setup is wrong and the 
driver should return an error? The code doesn't quite do that, it prints 
an error but then continues.



  struct dispc_features {
int min_pclk_khz;
int max_pclk_khz[DISPC_VP_MAX_BUS_TYPE];
@@ -133,6 +141,7 @@ int dispc_plane_setup(struct dispc_device *dispc, u32 
hw_plane,
  u32 hw_videoport);
  int dispc_plane_enable(struct dispc_device *dispc, u32 hw_plane, bool enable);
  const u32 *dispc_plane_formats(struct dispc_device *dispc, unsigned int *len);
+int dispc_set_oldi_mode(struct dispc_device *dispc, enum dispc_oldi_modes 
oldi_mode);
  
  int dispc_init(struct tidss_device *tidss);

  void dispc_remove(struct tidss_device *tidss);
diff --git a/drivers/gpu/drm/tidss/tidss_drv.h 
b/drivers/gpu/drm/tidss/tidss_drv.h
index 0ce7ee5ccd5b..58892f065c16 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.h
+++ b/drivers/gpu/drm/tidss/tidss_drv.h
@@ -13,6 +13,9 @@
  #define TIDSS_MAX_PLANES 4
  #define TIDSS_MAX_OUTPUT_PORTS 4
  
+/* For AM625-DSS with 2 OLDI TXes */

+#define TIDSS_MAX_BRIDGES_PER_PIPE 2
+
  typedef u32 dispc_irq_t;
  
  struct tidss_device {

diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c 
b/drivers/gpu/drm/tidss/tidss_encoder.c
index e278a9c89476..141383ec4045 100644
--- a/drivers/gpu/drm/tidss/tidss_encoder.c
+++ b/drivers/gpu/drm/tid

[PATCH 06/10] drm: Remove usage of deprecated DRM_DEBUG_DRIVER

2022-12-21 Thread Siddh Raman Pant
drm_print.h says DRM_DEBUG_DRIVER is deprecated.
Thus, use newer drm_dbg_driver().

Also fix the deprecation comment in drm_print.h which
mentions drm_dbg() instead of drm_dbg_driver().

Signed-off-by: Siddh Raman Pant 
---
 drivers/gpu/drm/drm_mipi_dbi.c | 10 +-
 include/drm/drm_print.h|  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 24af507bb687..6ad399f6ab03 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -69,11 +69,11 @@
 #define MIPI_DBI_DEBUG_COMMAND(cmd, data, len) \
 ({ \
if (!len) \
-   DRM_DEBUG_DRIVER("cmd=%02x\n", cmd); \
+   drm_dbg_driver(NULL, "cmd=%02x\n", cmd); \
else if (len <= 32) \
-   DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, (int)len, data);\
+   drm_dbg_driver(NULL, "cmd=%02x, par=%*ph\n", cmd, (int)len, 
data);\
else \
-   DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, len); \
+   drm_dbg_driver(NULL, "cmd=%02x, len=%zu\n", cmd, len); \
 })
 
 static const u8 mipi_dbi_dcs_read_commands[] = {
@@ -632,7 +632,7 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *dbi)
DCS_POWER_MODE_DISPLAY_NORMAL_MODE | DCS_POWER_MODE_SLEEP_MODE))
return false;
 
-   DRM_DEBUG_DRIVER("Display is ON\n");
+   drm_dbg_driver(NULL, "Display is ON\n");
 
return true;
 }
@@ -1168,7 +1168,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct 
mipi_dbi *dbi,
 
mutex_init(&dbi->cmdlock);
 
-   DRM_DEBUG_DRIVER("SPI speed: %uMHz\n", spi->max_speed_hz / 100);
+   drm_dbg_driver(NULL, "SPI speed: %uMHz\n", spi->max_speed_hz / 100);
 
return 0;
 }
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 53702d830291..10261faec8b6 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -614,7 +614,7 @@ void __drm_err(const char *format, ...);
 #define DRM_DEBUG(fmt, ...)\
__drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
 
-/* NOTE: this is deprecated in favor of drm_dbg(NULL, ...). */
+/* NOTE: this is deprecated in favor of drm_dbg_driver(NULL, ...). */
 #define DRM_DEBUG_DRIVER(fmt, ...) \
__drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
 
-- 
2.35.1




Re: [PATCH] drm/vmwgfx: Fix passing partly uninitialized drm_mode_fb_cmd2 struct

2022-12-21 Thread Kaiwan N Billimoria
[REGRESSION] ?
Hi,
Testing with 6.1, I find the same issue - VirtualBox VMs seem to hang
on boot, though the kernel has this patch applied of course...
Am running VirtualBox 7.0.4 on an x86_64 Linux (Ubuntu 22.04.1) host;
the system hangs on boot with the screen
going blank.
Passing 'nomodeset' via GRUB fixes it..

Thanks,
Kaiwan.


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

2022-12-21 Thread Sakari Ailus
Hi Laurent,

On Mon, Dec 19, 2022 at 11:47:04PM +0200, Laurent Pinchart wrote:
> Hi Tomi,
> 
> (CC'ing Sakari and Hans)
> 
> Thank you for the patch.
> 
> On Mon, Dec 19, 2022 at 04:01:39PM +0200, Tomi Valkeinen wrote:
> > Add new pixel formats: RGBX1010102, RGBA1010102, ARGB2101010 and Y210.
> > 
> > Signed-off-by: Tomi Valkeinen 
> > ---
> >  drivers/gpu/drm/rcar-du/rcar_du_kms.c | 24 +
> >  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 49 +--
> >  2 files changed, 71 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..8ccabf5a30c4 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,
> 
> Ah, here the format makes sense.
> 
> > +   .v4l2 = V4L2_PIX_FMT_XBGR2101010,
> 
> But this is horrible :-( Could we use the same names as DRM for new
> formats, when there is no conflict with existing V4L2 formats ?
> 
> Sakari, Hans, what do you think ? Please see patch 1/7 in the series for
> the format definitions.

I think it'd be good to have only one set of definitions.

Can we can sort the endianness question in a reasonable way?

Also new Bayer formats will probably be still needed on V4L2 side but will
they be relevant for DRM? I suppose that would mean new DRM format for
each pixel order, too? Or can we think of something smarter that would
still work reasonably with existing formats?

-- 
Kind regards,

Sakari Ailus


Re: [PATCH 04/10] drm/print: Fix support for NULL as first argument of drm_dbg_*

2022-12-21 Thread Thomas Zimmermann

Hi

Am 20.12.22 um 21:16 schrieb Siddh Raman Pant:

Comments say macros DRM_DEBUG_* are deprecated in favor of
drm_dbg_*(NULL, ...), but they have broken support for it,
as the macro will result in `(NULL) ? (NULL)->dev : NULL`.

Thus, fix them by casting input drm to a temporary struct ptr,
with the same convention as in __DRM_DEFINE_DBG_RATELIMITED.

Signed-off-by: Siddh Raman Pant 
---
  include/drm/drm_print.h | 89 -
  1 file changed, 69 insertions(+), 20 deletions(-)

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index a44fb7ef257f..53702d830291 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -486,26 +486,75 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct 
device *dev,
__drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
  
  
-#define drm_dbg_core(drm, fmt, ...)	\

-   drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)

...

+#define drm_dbg_core(drm, fmt, ...)\
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_CORE,\
+   fmt, ##__VA_ARGS__);\
+})


Instead of doing this for each drm_dbg_ macro, rather add an internal 
helper that returns the device or NULL like this:


static inline struct device *__drm_print_dev(struct drm_device *drm)
{
if (drm)
return drm->dev;
return NULL;
}

and change the macros to

drm_dbg_core(drm, fmt, ...)
drm_dev_dbg(__drm_print_dev(drm), DRM_UT_CORE, )

and so on.

Best regards
Thomas


+
+#define drm_dbg_driver(drm, fmt, ...)  \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_DRIVER,  \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_kms(drm, fmt, ...) \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_KMS, \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_prime(drm, fmt, ...)   \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_PRIME,   \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_atomic(drm, fmt, ...)  \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_ATOMIC,  \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_vbl(drm, fmt, ...) \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_VBL, \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_state(drm, fmt, ...)   \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_STATE,   \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_lease(drm, fmt, ...)   \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_LEASE,   \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_dp(drm, fmt, ...)  \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_DP,  \
+   fmt, ##__VA_ARGS__);\
+})
+
+#define drm_dbg_drmres(drm, fmt, ...)  \
+({ \
+   const struct drm_device *drm_ = (drm);  \
+   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_DRMRES,  \
+   fmt, ##__VA_ARGS__);\
+})
  
  #define drm_dbg(drm, fmt, ...)	drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
  


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


Ope

Re: [PATCH 00/10] drm: Remove usage of deprecated DRM_* macros

2022-12-21 Thread Thomas Zimmermann

Hi

Am 20.12.22 um 21:16 schrieb Siddh Raman Pant:

This patchset aims to remove usages of deprecated DRM_* macros from the
files residing in drivers/gpu/drm root.

In process, I found out that NULL as first argument of drm_dbg_* wasn't
working, but it was listed as the alternative in deprecation comment,
so I fixed that before removing usages of DRM_DEBUG_* macros.

This patchset should be applied in order as changes might be dependent.

Please review and let me know if any errors are there, and hopefully
this gets accepted.


Thanks for the patchset. Overall this looks fine.

But the use of pr_() functions is not optimal in my opinion. I know that 
I recommended using it, but at a closer look, I think we might want to 
reconsider that. I wouldn't like losing the '[drm]' tag, but adding them 
to each pr_() call isn't a good idea either.


I think it would be nicer to replace DRM_INFO with drm_info(NULL, ). 
Depending on the device being NULL, the helpers would select dev-based 
messages or printk-based messages. It would then work like drm_dbg_(). 
But it needs some additional changes.


Can you first move all pr_() related changes into a new patchset? The 
trivial conversion were the device is known and not NULL can remain in 
this patchset and be merged soon. We can afterwards have a separate 
discussion for the changes that currently involve pr_().


Best regards
Thomas



Siddh Raman Pant (10):
   drm: Remove usage of deprecated DRM_INFO
   drm: Remove usage of deprecated DRM_NOTE
   drm: Remove usage of deprecated DRM_ERROR
   drm/print: Fix support for NULL as first argument of drm_dbg_*
   drm: Remove usage of deprecated DRM_DEBUG
   drm: Remove usage of deprecated DRM_DEBUG_DRIVER
   drm: Remove usage of deprecated DRM_DEBUG_KMS
   drm: Remove usage of deprecated DRM_DEBUG_PRIME
   drm/drm_blend: Remove usage of deprecated DRM_DEBUG_ATOMIC
   drm/drm_lease: Remove usage of deprecated DRM_DEBUG_LEASE

  drivers/gpu/drm/drm_agpsupport.c|   4 +-
  drivers/gpu/drm/drm_blend.c |  13 ++-
  drivers/gpu/drm/drm_bridge.c|   8 +-
  drivers/gpu/drm/drm_bufs.c  | 122 
  drivers/gpu/drm/drm_client_modeset.c| 118 +--
  drivers/gpu/drm/drm_color_mgmt.c|   4 +-
  drivers/gpu/drm/drm_connector.c |  28 +++---
  drivers/gpu/drm/drm_context.c   |  18 ++--
  drivers/gpu/drm/drm_crtc.c  |  36 ---
  drivers/gpu/drm/drm_crtc_helper.c   |  62 ++--
  drivers/gpu/drm/drm_debugfs_crc.c   |   8 +-
  drivers/gpu/drm/drm_displayid.c |   6 +-
  drivers/gpu/drm/drm_dma.c   |  10 +-
  drivers/gpu/drm/drm_drv.c   |  28 +++---
  drivers/gpu/drm/drm_edid.c  |  17 ++--
  drivers/gpu/drm/drm_file.c  |  18 ++--
  drivers/gpu/drm/drm_flip_work.c |   2 +-
  drivers/gpu/drm/drm_framebuffer.c   |   3 +-
  drivers/gpu/drm/drm_gem.c   |   7 +-
  drivers/gpu/drm/drm_gem_dma_helper.c|   6 +-
  drivers/gpu/drm/drm_gem_shmem_helper.c  |   6 +-
  drivers/gpu/drm/drm_hashtab.c   |  10 +-
  drivers/gpu/drm/drm_ioc32.c |  13 +--
  drivers/gpu/drm/drm_ioctl.c |  24 ++---
  drivers/gpu/drm/drm_irq.c   |   4 +-
  drivers/gpu/drm/drm_kms_helper_common.c |   2 +-
  drivers/gpu/drm/drm_lease.c |  68 ++---
  drivers/gpu/drm/drm_legacy_misc.c   |   4 +-
  drivers/gpu/drm/drm_lock.c  |  36 +++
  drivers/gpu/drm/drm_mipi_dbi.c  |  19 ++--
  drivers/gpu/drm/drm_mm.c|   8 +-
  drivers/gpu/drm/drm_mode_config.c   |   2 +-
  drivers/gpu/drm/drm_mode_object.c   |   6 +-
  drivers/gpu/drm/drm_modes.c |  10 +-
  drivers/gpu/drm/drm_modeset_helper.c|   2 +-
  drivers/gpu/drm/drm_pci.c   |  14 +--
  drivers/gpu/drm/drm_plane.c |  46 -
  drivers/gpu/drm/drm_probe_helper.c  |  39 
  drivers/gpu/drm/drm_rect.c  |   4 +-
  drivers/gpu/drm/drm_scatter.c   |  19 ++--
  drivers/gpu/drm/drm_syncobj.c   |   2 +-
  drivers/gpu/drm/drm_sysfs.c |  22 ++---
  drivers/gpu/drm/drm_vm.c|  45 +
  include/drm/drm_print.h |  91 ++
  44 files changed, 549 insertions(+), 465 deletions(-)



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 04/10] drm/print: Fix support for NULL as first argument of drm_dbg_*

2022-12-21 Thread Jani Nikula
On Wed, 21 Dec 2022, Siddh Raman Pant  wrote:
> Comments say macros DRM_DEBUG_* are deprecated in favor of
> drm_dbg_*(NULL, ...), but they have broken support for it,
> as the macro will result in `(NULL) ? (NULL)->dev : NULL`.

What's wrong with that?

>
> Thus, fix them by casting input drm to a temporary struct ptr,
> with the same convention as in __DRM_DEFINE_DBG_RATELIMITED.
>
> Signed-off-by: Siddh Raman Pant 
> ---
>  include/drm/drm_print.h | 89 -
>  1 file changed, 69 insertions(+), 20 deletions(-)
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index a44fb7ef257f..53702d830291 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -486,26 +486,75 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct 
> device *dev,
>   __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
>  
>  
> -#define drm_dbg_core(drm, fmt, ...)  \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> -#define drm_dbg_driver(drm, fmt, ...)
> \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, 
> ##__VA_ARGS__)
> -#define drm_dbg_kms(drm, fmt, ...)   \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> -#define drm_dbg_prime(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> -#define drm_dbg_atomic(drm, fmt, ...)
> \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, 
> ##__VA_ARGS__)
> -#define drm_dbg_vbl(drm, fmt, ...)   \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> -#define drm_dbg_state(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
> -#define drm_dbg_lease(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> -#define drm_dbg_dp(drm, fmt, ...)\
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
> -#define drm_dbg_drmres(drm, fmt, ...)
> \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, 
> ##__VA_ARGS__)
> +#define drm_dbg_core(drm, fmt, ...)  \
> +({   \
> + const struct drm_device *drm_ = (drm);  \
> + drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_CORE,   \
> + fmt, ##__VA_ARGS__);\
> +})
> +
> +#define drm_dbg_driver(drm, fmt, ...)\
> +({   \
> + const struct drm_device *drm_ = (drm);  \
> + drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_DRIVER, \
> + fmt, ##__VA_ARGS__);\
> +})
> +
> +#define drm_dbg_kms(drm, fmt, ...)   \
> +({   \
> + const struct drm_device *drm_ = (drm);  \
> + drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_KMS,\
> + fmt, ##__VA_ARGS__);\
> +})
> +
> +#define drm_dbg_prime(drm, fmt, ...) \
> +({   \
> + const struct drm_device *drm_ = (drm);  \
> + drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_PRIME,  \
> + fmt, ##__VA_ARGS__);\
> +})
> +
> +#define drm_dbg_atomic(drm, fmt, ...)\
> +({   \
> + const struct drm_device *drm_ = (drm);  \
> + drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_ATOMIC, \
> + fmt, ##__VA_ARGS__);\
> +})
> +
> +#define drm_dbg_vbl(drm, fmt, ...)   \
> +({   \
> + const struct drm_device *drm_ = (drm);  \
> + drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_VBL,\
> + fmt, ##__VA_ARGS__);\
> +})
> +
> +#define drm_dbg_state(drm, fmt, ...) \
> +({   \
> + const struct drm_device *drm_ = (drm);  \
> + drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_STATE,  \
> + fmt, ##__VA_ARGS__);\
> +})
> +
> +#define drm_dbg_lease(drm, fmt, ...) \
> +({ 

Re: [PATCH 2/2] dt-bindings: leds: backlight: add binding for Kinetic KTZ8866 backlight

2022-12-21 Thread Krzysztof Kozlowski
On 21/12/2022 10:40, jianhua lu wrote:
> Thanks for review, I will resend this path.

Are you going to test it, before sending?

Best regards,
Krzysztof



Re: [PATCH 01/10] drm: Remove usage of deprecated DRM_INFO

2022-12-21 Thread Jani Nikula
On Wed, 21 Dec 2022, Siddh Raman Pant  wrote:
> drm_print.h says DRM_INFO is deprecated.
> Thus, use newer printing macros drm_info() and pr_info().

I think it's a bit odd some of the conversion is to pr_*() and some to
drm_*(NULL, ...) depending on the logging level etc.

Notably the pr_*() debugs will lack the [drm] part as well as the
function name, which makes some of the logging harder to map to what's
going on.

Maybe all of them should use the drm_*() calls, with better handling of
NULL drm device.

BR,
Jani.






>
> Signed-off-by: Siddh Raman Pant 
> ---
>  drivers/gpu/drm/drm_client_modeset.c | 2 +-
>  drivers/gpu/drm/drm_connector.c  | 7 ---
>  drivers/gpu/drm/drm_drv.c| 2 +-
>  drivers/gpu/drm/drm_pci.c| 2 +-
>  4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c 
> b/drivers/gpu/drm/drm_client_modeset.c
> index d553e793e673..2b76d4828c5f 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -335,7 +335,7 @@ static bool drm_client_target_cloned(struct drm_device 
> *dev,
>   DRM_DEBUG_KMS("can clone using 1024x768\n");
>   return true;
>   }
> - DRM_INFO("kms: can't enable cloning when we probably wanted to.\n");
> + drm_info(dev, "kms: can't enable cloning when we probably wanted 
> to.\n");
>   return false;
>  }
>  
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 547356e00341..34c26b2a974e 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -165,13 +165,14 @@ static void drm_connector_get_cmdline_mode(struct 
> drm_connector *connector)
>   return;
>  
>   if (mode->force) {
> - DRM_INFO("forcing %s connector %s\n", connector->name,
> -  drm_get_connector_force_name(mode->force));
> + drm_info(connector->dev, "forcing %s connector %s\n",
> +  connector->name, 
> drm_get_connector_force_name(mode->force));
>   connector->force = mode->force;
>   }
>  
>   if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
> - DRM_INFO("cmdline forces connector %s panel_orientation to 
> %d\n",
> + drm_info(connector->dev,
> +  "cmdline forces connector %s panel_orientation to 
> %d\n",
>connector->name, mode->panel_orientation);
>   drm_connector_set_panel_orientation(connector,
>   mode->panel_orientation);
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 73b845a75d52..bc98e4bcf2c1 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -938,7 +938,7 @@ int drm_dev_register(struct drm_device *dev, unsigned 
> long flags)
>   if (drm_core_check_feature(dev, DRIVER_MODESET))
>   drm_modeset_register_all(dev);
>  
> - DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
> + drm_info(dev, "Initialized %s %d.%d.%d %s for %s on minor %d\n",
>driver->name, driver->major, driver->minor,
>driver->patchlevel, driver->date,
>dev->dev ? dev_name(dev->dev) : "virtual device",
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 39d35fc3a43b..18cf7fa23698 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -262,7 +262,7 @@ void drm_legacy_pci_exit(const struct drm_driver *driver,
>   }
>   mutex_unlock(&legacy_dev_list_lock);
>   }
> - DRM_INFO("Module unloaded\n");
> + pr_info("Module unloaded\n");
>  }
>  EXPORT_SYMBOL(drm_legacy_pci_exit);

-- 
Jani Nikula, Intel Open Source Graphics Center


Re: [PATCH 06/10] drm: Remove usage of deprecated DRM_DEBUG_DRIVER

2022-12-21 Thread Jani Nikula
On Wed, 21 Dec 2022, Siddh Raman Pant  wrote:
> drm_print.h says DRM_DEBUG_DRIVER is deprecated.
> Thus, use newer drm_dbg_driver().
>
> Also fix the deprecation comment in drm_print.h which
> mentions drm_dbg() instead of drm_dbg_driver().
>
> Signed-off-by: Siddh Raman Pant 
> ---
>  drivers/gpu/drm/drm_mipi_dbi.c | 10 +-
>  include/drm/drm_print.h|  2 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> index 24af507bb687..6ad399f6ab03 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -69,11 +69,11 @@
>  #define MIPI_DBI_DEBUG_COMMAND(cmd, data, len) \
>  ({ \
>   if (!len) \
> - DRM_DEBUG_DRIVER("cmd=%02x\n", cmd); \
> + drm_dbg_driver(NULL, "cmd=%02x\n", cmd); \
>   else if (len <= 32) \
> - DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, (int)len, data);\
> + drm_dbg_driver(NULL, "cmd=%02x, par=%*ph\n", cmd, (int)len, 
> data);\
>   else \
> - DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, len); \
> + drm_dbg_driver(NULL, "cmd=%02x, len=%zu\n", cmd, len); \
>  })
>  
>  static const u8 mipi_dbi_dcs_read_commands[] = {
> @@ -632,7 +632,7 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *dbi)
>   DCS_POWER_MODE_DISPLAY_NORMAL_MODE | DCS_POWER_MODE_SLEEP_MODE))
>   return false;
>  
> - DRM_DEBUG_DRIVER("Display is ON\n");
> + drm_dbg_driver(NULL, "Display is ON\n");
>  
>   return true;
>  }
> @@ -1168,7 +1168,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct 
> mipi_dbi *dbi,
>  
>   mutex_init(&dbi->cmdlock);
>  
> - DRM_DEBUG_DRIVER("SPI speed: %uMHz\n", spi->max_speed_hz / 100);
> + drm_dbg_driver(NULL, "SPI speed: %uMHz\n", spi->max_speed_hz / 100);
>  
>   return 0;
>  }
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 53702d830291..10261faec8b6 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -614,7 +614,7 @@ void __drm_err(const char *format, ...);
>  #define DRM_DEBUG(fmt, ...)  \
>   __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
>  
> -/* NOTE: this is deprecated in favor of drm_dbg(NULL, ...). */
> +/* NOTE: this is deprecated in favor of drm_dbg_driver(NULL, ...). */

Way back the idea was to make the shorter drm_dbg() the driver debug,
and drm_dbg_core() the drm core debug, because the former vastly
outnumbers the the latter.

I don't know if that changed with the dyndbg stuff.


BR,
Jani.


>  #define DRM_DEBUG_DRIVER(fmt, ...)   \
>   __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)

-- 
Jani Nikula, Intel Open Source Graphics Center


Re: [PATCH 00/10] drm: Remove usage of deprecated DRM_* macros

2022-12-21 Thread Jani Nikula
On Wed, 21 Dec 2022, Thomas Zimmermann  wrote:
> Hi
>
> Am 20.12.22 um 21:16 schrieb Siddh Raman Pant:
>> This patchset aims to remove usages of deprecated DRM_* macros from the
>> files residing in drivers/gpu/drm root.
>> 
>> In process, I found out that NULL as first argument of drm_dbg_* wasn't
>> working, but it was listed as the alternative in deprecation comment,
>> so I fixed that before removing usages of DRM_DEBUG_* macros.
>> 
>> This patchset should be applied in order as changes might be dependent.
>> 
>> Please review and let me know if any errors are there, and hopefully
>> this gets accepted.
>
> Thanks for the patchset. Overall this looks fine.
>
> But the use of pr_() functions is not optimal in my opinion. I know that 
> I recommended using it, but at a closer look, I think we might want to 
> reconsider that. I wouldn't like losing the '[drm]' tag, but adding them 
> to each pr_() call isn't a good idea either.
>
> I think it would be nicer to replace DRM_INFO with drm_info(NULL, ). 
> Depending on the device being NULL, the helpers would select dev-based 
> messages or printk-based messages. It would then work like drm_dbg_(). 
> But it needs some additional changes.
>
> Can you first move all pr_() related changes into a new patchset? The 
> trivial conversion were the device is known and not NULL can remain in 
> this patchset and be merged soon. We can afterwards have a separate 
> discussion for the changes that currently involve pr_().

Same thoughts, agreed.

BR,
Jani.


>
> Best regards
> Thomas
>
>> 
>> Siddh Raman Pant (10):
>>drm: Remove usage of deprecated DRM_INFO
>>drm: Remove usage of deprecated DRM_NOTE
>>drm: Remove usage of deprecated DRM_ERROR
>>drm/print: Fix support for NULL as first argument of drm_dbg_*
>>drm: Remove usage of deprecated DRM_DEBUG
>>drm: Remove usage of deprecated DRM_DEBUG_DRIVER
>>drm: Remove usage of deprecated DRM_DEBUG_KMS
>>drm: Remove usage of deprecated DRM_DEBUG_PRIME
>>drm/drm_blend: Remove usage of deprecated DRM_DEBUG_ATOMIC
>>drm/drm_lease: Remove usage of deprecated DRM_DEBUG_LEASE
>> 
>>   drivers/gpu/drm/drm_agpsupport.c|   4 +-
>>   drivers/gpu/drm/drm_blend.c |  13 ++-
>>   drivers/gpu/drm/drm_bridge.c|   8 +-
>>   drivers/gpu/drm/drm_bufs.c  | 122 
>>   drivers/gpu/drm/drm_client_modeset.c| 118 +--
>>   drivers/gpu/drm/drm_color_mgmt.c|   4 +-
>>   drivers/gpu/drm/drm_connector.c |  28 +++---
>>   drivers/gpu/drm/drm_context.c   |  18 ++--
>>   drivers/gpu/drm/drm_crtc.c  |  36 ---
>>   drivers/gpu/drm/drm_crtc_helper.c   |  62 ++--
>>   drivers/gpu/drm/drm_debugfs_crc.c   |   8 +-
>>   drivers/gpu/drm/drm_displayid.c |   6 +-
>>   drivers/gpu/drm/drm_dma.c   |  10 +-
>>   drivers/gpu/drm/drm_drv.c   |  28 +++---
>>   drivers/gpu/drm/drm_edid.c  |  17 ++--
>>   drivers/gpu/drm/drm_file.c  |  18 ++--
>>   drivers/gpu/drm/drm_flip_work.c |   2 +-
>>   drivers/gpu/drm/drm_framebuffer.c   |   3 +-
>>   drivers/gpu/drm/drm_gem.c   |   7 +-
>>   drivers/gpu/drm/drm_gem_dma_helper.c|   6 +-
>>   drivers/gpu/drm/drm_gem_shmem_helper.c  |   6 +-
>>   drivers/gpu/drm/drm_hashtab.c   |  10 +-
>>   drivers/gpu/drm/drm_ioc32.c |  13 +--
>>   drivers/gpu/drm/drm_ioctl.c |  24 ++---
>>   drivers/gpu/drm/drm_irq.c   |   4 +-
>>   drivers/gpu/drm/drm_kms_helper_common.c |   2 +-
>>   drivers/gpu/drm/drm_lease.c |  68 ++---
>>   drivers/gpu/drm/drm_legacy_misc.c   |   4 +-
>>   drivers/gpu/drm/drm_lock.c  |  36 +++
>>   drivers/gpu/drm/drm_mipi_dbi.c  |  19 ++--
>>   drivers/gpu/drm/drm_mm.c|   8 +-
>>   drivers/gpu/drm/drm_mode_config.c   |   2 +-
>>   drivers/gpu/drm/drm_mode_object.c   |   6 +-
>>   drivers/gpu/drm/drm_modes.c |  10 +-
>>   drivers/gpu/drm/drm_modeset_helper.c|   2 +-
>>   drivers/gpu/drm/drm_pci.c   |  14 +--
>>   drivers/gpu/drm/drm_plane.c |  46 -
>>   drivers/gpu/drm/drm_probe_helper.c  |  39 
>>   drivers/gpu/drm/drm_rect.c  |   4 +-
>>   drivers/gpu/drm/drm_scatter.c   |  19 ++--
>>   drivers/gpu/drm/drm_syncobj.c   |   2 +-
>>   drivers/gpu/drm/drm_sysfs.c |  22 ++---
>>   drivers/gpu/drm/drm_vm.c|  45 +
>>   include/drm/drm_print.h |  91 ++
>>   44 files changed, 549 insertions(+), 465 deletions(-)
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center


Re: [PATCH 01/10] drm: Remove usage of deprecated DRM_INFO

2022-12-21 Thread Thomas Zimmermann

Hi

Am 21.12.22 um 10:49 schrieb Jani Nikula:

On Wed, 21 Dec 2022, Siddh Raman Pant  wrote:

drm_print.h says DRM_INFO is deprecated.
Thus, use newer printing macros drm_info() and pr_info().


I think it's a bit odd some of the conversion is to pr_*() and some to
drm_*(NULL, ...) depending on the logging level etc.

Notably the pr_*() debugs will lack the [drm] part as well as the
function name, which makes some of the logging harder to map to what's
going on.

Maybe all of them should use the drm_*() calls, with better handling of
NULL drm device.


That's also what I think. Something like drm_info(NULL, ) should just 
work and give the same results as before.  The older code that uses 
drm_dev_printk() seems to get it right.


Best regards
Thomas



BR,
Jani.








Signed-off-by: Siddh Raman Pant 
---
  drivers/gpu/drm/drm_client_modeset.c | 2 +-
  drivers/gpu/drm/drm_connector.c  | 7 ---
  drivers/gpu/drm/drm_drv.c| 2 +-
  drivers/gpu/drm/drm_pci.c| 2 +-
  4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index d553e793e673..2b76d4828c5f 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -335,7 +335,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
DRM_DEBUG_KMS("can clone using 1024x768\n");
return true;
}
-   DRM_INFO("kms: can't enable cloning when we probably wanted to.\n");
+   drm_info(dev, "kms: can't enable cloning when we probably wanted 
to.\n");
return false;
  }
  
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c

index 547356e00341..34c26b2a974e 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -165,13 +165,14 @@ static void drm_connector_get_cmdline_mode(struct 
drm_connector *connector)
return;
  
  	if (mode->force) {

-   DRM_INFO("forcing %s connector %s\n", connector->name,
-drm_get_connector_force_name(mode->force));
+   drm_info(connector->dev, "forcing %s connector %s\n",
+connector->name, 
drm_get_connector_force_name(mode->force));
connector->force = mode->force;
}
  
  	if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {

-   DRM_INFO("cmdline forces connector %s panel_orientation to 
%d\n",
+   drm_info(connector->dev,
+"cmdline forces connector %s panel_orientation to 
%d\n",
 connector->name, mode->panel_orientation);
drm_connector_set_panel_orientation(connector,
mode->panel_orientation);
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 73b845a75d52..bc98e4bcf2c1 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -938,7 +938,7 @@ int drm_dev_register(struct drm_device *dev, unsigned long 
flags)
if (drm_core_check_feature(dev, DRIVER_MODESET))
drm_modeset_register_all(dev);
  
-	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",

+   drm_info(dev, "Initialized %s %d.%d.%d %s for %s on minor %d\n",
 driver->name, driver->major, driver->minor,
 driver->patchlevel, driver->date,
 dev->dev ? dev_name(dev->dev) : "virtual device",
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 39d35fc3a43b..18cf7fa23698 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -262,7 +262,7 @@ void drm_legacy_pci_exit(const struct drm_driver *driver,
}
mutex_unlock(&legacy_dev_list_lock);
}
-   DRM_INFO("Module unloaded\n");
+   pr_info("Module unloaded\n");
  }
  EXPORT_SYMBOL(drm_legacy_pci_exit);




--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 06/10] drm: Remove usage of deprecated DRM_DEBUG_DRIVER

2022-12-21 Thread Thomas Zimmermann

Hi

Am 21.12.22 um 11:00 schrieb Jani Nikula:

On Wed, 21 Dec 2022, Siddh Raman Pant  wrote:

drm_print.h says DRM_DEBUG_DRIVER is deprecated.
Thus, use newer drm_dbg_driver().

Also fix the deprecation comment in drm_print.h which
mentions drm_dbg() instead of drm_dbg_driver().

Signed-off-by: Siddh Raman Pant 
---
  drivers/gpu/drm/drm_mipi_dbi.c | 10 +-
  include/drm/drm_print.h|  2 +-
  2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 24af507bb687..6ad399f6ab03 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -69,11 +69,11 @@
  #define MIPI_DBI_DEBUG_COMMAND(cmd, data, len) \
  ({ \
if (!len) \
-   DRM_DEBUG_DRIVER("cmd=%02x\n", cmd); \
+   drm_dbg_driver(NULL, "cmd=%02x\n", cmd); \
else if (len <= 32) \
-   DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, (int)len, data);\
+   drm_dbg_driver(NULL, "cmd=%02x, par=%*ph\n", cmd, (int)len, 
data);\
else \
-   DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, len); \
+   drm_dbg_driver(NULL, "cmd=%02x, len=%zu\n", cmd, len); \
  })
  
  static const u8 mipi_dbi_dcs_read_commands[] = {

@@ -632,7 +632,7 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *dbi)
DCS_POWER_MODE_DISPLAY_NORMAL_MODE | DCS_POWER_MODE_SLEEP_MODE))
return false;
  
-	DRM_DEBUG_DRIVER("Display is ON\n");

+   drm_dbg_driver(NULL, "Display is ON\n");
  
  	return true;

  }
@@ -1168,7 +1168,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct 
mipi_dbi *dbi,
  
  	mutex_init(&dbi->cmdlock);
  
-	DRM_DEBUG_DRIVER("SPI speed: %uMHz\n", spi->max_speed_hz / 100);

+   drm_dbg_driver(NULL, "SPI speed: %uMHz\n", spi->max_speed_hz / 100);
  
  	return 0;

  }
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 53702d830291..10261faec8b6 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -614,7 +614,7 @@ void __drm_err(const char *format, ...);
  #define DRM_DEBUG(fmt, ...)   \
__drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
  
-/* NOTE: this is deprecated in favor of drm_dbg(NULL, ...). */

+/* NOTE: this is deprecated in favor of drm_dbg_driver(NULL, ...). */


Way back the idea was to make the shorter drm_dbg() the driver debug,
and drm_dbg_core() the drm core debug, because the former vastly
outnumbers the the latter.

I don't know if that changed with the dyndbg stuff.


I've recently grepped for these macros and nothing uses drm_dbg_driver() 
directly.


I also wondered whether the driver debug macro makes much sense. For 
example, if a driver implements its own atomic helpers, it's much more 
useful to use drm_dbg_kms() within those functions. If enabled, their 
output would then blend into the overall KMS-related debugging. 
drm_dbg/drm_dbg_driver() appears to be mostly useful for init and status 
reporting.


Best regards
Thomas




BR,
Jani.



  #define DRM_DEBUG_DRIVER(fmt, ...)\
__drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)




--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH] drm/vmwgfx: Fix passing partly uninitialized drm_mode_fb_cmd2 struct

2022-12-21 Thread Thorsten Leemhuis
Hi, this is your Linux kernel regression tracker. The relevant code here
is not my area of expertise, nevertheless a few questions:

On 21.12.22 03:23, Kaiwan N Billimoria wrote:
> [REGRESSION] ?

> Testing with 6.1, I find the same issue - VirtualBox VMs seem to hang
> on boot, though the kernel has this patch applied of course...

Maybe I'm missing something, but what made you assume that it's the same
issue? The fix for that issue talked about "garbage" in some structures
that "can cause random failures during the bringup of the fbcon." Yeah,
maybe that ca result in a hang, but I didn't see it that thread (but
maybe I missed)

> Am running VirtualBox 7.0.4 on an x86_64 Linux (Ubuntu 22.04.1) host;
> the system hangs on boot with the screen
> going blank.

A bit more details would be helpful. For example: is anything printed at
all before the system hangs? What's the last kernel that worked for you
(and is the newer kernel using a similar build configuration)? Which
graphics adapater did you configure in VirtualBox?

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)

P.S.: As the Linux kernel's regression tracker I deal with a lot of
reports and sometimes miss something important when writing mails like
this. If that's the case here, don't hesitate to tell me in a public
reply, it's in everyone's interest to set the public record straight.


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

2022-12-21 Thread Laurent Pinchart
Hi Tomi,

On Wed, Dec 21, 2022 at 09:48:10AM +0200, Tomi Valkeinen wrote:
> On 19/12/2022 23:01, Laurent Pinchart wrote:
> > On Mon, Dec 19, 2022 at 04:01:35PM +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 correcly match for gen 4.
> >>
> >> Signed-off-by: Tomi Valkeinen 
> >> ---
> >>   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:
> > 
> > While this doesn't cause any functional change, it doesn't fall into the
> > renaming explained in the commit message. I'd make a mention of it
> > there.
> 
> The message says "update the code to correcly match for gen 4". (I see a 
> typo there =)). Doesn't that cover this change? It's similar to the if() 
> changes, where we now check for >= 3.

Possibly :-) This code change isn't needed as the default cases handles
gen4. It's still desirable though.

No need to send a new version for this.

> > Conditional-Reviewed-by: Laurent Pinchart 
> > 
> > 
> >>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/

Re: [Intel-gfx] [PATCH v2 1/1] drm/i915/pxp: Use drm_dbg if arb session failed due to fw version

2022-12-21 Thread Jani Nikula
On Tue, 20 Dec 2022, Alan Previn  wrote:
> If PXP arb-session is being attempted on older hardware SKUs or
> on hardware with older, unsupported, firmware versions, then don't
> report the failure with a drm_error. Instead, look specifically for
> the API-version error reply and drm_dbg that reply. In this case, the
> user-space will eventually get a -ENODEV for the protected context
> creation which is the correct behavior and we don't create unnecessary
> drm_error's in our dmesg (for what is unsupported platforms).
>
> Changes from prio revs:
>v1 : - print incorrect version from input packet, not output.
>
> Signed-off-by: Alan Previn 
> ---
>  drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h | 1 +
>  drivers/gpu/drm/i915/pxp/intel_pxp_tee.c   | 5 +
>  2 files changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h 
> b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
> index c2f23394f9b8..aaa8187a0afb 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
> @@ -17,6 +17,7 @@
>   */
>  enum pxp_status {
>   PXP_STATUS_SUCCESS = 0x0,
> + PXP_STATUS_ERROR_API_VERSION = 0x1002,
>   PXP_STATUS_OP_NOT_PERMITTED = 0x4013
>  };
>  
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c 
> b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> index d50354bfb993..9d084ed9cc50 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> @@ -298,6 +298,11 @@ int intel_pxp_tee_cmd_create_arb_session(struct 
> intel_pxp *pxp,
>  
>   if (ret)
>   drm_err(&i915->drm, "Failed to send tee msg ret=[%d]\n", ret);
> +

Superfluous newline that someone's gonna send a patch later to
remove. Easier to just not add it.

BR,
Jani.

> + else if (msg_out.header.status == PXP_STATUS_ERROR_API_VERSION)
> + drm_dbg(&i915->drm, "PXP firmware version unsupported, 
> requested: "
> + "CMD-ID-[0x%08x] on API-Ver-[0x%08x]\n",
> + msg_in.header.command_id, msg_in.header.api_version);
>   else if (msg_out.header.status != 0x0)
>   drm_warn(&i915->drm, "PXP firmware failed arb session init 
> request ret=[0x%08x]\n",
>msg_out.header.status);
>
> base-commit: cc44a1e87ea6b788868878295119398966f98a81

-- 
Jani Nikula, Intel Open Source Graphics Center


Re: [PATCH v3 0/2] drm/imx/lcdc: Implement DRM driver for imx21

2022-12-21 Thread Uwe Kleine-König
Hello Rob,

On Tue, Dec 20, 2022 at 12:19:48PM -0600, Rob Herring wrote:
> On Sat, Dec 17, 2022 at 07:38:06PM +0100, Uwe Kleine-König wrote:
> > On Fri, Dec 16, 2022 at 05:57:58PM -0600, Rob Herring wrote:
> > > On Fri, Dec 16, 2022 at 06:50:04PM +0100, Uwe Kleine-König wrote:
> > > > Hello,
> > > > 
> > > > Changes since v2:
> > > > 
> > > >  - added allOf as Krzysztof requested
> > > >  - reworked driver based on Philipp's comments
> > > >(improved error handling, different selects, moved driver to a 
> > > > subdirectory,
> > > >header sorting, drm_err instead of DRM_ERROR, inlined
> > > >imx_lcdc_check_mode_change, make use of dev_err_probe())
> > > >  
> > > > Krzysztof also pointed out that we're now having two compatibles for a
> > > > single hardware. Admittedly this is unusual, but this is the chance that
> > > > the (bad) compatible identifier imx21-fb gets deprecated. The hardware
> > > > is called LCDC and only the linux (framebuffer) driver is called imxfb.
> > > 
> > > The problem is you can't have firmware (with the DTB) that supports 
> > > both. Well, you can if you want to have some firmware setting that 
> > > selects which one. Otherwise, it's really an OS problem to decide what 
> > > to use. 
> > 
> > I don't understand what you intend to say here. The same applies if the
> > compatible is the same for both binding alternatives, isn't it? 
> 
> Only if you have both nodes in the DT and both enabled. But 2 enabled 
> nodes at the same address is also a dtc warning, so I was assuming you 
> didn't do that.

My idea was to use the new compatible in the soc.dtsi, and the old one
in the soc-machine.dts until they are converted. And then eventually
drop the old driver.

> > Do you consider a firmware problem better or an OS problem?
> 
> The OS created the problem, so they get to keep it. But a PC BIOS is 
> full of OS compatibility switches, so...
> 
> In the end, it's the platforms' decision really. I just want what the 
> implications of having 2 compatibles are to be understood.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


Re: [PATCH 10/10] drm/drm_lease: Remove usage of deprecated DRM_DEBUG_LEASE

2022-12-21 Thread Simon Ser
Patch is:

Reviewed-by: Simon Ser 


[PATCH v3 0/3] Add generic framebuffer support to EFI earlycon driver

2022-12-21 Thread Markuss Broks
Make the EFI earlycon driver be suitable for any linear framebuffers.
This should be helpful for early porting of boards with no other means of
output, like smartphones/tablets. There seems to be an issue with early_ioremap
function on ARM32, but I am unable to find the exact cause. It appears the 
mappings
returned by it are somehow incorrect, thus the driver is disabled on ARM. EFI 
early
console was disabled on IA64 previously because of missing early_memremap_prot,
and this is inherited to this driver.

This patch also changes behavior on EFI systems, by selecting the mapping type
based on if the framebuffer region intersects with system RAM. If it does, it's
common sense that it should be in RAM as a whole, and so the system RAM mapping 
is
used. It was tested to be working on my PC (Intel Z490 platform), as well as 
several
ARM64 boards (Samsung Galaxy S9 (Exynos), iPad Air 2, Xiaomi Mi Pad 4, ...).

Markuss Broks (2):
  drivers: serial: earlycon: Pass device-tree node
  efi: earlycon: Add support for generic framebuffers and move to fbdev
subsystem


v1 -> v2:

- a new patch correcting serial/earlycon.c argument name to "offset" instead
  of "node"
- move IA64 exclusion from EFI earlycon Kconfig to earlycon driver Kconfig
  (IA64 has no early_memremap_prot)
- move driver from fbdev to console subsystem
- select EFI earlycon by default
- fetch stride manually from device-tree, as on some devices it seems stride
  doesn't match the horizontal resolution * bpp.
- use saner format (e.g. 1920x1080x32 instead of 1920,1080,32).


Markuss Broks (3):
  drivers: serial: earlycon: Pass device-tree node
  efi: earlycon: move to video/console to prepare for changes
  efi: earlycon: Add support for generic framebuffers

 .../admin-guide/kernel-parameters.txt |  12 +-
 MAINTAINERS   |   5 +
 drivers/firmware/efi/Kconfig  |   7 +-
 drivers/firmware/efi/Makefile |   1 -
 drivers/firmware/efi/earlycon.c   | 246 --
 drivers/tty/serial/earlycon.c |   3 +
 drivers/video/console/Kconfig |  11 +
 drivers/video/console/Makefile|   1 +
 drivers/video/console/earlycon.c  | 305 ++
 include/linux/serial_core.h   |   1 +
 10 files changed, 336 insertions(+), 256 deletions(-)
 delete mode 100644 drivers/firmware/efi/earlycon.c
 create mode 100644 drivers/video/console/earlycon.c

-- 
2.39.0



[PATCH v3 1/3] drivers: serial: earlycon: Pass device-tree node

2022-12-21 Thread Markuss Broks
Pass a pointer to device-tree node in case the driver probed from
OF. This makes early console drivers able to fetch options from
device-tree node properties.

Signed-off-by: Markuss Broks 
---
 drivers/tty/serial/earlycon.c | 3 +++
 include/linux/serial_core.h   | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 4f6e9bf57169..0c7a789d7eb7 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -307,6 +307,9 @@ int __init of_setup_earlycon(const struct earlycon_id 
*match,
strscpy(early_console_dev.options, options,
sizeof(early_console_dev.options));
}
+
+   early_console_dev.node = node;
+
earlycon_init(&early_console_dev, match->name);
err = match->setup(&early_console_dev, options);
earlycon_print_info(&early_console_dev);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index fd59f600094a..0b06c0ee7705 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -783,6 +783,7 @@ struct earlycon_device {
struct uart_port port;
char options[16];   /* e.g., 115200n8 */
unsigned int baud;
+   unsigned long node;
 };
 
 struct earlycon_id {
-- 
2.39.0



[PATCH v3 2/3] efi: earlycon: move to video/console to prepare for changes

2022-12-21 Thread Markuss Broks
This would make the next patch in series with this one to
show a clear diff, instead of just removing the previous
driver and creating a new one.

Signed-off-by: Markuss Broks 
---
 drivers/{firmware/efi => video/console}/earlycon.c | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename drivers/{firmware/efi => video/console}/earlycon.c (100%)

diff --git a/drivers/firmware/efi/earlycon.c b/drivers/video/console/earlycon.c
similarity index 100%
rename from drivers/firmware/efi/earlycon.c
rename to drivers/video/console/earlycon.c
-- 
2.39.0



[PATCH v3 3/3] efi: earlycon: Add support for generic framebuffers

2022-12-21 Thread Markuss Broks
Add early console support for generic linear framebuffer devices.
This driver supports probing from cmdline early parameters
or from the device-tree using information in simple-framebuffer node.
The EFI functionality should be retained in whole.
The driver was disabled on ARM because of a bug in early_ioremap
implementation on ARM and on IA64 because of lack of early_memremap_prot.

Signed-off-by: Markuss Broks 
---
 .../admin-guide/kernel-parameters.txt |  12 +-
 MAINTAINERS   |   5 +
 drivers/firmware/efi/Kconfig  |   7 +-
 drivers/firmware/efi/Makefile |   1 -
 drivers/video/console/Kconfig |  11 +
 drivers/video/console/Makefile|   1 +
 drivers/video/console/earlycon.c  | 247 +++---
 7 files changed, 180 insertions(+), 104 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 6cfa6e3996cf..3bfac80f9075 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1302,12 +1302,9 @@
specified address. The serial port must already be
setup and configured. Options are not yet supported.
 
-   efifb,[options]
+   efifb
Start an early, unaccelerated console on the EFI
-   memory mapped framebuffer (if available). On cache
-   coherent non-x86 systems that use system memory for
-   the framebuffer, pass the 'ram' option so that it is
-   mapped with the correct attributes.
+   memory mapped framebuffer (if available).
 
linflex,
Use early console provided by Freescale LINFlexD UART
@@ -1315,6 +1312,11 @@
address must be provided, and the serial port must
already be setup and configured.
 
+   simplefb,,xx
+   Use early console with simple framebuffer that is
+   pre-initialized by firmware. A valid base address,
+   width, height and pixel size must be provided.
+
earlyprintk=[X86,SH,ARM,M68k,S390]
earlyprintk=vga
earlyprintk=sclp
diff --git a/MAINTAINERS b/MAINTAINERS
index 30e032abd196..270a4eecadec 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7373,6 +7373,11 @@ Q:   
http://patchwork.linuxtv.org/project/linux-media/list/
 T: git git://linuxtv.org/anttip/media_tree.git
 F: drivers/media/tuners/e4000*
 
+EARLY CONSOLE FRAMEBUFFER DRIVER
+M: Markuss Broks 
+S: Maintained
+F: drivers/video/console/earlycon.c
+
 EARTH_PT1 MEDIA DRIVER
 M: Akihiro Tsukada 
 L: linux-me...@vger.kernel.org
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 043ca31c114e..cedb718fab78 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -223,10 +223,9 @@ config EFI_DISABLE_PCI_DMA
  may be used to override this option.
 
 config EFI_EARLYCON
-   def_bool y
-   depends on SERIAL_EARLYCON && !ARM && !IA64
-   select FONT_SUPPORT
-   select ARCH_USE_MEMREMAP_PROT
+   bool "EFI early console support"
+   select FB_EARLYCON
+   default y
 
 config EFI_CUSTOM_SSDT_OVERLAYS
bool "Load custom ACPI SSDT overlay from an EFI variable"
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index b51f2a4c821e..ec46351ce79b 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -38,6 +38,5 @@ obj-$(CONFIG_ARM64)   += $(arm-obj-y)
 riscv-obj-$(CONFIG_EFI):= efi-init.o riscv-runtime.o
 obj-$(CONFIG_RISCV)+= $(riscv-obj-y)
 obj-$(CONFIG_EFI_CAPSULE_LOADER)   += capsule-loader.o
-obj-$(CONFIG_EFI_EARLYCON) += earlycon.o
 obj-$(CONFIG_UEFI_CPER_ARM)+= cper-arm.o
 obj-$(CONFIG_UEFI_CPER_X86)+= cper-x86.o
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 22cea5082ac4..6edfeddfe5ec 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -70,6 +70,17 @@ config DUMMY_CONSOLE_ROWS
  monitor.
  Select 25 if you use a 640x480 resolution by default.
 
+config FB_EARLYCON
+   bool "Generic framebuffer early console"
+   depends on SERIAL_EARLYCON && !ARM && !IA64
+   select FONT_SUPPORT
+   select ARCH_USE_MEMREMAP_PROT
+   help
+ Say Y here if you want early console support for firmware established
+ linear framebuffer. Unless you are using EFI framebuffer, you need to
+ specify framebuffer geometry and address in device-tree or in kernel
+ command line.
+
 config FRAMEBUFFER_CONSOLE
bool

[PATCH 0/2] Fixes for intel fb helper

2022-12-21 Thread Jouni Högander
This patch set is fixing Intel fb console update issues introduced by
splitting generic drm_fb_helper into it's own file.

Also damage clip check moved to higher level to share it between fb
helpers.

Cc: Ville Syrjälä 
Cc: Thomas Zimmermann 
Cc: Jani Nikula 

Jouni Högander (2):
  drm/i915/fbdev: Implement fb_dirty for intel custom fb helper
  drm/fbdev: Move damage clip check to higher level

 drivers/gpu/drm/drm_fb_helper.c| 4 
 drivers/gpu/drm/drm_fbdev_generic.c| 4 
 drivers/gpu/drm/i915/display/intel_fbdev.c | 9 +
 3 files changed, 13 insertions(+), 4 deletions(-)

-- 
2.34.1



[PATCH 1/2] drm/i915/fbdev: Implement fb_dirty for intel custom fb helper

2022-12-21 Thread Jouni Högander
After splitting generic drm_fb_helper into it's own file it's left to
helper implementation to have fb_dirty function. Currently intel
fb doesn't have it. This is causing problems to features (PSR, FBC, DRRS)
relying on dirty callback.

Implement simple fb_dirty callback to deliver notifications about updates
in fb console.

v2: Improved commit message and added Fixes tag

Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into separate 
source file")
Cc: Ville Syrjälä 
Cc: Thomas Zimmermann 
Cc: Jani Nikula 
Signed-off-by: Jouni Högander 
---
 drivers/gpu/drm/i915/display/intel_fbdev.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c 
b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 03ed4607a46d..20bbdeaf2e6f 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -328,8 +328,17 @@ static int intelfb_create(struct drm_fb_helper *helper,
return ret;
 }
 
+static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect 
*clip)
+{
+   if (helper->fb->funcs->dirty)
+   return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 
1);
+
+   return 0;
+}
+
 static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
.fb_probe = intelfb_create,
+   .fb_dirty = intelfb_dirty,
 };
 
 static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
-- 
2.34.1



[PATCH 2/2] drm/fbdev: Move damage clip check to higher level

2022-12-21 Thread Jouni Högander
Checking if damage clip is valid is common to all fb helpers.
Makes more sense to check it in higher level than adding into
all helpers.

Cc: Ville Syrjälä 
Cc: Thomas Zimmermann 
Cc: Jani Nikula 
Signed-off-by: Jouni Högander 
---
 drivers/gpu/drm/drm_fb_helper.c | 4 
 drivers/gpu/drm/drm_fbdev_generic.c | 4 
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index b3a731b9170a..78c889dbc610 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -384,6 +384,10 @@ static void drm_fb_helper_fb_dirty(struct drm_fb_helper 
*helper)
clip->x2 = clip->y2 = 0;
spin_unlock_irqrestore(&helper->damage_lock, flags);
 
+   /* Call damage handlers only if necessary */
+   if (!(clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2))
+   return;
+
ret = helper->funcs->fb_dirty(helper, &clip_copy);
if (ret)
goto err;
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c 
b/drivers/gpu/drm/drm_fbdev_generic.c
index 0a4c160e0e58..6c6bb0dd2ea8 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -334,10 +334,6 @@ static int drm_fbdev_fb_dirty(struct drm_fb_helper 
*helper, struct drm_clip_rect
if (!drm_fbdev_use_shadow_fb(helper))
return 0;
 
-   /* Call damage handlers only if necessary */
-   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
-   return 0;
-
if (helper->buffer) {
ret = drm_fbdev_damage_blit(helper, clip);
if (drm_WARN_ONCE(dev, ret, "Damage blitter failed: ret=%d\n", 
ret))
-- 
2.34.1



Re: [PATCH 1/2] drm/i915/fbdev: Implement fb_dirty for intel custom fb helper

2022-12-21 Thread Thomas Zimmermann

Hi

Am 21.12.22 um 12:19 schrieb Jouni Högander:

After splitting generic drm_fb_helper into it's own file it's left to
helper implementation to have fb_dirty function. Currently intel
fb doesn't have it. This is causing problems to features (PSR, FBC, DRRS)
relying on dirty callback.

Implement simple fb_dirty callback to deliver notifications about updates
in fb console.


If this is only required for the kernel console, you maybe want to 
rather change the fb_ops.


The kernel console only uses fb_fillrect, fb_copyarea and fb_imageblit. 
[1] Something simple as


void intel_fbdev_fillrect(...)
{
drm_fb_helper_cfb_fillrect();

/* comment on PSR problems */   
fb->funcs->dirty()
}

should work. Same for the other two helpers.

Not using fb_dirty will also avoid the fbdev's internal damage worker, 
which is otherwise scheduled for each console update.


Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v6.1/source/drivers/gpu/drm/i915/display/intel_fbdev.c#L127




v2: Improved commit message and added Fixes tag

Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into separate 
source file")
Cc: Ville Syrjälä 
Cc: Thomas Zimmermann 
Cc: Jani Nikula 
Signed-off-by: Jouni Högander 
---
  drivers/gpu/drm/i915/display/intel_fbdev.c | 9 +
  1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c 
b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 03ed4607a46d..20bbdeaf2e6f 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -328,8 +328,17 @@ static int intelfb_create(struct drm_fb_helper *helper,
return ret;
  }
  
+static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip)

+{
+   if (helper->fb->funcs->dirty)
+   return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 
1);
+
+   return 0;
+}
+
  static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
.fb_probe = intelfb_create,
+   .fb_dirty = intelfb_dirty,
  };
  
  static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 07/10] drm: Remove usage of deprecated DRM_DEBUG_KMS

2022-12-21 Thread kernel test robot
Hi Siddh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20221220]
[also build test ERROR on linus/master]
[cannot apply to drm-misc/drm-misc-next v6.1 v6.1-rc8 v6.1-rc7 v6.1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Siddh-Raman-Pant/drm-Remove-usage-of-deprecated-DRM_-macros/20221221-113133
patch link:
https://lore.kernel.org/r/99d9fc30de75907b13228ebd262da01c3c31b042.1671566741.git.code%40siddh.me
patch subject: [PATCH 07/10] drm: Remove usage of deprecated DRM_DEBUG_KMS
config: i386-randconfig-a011-20221219
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project 
f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/64f0237aa9072807bcfccd5ed22d30e7de1f8bb3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Siddh-Raman-Pant/drm-Remove-usage-of-deprecated-DRM_-macros/20221221-113133
git checkout 64f0237aa9072807bcfccd5ed22d30e7de1f8bb3
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/drm_displayid.c:18:2: error: incomplete definition of type 
>> 'struct drm_device'
   drm_dbg_kms(NULL, "base revision 0x%x, length %d, %d %d\n",
   ^~~
   include/drm/drm_print.h:506:25: note: expanded from macro 'drm_dbg_kms'
   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_KMS,\
  ^
   include/drm/drm_print.h:414:11: note: expanded from macro 'drm_dev_dbg'
  dev, cat, fmt, ##__VA_ARGS__)
  ^~~
   include/linux/dynamic_debug.h:247:65: note: expanded from macro 
'_dynamic_func_call_cls'
   __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, 
##__VA_ARGS__)
  
^~~
   include/linux/dynamic_debug.h:223:15: note: expanded from macro 
'__dynamic_func_call_cls'
   func(&id, ##__VA_ARGS__);   \
   ^~~
   include/drm/drm_edid.h:30:8: note: forward declaration of 'struct drm_device'
   struct drm_device;
  ^
   1 error generated.
--
>> drivers/gpu/drm/drm_edid.c:1990:15: error: use of undeclared identifier 'dev'
   drm_dbg_kms(dev, "Fixing EDID header, your hardware may be 
failing\n");
   ^
   1 error generated.
--
>> drivers/gpu/drm/drm_rect.c:231:3: error: incomplete definition of type 
>> 'struct drm_device'
   drm_dbg_kms(NULL, "%s" DRM_RECT_FP_FMT "\n", prefix, 
DRM_RECT_FP_ARG(r));
   
^~~~
   include/drm/drm_print.h:506:25: note: expanded from macro 'drm_dbg_kms'
   drm_dev_dbg(drm_ ? drm_->dev : NULL, DRM_UT_KMS,\
  ^
   include/drm/drm_print.h:414:11: note: expanded from macro 'drm_dev_dbg'
  dev, cat, fmt, ##__VA_ARGS__)
  ^~~
   include/linux/dynamic_debug.h:247:65: note: expanded from macro 
'_dynamic_func_call_cls'
   __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, 
##__VA_ARGS__)
  
^~~
   include/linux/dynamic_debug.h:223:15: note: expanded from macro 
'__dynamic_func_call_cls'
   func(&id, ##__VA_ARGS__);   \
   ^~~
   drivers/gpu/drm/drm_rect.c:231:3: note: forward declaration of 'struct 
drm_device'
   include/drm/drm_print.h:505:15: note: expanded from macro 'drm_dbg_kms'
   const struct drm_device *drm_ = (drm);  \
^
   drivers/gpu/drm/drm_rect.c:233:3: error: inco

Re: [PATCH 2/2] drm/fbdev: Move damage clip check to higher level

2022-12-21 Thread Thomas Zimmermann

Hi

Am 21.12.22 um 12:19 schrieb Jouni Högander:

Checking if damage clip is valid is common to all fb helpers.
Makes more sense to check it in higher level than adding into
all helpers.


It was a deliberate decision to separate damage clipping and dirty 
updates; done in [1]. Clipping is an optional hint in our regular damage 
handling via drm_framebuffer_funcs.dirty. The fb_dirty callback now 
follows that semantics.


I mentioned that it would be better to implement those fb_ops callbacks 
for i915. But if you go with fb_dirty, please implement the clipping 
test in your callback.


Best regards
Thomas

[1] https://patchwork.freedesktop.org/patch/509958/?series=109943&rev=3



Cc: Ville Syrjälä 
Cc: Thomas Zimmermann 
Cc: Jani Nikula 
Signed-off-by: Jouni Högander 
---
  drivers/gpu/drm/drm_fb_helper.c | 4 
  drivers/gpu/drm/drm_fbdev_generic.c | 4 
  2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index b3a731b9170a..78c889dbc610 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -384,6 +384,10 @@ static void drm_fb_helper_fb_dirty(struct drm_fb_helper 
*helper)
clip->x2 = clip->y2 = 0;
spin_unlock_irqrestore(&helper->damage_lock, flags);
  
+	/* Call damage handlers only if necessary */

+   if (!(clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2))
+   return;
+
ret = helper->funcs->fb_dirty(helper, &clip_copy);
if (ret)
goto err;
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c 
b/drivers/gpu/drm/drm_fbdev_generic.c
index 0a4c160e0e58..6c6bb0dd2ea8 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -334,10 +334,6 @@ static int drm_fbdev_fb_dirty(struct drm_fb_helper 
*helper, struct drm_clip_rect
if (!drm_fbdev_use_shadow_fb(helper))
return 0;
  
-	/* Call damage handlers only if necessary */

-   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
-   return 0;
-
if (helper->buffer) {
ret = drm_fbdev_damage_blit(helper, clip);
if (drm_WARN_ONCE(dev, ret, "Damage blitter failed: ret=%d\n", 
ret))


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH v2 07/13] drm/format-helper: Add conversion from XRGB8888 to ARGB8888

2022-12-21 Thread kernel test robot
Hi Thomas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[cannot apply to linus/master v6.1 next-20221220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/drm-Fix-color-format-selection-in-fbdev-emulation/20221221-001529
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20221220161145.27568-8-tzimmermann%40suse.de
patch subject: [PATCH v2 07/13] drm/format-helper: Add conversion from XRGB 
to ARGB
config: m68k-randconfig-s031-20221218
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# 
https://github.com/intel-lab-lkp/linux/commit/8e830536f6942bc56b4942165a14058d60c69f8c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Thomas-Zimmermann/drm-Fix-color-format-selection-in-fbdev-emulation/20221221-001529
git checkout 8e830536f6942bc56b4942165a14058d60c69f8c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k 
SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/drm_format_helper.c:459:27: sparse: sparse: incorrect type 
>> in assignment (different base types) @@ expected unsigned int [usertype] 
>> @@ got restricted __le32 [usertype] @@
   drivers/gpu/drm/drm_format_helper.c:459:27: sparse: expected unsigned 
int [usertype]
   drivers/gpu/drm/drm_format_helper.c:459:27: sparse: got restricted 
__le32 [usertype]

vim +459 drivers/gpu/drm/drm_format_helper.c

   448  
   449  static void drm_fb_xrgb_to_argb_line(void *dbuf, const void 
*sbuf, unsigned int pixels)
   450  {
   451  u32 *dbuf32 = dbuf;
   452  const __le32 *sbuf32 = sbuf;
   453  unsigned int x;
   454  u32 pix;
   455  
   456  for (x = 0; x < pixels; x++) {
   457  pix = le32_to_cpu(sbuf32[x]);
   458  pix |= GENMASK(31, 24); /* fill alpha bits */
 > 459  dbuf32[x] = cpu_to_le32(pix);
   460  }
   461  }
   462  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
#
# Automatically generated file; DO NOT EDIT.
# Linux/m68k 6.1.0-rc6 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="m68k-linux-gcc (GCC) 12.1.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=120100
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23800
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=23800
CONFIG_LLD_VERSION=0
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
CONFIG_PAHOLE_VERSION=123
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_COMPILE_TEST=y
# CONFIG_WERROR is not set
CONFIG_LOCALVERSION=""
CONFIG_BUILD_SALT=""
CONFIG_DEFAULT_INIT=""
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_WATCH_QUEUE=y
# CONFIG_USELIB is not set

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_SIM=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS=y
# CONFIG_GENERIC_IRQ_DEBUGFS is not set
# end of IRQ subsystem

CONFIG_LEGACY_TIMER_TICK=y

#
# BPF subsystem
#
# CONFIG_BPF_SYSCALL is not set
# end of BPF subsystem

CONFIG_PREEMPT_VOLUNTARY_BUILD=y
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not set
CONFIG_PREEMPT_COUNT=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_PSI is not set
# end of CPU/Task time and stats accounting

CONFIG_CPU_ISOLATION=y

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
# CONFIG_RCU_EXPERT is not set
CONFIG_SRCU=y
CONFIG_TINY_SRCU=y
# end of RCU Subsystem

# CONFIG_IKCONFIG is not set
# CONFIG_IKHEADERS is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13
CONFIG_PRINTK_INDEX=y

#
# Scheduler features
#
# end of Scheduler features

CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
CONFIG_GCC12_NO_ARRAY_BOUNDS=y
CON

Re: [PATCH 2/2] dt-bindings: leds: backlight: add binding for Kinetic KTZ8866 backlight

2022-12-21 Thread Rob Herring


On Wed, 21 Dec 2022 15:02:16 +0800, Jianhua Lu wrote:
> Add device tree bindings for the Kinetic KTZ8866 backlight driver.
> 
> Signed-off-by: Jianhua Lu 
> ---
>  .../leds/backlight/kinetic,ktz8866.yaml   | 37 +++
>  1 file changed, 37 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.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/leds/backlight/kinetic,ktz8866.yaml:
 properties:compatible:items: {'const': 'kinetic,ktz8866'} is not of type 
'array'
from schema $id: http://devicetree.org/meta-schemas/string-array.yaml#

doc reference errors (make refcheckdocs):

See 
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20221221070216.17850-1-lujianhua...@gmail.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.



[Bug 216806] [Raven Ridge] console disappears after framebuffer device loads

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

--- Comment #4 from Balazs Vinarz (viniba...@gmail.com) ---
Just some more information to share here. I gave it another try, and the
console  freezes exactly at the moment when drm enables the kernel modesetting. 
[6.329371] [drm] amdgpu kernel modesetting enabled.
With nomodesetting it works like it should, the vgaconsole remain active and
useable.
Do we know somebody who has some knowledge to understand the DRM logs?
Otherwise these lines are pretty strange for me:
[6.330490] amdgpu: Ignoring ACPI CRAT on non-APU system
.
.
.
[6.515889] [drm] failed to load ucode RLC_RESTORE_LIST_CNTL(0x28) 
[6.515892] [drm] psp gfx command LOAD_IP_FW(0x6) failed and response status
is (0x300F)
[6.516529] [drm] failed to load ucode RLC_RESTORE_LIST_GPM_MEM(0x29) 
[6.516531] [drm] psp gfx command LOAD_IP_FW(0x6) failed and response status
is (0x000F)
[6.517064] [drm] failed to load ucode RLC_RESTORE_LIST_SRM_MEM(0x2A) 
[6.517066] [drm] psp gfx command LOAD_IP_FW(0x6) failed and response status
is (0x000F)
.
.
.
[6.549311] [drm] psp gfx command LOAD_ASD(0x4) failed and response status
is (0x34)
[6.549317] amdgpu :04:00.0: amdgpu: RAS: optional ras ta ucode is not
available
[6.550582] [drm] psp gfx command LOAD_TA(0x1) failed and response status is
(0x34)
[6.551810] [drm] psp gfx command LOAD_TA(0x1) failed and response status is
(0x34)

-- 
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 09/13] drm/format-helper: Add conversion from XRGB8888 to 15-bit RGB555 formats

2022-12-21 Thread kernel test robot
Hi Thomas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[cannot apply to linus/master v6.1 next-20221220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/drm-Fix-color-format-selection-in-fbdev-emulation/20221221-001529
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20221220161145.27568-10-tzimmermann%40suse.de
patch subject: [PATCH v2 09/13] drm/format-helper: Add conversion from XRGB 
to 15-bit RGB555 formats
config: m68k-randconfig-s031-20221218
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# 
https://github.com/intel-lab-lkp/linux/commit/a8fee6947a797f9ae6b08708f1a355f3a34cc7ce
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Thomas-Zimmermann/drm-Fix-color-format-selection-in-fbdev-emulation/20221221-001529
git checkout a8fee6947a797f9ae6b08708f1a355f3a34cc7ce
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k 
SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/drm_format_helper.c:412:27: sparse: sparse: incorrect type 
>> in assignment (different base types) @@ expected unsigned short 
>> [usertype] @@ got restricted __le16 [usertype] @@
   drivers/gpu/drm/drm_format_helper.c:412:27: sparse: expected unsigned 
short [usertype]
   drivers/gpu/drm/drm_format_helper.c:412:27: sparse: got restricted 
__le16 [usertype]
   drivers/gpu/drm/drm_format_helper.c:464:27: sparse: sparse: incorrect type 
in assignment (different base types) @@ expected unsigned short [usertype] 
@@ got restricted __le16 [usertype] @@
   drivers/gpu/drm/drm_format_helper.c:464:27: sparse: expected unsigned 
short [usertype]
   drivers/gpu/drm/drm_format_helper.c:464:27: sparse: got restricted 
__le16 [usertype]
   drivers/gpu/drm/drm_format_helper.c:516:27: sparse: sparse: incorrect type 
in assignment (different base types) @@ expected unsigned short [usertype] 
@@ got restricted __le16 [usertype] @@
   drivers/gpu/drm/drm_format_helper.c:516:27: sparse: expected unsigned 
short [usertype]
   drivers/gpu/drm/drm_format_helper.c:516:27: sparse: got restricted 
__le16 [usertype]
   drivers/gpu/drm/drm_format_helper.c:614:27: sparse: sparse: incorrect type 
in assignment (different base types) @@ expected unsigned int [usertype] @@ 
got restricted __le32 [usertype] @@
   drivers/gpu/drm/drm_format_helper.c:614:27: sparse: expected unsigned 
int [usertype]
   drivers/gpu/drm/drm_format_helper.c:614:27: sparse: got restricted 
__le32 [usertype]

vim +412 drivers/gpu/drm/drm_format_helper.c

   398  
   399  static void drm_fb_xrgb_to_xrgb1555_line(void *dbuf, const void 
*sbuf, unsigned int pixels)
   400  {
   401  u16 *dbuf16 = dbuf;
   402  const __le32 *sbuf32 = sbuf;
   403  unsigned int x;
   404  u16 val16;
   405  u32 pix;
   406  
   407  for (x = 0; x < pixels; x++) {
   408  pix = le32_to_cpu(sbuf32[x]);
   409  val16 = ((pix & 0x00f8) >> 9) |
   410  ((pix & 0xf800) >> 6) |
   411  ((pix & 0x00f8) >> 3);
 > 412  dbuf16[x] = cpu_to_le16(val16);
   413  }
   414  }
   415  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
#
# Automatically generated file; DO NOT EDIT.
# Linux/m68k 6.1.0-rc6 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="m68k-linux-gcc (GCC) 12.1.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=120100
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23800
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=23800
CONFIG_LLD_VERSION=0
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
CONFIG_PAHOLE_VERSION=123
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONF

RE: [PATCH v9 01/15] drm/msm/disp/dpu: clear dpu_assign_crtc and get crtc from connector state instead of dpu_enc

2022-12-21 Thread Vinod Polimera


> -Original Message-
> From: Dmitry Baryshkov 
> Sent: Wednesday, December 14, 2022 9:05 PM
> To: Vinod Polimera (QUIC) ; dri-
> de...@lists.freedesktop.org; linux-arm-...@vger.kernel.org;
> freedr...@lists.freedesktop.org; devicet...@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org; robdcl...@gmail.com;
> diand...@chromium.org; swb...@chromium.org; Kalyan Thota (QUIC)
> ; Kuogee Hsieh (QUIC)
> ; Vishnuvardhan Prodduturi (QUIC)
> ; Bjorn Andersson (QUIC)
> ; Aravind Venkateswaran (QUIC)
> ; Abhinav Kumar (QUIC)
> ; Sankeerth Billakanti (QUIC)
> 
> Subject: Re: [PATCH v9 01/15] drm/msm/disp/dpu: clear dpu_assign_crtc and
> get crtc from connector state instead of dpu_enc
> 
> WARNING: This email originated from outside of Qualcomm. Please be wary
> of any links or attachments, and do not enable macros.
> 
> On 14/12/2022 12:05, Vinod Polimera wrote:
> > Update crtc retrieval from dpu_enc to dpu_enc connector state,
> > since new links get set as part of the dpu enc virt mode set.
> > The dpu_enc->crtc cache is no more needed, hence cleaning it as
> > part of this change.
> >
> > This patch is dependent on the series:
> > https://patchwork.freedesktop.org/series/110969/
> >
> > Signed-off-by: Vinod Polimera 
> > ---
> >   drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ---
> >   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 42 +-
> ---
> >   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  8 --
> >   3 files changed, 13 insertions(+), 41 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > index 3f72d38..289d51e 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > @@ -1029,7 +1029,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc,
> >*/
> >   if (dpu_encoder_get_intf_mode(encoder) == INTF_MODE_VIDEO)
> >   release_bandwidth = true;
> > - dpu_encoder_assign_crtc(encoder, NULL);
> >   }
> >
> >   /* wait for frame_event_done completion */
> > @@ -1099,9 +1098,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
> >   trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
> >   dpu_crtc->enabled = true;
> >
> > - drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state-
> >encoder_mask)
> > - dpu_encoder_assign_crtc(encoder, crtc);
> > -
> >   /* Enable/restore vblank irq handling */
> >   drm_crtc_vblank_on(crtc);
> >   }
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > index a585036..b9b254d 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > @@ -132,11 +132,6 @@ enum dpu_enc_rc_states {
> >* @intfs_swapped:  Whether or not the phys_enc interfaces have been
> swapped
> >*  for partial update right-only cases, such as pingpong
> >*  split where virtual pingpong does not generate IRQs
> > - * @crtc:Pointer to the currently assigned crtc. Normally you
> > - *   would use crtc->state->encoder_mask to determine the
> > - *   link between encoder/crtc. However in this case we 
> > need
> > - *   to track crtc in the disable() hook which is called
> > - *   _after_ encoder_mask is cleared.
> >* @connector:  If a mode is set, cached pointer to the active
> connector
> >* @crtc_kickoff_cb:Callback into CRTC that will flush & 
> > start
> >*  all CTL paths
> > @@ -181,7 +176,6 @@ struct dpu_encoder_virt {
> >
> >   bool intfs_swapped;
> >
> > - struct drm_crtc *crtc;
> >   struct drm_connector *connector;
> >
> >   struct dentry *debugfs_root;
> > @@ -1317,7 +1311,7 @@ static void dpu_encoder_vblank_callback(struct
> drm_encoder *drm_enc,
> >   struct dpu_encoder_phys *phy_enc)
> >   {
> >   struct dpu_encoder_virt *dpu_enc = NULL;
> > - unsigned long lock_flags;
> > + struct drm_crtc *crtc;
> >
> >   if (!drm_enc || !phy_enc)
> >   return;
> > @@ -1325,12 +1319,13 @@ static void dpu_encoder_vblank_callback(struct
> drm_encoder *drm_enc,
> >   DPU_ATRACE_BEGIN("encoder_vblank_callback");
> >   dpu_enc = to_dpu_encoder_virt(drm_enc);
> >
> > - atomic_inc(&phy_enc->vsync_cnt);
> > + if (!dpu_enc->connector || !dpu_enc->connector->state ||
> > + !dpu_enc->connector->state->crtc)
> > + return;
> >
> > - spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags);
> > - if (dpu_enc->crtc)
> > - dpu_crtc_vblank_callback(dpu_enc->crtc);
> > - spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags);
> > + atomic_inc(&phy_enc->vsync_cnt);
> > + crtc = dpu_enc->connector->state->crtc;
> > + dpu_crtc_vblank_callback(crtc);
> >

Re: [PATCH v3 1/5] PM: domains: Allow a genpd consumer to require a synced power off

2022-12-21 Thread Ulf Hansson
On Tue, 20 Dec 2022 at 08:44, Akhil P Oommen  wrote:
>
> From: Ulf Hansson 
>
> Some genpd providers doesn't ensure that it has turned off at hardware.
> This is fine until the consumer really requires during some special
> scenarios that the power domain collapse at hardware before it is
> turned ON again.
>
> An example is the reset sequence of Adreno GPU which requires that the
> 'gpucc cx gdsc' power domain should move to OFF state in hardware at
> least once before turning in ON again to clear the internal state.
>
> Signed-off-by: Ulf Hansson 
> Signed-off-by: Akhil P Oommen 
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Minor formatting fix
>
>  drivers/base/power/domain.c | 23 +++
>  include/linux/pm_domain.h   |  5 +
>  2 files changed, 28 insertions(+)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 967bcf9d415e..53524a102321 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -519,6 +519,28 @@ ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(dev_pm_genpd_get_next_hrtimer);
>
> +/*
> + * dev_pm_genpd_synced_poweroff - Next power off should be synchronous
> + *
> + * @dev: A device that is attached to the genpd.
> + *
> + * Allows a consumer of the genpd to notify the provider that the next power 
> off
> + * should be synchronous.

Nitpick; similar to other dev_pm_genpd_* function-descriptions, I
think it's important to add the below information.

"It is assumed that the users guarantee that the genpd wouldn't be
detached while this routine is getting called."

Can you please add that?

> + */
> +void dev_pm_genpd_synced_poweroff(struct device *dev)
> +{
> +   struct generic_pm_domain *genpd;
> +
> +   genpd = dev_to_genpd_safe(dev);
> +   if (!genpd)
> +   return;
> +
> +   genpd_lock(genpd);
> +   genpd->synced_poweroff = true;
> +   genpd_unlock(genpd);
> +}
> +EXPORT_SYMBOL_GPL(dev_pm_genpd_synced_poweroff);
> +
>  static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
>  {
> unsigned int state_idx = genpd->state_idx;
> @@ -562,6 +584,7 @@ static int _genpd_power_on(struct generic_pm_domain 
> *genpd, bool timed)
>
>  out:
> raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_ON, 
> NULL);
> +   genpd->synced_poweroff = false;
> return 0;
>  err:
> raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_OFF,
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 1cd41bdf73cf..f776fb93eaa0 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -136,6 +136,7 @@ struct generic_pm_domain {
> unsigned int prepared_count;/* Suspend counter of prepared 
> devices */
> unsigned int performance_state; /* Aggregated max performance state */
> cpumask_var_t cpus; /* A cpumask of the attached CPUs */
> +   bool synced_poweroff;   /* A consumer needs a synced poweroff 
> */
> int (*power_off)(struct generic_pm_domain *domain);
> int (*power_on)(struct generic_pm_domain *domain);
> struct raw_notifier_head power_notifiers; /* Power on/off notifiers */
> @@ -235,6 +236,7 @@ int dev_pm_genpd_add_notifier(struct device *dev, struct 
> notifier_block *nb);
>  int dev_pm_genpd_remove_notifier(struct device *dev);
>  void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next);
>  ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev);
> +void dev_pm_genpd_synced_poweroff(struct device *dev);
>
>  extern struct dev_power_governor simple_qos_governor;
>  extern struct dev_power_governor pm_domain_always_on_gov;
> @@ -300,6 +302,9 @@ static inline ktime_t 
> dev_pm_genpd_get_next_hrtimer(struct device *dev)
>  {
> return KTIME_MAX;
>  }
> +static inline void dev_pm_genpd_synced_poweroff(struct device *dev)
> +{ }
> +
>  #define simple_qos_governor(*(struct dev_power_governor *)(NULL))
>  #define pm_domain_always_on_gov(*(struct dev_power_governor 
> *)(NULL))
>  #endif
> --
> 2.7.4
>

Kind regards
Uffe


Re: [RESEND] dt-bindings: leds: backlight: Add Kinetic KTZ8866 backlight

2022-12-21 Thread Krzysztof Kozlowski
On 21/12/2022 14:24, Jianhua Lu wrote:
> Add Kinetic KTZ8866 backlight binding documentation.
> 
> Signed-off-by: Jianhua Lu 

Do not resend. You need to fix everything, test and send a new patchset
(entire) with the changelog.

Best regards,
Krzysztof



[PATCH v2 1/4] drm/msm/adreno: Fix null ptr access in adreno_gpu_cleanup()

2022-12-21 Thread Akhil P Oommen
Fix the below kernel panic due to null pointer access:
[   18.504431] Unable to handle kernel NULL pointer dereference at virtual 
address 0048
[   18.513464] Mem abort info:
[   18.516346]   ESR = 0x9605
[   18.520204]   EC = 0x25: DABT (current EL), IL = 32 bits
[   18.525706]   SET = 0, FnV = 0
[   18.528878]   EA = 0, S1PTW = 0
[   18.532117]   FSC = 0x05: level 1 translation fault
[   18.537138] Data abort info:
[   18.540110]   ISV = 0, ISS = 0x0005
[   18.544060]   CM = 0, WnR = 0
[   18.547109] user pgtable: 4k pages, 39-bit VAs, pgdp=000112826000
[   18.553738] [0048] pgd=, p4d=, 
pud=
[   18.562690] Internal error: Oops: 9605 [#1] PREEMPT SMP
**Snip**
[   18.696758] Call trace:
[   18.699278]  adreno_gpu_cleanup+0x30/0x88
[   18.703396]  a6xx_destroy+0xc0/0x130
[   18.707066]  a6xx_gpu_init+0x308/0x424
[   18.710921]  adreno_bind+0x178/0x288
[   18.714590]  component_bind_all+0xe0/0x214
[   18.718797]  msm_drm_bind+0x1d4/0x614
[   18.722566]  try_to_bring_up_aggregate_device+0x16c/0x1b8
[   18.728105]  __component_add+0xa0/0x158
[   18.732048]  component_add+0x20/0x2c
[   18.735719]  adreno_probe+0x40/0xc0
[   18.739300]  platform_probe+0xb4/0xd4
[   18.743068]  really_probe+0xfc/0x284
[   18.746738]  __driver_probe_device+0xc0/0xec
[   18.751129]  driver_probe_device+0x48/0x110
[   18.755421]  __device_attach_driver+0xa8/0xd0
[   18.759900]  bus_for_each_drv+0x90/0xdc
[   18.763843]  __device_attach+0xfc/0x174
[   18.767786]  device_initial_probe+0x20/0x2c
[   18.772090]  bus_probe_device+0x40/0xa0
[   18.776032]  deferred_probe_work_func+0x94/0xd0
[   18.780686]  process_one_work+0x190/0x3d0
[   18.784805]  worker_thread+0x280/0x3d4
[   18.788659]  kthread+0x104/0x1c0
[   18.791981]  ret_from_fork+0x10/0x20
[   18.795654] Code: f9400408 aa0003f3 aa1f03f4 91142015 (f9402516)
[   18.801913] ---[ end trace  ]---
[   18.809039] Kernel panic - not syncing: Oops: Fatal exception

Fixes: 17e822f7591f ("drm/msm: fix unbalanced pm_runtime_enable in 
adreno_gpu_{init, cleanup}")
Signed-off-by: Akhil P Oommen 
---

Changes in v2:
- Added 'Fixes' tag (Dan Carpenter)

 drivers/gpu/drm/msm/adreno/adreno_gpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 382fb7f9e497..118d07e5c66c 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -1073,13 +1073,13 @@ int adreno_gpu_init(struct drm_device *drm, struct 
platform_device *pdev,
 void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)
 {
struct msm_gpu *gpu = &adreno_gpu->base;
-   struct msm_drm_private *priv = gpu->dev->dev_private;
+   struct msm_drm_private *priv = gpu->dev ? gpu->dev->dev_private : NULL;
unsigned int i;
 
for (i = 0; i < ARRAY_SIZE(adreno_gpu->info->fw); i++)
release_firmware(adreno_gpu->fw[i]);
 
-   if (pm_runtime_enabled(&priv->gpu_pdev->dev))
+   if (priv && pm_runtime_enabled(&priv->gpu_pdev->dev))
pm_runtime_disable(&priv->gpu_pdev->dev);
 
msm_gpu_cleanup(&adreno_gpu->base);
-- 
2.7.4



[PATCH v2 2/4] drm/msm: Fix failure paths in msm_drm_init()

2022-12-21 Thread Akhil P Oommen
Ensure that we do drm_dev_put() when there is an early return in
msm_drm_init().

Signed-off-by: Akhil P Oommen 
---

(no changes since v1)

 drivers/gpu/drm/msm/disp/msm_disp_snapshot.c |  3 +++
 drivers/gpu/drm/msm/msm_drv.c| 11 +++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c 
b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c
index e75b97127c0d..b73031cd48e4 100644
--- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c
+++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c
@@ -129,6 +129,9 @@ void msm_disp_snapshot_destroy(struct drm_device *drm_dev)
}
 
priv = drm_dev->dev_private;
+   if (!priv->kms)
+   return;
+
kms = priv->kms;
 
if (kms->dump_worker)
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index eb5b056ce3f7..544e041dd710 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -149,6 +149,9 @@ static void msm_irq_uninstall(struct drm_device *dev)
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
 
+   if (!priv->kms)
+   return;
+
kms->funcs->irq_uninstall(kms);
if (kms->irq_requested)
free_irq(kms->irq, dev);
@@ -265,8 +268,6 @@ static int msm_drm_uninit(struct device *dev)
component_unbind_all(dev, ddev);
 
ddev->dev_private = NULL;
-   drm_dev_put(ddev);
-
destroy_workqueue(priv->wq);
 
return 0;
@@ -441,12 +442,12 @@ static int msm_drm_init(struct device *dev, const struct 
drm_driver *drv)
 
ret = msm_init_vram(ddev);
if (ret)
-   return ret;
+   goto err_drm_dev_put;
 
/* Bind all our sub-components: */
ret = component_bind_all(dev, ddev);
if (ret)
-   return ret;
+   goto err_drm_dev_put;
 
dma_set_max_seg_size(dev, UINT_MAX);
 
@@ -541,6 +542,8 @@ static int msm_drm_init(struct device *dev, const struct 
drm_driver *drv)
 
 err_msm_uninit:
msm_drm_uninit(dev);
+err_drm_dev_put:
+   drm_dev_put(ddev);
return ret;
 }
 
-- 
2.7.4



[PATCH v2 3/4] drm/msm/a6xx: Update a6xx gpu coredump

2022-12-21 Thread Akhil P Oommen
Update gpu coredump for a660/a650 family of gpus with the extra
information available.

Signed-off-by: Akhil P Oommen 
---

(no changes since v1)

 drivers/gpu/drm/msm/adreno/a6xx.xml.h   | 18 +++
 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 50 -
 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h | 49 +++-
 3 files changed, 108 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx.xml.h 
b/drivers/gpu/drm/msm/adreno/a6xx.xml.h
index beea4a7fc1df..a92788019376 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx.xml.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx.xml.h
@@ -241,6 +241,9 @@ enum a6xx_shader_id {
A6XX_HLSQ_FRONTEND_META = 97,
A6XX_HLSQ_INDIRECT_META = 98,
A6XX_HLSQ_BACKEND_META = 99,
+   A6XX_SP_LB_6_DATA = 112,
+   A6XX_SP_LB_7_DATA = 113,
+   A6XX_HLSQ_INST_RAM_1 = 115,
 };
 
 enum a6xx_debugbus_id {
@@ -274,19 +277,32 @@ enum a6xx_debugbus_id {
A6XX_DBGBUS_HLSQ_SPTP = 31,
A6XX_DBGBUS_RB_0 = 32,
A6XX_DBGBUS_RB_1 = 33,
+   A6XX_DBGBUS_RB_2 = 34,
A6XX_DBGBUS_UCHE_WRAPPER = 36,
A6XX_DBGBUS_CCU_0 = 40,
A6XX_DBGBUS_CCU_1 = 41,
+   A6XX_DBGBUS_CCU_2 = 42,
A6XX_DBGBUS_VFD_0 = 56,
A6XX_DBGBUS_VFD_1 = 57,
A6XX_DBGBUS_VFD_2 = 58,
A6XX_DBGBUS_VFD_3 = 59,
+   A6XX_DBGBUS_VFD_4 = 60,
+   A6XX_DBGBUS_VFD_5 = 61,
A6XX_DBGBUS_SP_0 = 64,
A6XX_DBGBUS_SP_1 = 65,
+   A6XX_DBGBUS_SP_2 = 66,
A6XX_DBGBUS_TPL1_0 = 72,
A6XX_DBGBUS_TPL1_1 = 73,
A6XX_DBGBUS_TPL1_2 = 74,
A6XX_DBGBUS_TPL1_3 = 75,
+   A6XX_DBGBUS_TPL1_4 = 76,
+   A6XX_DBGBUS_TPL1_5 = 77,
+   A6XX_DBGBUS_SPTP_0 = 88,
+   A6XX_DBGBUS_SPTP_1 = 89,
+   A6XX_DBGBUS_SPTP_2 = 90,
+   A6XX_DBGBUS_SPTP_3 = 91,
+   A6XX_DBGBUS_SPTP_4 = 92,
+   A6XX_DBGBUS_SPTP_5 = 93,
 };
 
 enum a6xx_cp_perfcounter_select {
@@ -1071,6 +1087,8 @@ enum a6xx_tex_type {
 
 #define REG_A6XX_CP_MISC_CNTL  0x0840
 
+#define REG_A6XX_CP_CHICKEN_DBG
0x0841
+
 #define REG_A6XX_CP_APRIV_CNTL 0x0844
 
 #define REG_A6XX_CP_ROQ_THRESHOLDS_1   0x08c1
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
index c61b233aff09..da190b6ddba0 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
@@ -385,6 +385,9 @@ static void a6xx_get_debugbus(struct msm_gpu *gpu,
nr_debugbus_blocks = ARRAY_SIZE(a6xx_debugbus_blocks) +
(a6xx_has_gbif(to_adreno_gpu(gpu)) ? 1 : 0);
 
+   if (adreno_is_a650_family(to_adreno_gpu(gpu)))
+   nr_debugbus_blocks += ARRAY_SIZE(a650_debugbus_blocks);
+
a6xx_state->debugbus = state_kcalloc(a6xx_state, nr_debugbus_blocks,
sizeof(*a6xx_state->debugbus));
 
@@ -411,6 +414,15 @@ static void a6xx_get_debugbus(struct msm_gpu *gpu,
 
a6xx_state->nr_debugbus += 1;
}
+
+
+   if (adreno_is_a650_family(to_adreno_gpu(gpu))) {
+   for (i = 0; i < ARRAY_SIZE(a650_debugbus_blocks); i++)
+   a6xx_get_debugbus_block(gpu,
+   a6xx_state,
+   &a650_debugbus_blocks[i],
+   &a6xx_state->debugbus[i]);
+   }
}
 
/*  Dump the VBIF debugbus on applicable targets */
@@ -524,10 +536,21 @@ static void a6xx_get_cluster(struct msm_gpu *gpu,
struct a6xx_gpu_state_obj *obj,
struct a6xx_crashdumper *dumper)
 {
+   struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
u64 *in = dumper->ptr;
u64 out = dumper->iova + A6XX_CD_DATA_OFFSET;
size_t datasize;
int i, regcount = 0;
+   u32 id = cluster->id;
+
+   /* Skip registers that are not present on older generation */
+   if (!adreno_is_a660_family(adreno_gpu) &&
+   cluster->registers == a660_fe_cluster)
+   return;
+
+   if (adreno_is_a650_family(adreno_gpu) &&
+   cluster->registers == a6xx_ps_cluster)
+   id = CLUSTER_VPC_PS;
 
/* Some clusters need a selector register to be programmed too */
if (cluster->sel_reg)
@@ -537,7 +560,7 @@ static void a6xx_get_cluster(struct msm_gpu *gpu,
int j;
 
in += CRASHDUMP_WRITE(in, REG_A6XX_CP_APERTURE_CNTL_CD,
-   (cluster->id << 8) | (i << 4) | i);
+   (id << 8) | (i << 4) | i);
 
for (j = 0; j < cluster->count; j += 2) {
int count = RANGE(cluster->registers, j);
@@ -687,6 +710,11 @@ static void a6xx_get_crashdumper_registers(struct 

[PATCH v2 4/4] drm/msm/a6xx: Update ROQ size in coredump

2022-12-21 Thread Akhil P Oommen
Since RoQ size differs between generations, calculate dynamically the
RoQ size while capturing coredump.

Signed-off-by: Akhil P Oommen 
---

(no changes since v1)

 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 11 ++-
 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h | 17 ++---
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
index da190b6ddba0..80e60e34ce7d 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
@@ -939,15 +939,24 @@ static void a6xx_get_registers(struct msm_gpu *gpu,
dumper);
 }
 
+static u32 a6xx_get_cp_roq_size(struct msm_gpu *gpu)
+{
+   /* The value at [16:31] is in 4dword units. Convert it to dwords */
+   return gpu_read(gpu, REG_A6XX_CP_ROQ_THRESHOLDS_2) >> 14;
+}
+
 /* Read a block of data from an indexed register pair */
 static void a6xx_get_indexed_regs(struct msm_gpu *gpu,
struct a6xx_gpu_state *a6xx_state,
-   const struct a6xx_indexed_registers *indexed,
+   struct a6xx_indexed_registers *indexed,
struct a6xx_gpu_state_obj *obj)
 {
int i;
 
obj->handle = (const void *) indexed;
+   if (indexed->count_fn)
+   indexed->count = indexed->count_fn(gpu);
+
obj->data = state_kcalloc(a6xx_state, indexed->count, sizeof(u32));
if (!obj->data)
return;
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h
index 808121c88662..790f55e24533 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.h
@@ -383,25 +383,28 @@ static const struct a6xx_registers a6xx_gmu_reglist[] = {
REGS(a6xx_gmu_gx_registers, 0, 0),
 };
 
-static const struct a6xx_indexed_registers {
+static u32 a6xx_get_cp_roq_size(struct msm_gpu *gpu);
+
+static struct a6xx_indexed_registers {
const char *name;
u32 addr;
u32 data;
u32 count;
+   u32 (*count_fn)(struct msm_gpu *gpu);
 } a6xx_indexed_reglist[] = {
{ "CP_SQE_STAT", REG_A6XX_CP_SQE_STAT_ADDR,
-   REG_A6XX_CP_SQE_STAT_DATA, 0x33 },
+   REG_A6XX_CP_SQE_STAT_DATA, 0x33, NULL },
{ "CP_DRAW_STATE", REG_A6XX_CP_DRAW_STATE_ADDR,
-   REG_A6XX_CP_DRAW_STATE_DATA, 0x100 },
+   REG_A6XX_CP_DRAW_STATE_DATA, 0x100, NULL },
{ "CP_UCODE_DBG_DATA", REG_A6XX_CP_SQE_UCODE_DBG_ADDR,
-   REG_A6XX_CP_SQE_UCODE_DBG_DATA, 0x6000 },
+   REG_A6XX_CP_SQE_UCODE_DBG_DATA, 0x8000, NULL },
{ "CP_ROQ", REG_A6XX_CP_ROQ_DBG_ADDR,
-   REG_A6XX_CP_ROQ_DBG_DATA, 0x400 },
+   REG_A6XX_CP_ROQ_DBG_DATA, 0, a6xx_get_cp_roq_size},
 };
 
-static const struct a6xx_indexed_registers a6xx_cp_mempool_indexed = {
+static struct a6xx_indexed_registers a6xx_cp_mempool_indexed = {
"CP_MEMPOOL", REG_A6XX_CP_MEM_POOL_DBG_ADDR,
-   REG_A6XX_CP_MEM_POOL_DBG_DATA, 0x2060,
+   REG_A6XX_CP_MEM_POOL_DBG_DATA, 0x2060, NULL,
 };
 
 #define DEBUGBUS(_id, _count) { .id = _id, .name = #_id, .count = _count }
-- 
2.7.4



Re: [PATCH] drm/panfrost: Fix GEM handle creation ref-counting

2022-12-21 Thread Steven Price
On 19/12/2022 17:10, Rob Clark wrote:
> On Mon, Dec 19, 2022 at 6:02 AM Steven Price  wrote:
>>
>> panfrost_gem_create_with_handle() previously returned a BO but with the
>> only reference being from the handle, which user space could in theory
>> guess and release, causing a use-after-free. Additionally if the call to
>> panfrost_gem_mapping_get() in panfrost_ioctl_create_bo() failed then
>> a(nother) reference on the BO was dropped.
>>
>> The _create_with_handle() is a problematic pattern, so ditch it and
>> instead create the handle in panfrost_ioctl_create_bo(). If the call to
>> panfrost_gem_mapping_get() fails then this means that user space has
>> indeed gone behind our back and freed the handle. In which case just
>> return an error code.
>>
>> Reported-by: Rob Clark 
> 
> Yeah, I like getting rid of the _create_with_handle() pattern, the
> only place where that pattern works is if you immediately return the
> handle to userspace (and don't otherwise touch the obj)
> 
> Reviewed-by: Rob Clark 

Thanks, I've pushed this to drm-misc-fixes:

4217c6ac8174 ("drm/panfrost: Fix GEM handle creation ref-counting")

Steve

>> Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver")
>> Signed-off-by: Steven Price 
>> ---
>>  drivers/gpu/drm/panfrost/panfrost_drv.c | 27 -
>>  drivers/gpu/drm/panfrost/panfrost_gem.c | 16 +--
>>  drivers/gpu/drm/panfrost/panfrost_gem.h |  5 +
>>  3 files changed, 20 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c 
>> b/drivers/gpu/drm/panfrost/panfrost_drv.c
>> index fa619fe72086..abb0dadd8f63 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
>> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
>> @@ -82,6 +82,7 @@ static int panfrost_ioctl_create_bo(struct drm_device 
>> *dev, void *data,
>> struct panfrost_gem_object *bo;
>> struct drm_panfrost_create_bo *args = data;
>> struct panfrost_gem_mapping *mapping;
>> +   int ret;
>>
>> if (!args->size || args->pad ||
>> (args->flags & ~(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP)))
>> @@ -92,21 +93,29 @@ static int panfrost_ioctl_create_bo(struct drm_device 
>> *dev, void *data,
>> !(args->flags & PANFROST_BO_NOEXEC))
>> return -EINVAL;
>>
>> -   bo = panfrost_gem_create_with_handle(file, dev, args->size, 
>> args->flags,
>> -&args->handle);
>> +   bo = panfrost_gem_create(dev, args->size, args->flags);
>> if (IS_ERR(bo))
>> return PTR_ERR(bo);
>>
>> +   ret = drm_gem_handle_create(file, &bo->base.base, &args->handle);
>> +   if (ret)
>> +   goto out;
>> +
>> mapping = panfrost_gem_mapping_get(bo, priv);
>> -   if (!mapping) {
>> -   drm_gem_object_put(&bo->base.base);
>> -   return -EINVAL;
>> +   if (mapping) {
>> +   args->offset = mapping->mmnode.start << PAGE_SHIFT;
>> +   panfrost_gem_mapping_put(mapping);
>> +   } else {
>> +   /* This can only happen if the handle from
>> +* drm_gem_handle_create() has already been guessed and freed
>> +* by user space
>> +*/
>> +   ret = -EINVAL;
>> }
>>
>> -   args->offset = mapping->mmnode.start << PAGE_SHIFT;
>> -   panfrost_gem_mapping_put(mapping);
>> -
>> -   return 0;
>> +out:
>> +   drm_gem_object_put(&bo->base.base);
>> +   return ret;
>>  }
>>
>>  /**
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c 
>> b/drivers/gpu/drm/panfrost/panfrost_gem.c
>> index 293e799e2fe8..3c812fbd126f 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_gem.c
>> +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
>> @@ -235,12 +235,8 @@ struct drm_gem_object 
>> *panfrost_gem_create_object(struct drm_device *dev, size_t
>>  }
>>
>>  struct panfrost_gem_object *
>> -panfrost_gem_create_with_handle(struct drm_file *file_priv,
>> -   struct drm_device *dev, size_t size,
>> -   u32 flags,
>> -   uint32_t *handle)
>> +panfrost_gem_create(struct drm_device *dev, size_t size, u32 flags)
>>  {
>> -   int ret;
>> struct drm_gem_shmem_object *shmem;
>> struct panfrost_gem_object *bo;
>>
>> @@ -256,16 +252,6 @@ panfrost_gem_create_with_handle(struct drm_file 
>> *file_priv,
>> bo->noexec = !!(flags & PANFROST_BO_NOEXEC);
>> bo->is_heap = !!(flags & PANFROST_BO_HEAP);
>>
>> -   /*
>> -* Allocate an id of idr table where the obj is registered
>> -* and handle has the id what user can see.
>> -*/
>> -   ret = drm_gem_handle_create(file_priv, &shmem->base, handle);
>> -   /* drop reference from allocate - handle holds it now. */
>> -   drm_gem_object_put(&shmem->base);
>> -   if (ret)
>> -   return ERR_PTR(ret);
>> -
>>   

Re: [RESEND] dt-bindings: leds: backlight: Add Kinetic KTZ8866 backlight

2022-12-21 Thread Krzysztof Kozlowski
On 21/12/2022 16:15, Jianhua Lu wrote:
> On Wed, Dec 21, 2022 at 04:03:44PM +0100, Krzysztof Kozlowski wrote:
>> On 21/12/2022 14:24, Jianhua Lu wrote:
>>> Add Kinetic KTZ8866 backlight binding documentation.
>>>
>>> Signed-off-by: Jianhua Lu 
>>
>> Do not resend. You need to fix everything, test and send a new patchset
>> (entire) with the changelog.
> 
> Ok, I got it. I was just a bit confused about "Need to resend with proper
> thread".

But you did not thread it properly anyway.

Best regards,
Krzysztof



Re: [PATCH 10/13] drm/amdgpu: use scheduler depenencies for CS

2022-12-21 Thread Mike Lothian
On Fri, 14 Oct 2022 at 09:47, Christian König
 wrote:
>
> Entirely remove the sync obj in the job.
>
> Signed-off-by: Christian König 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 21 ++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h  |  2 ++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |  9 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_job.h |  1 -
>  4 files changed, 13 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index d45b86bcf7fa..0528c2b1db6e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -426,7 +426,7 @@ static int amdgpu_cs_p2_dependencies(struct 
> amdgpu_cs_parser *p,
> dma_fence_put(old);
> }
>
> -   r = amdgpu_sync_fence(&p->gang_leader->sync, fence);
> +   r = amdgpu_sync_fence(&p->sync, fence);
> dma_fence_put(fence);
> if (r)
> return r;
> @@ -448,7 +448,7 @@ static int amdgpu_syncobj_lookup_and_add(struct 
> amdgpu_cs_parser *p,
> return r;
> }
>
> -   r = amdgpu_sync_fence(&p->gang_leader->sync, fence);
> +   r = amdgpu_sync_fence(&p->sync, fence);
> if (r)
> goto error;
>
> @@ -1108,7 +1108,7 @@ static int amdgpu_cs_vm_handling(struct 
> amdgpu_cs_parser *p)
> if (r)
> return r;
>
> -   r = amdgpu_sync_fence(&job->sync, fpriv->prt_va->last_pt_update);
> +   r = amdgpu_sync_fence(&p->sync, fpriv->prt_va->last_pt_update);
> if (r)
> return r;
>
> @@ -1119,7 +1119,7 @@ static int amdgpu_cs_vm_handling(struct 
> amdgpu_cs_parser *p)
> if (r)
> return r;
>
> -   r = amdgpu_sync_fence(&job->sync, bo_va->last_pt_update);
> +   r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update);
> if (r)
> return r;
> }
> @@ -1138,7 +1138,7 @@ static int amdgpu_cs_vm_handling(struct 
> amdgpu_cs_parser *p)
> if (r)
> return r;
>
> -   r = amdgpu_sync_fence(&job->sync, bo_va->last_pt_update);
> +   r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update);
> if (r)
> return r;
> }
> @@ -1151,7 +1151,7 @@ static int amdgpu_cs_vm_handling(struct 
> amdgpu_cs_parser *p)
> if (r)
> return r;
>
> -   r = amdgpu_sync_fence(&job->sync, vm->last_update);
> +   r = amdgpu_sync_fence(&p->sync, vm->last_update);
> if (r)
> return r;
>
> @@ -1183,7 +1183,6 @@ static int amdgpu_cs_vm_handling(struct 
> amdgpu_cs_parser *p)
>  static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
>  {
> struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
> -   struct amdgpu_job *leader = p->gang_leader;
> struct amdgpu_bo_list_entry *e;
> unsigned int i;
> int r;
> @@ -1195,14 +1194,14 @@ static int amdgpu_cs_sync_rings(struct 
> amdgpu_cs_parser *p)
>
> sync_mode = amdgpu_bo_explicit_sync(bo) ?
> AMDGPU_SYNC_EXPLICIT : AMDGPU_SYNC_NE_OWNER;
> -   r = amdgpu_sync_resv(p->adev, &leader->sync, resv, sync_mode,
> +   r = amdgpu_sync_resv(p->adev, &p->sync, resv, sync_mode,
>  &fpriv->vm);
> if (r)
> return r;
> }
>
> -   for (i = 0; i < p->gang_size - 1; ++i) {
> -   r = amdgpu_sync_clone(&leader->sync, &p->jobs[i]->sync);
> +   for (i = 0; i < p->gang_size; ++i) {
> +   r = amdgpu_sync_push_to_job(&p->sync, p->jobs[i]);
> if (r)
> return r;
> }
> @@ -1248,7 +1247,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
> struct dma_fence *fence;
>
> fence = &p->jobs[i]->base.s_fence->scheduled;
> -   r = amdgpu_sync_fence(&leader->sync, fence);
> +   r = drm_sched_job_add_dependency(&leader->base, fence);
> if (r)
> goto error_cleanup;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
> index cbaa19b2b8a3..207e801c24ed 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
> @@ -75,6 +75,8 @@ struct amdgpu_cs_parser {
>
> unsignednum_post_deps;
> struct amdgpu_cs_post_dep   *post_deps;
> +
> +   struct amdgpu_sync  sync;
>  };
>
>  int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index ba98d65835b4..b8494c3b3b8a 100644
> --- a/drivers/gpu/drm/amd

Re: [PATCH 2/2] drm/fbdev: Move damage clip check to higher level

2022-12-21 Thread Hogander, Jouni
On Wed, 2022-12-21 at 13:05 +0100, Thomas Zimmermann wrote:
> Hi
> 
> Am 21.12.22 um 12:19 schrieb Jouni Högander:
> > Checking if damage clip is valid is common to all fb helpers.
> > Makes more sense to check it in higher level than adding into
> > all helpers.
> 
> It was a deliberate decision to separate damage clipping and dirty 
> updates; done in [1]. Clipping is an optional hint in our regular
> damage 
> handling via drm_framebuffer_funcs.dirty. The fb_dirty callback now 
> follows that semantics.
> 
> I mentioned that it would be better to implement those fb_ops
> callbacks 
> for i915. But if you go with fb_dirty, please implement the clipping 
> test in your callback.

Thank you for your comments. I have sent a new version. Please check.

> 
> Best regards
> Thomas
> 
> [1]
> https://patchwork.freedesktop.org/patch/509958/?series=109943&rev=3
> 
> > 
> > Cc: Ville Syrjälä 
> > Cc: Thomas Zimmermann 
> > Cc: Jani Nikula 
> > Signed-off-by: Jouni Högander 
> > ---
> >   drivers/gpu/drm/drm_fb_helper.c | 4 
> >   drivers/gpu/drm/drm_fbdev_generic.c | 4 
> >   2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c
> > b/drivers/gpu/drm/drm_fb_helper.c
> > index b3a731b9170a..78c889dbc610 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -384,6 +384,10 @@ static void drm_fb_helper_fb_dirty(struct
> > drm_fb_helper *helper)
> > clip->x2 = clip->y2 = 0;
> > spin_unlock_irqrestore(&helper->damage_lock, flags);
> >   
> > +   /* Call damage handlers only if necessary */
> > +   if (!(clip_copy.x1 < clip_copy.x2 && clip_copy.y1 <
> > clip_copy.y2))
> > +   return;
> > +
> > ret = helper->funcs->fb_dirty(helper, &clip_copy);
> > if (ret)
> > goto err;
> > diff --git a/drivers/gpu/drm/drm_fbdev_generic.c
> > b/drivers/gpu/drm/drm_fbdev_generic.c
> > index 0a4c160e0e58..6c6bb0dd2ea8 100644
> > --- a/drivers/gpu/drm/drm_fbdev_generic.c
> > +++ b/drivers/gpu/drm/drm_fbdev_generic.c
> > @@ -334,10 +334,6 @@ static int drm_fbdev_fb_dirty(struct
> > drm_fb_helper *helper, struct drm_clip_rect
> > if (!drm_fbdev_use_shadow_fb(helper))
> > return 0;
> >   
> > -   /* Call damage handlers only if necessary */
> > -   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
> > -   return 0;
> > -
> > if (helper->buffer) {
> > ret = drm_fbdev_damage_blit(helper, clip);
> > if (drm_WARN_ONCE(dev, ret, "Damage blitter failed:
> > ret=%d\n", ret))
> 
> -- 
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Ivo Totev



Re: [PATCH 10/13] drm/amdgpu: use scheduler depenencies for CS

2022-12-21 Thread Mike Lothian
https://gitlab.freedesktop.org/drm/amd/-/issues/2309

On Wed, 21 Dec 2022 at 15:34, Mike Lothian  wrote:
>
> On Fri, 14 Oct 2022 at 09:47, Christian König
>  wrote:
> >
> > Entirely remove the sync obj in the job.
> >
> > Signed-off-by: Christian König 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 21 ++---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h  |  2 ++
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |  9 +
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_job.h |  1 -
> >  4 files changed, 13 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > index d45b86bcf7fa..0528c2b1db6e 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> > @@ -426,7 +426,7 @@ static int amdgpu_cs_p2_dependencies(struct 
> > amdgpu_cs_parser *p,
> > dma_fence_put(old);
> > }
> >
> > -   r = amdgpu_sync_fence(&p->gang_leader->sync, fence);
> > +   r = amdgpu_sync_fence(&p->sync, fence);
> > dma_fence_put(fence);
> > if (r)
> > return r;
> > @@ -448,7 +448,7 @@ static int amdgpu_syncobj_lookup_and_add(struct 
> > amdgpu_cs_parser *p,
> > return r;
> > }
> >
> > -   r = amdgpu_sync_fence(&p->gang_leader->sync, fence);
> > +   r = amdgpu_sync_fence(&p->sync, fence);
> > if (r)
> > goto error;
> >
> > @@ -1108,7 +1108,7 @@ static int amdgpu_cs_vm_handling(struct 
> > amdgpu_cs_parser *p)
> > if (r)
> > return r;
> >
> > -   r = amdgpu_sync_fence(&job->sync, fpriv->prt_va->last_pt_update);
> > +   r = amdgpu_sync_fence(&p->sync, fpriv->prt_va->last_pt_update);
> > if (r)
> > return r;
> >
> > @@ -1119,7 +1119,7 @@ static int amdgpu_cs_vm_handling(struct 
> > amdgpu_cs_parser *p)
> > if (r)
> > return r;
> >
> > -   r = amdgpu_sync_fence(&job->sync, bo_va->last_pt_update);
> > +   r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update);
> > if (r)
> > return r;
> > }
> > @@ -1138,7 +1138,7 @@ static int amdgpu_cs_vm_handling(struct 
> > amdgpu_cs_parser *p)
> > if (r)
> > return r;
> >
> > -   r = amdgpu_sync_fence(&job->sync, bo_va->last_pt_update);
> > +   r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update);
> > if (r)
> > return r;
> > }
> > @@ -1151,7 +1151,7 @@ static int amdgpu_cs_vm_handling(struct 
> > amdgpu_cs_parser *p)
> > if (r)
> > return r;
> >
> > -   r = amdgpu_sync_fence(&job->sync, vm->last_update);
> > +   r = amdgpu_sync_fence(&p->sync, vm->last_update);
> > if (r)
> > return r;
> >
> > @@ -1183,7 +1183,6 @@ static int amdgpu_cs_vm_handling(struct 
> > amdgpu_cs_parser *p)
> >  static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
> >  {
> > struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
> > -   struct amdgpu_job *leader = p->gang_leader;
> > struct amdgpu_bo_list_entry *e;
> > unsigned int i;
> > int r;
> > @@ -1195,14 +1194,14 @@ static int amdgpu_cs_sync_rings(struct 
> > amdgpu_cs_parser *p)
> >
> > sync_mode = amdgpu_bo_explicit_sync(bo) ?
> > AMDGPU_SYNC_EXPLICIT : AMDGPU_SYNC_NE_OWNER;
> > -   r = amdgpu_sync_resv(p->adev, &leader->sync, resv, 
> > sync_mode,
> > +   r = amdgpu_sync_resv(p->adev, &p->sync, resv, sync_mode,
> >  &fpriv->vm);
> > if (r)
> > return r;
> > }
> >
> > -   for (i = 0; i < p->gang_size - 1; ++i) {
> > -   r = amdgpu_sync_clone(&leader->sync, &p->jobs[i]->sync);
> > +   for (i = 0; i < p->gang_size; ++i) {
> > +   r = amdgpu_sync_push_to_job(&p->sync, p->jobs[i]);
> > if (r)
> > return r;
> > }
> > @@ -1248,7 +1247,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser 
> > *p,
> > struct dma_fence *fence;
> >
> > fence = &p->jobs[i]->base.s_fence->scheduled;
> > -   r = amdgpu_sync_fence(&leader->sync, fence);
> > +   r = drm_sched_job_add_dependency(&leader->base, fence);
> > if (r)
> > goto error_cleanup;
> > }
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
> > index cbaa19b2b8a3..207e801c24ed 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
> > @@ -75,6 +75,8 @@ struct amdgpu_cs_parser {
> >
> > unsigned  

Re: [PATCH 10/13] drm/amdgpu: use scheduler depenencies for CS

2022-12-21 Thread Luben Tuikov
On 2022-12-21 10:34, Mike Lothian wrote:
> On Fri, 14 Oct 2022 at 09:47, Christian König
>  wrote:
>>
>> Entirely remove the sync obj in the job.
>>
>> Signed-off-by: Christian König 
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 21 ++---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h  |  2 ++
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |  9 +
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_job.h |  1 -
>>  4 files changed, 13 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index d45b86bcf7fa..0528c2b1db6e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -426,7 +426,7 @@ static int amdgpu_cs_p2_dependencies(struct 
>> amdgpu_cs_parser *p,
>> dma_fence_put(old);
>> }
>>
>> -   r = amdgpu_sync_fence(&p->gang_leader->sync, fence);
>> +   r = amdgpu_sync_fence(&p->sync, fence);
>> dma_fence_put(fence);
>> if (r)
>> return r;
>> @@ -448,7 +448,7 @@ static int amdgpu_syncobj_lookup_and_add(struct 
>> amdgpu_cs_parser *p,
>> return r;
>> }
>>
>> -   r = amdgpu_sync_fence(&p->gang_leader->sync, fence);
>> +   r = amdgpu_sync_fence(&p->sync, fence);
>> if (r)
>> goto error;
>>
>> @@ -1108,7 +1108,7 @@ static int amdgpu_cs_vm_handling(struct 
>> amdgpu_cs_parser *p)
>> if (r)
>> return r;
>>
>> -   r = amdgpu_sync_fence(&job->sync, fpriv->prt_va->last_pt_update);
>> +   r = amdgpu_sync_fence(&p->sync, fpriv->prt_va->last_pt_update);
>> if (r)
>> return r;
>>
>> @@ -1119,7 +1119,7 @@ static int amdgpu_cs_vm_handling(struct 
>> amdgpu_cs_parser *p)
>> if (r)
>> return r;
>>
>> -   r = amdgpu_sync_fence(&job->sync, bo_va->last_pt_update);
>> +   r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update);
>> if (r)
>> return r;
>> }
>> @@ -1138,7 +1138,7 @@ static int amdgpu_cs_vm_handling(struct 
>> amdgpu_cs_parser *p)
>> if (r)
>> return r;
>>
>> -   r = amdgpu_sync_fence(&job->sync, bo_va->last_pt_update);
>> +   r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update);
>> if (r)
>> return r;
>> }
>> @@ -1151,7 +1151,7 @@ static int amdgpu_cs_vm_handling(struct 
>> amdgpu_cs_parser *p)
>> if (r)
>> return r;
>>
>> -   r = amdgpu_sync_fence(&job->sync, vm->last_update);
>> +   r = amdgpu_sync_fence(&p->sync, vm->last_update);
>> if (r)
>> return r;
>>
>> @@ -1183,7 +1183,6 @@ static int amdgpu_cs_vm_handling(struct 
>> amdgpu_cs_parser *p)
>>  static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
>>  {
>> struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
>> -   struct amdgpu_job *leader = p->gang_leader;
>> struct amdgpu_bo_list_entry *e;
>> unsigned int i;
>> int r;
>> @@ -1195,14 +1194,14 @@ static int amdgpu_cs_sync_rings(struct 
>> amdgpu_cs_parser *p)
>>
>> sync_mode = amdgpu_bo_explicit_sync(bo) ?
>> AMDGPU_SYNC_EXPLICIT : AMDGPU_SYNC_NE_OWNER;
>> -   r = amdgpu_sync_resv(p->adev, &leader->sync, resv, sync_mode,
>> +   r = amdgpu_sync_resv(p->adev, &p->sync, resv, sync_mode,
>>  &fpriv->vm);
>> if (r)
>> return r;
>> }
>>
>> -   for (i = 0; i < p->gang_size - 1; ++i) {
>> -   r = amdgpu_sync_clone(&leader->sync, &p->jobs[i]->sync);
>> +   for (i = 0; i < p->gang_size; ++i) {
>> +   r = amdgpu_sync_push_to_job(&p->sync, p->jobs[i]);
>> if (r)
>> return r;
>> }
>> @@ -1248,7 +1247,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
>> struct dma_fence *fence;
>>
>> fence = &p->jobs[i]->base.s_fence->scheduled;
>> -   r = amdgpu_sync_fence(&leader->sync, fence);
>> +   r = drm_sched_job_add_dependency(&leader->base, fence);
>> if (r)
>> goto error_cleanup;
>> }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
>> index cbaa19b2b8a3..207e801c24ed 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
>> @@ -75,6 +75,8 @@ struct amdgpu_cs_parser {
>>
>> unsignednum_post_deps;
>> struct amdgpu_cs_post_dep   *post_deps;
>> +
>> +   struct amdgpu_sync  sync;
>>  };
>>
>>  int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parse

Re: [PATCH 10/13] drm/amdgpu: use scheduler depenencies for CS

2022-12-21 Thread Mike Lothian
On Wed, 21 Dec 2022 at 15:52, Luben Tuikov  wrote:
>
> On 2022-12-21 10:34, Mike Lothian wrote:
> > On Fri, 14 Oct 2022 at 09:47, Christian König
> >  wrote:
> >>
> >> Entirely remove the sync obj in the job.
> >>
> >> Signed-off-by: Christian König 
> >> ---
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 21 ++---
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h  |  2 ++
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c |  9 +
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_job.h |  1 -
> >>  4 files changed, 13 insertions(+), 20 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
> >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> >> index d45b86bcf7fa..0528c2b1db6e 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> >> @@ -426,7 +426,7 @@ static int amdgpu_cs_p2_dependencies(struct 
> >> amdgpu_cs_parser *p,
> >> dma_fence_put(old);
> >> }
> >>
> >> -   r = amdgpu_sync_fence(&p->gang_leader->sync, fence);
> >> +   r = amdgpu_sync_fence(&p->sync, fence);
> >> dma_fence_put(fence);
> >> if (r)
> >> return r;
> >> @@ -448,7 +448,7 @@ static int amdgpu_syncobj_lookup_and_add(struct 
> >> amdgpu_cs_parser *p,
> >> return r;
> >> }
> >>
> >> -   r = amdgpu_sync_fence(&p->gang_leader->sync, fence);
> >> +   r = amdgpu_sync_fence(&p->sync, fence);
> >> if (r)
> >> goto error;
> >>
> >> @@ -1108,7 +1108,7 @@ static int amdgpu_cs_vm_handling(struct 
> >> amdgpu_cs_parser *p)
> >> if (r)
> >> return r;
> >>
> >> -   r = amdgpu_sync_fence(&job->sync, fpriv->prt_va->last_pt_update);
> >> +   r = amdgpu_sync_fence(&p->sync, fpriv->prt_va->last_pt_update);
> >> if (r)
> >> return r;
> >>
> >> @@ -1119,7 +1119,7 @@ static int amdgpu_cs_vm_handling(struct 
> >> amdgpu_cs_parser *p)
> >> if (r)
> >> return r;
> >>
> >> -   r = amdgpu_sync_fence(&job->sync, bo_va->last_pt_update);
> >> +   r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update);
> >> if (r)
> >> return r;
> >> }
> >> @@ -1138,7 +1138,7 @@ static int amdgpu_cs_vm_handling(struct 
> >> amdgpu_cs_parser *p)
> >> if (r)
> >> return r;
> >>
> >> -   r = amdgpu_sync_fence(&job->sync, bo_va->last_pt_update);
> >> +   r = amdgpu_sync_fence(&p->sync, bo_va->last_pt_update);
> >> if (r)
> >> return r;
> >> }
> >> @@ -1151,7 +1151,7 @@ static int amdgpu_cs_vm_handling(struct 
> >> amdgpu_cs_parser *p)
> >> if (r)
> >> return r;
> >>
> >> -   r = amdgpu_sync_fence(&job->sync, vm->last_update);
> >> +   r = amdgpu_sync_fence(&p->sync, vm->last_update);
> >> if (r)
> >> return r;
> >>
> >> @@ -1183,7 +1183,6 @@ static int amdgpu_cs_vm_handling(struct 
> >> amdgpu_cs_parser *p)
> >>  static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
> >>  {
> >> struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
> >> -   struct amdgpu_job *leader = p->gang_leader;
> >> struct amdgpu_bo_list_entry *e;
> >> unsigned int i;
> >> int r;
> >> @@ -1195,14 +1194,14 @@ static int amdgpu_cs_sync_rings(struct 
> >> amdgpu_cs_parser *p)
> >>
> >> sync_mode = amdgpu_bo_explicit_sync(bo) ?
> >> AMDGPU_SYNC_EXPLICIT : AMDGPU_SYNC_NE_OWNER;
> >> -   r = amdgpu_sync_resv(p->adev, &leader->sync, resv, 
> >> sync_mode,
> >> +   r = amdgpu_sync_resv(p->adev, &p->sync, resv, sync_mode,
> >>  &fpriv->vm);
> >> if (r)
> >> return r;
> >> }
> >>
> >> -   for (i = 0; i < p->gang_size - 1; ++i) {
> >> -   r = amdgpu_sync_clone(&leader->sync, &p->jobs[i]->sync);
> >> +   for (i = 0; i < p->gang_size; ++i) {
> >> +   r = amdgpu_sync_push_to_job(&p->sync, p->jobs[i]);
> >> if (r)
> >> return r;
> >> }
> >> @@ -1248,7 +1247,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser 
> >> *p,
> >> struct dma_fence *fence;
> >>
> >> fence = &p->jobs[i]->base.s_fence->scheduled;
> >> -   r = amdgpu_sync_fence(&leader->sync, fence);
> >> +   r = drm_sched_job_add_dependency(&leader->base, fence);
> >> if (r)
> >> goto error_cleanup;
> >> }
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h 
> >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
> >> index cbaa19b2b8a3..207e801c24ed 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.h
> >> +++ b/drivers/gpu/drm/amd/

[Bug 211425] [drm:atom_op_jump] *ERROR* atombios stuck in loop for more than 20secs aborting

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

Grigorije (grigorij...@gmail.com) changed:

   What|Removed |Added

 CC||grigorij...@gmail.com

--- Comment #26 from Grigorije (grigorij...@gmail.com) ---
6.0.12 kernel, the error still persists on my integrated vega gpu.
Sometimes it's just stuck about 30-40 seconds and then I can use my PC normally
like nothing happened, but usually have to do hard reboot.

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

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

[PATCH v4 0/5] Improve GPU reset sequence for Adreno GPU

2022-12-21 Thread Akhil P Oommen


This is a rework of [1] using genpd instead of 'reset' framework.

As per the recommended reset sequence of Adreno gpu, we should ensure that
gpucc-cx-gdsc has collapsed at hardware to reset gpu's internal hardware states.
Because this gdsc is implemented as 'votable', gdsc driver doesn't poll and
wait until its hw status says OFF.

So use the newly introduced genpd api (dev_pm_genpd_synced_poweroff()) to
provide a hint to the gdsc driver to poll for the hw status and use genpd
notifier to wait from adreno gpu driver until gdsc is turned OFF.

This series is rebased on top of linux-next (20221215) since the changes span
multiple drivers.

[1] https://patchwork.freedesktop.org/series/107507/

Changes in v4:
- Update genpd function documentation (Ulf)

Changes in v3:
- Rename the var 'force_sync' to 'wait (Stephen)

Changes in v2:
- Minor formatting fix
- Select PM_GENERIC_DOMAINS from Kconfig

Akhil P Oommen (4):
  clk: qcom: gdsc: Support 'synced_poweroff' genpd flag
  drm/msm/a6xx: Vote for cx gdsc from gpu driver
  drm/msm/a6xx: Remove cx gdsc polling using 'reset'
  drm/msm/a6xx: Use genpd notifier to ensure cx-gdsc collapse

Ulf Hansson (1):
  PM: domains: Allow a genpd consumer to require a synced power off

 drivers/base/power/domain.c   | 26 
 drivers/clk/qcom/gdsc.c   | 11 +
 drivers/gpu/drm/msm/Kconfig   |  1 +
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 46 ---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.h |  7 ++
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 13 +++---
 drivers/gpu/drm/msm/msm_gpu.c |  4 ---
 drivers/gpu/drm/msm/msm_gpu.h |  4 ---
 include/linux/pm_domain.h |  5 
 9 files changed, 97 insertions(+), 20 deletions(-)

-- 
2.7.4



[PATCH v4 1/5] PM: domains: Allow a genpd consumer to require a synced power off

2022-12-21 Thread Akhil P Oommen
From: Ulf Hansson 

Some genpd providers doesn't ensure that it has turned off at hardware.
This is fine until the consumer really requires during some special
scenarios that the power domain collapse at hardware before it is
turned ON again.

An example is the reset sequence of Adreno GPU which requires that the
'gpucc cx gdsc' power domain should move to OFF state in hardware at
least once before turning in ON again to clear the internal state.

Signed-off-by: Ulf Hansson 
Signed-off-by: Akhil P Oommen 
---

Changes in v4:
- Update genpd function documentation (Ulf)

Changes in v2:
- Minor formatting fix

 drivers/base/power/domain.c | 26 ++
 include/linux/pm_domain.h   |  5 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 967bcf9d415e..84662d338188 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -519,6 +519,31 @@ ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(dev_pm_genpd_get_next_hrtimer);
 
+/*
+ * dev_pm_genpd_synced_poweroff - Next power off should be synchronous
+ *
+ * @dev: A device that is attached to the genpd.
+ *
+ * Allows a consumer of the genpd to notify the provider that the next power 
off
+ * should be synchronous.
+ *
+ * It is assumed that the users guarantee that the genpd wouldn't be detached
+ * while this routine is getting called.
+ */
+void dev_pm_genpd_synced_poweroff(struct device *dev)
+{
+   struct generic_pm_domain *genpd;
+
+   genpd = dev_to_genpd_safe(dev);
+   if (!genpd)
+   return;
+
+   genpd_lock(genpd);
+   genpd->synced_poweroff = true;
+   genpd_unlock(genpd);
+}
+EXPORT_SYMBOL_GPL(dev_pm_genpd_synced_poweroff);
+
 static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
 {
unsigned int state_idx = genpd->state_idx;
@@ -562,6 +587,7 @@ static int _genpd_power_on(struct generic_pm_domain *genpd, 
bool timed)
 
 out:
raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_ON, NULL);
+   genpd->synced_poweroff = false;
return 0;
 err:
raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_OFF,
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 1cd41bdf73cf..f776fb93eaa0 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -136,6 +136,7 @@ struct generic_pm_domain {
unsigned int prepared_count;/* Suspend counter of prepared devices 
*/
unsigned int performance_state; /* Aggregated max performance state */
cpumask_var_t cpus; /* A cpumask of the attached CPUs */
+   bool synced_poweroff;   /* A consumer needs a synced poweroff */
int (*power_off)(struct generic_pm_domain *domain);
int (*power_on)(struct generic_pm_domain *domain);
struct raw_notifier_head power_notifiers; /* Power on/off notifiers */
@@ -235,6 +236,7 @@ int dev_pm_genpd_add_notifier(struct device *dev, struct 
notifier_block *nb);
 int dev_pm_genpd_remove_notifier(struct device *dev);
 void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next);
 ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev);
+void dev_pm_genpd_synced_poweroff(struct device *dev);
 
 extern struct dev_power_governor simple_qos_governor;
 extern struct dev_power_governor pm_domain_always_on_gov;
@@ -300,6 +302,9 @@ static inline ktime_t dev_pm_genpd_get_next_hrtimer(struct 
device *dev)
 {
return KTIME_MAX;
 }
+static inline void dev_pm_genpd_synced_poweroff(struct device *dev)
+{ }
+
 #define simple_qos_governor(*(struct dev_power_governor *)(NULL))
 #define pm_domain_always_on_gov(*(struct dev_power_governor 
*)(NULL))
 #endif
-- 
2.7.4



[PATCH v4 2/5] clk: qcom: gdsc: Support 'synced_poweroff' genpd flag

2022-12-21 Thread Akhil P Oommen
Add support for the newly added 'synced_poweroff' genpd flag. This allows
some clients (like adreno gpu driver) to request gdsc driver to ensure
a votable gdsc (like gpucc cx gdsc) has collapsed at hardware.

Signed-off-by: Akhil P Oommen 
---

(no changes since v3)

Changes in v3:
- Rename the var 'force_sync' to 'wait (Stephen)

 drivers/clk/qcom/gdsc.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index 9e4d6ce891aa..5358e28122ab 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -136,7 +136,8 @@ static int gdsc_update_collapse_bit(struct gdsc *sc, bool 
val)
return 0;
 }
 
-static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status)
+static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status,
+   bool wait)
 {
int ret;
 
@@ -149,7 +150,7 @@ static int gdsc_toggle_logic(struct gdsc *sc, enum 
gdsc_status status)
ret = gdsc_update_collapse_bit(sc, status == GDSC_OFF);
 
/* If disabling votable gdscs, don't poll on status */
-   if ((sc->flags & VOTABLE) && status == GDSC_OFF) {
+   if ((sc->flags & VOTABLE) && status == GDSC_OFF && !wait) {
/*
 * Add a short delay here to ensure that an enable
 * right after it was disabled does not put it in an
@@ -275,7 +276,7 @@ static int gdsc_enable(struct generic_pm_domain *domain)
gdsc_deassert_clamp_io(sc);
}
 
-   ret = gdsc_toggle_logic(sc, GDSC_ON);
+   ret = gdsc_toggle_logic(sc, GDSC_ON, false);
if (ret)
return ret;
 
@@ -352,7 +353,7 @@ static int gdsc_disable(struct generic_pm_domain *domain)
if (sc->pwrsts == PWRSTS_RET_ON)
return 0;
 
-   ret = gdsc_toggle_logic(sc, GDSC_OFF);
+   ret = gdsc_toggle_logic(sc, GDSC_OFF, domain->synced_poweroff);
if (ret)
return ret;
 
@@ -392,7 +393,7 @@ static int gdsc_init(struct gdsc *sc)
 
/* Force gdsc ON if only ON state is supported */
if (sc->pwrsts == PWRSTS_ON) {
-   ret = gdsc_toggle_logic(sc, GDSC_ON);
+   ret = gdsc_toggle_logic(sc, GDSC_ON, false);
if (ret)
return ret;
}
-- 
2.7.4



[PATCH v4 3/5] drm/msm/a6xx: Vote for cx gdsc from gpu driver

2022-12-21 Thread Akhil P Oommen
When a device has multiple power domains, dev->power_domain is left
empty during probe. That didn't cause any issue so far because we are
freeloading on smmu driver's vote on cx gdsc. Instead of that, create
a device_link between cx genpd device and gmu device to keep a vote from
gpu driver.

Before this patch:
localhost ~ # cat /sys/kernel/debug/pm_genpd/pm_genpd_summary
gx_gdsc on  0
/devices/genpd:1:3d6a000.gmuactive  0
cx_gdsc on  0
/devices/platform/soc@0/3da.iommu   active  0

After this patch:
localhost ~ # cat /sys/kernel/debug/pm_genpd/pm_genpd_summary
gx_gdsc on  0
/devices/genpd:1:3d6a000.gmuactive  0
cx_gdsc on  0
/devices/platform/soc@0/3da.iommu   active  0
/devices/genpd:0:3d6a000.gmuactive  0

Signed-off-by: Akhil P Oommen 
---

(no changes since v1)

 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 31 +++
 drivers/gpu/drm/msm/adreno/a6xx_gmu.h |  1 +
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 6484b97c5344..1580d0090f35 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -1479,6 +1479,12 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu)
 
pm_runtime_force_suspend(gmu->dev);
 
+   /*
+* Since cxpd is a virt device, the devlink with gmu-dev will be removed
+* automatically when we do detach
+*/
+   dev_pm_domain_detach(gmu->cxpd, false);
+
if (!IS_ERR_OR_NULL(gmu->gxpd)) {
pm_runtime_disable(gmu->gxpd);
dev_pm_domain_detach(gmu->gxpd, false);
@@ -1605,8 +1611,10 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct 
device_node *node)
 
if (adreno_is_a650_family(adreno_gpu)) {
gmu->rscc = a6xx_gmu_get_mmio(pdev, "rscc");
-   if (IS_ERR(gmu->rscc))
+   if (IS_ERR(gmu->rscc)) {
+   ret = -ENODEV;
goto err_mmio;
+   }
} else {
gmu->rscc = gmu->mmio + 0x23000;
}
@@ -1615,8 +1623,22 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct 
device_node *node)
gmu->hfi_irq = a6xx_gmu_get_irq(gmu, pdev, "hfi", a6xx_hfi_irq);
gmu->gmu_irq = a6xx_gmu_get_irq(gmu, pdev, "gmu", a6xx_gmu_irq);
 
-   if (gmu->hfi_irq < 0 || gmu->gmu_irq < 0)
+   if (gmu->hfi_irq < 0 || gmu->gmu_irq < 0) {
+   ret = -ENODEV;
+   goto err_mmio;
+   }
+
+   gmu->cxpd = dev_pm_domain_attach_by_name(gmu->dev, "cx");
+   if (IS_ERR(gmu->cxpd)) {
+   ret = PTR_ERR(gmu->cxpd);
goto err_mmio;
+   }
+
+   if (!device_link_add(gmu->dev, gmu->cxpd,
+   DL_FLAG_PM_RUNTIME)) {
+   ret = -ENODEV;
+   goto detach_cxpd;
+   }
 
/*
 * Get a link to the GX power domain to reset the GPU in case of GMU
@@ -1634,6 +1656,9 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct 
device_node *node)
 
return 0;
 
+detach_cxpd:
+   dev_pm_domain_detach(gmu->cxpd, false);
+
 err_mmio:
iounmap(gmu->mmio);
if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "rscc"))
@@ -1641,8 +1666,6 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct 
device_node *node)
free_irq(gmu->gmu_irq, gmu);
free_irq(gmu->hfi_irq, gmu);
 
-   ret = -ENODEV;
-
 err_memory:
a6xx_gmu_memory_free(gmu);
 err_put_device:
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
index e034935b3986..5a42dd4dd31f 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
@@ -56,6 +56,7 @@ struct a6xx_gmu {
int gmu_irq;
 
struct device *gxpd;
+   struct device *cxpd;
 
int idle_level;
 
-- 
2.7.4



[PATCH v4 4/5] drm/msm/a6xx: Remove cx gdsc polling using 'reset'

2022-12-21 Thread Akhil P Oommen
Remove the unused 'reset' interface which was supposed to help to ensure
that cx gdsc has collapsed during gpu recovery. This is was not enabled
so far due to missing gpucc driver support. Similar functionality using
genpd framework will be implemented in the upcoming patch.

This effectively reverts commit 1f6cca404918
("drm/msm/a6xx: Ensure CX collapse during gpu recovery").

Signed-off-by: Akhil P Oommen 
---

(no changes since v3)

Changes in v3:
- Updated commit msg (Philipp)

 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 
 drivers/gpu/drm/msm/msm_gpu.c | 4 
 drivers/gpu/drm/msm/msm_gpu.h | 4 
 3 files changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 36c8fb699b56..4b16e75dfa50 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -10,7 +10,6 @@
 
 #include 
 #include 
-#include 
 #include 
 
 #define GPU_PAS_ID 13
@@ -1298,9 +1297,6 @@ static void a6xx_recover(struct msm_gpu *gpu)
/* And the final one from recover worker */
pm_runtime_put_sync(&gpu->pdev->dev);
 
-   /* Call into gpucc driver to poll for cx gdsc collapse */
-   reset_control_reset(gpu->cx_collapse);
-
pm_runtime_use_autosuspend(&gpu->pdev->dev);
 
if (active_submits)
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 30ed45af76ad..97e1319d4577 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 /*
@@ -933,9 +932,6 @@ int msm_gpu_init(struct drm_device *drm, struct 
platform_device *pdev,
if (IS_ERR(gpu->gpu_cx))
gpu->gpu_cx = NULL;
 
-   gpu->cx_collapse = devm_reset_control_get_optional_exclusive(&pdev->dev,
-   "cx_collapse");
-
gpu->pdev = pdev;
platform_set_drvdata(pdev, &gpu->adreno_smmu);
 
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 651786bc55e5..fa9e34d02c91 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -13,7 +13,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "msm_drv.h"
 #include "msm_fence.h"
@@ -282,9 +281,6 @@ struct msm_gpu {
bool hw_apriv;
 
struct thermal_cooling_device *cooling;
-
-   /* To poll for cx gdsc collapse during gpu recovery */
-   struct reset_control *cx_collapse;
 };
 
 static inline struct msm_gpu *dev_to_gpu(struct device *dev)
-- 
2.7.4



[PATCH v4 5/5] drm/msm/a6xx: Use genpd notifier to ensure cx-gdsc collapse

2022-12-21 Thread Akhil P Oommen
As per the recommended recovery sequence of adreno gpu, cx gdsc should
collapse at hardware before it is turned back ON. This helps to clear
out the stale states in hardware before it is reinitialized. Use the
genpd notifier along with the newly introduced
dev_pm_genpd_synced_poweroff() api to ensure that cx gdsc has collapsed
before we turn it back ON.

Signed-off-by: Akhil P Oommen 
---

(no changes since v2)

Changes in v2:
- Select PM_GENERIC_DOMAINS from Kconfig

 drivers/gpu/drm/msm/Kconfig   |  1 +
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 15 +++
 drivers/gpu/drm/msm/adreno/a6xx_gmu.h |  6 ++
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 11 +++
 4 files changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 3c9dfdb0b328..74f5916f5ca5 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -28,6 +28,7 @@ config DRM_MSM
select SYNC_FILE
select PM_OPP
select NVMEM
+   select PM_GENERIC_DOMAINS
help
  DRM/KMS driver for MSM/snapdragon.
 
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 1580d0090f35..c03830957c26 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -1507,6 +1507,17 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu)
gmu->initialized = false;
 }
 
+static int cxpd_notifier_cb(struct notifier_block *nb,
+   unsigned long action, void *data)
+{
+   struct a6xx_gmu *gmu = container_of(nb, struct a6xx_gmu, pd_nb);
+
+   if (action == GENPD_NOTIFY_OFF)
+   complete_all(&gmu->pd_gate);
+
+   return 0;
+}
+
 int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
 {
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
@@ -1640,6 +1651,10 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct 
device_node *node)
goto detach_cxpd;
}
 
+   init_completion(&gmu->pd_gate);
+   complete_all(&gmu->pd_gate);
+   gmu->pd_nb.notifier_call = cxpd_notifier_cb;
+
/*
 * Get a link to the GX power domain to reset the GPU in case of GMU
 * crash
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
index 5a42dd4dd31f..0bc3eb443fec 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
@@ -4,8 +4,10 @@
 #ifndef _A6XX_GMU_H_
 #define _A6XX_GMU_H_
 
+#include 
 #include 
 #include 
+#include 
 #include "msm_drv.h"
 #include "a6xx_hfi.h"
 
@@ -90,6 +92,10 @@ struct a6xx_gmu {
bool initialized;
bool hung;
bool legacy; /* a618 or a630 */
+
+   /* For power domain callback */
+   struct notifier_block pd_nb;
+   struct completion pd_gate;
 };
 
 static inline u32 gmu_read(struct a6xx_gmu *gmu, u32 offset)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 4b16e75dfa50..dd618b099110 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -10,6 +10,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #define GPU_PAS_ID 13
@@ -1258,6 +1259,7 @@ static void a6xx_recover(struct msm_gpu *gpu)
 {
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
+   struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
int i, active_submits;
 
adreno_dump_info(gpu);
@@ -1290,6 +1292,10 @@ static void a6xx_recover(struct msm_gpu *gpu)
 */
gpu->active_submits = 0;
 
+   reinit_completion(&gmu->pd_gate);
+   dev_pm_genpd_add_notifier(gmu->cxpd, &gmu->pd_nb);
+   dev_pm_genpd_synced_poweroff(gmu->cxpd);
+
/* Drop the rpm refcount from active submits */
if (active_submits)
pm_runtime_put(&gpu->pdev->dev);
@@ -1297,6 +1303,11 @@ static void a6xx_recover(struct msm_gpu *gpu)
/* And the final one from recover worker */
pm_runtime_put_sync(&gpu->pdev->dev);
 
+   if (!wait_for_completion_timeout(&gmu->pd_gate, msecs_to_jiffies(1000)))
+   DRM_DEV_ERROR(&gpu->pdev->dev, "cx gdsc didn't collapse\n");
+
+   dev_pm_genpd_remove_notifier(gmu->cxpd);
+
pm_runtime_use_autosuspend(&gpu->pdev->dev);
 
if (active_submits)
-- 
2.7.4



Re: [PATCH v3 1/5] PM: domains: Allow a genpd consumer to require a synced power off

2022-12-21 Thread Akhil P Oommen
On 12/21/2022 8:13 PM, Ulf Hansson wrote:
> On Tue, 20 Dec 2022 at 08:44, Akhil P Oommen  wrote:
>> From: Ulf Hansson 
>>
>> Some genpd providers doesn't ensure that it has turned off at hardware.
>> This is fine until the consumer really requires during some special
>> scenarios that the power domain collapse at hardware before it is
>> turned ON again.
>>
>> An example is the reset sequence of Adreno GPU which requires that the
>> 'gpucc cx gdsc' power domain should move to OFF state in hardware at
>> least once before turning in ON again to clear the internal state.
>>
>> Signed-off-by: Ulf Hansson 
>> Signed-off-by: Akhil P Oommen 
>> ---
>>
>> (no changes since v2)
>>
>> Changes in v2:
>> - Minor formatting fix
>>
>>  drivers/base/power/domain.c | 23 +++
>>  include/linux/pm_domain.h   |  5 +
>>  2 files changed, 28 insertions(+)
>>
>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>> index 967bcf9d415e..53524a102321 100644
>> --- a/drivers/base/power/domain.c
>> +++ b/drivers/base/power/domain.c
>> @@ -519,6 +519,28 @@ ktime_t dev_pm_genpd_get_next_hrtimer(struct device 
>> *dev)
>>  }
>>  EXPORT_SYMBOL_GPL(dev_pm_genpd_get_next_hrtimer);
>>
>> +/*
>> + * dev_pm_genpd_synced_poweroff - Next power off should be synchronous
>> + *
>> + * @dev: A device that is attached to the genpd.
>> + *
>> + * Allows a consumer of the genpd to notify the provider that the next 
>> power off
>> + * should be synchronous.
> Nitpick; similar to other dev_pm_genpd_* function-descriptions, I
> think it's important to add the below information.
>
> "It is assumed that the users guarantee that the genpd wouldn't be
> detached while this routine is getting called."
>
> Can you please add that?
Thanks. Fixed in revision 4.

-Akhil.
>
>> + */
>> +void dev_pm_genpd_synced_poweroff(struct device *dev)
>> +{
>> +   struct generic_pm_domain *genpd;
>> +
>> +   genpd = dev_to_genpd_safe(dev);
>> +   if (!genpd)
>> +   return;
>> +
>> +   genpd_lock(genpd);
>> +   genpd->synced_poweroff = true;
>> +   genpd_unlock(genpd);
>> +}
>> +EXPORT_SYMBOL_GPL(dev_pm_genpd_synced_poweroff);
>> +
>>  static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
>>  {
>> unsigned int state_idx = genpd->state_idx;
>> @@ -562,6 +584,7 @@ static int _genpd_power_on(struct generic_pm_domain 
>> *genpd, bool timed)
>>
>>  out:
>> raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_ON, 
>> NULL);
>> +   genpd->synced_poweroff = false;
>> return 0;
>>  err:
>> raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_OFF,
>> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
>> index 1cd41bdf73cf..f776fb93eaa0 100644
>> --- a/include/linux/pm_domain.h
>> +++ b/include/linux/pm_domain.h
>> @@ -136,6 +136,7 @@ struct generic_pm_domain {
>> unsigned int prepared_count;/* Suspend counter of prepared 
>> devices */
>> unsigned int performance_state; /* Aggregated max performance state 
>> */
>> cpumask_var_t cpus; /* A cpumask of the attached CPUs */
>> +   bool synced_poweroff;   /* A consumer needs a synced 
>> poweroff */
>> int (*power_off)(struct generic_pm_domain *domain);
>> int (*power_on)(struct generic_pm_domain *domain);
>> struct raw_notifier_head power_notifiers; /* Power on/off notifiers 
>> */
>> @@ -235,6 +236,7 @@ int dev_pm_genpd_add_notifier(struct device *dev, struct 
>> notifier_block *nb);
>>  int dev_pm_genpd_remove_notifier(struct device *dev);
>>  void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next);
>>  ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev);
>> +void dev_pm_genpd_synced_poweroff(struct device *dev);
>>
>>  extern struct dev_power_governor simple_qos_governor;
>>  extern struct dev_power_governor pm_domain_always_on_gov;
>> @@ -300,6 +302,9 @@ static inline ktime_t 
>> dev_pm_genpd_get_next_hrtimer(struct device *dev)
>>  {
>> return KTIME_MAX;
>>  }
>> +static inline void dev_pm_genpd_synced_poweroff(struct device *dev)
>> +{ }
>> +
>>  #define simple_qos_governor(*(struct dev_power_governor 
>> *)(NULL))
>>  #define pm_domain_always_on_gov(*(struct dev_power_governor 
>> *)(NULL))
>>  #endif
>> --
>> 2.7.4
>>
> Kind regards
> Uffe



Re: [Intel-gfx] [PATCH v2 1/1] drm/i915/pxp: Use drm_dbg if arb session failed due to fw version

2022-12-21 Thread Teres Alexis, Alan Previn


On Wed, 2022-12-21 at 12:21 +0200, Jani Nikula wrote:
> On Tue, 20 Dec 2022, Alan Previn  wrote:
> > 
Alan:[snip]
> > +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
> > @@ -298,6 +298,11 @@ int intel_pxp_tee_cmd_create_arb_session(struct 
> > intel_pxp *pxp,
> >  
> > if (ret)
> > drm_err(&i915->drm, "Failed to send tee msg ret=[%d]\n", ret);
> > +
> 
> Superfluous newline that someone's gonna send a patch later to
> remove. Easier to just not add it.
> 
> BR,
> Jani.
> 
Alan: will fix



[PATCH v3 1/1] drm/i915/pxp: Use drm_dbg if arb session failed due to fw version

2022-12-21 Thread Alan Previn
If PXP arb-session is being attempted on older hardware SKUs or
on hardware with older, unsupported, firmware versions, then don't
report the failure with a drm_error. Instead, look specifically for
the API-version error reply and drm_dbg that reply. In this case, the
user-space will eventually get a -ENODEV for the protected context
creation which is the correct behavior and we don't create unnecessary
drm_error's in our dmesg (for what is unsupported platforms).

Changes from prio revs:
   v2 : - remove unnecessary newline. (Jani)
   v1 : - print incorrect version from input packet, not output.

Signed-off-by: Alan Previn 
---
 drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h | 1 +
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c   | 4 
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h 
b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
index c2f23394f9b8..aaa8187a0afb 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_cmn.h
@@ -17,6 +17,7 @@
  */
 enum pxp_status {
PXP_STATUS_SUCCESS = 0x0,
+   PXP_STATUS_ERROR_API_VERSION = 0x1002,
PXP_STATUS_OP_NOT_PERMITTED = 0x4013
 };
 
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
index d50354bfb993..73aa8015f828 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
@@ -298,6 +298,10 @@ int intel_pxp_tee_cmd_create_arb_session(struct intel_pxp 
*pxp,
 
if (ret)
drm_err(&i915->drm, "Failed to send tee msg ret=[%d]\n", ret);
+   else if (msg_out.header.status == PXP_STATUS_ERROR_API_VERSION)
+   drm_dbg(&i915->drm, "PXP firmware version unsupported, 
requested: "
+   "CMD-ID-[0x%08x] on API-Ver-[0x%08x]\n",
+   msg_in.header.command_id, msg_in.header.api_version);
else if (msg_out.header.status != 0x0)
drm_warn(&i915->drm, "PXP firmware failed arb session init 
request ret=[0x%08x]\n",
 msg_out.header.status);

base-commit: cc44a1e87ea6b788868878295119398966f98a81
-- 
2.34.1



[PATCH v5 01/12] dt-bindings: display: rockchip: convert rockchip-lvds.txt to YAML

2022-12-21 Thread Johan Jonker
Convert rockchip-lvds.txt to YAML.

Changed:
  Add power-domains property.
  Requirements between PX30 and RK3288

Signed-off-by: Johan Jonker 
Reviewed-by: Rob Herring 
---

Changed V3:
  Filename matching compatible style
  Drop "Regulator phandle for "
  Specify properties and requirements per SoC
  Sort order and restyle

Changed V2:
  Fix title
---
 .../display/rockchip/rockchip,lvds.yaml   | 170 ++
 .../display/rockchip/rockchip-lvds.txt|  92 --
 2 files changed, 170 insertions(+), 92 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/display/rockchip/rockchip,lvds.yaml
 delete mode 100644 
Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/rockchip,lvds.yaml 
b/Documentation/devicetree/bindings/display/rockchip/rockchip,lvds.yaml
new file mode 100644
index 0..03b002a05
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,lvds.yaml
@@ -0,0 +1,170 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/rockchip/rockchip,lvds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip low-voltage differential signal (LVDS) transmitter
+
+maintainers:
+  - Sandy Huang 
+  - Heiko Stuebner 
+
+properties:
+  compatible:
+enum:
+  - rockchip,px30-lvds
+  - rockchip,rk3288-lvds
+
+  reg:
+maxItems: 1
+
+  clocks:
+maxItems: 1
+
+  clock-names:
+const: pclk_lvds
+
+  avdd1v0-supply:
+description: 1.0V analog power.
+
+  avdd1v8-supply:
+description: 1.8V analog power.
+
+  avdd3v3-supply:
+description: 3.3V analog power.
+
+  rockchip,grf:
+$ref: /schemas/types.yaml#/definitions/phandle
+description: Phandle to the general register files syscon.
+
+  rockchip,output:
+$ref: /schemas/types.yaml#/definitions/string
+enum: [rgb, lvds, duallvds]
+description: This describes the output interface.
+
+  phys:
+maxItems: 1
+
+  phy-names:
+const: dphy
+
+  pinctrl-names:
+const: lcdc
+
+  pinctrl-0: true
+
+  power-domains:
+maxItems: 1
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Video port 0 for the VOP input.
+  The remote endpoint maybe vopb or vopl.
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Video port 1 for either a panel or subsequent encoder.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - rockchip,grf
+  - rockchip,output
+  - ports
+
+allOf:
+  - if:
+  properties:
+compatible:
+  contains:
+const: rockchip,px30-lvds
+
+then:
+  properties:
+reg: false
+clocks: false
+clock-names: false
+avdd1v0-supply: false
+avdd1v8-supply: false
+avdd3v3-supply: false
+
+  required:
+- phys
+- phy-names
+
+  - if:
+  properties:
+compatible:
+  contains:
+const: rockchip,rk3288-lvds
+
+then:
+  properties:
+phys: false
+phy-names: false
+
+  required:
+- reg
+- clocks
+- clock-names
+- avdd1v0-supply
+- avdd1v8-supply
+- avdd3v3-supply
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+lvds: lvds@ff96c000 {
+  compatible = "rockchip,rk3288-lvds";
+  reg = <0xff96c000 0x4000>;
+  clocks = <&cru PCLK_LVDS_PHY>;
+  clock-names = "pclk_lvds";
+  avdd1v0-supply = <&vdd10_lcd>;
+  avdd1v8-supply = <&vcc18_lcd>;
+  avdd3v3-supply = <&vcca_33>;
+  pinctrl-names = "lcdc";
+  pinctrl-0 = <&lcdc_ctl>;
+  rockchip,grf = <&grf>;
+  rockchip,output = "rgb";
+
+  ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+lvds_in: port@0 {
+  reg = <0>;
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  lvds_in_vopb: endpoint@0 {
+reg = <0>;
+remote-endpoint = <&vopb_out_lvds>;
+  };
+  lvds_in_vopl: endpoint@1 {
+reg = <1>;
+remote-endpoint = <&vopl_out_lvds>;
+  };
+};
+
+lvds_out: port@1 {
+  reg = <1>;
+
+  lvds_out_panel: endpoint {
+remote-endpoint = <&panel_in_lvds>;
+  };
+};
+  };
+};
diff --git 
a/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt 
b/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
deleted file mode 100644
index aaf8c44cf..0
--- a/Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-Rockchip RK3288 LVDS interface
-
-
-Required properties:
-- compatible: matching the soc type, one o

[PATCH v5 02/12] dt-bindings: soc: rockchip: grf: add rockchip,lvds.yaml

2022-12-21 Thread Johan Jonker
Add new converted rockchip,lvds.yaml to grf.yaml file.
Prepare for more SoCs with lvds output.

Signed-off-by: Johan Jonker 
Reviewed-by: Rob Herring 
---

Changed V5:
  Drop the quotes
---
 .../devicetree/bindings/soc/rockchip/grf.yaml | 24 +++
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml 
b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
index 2ed8cca79..7ac9aa5fa 100644
--- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
+++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
@@ -75,13 +75,17 @@ allOf:
   properties:
 compatible:
   contains:
-const: rockchip,px30-grf
+enum:
+  - rockchip,px30-grf

 then:
   properties:
 lvds:
-  description:
-
Documentation/devicetree/bindings/display/rockchip/rockchip-lvds.txt
+  type: object
+
+  $ref: /schemas/display/rockchip/rockchip,lvds.yaml#
+
+  unevaluatedProperties: false

   - if:
   properties:
@@ -109,7 +113,7 @@ allOf:
 usbphy:
   type: object

-  $ref: "/schemas/phy/rockchip-usb-phy.yaml#"
+  $ref: /schemas/phy/rockchip-usb-phy.yaml#

   unevaluatedProperties: false

@@ -124,14 +128,14 @@ allOf:
 gpio:
   type: object

-  $ref: "/schemas/gpio/rockchip,rk3328-grf-gpio.yaml#"
+  $ref: /schemas/gpio/rockchip,rk3328-grf-gpio.yaml#

   unevaluatedProperties: false

 power-controller:
   type: object

-  $ref: "/schemas/power/rockchip,power-controller.yaml#"
+  $ref: /schemas/power/rockchip,power-controller.yaml#

   unevaluatedProperties: false

@@ -146,7 +150,7 @@ allOf:
 mipi-dphy-rx0:
   type: object

-  $ref: "/schemas/phy/rockchip-mipi-dphy-rx0.yaml#"
+  $ref: /schemas/phy/rockchip-mipi-dphy-rx0.yaml#

   unevaluatedProperties: false

@@ -174,7 +178,7 @@ allOf:
 reboot-mode:
   type: object

-  $ref: "/schemas/power/reset/syscon-reboot-mode.yaml#"
+  $ref: /schemas/power/reset/syscon-reboot-mode.yaml#

   unevaluatedProperties: false

@@ -200,7 +204,7 @@ allOf:
 "usb2phy@[0-9a-f]+$":
   type: object

-  $ref: "/schemas/phy/phy-rockchip-inno-usb2.yaml#"
+  $ref: /schemas/phy/phy-rockchip-inno-usb2.yaml#

   unevaluatedProperties: false

@@ -228,7 +232,7 @@ allOf:
 io-domains:
   type: object

-  $ref: "/schemas/power/rockchip-io-domain.yaml#"
+  $ref: /schemas/power/rockchip-io-domain.yaml#

   unevaluatedProperties: false

--
2.20.1



[PATCH v5 03/12] dt-bindings: display: bridge: snps, dw-mipi-dsi: fix clock properties

2022-12-21 Thread Johan Jonker
Fix clock properties from the common snps,dw-mipi-dsi.yaml file,
as they don't match with what is used on the SoCs.

Signed-off-by: Johan Jonker 
---
 .../display/bridge/snps,dw-mipi-dsi.yaml | 16 +++-
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml 
b/Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml
index 11fd68a70..0b51c64f1 100644
--- a/Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/snps,dw-mipi-dsi.yaml
@@ -26,19 +26,9 @@ properties:
   reg:
 maxItems: 1

-  clocks:
-items:
-  - description: Module clock
-  - description: DSI bus clock for either AHB and APB
-  - description: Pixel clock for the DPI/RGB input
-minItems: 2
-
-  clock-names:
-items:
-  - const: ref
-  - const: pclk
-  - const: px_clk
-minItems: 2
+  clocks: true
+
+  clock-names: true

   resets:
 maxItems: 1
--
2.20.1



[PATCH v5 04/12] dt-bindings: display: rockchip: convert dw_mipi_dsi_rockchip.txt to yaml

2022-12-21 Thread Johan Jonker
Convert dw_mipi_dsi_rockchip.txt to yaml.

Changed:
  add clock-master property
  file name
  requirements

Signed-off-by: Johan Jonker 
---
 .../display/rockchip/dw_mipi_dsi_rockchip.txt |  94 --
 .../rockchip/rockchip,dw-mipi-dsi.yaml| 173 ++
 2 files changed, 173 insertions(+), 94 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
 create mode 100644 
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-mipi-dsi.yaml

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
deleted file mode 100644
index 9a223df85..0
--- 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-Rockchip specific extensions to the Synopsys Designware MIPI DSI
-
-
-Required properties:
-- #address-cells: Should be <1>.
-- #size-cells: Should be <0>.
-- compatible: one of
-   "rockchip,px30-mipi-dsi", "snps,dw-mipi-dsi"
-   "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi"
-   "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi"
-   "rockchip,rk3568-mipi-dsi", "snps,dw-mipi-dsi"
-- reg: Represent the physical address range of the controller.
-- interrupts: Represent the controller's interrupt to the CPU(s).
-- clocks, clock-names: Phandles to the controller's pll reference
-  clock(ref) when using an internal dphy and APB clock(pclk).
-  For RK3399, a phy config clock (phy_cfg) and a grf clock(grf)
-  are required. As described in [1].
-- rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
-- ports: contain a port node with endpoint definitions as defined in [2].
-  For vopb,set the reg = <0> and set the reg = <1> for vopl.
-- video port 0 for the VOP input, the remote endpoint maybe vopb or vopl
-- video port 1 for either a panel or subsequent encoder
-
-Optional properties:
-- phys: from general PHY binding: the phandle for the PHY device.
-- phy-names: Should be "dphy" if phys references an external phy.
-- #phy-cells: Defined when used as ISP phy, should be 0.
-- power-domains: a phandle to mipi dsi power domain node.
-- resets: list of phandle + reset specifier pairs, as described in [3].
-- reset-names: string reset name, must be "apb".
-
-[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
-[2] Documentation/devicetree/bindings/media/video-interfaces.txt
-[3] Documentation/devicetree/bindings/reset/reset.txt
-
-Example:
-   mipi_dsi: mipi@ff96 {
-   #address-cells = <1>;
-   #size-cells = <0>;
-   compatible = "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi";
-   reg = <0xff96 0x4000>;
-   interrupts = ;
-   clocks = <&cru SCLK_MIPI_24M>, <&cru PCLK_MIPI_DSI0>;
-   clock-names = "ref", "pclk";
-   resets = <&cru SRST_MIPIDSI0>;
-   reset-names = "apb";
-   rockchip,grf = <&grf>;
-
-   ports {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   mipi_in: port@0 {
-   reg = <0>;
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   mipi_in_vopb: endpoint@0 {
-   reg = <0>;
-   remote-endpoint = <&vopb_out_mipi>;
-   };
-   mipi_in_vopl: endpoint@1 {
-   reg = <1>;
-   remote-endpoint = <&vopl_out_mipi>;
-   };
-   };
-
-   mipi_out: port@1 {
-   reg = <1>;
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   mipi_out_panel: endpoint {
-   remote-endpoint = <&panel_in_mipi>;
-   };
-   };
-   };
-
-   panel {
-   compatible ="boe,tv080wum-nl0";
-   reg = <0>;
-
-   enable-gpios = <&gpio7 3 GPIO_ACTIVE_HIGH>;
-   pinctrl-names = "default";
-   pinctrl-0 = <&lcd_en>;
-   backlight = <&backlight>;
-
-   port {
-   panel_in_mipi: endpoint {
-   remote-endpoint = <&mipi_out_panel>;
-   };
-   };
-   };
-   };
diff --git 
a/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-mipi-dsi.yaml 
b/Documentation/devicetree/bindings/display/

[PATCH v5 05/12] dt-bindings: usb: convert fcs,fusb302.txt to yaml

2022-12-21 Thread Johan Jonker
Convert fcs,fusb302.txt to yaml.

Changed:
  Add vbus-supply property

Signed-off-by: Johan Jonker 
---
 .../devicetree/bindings/usb/fcs,fusb302.txt   | 34 --
 .../devicetree/bindings/usb/fcs,fusb302.yaml  | 66 +++
 2 files changed, 66 insertions(+), 34 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/usb/fcs,fusb302.txt
 create mode 100644 Documentation/devicetree/bindings/usb/fcs,fusb302.yaml

diff --git a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt 
b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
deleted file mode 100644
index 60e465429..0
--- a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-Fairchild FUSB302 Type-C Port controllers
-
-Required properties :
-- compatible : "fcs,fusb302"
-- reg: I2C slave address
-- interrupts : Interrupt specifier
-
-Required sub-node:
-- connector : The "usb-c-connector" attached to the FUSB302 IC. The bindings
-  of the connector node are specified in:
-
-   Documentation/devicetree/bindings/connector/usb-connector.yaml
-
-
-Example:
-
-fusb302: typec-portc@54 {
-   compatible = "fcs,fusb302";
-   reg = <0x54>;
-   interrupt-parent = <&nmi_intc>;
-   interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-
-   usb_con: connector {
-   compatible = "usb-c-connector";
-   label = "USB-C";
-   power-role = "dual";
-   try-power-role = "sink";
-   source-pdos = ;
-   sink-pdos = ;
-   op-sink-microwatt = <1000>;
-   };
-};
diff --git a/Documentation/devicetree/bindings/usb/fcs,fusb302.yaml 
b/Documentation/devicetree/bindings/usb/fcs,fusb302.yaml
new file mode 100644
index 0..9b172fda9
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/fcs,fusb302.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/fcs,fusb302.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Fairchild FUSB302 Type-C Port controller
+
+maintainers:
+  - Rob Herring 
+
+properties:
+  compatible:
+const: fcs,fusb302
+
+  reg:
+maxItems: 1
+
+  interrupts:
+maxItems: 1
+
+  vbus-supply:
+description: VBUS power supply
+
+  connector:
+type: object
+$ref: /schemas/connector/usb-connector.yaml#
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - vbus-supply
+  - connector
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+#include 
+
+i2c {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  fusb302: typec-portc@54 {
+compatible = "fcs,fusb302";
+reg = <0x54>;
+interrupt-parent = <&nmi_intc>;
+interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+vbus-supply = <&vbus_typec>;
+
+usb_con: connector {
+  compatible = "usb-c-connector";
+  label = "USB-C";
+  power-role = "dual";
+  try-power-role = "sink";
+  source-pdos = ;
+  sink-pdos = ;
+  op-sink-microwatt = <1000>;
+};
+  };
+};
--
2.20.1



[PATCH v5 06/12] ARM: dts: rockchip: rk3288: fix dsi node

2022-12-21 Thread Johan Jonker
Use generic node name for rk3288.dtsi dsi node.
With the conversion of rockchip,dw-mipi-dsi.yaml a port@1 node
is required, so add a node with label mipi_out.

Signed-off-by: Johan Jonker 
---
 arch/arm/boot/dts/rk3288.dtsi | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 487b0e03d..c22f90e53 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -1114,7 +1114,7 @@
status = "disabled";
};

-   mipi_dsi: mipi@ff96 {
+   mipi_dsi: dsi@ff96 {
compatible = "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi";
reg = <0x0 0xff96 0x0 0x4000>;
interrupts = ;
@@ -1137,6 +1137,10 @@
remote-endpoint = <&vopl_out_mipi>;
};
};
+
+   mipi_out: port@1 {
+   reg = <1>;
+   };
};
};

--
2.20.1



[PATCH v5 07/12] ARM: dts: rockchip: rk3288: fix lvds node

2022-12-21 Thread Johan Jonker
With the conversion of rockchip,lvds.yaml a port@1 node
is required, so add a node with label lvds_out.

Signed-off-by: Johan Jonker 
---

Changed V5:
  rename title
---
 arch/arm/boot/dts/rk3288.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index c22f90e53..cedaa633d 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -1174,6 +1174,10 @@
remote-endpoint = <&vopl_out_lvds>;
};
};
+
+   lvds_out: port@1 {
+   reg = <1>;
+   };
};
};

--
2.20.1



[PATCH v5 08/12] arm64: dts: rockchip: px30: fix lvds node

2022-12-21 Thread Johan Jonker
With the conversion of rockchip,lvds.yaml a port@1 node
is required, so add a node with label lvds_out.
Also add label lvds_in to port@0.

Signed-off-by: Johan Jonker 
---

Changed V5:
  rename title
  add label lvds_in
---
 arch/arm64/boot/dts/rockchip/px30.dtsi | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/px30.dtsi 
b/arch/arm64/boot/dts/rockchip/px30.dtsi
index bfa358042..e34d81f29 100644
--- a/arch/arm64/boot/dts/rockchip/px30.dtsi
+++ b/arch/arm64/boot/dts/rockchip/px30.dtsi
@@ -453,7 +453,7 @@
#address-cells = <1>;
#size-cells = <0>;

-   port@0 {
+   lvds_in: port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
@@ -468,6 +468,10 @@
remote-endpoint = 
<&vopl_out_lvds>;
};
};
+
+   lvds_out: port@1 {
+   reg = <1>;
+   };
};
};
};
--
2.20.1



[PATCH v5 09/12] arm64: dts: rockchip: px30: fix dsi node

2022-12-21 Thread Johan Jonker
With the conversion of rockchip,dw-mipi-dsi.yaml a port@1 node
is required, so add a node with label dsi_out.
Also add label dsi_in to port@0.

Signed-off-by: Johan Jonker 
---
 arch/arm64/boot/dts/rockchip/px30.dtsi | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/px30.dtsi 
b/arch/arm64/boot/dts/rockchip/px30.dtsi
index e34d81f29..272b01154 100644
--- a/arch/arm64/boot/dts/rockchip/px30.dtsi
+++ b/arch/arm64/boot/dts/rockchip/px30.dtsi
@@ -1117,7 +1117,7 @@
#address-cells = <1>;
#size-cells = <0>;

-   port@0 {
+   dsi_in: port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
@@ -1132,6 +1132,10 @@
remote-endpoint = <&vopl_out_dsi>;
};
};
+
+   dsi_out: port@1 {
+   reg = <1>;
+   };
};
};

--
2.20.1



[PATCH v5 10/12] arm64: dts: rockchip: rk3399: fix dsi node

2022-12-21 Thread Johan Jonker
Use generic node name for rk3399.dtsi dsi node.
With the conversion of rockchip,dw-mipi-dsi.yaml a port@1 node
is required, so add a node with label mipi_out.

Signed-off-by: Johan Jonker 
---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 834d16acb..62047a5a0 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -1954,7 +1954,7 @@
};
};

-   mipi_dsi: mipi@ff96 {
+   mipi_dsi: dsi@ff96 {
compatible = "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi";
reg = <0x0 0xff96 0x0 0x8000>;
interrupts = ;
@@ -1987,10 +1987,14 @@
remote-endpoint = <&vopl_out_mipi>;
};
};
+
+   mipi_out: port@1 {
+   reg = <1>;
+   };
};
};

-   mipi_dsi1: mipi@ff968000 {
+   mipi_dsi1: dsi@ff968000 {
compatible = "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi";
reg = <0x0 0xff968000 0x0 0x8000>;
interrupts = ;
@@ -2025,6 +2029,10 @@
remote-endpoint = <&vopl_out_mipi1>;
};
};
+
+   mipi1_out: port@1 {
+   reg = <1>;
+   };
};
};

--
2.20.1



[PATCH v5 11/12] arm64: dts: rockchip: rename vbus-supply to phy-supply in rk3566-box-demo.dts

2022-12-21 Thread Johan Jonker
'vbus-supply' does not match any of the regexes in rk3566-box-demo.dts
in the usb2phy0_otg node, so rename vbus-supply to phy-supply.

Signed-off-by: Johan Jonker 
---
 arch/arm64/boot/dts/rockchip/rk3566-box-demo.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3566-box-demo.dts 
b/arch/arm64/boot/dts/rockchip/rk3566-box-demo.dts
index 4c7f9abd5..4dc9b7623 100644
--- a/arch/arm64/boot/dts/rockchip/rk3566-box-demo.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3566-box-demo.dts
@@ -464,7 +464,7 @@
 };

 &usb2phy0_otg {
-   vbus-supply = <&vcc5v0_usb2_otg>;
+   phy-supply = <&vcc5v0_usb2_otg>;
status = "okay";
 };

--
2.20.1



[PATCH v5 12/12] arm64: dts: rockchip: rk356x: remove hclk from dsi node

2022-12-21 Thread Johan Jonker
The hclk is not used in the dw-mipi-dsi-rockchip.c driver,
so remove hclk from the rk356x.dtsi dsi node.

Signed-off-by: Johan Jonker 
---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi 
b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index 5706c3e24..2cb61a783 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -743,8 +743,8 @@
compatible = "rockchip,rk3568-mipi-dsi", "snps,dw-mipi-dsi";
reg = <0x00 0xfe06 0x00 0x1>;
interrupts = ;
-   clock-names = "pclk", "hclk";
-   clocks = <&cru PCLK_DSITX_0>, <&cru HCLK_VO>;
+   clock-names = "pclk";
+   clocks = <&cru PCLK_DSITX_0>;
phy-names = "dphy";
phys = <&dsi_dphy0>;
power-domains = <&power RK3568_PD_VO>;
@@ -771,8 +771,8 @@
compatible = "rockchip,rk3568-mipi-dsi", "snps,dw-mipi-dsi";
reg = <0x0 0xfe07 0x0 0x1>;
interrupts = ;
-   clock-names = "pclk", "hclk";
-   clocks = <&cru PCLK_DSITX_1>, <&cru HCLK_VO>;
+   clock-names = "pclk";
+   clocks = <&cru PCLK_DSITX_1>;
phy-names = "dphy";
phys = <&dsi_dphy1>;
power-domains = <&power RK3568_PD_VO>;
--
2.20.1



Re: [PATCH] treewide: Convert del_timer*() to timer_shutdown*()

2022-12-21 Thread Kalle Valo
Steven Rostedt  writes:

> [
>   Linus,
>
> I ran the script against your latest master branch:
> commit b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf
>
> As the timer_shutdown*() code is now in your tree, I figured
> we can start doing the conversions. At least add the trivial ones
> now as Thomas suggested that this gets applied at the end of the
> merge window, to avoid conflicts with linux-next during the
> development cycle. I can wait to Friday to run it again, and
> resubmit.
>
> What is the best way to handle this?
> ]
>
> From: "Steven Rostedt (Google)" 
>
> Due to several bugs caused by timers being re-armed after they are
> shutdown and just before they are freed, a new state of timers was added
> called "shutdown". After a timer is set to this state, then it can no
> longer be re-armed.
>
> The following script was run to find all the trivial locations where
> del_timer() or del_timer_sync() is called in the same function that the
> object holding the timer is freed. It also ignores any locations where the
> timer->function is modified between the del_timer*() and the free(), as
> that is not considered a "trivial" case.
>
> This was created by using a coccinelle script and the following commands:
>
>  $ cat timer.cocci
> @@
> expression ptr, slab;
> identifier timer, rfield;
> @@
> (
> -   del_timer(&ptr->timer);
> +   timer_shutdown(&ptr->timer);
> |
> -   del_timer_sync(&ptr->timer);
> +   timer_shutdown_sync(&ptr->timer);
> )
>   ... when strict
>   when != ptr->timer
> (
> kfree_rcu(ptr, rfield);
> |
> kmem_cache_free(slab, ptr);
> |
> kfree(ptr);
> )
>
>  $ spatch timer.cocci . > /tmp/t.patch
>  $ patch -p1 < /tmp/t.patch
>
> Link: https://lore.kernel.org/lkml/20221123201306.823305...@linutronix.de/
>
> Signed-off-by: Steven Rostedt (Google) 

For wireless:

>  .../broadcom/brcm80211/brcmfmac/btcoex.c |  2 +-
>  drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c |  2 +-
>  drivers/net/wireless/intel/iwlwifi/mvm/sta.c |  2 +-
>  drivers/net/wireless/intersil/hostap/hostap_ap.c |  2 +-
>  drivers/net/wireless/marvell/mwifiex/main.c  |  2 +-
>  drivers/net/wireless/microchip/wilc1000/hif.c|  6 +++---

Acked-by: Kalle Valo 

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


[PATCH 0/3] Fixes for various UC related issues

2022-12-21 Thread John . C . Harrison
From: John Harrison 

Fix a bunch of assorted issues with firmware loading and GuC
intialisation.

Signed-off-by: John Harrison 


John Harrison (3):
  drm/i915/guc: Fix missing return code checks in submission init
  drm/i915/guc: Fix a static analysis warning
  drm/i915/uc: Fix two issues with over-size firmware files

 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 75 ++-
 .../gpu/drm/i915/gt/uc/intel_guc_submission.h |  2 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c |  7 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c  | 42 +++
 4 files changed, 91 insertions(+), 35 deletions(-)

-- 
2.39.0



[PATCH 1/3] drm/i915/guc: Fix missing return code checks in submission init

2022-12-21 Thread John . C . Harrison
From: John Harrison 

The CI results for the 'fast request' patch set (enables error return
codes for fire-and-forget H2G messages) hit an issue with the KMD
sending context submission requests on an invalid context. That was
caused by a fault injection probe failing the context creation of a
kernel context. However, there was no return code checking on any of
the kernel context registration paths. So the driver kept going and
tried to use the kernel context for the record defaults process.

Fix that by checking for errors and aborting as appropriate when
creating kernel contexts. While at it, clean up some other submission
init related failure cleanup paths. Also, rename guc_init_lrc_mapping
to guc_init_submission as the former name hasn't been valid in a long
time.

Signed-off-by: John Harrison 
---
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 74 ++-
 .../gpu/drm/i915/gt/uc/intel_guc_submission.h |  2 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c |  7 +-
 3 files changed, 62 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 53f7f599cde3a..4682ec1dbd9c0 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -1431,21 +1431,25 @@ static int guc_action_enable_usage_stats(struct 
intel_guc *guc)
return intel_guc_send(guc, action, ARRAY_SIZE(action));
 }
 
-static void guc_init_engine_stats(struct intel_guc *guc)
+static int guc_init_engine_stats(struct intel_guc *guc)
 {
struct intel_gt *gt = guc_to_gt(guc);
intel_wakeref_t wakeref;
+   int ret;
 
mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
 guc->timestamp.ping_delay);
 
with_intel_runtime_pm(>->i915->runtime_pm, wakeref) {
-   int ret = guc_action_enable_usage_stats(guc);
+   ret = guc_action_enable_usage_stats(guc);
 
-   if (ret)
-   drm_err(>->i915->drm,
-   "Failed to enable usage stats: %d!\n", ret);
+   if (ret) {
+   cancel_delayed_work_sync(&guc->timestamp.work);
+   drm_err(>->i915->drm, "Failed to enable usage stats: 
%d!\n", ret);
+   }
}
+
+   return ret;
 }
 
 void intel_guc_busyness_park(struct intel_gt *gt)
@@ -4101,9 +4105,11 @@ static void guc_set_default_submission(struct 
intel_engine_cs *engine)
engine->submit_request = guc_submit_request;
 }
 
-static inline void guc_kernel_context_pin(struct intel_guc *guc,
- struct intel_context *ce)
+static inline int guc_kernel_context_pin(struct intel_guc *guc,
+struct intel_context *ce)
 {
+   int ret;
+
/*
 * Note: we purposefully do not check the returns below because
 * the registration can only fail if a reset is just starting.
@@ -4111,16 +4117,24 @@ static inline void guc_kernel_context_pin(struct 
intel_guc *guc,
 * isn't happening and even it did this code would be run again.
 */
 
-   if (context_guc_id_invalid(ce))
-   pin_guc_id(guc, ce);
+   if (context_guc_id_invalid(ce)) {
+   int ret = pin_guc_id(guc, ce);
+
+   if (ret < 0)
+   return ret;
+   }
 
if (!test_bit(CONTEXT_GUC_INIT, &ce->flags))
guc_context_init(ce);
 
-   try_context_registration(ce, true);
+   ret = try_context_registration(ce, true);
+   if (ret)
+   unpin_guc_id(guc, ce);
+
+   return ret;
 }
 
-static inline void guc_init_lrc_mapping(struct intel_guc *guc)
+static inline int guc_init_submission(struct intel_guc *guc)
 {
struct intel_gt *gt = guc_to_gt(guc);
struct intel_engine_cs *engine;
@@ -4147,9 +4161,17 @@ static inline void guc_init_lrc_mapping(struct intel_guc 
*guc)
struct intel_context *ce;
 
list_for_each_entry(ce, &engine->pinned_contexts_list,
-   pinned_contexts_link)
-   guc_kernel_context_pin(guc, ce);
+   pinned_contexts_link) {
+   int ret = guc_kernel_context_pin(guc, ce);
+
+   if (ret) {
+   /* No point in trying to clean up as i915 will 
wedge on failure */
+   return ret;
+   }
+   }
}
+
+   return 0;
 }
 
 static void guc_release(struct intel_engine_cs *engine)
@@ -4391,9 +4413,10 @@ static int guc_init_global_schedule_policy(struct 
intel_guc *guc)
return ret;
 }
 
-void intel_guc_submission_enable(struct intel_guc *guc)
+int intel_guc_submission_enable(struct intel_guc *guc)
 {
struct intel_gt *gt = guc_to_gt(guc);
+   int ret;

[PATCH 2/3] drm/i915/guc: Fix a static analysis warning

2022-12-21 Thread John . C . Harrison
From: John Harrison 

A static analyser was complaining about not checking for null
pointers. However, the location of the complaint can only be reached
in the first place if said pointer is non-null. Basically, if we are
using a v69 GuC then the descriptor pool is guaranteed to be alocated
at start of day or submission will be disabled with an ENOMEM error.
And if we are using a later GuC that does not use a descriptor pool
then the v69 submission function would not be called. So, not a
possible null at that point in the code.

Hence adding a GEM_BUG_ON(!ptr) to keep the tool happy.

Signed-off-by: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 4682ec1dbd9c0..c93d0594bfd5e 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -2538,6 +2538,7 @@ static void prepare_context_registration_info_v69(struct 
intel_context *ce)
   i915_gem_object_is_lmem(ce->ring->vma->obj));
 
desc = __get_lrc_desc_v69(guc, ctx_id);
+   GEM_BUG_ON(!desc);
desc->engine_class = engine_class_to_guc_class(engine->class);
desc->engine_submit_mask = engine->logical_mask;
desc->hw_context_desc = ce->lrc.lrca;
-- 
2.39.0



[PATCH 3/3] drm/i915/uc: Fix two issues with over-size firmware files

2022-12-21 Thread John . C . Harrison
From: John Harrison 

In the case where a firmware file is too large (e.g. someone
downloaded a web page ASCII dump from github...), the firmware object
is released but the pointer is not zerod. If no other firmware file
was found then release would be called again leading to a double kfree.

Also, the size check was only being applied to the initial firmware
load not any of the subsequent attempts. So move the check into a
wrapper that is used for all loads.

Fixes: 016241168dc5 ("drm/i915/uc: use different ggtt pin offsets for uc loads")
Signed-off-by: John Harrison 
Reviewed-by: Daniele Ceraolo Spurio 
Cc: Alan Previn 
Cc: Rodrigo Vivi 
Cc: Matt Roper 
Cc: Jani Nikula 
Cc: Matthew Auld 
Cc: "Thomas Hellström" 
---
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 42 
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c 
b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
index d6ff6c584c1e1..65672ff826054 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
@@ -675,6 +675,32 @@ static int check_fw_header(struct intel_gt *gt,
return 0;
 }
 
+static int try_firmware_load(struct intel_uc_fw *uc_fw, const struct firmware 
**fw)
+{
+   struct intel_gt *gt = __uc_fw_to_gt(uc_fw);
+   struct device *dev = gt->i915->drm.dev;
+   int err;
+
+   err = firmware_request_nowarn(fw, uc_fw->file_selected.path, dev);
+
+   if (err)
+   return err;
+
+   if ((*fw)->size > INTEL_UC_RSVD_GGTT_PER_FW) {
+   drm_err(>->i915->drm,
+   "%s firmware %s: size (%zuKB) exceeds max supported 
size (%uKB)\n",
+   intel_uc_fw_type_repr(uc_fw->type), 
uc_fw->file_selected.path,
+   (*fw)->size / SZ_1K, INTEL_UC_RSVD_GGTT_PER_FW / SZ_1K);
+
+   /* try to find another blob to load */
+   release_firmware(*fw);
+   *fw = NULL;
+   return -ENOENT;
+   }
+
+   return 0;
+}
+
 /**
  * intel_uc_fw_fetch - fetch uC firmware
  * @uc_fw: uC firmware
@@ -688,7 +714,6 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw)
struct intel_gt *gt = __uc_fw_to_gt(uc_fw);
struct drm_i915_private *i915 = gt->i915;
struct intel_uc_fw_file file_ideal;
-   struct device *dev = i915->drm.dev;
struct drm_i915_gem_object *obj;
const struct firmware *fw = NULL;
bool old_ver = false;
@@ -704,20 +729,9 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw)
__force_fw_fetch_failures(uc_fw, -EINVAL);
__force_fw_fetch_failures(uc_fw, -ESTALE);
 
-   err = firmware_request_nowarn(&fw, uc_fw->file_selected.path, dev);
+   err = try_firmware_load(uc_fw, &fw);
memcpy(&file_ideal, &uc_fw->file_wanted, sizeof(file_ideal));
 
-   if (!err && fw->size > INTEL_UC_RSVD_GGTT_PER_FW) {
-   drm_err(&i915->drm,
-   "%s firmware %s: size (%zuKB) exceeds max supported 
size (%uKB)\n",
-   intel_uc_fw_type_repr(uc_fw->type), 
uc_fw->file_selected.path,
-   fw->size / SZ_1K, INTEL_UC_RSVD_GGTT_PER_FW / SZ_1K);
-
-   /* try to find another blob to load */
-   release_firmware(fw);
-   err = -ENOENT;
-   }
-
/* Any error is terminal if overriding. Don't bother searching for 
older versions */
if (err && intel_uc_fw_is_overridden(uc_fw))
goto fail;
@@ -738,7 +752,7 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw)
break;
}
 
-   err = firmware_request_nowarn(&fw, uc_fw->file_selected.path, 
dev);
+   err = try_firmware_load(uc_fw, &fw);
}
 
if (err)
-- 
2.39.0



Re: [PATCH v2 02/13] drm/format-helper: Comment on RGB888 byte order

2022-12-21 Thread Maíra Canal
On 12/20/22 13:11, Thomas Zimmermann wrote:
> RGB888 is different than the other formats as most of its pixels are
> unaligned and therefore helper functions do not use endianness conversion
> helpers. Comment on this in the source code.
> 
> Signed-off-by: Thomas Zimmermann 

Reviewed-by: Maíra Canal 

Best Regards,
- Maíra Canal

> ---
>  drivers/gpu/drm/drm_format_helper.c| 1 +
>  drivers/gpu/drm/tests/drm_format_helper_test.c | 4 
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_format_helper.c 
> b/drivers/gpu/drm/drm_format_helper.c
> index 74ff33c2ddaa..b98bd7c5caee 100644
> --- a/drivers/gpu/drm/drm_format_helper.c
> +++ b/drivers/gpu/drm/drm_format_helper.c
> @@ -404,6 +404,7 @@ static void drm_fb_xrgb_to_rgb888_line(void *dbuf, 
> const void *sbuf, unsigne
>  
>   for (x = 0; x < pixels; x++) {
>   pix = le32_to_cpu(sbuf32[x]);
> + /* write blue-green-red to output in little endianness */
>   *dbuf8++ = (pix & 0x00FF) >>  0;
>   *dbuf8++ = (pix & 0xFF00) >>  8;
>   *dbuf8++ = (pix & 0x00FF) >> 16;
> diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c 
> b/drivers/gpu/drm/tests/drm_format_helper_test.c
> index 2191e57f2297..cd1d7da3483c 100644
> --- a/drivers/gpu/drm/tests/drm_format_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
> @@ -407,6 +407,10 @@ static void drm_test_fb_xrgb_to_rgb888(struct kunit 
> *test)
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb);
>   iosys_map_set_vaddr(&src, xrgb);
>  
> + /*
> +  * RGB888 expected results are already in little-endian
> +  * order, so there's no need to convert the test output.
> +  */
>   drm_fb_xrgb_to_rgb888(&dst, &result->dst_pitch, &src, &fb, 
> ¶ms->clip);
>   KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
>  }


Re: [PATCH v2 03/13] drm/format-helper: Fix test-input format conversion

2022-12-21 Thread Maíra Canal
On 12/20/22 13:11, Thomas Zimmermann wrote:
> Convert test input for format helpers from host byte order to
> little-endian order. The current code does it the other way around,
> but there's no effective difference to the result.
> 
> Signed-off-by: Thomas Zimmermann 

Reviewed-by: Maíra Canal 

Best Regards,
- Maíra Canal

> ---
>  .../gpu/drm/tests/drm_format_helper_test.c| 35 +--
>  1 file changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c 
> b/drivers/gpu/drm/tests/drm_format_helper_test.c
> index cd1d7da3483c..e7c49e6d3f6d 100644
> --- a/drivers/gpu/drm/tests/drm_format_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
> @@ -279,6 +279,21 @@ static u32 *le32buf_to_cpu(struct kunit *test, const u32 
> *buf, size_t buf_size)
>   return dst;
>  }
>  
> +static __le32 *cpubuf_to_le32(struct kunit *test, const u32 *buf, size_t 
> buf_size)
> +{
> + __le32 *dst = NULL;
> + int n;
> +
> + dst = kunit_kzalloc(test, sizeof(*dst) * buf_size, GFP_KERNEL);
> + if (!dst)
> + return NULL;
> +
> + for (n = 0; n < buf_size; n++)
> + dst[n] = cpu_to_le32(buf[n]);
> +
> + return dst;
> +}
> +
>  static void convert_xrgb_case_desc(struct convert_xrgb_case *t,
>  char *desc)
>  {
> @@ -294,7 +309,7 @@ static void drm_test_fb_xrgb_to_gray8(struct kunit 
> *test)
>   const struct convert_to_gray8_result *result = ¶ms->gray8_result;
>   size_t dst_size;
>   __u8 *buf = NULL;
> - __u32 *xrgb = NULL;
> + __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
>   struct drm_framebuffer fb = {
> @@ -310,7 +325,7 @@ static void drm_test_fb_xrgb_to_gray8(struct kunit 
> *test)
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>   iosys_map_set_vaddr(&dst, buf);
>  
> - xrgb = le32buf_to_cpu(test, params->xrgb, TEST_BUF_SIZE);
> + xrgb = cpubuf_to_le32(test, params->xrgb, TEST_BUF_SIZE);
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb);
>   iosys_map_set_vaddr(&src, xrgb);
>  
> @@ -324,7 +339,7 @@ static void drm_test_fb_xrgb_to_rgb332(struct kunit 
> *test)
>   const struct convert_to_rgb332_result *result = ¶ms->rgb332_result;
>   size_t dst_size;
>   __u8 *buf = NULL;
> - __u32 *xrgb = NULL;
> + __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
>   struct drm_framebuffer fb = {
> @@ -340,7 +355,7 @@ static void drm_test_fb_xrgb_to_rgb332(struct kunit 
> *test)
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>   iosys_map_set_vaddr(&dst, buf);
>  
> - xrgb = le32buf_to_cpu(test, params->xrgb, TEST_BUF_SIZE);
> + xrgb = cpubuf_to_le32(test, params->xrgb, TEST_BUF_SIZE);
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb);
>   iosys_map_set_vaddr(&src, xrgb);
>  
> @@ -354,7 +369,7 @@ static void drm_test_fb_xrgb_to_rgb565(struct kunit 
> *test)
>   const struct convert_to_rgb565_result *result = ¶ms->rgb565_result;
>   size_t dst_size;
>   __u16 *buf = NULL;
> - __u32 *xrgb = NULL;
> + __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
>   struct drm_framebuffer fb = {
> @@ -370,7 +385,7 @@ static void drm_test_fb_xrgb_to_rgb565(struct kunit 
> *test)
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>   iosys_map_set_vaddr(&dst, buf);
>  
> - xrgb = le32buf_to_cpu(test, params->xrgb, TEST_BUF_SIZE);
> + xrgb = cpubuf_to_le32(test, params->xrgb, TEST_BUF_SIZE);
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb);
>   iosys_map_set_vaddr(&src, xrgb);
>  
> @@ -387,7 +402,7 @@ static void drm_test_fb_xrgb_to_rgb888(struct kunit 
> *test)
>   const struct convert_to_rgb888_result *result = ¶ms->rgb888_result;
>   size_t dst_size;
>   __u8 *buf = NULL;
> - __u32 *xrgb = NULL;
> + __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
>   struct drm_framebuffer fb = {
> @@ -403,7 +418,7 @@ static void drm_test_fb_xrgb_to_rgb888(struct kunit 
> *test)
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
>   iosys_map_set_vaddr(&dst, buf);
>  
> - xrgb = le32buf_to_cpu(test, params->xrgb, TEST_BUF_SIZE);
> + xrgb = cpubuf_to_le32(test, params->xrgb, TEST_BUF_SIZE);
>   KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xrgb);
>   iosys_map_set_vaddr(&src, xrgb);
>  
> @@ -421,7 +436,7 @@ static void drm_test_fb_xrgb_to_xrgb2101010(struct 
> kunit *test)
>   const struct convert_to_xrgb2101010_result *result = 
> ¶ms->xrgb2101010_result;
>   size_t dst_size;
>   __u32 *buf = NULL;
> - __u32 *xrgb = NULL;
> + __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
>   struct drm_framebuffer fb = {
> @@ -437,7 +452,7 @@ static void drm_test_fb_xrgb_to_xrgb2101010(struct 
> kunit *test)

Re: [PATCH v9 01/15] drm/msm/disp/dpu: clear dpu_assign_crtc and get crtc from connector state instead of dpu_enc

2022-12-21 Thread Dmitry Baryshkov

On 21/12/2022 16:10, Vinod Polimera wrote:




-Original Message-
From: Dmitry Baryshkov 
Sent: Wednesday, December 14, 2022 9:05 PM
To: Vinod Polimera (QUIC) ; dri-
de...@lists.freedesktop.org; linux-arm-...@vger.kernel.org;
freedr...@lists.freedesktop.org; devicet...@vger.kernel.org
Cc: linux-ker...@vger.kernel.org; robdcl...@gmail.com;
diand...@chromium.org; swb...@chromium.org; Kalyan Thota (QUIC)
; Kuogee Hsieh (QUIC)
; Vishnuvardhan Prodduturi (QUIC)
; Bjorn Andersson (QUIC)
; Aravind Venkateswaran (QUIC)
; Abhinav Kumar (QUIC)
; Sankeerth Billakanti (QUIC)

Subject: Re: [PATCH v9 01/15] drm/msm/disp/dpu: clear dpu_assign_crtc and
get crtc from connector state instead of dpu_enc

WARNING: This email originated from outside of Qualcomm. Please be wary
of any links or attachments, and do not enable macros.

On 14/12/2022 12:05, Vinod Polimera wrote:

Update crtc retrieval from dpu_enc to dpu_enc connector state,
since new links get set as part of the dpu enc virt mode set.
The dpu_enc->crtc cache is no more needed, hence cleaning it as
part of this change.

This patch is dependent on the series:
https://patchwork.freedesktop.org/series/110969/

Signed-off-by: Vinod Polimera 
---
   drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ---
   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 42 +-

---

   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  8 --
   3 files changed, 13 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c

b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c

index 3f72d38..289d51e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1029,7 +1029,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc,
*/
   if (dpu_encoder_get_intf_mode(encoder) == INTF_MODE_VIDEO)
   release_bandwidth = true;
- dpu_encoder_assign_crtc(encoder, NULL);
   }

   /* wait for frame_event_done completion */
@@ -1099,9 +1098,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
   trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
   dpu_crtc->enabled = true;

- drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state-
encoder_mask)
- dpu_encoder_assign_crtc(encoder, crtc);
-
   /* Enable/restore vblank irq handling */
   drm_crtc_vblank_on(crtc);
   }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

index a585036..b9b254d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -132,11 +132,6 @@ enum dpu_enc_rc_states {
* @intfs_swapped:  Whether or not the phys_enc interfaces have been

swapped

*  for partial update right-only cases, such as pingpong
*  split where virtual pingpong does not generate IRQs
- * @crtc:Pointer to the currently assigned crtc. Normally you
- *   would use crtc->state->encoder_mask to determine the
- *   link between encoder/crtc. However in this case we need
- *   to track crtc in the disable() hook which is called
- *   _after_ encoder_mask is cleared.
* @connector:  If a mode is set, cached pointer to the active

connector

* @crtc_kickoff_cb:Callback into CRTC that will flush & 
start
*  all CTL paths
@@ -181,7 +176,6 @@ struct dpu_encoder_virt {

   bool intfs_swapped;

- struct drm_crtc *crtc;
   struct drm_connector *connector;

   struct dentry *debugfs_root;
@@ -1317,7 +1311,7 @@ static void dpu_encoder_vblank_callback(struct

drm_encoder *drm_enc,

   struct dpu_encoder_phys *phy_enc)
   {
   struct dpu_encoder_virt *dpu_enc = NULL;
- unsigned long lock_flags;
+ struct drm_crtc *crtc;

   if (!drm_enc || !phy_enc)
   return;
@@ -1325,12 +1319,13 @@ static void dpu_encoder_vblank_callback(struct

drm_encoder *drm_enc,

   DPU_ATRACE_BEGIN("encoder_vblank_callback");
   dpu_enc = to_dpu_encoder_virt(drm_enc);

- atomic_inc(&phy_enc->vsync_cnt);
+ if (!dpu_enc->connector || !dpu_enc->connector->state ||
+ !dpu_enc->connector->state->crtc)
+ return;

- spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags);
- if (dpu_enc->crtc)
- dpu_crtc_vblank_callback(dpu_enc->crtc);
- spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags);
+ atomic_inc(&phy_enc->vsync_cnt);
+ crtc = dpu_enc->connector->state->crtc;
+ dpu_crtc_vblank_callback(crtc);

   DPU_ATRACE_END("encoder_vblank_callback");
   }
@@ -1353,33 +1348,22 @@ static void

dpu_encoder_underrun_callback(struct drm_encoder *drm_enc,

   DPU_ATRACE_END("encoder_underrun_callback");
   }

-void dpu_encoder_assign_crtc(struct drm_encoder *drm_enc, struct

drm_crtc *crtc)

-{
- struct dpu_

WARNING: CPU: 2 PID: 42 at drivers/gpu/drm/drm_modeset_lock.c:276

2022-12-21 Thread Stefan Wahren

Hi,

if i enable PROVE_LOCKING on the Raspberry Pi 3 B+ 
(arm/multi_v7_defconfig) using v6.1 (didn't test older versions) i'm 
getting the following warning:


[  204.043396] WARNING: CPU: 2 PID: 42 at 
drivers/gpu/drm/drm_modeset_lock.c:276 drm_modeset_drop_locks+0x6c/0x70
[  204.043426] Modules linked in: aes_arm aes_generic cmac 
bcm2835_v4l2(C) bcm2835_mmal_vchiq(C) videobuf2_vmalloc videobuf2_memops 
videobuf2_v4l2 videobuf2_common videodev mc snd_bcm2835(C) crc32_arm_ce 
brcmfmac brcmutil vc4 snd_soc_hdmi_codec sha256_generic libsha256 
snd_soc_core ac97_bus snd_pcm_dmaengine snd_pcm sha256_arm snd_timer 
cfg80211 onboard_usb_hub snd hci_uart raspberrypi_hwmon soundcore 
drm_dma_helper btbcm bluetooth ecdh_generic bcm2835_thermal ecc libaes 
vchiq(C) microchip lan78xx
[  204.043820] CPU: 2 PID: 42 Comm: kworker/2:1 Tainted: G C 
6.1.0-7-g22fada783b9f #31

[  204.043833] Hardware name: BCM2835
[  204.043842] Workqueue: events output_poll_execute
[  204.043866]  unwind_backtrace from show_stack+0x10/0x14
[  204.043886]  show_stack from dump_stack_lvl+0x58/0x70
[  204.043903]  dump_stack_lvl from __warn+0xc8/0x1e8
[  204.043920]  __warn from warn_slowpath_fmt+0x5c/0xb8
[  204.043936]  warn_slowpath_fmt from drm_modeset_drop_locks+0x6c/0x70
[  204.043952]  drm_modeset_drop_locks from 
drm_helper_probe_detect_ctx+0xd4/0x124
[  204.043969]  drm_helper_probe_detect_ctx from 
output_poll_execute+0x154/0x230

[  204.043986]  output_poll_execute from process_one_work+0x288/0x708
[  204.044004]  process_one_work from worker_thread+0x54/0x50c
[  204.044020]  worker_thread from kthread+0xe8/0x104
[  204.044034]  kthread from ret_from_fork+0x14/0x2c
[  204.044048] Exception stack(0xf0915fb0 to 0xf0915ff8)
[  204.044059] 5fa0:  
  
[  204.044070] 5fc0:      
  

[  204.044080] 5fe0:     0013 
[  204.044090] irq event stamp: 33189
[  204.044100] hardirqs last  enabled at (33195): [] 
__up_console_sem+0x50/0x60
[  204.044120] hardirqs last disabled at (33200): [] 
__up_console_sem+0x3c/0x60
[  204.044136] softirqs last  enabled at (32836): [] 
process_one_work+0x288/0x708
[  204.044152] softirqs last disabled at (32832): [] 
neigh_managed_work+0x18/0xa4

[  204.044168] ---[ end trace  ]---

Best regards



Re: [PATCH v2 04/13] drm/format-helper: Store RGB565 in little-endian order

2022-12-21 Thread Maíra Canal
On 12/20/22 13:11, Thomas Zimmermann wrote:> Fix to-RGB565 conversion
helpers to store the result in little-
> endian byte order. Update test cases as well.
> 
> Signed-off-by: Thomas Zimmermann 

Reviewed-by: Maíra Canal 

Best Regards,
- Maíra Canal

> ---
>  drivers/gpu/drm/drm_format_helper.c   |  9 +
>  .../gpu/drm/tests/drm_format_helper_test.c| 20 ++-
>  2 files changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_format_helper.c 
> b/drivers/gpu/drm/drm_format_helper.c
> index b98bd7c5caee..f3f3b3809a3e 100644
> --- a/drivers/gpu/drm/drm_format_helper.c
> +++ b/drivers/gpu/drm/drm_format_helper.c
> @@ -322,7 +322,7 @@ EXPORT_SYMBOL(drm_fb_xrgb_to_rgb332);
>  
>  static void drm_fb_xrgb_to_rgb565_line(void *dbuf, const void *sbuf, 
> unsigned int pixels)
>  {
> - u16 *dbuf16 = dbuf;
> + __le16 *dbuf16 = dbuf;
>   const __le32 *sbuf32 = sbuf;
>   unsigned int x;
>   u16 val16;
> @@ -333,14 +333,15 @@ static void drm_fb_xrgb_to_rgb565_line(void *dbuf, 
> const void *sbuf, unsigne
>   val16 = ((pix & 0x00F8) >> 8) |
>   ((pix & 0xFC00) >> 5) |
>   ((pix & 0x00F8) >> 3);
> - dbuf16[x] = val16;
> + dbuf16[x] = cpu_to_le16(val16);
>   }
>  }
>  
> +/* TODO: implement this helper as conversion to RGB565|BIG_ENDIAN */
>  static void drm_fb_xrgb_to_rgb565_swab_line(void *dbuf, const void *sbuf,
>   unsigned int pixels)
>  {
> - u16 *dbuf16 = dbuf;
> + __le16 *dbuf16 = dbuf;
>   const __le32 *sbuf32 = sbuf;
>   unsigned int x;
>   u16 val16;
> @@ -351,7 +352,7 @@ static void drm_fb_xrgb_to_rgb565_swab_line(void 
> *dbuf, const void *sbuf,
>   val16 = ((pix & 0x00F8) >> 8) |
>   ((pix & 0xFC00) >> 5) |
>   ((pix & 0x00F8) >> 3);
> - dbuf16[x] = swab16(val16);
> + dbuf16[x] = cpu_to_le16(swab16(val16));
>   }
>  }
>  
> diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c 
> b/drivers/gpu/drm/tests/drm_format_helper_test.c
> index e7c49e6d3f6d..04fe373c9d97 100644
> --- a/drivers/gpu/drm/tests/drm_format_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
> @@ -264,6 +264,21 @@ static size_t conversion_buf_size(u32 dst_format, 
> unsigned int dst_pitch,
>   return dst_pitch * drm_rect_height(clip);
>  }
>  
> +static u16 *le16buf_to_cpu(struct kunit *test, const __le16 *buf, size_t 
> buf_size)
> +{
> + u16 *dst = NULL;
> + int n;
> +
> + dst = kunit_kzalloc(test, sizeof(*dst) * buf_size, GFP_KERNEL);
> + if (!dst)
> + return NULL;
> +
> + for (n = 0; n < buf_size; n++)
> + dst[n] = le16_to_cpu(buf[n]);
> +
> + return dst;
> +}
> +
>  static u32 *le32buf_to_cpu(struct kunit *test, const u32 *buf, size_t 
> buf_size)
>  {
>   u32 *dst = NULL;
> @@ -368,7 +383,7 @@ static void drm_test_fb_xrgb_to_rgb565(struct kunit 
> *test)
>   const struct convert_xrgb_case *params = test->param_value;
>   const struct convert_to_rgb565_result *result = ¶ms->rgb565_result;
>   size_t dst_size;
> - __u16 *buf = NULL;
> + u16 *buf = NULL;
>   __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
> @@ -390,9 +405,12 @@ static void drm_test_fb_xrgb_to_rgb565(struct kunit 
> *test)
>   iosys_map_set_vaddr(&src, xrgb);
>  
>   drm_fb_xrgb_to_rgb565(&dst, &result->dst_pitch, &src, &fb, 
> ¶ms->clip, false);
> + buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / 
> sizeof(__le16));
>   KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
>  
> + buf = dst.vaddr; /* restore original value of buf */
>   drm_fb_xrgb_to_rgb565(&dst, &result->dst_pitch, &src, &fb, 
> ¶ms->clip, true);
> + buf = le16buf_to_cpu(test, (__force const __le16 *)buf, dst_size / 
> sizeof(__le16));
>   KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected_swab, dst_size), 0);
>  }
>  


Re: [PATCH 1/2] backlight: ktz8866: Add support for Kinetic KTZ8866 backlight

2022-12-21 Thread Han Jingoo
On Tue, Dec 20, 2022, Jianhua Lu  wrote:
>
> Add support for Kinetic KTZ8866 backlight, which is used in
> Xiaomi tablet, Mi Pad 5 series. This driver lightly based on
> downstream implementation [1].
> [1] 
> https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/elish-r-oss/drivers/video/backlight/ktz8866.c
>
> Signed-off-by: Jianhua Lu 
> ---
>  drivers/video/backlight/Kconfig   |   8 ++
>  drivers/video/backlight/Makefile  |   1 +
>  drivers/video/backlight/ktz8866.c | 173 ++
>  drivers/video/backlight/ktz8866.h |  31 ++
>  4 files changed, 213 insertions(+)
>  create mode 100644 drivers/video/backlight/ktz8866.c
>  create mode 100644 drivers/video/backlight/ktz8866.h
>
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 936ba1e4d35e..2845fd7e33ad 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -190,6 +190,14 @@ config BACKLIGHT_KTD253
>   which is a 1-wire GPIO-controlled backlight found in some mobile
>   phones.
>
> +config BACKLIGHT_KTZ8866
> +   tristate "Backlight Driver for Kinetic KTZ8866"
> +   depends on I2C
> +   select REGMAP_I2C
> +   help
> +   Say Y to enabled the backlight driver for the Kinetic KTZ8866
> +   found in Xiaomi Mi Pad 5 series.
> +
>  config BACKLIGHT_LM3533
> tristate "Backlight Driver for LM3533"
> depends on MFD_LM3533
> diff --git a/drivers/video/backlight/Makefile 
> b/drivers/video/backlight/Makefile
> index e815f3f1deff..f70a819c304c 100644
> --- a/drivers/video/backlight/Makefile
> +++ b/drivers/video/backlight/Makefile
> @@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
>  obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
>  obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o
>  obj-$(CONFIG_BACKLIGHT_KTD253) += ktd253-backlight.o
> +obj-$(CONFIG_BACKLIGHT_KTZ8866)+= ktz8866.o
>  obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
>  obj-$(CONFIG_BACKLIGHT_LM3630A)+= lm3630a_bl.o
>  obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
> diff --git a/drivers/video/backlight/ktz8866.c 
> b/drivers/video/backlight/ktz8866.c
> new file mode 100644
> index ..1eaf72d9116b
> --- /dev/null
> +++ b/drivers/video/backlight/ktz8866.c
> @@ -0,0 +1,173 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Backlight driver for the Kinetic KTZ8866
> + *
> + * Copyright (C) Jianhua Lu 

Please add '2022'.

> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

Please sort these headers alphabetically.

> +#include 
> +#include 
> +#include "ktz8866.h"

> +
> +#define DEF_BRIGHTNESS 1500

What is 'DEF'? Please use more meaningful name.

> +#define MAX_BRIGHTNESS 2047
> +#define REG_MAX 0x15
> +
> +/* Helper */

Remove this meaningless comment line.

> +#define low_3_bit(x) ((x)&0x7)
> +#define high_8_bit(x) ((x >> 3) & 0xFF)
> +
> +struct ktz8866 {
> +   struct i2c_client *client;
> +   struct regmap *regmap;
> +   bool state;
> +};
> +
> +enum {
> +   LED_OFF,
> +   LED_ON,
> +};
> +
> +static const struct regmap_config ktz8866_regmap_config = {
> +   .reg_bits = 8,
> +   .val_bits = 8,
> +   .max_register = REG_MAX,
> +};
> +
> +int ktz8866_write(struct ktz8866 *ktz, unsigned int reg, unsigned int val)

Add 'static' here, unless you have a reason.

> +{
> +   return regmap_write(ktz->regmap, reg, val);
> +}
> +
> +static int ktz8866_update_bits(struct ktz8866 *ktz, unsigned int reg,
> +  unsigned int mask, unsigned int val)
> +{
> +   return regmap_update_bits(ktz->regmap, reg, mask, val);
> +}
> +
> +static int
> +ktz8866_backlight_update_status(struct backlight_device *backlight_dev)

Hmm, use 1 line not 2 lines, if there is no reason.

> +{
> +   struct ktz8866 *ktz = bl_get_data(backlight_dev);
> +   unsigned int brightness = backlight_get_brightness(backlight_dev);
> +
> +   if (!ktz->state && brightness > 0) {
> +   ktz8866_update_bits(ktz, BL_EN, BIT(6), BIT(6));

Please use definitions.

> +   ktz->state = LED_ON;
> +   } else if (brightness == 0) {
> +   ktz8866_update_bits(ktz, BL_EN, BIT(6), 0);
> +   ktz->state = LED_OFF;
> +   msleep(10);
> +   }
> +
> +   /* Set brightness */
> +   ktz8866_write(ktz, BL_BRT_LSB, low_3_bit(brightness));
> +   ktz8866_write(ktz, BL_BRT_MSB, high_8_bit(brightness));
> +
> +   return 0;
> +}
> +
> +static const struct backlight_ops ktz8866_backlight_ops = {
> +   .options = BL_CORE_SUSPENDRESUME,
> +   .update_status = ktz8866_backlight_update_status,
> +};
> +
> +static void ktz8866_init(struct ktz8866 *ktz)
> +{
> +   /* Enable 1~5 current sinks */
> +   ktz8866_write(ktz, BL_EN, 0x1F);
> +   /* Backlight OVP 26.4V */
> +   ktz8866_write(ktz, BL_CFG1, 0

Re: [PATCH v2 05/13] drm/format-helper: Type fixes in format-helper tests

2022-12-21 Thread Maíra Canal
On 12/20/22 13:11, Thomas Zimmermann wrote:
> Change the source-buffer type of le32buf_to_cpu() to __le32* to
> reflect endianness. Result buffers are converted to local endianness,
> so instantiate them from regular u8 or u32 types.
> 
> Signed-off-by: Thomas Zimmermann 

Reviewed-by: Maíra Canal 

Best Regards,
- Maíra Canal

> ---
>  drivers/gpu/drm/tests/drm_format_helper_test.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c 
> b/drivers/gpu/drm/tests/drm_format_helper_test.c
> index 04fe373c9d97..c2411ec808a1 100644
> --- a/drivers/gpu/drm/tests/drm_format_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c
> @@ -279,7 +279,7 @@ static u16 *le16buf_to_cpu(struct kunit *test, const 
> __le16 *buf, size_t buf_siz
>   return dst;
>  }
>  
> -static u32 *le32buf_to_cpu(struct kunit *test, const u32 *buf, size_t 
> buf_size)
> +static u32 *le32buf_to_cpu(struct kunit *test, const __le32 *buf, size_t 
> buf_size)
>  {
>   u32 *dst = NULL;
>   int n;
> @@ -323,7 +323,7 @@ static void drm_test_fb_xrgb_to_gray8(struct kunit 
> *test)
>   const struct convert_xrgb_case *params = test->param_value;
>   const struct convert_to_gray8_result *result = ¶ms->gray8_result;
>   size_t dst_size;
> - __u8 *buf = NULL;
> + u8 *buf = NULL;
>   __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
> @@ -353,7 +353,7 @@ static void drm_test_fb_xrgb_to_rgb332(struct kunit 
> *test)
>   const struct convert_xrgb_case *params = test->param_value;
>   const struct convert_to_rgb332_result *result = ¶ms->rgb332_result;
>   size_t dst_size;
> - __u8 *buf = NULL;
> + u8 *buf = NULL;
>   __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
> @@ -419,7 +419,7 @@ static void drm_test_fb_xrgb_to_rgb888(struct kunit 
> *test)
>   const struct convert_xrgb_case *params = test->param_value;
>   const struct convert_to_rgb888_result *result = ¶ms->rgb888_result;
>   size_t dst_size;
> - __u8 *buf = NULL;
> + u8 *buf = NULL;
>   __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
> @@ -453,7 +453,7 @@ static void drm_test_fb_xrgb_to_xrgb2101010(struct 
> kunit *test)
>   const struct convert_xrgb_case *params = test->param_value;
>   const struct convert_to_xrgb2101010_result *result = 
> ¶ms->xrgb2101010_result;
>   size_t dst_size;
> - __u32 *buf = NULL;
> + u32 *buf = NULL;
>   __le32 *xrgb = NULL;
>   struct iosys_map dst, src;
>  
> @@ -475,7 +475,7 @@ static void drm_test_fb_xrgb_to_xrgb2101010(struct 
> kunit *test)
>   iosys_map_set_vaddr(&src, xrgb);
>  
>   drm_fb_xrgb_to_xrgb2101010(&dst, &result->dst_pitch, &src, &fb, 
> ¶ms->clip);
> - buf = le32buf_to_cpu(test, buf, dst_size / sizeof(u32));
> + buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / 
> sizeof(u32));
>   KUNIT_EXPECT_EQ(test, memcmp(buf, result->expected, dst_size), 0);
>  }
>  


  1   2   >