Commit 71ab34f7 authored by Daniel Vetter's avatar Daniel Vetter

Merge tag 'drm-misc-next-2024-02-22' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v6.9:

UAPI Changes:

- changes to fdinfo stats

Cross-subsystem Changes:

agp:
- remove unused type field from struct agp_bridge_data

Core Changes:

ci:
- update test names
- cleanups

gem:
- add stats for shared buffers plus updates to amdgpu, i915, xe

Documentation:
- fixes

syncobj:
- fixes to waiting and sleeping

Driver Changes:

bridge:
- adv7511: fix crash on irq during probe
- dw_hdmi: set bridge type

host1x:
- cleanups

ivpu:
- updates to firmware API
- refactor BO allocation

meson:
- fix error handling in probe

panel:
- revert "drm/panel-edp: Add auo_b116xa3_mode"
- add Himax HX83112A plus DT bindings
- ltk500hd1829: add support for ltk101b4029w and admatec 9904370
- simple: add BOE BP082WX1-100 8.2" panel plus DT bindungs

renesas:
- add RZ/G2L DU support plus DT bindings
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240222135841.GA6677@localhost.localdomain
parents 40d47c5f a3baaca4
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/display/panel/himax,hx83112a.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Himax HX83112A-based DSI display panels
maintainers:
- Luca Weiss <luca.weiss@fairphone.com>
description:
The Himax HX83112A is a generic DSI Panel IC used to control
LCD panels.
allOf:
- $ref: panel-common.yaml#
properties:
compatible:
contains:
const: djn,9a-3r063-1102b
vdd1-supply:
description: Digital voltage rail
vsn-supply:
description: Positive source voltage rail
vsp-supply:
description: Negative source voltage rail
reg: true
port: true
required:
- compatible
- reg
- reset-gpios
- vdd1-supply
- vsn-supply
- vsp-supply
- port
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
dsi {
#address-cells = <1>;
#size-cells = <0>;
panel@0 {
compatible = "djn,9a-3r063-1102b";
reg = <0>;
backlight = <&pm6150l_wled>;
reset-gpios = <&pm6150l_gpios 9 GPIO_ACTIVE_LOW>;
vdd1-supply = <&vreg_l1e>;
vsn-supply = <&pm6150l_lcdb_ncp>;
vsp-supply = <&pm6150l_lcdb_ldo>;
port {
panel_in_0: endpoint {
remote-endpoint = <&dsi0_out>;
};
};
};
};
...
...@@ -14,7 +14,9 @@ allOf: ...@@ -14,7 +14,9 @@ allOf:
properties: properties:
compatible: compatible:
const: leadtek,ltk500hd1829 enum:
- leadtek,ltk101b4029w
- leadtek,ltk500hd1829
reg: true reg: true
backlight: true backlight: true
reset-gpios: true reset-gpios: true
......
...@@ -39,6 +39,8 @@ properties: ...@@ -39,6 +39,8 @@ properties:
compatible: compatible:
items: items:
- enum: - enum:
# Admatec 9904379 10.1" 1024x600 LVDS panel
- admatec,9904379
- auo,b101ew05 - auo,b101ew05
# Chunghwa Picture Tubes Ltd. 7" WXGA (800x1280) TFT LCD LVDS panel # Chunghwa Picture Tubes Ltd. 7" WXGA (800x1280) TFT LCD LVDS panel
- chunghwa,claa070wp03xg - chunghwa,claa070wp03xg
......
...@@ -73,6 +73,8 @@ properties: ...@@ -73,6 +73,8 @@ properties:
- auo,t215hvn01 - auo,t215hvn01
# Shanghai AVIC Optoelectronics 7" 1024x600 color TFT-LCD panel # Shanghai AVIC Optoelectronics 7" 1024x600 color TFT-LCD panel
- avic,tm070ddh03 - avic,tm070ddh03
# BOE BP082WX1-100 8.2" WXGA (1280x800) LVDS panel
- boe,bp082wx1-100
# BOE BP101WX1-100 10.1" WXGA (1280x800) LVDS panel # BOE BP101WX1-100 10.1" WXGA (1280x800) LVDS panel
- boe,bp101wx1-100 - boe,bp101wx1-100
# BOE EV121WXM-N10-1850 12.1" WXGA (1280x800) TFT LCD panel # BOE EV121WXM-N10-1850 12.1" WXGA (1280x800) TFT LCD panel
......
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/display/renesas,rzg2l-du.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Renesas RZ/G2L Display Unit (DU)
maintainers:
- Biju Das <biju.das.jz@bp.renesas.com>
- Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
description: |
These DT bindings describe the Display Unit embedded in the Renesas RZ/G2L
and RZ/V2L SoCs.
properties:
compatible:
oneOf:
- enum:
- renesas,r9a07g044-du # RZ/G2{L,LC}
- items:
- enum:
- renesas,r9a07g054-du # RZ/V2L
- const: renesas,r9a07g044-du # RZ/G2L fallback
reg:
maxItems: 1
interrupts:
maxItems: 1
clocks:
items:
- description: Main clock
- description: Register access clock
- description: Video clock
clock-names:
items:
- const: aclk
- const: pclk
- const: vclk
resets:
maxItems: 1
power-domains:
maxItems: 1
ports:
$ref: /schemas/graph.yaml#/properties/ports
description: |
The connections to the DU output video ports are modeled using the OF
graph bindings. The number of ports and their assignment are
model-dependent. Each port shall have a single endpoint.
patternProperties:
"^port@[0-1]$":
$ref: /schemas/graph.yaml#/properties/port
unevaluatedProperties: false
required:
- port@0
unevaluatedProperties: false
renesas,vsps:
$ref: /schemas/types.yaml#/definitions/phandle-array
items:
items:
- description: phandle to VSP instance that serves the DU channel
- description: Channel index identifying the LIF instance in that VSP
description:
A list of phandle and channel index tuples to the VSPs that handle the
memory interfaces for the DU channels.
required:
- compatible
- reg
- interrupts
- clocks
- clock-names
- resets
- power-domains
- ports
- renesas,vsps
additionalProperties: false
examples:
# RZ/G2L DU
- |
#include <dt-bindings/clock/r9a07g044-cpg.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
display@10890000 {
compatible = "renesas,r9a07g044-du";
reg = <0x10890000 0x10000>;
interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cpg CPG_MOD R9A07G044_LCDC_CLK_A>,
<&cpg CPG_MOD R9A07G044_LCDC_CLK_P>,
<&cpg CPG_MOD R9A07G044_LCDC_CLK_D>;
clock-names = "aclk", "pclk", "vclk";
resets = <&cpg R9A07G044_LCDC_RESET_N>;
power-domains = <&cpg>;
renesas,vsps = <&vspd0 0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
endpoint {
remote-endpoint = <&dsi0_in>;
};
};
port@1 {
reg = <1>;
};
};
};
...
...@@ -37,6 +37,7 @@ properties: ...@@ -37,6 +37,7 @@ properties:
- description: OVR2 overlay manager for vp2 - description: OVR2 overlay manager for vp2
- description: VP1 video port 1 - description: VP1 video port 1
- description: VP2 video port 2 - description: VP2 video port 2
- description: common1 DSS register area
reg-names: reg-names:
items: items:
...@@ -47,6 +48,7 @@ properties: ...@@ -47,6 +48,7 @@ properties:
- const: ovr2 - const: ovr2
- const: vp1 - const: vp1
- const: vp2 - const: vp2
- const: common1
clocks: clocks:
items: items:
...@@ -147,9 +149,10 @@ examples: ...@@ -147,9 +149,10 @@ examples:
<0x04a07000 0x1000>, /* ovr1 */ <0x04a07000 0x1000>, /* ovr1 */
<0x04a08000 0x1000>, /* ovr2 */ <0x04a08000 0x1000>, /* ovr2 */
<0x04a0a000 0x1000>, /* vp1 */ <0x04a0a000 0x1000>, /* vp1 */
<0x04a0b000 0x1000>; /* vp2 */ <0x04a0b000 0x1000>, /* vp2 */
<0x04a01000 0x1000>; /* common1 */
reg-names = "common", "vidl1", "vid", reg-names = "common", "vidl1", "vid",
"ovr1", "ovr2", "vp1", "vp2"; "ovr1", "ovr2", "vp1", "vp2", "common1";
ti,am65x-oldi-io-ctrl = <&dss_oldi_io_ctrl>; ti,am65x-oldi-io-ctrl = <&dss_oldi_io_ctrl>;
power-domains = <&k3_pds 67 TI_SCI_PD_EXCLUSIVE>; power-domains = <&k3_pds 67 TI_SCI_PD_EXCLUSIVE>;
clocks = <&k3_clks 67 1>, clocks = <&k3_clks 67 1>,
......
...@@ -61,6 +61,8 @@ patternProperties: ...@@ -61,6 +61,8 @@ patternProperties:
description: Analog Devices, Inc. description: Analog Devices, Inc.
"^adieng,.*": "^adieng,.*":
description: ADI Engineering, Inc. description: ADI Engineering, Inc.
"^admatec,.*":
description: admatec GmbH
"^advantech,.*": "^advantech,.*":
description: Advantech Corporation description: Advantech Corporation
"^aeroflexgaisler,.*": "^aeroflexgaisler,.*":
......
...@@ -138,7 +138,7 @@ indicating kibi- or mebi-bytes. ...@@ -138,7 +138,7 @@ indicating kibi- or mebi-bytes.
- drm-shared-<region>: <uint> [KiB|MiB] - drm-shared-<region>: <uint> [KiB|MiB]
The total size of buffers that are shared with another file (ie. have more The total size of buffers that are shared with another file (e.g., have more
than a single handle). than a single handle).
- drm-total-<region>: <uint> [KiB|MiB] - drm-total-<region>: <uint> [KiB|MiB]
......
...@@ -7025,7 +7025,7 @@ X: drivers/gpu/drm/mediatek/ ...@@ -7025,7 +7025,7 @@ X: drivers/gpu/drm/mediatek/
X: drivers/gpu/drm/msm/ X: drivers/gpu/drm/msm/
X: drivers/gpu/drm/nouveau/ X: drivers/gpu/drm/nouveau/
X: drivers/gpu/drm/radeon/ X: drivers/gpu/drm/radeon/
X: drivers/gpu/drm/renesas/ X: drivers/gpu/drm/renesas/rcar-du/
X: drivers/gpu/drm/tegra/ X: drivers/gpu/drm/tegra/
DRM DRIVERS FOR ALLWINNER A10 DRM DRIVERS FOR ALLWINNER A10
...@@ -7193,12 +7193,22 @@ F: Documentation/devicetree/bindings/display/bridge/renesas,lvds.yaml ...@@ -7193,12 +7193,22 @@ F: Documentation/devicetree/bindings/display/bridge/renesas,lvds.yaml
F: Documentation/devicetree/bindings/display/renesas,du.yaml F: Documentation/devicetree/bindings/display/renesas,du.yaml
F: drivers/gpu/drm/renesas/rcar-du/ F: drivers/gpu/drm/renesas/rcar-du/
DRM DRIVERS FOR RENESAS RZ
M: Biju Das <biju.das.jz@bp.renesas.com>
L: dri-devel@lists.freedesktop.org
L: linux-renesas-soc@vger.kernel.org
S: Maintained
T: git git://anongit.freedesktop.org/drm/drm-misc
F: Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml
F: drivers/gpu/drm/renesas/rz-du/
DRM DRIVERS FOR RENESAS SHMOBILE DRM DRIVERS FOR RENESAS SHMOBILE
M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
M: Geert Uytterhoeven <geert+renesas@glider.be> M: Geert Uytterhoeven <geert+renesas@glider.be>
L: dri-devel@lists.freedesktop.org L: dri-devel@lists.freedesktop.org
L: linux-renesas-soc@vger.kernel.org L: linux-renesas-soc@vger.kernel.org
S: Supported S: Supported
T: git git://anongit.freedesktop.org/drm/drm-misc
F: Documentation/devicetree/bindings/display/renesas,shmobile-lcdc.yaml F: Documentation/devicetree/bindings/display/renesas,shmobile-lcdc.yaml
F: drivers/gpu/drm/renesas/shmobile/ F: drivers/gpu/drm/renesas/shmobile/
F: include/linux/platform_data/shmob_drm.h F: include/linux/platform_data/shmob_drm.h
......
...@@ -286,22 +286,6 @@ static const struct file_operations fw_trace_level_fops = { ...@@ -286,22 +286,6 @@ static const struct file_operations fw_trace_level_fops = {
.write = fw_trace_level_fops_write, .write = fw_trace_level_fops_write,
}; };
static ssize_t
ivpu_reset_engine_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
{
struct ivpu_device *vdev = file->private_data;
if (!size)
return -EINVAL;
if (ivpu_jsm_reset_engine(vdev, DRM_IVPU_ENGINE_COMPUTE))
return -ENODEV;
if (ivpu_jsm_reset_engine(vdev, DRM_IVPU_ENGINE_COPY))
return -ENODEV;
return size;
}
static ssize_t static ssize_t
ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos) ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
{ {
...@@ -327,6 +311,22 @@ static const struct file_operations ivpu_force_recovery_fops = { ...@@ -327,6 +311,22 @@ static const struct file_operations ivpu_force_recovery_fops = {
.write = ivpu_force_recovery_fn, .write = ivpu_force_recovery_fn,
}; };
static ssize_t
ivpu_reset_engine_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
{
struct ivpu_device *vdev = file->private_data;
if (!size)
return -EINVAL;
if (ivpu_jsm_reset_engine(vdev, DRM_IVPU_ENGINE_COMPUTE))
return -ENODEV;
if (ivpu_jsm_reset_engine(vdev, DRM_IVPU_ENGINE_COPY))
return -ENODEV;
return size;
}
static const struct file_operations ivpu_reset_engine_fops = { static const struct file_operations ivpu_reset_engine_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = simple_open, .open = simple_open,
......
...@@ -45,11 +45,11 @@ MODULE_PARM_DESC(test_mode, "Test mode mask. See IVPU_TEST_MODE_* macros."); ...@@ -45,11 +45,11 @@ MODULE_PARM_DESC(test_mode, "Test mode mask. See IVPU_TEST_MODE_* macros.");
u8 ivpu_pll_min_ratio; u8 ivpu_pll_min_ratio;
module_param_named(pll_min_ratio, ivpu_pll_min_ratio, byte, 0644); module_param_named(pll_min_ratio, ivpu_pll_min_ratio, byte, 0644);
MODULE_PARM_DESC(pll_min_ratio, "Minimum PLL ratio used to set VPU frequency"); MODULE_PARM_DESC(pll_min_ratio, "Minimum PLL ratio used to set NPU frequency");
u8 ivpu_pll_max_ratio = U8_MAX; u8 ivpu_pll_max_ratio = U8_MAX;
module_param_named(pll_max_ratio, ivpu_pll_max_ratio, byte, 0644); module_param_named(pll_max_ratio, ivpu_pll_max_ratio, byte, 0644);
MODULE_PARM_DESC(pll_max_ratio, "Maximum PLL ratio used to set VPU frequency"); MODULE_PARM_DESC(pll_max_ratio, "Maximum PLL ratio used to set NPU frequency");
bool ivpu_disable_mmu_cont_pages; bool ivpu_disable_mmu_cont_pages;
module_param_named(disable_mmu_cont_pages, ivpu_disable_mmu_cont_pages, bool, 0644); module_param_named(disable_mmu_cont_pages, ivpu_disable_mmu_cont_pages, bool, 0644);
...@@ -328,13 +328,13 @@ static int ivpu_wait_for_ready(struct ivpu_device *vdev) ...@@ -328,13 +328,13 @@ static int ivpu_wait_for_ready(struct ivpu_device *vdev)
ivpu_ipc_consumer_del(vdev, &cons); ivpu_ipc_consumer_del(vdev, &cons);
if (!ret && ipc_hdr.data_addr != IVPU_IPC_BOOT_MSG_DATA_ADDR) { if (!ret && ipc_hdr.data_addr != IVPU_IPC_BOOT_MSG_DATA_ADDR) {
ivpu_err(vdev, "Invalid VPU ready message: 0x%x\n", ivpu_err(vdev, "Invalid NPU ready message: 0x%x\n",
ipc_hdr.data_addr); ipc_hdr.data_addr);
return -EIO; return -EIO;
} }
if (!ret) if (!ret)
ivpu_dbg(vdev, PM, "VPU ready message received successfully\n"); ivpu_dbg(vdev, PM, "NPU ready message received successfully\n");
return ret; return ret;
} }
...@@ -533,6 +533,7 @@ static int ivpu_dev_init(struct ivpu_device *vdev) ...@@ -533,6 +533,7 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
atomic64_set(&vdev->unique_id_counter, 0); atomic64_set(&vdev->unique_id_counter, 0);
xa_init_flags(&vdev->context_xa, XA_FLAGS_ALLOC); xa_init_flags(&vdev->context_xa, XA_FLAGS_ALLOC);
xa_init_flags(&vdev->submitted_jobs_xa, XA_FLAGS_ALLOC1); xa_init_flags(&vdev->submitted_jobs_xa, XA_FLAGS_ALLOC1);
xa_init_flags(&vdev->db_xa, XA_FLAGS_ALLOC1);
lockdep_set_class(&vdev->submitted_jobs_xa.xa_lock, &submitted_jobs_xa_lock_class_key); lockdep_set_class(&vdev->submitted_jobs_xa.xa_lock, &submitted_jobs_xa_lock_class_key);
INIT_LIST_HEAD(&vdev->bo_list); INIT_LIST_HEAD(&vdev->bo_list);
...@@ -606,6 +607,7 @@ static int ivpu_dev_init(struct ivpu_device *vdev) ...@@ -606,6 +607,7 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
if (IVPU_WA(d3hot_after_power_off)) if (IVPU_WA(d3hot_after_power_off))
pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot); pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot);
err_xa_destroy: err_xa_destroy:
xa_destroy(&vdev->db_xa);
xa_destroy(&vdev->submitted_jobs_xa); xa_destroy(&vdev->submitted_jobs_xa);
xa_destroy(&vdev->context_xa); xa_destroy(&vdev->context_xa);
return ret; return ret;
...@@ -641,6 +643,8 @@ static void ivpu_dev_fini(struct ivpu_device *vdev) ...@@ -641,6 +643,8 @@ static void ivpu_dev_fini(struct ivpu_device *vdev)
ivpu_mmu_reserved_context_fini(vdev); ivpu_mmu_reserved_context_fini(vdev);
ivpu_mmu_global_context_fini(vdev); ivpu_mmu_global_context_fini(vdev);
drm_WARN_ON(&vdev->drm, !xa_empty(&vdev->db_xa));
xa_destroy(&vdev->db_xa);
drm_WARN_ON(&vdev->drm, !xa_empty(&vdev->submitted_jobs_xa)); drm_WARN_ON(&vdev->drm, !xa_empty(&vdev->submitted_jobs_xa));
xa_destroy(&vdev->submitted_jobs_xa); xa_destroy(&vdev->submitted_jobs_xa);
drm_WARN_ON(&vdev->drm, !xa_empty(&vdev->context_xa)); drm_WARN_ON(&vdev->drm, !xa_empty(&vdev->context_xa));
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
#define IVPU_USER_CONTEXT_MIN_SSID 2 #define IVPU_USER_CONTEXT_MIN_SSID 2
#define IVPU_USER_CONTEXT_MAX_SSID (IVPU_USER_CONTEXT_MIN_SSID + 63) #define IVPU_USER_CONTEXT_MAX_SSID (IVPU_USER_CONTEXT_MIN_SSID + 63)
#define IVPU_MIN_DB 1
#define IVPU_MAX_DB 255
#define IVPU_NUM_ENGINES 2 #define IVPU_NUM_ENGINES 2
#define IVPU_PLATFORM_SILICON 0 #define IVPU_PLATFORM_SILICON 0
...@@ -119,6 +122,8 @@ struct ivpu_device { ...@@ -119,6 +122,8 @@ struct ivpu_device {
struct xarray context_xa; struct xarray context_xa;
struct xa_limit context_xa_limit; struct xa_limit context_xa_limit;
struct xarray db_xa;
struct mutex bo_list_lock; /* Protects bo_list */ struct mutex bo_list_lock; /* Protects bo_list */
struct list_head bo_list; struct list_head bo_list;
...@@ -189,7 +194,7 @@ static inline int ivpu_hw_gen(struct ivpu_device *vdev) ...@@ -189,7 +194,7 @@ static inline int ivpu_hw_gen(struct ivpu_device *vdev)
case PCI_DEVICE_ID_LNL: case PCI_DEVICE_ID_LNL:
return IVPU_HW_40XX; return IVPU_HW_40XX;
default: default:
ivpu_err(vdev, "Unknown VPU device\n"); ivpu_err(vdev, "Unknown NPU device\n");
return 0; return 0;
} }
} }
......
...@@ -46,15 +46,13 @@ ...@@ -46,15 +46,13 @@
static char *ivpu_firmware; static char *ivpu_firmware;
module_param_named_unsafe(firmware, ivpu_firmware, charp, 0644); module_param_named_unsafe(firmware, ivpu_firmware, charp, 0644);
MODULE_PARM_DESC(firmware, "VPU firmware binary in /lib/firmware/.."); MODULE_PARM_DESC(firmware, "NPU firmware binary in /lib/firmware/..");
/* TODO: Remove mtl_vpu.bin from names after transition to generation based FW names */
static struct { static struct {
int gen; int gen;
const char *name; const char *name;
} fw_names[] = { } fw_names[] = {
{ IVPU_HW_37XX, "vpu_37xx.bin" }, { IVPU_HW_37XX, "vpu_37xx.bin" },
{ IVPU_HW_37XX, "mtl_vpu.bin" },
{ IVPU_HW_37XX, "intel/vpu/vpu_37xx_v0.0.bin" }, { IVPU_HW_37XX, "intel/vpu/vpu_37xx_v0.0.bin" },
{ IVPU_HW_40XX, "vpu_40xx.bin" }, { IVPU_HW_40XX, "vpu_40xx.bin" },
{ IVPU_HW_40XX, "intel/vpu/vpu_40xx_v0.0.bin" }, { IVPU_HW_40XX, "intel/vpu/vpu_40xx_v0.0.bin" },
...@@ -251,6 +249,7 @@ static int ivpu_fw_update_global_range(struct ivpu_device *vdev) ...@@ -251,6 +249,7 @@ static int ivpu_fw_update_global_range(struct ivpu_device *vdev)
static int ivpu_fw_mem_init(struct ivpu_device *vdev) static int ivpu_fw_mem_init(struct ivpu_device *vdev)
{ {
struct ivpu_fw_info *fw = vdev->fw; struct ivpu_fw_info *fw = vdev->fw;
struct ivpu_addr_range fw_range;
int log_verb_size; int log_verb_size;
int ret; int ret;
...@@ -258,16 +257,19 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev) ...@@ -258,16 +257,19 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev)
if (ret) if (ret)
return ret; return ret;
fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size, DRM_IVPU_BO_WC); fw_range.start = fw->runtime_addr;
fw_range.end = fw->runtime_addr + fw->runtime_size;
fw->mem = ivpu_bo_create(vdev, &vdev->gctx, &fw_range, fw->runtime_size,
DRM_IVPU_BO_WC | DRM_IVPU_BO_MAPPABLE);
if (!fw->mem) { if (!fw->mem) {
ivpu_err(vdev, "Failed to allocate firmware runtime memory\n"); ivpu_err(vdev, "Failed to create firmware runtime memory buffer\n");
return -ENOMEM; return -ENOMEM;
} }
fw->mem_log_crit = ivpu_bo_alloc_internal(vdev, 0, IVPU_FW_CRITICAL_BUFFER_SIZE, fw->mem_log_crit = ivpu_bo_create_global(vdev, IVPU_FW_CRITICAL_BUFFER_SIZE,
DRM_IVPU_BO_CACHED); DRM_IVPU_BO_CACHED | DRM_IVPU_BO_MAPPABLE);
if (!fw->mem_log_crit) { if (!fw->mem_log_crit) {
ivpu_err(vdev, "Failed to allocate critical log buffer\n"); ivpu_err(vdev, "Failed to create critical log buffer\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_free_fw_mem; goto err_free_fw_mem;
} }
...@@ -277,18 +279,19 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev) ...@@ -277,18 +279,19 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev)
else else
log_verb_size = IVPU_FW_VERBOSE_BUFFER_SMALL_SIZE; log_verb_size = IVPU_FW_VERBOSE_BUFFER_SMALL_SIZE;
fw->mem_log_verb = ivpu_bo_alloc_internal(vdev, 0, log_verb_size, DRM_IVPU_BO_CACHED); fw->mem_log_verb = ivpu_bo_create_global(vdev, log_verb_size,
DRM_IVPU_BO_CACHED | DRM_IVPU_BO_MAPPABLE);
if (!fw->mem_log_verb) { if (!fw->mem_log_verb) {
ivpu_err(vdev, "Failed to allocate verbose log buffer\n"); ivpu_err(vdev, "Failed to create verbose log buffer\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_free_log_crit; goto err_free_log_crit;
} }
if (fw->shave_nn_size) { if (fw->shave_nn_size) {
fw->mem_shave_nn = ivpu_bo_alloc_internal(vdev, vdev->hw->ranges.shave.start, fw->mem_shave_nn = ivpu_bo_create(vdev, &vdev->gctx, &vdev->hw->ranges.shave,
fw->shave_nn_size, DRM_IVPU_BO_WC); fw->shave_nn_size, DRM_IVPU_BO_WC);
if (!fw->mem_shave_nn) { if (!fw->mem_shave_nn) {
ivpu_err(vdev, "Failed to allocate shavenn buffer\n"); ivpu_err(vdev, "Failed to create shavenn buffer\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_free_log_verb; goto err_free_log_verb;
} }
...@@ -297,11 +300,11 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev) ...@@ -297,11 +300,11 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev)
return 0; return 0;
err_free_log_verb: err_free_log_verb:
ivpu_bo_free_internal(fw->mem_log_verb); ivpu_bo_free(fw->mem_log_verb);
err_free_log_crit: err_free_log_crit:
ivpu_bo_free_internal(fw->mem_log_crit); ivpu_bo_free(fw->mem_log_crit);
err_free_fw_mem: err_free_fw_mem:
ivpu_bo_free_internal(fw->mem); ivpu_bo_free(fw->mem);
return ret; return ret;
} }
...@@ -310,13 +313,13 @@ static void ivpu_fw_mem_fini(struct ivpu_device *vdev) ...@@ -310,13 +313,13 @@ static void ivpu_fw_mem_fini(struct ivpu_device *vdev)
struct ivpu_fw_info *fw = vdev->fw; struct ivpu_fw_info *fw = vdev->fw;
if (fw->mem_shave_nn) { if (fw->mem_shave_nn) {
ivpu_bo_free_internal(fw->mem_shave_nn); ivpu_bo_free(fw->mem_shave_nn);
fw->mem_shave_nn = NULL; fw->mem_shave_nn = NULL;
} }
ivpu_bo_free_internal(fw->mem_log_verb); ivpu_bo_free(fw->mem_log_verb);
ivpu_bo_free_internal(fw->mem_log_crit); ivpu_bo_free(fw->mem_log_crit);
ivpu_bo_free_internal(fw->mem); ivpu_bo_free(fw->mem);
fw->mem_log_verb = NULL; fw->mem_log_verb = NULL;
fw->mem_log_crit = NULL; fw->mem_log_crit = NULL;
...@@ -470,6 +473,8 @@ static void ivpu_fw_boot_params_print(struct ivpu_device *vdev, struct vpu_boot_ ...@@ -470,6 +473,8 @@ static void ivpu_fw_boot_params_print(struct ivpu_device *vdev, struct vpu_boot_
boot_params->d0i3_residency_time_us); boot_params->d0i3_residency_time_us);
ivpu_dbg(vdev, FW_BOOT, "boot_params.d0i3_entry_vpu_ts = %llu\n", ivpu_dbg(vdev, FW_BOOT, "boot_params.d0i3_entry_vpu_ts = %llu\n",
boot_params->d0i3_entry_vpu_ts); boot_params->d0i3_entry_vpu_ts);
ivpu_dbg(vdev, FW_BOOT, "boot_params.system_time_us = %llu\n",
boot_params->system_time_us);
} }
void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params *boot_params) void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params *boot_params)
...@@ -481,11 +486,14 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params ...@@ -481,11 +486,14 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params
boot_params->d0i3_residency_time_us = boot_params->d0i3_residency_time_us =
ktime_us_delta(ktime_get_boottime(), vdev->hw->d0i3_entry_host_ts); ktime_us_delta(ktime_get_boottime(), vdev->hw->d0i3_entry_host_ts);
boot_params->d0i3_entry_vpu_ts = vdev->hw->d0i3_entry_vpu_ts; boot_params->d0i3_entry_vpu_ts = vdev->hw->d0i3_entry_vpu_ts;
boot_params->system_time_us = ktime_to_us(ktime_get_real());
ivpu_dbg(vdev, FW_BOOT, "boot_params.d0i3_residency_time_us = %lld\n", ivpu_dbg(vdev, FW_BOOT, "boot_params.d0i3_residency_time_us = %lld\n",
boot_params->d0i3_residency_time_us); boot_params->d0i3_residency_time_us);
ivpu_dbg(vdev, FW_BOOT, "boot_params.d0i3_entry_vpu_ts = %llu\n", ivpu_dbg(vdev, FW_BOOT, "boot_params.d0i3_entry_vpu_ts = %llu\n",
boot_params->d0i3_entry_vpu_ts); boot_params->d0i3_entry_vpu_ts);
ivpu_dbg(vdev, FW_BOOT, "boot_params.system_time_us = %llu\n",
boot_params->system_time_us);
boot_params->save_restore_ret_address = 0; boot_params->save_restore_ret_address = 0;
vdev->pm->is_warmboot = true; vdev->pm->is_warmboot = true;
...@@ -563,6 +571,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params ...@@ -563,6 +571,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params
boot_params->d0i3_residency_time_us = 0; boot_params->d0i3_residency_time_us = 0;
boot_params->d0i3_entry_vpu_ts = 0; boot_params->d0i3_entry_vpu_ts = 0;
boot_params->system_time_us = ktime_to_us(ktime_get_real());
wmb(); /* Flush WC buffers after writing bootparams */ wmb(); /* Flush WC buffers after writing bootparams */
ivpu_fw_boot_params_print(vdev, boot_params); ivpu_fw_boot_params_print(vdev, boot_params);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
unsigned int ivpu_log_level = IVPU_FW_LOG_ERROR; unsigned int ivpu_log_level = IVPU_FW_LOG_ERROR;
module_param(ivpu_log_level, uint, 0444); module_param(ivpu_log_level, uint, 0444);
MODULE_PARM_DESC(ivpu_log_level, MODULE_PARM_DESC(ivpu_log_level,
"VPU firmware default trace level: debug=" __stringify(IVPU_FW_LOG_DEBUG) "NPU firmware default trace level: debug=" __stringify(IVPU_FW_LOG_DEBUG)
" info=" __stringify(IVPU_FW_LOG_INFO) " info=" __stringify(IVPU_FW_LOG_INFO)
" warn=" __stringify(IVPU_FW_LOG_WARN) " warn=" __stringify(IVPU_FW_LOG_WARN)
" error=" __stringify(IVPU_FW_LOG_ERROR) " error=" __stringify(IVPU_FW_LOG_ERROR)
...@@ -121,11 +121,11 @@ void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_ ...@@ -121,11 +121,11 @@ void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_
u32 next = 0; u32 next = 0;
while (fw_log_ptr(vdev, vdev->fw->mem_log_crit, &next, &log_header) == 0) while (fw_log_ptr(vdev, vdev->fw->mem_log_crit, &next, &log_header) == 0)
fw_log_print_buffer(vdev, log_header, "VPU critical", only_new_msgs, p); fw_log_print_buffer(vdev, log_header, "NPU critical", only_new_msgs, p);
next = 0; next = 0;
while (fw_log_ptr(vdev, vdev->fw->mem_log_verb, &next, &log_header) == 0) while (fw_log_ptr(vdev, vdev->fw->mem_log_verb, &next, &log_header) == 0)
fw_log_print_buffer(vdev, log_header, "VPU verbose", only_new_msgs, p); fw_log_print_buffer(vdev, log_header, "NPU verbose", only_new_msgs, p);
} }
void ivpu_fw_log_clear(struct ivpu_device *vdev) void ivpu_fw_log_clear(struct ivpu_device *vdev)
......
...@@ -172,8 +172,7 @@ struct drm_gem_object *ivpu_gem_create_object(struct drm_device *dev, size_t siz ...@@ -172,8 +172,7 @@ struct drm_gem_object *ivpu_gem_create_object(struct drm_device *dev, size_t siz
return &bo->base.base; return &bo->base.base;
} }
static struct ivpu_bo * static struct ivpu_bo *ivpu_bo_alloc(struct ivpu_device *vdev, u64 size, u32 flags)
ivpu_bo_create(struct ivpu_device *vdev, u64 size, u32 flags)
{ {
struct drm_gem_shmem_object *shmem; struct drm_gem_shmem_object *shmem;
struct ivpu_bo *bo; struct ivpu_bo *bo;
...@@ -201,7 +200,7 @@ ivpu_bo_create(struct ivpu_device *vdev, u64 size, u32 flags) ...@@ -201,7 +200,7 @@ ivpu_bo_create(struct ivpu_device *vdev, u64 size, u32 flags)
return bo; return bo;
} }
static int ivpu_bo_open(struct drm_gem_object *obj, struct drm_file *file) static int ivpu_gem_bo_open(struct drm_gem_object *obj, struct drm_file *file)
{ {
struct ivpu_file_priv *file_priv = file->driver_priv; struct ivpu_file_priv *file_priv = file->driver_priv;
struct ivpu_device *vdev = file_priv->vdev; struct ivpu_device *vdev = file_priv->vdev;
...@@ -224,7 +223,7 @@ static int ivpu_bo_open(struct drm_gem_object *obj, struct drm_file *file) ...@@ -224,7 +223,7 @@ static int ivpu_bo_open(struct drm_gem_object *obj, struct drm_file *file)
return ivpu_bo_alloc_vpu_addr(bo, &file_priv->ctx, range); return ivpu_bo_alloc_vpu_addr(bo, &file_priv->ctx, range);
} }
static void ivpu_bo_free(struct drm_gem_object *obj) static void ivpu_gem_bo_free(struct drm_gem_object *obj)
{ {
struct ivpu_device *vdev = to_ivpu_device(obj->dev); struct ivpu_device *vdev = to_ivpu_device(obj->dev);
struct ivpu_bo *bo = to_ivpu_bo(obj); struct ivpu_bo *bo = to_ivpu_bo(obj);
...@@ -245,8 +244,8 @@ static void ivpu_bo_free(struct drm_gem_object *obj) ...@@ -245,8 +244,8 @@ static void ivpu_bo_free(struct drm_gem_object *obj)
} }
static const struct drm_gem_object_funcs ivpu_gem_funcs = { static const struct drm_gem_object_funcs ivpu_gem_funcs = {
.free = ivpu_bo_free, .free = ivpu_gem_bo_free,
.open = ivpu_bo_open, .open = ivpu_gem_bo_open,
.print_info = drm_gem_shmem_object_print_info, .print_info = drm_gem_shmem_object_print_info,
.pin = drm_gem_shmem_object_pin, .pin = drm_gem_shmem_object_pin,
.unpin = drm_gem_shmem_object_unpin, .unpin = drm_gem_shmem_object_unpin,
...@@ -272,9 +271,9 @@ int ivpu_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -272,9 +271,9 @@ int ivpu_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
if (size == 0) if (size == 0)
return -EINVAL; return -EINVAL;
bo = ivpu_bo_create(vdev, size, args->flags); bo = ivpu_bo_alloc(vdev, size, args->flags);
if (IS_ERR(bo)) { if (IS_ERR(bo)) {
ivpu_err(vdev, "Failed to create BO: %pe (ctx %u size %llu flags 0x%x)", ivpu_err(vdev, "Failed to allocate BO: %pe (ctx %u size %llu flags 0x%x)",
bo, file_priv->ctx.id, args->size, args->flags); bo, file_priv->ctx.id, args->size, args->flags);
return PTR_ERR(bo); return PTR_ERR(bo);
} }
...@@ -289,33 +288,28 @@ int ivpu_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -289,33 +288,28 @@ int ivpu_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *fi
} }
struct ivpu_bo * struct ivpu_bo *
ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 flags) ivpu_bo_create(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
struct ivpu_addr_range *range, u64 size, u32 flags)
{ {
const struct ivpu_addr_range *range;
struct ivpu_addr_range fixed_range;
struct iosys_map map; struct iosys_map map;
struct ivpu_bo *bo; struct ivpu_bo *bo;
int ret; int ret;
drm_WARN_ON(&vdev->drm, !PAGE_ALIGNED(vpu_addr)); if (drm_WARN_ON(&vdev->drm, !range))
drm_WARN_ON(&vdev->drm, !PAGE_ALIGNED(size)); return NULL;
if (vpu_addr) { drm_WARN_ON(&vdev->drm, !PAGE_ALIGNED(range->start));
fixed_range.start = vpu_addr; drm_WARN_ON(&vdev->drm, !PAGE_ALIGNED(range->end));
fixed_range.end = vpu_addr + size; drm_WARN_ON(&vdev->drm, !PAGE_ALIGNED(size));
range = &fixed_range;
} else {
range = &vdev->hw->ranges.global;
}
bo = ivpu_bo_create(vdev, size, flags); bo = ivpu_bo_alloc(vdev, size, flags);
if (IS_ERR(bo)) { if (IS_ERR(bo)) {
ivpu_err(vdev, "Failed to create BO: %pe (vpu_addr 0x%llx size %llu flags 0x%x)", ivpu_err(vdev, "Failed to allocate BO: %pe (vpu_addr 0x%llx size %llu flags 0x%x)",
bo, vpu_addr, size, flags); bo, range->start, size, flags);
return NULL; return NULL;
} }
ret = ivpu_bo_alloc_vpu_addr(bo, &vdev->gctx, range); ret = ivpu_bo_alloc_vpu_addr(bo, ctx, range);
if (ret) if (ret)
goto err_put; goto err_put;
...@@ -323,11 +317,14 @@ ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 fla ...@@ -323,11 +317,14 @@ ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 fla
if (ret) if (ret)
goto err_put; goto err_put;
dma_resv_lock(bo->base.base.resv, NULL); if (flags & DRM_IVPU_BO_MAPPABLE) {
ret = drm_gem_shmem_vmap(&bo->base, &map); dma_resv_lock(bo->base.base.resv, NULL);
dma_resv_unlock(bo->base.base.resv); ret = drm_gem_shmem_vmap(&bo->base, &map);
if (ret) dma_resv_unlock(bo->base.base.resv);
goto err_put;
if (ret)
goto err_put;
}
return bo; return bo;
...@@ -336,13 +333,20 @@ ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 fla ...@@ -336,13 +333,20 @@ ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 fla
return NULL; return NULL;
} }
void ivpu_bo_free_internal(struct ivpu_bo *bo) struct ivpu_bo *ivpu_bo_create_global(struct ivpu_device *vdev, u64 size, u32 flags)
{
return ivpu_bo_create(vdev, &vdev->gctx, &vdev->hw->ranges.global, size, flags);
}
void ivpu_bo_free(struct ivpu_bo *bo)
{ {
struct iosys_map map = IOSYS_MAP_INIT_VADDR(bo->base.vaddr); struct iosys_map map = IOSYS_MAP_INIT_VADDR(bo->base.vaddr);
dma_resv_lock(bo->base.base.resv, NULL); if (bo->flags & DRM_IVPU_BO_MAPPABLE) {
drm_gem_shmem_vunmap(&bo->base, &map); dma_resv_lock(bo->base.base.resv, NULL);
dma_resv_unlock(bo->base.base.resv); drm_gem_shmem_vunmap(&bo->base, &map);
dma_resv_unlock(bo->base.base.resv);
}
drm_gem_object_put(&bo->base.base); drm_gem_object_put(&bo->base.base);
} }
......
...@@ -28,8 +28,10 @@ int ivpu_bo_pin(struct ivpu_bo *bo); ...@@ -28,8 +28,10 @@ int ivpu_bo_pin(struct ivpu_bo *bo);
void ivpu_bo_unbind_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx); void ivpu_bo_unbind_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx);
struct drm_gem_object *ivpu_gem_create_object(struct drm_device *dev, size_t size); struct drm_gem_object *ivpu_gem_create_object(struct drm_device *dev, size_t size);
struct ivpu_bo *ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 flags); struct ivpu_bo *ivpu_bo_create(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
void ivpu_bo_free_internal(struct ivpu_bo *bo); struct ivpu_addr_range *range, u64 size, u32 flags);
struct ivpu_bo *ivpu_bo_create_global(struct ivpu_device *vdev, u64 size, u32 flags);
void ivpu_bo_free(struct ivpu_bo *bo);
int ivpu_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int ivpu_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
int ivpu_bo_info_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int ivpu_bo_info_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "ivpu_pm.h" #include "ivpu_pm.h"
#define TILE_FUSE_ENABLE_BOTH 0x0 #define TILE_FUSE_ENABLE_BOTH 0x0
#define TILE_SKU_BOTH_MTL 0x3630 #define TILE_SKU_BOTH 0x3630
/* Work point configuration values */ /* Work point configuration values */
#define CONFIG_1_TILE 0x01 #define CONFIG_1_TILE 0x01
...@@ -228,7 +228,7 @@ static int ivpu_pll_drive(struct ivpu_device *vdev, bool enable) ...@@ -228,7 +228,7 @@ static int ivpu_pll_drive(struct ivpu_device *vdev, bool enable)
ret = ivpu_hw_37xx_wait_for_vpuip_bar(vdev); ret = ivpu_hw_37xx_wait_for_vpuip_bar(vdev);
if (ret) { if (ret) {
ivpu_err(vdev, "Timed out waiting for VPUIP bar\n"); ivpu_err(vdev, "Timed out waiting for NPU IP bar\n");
return ret; return ret;
} }
} }
...@@ -599,7 +599,7 @@ static int ivpu_hw_37xx_info_init(struct ivpu_device *vdev) ...@@ -599,7 +599,7 @@ static int ivpu_hw_37xx_info_init(struct ivpu_device *vdev)
struct ivpu_hw_info *hw = vdev->hw; struct ivpu_hw_info *hw = vdev->hw;
hw->tile_fuse = TILE_FUSE_ENABLE_BOTH; hw->tile_fuse = TILE_FUSE_ENABLE_BOTH;
hw->sku = TILE_SKU_BOTH_MTL; hw->sku = TILE_SKU_BOTH;
hw->config = WP_CONFIG_2_TILE_4_3_RATIO; hw->config = WP_CONFIG_2_TILE_4_3_RATIO;
ivpu_pll_init_frequency_ratios(vdev); ivpu_pll_init_frequency_ratios(vdev);
...@@ -742,10 +742,10 @@ static int ivpu_hw_37xx_power_down(struct ivpu_device *vdev) ...@@ -742,10 +742,10 @@ static int ivpu_hw_37xx_power_down(struct ivpu_device *vdev)
ivpu_hw_37xx_save_d0i3_entry_timestamp(vdev); ivpu_hw_37xx_save_d0i3_entry_timestamp(vdev);
if (!ivpu_hw_37xx_is_idle(vdev)) if (!ivpu_hw_37xx_is_idle(vdev))
ivpu_warn(vdev, "VPU not idle during power down\n"); ivpu_warn(vdev, "NPU not idle during power down\n");
if (ivpu_hw_37xx_reset(vdev)) { if (ivpu_hw_37xx_reset(vdev)) {
ivpu_err(vdev, "Failed to reset VPU\n"); ivpu_err(vdev, "Failed to reset NPU\n");
ret = -EIO; ret = -EIO;
} }
......
...@@ -80,11 +80,11 @@ static char *ivpu_platform_to_str(u32 platform) ...@@ -80,11 +80,11 @@ static char *ivpu_platform_to_str(u32 platform)
{ {
switch (platform) { switch (platform) {
case IVPU_PLATFORM_SILICON: case IVPU_PLATFORM_SILICON:
return "IVPU_PLATFORM_SILICON"; return "SILICON";
case IVPU_PLATFORM_SIMICS: case IVPU_PLATFORM_SIMICS:
return "IVPU_PLATFORM_SIMICS"; return "SIMICS";
case IVPU_PLATFORM_FPGA: case IVPU_PLATFORM_FPGA:
return "IVPU_PLATFORM_FPGA"; return "FPGA";
default: default:
return "Invalid platform"; return "Invalid platform";
} }
...@@ -773,7 +773,7 @@ static int ivpu_hw_40xx_reset(struct ivpu_device *vdev) ...@@ -773,7 +773,7 @@ static int ivpu_hw_40xx_reset(struct ivpu_device *vdev)
int ret = 0; int ret = 0;
if (ivpu_hw_40xx_ip_reset(vdev)) { if (ivpu_hw_40xx_ip_reset(vdev)) {
ivpu_err(vdev, "Failed to reset VPU IP\n"); ivpu_err(vdev, "Failed to reset NPU IP\n");
ret = -EIO; ret = -EIO;
} }
...@@ -931,7 +931,7 @@ static int ivpu_hw_40xx_power_down(struct ivpu_device *vdev) ...@@ -931,7 +931,7 @@ static int ivpu_hw_40xx_power_down(struct ivpu_device *vdev)
ivpu_hw_40xx_save_d0i3_entry_timestamp(vdev); ivpu_hw_40xx_save_d0i3_entry_timestamp(vdev);
if (!ivpu_hw_40xx_is_idle(vdev) && ivpu_hw_40xx_ip_reset(vdev)) if (!ivpu_hw_40xx_is_idle(vdev) && ivpu_hw_40xx_ip_reset(vdev))
ivpu_warn(vdev, "Failed to reset the VPU\n"); ivpu_warn(vdev, "Failed to reset the NPU\n");
if (ivpu_pll_disable(vdev)) { if (ivpu_pll_disable(vdev)) {
ivpu_err(vdev, "Failed to disable PLL\n"); ivpu_err(vdev, "Failed to disable PLL\n");
......
...@@ -58,8 +58,8 @@ static void ivpu_ipc_mem_fini(struct ivpu_device *vdev) ...@@ -58,8 +58,8 @@ static void ivpu_ipc_mem_fini(struct ivpu_device *vdev)
{ {
struct ivpu_ipc_info *ipc = vdev->ipc; struct ivpu_ipc_info *ipc = vdev->ipc;
ivpu_bo_free_internal(ipc->mem_rx); ivpu_bo_free(ipc->mem_rx);
ivpu_bo_free_internal(ipc->mem_tx); ivpu_bo_free(ipc->mem_tx);
} }
static int static int
...@@ -471,13 +471,13 @@ int ivpu_ipc_init(struct ivpu_device *vdev) ...@@ -471,13 +471,13 @@ int ivpu_ipc_init(struct ivpu_device *vdev)
struct ivpu_ipc_info *ipc = vdev->ipc; struct ivpu_ipc_info *ipc = vdev->ipc;
int ret; int ret;
ipc->mem_tx = ivpu_bo_alloc_internal(vdev, 0, SZ_16K, DRM_IVPU_BO_WC); ipc->mem_tx = ivpu_bo_create_global(vdev, SZ_16K, DRM_IVPU_BO_WC | DRM_IVPU_BO_MAPPABLE);
if (!ipc->mem_tx) { if (!ipc->mem_tx) {
ivpu_err(vdev, "Failed to allocate mem_tx\n"); ivpu_err(vdev, "Failed to allocate mem_tx\n");
return -ENOMEM; return -ENOMEM;
} }
ipc->mem_rx = ivpu_bo_alloc_internal(vdev, 0, SZ_16K, DRM_IVPU_BO_WC); ipc->mem_rx = ivpu_bo_create_global(vdev, SZ_16K, DRM_IVPU_BO_WC | DRM_IVPU_BO_MAPPABLE);
if (!ipc->mem_rx) { if (!ipc->mem_rx) {
ivpu_err(vdev, "Failed to allocate mem_rx\n"); ivpu_err(vdev, "Failed to allocate mem_rx\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -506,9 +506,9 @@ int ivpu_ipc_init(struct ivpu_device *vdev) ...@@ -506,9 +506,9 @@ int ivpu_ipc_init(struct ivpu_device *vdev)
return 0; return 0;
err_free_rx: err_free_rx:
ivpu_bo_free_internal(ipc->mem_rx); ivpu_bo_free(ipc->mem_rx);
err_free_tx: err_free_tx:
ivpu_bo_free_internal(ipc->mem_tx); ivpu_bo_free(ipc->mem_tx);
return ret; return ret;
} }
......
...@@ -30,19 +30,26 @@ static void ivpu_cmdq_ring_db(struct ivpu_device *vdev, struct ivpu_cmdq *cmdq) ...@@ -30,19 +30,26 @@ static void ivpu_cmdq_ring_db(struct ivpu_device *vdev, struct ivpu_cmdq *cmdq)
static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv, u16 engine) static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv, u16 engine)
{ {
struct xa_limit db_xa_limit = {.max = IVPU_MAX_DB, .min = IVPU_MIN_DB};
struct ivpu_device *vdev = file_priv->vdev; struct ivpu_device *vdev = file_priv->vdev;
struct vpu_job_queue_header *jobq_header; struct vpu_job_queue_header *jobq_header;
struct ivpu_cmdq *cmdq; struct ivpu_cmdq *cmdq;
int ret;
cmdq = kzalloc(sizeof(*cmdq), GFP_KERNEL); cmdq = kzalloc(sizeof(*cmdq), GFP_KERNEL);
if (!cmdq) if (!cmdq)
return NULL; return NULL;
cmdq->mem = ivpu_bo_alloc_internal(vdev, 0, SZ_4K, DRM_IVPU_BO_WC); ret = xa_alloc(&vdev->db_xa, &cmdq->db_id, NULL, db_xa_limit, GFP_KERNEL);
if (ret) {
ivpu_err(vdev, "Failed to allocate doorbell id: %d\n", ret);
goto err_free_cmdq;
}
cmdq->mem = ivpu_bo_create_global(vdev, SZ_4K, DRM_IVPU_BO_WC | DRM_IVPU_BO_MAPPABLE);
if (!cmdq->mem) if (!cmdq->mem)
goto cmdq_free; goto err_erase_xa;
cmdq->db_id = file_priv->ctx.id + engine * ivpu_get_context_count(vdev);
cmdq->entry_count = (u32)((ivpu_bo_size(cmdq->mem) - sizeof(struct vpu_job_queue_header)) / cmdq->entry_count = (u32)((ivpu_bo_size(cmdq->mem) - sizeof(struct vpu_job_queue_header)) /
sizeof(struct vpu_job_queue_entry)); sizeof(struct vpu_job_queue_entry));
...@@ -55,7 +62,9 @@ static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv, u16 e ...@@ -55,7 +62,9 @@ static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv, u16 e
return cmdq; return cmdq;
cmdq_free: err_erase_xa:
xa_erase(&vdev->db_xa, cmdq->db_id);
err_free_cmdq:
kfree(cmdq); kfree(cmdq);
return NULL; return NULL;
} }
...@@ -65,7 +74,8 @@ static void ivpu_cmdq_free(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *c ...@@ -65,7 +74,8 @@ static void ivpu_cmdq_free(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *c
if (!cmdq) if (!cmdq)
return; return;
ivpu_bo_free_internal(cmdq->mem); ivpu_bo_free(cmdq->mem);
xa_erase(&file_priv->vdev->db_xa, cmdq->db_id);
kfree(cmdq); kfree(cmdq);
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
static bool ivpu_disable_recovery; static bool ivpu_disable_recovery;
module_param_named_unsafe(disable_recovery, ivpu_disable_recovery, bool, 0644); module_param_named_unsafe(disable_recovery, ivpu_disable_recovery, bool, 0644);
MODULE_PARM_DESC(disable_recovery, "Disables recovery when VPU hang is detected"); MODULE_PARM_DESC(disable_recovery, "Disables recovery when NPU hang is detected");
static unsigned long ivpu_tdr_timeout_ms; static unsigned long ivpu_tdr_timeout_ms;
module_param_named(tdr_timeout_ms, ivpu_tdr_timeout_ms, ulong, 0644); module_param_named(tdr_timeout_ms, ivpu_tdr_timeout_ms, ulong, 0644);
...@@ -112,11 +112,11 @@ static void ivpu_pm_recovery_work(struct work_struct *work) ...@@ -112,11 +112,11 @@ static void ivpu_pm_recovery_work(struct work_struct *work)
char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL}; char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL};
int ret; int ret;
ivpu_err(vdev, "Recovering the VPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter)); ivpu_err(vdev, "Recovering the NPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter));
ret = pm_runtime_resume_and_get(vdev->drm.dev); ret = pm_runtime_resume_and_get(vdev->drm.dev);
if (ret) if (ret)
ivpu_err(vdev, "Failed to resume VPU: %d\n", ret); ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
ivpu_fw_log_dump(vdev); ivpu_fw_log_dump(vdev);
...@@ -255,10 +255,10 @@ int ivpu_pm_runtime_suspend_cb(struct device *dev) ...@@ -255,10 +255,10 @@ int ivpu_pm_runtime_suspend_cb(struct device *dev)
ret = ivpu_suspend(vdev); ret = ivpu_suspend(vdev);
if (ret) if (ret)
ivpu_err(vdev, "Failed to set suspend VPU: %d\n", ret); ivpu_err(vdev, "Failed to suspend NPU: %d\n", ret);
if (!hw_is_idle) { if (!hw_is_idle) {
ivpu_err(vdev, "VPU failed to enter idle, force suspended.\n"); ivpu_err(vdev, "NPU failed to enter idle, force suspended.\n");
ivpu_fw_log_dump(vdev); ivpu_fw_log_dump(vdev);
ivpu_pm_prepare_cold_boot(vdev); ivpu_pm_prepare_cold_boot(vdev);
} else { } else {
......
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
/* /*
* Copyright (C) 2020-2023 Intel Corporation * Copyright (c) 2020-2023, Intel Corporation.
*/ */
#ifndef VPU_BOOT_API_H #ifndef VPU_BOOT_API_H
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
* Minor version changes when API backward compatibility is preserved. * Minor version changes when API backward compatibility is preserved.
* Resets to 0 if Major version is incremented. * Resets to 0 if Major version is incremented.
*/ */
#define VPU_BOOT_API_VER_MINOR 20 #define VPU_BOOT_API_VER_MINOR 22
/* /*
* API header changed (field names, documentation, formatting) but API itself has not been changed * API header changed (field names, documentation, formatting) but API itself has not been changed
*/ */
#define VPU_BOOT_API_VER_PATCH 4 #define VPU_BOOT_API_VER_PATCH 0
/* /*
* Index in the API version table * Index in the API version table
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#define VPU_BOOT_API_VER_INDEX 0 #define VPU_BOOT_API_VER_INDEX 0
/* ------------ FW API version information end ---------------------*/ /* ------------ FW API version information end ---------------------*/
#pragma pack(push, 1) #pragma pack(push, 4)
/* /*
* Firmware image header format * Firmware image header format
...@@ -66,9 +66,17 @@ struct vpu_firmware_header { ...@@ -66,9 +66,17 @@ struct vpu_firmware_header {
/* Size of memory require for firmware execution */ /* Size of memory require for firmware execution */
u32 runtime_size; u32 runtime_size;
u32 shave_nn_fw_size; u32 shave_nn_fw_size;
/* Size of primary preemption buffer. */ /*
* Size of primary preemption buffer, assuming a 2-job submission queue.
* NOTE: host driver is expected to adapt size accordingly to actual
* submission queue size and device capabilities.
*/
u32 preemption_buffer_1_size; u32 preemption_buffer_1_size;
/* Size of secondary preemption buffer. */ /*
* Size of secondary preemption buffer, assuming a 2-job submission queue.
* NOTE: host driver is expected to adapt size accordingly to actual
* submission queue size and device capabilities.
*/
u32 preemption_buffer_2_size; u32 preemption_buffer_2_size;
/* Space reserved for future preemption-related fields. */ /* Space reserved for future preemption-related fields. */
u32 preemption_reserved[6]; u32 preemption_reserved[6];
...@@ -181,10 +189,10 @@ struct vpu_warm_boot_section { ...@@ -181,10 +189,10 @@ struct vpu_warm_boot_section {
#define VPU_PRESENT_CALL_PERIOD_MS_MAX 10000 #define VPU_PRESENT_CALL_PERIOD_MS_MAX 10000
/** /**
* Macros to enable various operation modes within the VPU. * Macros to enable various power profiles within the NPU.
* To be defined as part of 32 bit mask. * To be defined as part of 32 bit mask.
*/ */
#define VPU_OP_MODE_SURVIVABILITY 0x1 #define POWER_PROFILE_SURVIVABILITY 0x1
struct vpu_boot_params { struct vpu_boot_params {
u32 magic; u32 magic;
...@@ -317,7 +325,15 @@ struct vpu_boot_params { ...@@ -317,7 +325,15 @@ struct vpu_boot_params {
u64 d0i3_residency_time_us; u64 d0i3_residency_time_us;
/* Value of VPU perf counter at the time of entering D0i3 state . */ /* Value of VPU perf counter at the time of entering D0i3 state . */
u64 d0i3_entry_vpu_ts; u64 d0i3_entry_vpu_ts;
u32 pad4[20]; /*
* The system time of the host operating system in microseconds.
* E.g the number of microseconds since 1st of January 1970, or whatever date the
* host operating system uses to maintain system time.
* This value will be used to track system time on the VPU.
* The KMD is required to update this value on every VPU reset.
*/
u64 system_time_us;
u32 pad4[18];
/* Warm boot information: 0x400 - 0x43F */ /* Warm boot information: 0x400 - 0x43F */
u32 warm_boot_sections_count; u32 warm_boot_sections_count;
u32 warm_boot_start_address_reference; u32 warm_boot_start_address_reference;
...@@ -344,10 +360,14 @@ struct vpu_boot_params { ...@@ -344,10 +360,14 @@ struct vpu_boot_params {
u32 vpu_focus_present_timer_ms; u32 vpu_focus_present_timer_ms;
/* VPU ECC Signaling */ /* VPU ECC Signaling */
u32 vpu_uses_ecc_mca_signal; u32 vpu_uses_ecc_mca_signal;
/* Values defined by VPU_OP_MODE* macros */ /* Values defined by POWER_PROFILE* macros */
u32 vpu_operation_mode; u32 power_profile;
/* Unused/reserved: 0x480 - 0xFFF */ /* Microsecond value for DCT active cycle */
u32 pad6[736]; u32 dct_active_us;
/* Microsecond value for DCT inactive cycle */
u32 dct_inactive_us;
/* Unused/reserved: 0x488 - 0xFFF */
u32 pad6[734];
}; };
/* /*
......
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
/* /*
* Copyright (C) 2020-2023 Intel Corporation * Copyright (c) 2020-2023, Intel Corporation.
*/ */
/** /**
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/* /*
* API header changed (field names, documentation, formatting) but API itself has not been changed * API header changed (field names, documentation, formatting) but API itself has not been changed
*/ */
#define VPU_JSM_API_VER_PATCH 0 #define VPU_JSM_API_VER_PATCH 6
/* /*
* Index in the API version table * Index in the API version table
...@@ -43,8 +43,11 @@ ...@@ -43,8 +43,11 @@
/* Max number of impacted contexts that can be dealt with the engine reset command */ /* Max number of impacted contexts that can be dealt with the engine reset command */
#define VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS 3 #define VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS 3
/** Pack the API structures for now, once alignment issues are fixed this can be removed */ /*
#pragma pack(push, 1) * Pack the API structures to enforce binary compatibility
* Align to 8 bytes for optimal performance
*/
#pragma pack(push, 8)
/* /*
* Engine indexes. * Engine indexes.
...@@ -124,6 +127,19 @@ ...@@ -124,6 +127,19 @@
*/ */
#define VPU_HWS_MAX_REALTIME_PRIORITY_LEVEL 31U #define VPU_HWS_MAX_REALTIME_PRIORITY_LEVEL 31U
/*
* vpu_jsm_engine_reset_context flag definitions
*/
#define VPU_ENGINE_RESET_CONTEXT_FLAG_COLLATERAL_DAMAGE_MASK BIT(0)
#define VPU_ENGINE_RESET_CONTEXT_HANG_PRIMARY_CAUSE 0
#define VPU_ENGINE_RESET_CONTEXT_COLLATERAL_DAMAGE 1
/*
* Invalid command queue handle identifier. Applies to cmdq_id and cmdq_group
* in this API.
*/
#define VPU_HWS_INVALID_CMDQ_HANDLE 0ULL
/* /*
* Job format. * Job format.
*/ */
...@@ -613,7 +629,7 @@ struct vpu_jsm_engine_reset_context { ...@@ -613,7 +629,7 @@ struct vpu_jsm_engine_reset_context {
u32 reserved_0; u32 reserved_0;
/* Command queue id */ /* Command queue id */
u64 cmdq_id; u64 cmdq_id;
/* Flags: 0: cause of hang; 1: collateral damage of reset */ /* See VPU_ENGINE_RESET_CONTEXT_* defines */
u64 flags; u64 flags;
}; };
...@@ -730,11 +746,7 @@ struct vpu_ipc_msg_payload_hws_create_cmdq { ...@@ -730,11 +746,7 @@ struct vpu_ipc_msg_payload_hws_create_cmdq {
u32 host_ssid; u32 host_ssid;
/* Engine for which queue is being created */ /* Engine for which queue is being created */
u32 engine_idx; u32 engine_idx;
/* /* Cmdq group: only used for HWS logging of state changes */
* Cmdq group may be set to 0 or equal to
* cmdq_id while each priority band contains
* only single engine instances.
*/
u64 cmdq_group; u64 cmdq_group;
/* Command queue id */ /* Command queue id */
u64 cmdq_id; u64 cmdq_id;
......
...@@ -138,7 +138,6 @@ struct agp_bridge_data { ...@@ -138,7 +138,6 @@ struct agp_bridge_data {
unsigned long gart_bus_addr; unsigned long gart_bus_addr;
unsigned long gatt_bus_addr; unsigned long gatt_bus_addr;
u32 mode; u32 mode;
enum chipset_type type;
unsigned long *key_list; unsigned long *key_list;
atomic_t current_memory_agp; atomic_t current_memory_agp;
atomic_t agp_in_use; atomic_t agp_in_use;
......
...@@ -97,6 +97,10 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file) ...@@ -97,6 +97,10 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
stats.requested_visible_vram/1024UL); stats.requested_visible_vram/1024UL);
drm_printf(p, "amd-requested-gtt:\t%llu KiB\n", drm_printf(p, "amd-requested-gtt:\t%llu KiB\n",
stats.requested_gtt/1024UL); stats.requested_gtt/1024UL);
drm_printf(p, "drm-shared-vram:\t%llu KiB\n", stats.vram_shared/1024UL);
drm_printf(p, "drm-shared-gtt:\t%llu KiB\n", stats.gtt_shared/1024UL);
drm_printf(p, "drm-shared-cpu:\t%llu KiB\n", stats.cpu_shared/1024UL);
for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) { for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) {
if (!usage[hw_ip]) if (!usage[hw_ip])
continue; continue;
......
...@@ -1273,25 +1273,36 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo, ...@@ -1273,25 +1273,36 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
struct amdgpu_mem_stats *stats) struct amdgpu_mem_stats *stats)
{ {
uint64_t size = amdgpu_bo_size(bo); uint64_t size = amdgpu_bo_size(bo);
struct drm_gem_object *obj;
unsigned int domain; unsigned int domain;
bool shared;
/* Abort if the BO doesn't currently have a backing store */ /* Abort if the BO doesn't currently have a backing store */
if (!bo->tbo.resource) if (!bo->tbo.resource)
return; return;
obj = &bo->tbo.base;
shared = drm_gem_object_is_shared_for_memory_stats(obj);
domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type); domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
switch (domain) { switch (domain) {
case AMDGPU_GEM_DOMAIN_VRAM: case AMDGPU_GEM_DOMAIN_VRAM:
stats->vram += size; stats->vram += size;
if (amdgpu_bo_in_cpu_visible_vram(bo)) if (amdgpu_bo_in_cpu_visible_vram(bo))
stats->visible_vram += size; stats->visible_vram += size;
if (shared)
stats->vram_shared += size;
break; break;
case AMDGPU_GEM_DOMAIN_GTT: case AMDGPU_GEM_DOMAIN_GTT:
stats->gtt += size; stats->gtt += size;
if (shared)
stats->gtt_shared += size;
break; break;
case AMDGPU_GEM_DOMAIN_CPU: case AMDGPU_GEM_DOMAIN_CPU:
default: default:
stats->cpu += size; stats->cpu += size;
if (shared)
stats->cpu_shared += size;
break; break;
} }
......
...@@ -138,12 +138,18 @@ struct amdgpu_bo_vm { ...@@ -138,12 +138,18 @@ struct amdgpu_bo_vm {
struct amdgpu_mem_stats { struct amdgpu_mem_stats {
/* current VRAM usage, includes visible VRAM */ /* current VRAM usage, includes visible VRAM */
uint64_t vram; uint64_t vram;
/* current shared VRAM usage, includes visible VRAM */
uint64_t vram_shared;
/* current visible VRAM usage */ /* current visible VRAM usage */
uint64_t visible_vram; uint64_t visible_vram;
/* current GTT usage */ /* current GTT usage */
uint64_t gtt; uint64_t gtt;
/* current shared GTT usage */
uint64_t gtt_shared;
/* current system memory usage */ /* current system memory usage */
uint64_t cpu; uint64_t cpu;
/* current shared system memory usage */
uint64_t cpu_shared;
/* sum of evicted buffers, includes visible VRAM */ /* sum of evicted buffers, includes visible VRAM */
uint64_t evicted_vram; uint64_t evicted_vram;
/* sum of evicted buffers due to CPU access */ /* sum of evicted buffers due to CPU access */
......
...@@ -1290,17 +1290,6 @@ static int adv7511_probe(struct i2c_client *i2c) ...@@ -1290,17 +1290,6 @@ static int adv7511_probe(struct i2c_client *i2c)
INIT_WORK(&adv7511->hpd_work, adv7511_hpd_work); INIT_WORK(&adv7511->hpd_work, adv7511_hpd_work);
if (i2c->irq) {
init_waitqueue_head(&adv7511->wq);
ret = devm_request_threaded_irq(dev, i2c->irq, NULL,
adv7511_irq_handler,
IRQF_ONESHOT, dev_name(dev),
adv7511);
if (ret)
goto err_unregister_cec;
}
adv7511_power_off(adv7511); adv7511_power_off(adv7511);
i2c_set_clientdata(i2c, adv7511); i2c_set_clientdata(i2c, adv7511);
...@@ -1324,6 +1313,17 @@ static int adv7511_probe(struct i2c_client *i2c) ...@@ -1324,6 +1313,17 @@ static int adv7511_probe(struct i2c_client *i2c)
adv7511_audio_init(dev, adv7511); adv7511_audio_init(dev, adv7511);
if (i2c->irq) {
init_waitqueue_head(&adv7511->wq);
ret = devm_request_threaded_irq(dev, i2c->irq, NULL,
adv7511_irq_handler,
IRQF_ONESHOT, dev_name(dev),
adv7511);
if (ret)
goto err_unregister_audio;
}
if (adv7511->info->has_dsi) { if (adv7511->info->has_dsi) {
ret = adv7533_attach_dsi(adv7511); ret = adv7533_attach_dsi(adv7511);
if (ret) if (ret)
......
...@@ -3549,6 +3549,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, ...@@ -3549,6 +3549,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
hdmi->bridge.interlace_allowed = true; hdmi->bridge.interlace_allowed = true;
hdmi->bridge.ddc = hdmi->ddc; hdmi->bridge.ddc = hdmi->ddc;
hdmi->bridge.of_node = pdev->dev.of_node; hdmi->bridge.of_node = pdev->dev.of_node;
hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
memset(&pdevinfo, 0, sizeof(pdevinfo)); memset(&pdevinfo, 0, sizeof(pdevinfo));
pdevinfo.parent = dev; pdevinfo.parent = dev;
......
This diff is collapsed.
kms_3d,Fail kms_3d,Fail
kms_addfb_basic@addfb25-bad-modifier,Fail kms_addfb_basic@addfb25-bad-modifier,Fail
kms_force_connector_basic@force-edid,Fail
kms_hdmi_inject@inject-4k,Fail
...@@ -15,3 +15,4 @@ kms_plane_alpha_blend@alpha-7efc,Fail ...@@ -15,3 +15,4 @@ kms_plane_alpha_blend@alpha-7efc,Fail
kms_plane_alpha_blend@coverage-7efc,Fail kms_plane_alpha_blend@coverage-7efc,Fail
kms_plane_alpha_blend@coverage-vs-premult-vs-constant,Fail kms_plane_alpha_blend@coverage-vs-premult-vs-constant,Fail
kms_rmfb@close-fd,Fail kms_rmfb@close-fd,Fail
kms_universal_plane@universal-plane-sanity,Fail
# Suspend to RAM seems to be broken on this machine
.*suspend.*
...@@ -15,3 +15,4 @@ kms_plane_alpha_blend@alpha-7efc,Fail ...@@ -15,3 +15,4 @@ kms_plane_alpha_blend@alpha-7efc,Fail
kms_plane_alpha_blend@coverage-7efc,Fail kms_plane_alpha_blend@coverage-7efc,Fail
kms_plane_alpha_blend@coverage-vs-premult-vs-constant,Fail kms_plane_alpha_blend@coverage-vs-premult-vs-constant,Fail
kms_rmfb@close-fd,Fail kms_rmfb@close-fd,Fail
kms_universal_plane@universal-plane-sanity,Fail
# Suspend to RAM seems to be broken on this machine
.*suspend.*
...@@ -913,7 +913,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) ...@@ -913,7 +913,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file)
DRM_GEM_OBJECT_PURGEABLE; DRM_GEM_OBJECT_PURGEABLE;
} }
if (obj->handle_count > 1) { if (drm_gem_object_is_shared_for_memory_stats(obj)) {
status.shared += obj->size; status.shared += obj->size;
} else { } else {
status.private += obj->size; status.private += obj->size;
......
...@@ -441,6 +441,9 @@ int drm_syncobj_find_fence(struct drm_file *file_private, ...@@ -441,6 +441,9 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
u64 timeout = nsecs_to_jiffies64(DRM_SYNCOBJ_WAIT_FOR_SUBMIT_TIMEOUT); u64 timeout = nsecs_to_jiffies64(DRM_SYNCOBJ_WAIT_FOR_SUBMIT_TIMEOUT);
int ret; int ret;
if (flags & ~DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)
return -EINVAL;
if (!syncobj) if (!syncobj)
return -ENOENT; return -ENOENT;
...@@ -1040,8 +1043,11 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, ...@@ -1040,8 +1043,11 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
uint64_t *points; uint64_t *points;
uint32_t signaled_count, i; uint32_t signaled_count, i;
if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT |
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE)) {
might_sleep();
lockdep_assert_none_held_once(); lockdep_assert_none_held_once();
}
points = kmalloc_array(count, sizeof(*points), GFP_KERNEL); points = kmalloc_array(count, sizeof(*points), GFP_KERNEL);
if (points == NULL) if (points == NULL)
...@@ -1109,7 +1115,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, ...@@ -1109,7 +1115,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
* fallthough and try a 0 timeout wait! * fallthough and try a 0 timeout wait!
*/ */
if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT |
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE)) {
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)
drm_syncobj_fence_add_wait(syncobjs[i], &entries[i]); drm_syncobj_fence_add_wait(syncobjs[i], &entries[i]);
} }
......
...@@ -53,7 +53,7 @@ obj_meminfo(struct drm_i915_gem_object *obj, ...@@ -53,7 +53,7 @@ obj_meminfo(struct drm_i915_gem_object *obj,
obj->mm.region->id : INTEL_REGION_SMEM; obj->mm.region->id : INTEL_REGION_SMEM;
const u64 sz = obj->base.size; const u64 sz = obj->base.size;
if (obj->base.handle_count > 1) if (drm_gem_object_is_shared_for_memory_stats(&obj->base))
stats[id].shared += sz; stats[id].shared += sz;
else else
stats[id].private += sz; stats[id].private += sz;
......
...@@ -312,7 +312,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) ...@@ -312,7 +312,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
/* Encoder Initialization */ /* Encoder Initialization */
ret = meson_encoder_cvbs_init(priv); ret = meson_encoder_cvbs_probe(priv);
if (ret) if (ret)
goto exit_afbcd; goto exit_afbcd;
...@@ -326,12 +326,12 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) ...@@ -326,12 +326,12 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
} }
} }
ret = meson_encoder_hdmi_init(priv); ret = meson_encoder_hdmi_probe(priv);
if (ret) if (ret)
goto exit_afbcd; goto exit_afbcd;
if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) { if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) {
ret = meson_encoder_dsi_init(priv); ret = meson_encoder_dsi_probe(priv);
if (ret) if (ret)
goto exit_afbcd; goto exit_afbcd;
} }
......
...@@ -219,7 +219,7 @@ static const struct drm_bridge_funcs meson_encoder_cvbs_bridge_funcs = { ...@@ -219,7 +219,7 @@ static const struct drm_bridge_funcs meson_encoder_cvbs_bridge_funcs = {
.atomic_reset = drm_atomic_helper_bridge_reset, .atomic_reset = drm_atomic_helper_bridge_reset,
}; };
int meson_encoder_cvbs_init(struct meson_drm *priv) int meson_encoder_cvbs_probe(struct meson_drm *priv)
{ {
struct drm_device *drm = priv->drm; struct drm_device *drm = priv->drm;
struct meson_encoder_cvbs *meson_encoder_cvbs; struct meson_encoder_cvbs *meson_encoder_cvbs;
...@@ -240,10 +240,9 @@ int meson_encoder_cvbs_init(struct meson_drm *priv) ...@@ -240,10 +240,9 @@ int meson_encoder_cvbs_init(struct meson_drm *priv)
meson_encoder_cvbs->next_bridge = of_drm_find_bridge(remote); meson_encoder_cvbs->next_bridge = of_drm_find_bridge(remote);
of_node_put(remote); of_node_put(remote);
if (!meson_encoder_cvbs->next_bridge) { if (!meson_encoder_cvbs->next_bridge)
dev_err(priv->dev, "Failed to find CVBS Connector bridge\n"); return dev_err_probe(priv->dev, -EPROBE_DEFER,
return -EPROBE_DEFER; "Failed to find CVBS Connector bridge\n");
}
/* CVBS Encoder Bridge */ /* CVBS Encoder Bridge */
meson_encoder_cvbs->bridge.funcs = &meson_encoder_cvbs_bridge_funcs; meson_encoder_cvbs->bridge.funcs = &meson_encoder_cvbs_bridge_funcs;
...@@ -259,10 +258,9 @@ int meson_encoder_cvbs_init(struct meson_drm *priv) ...@@ -259,10 +258,9 @@ int meson_encoder_cvbs_init(struct meson_drm *priv)
/* Encoder */ /* Encoder */
ret = drm_simple_encoder_init(priv->drm, &meson_encoder_cvbs->encoder, ret = drm_simple_encoder_init(priv->drm, &meson_encoder_cvbs->encoder,
DRM_MODE_ENCODER_TVDAC); DRM_MODE_ENCODER_TVDAC);
if (ret) { if (ret)
dev_err(priv->dev, "Failed to init CVBS encoder: %d\n", ret); return dev_err_probe(priv->dev, ret,
return ret; "Failed to init CVBS encoder\n");
}
meson_encoder_cvbs->encoder.possible_crtcs = BIT(0); meson_encoder_cvbs->encoder.possible_crtcs = BIT(0);
...@@ -276,10 +274,10 @@ int meson_encoder_cvbs_init(struct meson_drm *priv) ...@@ -276,10 +274,10 @@ int meson_encoder_cvbs_init(struct meson_drm *priv)
/* Initialize & attach Bridge Connector */ /* Initialize & attach Bridge Connector */
connector = drm_bridge_connector_init(priv->drm, &meson_encoder_cvbs->encoder); connector = drm_bridge_connector_init(priv->drm, &meson_encoder_cvbs->encoder);
if (IS_ERR(connector)) { if (IS_ERR(connector))
dev_err(priv->dev, "Unable to create CVBS bridge connector\n"); return dev_err_probe(priv->dev, PTR_ERR(connector),
return PTR_ERR(connector); "Unable to create CVBS bridge connector\n");
}
drm_connector_attach_encoder(connector, &meson_encoder_cvbs->encoder); drm_connector_attach_encoder(connector, &meson_encoder_cvbs->encoder);
priv->encoders[MESON_ENC_CVBS] = meson_encoder_cvbs; priv->encoders[MESON_ENC_CVBS] = meson_encoder_cvbs;
......
...@@ -24,7 +24,7 @@ struct meson_cvbs_mode { ...@@ -24,7 +24,7 @@ struct meson_cvbs_mode {
/* Modes supported by the CVBS output */ /* Modes supported by the CVBS output */
extern struct meson_cvbs_mode meson_cvbs_modes[MESON_CVBS_MODES_COUNT]; extern struct meson_cvbs_mode meson_cvbs_modes[MESON_CVBS_MODES_COUNT];
int meson_encoder_cvbs_init(struct meson_drm *priv); int meson_encoder_cvbs_probe(struct meson_drm *priv);
void meson_encoder_cvbs_remove(struct meson_drm *priv); void meson_encoder_cvbs_remove(struct meson_drm *priv);
#endif /* __MESON_VENC_CVBS_H */ #endif /* __MESON_VENC_CVBS_H */
...@@ -100,7 +100,7 @@ static const struct drm_bridge_funcs meson_encoder_dsi_bridge_funcs = { ...@@ -100,7 +100,7 @@ static const struct drm_bridge_funcs meson_encoder_dsi_bridge_funcs = {
.atomic_reset = drm_atomic_helper_bridge_reset, .atomic_reset = drm_atomic_helper_bridge_reset,
}; };
int meson_encoder_dsi_init(struct meson_drm *priv) int meson_encoder_dsi_probe(struct meson_drm *priv)
{ {
struct meson_encoder_dsi *meson_encoder_dsi; struct meson_encoder_dsi *meson_encoder_dsi;
struct device_node *remote; struct device_node *remote;
...@@ -118,10 +118,9 @@ int meson_encoder_dsi_init(struct meson_drm *priv) ...@@ -118,10 +118,9 @@ int meson_encoder_dsi_init(struct meson_drm *priv)
} }
meson_encoder_dsi->next_bridge = of_drm_find_bridge(remote); meson_encoder_dsi->next_bridge = of_drm_find_bridge(remote);
if (!meson_encoder_dsi->next_bridge) { if (!meson_encoder_dsi->next_bridge)
dev_dbg(priv->dev, "Failed to find DSI transceiver bridge\n"); return dev_err_probe(priv->dev, -EPROBE_DEFER,
return -EPROBE_DEFER; "Failed to find DSI transceiver bridge\n");
}
/* DSI Encoder Bridge */ /* DSI Encoder Bridge */
meson_encoder_dsi->bridge.funcs = &meson_encoder_dsi_bridge_funcs; meson_encoder_dsi->bridge.funcs = &meson_encoder_dsi_bridge_funcs;
...@@ -135,19 +134,17 @@ int meson_encoder_dsi_init(struct meson_drm *priv) ...@@ -135,19 +134,17 @@ int meson_encoder_dsi_init(struct meson_drm *priv)
/* Encoder */ /* Encoder */
ret = drm_simple_encoder_init(priv->drm, &meson_encoder_dsi->encoder, ret = drm_simple_encoder_init(priv->drm, &meson_encoder_dsi->encoder,
DRM_MODE_ENCODER_DSI); DRM_MODE_ENCODER_DSI);
if (ret) { if (ret)
dev_err(priv->dev, "Failed to init DSI encoder: %d\n", ret); return dev_err_probe(priv->dev, ret,
return ret; "Failed to init DSI encoder\n");
}
meson_encoder_dsi->encoder.possible_crtcs = BIT(0); meson_encoder_dsi->encoder.possible_crtcs = BIT(0);
/* Attach DSI Encoder Bridge to Encoder */ /* Attach DSI Encoder Bridge to Encoder */
ret = drm_bridge_attach(&meson_encoder_dsi->encoder, &meson_encoder_dsi->bridge, NULL, 0); ret = drm_bridge_attach(&meson_encoder_dsi->encoder, &meson_encoder_dsi->bridge, NULL, 0);
if (ret) { if (ret)
dev_err(priv->dev, "Failed to attach bridge: %d\n", ret); return dev_err_probe(priv->dev, ret,
return ret; "Failed to attach bridge\n");
}
/* /*
* We should have now in place: * We should have now in place:
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef __MESON_ENCODER_DSI_H #ifndef __MESON_ENCODER_DSI_H
#define __MESON_ENCODER_DSI_H #define __MESON_ENCODER_DSI_H
int meson_encoder_dsi_init(struct meson_drm *priv); int meson_encoder_dsi_probe(struct meson_drm *priv);
void meson_encoder_dsi_remove(struct meson_drm *priv); void meson_encoder_dsi_remove(struct meson_drm *priv);
#endif /* __MESON_ENCODER_DSI_H */ #endif /* __MESON_ENCODER_DSI_H */
...@@ -366,7 +366,7 @@ static const struct drm_bridge_funcs meson_encoder_hdmi_bridge_funcs = { ...@@ -366,7 +366,7 @@ static const struct drm_bridge_funcs meson_encoder_hdmi_bridge_funcs = {
.atomic_reset = drm_atomic_helper_bridge_reset, .atomic_reset = drm_atomic_helper_bridge_reset,
}; };
int meson_encoder_hdmi_init(struct meson_drm *priv) int meson_encoder_hdmi_probe(struct meson_drm *priv)
{ {
struct meson_encoder_hdmi *meson_encoder_hdmi; struct meson_encoder_hdmi *meson_encoder_hdmi;
struct platform_device *pdev; struct platform_device *pdev;
...@@ -386,8 +386,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) ...@@ -386,8 +386,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)
meson_encoder_hdmi->next_bridge = of_drm_find_bridge(remote); meson_encoder_hdmi->next_bridge = of_drm_find_bridge(remote);
if (!meson_encoder_hdmi->next_bridge) { if (!meson_encoder_hdmi->next_bridge) {
dev_err(priv->dev, "Failed to find HDMI transceiver bridge\n"); ret = dev_err_probe(priv->dev, -EPROBE_DEFER,
ret = -EPROBE_DEFER; "Failed to find HDMI transceiver bridge\n");
goto err_put_node; goto err_put_node;
} }
...@@ -405,7 +405,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) ...@@ -405,7 +405,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)
ret = drm_simple_encoder_init(priv->drm, &meson_encoder_hdmi->encoder, ret = drm_simple_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
DRM_MODE_ENCODER_TMDS); DRM_MODE_ENCODER_TMDS);
if (ret) { if (ret) {
dev_err(priv->dev, "Failed to init HDMI encoder: %d\n", ret); dev_err_probe(priv->dev, ret, "Failed to init HDMI encoder\n");
goto err_put_node; goto err_put_node;
} }
...@@ -415,7 +415,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) ...@@ -415,7 +415,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)
ret = drm_bridge_attach(&meson_encoder_hdmi->encoder, &meson_encoder_hdmi->bridge, NULL, ret = drm_bridge_attach(&meson_encoder_hdmi->encoder, &meson_encoder_hdmi->bridge, NULL,
DRM_BRIDGE_ATTACH_NO_CONNECTOR); DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (ret) { if (ret) {
dev_err(priv->dev, "Failed to attach bridge: %d\n", ret); dev_err_probe(priv->dev, ret, "Failed to attach bridge\n");
goto err_put_node; goto err_put_node;
} }
...@@ -423,8 +423,9 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) ...@@ -423,8 +423,9 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)
meson_encoder_hdmi->connector = drm_bridge_connector_init(priv->drm, meson_encoder_hdmi->connector = drm_bridge_connector_init(priv->drm,
&meson_encoder_hdmi->encoder); &meson_encoder_hdmi->encoder);
if (IS_ERR(meson_encoder_hdmi->connector)) { if (IS_ERR(meson_encoder_hdmi->connector)) {
dev_err(priv->dev, "Unable to create HDMI bridge connector\n"); ret = dev_err_probe(priv->dev,
ret = PTR_ERR(meson_encoder_hdmi->connector); PTR_ERR(meson_encoder_hdmi->connector),
"Unable to create HDMI bridge connector\n");
goto err_put_node; goto err_put_node;
} }
drm_connector_attach_encoder(meson_encoder_hdmi->connector, drm_connector_attach_encoder(meson_encoder_hdmi->connector,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef __MESON_ENCODER_HDMI_H #ifndef __MESON_ENCODER_HDMI_H
#define __MESON_ENCODER_HDMI_H #define __MESON_ENCODER_HDMI_H
int meson_encoder_hdmi_init(struct meson_drm *priv); int meson_encoder_hdmi_probe(struct meson_drm *priv);
void meson_encoder_hdmi_remove(struct meson_drm *priv); void meson_encoder_hdmi_remove(struct meson_drm *priv);
#endif /* __MESON_ENCODER_HDMI_H */ #endif /* __MESON_ENCODER_HDMI_H */
...@@ -145,6 +145,16 @@ config DRM_PANEL_LVDS ...@@ -145,6 +145,16 @@ config DRM_PANEL_LVDS
handling of power supplies or control signals. It implements automatic handling of power supplies or control signals. It implements automatic
backlight handling if the panel is attached to a backlight controller. backlight handling if the panel is attached to a backlight controller.
config DRM_PANEL_HIMAX_HX83112A
tristate "Himax HX83112A-based DSI panel"
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
select DRM_KMS_HELPER
help
Say Y here if you want to enable support for Himax HX83112A-based
display panels, such as the one found in the Fairphone 4 smartphone.
config DRM_PANEL_HIMAX_HX8394 config DRM_PANEL_HIMAX_HX8394
tristate "HIMAX HX8394 MIPI-DSI LCD panels" tristate "HIMAX HX8394 MIPI-DSI LCD panels"
depends on OF depends on OF
......
...@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_PANEL_EBBG_FT8719) += panel-ebbg-ft8719.o ...@@ -15,6 +15,7 @@ obj-$(CONFIG_DRM_PANEL_EBBG_FT8719) += panel-ebbg-ft8719.o
obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o
obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o
obj-$(CONFIG_DRM_PANEL_HIMAX_HX83112A) += panel-himax-hx83112a.o
obj-$(CONFIG_DRM_PANEL_HIMAX_HX8394) += panel-himax-hx8394.o obj-$(CONFIG_DRM_PANEL_HIMAX_HX8394) += panel-himax-hx8394.o
obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o
......
...@@ -1871,6 +1871,8 @@ static int boe_panel_add(struct boe_panel *boe) ...@@ -1871,6 +1871,8 @@ static int boe_panel_add(struct boe_panel *boe)
gpiod_set_value(boe->enable_gpio, 0); gpiod_set_value(boe->enable_gpio, 0);
boe->base.prepare_prev_first = true;
drm_panel_init(&boe->base, dev, &boe_panel_funcs, drm_panel_init(&boe->base, dev, &boe_panel_funcs,
DRM_MODE_CONNECTOR_DSI); DRM_MODE_CONNECTOR_DSI);
err = of_drm_get_panel_orientation(dev->of_node, &boe->orientation); err = of_drm_get_panel_orientation(dev->of_node, &boe->orientation);
......
...@@ -1002,19 +1002,6 @@ static const struct panel_desc auo_b101ean01 = { ...@@ -1002,19 +1002,6 @@ static const struct panel_desc auo_b101ean01 = {
}, },
}; };
static const struct drm_display_mode auo_b116xa3_mode = {
.clock = 70589,
.hdisplay = 1366,
.hsync_start = 1366 + 40,
.hsync_end = 1366 + 40 + 40,
.htotal = 1366 + 40 + 40 + 32,
.vdisplay = 768,
.vsync_start = 768 + 10,
.vsync_end = 768 + 10 + 12,
.vtotal = 768 + 10 + 12 + 6,
.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
};
static const struct drm_display_mode auo_b116xak01_mode = { static const struct drm_display_mode auo_b116xak01_mode = {
.clock = 69300, .clock = 69300,
.hdisplay = 1366, .hdisplay = 1366,
...@@ -1963,12 +1950,10 @@ static const struct edp_panel_entry edp_panels[] = { ...@@ -1963,12 +1950,10 @@ static const struct edp_panel_entry edp_panels[] = {
EDP_PANEL_ENTRY('A', 'U', 'O', 0x239b, &delay_200_500_e50, "B116XAN06.1"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x239b, &delay_200_500_e50, "B116XAN06.1"),
EDP_PANEL_ENTRY('A', 'U', 'O', 0x255c, &delay_200_500_e50, "B116XTN02.5"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x255c, &delay_200_500_e50, "B116XTN02.5"),
EDP_PANEL_ENTRY('A', 'U', 'O', 0x403d, &delay_200_500_e50, "B140HAN04.0"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x403d, &delay_200_500_e50, "B140HAN04.0"),
EDP_PANEL_ENTRY2('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.0", EDP_PANEL_ENTRY('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.0"),
&auo_b116xa3_mode),
EDP_PANEL_ENTRY('A', 'U', 'O', 0x435c, &delay_200_500_e50, "Unknown"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x435c, &delay_200_500_e50, "Unknown"),
EDP_PANEL_ENTRY('A', 'U', 'O', 0x582d, &delay_200_500_e50, "B133UAN01.0"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x582d, &delay_200_500_e50, "B133UAN01.0"),
EDP_PANEL_ENTRY2('A', 'U', 'O', 0x615c, &delay_200_500_e50, "B116XAN06.1", EDP_PANEL_ENTRY('A', 'U', 'O', 0x615c, &delay_200_500_e50, "B116XAN06.1"),
&auo_b116xa3_mode),
EDP_PANEL_ENTRY('A', 'U', 'O', 0x635c, &delay_200_500_e50, "B116XAN06.3"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x635c, &delay_200_500_e50, "B116XAN06.3"),
EDP_PANEL_ENTRY('A', 'U', 'O', 0x639c, &delay_200_500_e50, "B140HAK02.7"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x639c, &delay_200_500_e50, "B140HAK02.7"),
EDP_PANEL_ENTRY('A', 'U', 'O', 0x723c, &delay_200_500_e50, "B140XTN07.2"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x723c, &delay_200_500_e50, "B140XTN07.2"),
......
This diff is collapsed.
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <video/mipi_display.h> #include <video/mipi_display.h>
...@@ -21,25 +22,224 @@ ...@@ -21,25 +22,224 @@
#include <drm/drm_modes.h> #include <drm/drm_modes.h>
#include <drm/drm_panel.h> #include <drm/drm_panel.h>
struct ltk500hd1829_cmd {
char cmd;
char data;
};
struct ltk500hd1829_desc {
const struct drm_display_mode *mode;
const struct ltk500hd1829_cmd *init;
unsigned int num_init;
};
struct ltk500hd1829 { struct ltk500hd1829 {
struct device *dev; struct device *dev;
struct drm_panel panel; struct drm_panel panel;
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct regulator *vcc; struct regulator *vcc;
struct regulator *iovcc; struct regulator *iovcc;
const struct ltk500hd1829_desc *panel_desc;
bool prepared; bool prepared;
}; };
struct ltk500hd1829_cmd { static const struct ltk500hd1829_cmd ltk101b4029w_init[] = {
char cmd; /* Page0 */
char data; { 0xE0, 0x00 },
/* PASSWORD */
{ 0xE1, 0x93 },
{ 0xE2, 0x65 },
{ 0xE3, 0xF8 },
{ 0x80, 0x03 }, /* 0X03:4-LANE; 0X02:3-LANE; 0X01:2-LANE */
/* Page1 */
{ 0xE0, 0x01 },
/* Set VCOM */
{ 0x00, 0x00 },
{ 0x01, 0x6F },
/* Set Gamma Power, VGMP,VGMN,VGSP,VGSN */
{ 0x17, 0x00 },
{ 0x18, 0xAF }, /* 4.3V */
{ 0x19, 0x01 }, /* 0.3V */
{ 0x1A, 0x00 },
{ 0x1B, 0xAF }, /* 4.3V */
{ 0x1C, 0x01 }, /* 0.3V */
/* Set Gate Power */
{ 0x1F, 0x3E }, /* VGH_R = 15V */
{ 0x20, 0x28 }, /* VGL_R = -12V */
{ 0x21, 0x28 }, /* VGL_R2 = -12V */
{ 0x22, 0x7E },
/* SETPANEL */
{ 0x35, 0x26 },
{ 0x37, 0x09 },
/* SET RGBCYC */
{ 0x38, 0x04 },
{ 0x39, 0x00 },
{ 0x3A, 0x01 },
{ 0x3C, 0x7C },
{ 0x3D, 0xFF },
{ 0x3E, 0xFF },
{ 0x3F, 0x7F },
/* Set TCON */
{ 0x40, 0x06 }, /* RSO = 800 RGB */
{ 0x41, 0xA0 }, /* LN = 640->1280 line */
{ 0x42, 0x81 },
{ 0x43, 0x08 }, /* VFP = 8 */
{ 0x44, 0x0B }, /* VBP = 12 */
{ 0x45, 0x28 }, /* HBP = 40 */
/* power voltage */
{ 0x55, 0x0F }, /* DCDCM = 0001, JD PWR_IC */
{ 0x57, 0x69 },
{ 0x59, 0x0A }, /* VCL = -2.9V */
{ 0x5A, 0x28 }, /* VGH = 15V */
{ 0x5B, 0x14 }, /* VGL = -11V */
/* Gamma */
{ 0x5D, 0x7C },
{ 0x5E, 0x65 },
{ 0x5F, 0x55 },
{ 0x60, 0x47 },
{ 0x61, 0x43 },
{ 0x62, 0x32 },
{ 0x63, 0x34 },
{ 0x64, 0x1C },
{ 0x65, 0x33 },
{ 0x66, 0x31 },
{ 0x67, 0x30 },
{ 0x68, 0x4E },
{ 0x69, 0x3C },
{ 0x6A, 0x44 },
{ 0x6B, 0x35 },
{ 0x6C, 0x31 },
{ 0x6D, 0x23 },
{ 0x6E, 0x11 },
{ 0x6F, 0x00 },
{ 0x70, 0x7C },
{ 0x71, 0x65 },
{ 0x72, 0x55 },
{ 0x73, 0x47 },
{ 0x74, 0x43 },
{ 0x75, 0x32 },
{ 0x76, 0x34 },
{ 0x77, 0x1C },
{ 0x78, 0x33 },
{ 0x79, 0x31 },
{ 0x7A, 0x30 },
{ 0x7B, 0x4E },
{ 0x7C, 0x3C },
{ 0x7D, 0x44 },
{ 0x7E, 0x35 },
{ 0x7F, 0x31 },
{ 0x80, 0x23 },
{ 0x81, 0x11 },
{ 0x82, 0x00 },
/* Page2, for GIP */
{ 0xE0, 0x02 },
/* GIP_L Pin mapping */
{ 0x00, 0x1E },
{ 0x01, 0x1E },
{ 0x02, 0x41 },
{ 0x03, 0x41 },
{ 0x04, 0x43 },
{ 0x05, 0x43 },
{ 0x06, 0x1F },
{ 0x07, 0x1F },
{ 0x08, 0x35 },
{ 0x09, 0x1F },
{ 0x0A, 0x15 },
{ 0x0B, 0x15 },
{ 0x0C, 0x1F },
{ 0x0D, 0x47 },
{ 0x0E, 0x47 },
{ 0x0F, 0x45 },
{ 0x10, 0x45 },
{ 0x11, 0x4B },
{ 0x12, 0x4B },
{ 0x13, 0x49 },
{ 0x14, 0x49 },
{ 0x15, 0x1F },
/* GIP_R Pin mapping */
{ 0x16, 0x1E },
{ 0x17, 0x1E },
{ 0x18, 0x40 },
{ 0x19, 0x40 },
{ 0x1A, 0x42 },
{ 0x1B, 0x42 },
{ 0x1C, 0x1F },
{ 0x1D, 0x1F },
{ 0x1E, 0x35 },
{ 0x1F, 0x1F },
{ 0x20, 0x15 },
{ 0x21, 0x15 },
{ 0x22, 0x1f },
{ 0x23, 0x46 },
{ 0x24, 0x46 },
{ 0x25, 0x44 },
{ 0x26, 0x44 },
{ 0x27, 0x4A },
{ 0x28, 0x4A },
{ 0x29, 0x48 },
{ 0x2A, 0x48 },
{ 0x2B, 0x1F },
/* GIP Timing */
{ 0x58, 0x40 },
{ 0x5B, 0x30 },
{ 0x5C, 0x03 },
{ 0x5D, 0x30 },
{ 0x5E, 0x01 },
{ 0x5F, 0x02 },
{ 0x63, 0x14 },
{ 0x64, 0x6A },
{ 0x67, 0x73 },
{ 0x68, 0x05 },
{ 0x69, 0x14 },
{ 0x6A, 0x6A },
{ 0x6B, 0x08 },
{ 0x6C, 0x00 },
{ 0x6D, 0x00 },
{ 0x6E, 0x00 },
{ 0x6F, 0x88 },
{ 0x77, 0xDD },
{ 0x79, 0x0E },
{ 0x7A, 0x03 },
{ 0x7D, 0x14 },
{ 0x7E, 0x6A },
/* Page4 */
{ 0xE0, 0x04 },
{ 0x09, 0x11 },
{ 0x0E, 0x48 },
{ 0x2B, 0x2B },
{ 0x2D, 0x03 },
{ 0x2E, 0x44 },
/* Page0 */
{ 0xE0, 0x00 },
{ 0xE6, 0x02 },
{ 0xE7, 0x0C },
};
static const struct drm_display_mode ltk101b4029w_mode = {
.hdisplay = 800,
.hsync_start = 800 + 18,
.hsync_end = 800 + 18 + 18,
.htotal = 800 + 18 + 18 + 18,
.vdisplay = 1280,
.vsync_start = 1280 + 24,
.vsync_end = 1280 + 24 + 4,
.vtotal = 1280 + 24 + 4 + 8,
.clock = 67330,
.width_mm = 136,
.height_mm = 218,
};
static const struct ltk500hd1829_desc ltk101b4029w_data = {
.mode = &ltk101b4029w_mode,
.init = ltk101b4029w_init,
.num_init = ARRAY_SIZE(ltk101b4029w_init),
}; };
/* /*
* There is no description in the Reference Manual about these commands. * There is no description in the Reference Manual about these commands.
* We received them from the vendor, so just use them as is. * We received them from the vendor, so just use them as is.
*/ */
static const struct ltk500hd1829_cmd init_code[] = { static const struct ltk500hd1829_cmd ltk500hd1829_init[] = {
{ 0xE0, 0x00 }, { 0xE0, 0x00 },
{ 0xE1, 0x93 }, { 0xE1, 0x93 },
{ 0xE2, 0x65 }, { 0xE2, 0x65 },
...@@ -260,6 +460,26 @@ static const struct ltk500hd1829_cmd init_code[] = { ...@@ -260,6 +460,26 @@ static const struct ltk500hd1829_cmd init_code[] = {
{ 0x35, 0x00 }, { 0x35, 0x00 },
}; };
static const struct drm_display_mode ltk500hd1829_mode = {
.hdisplay = 720,
.hsync_start = 720 + 50,
.hsync_end = 720 + 50 + 50,
.htotal = 720 + 50 + 50 + 50,
.vdisplay = 1280,
.vsync_start = 1280 + 30,
.vsync_end = 1280 + 30 + 4,
.vtotal = 1280 + 30 + 4 + 12,
.clock = 69217,
.width_mm = 62,
.height_mm = 110,
};
static const struct ltk500hd1829_desc ltk500hd1829_data = {
.mode = &ltk500hd1829_mode,
.init = ltk500hd1829_init,
.num_init = ARRAY_SIZE(ltk500hd1829_init),
};
static inline static inline
struct ltk500hd1829 *panel_to_ltk500hd1829(struct drm_panel *panel) struct ltk500hd1829 *panel_to_ltk500hd1829(struct drm_panel *panel)
{ {
...@@ -324,8 +544,8 @@ static int ltk500hd1829_prepare(struct drm_panel *panel) ...@@ -324,8 +544,8 @@ static int ltk500hd1829_prepare(struct drm_panel *panel)
/* tRT: >= 5ms */ /* tRT: >= 5ms */
usleep_range(5000, 6000); usleep_range(5000, 6000);
for (i = 0; i < ARRAY_SIZE(init_code); i++) { for (i = 0; i < ctx->panel_desc->num_init; i++) {
ret = mipi_dsi_generic_write(dsi, &init_code[i], ret = mipi_dsi_generic_write(dsi, &ctx->panel_desc->init[i],
sizeof(struct ltk500hd1829_cmd)); sizeof(struct ltk500hd1829_cmd));
if (ret < 0) { if (ret < 0) {
dev_err(panel->dev, "failed to write init cmds: %d\n", ret); dev_err(panel->dev, "failed to write init cmds: %d\n", ret);
...@@ -359,31 +579,17 @@ static int ltk500hd1829_prepare(struct drm_panel *panel) ...@@ -359,31 +579,17 @@ static int ltk500hd1829_prepare(struct drm_panel *panel)
return ret; return ret;
} }
static const struct drm_display_mode default_mode = {
.hdisplay = 720,
.hsync_start = 720 + 50,
.hsync_end = 720 + 50 + 50,
.htotal = 720 + 50 + 50 + 50,
.vdisplay = 1280,
.vsync_start = 1280 + 30,
.vsync_end = 1280 + 30 + 4,
.vtotal = 1280 + 30 + 4 + 12,
.clock = 69217,
.width_mm = 62,
.height_mm = 110,
};
static int ltk500hd1829_get_modes(struct drm_panel *panel, static int ltk500hd1829_get_modes(struct drm_panel *panel,
struct drm_connector *connector) struct drm_connector *connector)
{ {
struct ltk500hd1829 *ctx = panel_to_ltk500hd1829(panel); struct ltk500hd1829 *ctx = panel_to_ltk500hd1829(panel);
struct drm_display_mode *mode; struct drm_display_mode *mode;
mode = drm_mode_duplicate(connector->dev, &default_mode); mode = drm_mode_duplicate(connector->dev, ctx->panel_desc->mode);
if (!mode) { if (!mode) {
dev_err(ctx->dev, "failed to add mode %ux%u@%u\n", dev_err(ctx->dev, "failed to add mode %ux%u@%u\n",
default_mode.hdisplay, default_mode.vdisplay, ctx->panel_desc->mode->hdisplay, ctx->panel_desc->mode->vdisplay,
drm_mode_vrefresh(&default_mode)); drm_mode_vrefresh(ctx->panel_desc->mode));
return -ENOMEM; return -ENOMEM;
} }
...@@ -413,6 +619,10 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi) ...@@ -413,6 +619,10 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi)
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
ctx->panel_desc = of_device_get_match_data(dev);
if (!ctx->panel_desc)
return -EINVAL;
ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(ctx->reset_gpio)) { if (IS_ERR(ctx->reset_gpio)) {
dev_err(dev, "cannot get reset gpio\n"); dev_err(dev, "cannot get reset gpio\n");
...@@ -492,7 +702,14 @@ static void ltk500hd1829_remove(struct mipi_dsi_device *dsi) ...@@ -492,7 +702,14 @@ static void ltk500hd1829_remove(struct mipi_dsi_device *dsi)
} }
static const struct of_device_id ltk500hd1829_of_match[] = { static const struct of_device_id ltk500hd1829_of_match[] = {
{ .compatible = "leadtek,ltk500hd1829", }, {
.compatible = "leadtek,ltk101b4029w",
.data = &ltk101b4029w_data,
},
{
.compatible = "leadtek,ltk500hd1829",
.data = &ltk500hd1829_data,
},
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, ltk500hd1829_of_match); MODULE_DEVICE_TABLE(of, ltk500hd1829_of_match);
......
...@@ -1367,6 +1367,23 @@ static const struct drm_display_mode boe_bp101wx1_100_mode = { ...@@ -1367,6 +1367,23 @@ static const struct drm_display_mode boe_bp101wx1_100_mode = {
.vtotal = 800 + 6 + 8 + 2, .vtotal = 800 + 6 + 8 + 2,
}; };
static const struct panel_desc boe_bp082wx1_100 = {
.modes = &boe_bp101wx1_100_mode,
.num_modes = 1,
.bpc = 8,
.size = {
.width = 177,
.height = 110,
},
.delay = {
.enable = 50,
.disable = 50,
},
.bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
.bus_flags = DRM_BUS_FLAG_DE_HIGH,
.connector_type = DRM_MODE_CONNECTOR_LVDS,
};
static const struct panel_desc boe_bp101wx1_100 = { static const struct panel_desc boe_bp101wx1_100 = {
.modes = &boe_bp101wx1_100_mode, .modes = &boe_bp101wx1_100_mode,
.num_modes = 1, .num_modes = 1,
...@@ -4373,6 +4390,9 @@ static const struct of_device_id platform_of_match[] = { ...@@ -4373,6 +4390,9 @@ static const struct of_device_id platform_of_match[] = {
}, { }, {
.compatible = "bananapi,s070wv20-ct16", .compatible = "bananapi,s070wv20-ct16",
.data = &bananapi_s070wv20_ct16, .data = &bananapi_s070wv20_ct16,
}, {
.compatible = "boe,bp082wx1-100",
.data = &boe_bp082wx1_100,
}, { }, {
.compatible = "boe,bp101wx1-100", .compatible = "boe,bp101wx1-100",
.data = &boe_bp101wx1_100, .data = &boe_bp101wx1_100,
......
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
source "drivers/gpu/drm/renesas/rcar-du/Kconfig" source "drivers/gpu/drm/renesas/rcar-du/Kconfig"
source "drivers/gpu/drm/renesas/rz-du/Kconfig"
source "drivers/gpu/drm/renesas/shmobile/Kconfig" source "drivers/gpu/drm/renesas/shmobile/Kconfig"
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
obj-y += rcar-du/ obj-y += rcar-du/
obj-y += rz-du/
obj-$(CONFIG_DRM_SHMOBILE) += shmobile/ obj-$(CONFIG_DRM_SHMOBILE) += shmobile/
# SPDX-License-Identifier: GPL-2.0
config DRM_RZG2L_DU
tristate "DRM Support for RZ/G2L Display Unit"
depends on ARCH_RZG2L || COMPILE_TEST
depends on DRM && OF
depends on VIDEO_RENESAS_VSP1
select DRM_GEM_DMA_HELPER
select DRM_KMS_HELPER
select VIDEOMODE_HELPERS
help
Choose this option if you have an RZ/G2L alike chipset.
If M is selected the module will be called rzg2l-du-drm.
# SPDX-License-Identifier: GPL-2.0
rzg2l-du-drm-y := rzg2l_du_crtc.o \
rzg2l_du_drv.o \
rzg2l_du_encoder.o \
rzg2l_du_kms.o \
rzg2l-du-drm-$(CONFIG_VIDEO_RENESAS_VSP1) += rzg2l_du_vsp.o
obj-$(CONFIG_DRM_RZG2L_DU) += rzg2l-du-drm.o
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* RZ/G2L Display Unit CRTCs
*
* Copyright (C) 2023 Renesas Electronics Corporation
*
* Based on rcar_du_crtc.h
*/
#ifndef __RZG2L_DU_CRTC_H__
#define __RZG2L_DU_CRTC_H__
#include <linux/container_of.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <drm/drm_crtc.h>
#include <drm/drm_writeback.h>
#include <media/vsp1.h>
struct clk;
struct reset_control;
struct rzg2l_du_vsp;
struct rzg2l_du_format_info;
/**
* struct rzg2l_du_crtc - the CRTC, representing a DU superposition processor
* @crtc: base DRM CRTC
* @dev: the DU device
* @initialized: whether the CRTC has been initialized and clocks enabled
* @vblank_enable: whether vblank events are enabled on this CRTC
* @event: event to post when the pending page flip completes
* @flip_wait: wait queue used to signal page flip completion
* @vsp: VSP feeding video to this CRTC
* @vsp_pipe: index of the VSP pipeline feeding video to this CRTC
* @rstc: reset controller
* @rzg2l_clocks: the bus, main and video clock
*/
struct rzg2l_du_crtc {
struct drm_crtc crtc;
struct rzg2l_du_device *dev;
bool initialized;
bool vblank_enable;
struct drm_pending_vblank_event *event;
wait_queue_head_t flip_wait;
struct rzg2l_du_vsp *vsp;
unsigned int vsp_pipe;
const char *const *sources;
unsigned int sources_count;
struct reset_control *rstc;
struct {
struct clk *aclk;
struct clk *pclk;
struct clk *dclk;
} rzg2l_clocks;
};
static inline struct rzg2l_du_crtc *to_rzg2l_crtc(struct drm_crtc *c)
{
return container_of(c, struct rzg2l_du_crtc, crtc);
}
/**
* struct rzg2l_du_crtc_state - Driver-specific CRTC state
* @state: base DRM CRTC state
* @outputs: bitmask of the outputs (enum rzg2l_du_output) driven by this CRTC
*/
struct rzg2l_du_crtc_state {
struct drm_crtc_state state;
unsigned int outputs;
};
static inline struct rzg2l_du_crtc_state *to_rzg2l_crtc_state(struct drm_crtc_state *s)
{
return container_of(s, struct rzg2l_du_crtc_state, state);
}
int rzg2l_du_crtc_create(struct rzg2l_du_device *rcdu);
void rzg2l_du_crtc_finish_page_flip(struct rzg2l_du_crtc *rcrtc);
#endif /* __RZG2L_DU_CRTC_H__ */
// SPDX-License-Identifier: GPL-2.0+
/*
* RZ/G2L Display Unit DRM driver
*
* Copyright (C) 2023 Renesas Electronics Corporation
*
* Based on rcar_du_drv.c
*/
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_fbdev_generic.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_probe_helper.h>
#include "rzg2l_du_drv.h"
#include "rzg2l_du_kms.h"
/* -----------------------------------------------------------------------------
* Device Information
*/
static const struct rzg2l_du_device_info rzg2l_du_r9a07g044_info = {
.channels_mask = BIT(0),
.routes = {
[RZG2L_DU_OUTPUT_DSI0] = {
.possible_outputs = BIT(0),
.port = 0,
},
[RZG2L_DU_OUTPUT_DPAD0] = {
.possible_outputs = BIT(0),
.port = 1,
}
}
};
static const struct of_device_id rzg2l_du_of_table[] = {
{ .compatible = "renesas,r9a07g044-du", .data = &rzg2l_du_r9a07g044_info },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, rzg2l_du_of_table);
const char *rzg2l_du_output_name(enum rzg2l_du_output output)
{
static const char * const names[] = {
[RZG2L_DU_OUTPUT_DSI0] = "DSI0",
[RZG2L_DU_OUTPUT_DPAD0] = "DPAD0"
};
if (output >= ARRAY_SIZE(names))
return "UNKNOWN";
return names[output];
}
/* -----------------------------------------------------------------------------
* DRM operations
*/
DEFINE_DRM_GEM_DMA_FOPS(rzg2l_du_fops);
static const struct drm_driver rzg2l_du_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.dumb_create = rzg2l_du_dumb_create,
.fops = &rzg2l_du_fops,
.name = "rzg2l-du",
.desc = "Renesas RZ/G2L Display Unit",
.date = "20230410",
.major = 1,
.minor = 0,
};
/* -----------------------------------------------------------------------------
* Platform driver
*/
static void rzg2l_du_remove(struct platform_device *pdev)
{
struct rzg2l_du_device *rcdu = platform_get_drvdata(pdev);
struct drm_device *ddev = &rcdu->ddev;
drm_dev_unregister(ddev);
drm_atomic_helper_shutdown(ddev);
drm_kms_helper_poll_fini(ddev);
}
static void rzg2l_du_shutdown(struct platform_device *pdev)
{
struct rzg2l_du_device *rcdu = platform_get_drvdata(pdev);
drm_atomic_helper_shutdown(&rcdu->ddev);
}
static int rzg2l_du_probe(struct platform_device *pdev)
{
struct rzg2l_du_device *rcdu;
int ret;
if (drm_firmware_drivers_only())
return -ENODEV;
/* Allocate and initialize the RZ/G2L device structure. */
rcdu = devm_drm_dev_alloc(&pdev->dev, &rzg2l_du_driver,
struct rzg2l_du_device, ddev);
if (IS_ERR(rcdu))
return PTR_ERR(rcdu);
rcdu->dev = &pdev->dev;
rcdu->info = of_device_get_match_data(rcdu->dev);
platform_set_drvdata(pdev, rcdu);
/* I/O resources */
rcdu->mmio = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rcdu->mmio))
return PTR_ERR(rcdu->mmio);
ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret)
return ret;
/* DRM/KMS objects */
ret = rzg2l_du_modeset_init(rcdu);
if (ret < 0) {
/*
* Don't use dev_err_probe(), as it would overwrite the probe
* deferral reason recorded in rzg2l_du_modeset_init().
*/
if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev,
"failed to initialize DRM/KMS (%d)\n", ret);
goto error;
}
/*
* Register the DRM device with the core and the connectors with
* sysfs.
*/
ret = drm_dev_register(&rcdu->ddev, 0);
if (ret)
goto error;
drm_info(&rcdu->ddev, "Device %s probed\n", dev_name(&pdev->dev));
drm_fbdev_generic_setup(&rcdu->ddev, 32);
return 0;
error:
drm_kms_helper_poll_fini(&rcdu->ddev);
return ret;
}
static struct platform_driver rzg2l_du_platform_driver = {
.probe = rzg2l_du_probe,
.remove_new = rzg2l_du_remove,
.shutdown = rzg2l_du_shutdown,
.driver = {
.name = "rzg2l-du",
.of_match_table = rzg2l_du_of_table,
},
};
module_platform_driver(rzg2l_du_platform_driver);
MODULE_AUTHOR("Biju Das <biju.das.jz@bp.renesas.com>");
MODULE_DESCRIPTION("Renesas RZ/G2L Display Unit DRM Driver");
MODULE_LICENSE("GPL");
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* RZ/G2L Display Unit DRM driver
*
* Copyright (C) 2023 Renesas Electronics Corporation
*
* Based on rcar_du_drv.h
*/
#ifndef __RZG2L_DU_DRV_H__
#define __RZG2L_DU_DRV_H__
#include <linux/kernel.h>
#include <drm/drm_device.h>
#include "rzg2l_du_crtc.h"
#include "rzg2l_du_vsp.h"
struct device;
struct drm_property;
enum rzg2l_du_output {
RZG2L_DU_OUTPUT_DSI0,
RZG2L_DU_OUTPUT_DPAD0,
RZG2L_DU_OUTPUT_MAX,
};
/*
* struct rzg2l_du_output_routing - Output routing specification
* @possible_outputs: bitmask of possible outputs
* @port: device tree port number corresponding to this output route
*
* The DU has 2 possible outputs (DPAD0, DSI0). Output routing data
* specify the valid SoC outputs, which CRTC can drive the output, and the type
* of in-SoC encoder for the output.
*/
struct rzg2l_du_output_routing {
unsigned int possible_outputs;
unsigned int port;
};
/*
* struct rzg2l_du_device_info - DU model-specific information
* @channels_mask: bit mask of available DU channels
* @routes: array of CRTC to output routes, indexed by output (RZG2L_DU_OUTPUT_*)
*/
struct rzg2l_du_device_info {
unsigned int channels_mask;
struct rzg2l_du_output_routing routes[RZG2L_DU_OUTPUT_MAX];
};
#define RZG2L_DU_MAX_CRTCS 1
#define RZG2L_DU_MAX_VSPS 1
#define RZG2L_DU_MAX_DSI 1
struct rzg2l_du_device {
struct device *dev;
const struct rzg2l_du_device_info *info;
void __iomem *mmio;
struct drm_device ddev;
struct rzg2l_du_crtc crtcs[RZG2L_DU_MAX_CRTCS];
unsigned int num_crtcs;
struct rzg2l_du_vsp vsps[RZG2L_DU_MAX_VSPS];
};
static inline struct rzg2l_du_device *to_rzg2l_du_device(struct drm_device *dev)
{
return container_of(dev, struct rzg2l_du_device, ddev);
}
const char *rzg2l_du_output_name(enum rzg2l_du_output output);
#endif /* __RZG2L_DU_DRV_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -113,7 +113,7 @@ static void bo_meminfo(struct xe_bo *bo, ...@@ -113,7 +113,7 @@ static void bo_meminfo(struct xe_bo *bo,
else else
mem_type = XE_PL_TT; mem_type = XE_PL_TT;
if (bo->ttm.base.handle_count > 1) if (drm_gem_object_is_shared_for_memory_stats(&bo->ttm.base))
stats[mem_type].shared += sz; stats[mem_type].shared += sz;
else else
stats[mem_type].private += sz; stats[mem_type].private += sz;
......
...@@ -625,8 +625,7 @@ void host1x_cdma_push_wide(struct host1x_cdma *cdma, u32 op1, u32 op2, ...@@ -625,8 +625,7 @@ void host1x_cdma_push_wide(struct host1x_cdma *cdma, u32 op1, u32 op2,
struct host1x_channel *channel = cdma_to_channel(cdma); struct host1x_channel *channel = cdma_to_channel(cdma);
struct host1x *host1x = cdma_to_host1x(cdma); struct host1x *host1x = cdma_to_host1x(cdma);
struct push_buffer *pb = &cdma->push_buffer; struct push_buffer *pb = &cdma->push_buffer;
unsigned int space = cdma->slots_free; unsigned int space, needed = 2, extra = 0;
unsigned int needed = 2, extra = 0;
if (host1x_debug_trace_cmdbuf) if (host1x_debug_trace_cmdbuf)
trace_host1x_cdma_push_wide(dev_name(channel->dev), op1, op2, trace_host1x_cdma_push_wide(dev_name(channel->dev), op1, op2,
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment