drm-misc-next for $kernel-version:
UAPI Changes: Cross-subsystem Changes: Core Changes: * Cleanup unneeded include statements wrt <linux/fb.h>, <drm/drm_fb_helper.h> and <drm/drm_crtc_helper.h> * Remove unused helper DRM_DEBUG_KMS_RATELIMITED() * fbdev: Remove obsolete aperture field from struct fb_device, plus driver cleanups; Remove unused flag FBINFO_MISC_FIRMWARE * MIPI-DSI: Fix brightness, plus rsp. driver updates * scheduler: Deprecate drm_sched_resubmit_jobs() * ttm: Fix MIPS build; Remove ttm_bo_wait(); Documentation fixes Driver Changes: * Remove obsolete drivers for userspace modesetting i810, mga, r128, savage, sis, tdfx, via * bridge: Support CDNS DSI J721E, plus DT bindings; lt9611: Various fixes and improvements; sil902x: Various fixes; Fixes * nouveau: Removed support for legacy ioctls; Replace zero-size array; Cleanups * panel: Fixes * radeon: Use new DRM logging helpers -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmPJAq4ACgkQaA3BHVML eiNEIgf+I0R9KmX890K4usKG9LfPH/nIv+4Am6x4/4lv0PzN2vYGhoyPJG8cyNvs KFms+lTUJBBgHeTG8S8NU1qKWUlA78eYQz8S4dbaocchsAiPTHq4f5J45zbQWMGI P56iNAflaO2ETtb3CsH0P0TPsW2TpZC3dvZUYpAEQDli66Bn2BCPCYspt4scOhZX S9usD28sB6L9AnALcCUMLqF4DUsW4FC8Zz46hKVUFlQpN5dcC1b0x0gyclyWy0wh yi1fkqzBB3N44JOIFFwan/KxQttgvrc9Shllkqss525AhE+v3afkK2i9ZXgdckuU kLC09pn6yuxubYgS0vJEU1bsqiMs+Q== =WjQb -----END PGP SIGNATURE----- Merge tag 'drm-misc-next-2023-01-19' of git://anongit.freedesktop.org/drm/drm-misc into drm-next drm-misc-next for $kernel-version: UAPI Changes: Cross-subsystem Changes: Core Changes: * Cleanup unneeded include statements wrt <linux/fb.h>, <drm/drm_fb_helper.h> and <drm/drm_crtc_helper.h> * Remove unused helper DRM_DEBUG_KMS_RATELIMITED() * fbdev: Remove obsolete aperture field from struct fb_device, plus driver cleanups; Remove unused flag FBINFO_MISC_FIRMWARE * MIPI-DSI: Fix brightness, plus rsp. driver updates * scheduler: Deprecate drm_sched_resubmit_jobs() * ttm: Fix MIPS build; Remove ttm_bo_wait(); Documentation fixes Driver Changes: * Remove obsolete drivers for userspace modesetting i810, mga, r128, savage, sis, tdfx, via * bridge: Support CDNS DSI J721E, plus DT bindings; lt9611: Various fixes and improvements; sil902x: Various fixes; Fixes * nouveau: Removed support for legacy ioctls; Replace zero-size array; Cleanups * panel: Fixes * radeon: Use new DRM logging helpers Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/Y8kDk5YX7Yz3eRhM@linux-uq9g
This commit is contained in:
commit
b8f55f24bc
|
@ -1,112 +0,0 @@
|
|||
Cadence DSI bridge
|
||||
==================
|
||||
|
||||
The Cadence DSI bridge is a DPI to DSI bridge supporting up to 4 DSI lanes.
|
||||
|
||||
Required properties:
|
||||
- compatible: should be set to "cdns,dsi".
|
||||
- reg: physical base address and length of the controller's registers.
|
||||
- interrupts: interrupt line connected to the DSI bridge.
|
||||
- clocks: DSI bridge clocks.
|
||||
- clock-names: must contain "dsi_p_clk" and "dsi_sys_clk".
|
||||
- phys: phandle link to the MIPI D-PHY controller.
|
||||
- phy-names: must contain "dphy".
|
||||
- #address-cells: must be set to 1.
|
||||
- #size-cells: must be set to 0.
|
||||
|
||||
Optional properties:
|
||||
- resets: DSI reset lines.
|
||||
- reset-names: can contain "dsi_p_rst".
|
||||
|
||||
Required subnodes:
|
||||
- ports: Ports as described in Documentation/devicetree/bindings/graph.txt.
|
||||
2 ports are available:
|
||||
* port 0: this port is only needed if some of your DSI devices are
|
||||
controlled through an external bus like I2C or SPI. Can have at
|
||||
most 4 endpoints. The endpoint number is directly encoding the
|
||||
DSI virtual channel used by this device.
|
||||
* port 1: represents the DPI input.
|
||||
Other ports will be added later to support the new kind of inputs.
|
||||
|
||||
- one subnode per DSI device connected on the DSI bus. Each DSI device should
|
||||
contain a reg property encoding its virtual channel.
|
||||
|
||||
Example:
|
||||
dsi0: dsi@fd0c0000 {
|
||||
compatible = "cdns,dsi";
|
||||
reg = <0x0 0xfd0c0000 0x0 0x1000>;
|
||||
clocks = <&pclk>, <&sysclk>;
|
||||
clock-names = "dsi_p_clk", "dsi_sys_clk";
|
||||
interrupts = <1>;
|
||||
phys = <&dphy0>;
|
||||
phy-names = "dphy";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
dsi0_dpi_input: endpoint {
|
||||
remote-endpoint = <&xxx_dpi_output>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
panel: dsi-dev@0 {
|
||||
compatible = "<vendor,panel>";
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
or
|
||||
|
||||
dsi0: dsi@fd0c0000 {
|
||||
compatible = "cdns,dsi";
|
||||
reg = <0x0 0xfd0c0000 0x0 0x1000>;
|
||||
clocks = <&pclk>, <&sysclk>;
|
||||
clock-names = "dsi_p_clk", "dsi_sys_clk";
|
||||
interrupts = <1>;
|
||||
phys = <&dphy1>;
|
||||
phy-names = "dphy";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
dsi0_output: endpoint@0 {
|
||||
reg = <0>;
|
||||
remote-endpoint = <&dsi_panel_input>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
dsi0_dpi_input: endpoint {
|
||||
remote-endpoint = <&xxx_dpi_output>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
i2c@xxx {
|
||||
panel: panel@59 {
|
||||
compatible = "<vendor,panel>";
|
||||
reg = <0x59>;
|
||||
|
||||
port {
|
||||
dsi_panel_input: endpoint {
|
||||
remote-endpoint = <&dsi0_output>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
|
@ -0,0 +1,180 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/display/bridge/cdns,dsi.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Cadence DSI bridge
|
||||
|
||||
maintainers:
|
||||
- Boris Brezillon <boris.brezillon@bootlin.com>
|
||||
|
||||
description: |
|
||||
CDNS DSI is a bridge device which converts DPI to DSI
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- cdns,dsi
|
||||
- ti,j721e-dsi
|
||||
|
||||
reg:
|
||||
minItems: 1
|
||||
items:
|
||||
- description:
|
||||
Register block for controller's registers.
|
||||
- description:
|
||||
Register block for wrapper settings registers in case of TI J7 SoCs.
|
||||
|
||||
clocks:
|
||||
items:
|
||||
- description: PSM clock, used by the IP
|
||||
- description: sys clock, used by the IP
|
||||
|
||||
clock-names:
|
||||
items:
|
||||
- const: dsi_p_clk
|
||||
- const: dsi_sys_clk
|
||||
|
||||
phys:
|
||||
maxItems: 1
|
||||
|
||||
phy-names:
|
||||
const: dphy
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
resets:
|
||||
maxItems: 1
|
||||
|
||||
reset-names:
|
||||
const: dsi_p_rst
|
||||
|
||||
ports:
|
||||
$ref: /schemas/graph.yaml#/properties/ports
|
||||
|
||||
properties:
|
||||
port@0:
|
||||
$ref: /schemas/graph.yaml#/properties/port
|
||||
description:
|
||||
Output port representing the DSI output. It can have
|
||||
at most 4 endpoints. The endpoint number is directly encoding
|
||||
the DSI virtual channel used by this device.
|
||||
|
||||
port@1:
|
||||
$ref: /schemas/graph.yaml#/properties/port
|
||||
description:
|
||||
Input port representing the DPI input.
|
||||
|
||||
required:
|
||||
- port@1
|
||||
|
||||
allOf:
|
||||
- $ref: ../dsi-controller.yaml#
|
||||
|
||||
- if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
const: ti,j721e-dsi
|
||||
then:
|
||||
properties:
|
||||
reg:
|
||||
minItems: 2
|
||||
maxItems: 2
|
||||
power-domains:
|
||||
maxItems: 1
|
||||
else:
|
||||
properties:
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
- clocks
|
||||
- clock-names
|
||||
- phys
|
||||
- phy-names
|
||||
- ports
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
bus {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
dsi@fd0c0000 {
|
||||
compatible = "cdns,dsi";
|
||||
reg = <0x0 0xfd0c0000 0x0 0x1000>;
|
||||
clocks = <&pclk>, <&sysclk>;
|
||||
clock-names = "dsi_p_clk", "dsi_sys_clk";
|
||||
interrupts = <1>;
|
||||
phys = <&dphy0>;
|
||||
phy-names = "dphy";
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
endpoint {
|
||||
remote-endpoint = <&xxx_dpi_output>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
panel@0 {
|
||||
compatible = "panasonic,vvx10f034n00";
|
||||
reg = <0>;
|
||||
power-supply = <&vcc_lcd_reg>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
- |
|
||||
bus {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
dsi@fd0c0000 {
|
||||
compatible = "cdns,dsi";
|
||||
reg = <0x0 0xfd0c0000 0x0 0x1000>;
|
||||
clocks = <&pclk>, <&sysclk>;
|
||||
clock-names = "dsi_p_clk", "dsi_sys_clk";
|
||||
interrupts = <1>;
|
||||
phys = <&dphy1>;
|
||||
phy-names = "dphy";
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
endpoint@0 {
|
||||
reg = <0>;
|
||||
remote-endpoint = <&dsi_panel_input>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
endpoint {
|
||||
remote-endpoint = <&xxx_dpi_output>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
|
@ -22,6 +22,7 @@ properties:
|
|||
items:
|
||||
- enum:
|
||||
- renesas,r9a07g044-mipi-dsi # RZ/G2{L,LC}
|
||||
- renesas,r9a07g054-mipi-dsi # RZ/V2L
|
||||
- const: renesas,rzg2l-mipi-dsi
|
||||
|
||||
reg:
|
||||
|
|
29
MAINTAINERS
29
MAINTAINERS
|
@ -6579,11 +6579,6 @@ T: git git://anongit.freedesktop.org/drm/drm-misc
|
|||
F: Documentation/devicetree/bindings/display/ilitek,ili9486.yaml
|
||||
F: drivers/gpu/drm/tiny/ili9486.c
|
||||
|
||||
DRM DRIVER FOR INTEL I810 VIDEO CARDS
|
||||
S: Orphan / Obsolete
|
||||
F: drivers/gpu/drm/i810/
|
||||
F: include/uapi/drm/i810_drm.h
|
||||
|
||||
DRM DRIVER FOR JADARD JD9365DA-H3 MIPI-DSI LCD PANELS
|
||||
M: Jagan Teki <jagan@edgeble.ai>
|
||||
S: Maintained
|
||||
|
@ -6612,11 +6607,6 @@ S: Maintained
|
|||
F: Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml
|
||||
F: drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
|
||||
|
||||
DRM DRIVER FOR MATROX G200/G400 GRAPHICS CARDS
|
||||
S: Orphan / Obsolete
|
||||
F: drivers/gpu/drm/mga/
|
||||
F: include/uapi/drm/mga_drm.h
|
||||
|
||||
DRM DRIVER FOR MGA G200 GRAPHICS CHIPS
|
||||
M: Dave Airlie <airlied@redhat.com>
|
||||
R: Thomas Zimmermann <tzimmermann@suse.de>
|
||||
|
@ -6735,11 +6725,6 @@ T: git git://anongit.freedesktop.org/drm/drm-misc
|
|||
F: drivers/gpu/drm/qxl/
|
||||
F: include/uapi/drm/qxl_drm.h
|
||||
|
||||
DRM DRIVER FOR RAGE 128 VIDEO CARDS
|
||||
S: Orphan / Obsolete
|
||||
F: drivers/gpu/drm/r128/
|
||||
F: include/uapi/drm/r128_drm.h
|
||||
|
||||
DRM DRIVER FOR RAYDIUM RM67191 PANELS
|
||||
M: Robert Chiras <robert.chiras@nxp.com>
|
||||
S: Maintained
|
||||
|
@ -6767,11 +6752,6 @@ S: Maintained
|
|||
F: Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
|
||||
F: drivers/gpu/drm/panel/panel-sitronix-st7703.c
|
||||
|
||||
DRM DRIVER FOR SAVAGE VIDEO CARDS
|
||||
S: Orphan / Obsolete
|
||||
F: drivers/gpu/drm/savage/
|
||||
F: include/uapi/drm/savage_drm.h
|
||||
|
||||
DRM DRIVER FOR FIRMWARE FRAMEBUFFERS
|
||||
M: Thomas Zimmermann <tzimmermann@suse.de>
|
||||
M: Javier Martinez Canillas <javierm@redhat.com>
|
||||
|
@ -6787,11 +6767,6 @@ F: include/drm/drm_aperture.h
|
|||
F: include/linux/aperture.h
|
||||
F: include/video/nomodeset.h
|
||||
|
||||
DRM DRIVER FOR SIS VIDEO CARDS
|
||||
S: Orphan / Obsolete
|
||||
F: drivers/gpu/drm/sis/
|
||||
F: include/uapi/drm/sis_drm.h
|
||||
|
||||
DRM DRIVER FOR SITRONIX ST7586 PANELS
|
||||
M: David Lechner <david@lechnology.com>
|
||||
S: Maintained
|
||||
|
@ -6819,10 +6794,6 @@ T: git git://anongit.freedesktop.org/drm/drm-misc
|
|||
F: Documentation/devicetree/bindings/display/ste,mcde.yaml
|
||||
F: drivers/gpu/drm/mcde/
|
||||
|
||||
DRM DRIVER FOR TDFX VIDEO CARDS
|
||||
S: Orphan / Obsolete
|
||||
F: drivers/gpu/drm/tdfx/
|
||||
|
||||
DRM DRIVER FOR TI DLPC3433 MIPI DSI TO DMD BRIDGE
|
||||
M: Jagan Teki <jagan@amarulasolutions.com>
|
||||
S: Maintained
|
||||
|
|
|
@ -397,64 +397,7 @@ menuconfig DRM_LEGACY
|
|||
Unless you have strong reasons to go rogue, say "N".
|
||||
|
||||
if DRM_LEGACY
|
||||
|
||||
config DRM_TDFX
|
||||
tristate "3dfx Banshee/Voodoo3+"
|
||||
depends on DRM && PCI
|
||||
help
|
||||
Choose this option if you have a 3dfx Banshee or Voodoo3 (or later),
|
||||
graphics card. If M is selected, the module will be called tdfx.
|
||||
|
||||
config DRM_R128
|
||||
tristate "ATI Rage 128"
|
||||
depends on DRM && PCI
|
||||
select FW_LOADER
|
||||
help
|
||||
Choose this option if you have an ATI Rage 128 graphics card. If M
|
||||
is selected, the module will be called r128. AGP support for
|
||||
this card is strongly suggested (unless you have a PCI version).
|
||||
|
||||
config DRM_I810
|
||||
tristate "Intel I810"
|
||||
# !PREEMPTION because of missing ioctl locking
|
||||
depends on DRM && AGP && AGP_INTEL && (!PREEMPTION || BROKEN)
|
||||
help
|
||||
Choose this option if you have an Intel I810 graphics card. If M is
|
||||
selected, the module will be called i810. AGP support is required
|
||||
for this driver to work.
|
||||
|
||||
config DRM_MGA
|
||||
tristate "Matrox g200/g400"
|
||||
depends on DRM && PCI
|
||||
select FW_LOADER
|
||||
help
|
||||
Choose this option if you have a Matrox G200, G400 or G450 graphics
|
||||
card. If M is selected, the module will be called mga. AGP
|
||||
support is required for this driver to work.
|
||||
|
||||
config DRM_SIS
|
||||
tristate "SiS video cards"
|
||||
depends on DRM && AGP
|
||||
depends on FB_SIS || FB_SIS=n
|
||||
help
|
||||
Choose this option if you have a SiS 630 or compatible video
|
||||
chipset. If M is selected the module will be called sis. AGP
|
||||
support is required for this driver to work.
|
||||
|
||||
config DRM_VIA
|
||||
tristate "Via unichrome video cards"
|
||||
depends on DRM && PCI
|
||||
help
|
||||
Choose this option if you have a Via unichrome or compatible video
|
||||
chipset. If M is selected the module will be called via.
|
||||
|
||||
config DRM_SAVAGE
|
||||
tristate "Savage video cards"
|
||||
depends on DRM && PCI
|
||||
help
|
||||
Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
|
||||
chipset. If M is selected the module will be called savage.
|
||||
|
||||
# leave here to list legacy drivers
|
||||
endif # DRM_LEGACY
|
||||
|
||||
config DRM_EXPORT_FOR_TESTS
|
||||
|
|
|
@ -134,21 +134,14 @@ obj-y += arm/
|
|||
obj-y += display/
|
||||
obj-$(CONFIG_DRM_TTM) += ttm/
|
||||
obj-$(CONFIG_DRM_SCHED) += scheduler/
|
||||
obj-$(CONFIG_DRM_TDFX) += tdfx/
|
||||
obj-$(CONFIG_DRM_R128) += r128/
|
||||
obj-$(CONFIG_DRM_RADEON)+= radeon/
|
||||
obj-$(CONFIG_DRM_AMDGPU)+= amd/amdgpu/
|
||||
obj-$(CONFIG_DRM_MGA) += mga/
|
||||
obj-$(CONFIG_DRM_I810) += i810/
|
||||
obj-$(CONFIG_DRM_I915) += i915/
|
||||
obj-$(CONFIG_DRM_KMB_DISPLAY) += kmb/
|
||||
obj-$(CONFIG_DRM_MGAG200) += mgag200/
|
||||
obj-$(CONFIG_DRM_V3D) += v3d/
|
||||
obj-$(CONFIG_DRM_VC4) += vc4/
|
||||
obj-$(CONFIG_DRM_SIS) += sis/
|
||||
obj-$(CONFIG_DRM_SAVAGE)+= savage/
|
||||
obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/
|
||||
obj-$(CONFIG_DRM_VIA) +=via/
|
||||
obj-$(CONFIG_DRM_VGEM) += vgem/
|
||||
obj-$(CONFIG_DRM_VKMS) += vkms/
|
||||
obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/power_supply.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
@ -31,7 +32,6 @@
|
|||
#include <acpi/video.h>
|
||||
#include <acpi/actbl.h>
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_pm.h"
|
||||
#include "amdgpu_display.h"
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
*/
|
||||
|
||||
#include <drm/display/drm_dp_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <drm/amdgpu_drm.h>
|
||||
#include "amdgpu.h"
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include <drm/drm_aperture.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <drm/amdgpu_drm.h>
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_gem_framebuffer_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_modeset_helper.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include <linux/mmu_notifier.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/cc_platform.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/dynamic_debug.h>
|
||||
|
||||
#include "amdgpu.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
* Alex Deucher
|
||||
*/
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/amdgpu_drm.h>
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_connectors.h"
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <linux/irq.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
#include <drm/amdgpu_drm.h>
|
||||
#include <drm/drm_drv.h>
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_encoder.h>
|
||||
#include <drm/drm_fixed.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_framebuffer.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <linux/i2c.h>
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
* Alex Deucher
|
||||
*/
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/amdgpu_drm.h>
|
||||
#include <drm/drm_fixed.h>
|
||||
#include "amdgpu.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#include <acpi/video.h>
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/amdgpu_drm.h>
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_connectors.h"
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_modeset_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
|
||||
#include "amdgpu.h"
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_modeset_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
|
||||
#include "amdgpu.h"
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_modeset_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
|
||||
#include "amdgpu.h"
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_modeset_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
|
||||
#include "amdgpu.h"
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "ivsrcid/ivsrcid_vislands30.h"
|
||||
|
||||
#include "i2caux_interface.h"
|
||||
#include <linux/backlight.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/types.h>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
#include "pp_debug.h"
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include "vega10_processpptables.h"
|
||||
#include "ppatomfwctrl.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include "vega12/smu9_driver_if.h"
|
||||
#include "vega12_processpptables.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
|
||||
#include "smu11_driver_if.h"
|
||||
#include "vega20_processpptables.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fb.h>
|
||||
#include "linux/delay.h"
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include <drm/drm_atomic.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/component.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <drm/drm_atomic.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_blend.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_device.h>
|
||||
#include <drm/drm_writeback.h>
|
||||
#include <drm/drm_print.h>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <linux/reset.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_device.h>
|
||||
#include <drm/drm_fb_dma_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <linux/reset.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_device.h>
|
||||
#include <drm/drm_fbdev_generic.h>
|
||||
#include <drm/drm_gem_dma_helper.h>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_connector.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <drm/drm_aperture.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_fbdev_generic.h>
|
||||
#include <drm/drm_gem_shmem_helper.h>
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <linux/pci.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_gem.h>
|
||||
#include <drm/drm_managed.h>
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_atomic_state_helper.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_damage_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_format_helper.h>
|
||||
|
|
|
@ -15,17 +15,6 @@ config DRM_PANEL_BRIDGE
|
|||
menu "Display Interface Bridges"
|
||||
depends on DRM && DRM_BRIDGE
|
||||
|
||||
config DRM_CDNS_DSI
|
||||
tristate "Cadence DPI/DSI bridge"
|
||||
select DRM_KMS_HELPER
|
||||
select DRM_MIPI_DSI
|
||||
select DRM_PANEL_BRIDGE
|
||||
select GENERIC_PHY_MIPI_DPHY
|
||||
depends on OF
|
||||
help
|
||||
Support Cadence DPI to DSI bridge. This is an internal
|
||||
bridge and is meant to be directly embedded in a SoC.
|
||||
|
||||
config DRM_CHIPONE_ICN6211
|
||||
tristate "Chipone ICN6211 MIPI-DSI/RGB Converter bridge"
|
||||
depends on OF
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
|
||||
obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o
|
||||
obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
|
||||
obj-$(CONFIG_DRM_CROS_EC_ANX7688) += cros-ec-anx7688.o
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_panel.h>
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <drm/display/drm_hdcp_helper.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_mipi_dsi.h>
|
||||
#include <drm/drm_of.h>
|
||||
|
|
|
@ -1,4 +1,25 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
config DRM_CDNS_DSI
|
||||
tristate "Cadence DPI/DSI bridge"
|
||||
select DRM_KMS_HELPER
|
||||
select DRM_MIPI_DSI
|
||||
select DRM_PANEL_BRIDGE
|
||||
select GENERIC_PHY_MIPI_DPHY
|
||||
depends on OF
|
||||
help
|
||||
Support Cadence DPI to DSI bridge. This is an internal
|
||||
bridge and is meant to be directly embedded in a SoC.
|
||||
|
||||
if DRM_CDNS_DSI
|
||||
|
||||
config DRM_CDNS_DSI_J721E
|
||||
bool "J721E Cadence DSI wrapper support"
|
||||
default y
|
||||
help
|
||||
Support J721E Cadence DSI wrapper. The wrapper manages
|
||||
the routing of the DSS DPI signal to the Cadence DSI.
|
||||
endif
|
||||
|
||||
config DRM_CDNS_MHDP8546
|
||||
tristate "Cadence DPI/DP bridge"
|
||||
select DRM_DISPLAY_DP_HELPER
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
|
||||
cdns-dsi-y := cdns-dsi-core.o
|
||||
cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
|
||||
obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
|
||||
cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
|
||||
cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_mipi_dsi.h>
|
||||
#include <drm/drm_panel.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <video/mipi_display.h>
|
||||
|
||||
|
@ -18,14 +15,19 @@
|
|||
#include <linux/iopoll.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_graph.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/reset.h>
|
||||
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/phy/phy-mipi-dphy.h>
|
||||
|
||||
#include "cdns-dsi-core.h"
|
||||
#ifdef CONFIG_DRM_CDNS_DSI_J721E
|
||||
#include "cdns-dsi-j721e.h"
|
||||
#endif
|
||||
|
||||
#define IP_CONF 0x0
|
||||
#define SP_HS_FIFO_DEPTH(x) (((x) & GENMASK(30, 26)) >> 26)
|
||||
#define SP_LP_FIFO_DEPTH(x) (((x) & GENMASK(25, 21)) >> 21)
|
||||
|
@ -424,48 +426,6 @@
|
|||
#define DSI_NULL_FRAME_OVERHEAD 6
|
||||
#define DSI_EOT_PKT_SIZE 4
|
||||
|
||||
struct cdns_dsi_output {
|
||||
struct mipi_dsi_device *dev;
|
||||
struct drm_panel *panel;
|
||||
struct drm_bridge *bridge;
|
||||
union phy_configure_opts phy_opts;
|
||||
};
|
||||
|
||||
enum cdns_dsi_input_id {
|
||||
CDNS_SDI_INPUT,
|
||||
CDNS_DPI_INPUT,
|
||||
CDNS_DSC_INPUT,
|
||||
};
|
||||
|
||||
struct cdns_dsi_cfg {
|
||||
unsigned int hfp;
|
||||
unsigned int hsa;
|
||||
unsigned int hbp;
|
||||
unsigned int hact;
|
||||
unsigned int htotal;
|
||||
};
|
||||
|
||||
struct cdns_dsi_input {
|
||||
enum cdns_dsi_input_id id;
|
||||
struct drm_bridge bridge;
|
||||
};
|
||||
|
||||
struct cdns_dsi {
|
||||
struct mipi_dsi_host base;
|
||||
void __iomem *regs;
|
||||
struct cdns_dsi_input input;
|
||||
struct cdns_dsi_output output;
|
||||
unsigned int direct_cmd_fifo_depth;
|
||||
unsigned int rx_fifo_depth;
|
||||
struct completion direct_cmd_comp;
|
||||
struct clk *dsi_p_clk;
|
||||
struct reset_control *dsi_p_rst;
|
||||
struct clk *dsi_sys_clk;
|
||||
bool link_initialized;
|
||||
bool phy_initialized;
|
||||
struct phy *dphy;
|
||||
};
|
||||
|
||||
static inline struct cdns_dsi *input_to_dsi(struct cdns_dsi_input *input)
|
||||
{
|
||||
return container_of(input, struct cdns_dsi, input);
|
||||
|
@ -709,6 +669,10 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge)
|
|||
|
||||
val = readl(dsi->regs + MCTL_MAIN_EN) & ~IF_EN(input->id);
|
||||
writel(val, dsi->regs + MCTL_MAIN_EN);
|
||||
|
||||
if (dsi->platform_ops && dsi->platform_ops->disable)
|
||||
dsi->platform_ops->disable(dsi);
|
||||
|
||||
pm_runtime_put(dsi->base.dev);
|
||||
}
|
||||
|
||||
|
@ -804,6 +768,9 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
|
|||
if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
|
||||
return;
|
||||
|
||||
if (dsi->platform_ops && dsi->platform_ops->enable)
|
||||
dsi->platform_ops->enable(dsi);
|
||||
|
||||
mode = &bridge->encoder->crtc->state->adjusted_mode;
|
||||
nlanes = output->dev->lanes;
|
||||
|
||||
|
@ -1244,6 +1211,8 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
|
|||
goto err_disable_pclk;
|
||||
}
|
||||
|
||||
dsi->platform_ops = of_device_get_match_data(&pdev->dev);
|
||||
|
||||
val = readl(dsi->regs + IP_CONF);
|
||||
dsi->direct_cmd_fifo_depth = 1 << (DIRCMD_FIFO_DEPTH(val) + 2);
|
||||
dsi->rx_fifo_depth = RX_FIFO_DEPTH(val);
|
||||
|
@ -1279,14 +1248,27 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
|
|||
dsi->base.dev = &pdev->dev;
|
||||
dsi->base.ops = &cdns_dsi_ops;
|
||||
|
||||
if (dsi->platform_ops && dsi->platform_ops->init) {
|
||||
ret = dsi->platform_ops->init(dsi);
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "platform initialization failed: %d\n",
|
||||
ret);
|
||||
goto err_disable_runtime_pm;
|
||||
}
|
||||
}
|
||||
|
||||
ret = mipi_dsi_host_register(&dsi->base);
|
||||
if (ret)
|
||||
goto err_disable_runtime_pm;
|
||||
goto err_deinit_platform;
|
||||
|
||||
clk_disable_unprepare(dsi->dsi_p_clk);
|
||||
|
||||
return 0;
|
||||
|
||||
err_deinit_platform:
|
||||
if (dsi->platform_ops && dsi->platform_ops->deinit)
|
||||
dsi->platform_ops->deinit(dsi);
|
||||
|
||||
err_disable_runtime_pm:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
|
@ -1301,6 +1283,10 @@ static int cdns_dsi_drm_remove(struct platform_device *pdev)
|
|||
struct cdns_dsi *dsi = platform_get_drvdata(pdev);
|
||||
|
||||
mipi_dsi_host_unregister(&dsi->base);
|
||||
|
||||
if (dsi->platform_ops && dsi->platform_ops->deinit)
|
||||
dsi->platform_ops->deinit(dsi);
|
||||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
@ -1308,6 +1294,9 @@ static int cdns_dsi_drm_remove(struct platform_device *pdev)
|
|||
|
||||
static const struct of_device_id cdns_dsi_of_match[] = {
|
||||
{ .compatible = "cdns,dsi" },
|
||||
#ifdef CONFIG_DRM_CDNS_DSI_J721E
|
||||
{ .compatible = "ti,j721e-dsi", .data = &dsi_ti_j721e_ops, },
|
||||
#endif
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, cdns_dsi_of_match);
|
|
@ -0,0 +1,84 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright: 2017 Cadence Design Systems, Inc.
|
||||
*
|
||||
* Author: Boris Brezillon <boris.brezillon@bootlin.com>
|
||||
*/
|
||||
|
||||
#ifndef __CDNS_DSI_H__
|
||||
#define __CDNS_DSI_H__
|
||||
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_mipi_dsi.h>
|
||||
#include <drm/drm_panel.h>
|
||||
|
||||
#include <linux/bits.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/phy/phy.h>
|
||||
|
||||
struct clk;
|
||||
struct reset_control;
|
||||
|
||||
struct cdns_dsi_output {
|
||||
struct mipi_dsi_device *dev;
|
||||
struct drm_panel *panel;
|
||||
struct drm_bridge *bridge;
|
||||
union phy_configure_opts phy_opts;
|
||||
};
|
||||
|
||||
enum cdns_dsi_input_id {
|
||||
CDNS_SDI_INPUT,
|
||||
CDNS_DPI_INPUT,
|
||||
CDNS_DSC_INPUT,
|
||||
};
|
||||
|
||||
struct cdns_dsi_cfg {
|
||||
unsigned int hfp;
|
||||
unsigned int hsa;
|
||||
unsigned int hbp;
|
||||
unsigned int hact;
|
||||
unsigned int htotal;
|
||||
};
|
||||
|
||||
struct cdns_dsi_input {
|
||||
enum cdns_dsi_input_id id;
|
||||
struct drm_bridge bridge;
|
||||
};
|
||||
|
||||
struct cdns_dsi;
|
||||
|
||||
/**
|
||||
* struct cdns_dsi_platform_ops - CDNS DSI Platform operations
|
||||
* @init: Called in the CDNS DSI probe
|
||||
* @deinit: Called in the CDNS DSI remove
|
||||
* @enable: Called at the beginning of CDNS DSI bridge enable
|
||||
* @disable: Called at the end of CDNS DSI bridge disable
|
||||
*/
|
||||
struct cdns_dsi_platform_ops {
|
||||
int (*init)(struct cdns_dsi *dsi);
|
||||
void (*deinit)(struct cdns_dsi *dsi);
|
||||
void (*enable)(struct cdns_dsi *dsi);
|
||||
void (*disable)(struct cdns_dsi *dsi);
|
||||
};
|
||||
|
||||
struct cdns_dsi {
|
||||
struct mipi_dsi_host base;
|
||||
void __iomem *regs;
|
||||
#ifdef CONFIG_DRM_CDNS_DSI_J721E
|
||||
void __iomem *j721e_regs;
|
||||
#endif
|
||||
const struct cdns_dsi_platform_ops *platform_ops;
|
||||
struct cdns_dsi_input input;
|
||||
struct cdns_dsi_output output;
|
||||
unsigned int direct_cmd_fifo_depth;
|
||||
unsigned int rx_fifo_depth;
|
||||
struct completion direct_cmd_comp;
|
||||
struct clk *dsi_p_clk;
|
||||
struct reset_control *dsi_p_rst;
|
||||
struct clk *dsi_sys_clk;
|
||||
bool link_initialized;
|
||||
bool phy_initialized;
|
||||
struct phy *dphy;
|
||||
};
|
||||
|
||||
#endif /* !__CDNS_DSI_H__ */
|
|
@ -0,0 +1,51 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* TI j721e Cadence DSI wrapper
|
||||
*
|
||||
* Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Author: Rahul T R <r-ravikumar@ti.com>
|
||||
*/
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "cdns-dsi-j721e.h"
|
||||
|
||||
#define DSI_WRAP_REVISION 0x0
|
||||
#define DSI_WRAP_DPI_CONTROL 0x4
|
||||
#define DSI_WRAP_DSC_CONTROL 0x8
|
||||
#define DSI_WRAP_DPI_SECURE 0xc
|
||||
#define DSI_WRAP_DSI_0_ASF_STATUS 0x10
|
||||
|
||||
#define DSI_WRAP_DPI_0_EN BIT(0)
|
||||
#define DSI_WRAP_DSI2_MUX_SEL BIT(4)
|
||||
|
||||
static int cdns_dsi_j721e_init(struct cdns_dsi *dsi)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dsi->base.dev);
|
||||
|
||||
dsi->j721e_regs = devm_platform_ioremap_resource(pdev, 1);
|
||||
return PTR_ERR_OR_ZERO(dsi->j721e_regs);
|
||||
}
|
||||
|
||||
static void cdns_dsi_j721e_enable(struct cdns_dsi *dsi)
|
||||
{
|
||||
/*
|
||||
* Enable DPI0 as its input. DSS0 DPI2 is connected
|
||||
* to DSI DPI0. This is the only supported configuration on
|
||||
* J721E.
|
||||
*/
|
||||
writel(DSI_WRAP_DPI_0_EN, dsi->j721e_regs + DSI_WRAP_DPI_CONTROL);
|
||||
}
|
||||
|
||||
static void cdns_dsi_j721e_disable(struct cdns_dsi *dsi)
|
||||
{
|
||||
/* Put everything to defaults */
|
||||
writel(0, dsi->j721e_regs + DSI_WRAP_DPI_CONTROL);
|
||||
}
|
||||
|
||||
const struct cdns_dsi_platform_ops dsi_ti_j721e_ops = {
|
||||
.init = cdns_dsi_j721e_init,
|
||||
.enable = cdns_dsi_j721e_enable,
|
||||
.disable = cdns_dsi_j721e_disable,
|
||||
};
|
|
@ -0,0 +1,16 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* TI j721e Cadence DSI wrapper
|
||||
*
|
||||
* Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Author: Rahul T R <r-ravikumar@ti.com>
|
||||
*/
|
||||
|
||||
#ifndef __CDNS_DSI_J721E_H__
|
||||
#define __CDNS_DSI_J721E_H__
|
||||
|
||||
#include "cdns-dsi-core.h"
|
||||
|
||||
extern const struct cdns_dsi_platform_ops dsi_ti_j721e_ops;
|
||||
|
||||
#endif /* !__CDNS_DSI_J721E_H__ */
|
|
@ -43,7 +43,6 @@
|
|||
#include <drm/drm_atomic_state_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_connector.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_print.h>
|
||||
|
|
|
@ -66,6 +66,14 @@ static inline struct fsl_ldb *to_fsl_ldb(struct drm_bridge *bridge)
|
|||
return container_of(bridge, struct fsl_ldb, bridge);
|
||||
}
|
||||
|
||||
static unsigned long fsl_ldb_link_frequency(struct fsl_ldb *fsl_ldb, int clock)
|
||||
{
|
||||
if (fsl_ldb->lvds_dual_link)
|
||||
return clock * 3500;
|
||||
else
|
||||
return clock * 7000;
|
||||
}
|
||||
|
||||
static int fsl_ldb_attach(struct drm_bridge *bridge,
|
||||
enum drm_bridge_attach_flags flags)
|
||||
{
|
||||
|
@ -85,6 +93,8 @@ static void fsl_ldb_atomic_enable(struct drm_bridge *bridge,
|
|||
const struct drm_display_mode *mode;
|
||||
struct drm_connector *connector;
|
||||
struct drm_crtc *crtc;
|
||||
unsigned long configured_link_freq;
|
||||
unsigned long requested_link_freq;
|
||||
bool lvds_format_24bpp;
|
||||
bool lvds_format_jeida;
|
||||
u32 reg;
|
||||
|
@ -128,10 +138,15 @@ static void fsl_ldb_atomic_enable(struct drm_bridge *bridge,
|
|||
crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
|
||||
mode = &crtc_state->adjusted_mode;
|
||||
|
||||
if (fsl_ldb->lvds_dual_link)
|
||||
clk_set_rate(fsl_ldb->clk, mode->clock * 3500);
|
||||
else
|
||||
clk_set_rate(fsl_ldb->clk, mode->clock * 7000);
|
||||
requested_link_freq = fsl_ldb_link_frequency(fsl_ldb, mode->clock);
|
||||
clk_set_rate(fsl_ldb->clk, requested_link_freq);
|
||||
|
||||
configured_link_freq = clk_get_rate(fsl_ldb->clk);
|
||||
if (configured_link_freq != requested_link_freq)
|
||||
dev_warn(fsl_ldb->dev, "Configured LDB clock (%lu Hz) does not match requested LVDS clock: %lu Hz",
|
||||
configured_link_freq,
|
||||
requested_link_freq);
|
||||
|
||||
clk_prepare_enable(fsl_ldb->clk);
|
||||
|
||||
/* Program LDB_CTRL */
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_modes.h>
|
||||
#include <drm/drm_print.h>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_mipi_dsi.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
|
||||
|
@ -33,7 +34,7 @@
|
|||
struct lt9611 {
|
||||
struct device *dev;
|
||||
struct drm_bridge bridge;
|
||||
struct drm_connector connector;
|
||||
struct drm_bridge *next_bridge;
|
||||
|
||||
struct regmap *regmap;
|
||||
|
||||
|
@ -58,7 +59,6 @@ struct lt9611 {
|
|||
enum drm_connector_status status;
|
||||
|
||||
u8 edid_buf[EDID_SEG_SIZE];
|
||||
u32 vic;
|
||||
};
|
||||
|
||||
#define LT9611_PAGE_CONTROL 0xff
|
||||
|
@ -84,34 +84,11 @@ static const struct regmap_config lt9611_regmap_config = {
|
|||
.num_ranges = ARRAY_SIZE(lt9611_ranges),
|
||||
};
|
||||
|
||||
struct lt9611_mode {
|
||||
u16 hdisplay;
|
||||
u16 vdisplay;
|
||||
u8 vrefresh;
|
||||
u8 lanes;
|
||||
u8 intfs;
|
||||
};
|
||||
|
||||
static struct lt9611_mode lt9611_modes[] = {
|
||||
{ 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
|
||||
{ 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
|
||||
{ 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
|
||||
{ 1920, 1080, 24, 3, 1 },
|
||||
{ 720, 480, 60, 4, 1 },
|
||||
{ 720, 576, 50, 2, 1 },
|
||||
{ 640, 480, 60, 2, 1 },
|
||||
};
|
||||
|
||||
static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
|
||||
{
|
||||
return container_of(bridge, struct lt9611, bridge);
|
||||
}
|
||||
|
||||
static struct lt9611 *connector_to_lt9611(struct drm_connector *connector)
|
||||
{
|
||||
return container_of(connector, struct lt9611, connector);
|
||||
}
|
||||
|
||||
static int lt9611_mipi_input_analog(struct lt9611 *lt9611)
|
||||
{
|
||||
const struct reg_sequence reg_cfg[] = {
|
||||
|
@ -141,7 +118,7 @@ static int lt9611_mipi_input_digital(struct lt9611 *lt9611,
|
|||
{ 0x8306, 0x0a },
|
||||
};
|
||||
|
||||
if (mode->hdisplay == 3840)
|
||||
if (lt9611->dsi1_node)
|
||||
reg_cfg[1].def = 0x03;
|
||||
|
||||
return regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
|
||||
|
@ -159,12 +136,12 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
|
|||
hactive = mode->hdisplay;
|
||||
hsync_len = mode->hsync_end - mode->hsync_start;
|
||||
hfront_porch = mode->hsync_start - mode->hdisplay;
|
||||
hsync_porch = hsync_len + mode->htotal - mode->hsync_end;
|
||||
hsync_porch = mode->htotal - mode->hsync_start;
|
||||
|
||||
vactive = mode->vdisplay;
|
||||
vsync_len = mode->vsync_end - mode->vsync_start;
|
||||
vfront_porch = mode->vsync_start - mode->vdisplay;
|
||||
vsync_porch = vsync_len + mode->vtotal - mode->vsync_end;
|
||||
vsync_porch = mode->vtotal - mode->vsync_start;
|
||||
|
||||
regmap_write(lt9611->regmap, 0x830d, (u8)(v_total / 256));
|
||||
regmap_write(lt9611->regmap, 0x830e, (u8)(v_total % 256));
|
||||
|
@ -187,12 +164,14 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
|
|||
|
||||
regmap_write(lt9611->regmap, 0x8319, (u8)(hfront_porch % 256));
|
||||
|
||||
regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256));
|
||||
regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256) |
|
||||
((hfront_porch / 256) << 4));
|
||||
regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
|
||||
}
|
||||
|
||||
static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
|
||||
static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int postdiv)
|
||||
{
|
||||
unsigned int pcr_m = mode->clock * 5 * postdiv / 27000;
|
||||
const struct reg_sequence reg_cfg[] = {
|
||||
{ 0x830b, 0x01 },
|
||||
{ 0x830c, 0x10 },
|
||||
|
@ -207,45 +186,40 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
|
|||
|
||||
/* stage 2 */
|
||||
{ 0x834a, 0x40 },
|
||||
{ 0x831d, 0x10 },
|
||||
|
||||
/* MK limit */
|
||||
{ 0x832d, 0x38 },
|
||||
{ 0x8331, 0x08 },
|
||||
};
|
||||
const struct reg_sequence reg_cfg2[] = {
|
||||
{ 0x830b, 0x03 },
|
||||
{ 0x830c, 0xd0 },
|
||||
{ 0x8348, 0x03 },
|
||||
{ 0x8349, 0xe0 },
|
||||
{ 0x8324, 0x72 },
|
||||
{ 0x8325, 0x00 },
|
||||
{ 0x832a, 0x01 },
|
||||
{ 0x834a, 0x10 },
|
||||
{ 0x831d, 0x10 },
|
||||
{ 0x8326, 0x37 },
|
||||
};
|
||||
u8 pol = 0x10;
|
||||
|
||||
if (mode->flags & DRM_MODE_FLAG_NHSYNC)
|
||||
pol |= 0x2;
|
||||
if (mode->flags & DRM_MODE_FLAG_NVSYNC)
|
||||
pol |= 0x1;
|
||||
regmap_write(lt9611->regmap, 0x831d, pol);
|
||||
|
||||
regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
|
||||
if (lt9611->dsi1_node) {
|
||||
unsigned int hact = mode->hdisplay;
|
||||
|
||||
switch (mode->hdisplay) {
|
||||
case 640:
|
||||
regmap_write(lt9611->regmap, 0x8326, 0x14);
|
||||
break;
|
||||
case 1920:
|
||||
regmap_write(lt9611->regmap, 0x8326, 0x37);
|
||||
break;
|
||||
case 3840:
|
||||
regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
|
||||
break;
|
||||
hact >>= 2;
|
||||
hact += 0x50;
|
||||
hact = min(hact, 0x3e0U);
|
||||
regmap_write(lt9611->regmap, 0x830b, hact / 256);
|
||||
regmap_write(lt9611->regmap, 0x830c, hact % 256);
|
||||
regmap_write(lt9611->regmap, 0x8348, hact / 256);
|
||||
regmap_write(lt9611->regmap, 0x8349, hact % 256);
|
||||
}
|
||||
|
||||
regmap_write(lt9611->regmap, 0x8326, pcr_m);
|
||||
|
||||
/* pcr rst */
|
||||
regmap_write(lt9611->regmap, 0x8011, 0x5a);
|
||||
regmap_write(lt9611->regmap, 0x8011, 0xfa);
|
||||
}
|
||||
|
||||
static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
|
||||
static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int *postdiv)
|
||||
{
|
||||
unsigned int pclk = mode->clock;
|
||||
const struct reg_sequence reg_cfg[] = {
|
||||
|
@ -264,12 +238,16 @@ static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode
|
|||
|
||||
regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
|
||||
|
||||
if (pclk > 150000)
|
||||
if (pclk > 150000) {
|
||||
regmap_write(lt9611->regmap, 0x812d, 0x88);
|
||||
else if (pclk > 70000)
|
||||
*postdiv = 1;
|
||||
} else if (pclk > 70000) {
|
||||
regmap_write(lt9611->regmap, 0x812d, 0x99);
|
||||
else
|
||||
*postdiv = 2;
|
||||
} else {
|
||||
regmap_write(lt9611->regmap, 0x812d, 0xaa);
|
||||
*postdiv = 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* first divide pclk by 2 first
|
||||
|
@ -354,13 +332,55 @@ end:
|
|||
return temp;
|
||||
}
|
||||
|
||||
static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611)
|
||||
static void lt9611_hdmi_set_infoframes(struct lt9611 *lt9611,
|
||||
struct drm_connector *connector,
|
||||
struct drm_display_mode *mode)
|
||||
{
|
||||
regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
|
||||
regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
|
||||
regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
|
||||
union hdmi_infoframe infoframe;
|
||||
ssize_t len;
|
||||
u8 iframes = 0x0a; /* UD1 infoframe */
|
||||
u8 buf[32];
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
regmap_write(lt9611->regmap, 0x82d6, 0x8c);
|
||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe.avi,
|
||||
connector,
|
||||
mode);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
|
||||
if (len < 0)
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
regmap_write(lt9611->regmap, 0x8440 + i, buf[i]);
|
||||
|
||||
ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe.vendor.hdmi,
|
||||
connector,
|
||||
mode);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
|
||||
if (len < 0)
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
regmap_write(lt9611->regmap, 0x8474 + i, buf[i]);
|
||||
|
||||
iframes |= 0x20;
|
||||
|
||||
out:
|
||||
regmap_write(lt9611->regmap, 0x843d, iframes); /* UD1 infoframe */
|
||||
}
|
||||
|
||||
static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
|
||||
{
|
||||
if (is_hdmi)
|
||||
regmap_write(lt9611->regmap, 0x82d6, 0x8c);
|
||||
else
|
||||
regmap_write(lt9611->regmap, 0x82d6, 0x0c);
|
||||
regmap_write(lt9611->regmap, 0x82d7, 0x04);
|
||||
}
|
||||
|
||||
|
@ -449,12 +469,11 @@ static void lt9611_sleep_setup(struct lt9611 *lt9611)
|
|||
{ 0x8023, 0x01 },
|
||||
{ 0x8157, 0x03 }, /* set addr pin as output */
|
||||
{ 0x8149, 0x0b },
|
||||
{ 0x8151, 0x30 }, /* disable IRQ */
|
||||
|
||||
{ 0x8102, 0x48 }, /* MIPI Rx power down */
|
||||
{ 0x8123, 0x80 },
|
||||
{ 0x8130, 0x00 },
|
||||
{ 0x8100, 0x01 }, /* bandgap power down */
|
||||
{ 0x8101, 0x00 }, /* system clk power down */
|
||||
{ 0x8011, 0x0a },
|
||||
};
|
||||
|
||||
regmap_multi_reg_write(lt9611->regmap,
|
||||
|
@ -565,24 +584,9 @@ static int lt9611_regulator_enable(struct lt9611 *lt9611)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
|
||||
if (lt9611_modes[i].hdisplay == mode->hdisplay &&
|
||||
lt9611_modes[i].vdisplay == mode->vdisplay &&
|
||||
lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
|
||||
return <9611_modes[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* connector funcs */
|
||||
static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
|
||||
static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
|
||||
{
|
||||
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
|
||||
unsigned int reg_val = 0;
|
||||
int connected = 0;
|
||||
|
||||
|
@ -595,12 +599,6 @@ static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
|
|||
return lt9611->status;
|
||||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
lt9611_connector_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
return __lt9611_detect(connector_to_lt9611(connector));
|
||||
}
|
||||
|
||||
static int lt9611_read_edid(struct lt9611 *lt9611)
|
||||
{
|
||||
unsigned int temp;
|
||||
|
@ -682,36 +680,37 @@ lt9611_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lt9611_connector_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct lt9611 *lt9611 = connector_to_lt9611(connector);
|
||||
unsigned int count;
|
||||
struct edid *edid;
|
||||
|
||||
lt9611_power_on(lt9611);
|
||||
edid = drm_do_get_edid(connector, lt9611_get_edid_block, lt9611);
|
||||
drm_connector_update_edid_property(connector, edid);
|
||||
count = drm_add_edid_modes(connector, edid);
|
||||
kfree(edid);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
lt9611_connector_mode_valid(struct drm_connector *connector,
|
||||
struct drm_display_mode *mode)
|
||||
{
|
||||
struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
|
||||
|
||||
return lt9611_mode ? MODE_OK : MODE_BAD;
|
||||
}
|
||||
|
||||
/* bridge funcs */
|
||||
static void
|
||||
lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
|
||||
struct drm_bridge_state *old_bridge_state)
|
||||
{
|
||||
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
|
||||
struct drm_atomic_state *state = old_bridge_state->base.state;
|
||||
struct drm_connector *connector;
|
||||
struct drm_connector_state *conn_state;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
struct drm_display_mode *mode;
|
||||
unsigned int postdiv;
|
||||
|
||||
connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
|
||||
if (WARN_ON(!connector))
|
||||
return;
|
||||
|
||||
conn_state = drm_atomic_get_new_connector_state(state, connector);
|
||||
if (WARN_ON(!conn_state))
|
||||
return;
|
||||
|
||||
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
|
||||
if (WARN_ON(!crtc_state))
|
||||
return;
|
||||
|
||||
mode = &crtc_state->adjusted_mode;
|
||||
|
||||
lt9611_mipi_input_digital(lt9611, mode);
|
||||
lt9611_pll_setup(lt9611, mode, &postdiv);
|
||||
lt9611_mipi_video_setup(lt9611, mode);
|
||||
lt9611_pcr_setup(lt9611, mode, postdiv);
|
||||
|
||||
if (lt9611_power_on(lt9611)) {
|
||||
dev_err(lt9611->dev, "power on failed\n");
|
||||
|
@ -719,7 +718,8 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
|
|||
}
|
||||
|
||||
lt9611_mipi_input_analog(lt9611);
|
||||
lt9611_hdmi_tx_digital(lt9611);
|
||||
lt9611_hdmi_set_infoframes(lt9611, connector, mode);
|
||||
lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
|
||||
lt9611_hdmi_tx_phy(lt9611);
|
||||
|
||||
msleep(500);
|
||||
|
@ -750,25 +750,10 @@ lt9611_bridge_atomic_disable(struct drm_bridge *bridge,
|
|||
}
|
||||
}
|
||||
|
||||
static struct
|
||||
drm_connector_helper_funcs lt9611_bridge_connector_helper_funcs = {
|
||||
.get_modes = lt9611_connector_get_modes,
|
||||
.mode_valid = lt9611_connector_mode_valid,
|
||||
};
|
||||
|
||||
static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
|
||||
.fill_modes = drm_helper_probe_single_connector_modes,
|
||||
.detect = lt9611_connector_detect,
|
||||
.destroy = drm_connector_cleanup,
|
||||
.reset = drm_atomic_helper_connector_reset,
|
||||
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
|
||||
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
||||
};
|
||||
|
||||
static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
|
||||
struct device_node *dsi_node)
|
||||
{
|
||||
const struct mipi_dsi_device_info info = { "lt9611", 0, NULL };
|
||||
const struct mipi_dsi_device_info info = { "lt9611", 0, lt9611->dev->of_node};
|
||||
struct mipi_dsi_device *dsi;
|
||||
struct mipi_dsi_host *host;
|
||||
struct device *dev = lt9611->dev;
|
||||
|
@ -800,70 +785,54 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
|
|||
return dsi;
|
||||
}
|
||||
|
||||
static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt9611)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = drm_connector_init(bridge->dev, <9611->connector,
|
||||
<9611_bridge_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_HDMIA);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to initialize connector with drm\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
drm_connector_helper_add(<9611->connector,
|
||||
<9611_bridge_connector_helper_funcs);
|
||||
|
||||
if (!bridge->encoder) {
|
||||
DRM_ERROR("Parent encoder object not found");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
drm_connector_attach_encoder(<9611->connector, bridge->encoder);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lt9611_bridge_attach(struct drm_bridge *bridge,
|
||||
enum drm_bridge_attach_flags flags)
|
||||
{
|
||||
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
|
||||
int ret;
|
||||
|
||||
if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
|
||||
ret = lt9611_connector_init(bridge, lt9611);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return drm_bridge_attach(bridge->encoder, lt9611->next_bridge,
|
||||
bridge, flags);
|
||||
}
|
||||
|
||||
static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
|
||||
const struct drm_display_info *info,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
|
||||
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
|
||||
|
||||
if (!lt9611_mode)
|
||||
return MODE_BAD;
|
||||
else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
|
||||
if (mode->hdisplay > 3840)
|
||||
return MODE_BAD_HVALUE;
|
||||
|
||||
if (mode->vdisplay > 2160)
|
||||
return MODE_BAD_VVALUE;
|
||||
|
||||
if (mode->hdisplay == 3840 &&
|
||||
mode->vdisplay == 2160 &&
|
||||
drm_mode_vrefresh(mode) > 30)
|
||||
return MODE_CLOCK_HIGH;
|
||||
|
||||
if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
|
||||
return MODE_PANEL;
|
||||
else
|
||||
return MODE_OK;
|
||||
}
|
||||
|
||||
static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
|
||||
static void lt9611_bridge_atomic_pre_enable(struct drm_bridge *bridge,
|
||||
struct drm_bridge_state *old_bridge_state)
|
||||
{
|
||||
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
|
||||
static const struct reg_sequence reg_cfg[] = {
|
||||
{ 0x8102, 0x12 },
|
||||
{ 0x8123, 0x40 },
|
||||
{ 0x8130, 0xea },
|
||||
{ 0x8011, 0xfa },
|
||||
};
|
||||
|
||||
if (!lt9611->sleep)
|
||||
return;
|
||||
|
||||
lt9611_reset(lt9611);
|
||||
regmap_write(lt9611->regmap, 0x80ee, 0x01);
|
||||
regmap_multi_reg_write(lt9611->regmap,
|
||||
reg_cfg, ARRAY_SIZE(reg_cfg));
|
||||
|
||||
lt9611->sleep = false;
|
||||
}
|
||||
|
@ -877,33 +846,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
|
|||
lt9611_sleep_setup(lt9611);
|
||||
}
|
||||
|
||||
static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adj_mode)
|
||||
{
|
||||
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
|
||||
struct hdmi_avi_infoframe avi_frame;
|
||||
int ret;
|
||||
|
||||
lt9611_bridge_pre_enable(bridge);
|
||||
|
||||
lt9611_mipi_input_digital(lt9611, mode);
|
||||
lt9611_pll_setup(lt9611, mode);
|
||||
lt9611_mipi_video_setup(lt9611, mode);
|
||||
lt9611_pcr_setup(lt9611, mode);
|
||||
|
||||
ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
|
||||
<9611->connector,
|
||||
mode);
|
||||
if (!ret)
|
||||
lt9611->vic = avi_frame.video_code;
|
||||
}
|
||||
|
||||
static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
|
||||
{
|
||||
return __lt9611_detect(bridge_to_lt9611(bridge));
|
||||
}
|
||||
|
||||
static struct edid *lt9611_bridge_get_edid(struct drm_bridge *bridge,
|
||||
struct drm_connector *connector)
|
||||
{
|
||||
|
@ -949,11 +891,11 @@ lt9611_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
|
|||
static const struct drm_bridge_funcs lt9611_bridge_funcs = {
|
||||
.attach = lt9611_bridge_attach,
|
||||
.mode_valid = lt9611_bridge_mode_valid,
|
||||
.mode_set = lt9611_bridge_mode_set,
|
||||
.detect = lt9611_bridge_detect,
|
||||
.get_edid = lt9611_bridge_get_edid,
|
||||
.hpd_enable = lt9611_bridge_hpd_enable,
|
||||
|
||||
.atomic_pre_enable = lt9611_bridge_atomic_pre_enable,
|
||||
.atomic_enable = lt9611_bridge_atomic_enable,
|
||||
.atomic_disable = lt9611_bridge_atomic_disable,
|
||||
.atomic_post_disable = lt9611_bridge_atomic_post_disable,
|
||||
|
@ -976,7 +918,7 @@ static int lt9611_parse_dt(struct device *dev,
|
|||
|
||||
lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
|
||||
|
||||
return 0;
|
||||
return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611->next_bridge);
|
||||
}
|
||||
|
||||
static int lt9611_gpio_init(struct lt9611 *lt9611)
|
||||
|
|
|
@ -239,12 +239,12 @@ static void sii902x_reset(struct sii902x *sii902x)
|
|||
if (!sii902x->reset_gpio)
|
||||
return;
|
||||
|
||||
gpiod_set_value(sii902x->reset_gpio, 1);
|
||||
gpiod_set_value_cansleep(sii902x->reset_gpio, 1);
|
||||
|
||||
/* The datasheet says treset-min = 100us. Make it 150us to be sure. */
|
||||
usleep_range(150, 200);
|
||||
|
||||
gpiod_set_value(sii902x->reset_gpio, 0);
|
||||
gpiod_set_value_cansleep(sii902x->reset_gpio, 0);
|
||||
}
|
||||
|
||||
static enum drm_connector_status sii902x_detect(struct sii902x *sii902x)
|
||||
|
@ -1116,7 +1116,8 @@ static int sii902x_probe(struct i2c_client *client)
|
|||
sii902x->next_bridge = of_drm_find_bridge(remote);
|
||||
of_node_put(remote);
|
||||
if (!sii902x->next_bridge)
|
||||
return -EPROBE_DEFER;
|
||||
return dev_err_probe(dev, -EPROBE_DEFER,
|
||||
"Failed to find remote bridge\n");
|
||||
}
|
||||
|
||||
mutex_init(&sii902x->mutex);
|
||||
|
|
|
@ -1264,10 +1264,10 @@ static int tc_dsi_rx_enable(struct tc_data *tc)
|
|||
u32 value;
|
||||
int ret;
|
||||
|
||||
regmap_write(tc->regmap, PPI_D0S_CLRSIPOCOUNT, 5);
|
||||
regmap_write(tc->regmap, PPI_D1S_CLRSIPOCOUNT, 5);
|
||||
regmap_write(tc->regmap, PPI_D2S_CLRSIPOCOUNT, 5);
|
||||
regmap_write(tc->regmap, PPI_D3S_CLRSIPOCOUNT, 5);
|
||||
regmap_write(tc->regmap, PPI_D0S_CLRSIPOCOUNT, 25);
|
||||
regmap_write(tc->regmap, PPI_D1S_CLRSIPOCOUNT, 25);
|
||||
regmap_write(tc->regmap, PPI_D2S_CLRSIPOCOUNT, 25);
|
||||
regmap_write(tc->regmap, PPI_D3S_CLRSIPOCOUNT, 25);
|
||||
regmap_write(tc->regmap, PPI_D0S_ATMR, 0);
|
||||
regmap_write(tc->regmap, PPI_D1S_ATMR, 0);
|
||||
regmap_write(tc->regmap, PPI_TX_RX_TA, TTA_GET | TTA_SURE);
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <linux/slab.h>
|
||||
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_mipi_dsi.h>
|
||||
#include <drm/drm_of.h>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <drm/display/drm_dp_helper.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_mipi_dsi.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_panel.h>
|
||||
|
|
|
@ -423,8 +423,7 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
|
|||
if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
|
||||
return -EPERM;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
err = drm_addmap_core(dev, map->offset, map->size, map->type,
|
||||
|
@ -469,8 +468,7 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
|
|||
int idx;
|
||||
int i;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
idx = map->offset;
|
||||
|
@ -570,8 +568,7 @@ EXPORT_SYMBOL(drm_legacy_rmmap_locked);
|
|||
|
||||
void drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
|
||||
{
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -628,8 +625,7 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
|
|||
struct drm_map_list *r_list;
|
||||
int ret;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
|
|
@ -59,8 +59,7 @@ struct drm_ctx_list {
|
|||
*/
|
||||
void drm_legacy_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
|
||||
{
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -97,8 +96,7 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
|
|||
*/
|
||||
void drm_legacy_ctxbitmap_init(struct drm_device * dev)
|
||||
{
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
idr_init(&dev->ctx_idr);
|
||||
|
@ -114,8 +112,7 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev)
|
|||
*/
|
||||
void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev)
|
||||
{
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -136,8 +133,7 @@ void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file)
|
|||
{
|
||||
struct drm_ctx_list *pos, *tmp;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return;
|
||||
|
||||
mutex_lock(&dev->ctxlist_mutex);
|
||||
|
@ -182,8 +178,7 @@ int drm_legacy_getsareactx(struct drm_device *dev, void *data,
|
|||
struct drm_local_map *map;
|
||||
struct drm_map_list *_entry;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -230,8 +225,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void *data,
|
|||
struct drm_local_map *map = NULL;
|
||||
struct drm_map_list *r_list = NULL;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -335,8 +329,7 @@ int drm_legacy_resctx(struct drm_device *dev, void *data,
|
|||
struct drm_ctx ctx;
|
||||
int i;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (res->count >= DRM_RESERVED_CONTEXTS) {
|
||||
|
@ -370,8 +363,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
|
|||
struct drm_ctx *ctx = data;
|
||||
int tmp_handle;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
tmp_handle = drm_legacy_ctxbitmap_next(dev);
|
||||
|
@ -419,8 +411,7 @@ int drm_legacy_getctx(struct drm_device *dev, void *data,
|
|||
{
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/* This is 0, because we don't handle any context flags */
|
||||
|
@ -445,8 +436,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
|
|||
{
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
DRM_DEBUG("%d\n", ctx->handle);
|
||||
|
@ -469,8 +459,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
|
|||
{
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
DRM_DEBUG("%d\n", ctx->handle);
|
||||
|
@ -495,8 +484,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data,
|
|||
{
|
||||
struct drm_ctx *ctx = data;
|
||||
|
||||
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
|
||||
!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
DRM_DEBUG("%d\n", ctx->handle);
|
||||
|
|
|
@ -473,8 +473,8 @@ EXPORT_SYMBOL(drm_fb_helper_init);
|
|||
* drm_fb_helper_alloc_info - allocate fb_info and some of its members
|
||||
* @fb_helper: driver-allocated fbdev helper
|
||||
*
|
||||
* A helper to alloc fb_info and the members cmap and apertures. Called
|
||||
* by the driver within the fb_probe fb_helper callback function. Drivers do not
|
||||
* A helper to alloc fb_info and the member cmap. Called by the driver
|
||||
* within the fb_probe fb_helper callback function. Drivers do not
|
||||
* need to release the allocated fb_info structure themselves, this is
|
||||
* automatically done when calling drm_fb_helper_fini().
|
||||
*
|
||||
|
@ -496,27 +496,11 @@ struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper)
|
|||
if (ret)
|
||||
goto err_release;
|
||||
|
||||
/*
|
||||
* TODO: We really should be smarter here and alloc an aperture
|
||||
* for each IORESOURCE_MEM resource helper->dev->dev has and also
|
||||
* init the ranges of the appertures based on the resources.
|
||||
* Note some drivers currently count on there being only 1 empty
|
||||
* aperture and fill this themselves, these will need to be dealt
|
||||
* with somehow when fixing this.
|
||||
*/
|
||||
info->apertures = alloc_apertures(1);
|
||||
if (!info->apertures) {
|
||||
ret = -ENOMEM;
|
||||
goto err_free_cmap;
|
||||
}
|
||||
|
||||
fb_helper->info = info;
|
||||
info->skip_vt_switch = true;
|
||||
|
||||
return info;
|
||||
|
||||
err_free_cmap:
|
||||
fb_dealloc_cmap(&info->cmap);
|
||||
err_release:
|
||||
framebuffer_release(info);
|
||||
return ERR_PTR(ret);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <linux/uaccess.h>
|
||||
|
||||
#include <drm/drm_auth.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_file.h>
|
||||
#include <drm/drm_lease.h>
|
||||
|
|
|
@ -1224,6 +1224,58 @@ int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
|
|||
}
|
||||
EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness);
|
||||
|
||||
/**
|
||||
* mipi_dsi_dcs_set_display_brightness_large() - sets the 16-bit brightness value
|
||||
* of the display
|
||||
* @dsi: DSI peripheral device
|
||||
* @brightness: brightness value
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
int mipi_dsi_dcs_set_display_brightness_large(struct mipi_dsi_device *dsi,
|
||||
u16 brightness)
|
||||
{
|
||||
u8 payload[2] = { brightness >> 8, brightness & 0xff };
|
||||
ssize_t err;
|
||||
|
||||
err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
|
||||
payload, sizeof(payload));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mipi_dsi_dcs_set_display_brightness_large);
|
||||
|
||||
/**
|
||||
* mipi_dsi_dcs_get_display_brightness_large() - gets the current 16-bit
|
||||
* brightness value of the display
|
||||
* @dsi: DSI peripheral device
|
||||
* @brightness: brightness value
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
|
||||
u16 *brightness)
|
||||
{
|
||||
u8 brightness_be[2];
|
||||
ssize_t err;
|
||||
|
||||
err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
|
||||
brightness_be, sizeof(brightness_be));
|
||||
if (err <= 0) {
|
||||
if (err == 0)
|
||||
err = -ENODATA;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
*brightness = (brightness_be[0] << 8) | brightness_be[1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mipi_dsi_dcs_get_display_brightness_large);
|
||||
|
||||
static int mipi_dsi_drv_probe(struct device *dev)
|
||||
{
|
||||
struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
|
||||
|
|
|
@ -31,10 +31,11 @@
|
|||
*/
|
||||
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/fb.h> /* for KHZ2PICOS() */
|
||||
#include <linux/list.h>
|
||||
#include <linux/list_sort.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
#include <video/of_display_timing.h>
|
||||
#include <video/of_videomode.h>
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <drm/drm_atomic.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_atomic_uapi.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_device.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_encoder.h>
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* Authors: Eric Knopp
|
||||
*/
|
||||
|
||||
#include <linux/backlight.h>
|
||||
|
||||
#include <acpi/video.h>
|
||||
|
||||
#include "psb_drv.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <linux/delay.h>
|
||||
|
||||
#include <drm/drm.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
|
||||
#include "cdv_device.h"
|
||||
#include "gma_device.h"
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <linux/i2c.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_simple_kms_helper.h>
|
||||
|
||||
#include "cdv_device.h"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <linux/i2c.h>
|
||||
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
|
||||
#include "cdv_device.h"
|
||||
#include "framebuffer.h"
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_simple_kms_helper.h>
|
||||
|
||||
#include "gma_display.h"
|
||||
|
|
|
@ -28,7 +28,9 @@
|
|||
|
||||
#include <drm/drm.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_simple_kms_helper.h>
|
||||
|
||||
#include "cdv_device.h"
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include <linux/i2c.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_simple_kms_helper.h>
|
||||
|
||||
#include "cdv_device.h"
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
|
||||
#include <drm/drm.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_framebuffer.h>
|
||||
#include <drm/drm_gem_framebuffer_helper.h>
|
||||
#include <drm/drm_modeset_helper.h>
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "gem.h"
|
||||
|
@ -297,11 +299,6 @@ static int psbfb_create(struct drm_fb_helper *fb_helper,
|
|||
info->screen_base = dev_priv->vram_addr + backing->offset;
|
||||
info->screen_size = size;
|
||||
|
||||
if (dev_priv->gtt.stolen_size) {
|
||||
info->apertures->ranges[0].base = dev_priv->fb_base;
|
||||
info->apertures->ranges[0].size = dev_priv->gtt.stolen_size;
|
||||
}
|
||||
|
||||
drm_fb_helper_fill_info(info, fb_helper, sizes);
|
||||
|
||||
info->fix.mmio_start = pci_resource_start(pdev, 0);
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
#include <linux/highmem.h>
|
||||
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_framebuffer.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
|
||||
#include "framebuffer.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_framebuffer.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "gem.h"
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
#include <linux/delay.h>
|
||||
|
||||
#include <drm/drm.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_simple_kms_helper.h>
|
||||
|
||||
#include "psb_drv.h"
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <asm/intel-mid.h>
|
||||
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_simple_kms_helper.h>
|
||||
|
||||
#include "intel_bios.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
**************************************************************************/
|
||||
|
||||
#include <drm/drm.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
|
||||
#include "gma_device.h"
|
||||
#include "intel_bios.h"
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
|
||||
#include <drm/drm_modeset_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "gem.h"
|
||||
#include "gma_display.h"
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_encoder.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <linux/i2c.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_simple_kms_helper.h>
|
||||
|
||||
#include "intel_bios.h"
|
||||
|
|
|
@ -33,7 +33,9 @@
|
|||
#include <linux/slab.h>
|
||||
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
|
||||
#include "psb_drv.h"
|
||||
#include "psb_intel_drv.h"
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
|
||||
#include "ch7006_priv.h"
|
||||
|
||||
/* DRM encoder functions */
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#ifndef __DRM_I2C_CH7006_PRIV_H__
|
||||
#define __DRM_I2C_CH7006_PRIV_H__
|
||||
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_encoder_slave.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <drm/i2c/ch7006.h>
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Makefile for the drm device driver. This driver provides support for the
|
||||
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
|
||||
|
||||
i810-y := i810_drv.o i810_dma.o
|
||||
|
||||
obj-$(CONFIG_DRM_I810) += i810.o
|
File diff suppressed because it is too large
Load Diff
|
@ -1,101 +0,0 @@
|
|||
/* i810_drv.c -- I810 driver -*- linux-c -*-
|
||||
* Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
* Jeff Hartmann <jhartmann@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*/
|
||||
|
||||
#include "i810_drv.h"
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_file.h>
|
||||
#include <drm/drm_pciids.h>
|
||||
#include <drm/i810_drm.h>
|
||||
|
||||
|
||||
static struct pci_device_id pciidlist[] = {
|
||||
i810_PCI_IDS
|
||||
};
|
||||
|
||||
static const struct file_operations i810_driver_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = drm_open,
|
||||
.release = drm_release,
|
||||
.unlocked_ioctl = drm_ioctl,
|
||||
.mmap = drm_legacy_mmap,
|
||||
.poll = drm_poll,
|
||||
.compat_ioctl = drm_compat_ioctl,
|
||||
.llseek = noop_llseek,
|
||||
};
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features = DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_LEGACY,
|
||||
.dev_priv_size = sizeof(drm_i810_buf_priv_t),
|
||||
.load = i810_driver_load,
|
||||
.lastclose = i810_driver_lastclose,
|
||||
.preclose = i810_driver_preclose,
|
||||
.dma_quiescent = i810_driver_dma_quiescent,
|
||||
.ioctls = i810_ioctls,
|
||||
.fops = &i810_driver_fops,
|
||||
.name = DRIVER_NAME,
|
||||
.desc = DRIVER_DESC,
|
||||
.date = DRIVER_DATE,
|
||||
.major = DRIVER_MAJOR,
|
||||
.minor = DRIVER_MINOR,
|
||||
.patchlevel = DRIVER_PATCHLEVEL,
|
||||
};
|
||||
|
||||
static struct pci_driver i810_pci_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.id_table = pciidlist,
|
||||
};
|
||||
|
||||
static int __init i810_init(void)
|
||||
{
|
||||
if (num_possible_cpus() > 1) {
|
||||
pr_err("drm/i810 does not support SMP\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
driver.num_ioctls = i810_max_ioctl;
|
||||
return drm_legacy_pci_init(&driver, &i810_pci_driver);
|
||||
}
|
||||
|
||||
static void __exit i810_exit(void)
|
||||
{
|
||||
drm_legacy_pci_exit(&driver, &i810_pci_driver);
|
||||
}
|
||||
|
||||
module_init(i810_init);
|
||||
module_exit(i810_exit);
|
||||
|
||||
MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
MODULE_LICENSE("GPL and additional rights");
|
|
@ -1,246 +0,0 @@
|
|||
/* i810_drv.h -- Private header for the Matrox g200/g400 driver -*- linux-c -*-
|
||||
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
* Jeff Hartmann <jhartmann@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _I810_DRV_H_
|
||||
#define _I810_DRV_H_
|
||||
|
||||
#include <drm/drm_ioctl.h>
|
||||
#include <drm/drm_legacy.h>
|
||||
#include <drm/i810_drm.h>
|
||||
|
||||
/* General customization:
|
||||
*/
|
||||
|
||||
#define DRIVER_AUTHOR "VA Linux Systems Inc."
|
||||
|
||||
#define DRIVER_NAME "i810"
|
||||
#define DRIVER_DESC "Intel i810"
|
||||
#define DRIVER_DATE "20030605"
|
||||
|
||||
/* Interface history
|
||||
*
|
||||
* 1.1 - XFree86 4.1
|
||||
* 1.2 - XvMC interfaces
|
||||
* - XFree86 4.2
|
||||
* 1.2.1 - Disable copying code (leave stub ioctls for backwards compatibility)
|
||||
* - Remove requirement for interrupt (leave stubs again)
|
||||
* 1.3 - Add page flipping.
|
||||
* 1.4 - fix DRM interface
|
||||
*/
|
||||
#define DRIVER_MAJOR 1
|
||||
#define DRIVER_MINOR 4
|
||||
#define DRIVER_PATCHLEVEL 0
|
||||
|
||||
typedef struct drm_i810_buf_priv {
|
||||
u32 *in_use;
|
||||
int my_use_idx;
|
||||
int currently_mapped;
|
||||
void *virtual;
|
||||
void *kernel_virtual;
|
||||
drm_local_map_t map;
|
||||
} drm_i810_buf_priv_t;
|
||||
|
||||
typedef struct _drm_i810_ring_buffer {
|
||||
int tail_mask;
|
||||
unsigned long Start;
|
||||
unsigned long End;
|
||||
unsigned long Size;
|
||||
u8 *virtual_start;
|
||||
int head;
|
||||
int tail;
|
||||
int space;
|
||||
drm_local_map_t map;
|
||||
} drm_i810_ring_buffer_t;
|
||||
|
||||
typedef struct drm_i810_private {
|
||||
struct drm_local_map *sarea_map;
|
||||
struct drm_local_map *mmio_map;
|
||||
|
||||
drm_i810_sarea_t *sarea_priv;
|
||||
drm_i810_ring_buffer_t ring;
|
||||
|
||||
void *hw_status_page;
|
||||
unsigned long counter;
|
||||
|
||||
dma_addr_t dma_status_page;
|
||||
|
||||
struct drm_buf *mmap_buffer;
|
||||
|
||||
u32 front_di1, back_di1, zi1;
|
||||
|
||||
int back_offset;
|
||||
int depth_offset;
|
||||
int overlay_offset;
|
||||
int overlay_physical;
|
||||
int w, h;
|
||||
int pitch;
|
||||
int back_pitch;
|
||||
int depth_pitch;
|
||||
|
||||
int do_boxes;
|
||||
int dma_used;
|
||||
|
||||
int current_page;
|
||||
int page_flipping;
|
||||
|
||||
wait_queue_head_t irq_queue;
|
||||
atomic_t irq_received;
|
||||
atomic_t irq_emitted;
|
||||
|
||||
int front_offset;
|
||||
} drm_i810_private_t;
|
||||
|
||||
/* i810_dma.c */
|
||||
extern int i810_driver_dma_quiescent(struct drm_device *dev);
|
||||
void i810_driver_reclaim_buffers(struct drm_device *dev,
|
||||
struct drm_file *file_priv);
|
||||
extern int i810_driver_load(struct drm_device *, unsigned long flags);
|
||||
extern void i810_driver_lastclose(struct drm_device *dev);
|
||||
extern void i810_driver_preclose(struct drm_device *dev,
|
||||
struct drm_file *file_priv);
|
||||
|
||||
extern long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
|
||||
extern const struct drm_ioctl_desc i810_ioctls[];
|
||||
extern int i810_max_ioctl;
|
||||
|
||||
#define I810_BASE(reg) ((unsigned long) \
|
||||
dev_priv->mmio_map->handle)
|
||||
#define I810_ADDR(reg) (I810_BASE(reg) + reg)
|
||||
#define I810_DEREF(reg) (*(__volatile__ int *)I810_ADDR(reg))
|
||||
#define I810_READ(reg) I810_DEREF(reg)
|
||||
#define I810_WRITE(reg, val) do { I810_DEREF(reg) = val; } while (0)
|
||||
#define I810_DEREF16(reg) (*(__volatile__ u16 *)I810_ADDR(reg))
|
||||
#define I810_READ16(reg) I810_DEREF16(reg)
|
||||
#define I810_WRITE16(reg, val) do { I810_DEREF16(reg) = val; } while (0)
|
||||
|
||||
#define I810_VERBOSE 0
|
||||
#define RING_LOCALS unsigned int outring, ringmask; \
|
||||
volatile char *virt;
|
||||
|
||||
#define BEGIN_LP_RING(n) do { \
|
||||
if (I810_VERBOSE) \
|
||||
DRM_DEBUG("BEGIN_LP_RING(%d)\n", n); \
|
||||
if (dev_priv->ring.space < n*4) \
|
||||
i810_wait_ring(dev, n*4); \
|
||||
dev_priv->ring.space -= n*4; \
|
||||
outring = dev_priv->ring.tail; \
|
||||
ringmask = dev_priv->ring.tail_mask; \
|
||||
virt = dev_priv->ring.virtual_start; \
|
||||
} while (0)
|
||||
|
||||
#define ADVANCE_LP_RING() do { \
|
||||
if (I810_VERBOSE) \
|
||||
DRM_DEBUG("ADVANCE_LP_RING\n"); \
|
||||
dev_priv->ring.tail = outring; \
|
||||
I810_WRITE(LP_RING + RING_TAIL, outring); \
|
||||
} while (0)
|
||||
|
||||
#define OUT_RING(n) do { \
|
||||
if (I810_VERBOSE) \
|
||||
DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \
|
||||
*(volatile unsigned int *)(virt + outring) = n; \
|
||||
outring += 4; \
|
||||
outring &= ringmask; \
|
||||
} while (0)
|
||||
|
||||
#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
|
||||
#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23))
|
||||
#define CMD_REPORT_HEAD (7<<23)
|
||||
#define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1)
|
||||
#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1)
|
||||
|
||||
#define INST_PARSER_CLIENT 0x00000000
|
||||
#define INST_OP_FLUSH 0x02000000
|
||||
#define INST_FLUSH_MAP_CACHE 0x00000001
|
||||
|
||||
#define BB1_START_ADDR_MASK (~0x7)
|
||||
#define BB1_PROTECTED (1<<0)
|
||||
#define BB1_UNPROTECTED (0<<0)
|
||||
#define BB2_END_ADDR_MASK (~0x7)
|
||||
|
||||
#define I810REG_HWSTAM 0x02098
|
||||
#define I810REG_INT_IDENTITY_R 0x020a4
|
||||
#define I810REG_INT_MASK_R 0x020a8
|
||||
#define I810REG_INT_ENABLE_R 0x020a0
|
||||
|
||||
#define LP_RING 0x2030
|
||||
#define HP_RING 0x2040
|
||||
#define RING_TAIL 0x00
|
||||
#define TAIL_ADDR 0x000FFFF8
|
||||
#define RING_HEAD 0x04
|
||||
#define HEAD_WRAP_COUNT 0xFFE00000
|
||||
#define HEAD_WRAP_ONE 0x00200000
|
||||
#define HEAD_ADDR 0x001FFFFC
|
||||
#define RING_START 0x08
|
||||
#define START_ADDR 0x00FFFFF8
|
||||
#define RING_LEN 0x0C
|
||||
#define RING_NR_PAGES 0x000FF000
|
||||
#define RING_REPORT_MASK 0x00000006
|
||||
#define RING_REPORT_64K 0x00000002
|
||||
#define RING_REPORT_128K 0x00000004
|
||||
#define RING_NO_REPORT 0x00000000
|
||||
#define RING_VALID_MASK 0x00000001
|
||||
#define RING_VALID 0x00000001
|
||||
#define RING_INVALID 0x00000000
|
||||
|
||||
#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
|
||||
#define SC_UPDATE_SCISSOR (0x1<<1)
|
||||
#define SC_ENABLE_MASK (0x1<<0)
|
||||
#define SC_ENABLE (0x1<<0)
|
||||
|
||||
#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
|
||||
#define SCI_YMIN_MASK (0xffff<<16)
|
||||
#define SCI_XMIN_MASK (0xffff<<0)
|
||||
#define SCI_YMAX_MASK (0xffff<<16)
|
||||
#define SCI_XMAX_MASK (0xffff<<0)
|
||||
|
||||
#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
|
||||
#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
|
||||
#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x2)
|
||||
#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
|
||||
#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
|
||||
#define GFX_OP_PRIMITIVE ((0x3<<29)|(0x1f<<24))
|
||||
|
||||
#define CMD_OP_Z_BUFFER_INFO ((0x0<<29)|(0x16<<23))
|
||||
#define CMD_OP_DESTBUFFER_INFO ((0x0<<29)|(0x15<<23))
|
||||
#define CMD_OP_FRONTBUFFER_INFO ((0x0<<29)|(0x14<<23))
|
||||
#define CMD_OP_WAIT_FOR_EVENT ((0x0<<29)|(0x03<<23))
|
||||
|
||||
#define BR00_BITBLT_CLIENT 0x40000000
|
||||
#define BR00_OP_COLOR_BLT 0x10000000
|
||||
#define BR00_OP_SRC_COPY_BLT 0x10C00000
|
||||
#define BR13_SOLID_PATTERN 0x80000000
|
||||
|
||||
#define WAIT_FOR_PLANE_A_SCANLINES (1<<1)
|
||||
#define WAIT_FOR_PLANE_A_FLIP (1<<2)
|
||||
#define WAIT_FOR_VBLANK (1<<3)
|
||||
|
||||
#endif
|
|
@ -267,23 +267,16 @@ static int intelfb_create(struct drm_fb_helper *helper,
|
|||
|
||||
info->fbops = &intelfb_ops;
|
||||
|
||||
/* setup aperture base/size for vesafb takeover */
|
||||
obj = intel_fb_obj(&intel_fb->base);
|
||||
if (i915_gem_object_is_lmem(obj)) {
|
||||
struct intel_memory_region *mem = obj->mm.region;
|
||||
|
||||
info->apertures->ranges[0].base = mem->io_start;
|
||||
info->apertures->ranges[0].size = mem->io_size;
|
||||
|
||||
/* Use fbdev's framebuffer from lmem for discrete */
|
||||
info->fix.smem_start =
|
||||
(unsigned long)(mem->io_start +
|
||||
i915_gem_object_get_dma_address(obj, 0));
|
||||
info->fix.smem_len = obj->base.size;
|
||||
} else {
|
||||
info->apertures->ranges[0].base = ggtt->gmadr.start;
|
||||
info->apertures->ranges[0].size = ggtt->mappable_end;
|
||||
|
||||
/* Our framebuffer is the entirety of fbdev's system memory */
|
||||
info->fix.smem_start =
|
||||
(unsigned long)(ggtt->gmadr.start + i915_ggtt_offset(vma));
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <drm/drm_bridge_connector.h>
|
||||
#include <drm/drm_color_mgmt.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_damage_helper.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_encoder.h>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <drm/drm_atomic.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_blend.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_fb_dma_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_framebuffer.h>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_bridge.h>
|
||||
#include <drm/drm_connector.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_encoder.h>
|
||||
#include <drm/drm_gem_dma_helper.h>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <drm/drm_atomic.h>
|
||||
#include <drm/drm_atomic_helper.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_gem_dma_helper.h>
|
||||
#include <drm/drm_gem_framebuffer_helper.h>
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Makefile for the drm device driver. This driver provides support for the
|
||||
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
|
||||
|
||||
mga-y := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
|
||||
|
||||
mga-$(CONFIG_COMPAT) += mga_ioc32.o
|
||||
|
||||
obj-$(CONFIG_DRM_MGA) += mga.o
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,104 +0,0 @@
|
|||
/* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*-
|
||||
* Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drm_pciids.h>
|
||||
|
||||
#include "mga_drv.h"
|
||||
|
||||
static struct pci_device_id pciidlist[] = {
|
||||
mga_PCI_IDS
|
||||
};
|
||||
|
||||
static const struct file_operations mga_driver_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = drm_open,
|
||||
.release = drm_release,
|
||||
.unlocked_ioctl = drm_ioctl,
|
||||
.mmap = drm_legacy_mmap,
|
||||
.poll = drm_poll,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = mga_compat_ioctl,
|
||||
#endif
|
||||
.llseek = noop_llseek,
|
||||
};
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features =
|
||||
DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_LEGACY |
|
||||
DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ,
|
||||
.dev_priv_size = sizeof(drm_mga_buf_priv_t),
|
||||
.load = mga_driver_load,
|
||||
.unload = mga_driver_unload,
|
||||
.lastclose = mga_driver_lastclose,
|
||||
.dma_quiescent = mga_driver_dma_quiescent,
|
||||
.get_vblank_counter = mga_get_vblank_counter,
|
||||
.enable_vblank = mga_enable_vblank,
|
||||
.disable_vblank = mga_disable_vblank,
|
||||
.irq_preinstall = mga_driver_irq_preinstall,
|
||||
.irq_postinstall = mga_driver_irq_postinstall,
|
||||
.irq_uninstall = mga_driver_irq_uninstall,
|
||||
.irq_handler = mga_driver_irq_handler,
|
||||
.ioctls = mga_ioctls,
|
||||
.dma_ioctl = mga_dma_buffers,
|
||||
.fops = &mga_driver_fops,
|
||||
.name = DRIVER_NAME,
|
||||
.desc = DRIVER_DESC,
|
||||
.date = DRIVER_DATE,
|
||||
.major = DRIVER_MAJOR,
|
||||
.minor = DRIVER_MINOR,
|
||||
.patchlevel = DRIVER_PATCHLEVEL,
|
||||
};
|
||||
|
||||
static struct pci_driver mga_pci_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.id_table = pciidlist,
|
||||
};
|
||||
|
||||
static int __init mga_init(void)
|
||||
{
|
||||
driver.num_ioctls = mga_max_ioctl;
|
||||
return drm_legacy_pci_init(&driver, &mga_pci_driver);
|
||||
}
|
||||
|
||||
static void __exit mga_exit(void)
|
||||
{
|
||||
drm_legacy_pci_exit(&driver, &mga_pci_driver);
|
||||
}
|
||||
|
||||
module_init(mga_init);
|
||||
module_exit(mga_exit);
|
||||
|
||||
MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
MODULE_LICENSE("GPL and additional rights");
|
|
@ -1,685 +0,0 @@
|
|||
/* mga_drv.h -- Private header for the Matrox G200/G400 driver -*- linux-c -*-
|
||||
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*/
|
||||
|
||||
#ifndef __MGA_DRV_H__
|
||||
#define __MGA_DRV_H__
|
||||
|
||||
#include <linux/irqreturn.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <drm/drm_device.h>
|
||||
#include <drm/drm_file.h>
|
||||
#include <drm/drm_ioctl.h>
|
||||
#include <drm/drm_legacy.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <drm/drm_sarea.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
#include <drm/mga_drm.h>
|
||||
|
||||
/* General customization:
|
||||
*/
|
||||
|
||||
#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
|
||||
|
||||
#define DRIVER_NAME "mga"
|
||||
#define DRIVER_DESC "Matrox G200/G400"
|
||||
#define DRIVER_DATE "20051102"
|
||||
|
||||
#define DRIVER_MAJOR 3
|
||||
#define DRIVER_MINOR 2
|
||||
#define DRIVER_PATCHLEVEL 1
|
||||
|
||||
typedef struct drm_mga_primary_buffer {
|
||||
u8 *start;
|
||||
u8 *end;
|
||||
int size;
|
||||
|
||||
u32 tail;
|
||||
int space;
|
||||
volatile long wrapped;
|
||||
|
||||
volatile u32 *status;
|
||||
|
||||
u32 last_flush;
|
||||
u32 last_wrap;
|
||||
|
||||
u32 high_mark;
|
||||
} drm_mga_primary_buffer_t;
|
||||
|
||||
typedef struct drm_mga_freelist {
|
||||
struct drm_mga_freelist *next;
|
||||
struct drm_mga_freelist *prev;
|
||||
drm_mga_age_t age;
|
||||
struct drm_buf *buf;
|
||||
} drm_mga_freelist_t;
|
||||
|
||||
typedef struct {
|
||||
drm_mga_freelist_t *list_entry;
|
||||
int discard;
|
||||
int dispatched;
|
||||
} drm_mga_buf_priv_t;
|
||||
|
||||
typedef struct drm_mga_private {
|
||||
drm_mga_primary_buffer_t prim;
|
||||
drm_mga_sarea_t *sarea_priv;
|
||||
|
||||
drm_mga_freelist_t *head;
|
||||
drm_mga_freelist_t *tail;
|
||||
|
||||
unsigned int warp_pipe;
|
||||
unsigned long warp_pipe_phys[MGA_MAX_WARP_PIPES];
|
||||
|
||||
int chipset;
|
||||
int usec_timeout;
|
||||
|
||||
/**
|
||||
* If set, the new DMA initialization sequence was used. This is
|
||||
* primarilly used to select how the driver should uninitialized its
|
||||
* internal DMA structures.
|
||||
*/
|
||||
int used_new_dma_init;
|
||||
|
||||
/**
|
||||
* If AGP memory is used for DMA buffers, this will be the value
|
||||
* \c MGA_PAGPXFER. Otherwise, it will be zero (for a PCI transfer).
|
||||
*/
|
||||
u32 dma_access;
|
||||
|
||||
/**
|
||||
* If AGP memory is used for DMA buffers, this will be the value
|
||||
* \c MGA_WAGP_ENABLE. Otherwise, it will be zero (for a PCI
|
||||
* transfer).
|
||||
*/
|
||||
u32 wagp_enable;
|
||||
|
||||
/**
|
||||
* \name MMIO region parameters.
|
||||
*
|
||||
* \sa drm_mga_private_t::mmio
|
||||
*/
|
||||
/*@{ */
|
||||
resource_size_t mmio_base; /**< Bus address of base of MMIO. */
|
||||
resource_size_t mmio_size; /**< Size of the MMIO region. */
|
||||
/*@} */
|
||||
|
||||
u32 clear_cmd;
|
||||
u32 maccess;
|
||||
|
||||
atomic_t vbl_received; /**< Number of vblanks received. */
|
||||
wait_queue_head_t fence_queue;
|
||||
atomic_t last_fence_retired;
|
||||
u32 next_fence_to_post;
|
||||
|
||||
unsigned int fb_cpp;
|
||||
unsigned int front_offset;
|
||||
unsigned int front_pitch;
|
||||
unsigned int back_offset;
|
||||
unsigned int back_pitch;
|
||||
|
||||
unsigned int depth_cpp;
|
||||
unsigned int depth_offset;
|
||||
unsigned int depth_pitch;
|
||||
|
||||
unsigned int texture_offset;
|
||||
unsigned int texture_size;
|
||||
|
||||
drm_local_map_t *sarea;
|
||||
drm_local_map_t *mmio;
|
||||
drm_local_map_t *status;
|
||||
drm_local_map_t *warp;
|
||||
drm_local_map_t *primary;
|
||||
drm_local_map_t *agp_textures;
|
||||
|
||||
unsigned long agp_handle;
|
||||
unsigned int agp_size;
|
||||
} drm_mga_private_t;
|
||||
|
||||
extern const struct drm_ioctl_desc mga_ioctls[];
|
||||
extern int mga_max_ioctl;
|
||||
|
||||
/* mga_dma.c */
|
||||
extern int mga_dma_bootstrap(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
extern int mga_dma_init(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
extern int mga_getparam(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
extern int mga_dma_flush(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
extern int mga_dma_reset(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
extern int mga_dma_buffers(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
extern int mga_driver_load(struct drm_device *dev, unsigned long flags);
|
||||
extern void mga_driver_unload(struct drm_device *dev);
|
||||
extern void mga_driver_lastclose(struct drm_device *dev);
|
||||
extern int mga_driver_dma_quiescent(struct drm_device *dev);
|
||||
|
||||
extern int mga_do_wait_for_idle(drm_mga_private_t *dev_priv);
|
||||
|
||||
extern void mga_do_dma_flush(drm_mga_private_t *dev_priv);
|
||||
extern void mga_do_dma_wrap_start(drm_mga_private_t *dev_priv);
|
||||
extern void mga_do_dma_wrap_end(drm_mga_private_t *dev_priv);
|
||||
|
||||
extern int mga_freelist_put(struct drm_device *dev, struct drm_buf *buf);
|
||||
|
||||
/* mga_warp.c */
|
||||
extern int mga_warp_install_microcode(drm_mga_private_t *dev_priv);
|
||||
extern int mga_warp_init(drm_mga_private_t *dev_priv);
|
||||
|
||||
/* mga_irq.c */
|
||||
extern int mga_enable_vblank(struct drm_device *dev, unsigned int pipe);
|
||||
extern void mga_disable_vblank(struct drm_device *dev, unsigned int pipe);
|
||||
extern u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int pipe);
|
||||
extern void mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence);
|
||||
extern int mga_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence);
|
||||
extern irqreturn_t mga_driver_irq_handler(int irq, void *arg);
|
||||
extern void mga_driver_irq_preinstall(struct drm_device *dev);
|
||||
extern int mga_driver_irq_postinstall(struct drm_device *dev);
|
||||
extern void mga_driver_irq_uninstall(struct drm_device *dev);
|
||||
extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
|
||||
#define mga_flush_write_combine() wmb()
|
||||
|
||||
#define MGA_READ8(reg) \
|
||||
readb(((void __iomem *)dev_priv->mmio->handle) + (reg))
|
||||
#define MGA_READ(reg) \
|
||||
readl(((void __iomem *)dev_priv->mmio->handle) + (reg))
|
||||
#define MGA_WRITE8(reg, val) \
|
||||
writeb(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
|
||||
#define MGA_WRITE(reg, val) \
|
||||
writel(val, ((void __iomem *)dev_priv->mmio->handle) + (reg))
|
||||
|
||||
#define DWGREG0 0x1c00
|
||||
#define DWGREG0_END 0x1dff
|
||||
#define DWGREG1 0x2c00
|
||||
#define DWGREG1_END 0x2dff
|
||||
|
||||
#define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END)
|
||||
#define DMAREG0(r) (u8)((r - DWGREG0) >> 2)
|
||||
#define DMAREG1(r) (u8)(((r - DWGREG1) >> 2) | 0x80)
|
||||
#define DMAREG(r) (ISREG0(r) ? DMAREG0(r) : DMAREG1(r))
|
||||
|
||||
/* ================================================================
|
||||
* Helper macross...
|
||||
*/
|
||||
|
||||
#define MGA_EMIT_STATE(dev_priv, dirty) \
|
||||
do { \
|
||||
if ((dirty) & ~MGA_UPLOAD_CLIPRECTS) { \
|
||||
if (dev_priv->chipset >= MGA_CARD_TYPE_G400) \
|
||||
mga_g400_emit_state(dev_priv); \
|
||||
else \
|
||||
mga_g200_emit_state(dev_priv); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define WRAP_TEST_WITH_RETURN(dev_priv) \
|
||||
do { \
|
||||
if (test_bit(0, &dev_priv->prim.wrapped)) { \
|
||||
if (mga_is_idle(dev_priv)) { \
|
||||
mga_do_dma_wrap_end(dev_priv); \
|
||||
} else if (dev_priv->prim.space < \
|
||||
dev_priv->prim.high_mark) { \
|
||||
if (MGA_DMA_DEBUG) \
|
||||
DRM_INFO("wrap...\n"); \
|
||||
return -EBUSY; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define WRAP_WAIT_WITH_RETURN(dev_priv) \
|
||||
do { \
|
||||
if (test_bit(0, &dev_priv->prim.wrapped)) { \
|
||||
if (mga_do_wait_for_idle(dev_priv) < 0) { \
|
||||
if (MGA_DMA_DEBUG) \
|
||||
DRM_INFO("wrap...\n"); \
|
||||
return -EBUSY; \
|
||||
} \
|
||||
mga_do_dma_wrap_end(dev_priv); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* ================================================================
|
||||
* Primary DMA command stream
|
||||
*/
|
||||
|
||||
#define MGA_VERBOSE 0
|
||||
|
||||
#define DMA_LOCALS unsigned int write; volatile u8 *prim;
|
||||
|
||||
#define DMA_BLOCK_SIZE (5 * sizeof(u32))
|
||||
|
||||
#define BEGIN_DMA(n) \
|
||||
do { \
|
||||
if (MGA_VERBOSE) { \
|
||||
DRM_INFO("BEGIN_DMA(%d)\n", (n)); \
|
||||
DRM_INFO(" space=0x%x req=0x%zx\n", \
|
||||
dev_priv->prim.space, (n) * DMA_BLOCK_SIZE); \
|
||||
} \
|
||||
prim = dev_priv->prim.start; \
|
||||
write = dev_priv->prim.tail; \
|
||||
} while (0)
|
||||
|
||||
#define BEGIN_DMA_WRAP() \
|
||||
do { \
|
||||
if (MGA_VERBOSE) { \
|
||||
DRM_INFO("BEGIN_DMA()\n"); \
|
||||
DRM_INFO(" space=0x%x\n", dev_priv->prim.space); \
|
||||
} \
|
||||
prim = dev_priv->prim.start; \
|
||||
write = dev_priv->prim.tail; \
|
||||
} while (0)
|
||||
|
||||
#define ADVANCE_DMA() \
|
||||
do { \
|
||||
dev_priv->prim.tail = write; \
|
||||
if (MGA_VERBOSE) \
|
||||
DRM_INFO("ADVANCE_DMA() tail=0x%05x sp=0x%x\n", \
|
||||
write, dev_priv->prim.space); \
|
||||
} while (0)
|
||||
|
||||
#define FLUSH_DMA() \
|
||||
do { \
|
||||
if (0) { \
|
||||
DRM_INFO("\n"); \
|
||||
DRM_INFO(" tail=0x%06x head=0x%06lx\n", \
|
||||
dev_priv->prim.tail, \
|
||||
(unsigned long)(MGA_READ(MGA_PRIMADDRESS) - \
|
||||
dev_priv->primary->offset)); \
|
||||
} \
|
||||
if (!test_bit(0, &dev_priv->prim.wrapped)) { \
|
||||
if (dev_priv->prim.space < dev_priv->prim.high_mark) \
|
||||
mga_do_dma_wrap_start(dev_priv); \
|
||||
else \
|
||||
mga_do_dma_flush(dev_priv); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Never use this, always use DMA_BLOCK(...) for primary DMA output.
|
||||
*/
|
||||
#define DMA_WRITE(offset, val) \
|
||||
do { \
|
||||
if (MGA_VERBOSE) \
|
||||
DRM_INFO(" DMA_WRITE( 0x%08x ) at 0x%04zx\n", \
|
||||
(u32)(val), write + (offset) * sizeof(u32)); \
|
||||
*(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \
|
||||
} while (0)
|
||||
|
||||
#define DMA_BLOCK(reg0, val0, reg1, val1, reg2, val2, reg3, val3) \
|
||||
do { \
|
||||
DMA_WRITE(0, ((DMAREG(reg0) << 0) | \
|
||||
(DMAREG(reg1) << 8) | \
|
||||
(DMAREG(reg2) << 16) | \
|
||||
(DMAREG(reg3) << 24))); \
|
||||
DMA_WRITE(1, val0); \
|
||||
DMA_WRITE(2, val1); \
|
||||
DMA_WRITE(3, val2); \
|
||||
DMA_WRITE(4, val3); \
|
||||
write += DMA_BLOCK_SIZE; \
|
||||
} while (0)
|
||||
|
||||
/* Buffer aging via primary DMA stream head pointer.
|
||||
*/
|
||||
|
||||
#define SET_AGE(age, h, w) \
|
||||
do { \
|
||||
(age)->head = h; \
|
||||
(age)->wrap = w; \
|
||||
} while (0)
|
||||
|
||||
#define TEST_AGE(age, h, w) ((age)->wrap < w || \
|
||||
((age)->wrap == w && \
|
||||
(age)->head < h))
|
||||
|
||||
#define AGE_BUFFER(buf_priv) \
|
||||
do { \
|
||||
drm_mga_freelist_t *entry = (buf_priv)->list_entry; \
|
||||
if ((buf_priv)->dispatched) { \
|
||||
entry->age.head = (dev_priv->prim.tail + \
|
||||
dev_priv->primary->offset); \
|
||||
entry->age.wrap = dev_priv->sarea_priv->last_wrap; \
|
||||
} else { \
|
||||
entry->age.head = 0; \
|
||||
entry->age.wrap = 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MGA_ENGINE_IDLE_MASK (MGA_SOFTRAPEN | \
|
||||
MGA_DWGENGSTS | \
|
||||
MGA_ENDPRDMASTS)
|
||||
#define MGA_DMA_IDLE_MASK (MGA_SOFTRAPEN | \
|
||||
MGA_ENDPRDMASTS)
|
||||
|
||||
#define MGA_DMA_DEBUG 0
|
||||
|
||||
/* A reduced set of the mga registers.
|
||||
*/
|
||||
#define MGA_CRTC_INDEX 0x1fd4
|
||||
#define MGA_CRTC_DATA 0x1fd5
|
||||
|
||||
/* CRTC11 */
|
||||
#define MGA_VINTCLR (1 << 4)
|
||||
#define MGA_VINTEN (1 << 5)
|
||||
|
||||
#define MGA_ALPHACTRL 0x2c7c
|
||||
#define MGA_AR0 0x1c60
|
||||
#define MGA_AR1 0x1c64
|
||||
#define MGA_AR2 0x1c68
|
||||
#define MGA_AR3 0x1c6c
|
||||
#define MGA_AR4 0x1c70
|
||||
#define MGA_AR5 0x1c74
|
||||
#define MGA_AR6 0x1c78
|
||||
|
||||
#define MGA_CXBNDRY 0x1c80
|
||||
#define MGA_CXLEFT 0x1ca0
|
||||
#define MGA_CXRIGHT 0x1ca4
|
||||
|
||||
#define MGA_DMAPAD 0x1c54
|
||||
#define MGA_DSTORG 0x2cb8
|
||||
#define MGA_DWGCTL 0x1c00
|
||||
# define MGA_OPCOD_MASK (15 << 0)
|
||||
# define MGA_OPCOD_TRAP (4 << 0)
|
||||
# define MGA_OPCOD_TEXTURE_TRAP (6 << 0)
|
||||
# define MGA_OPCOD_BITBLT (8 << 0)
|
||||
# define MGA_OPCOD_ILOAD (9 << 0)
|
||||
# define MGA_ATYPE_MASK (7 << 4)
|
||||
# define MGA_ATYPE_RPL (0 << 4)
|
||||
# define MGA_ATYPE_RSTR (1 << 4)
|
||||
# define MGA_ATYPE_ZI (3 << 4)
|
||||
# define MGA_ATYPE_BLK (4 << 4)
|
||||
# define MGA_ATYPE_I (7 << 4)
|
||||
# define MGA_LINEAR (1 << 7)
|
||||
# define MGA_ZMODE_MASK (7 << 8)
|
||||
# define MGA_ZMODE_NOZCMP (0 << 8)
|
||||
# define MGA_ZMODE_ZE (2 << 8)
|
||||
# define MGA_ZMODE_ZNE (3 << 8)
|
||||
# define MGA_ZMODE_ZLT (4 << 8)
|
||||
# define MGA_ZMODE_ZLTE (5 << 8)
|
||||
# define MGA_ZMODE_ZGT (6 << 8)
|
||||
# define MGA_ZMODE_ZGTE (7 << 8)
|
||||
# define MGA_SOLID (1 << 11)
|
||||
# define MGA_ARZERO (1 << 12)
|
||||
# define MGA_SGNZERO (1 << 13)
|
||||
# define MGA_SHIFTZERO (1 << 14)
|
||||
# define MGA_BOP_MASK (15 << 16)
|
||||
# define MGA_BOP_ZERO (0 << 16)
|
||||
# define MGA_BOP_DST (10 << 16)
|
||||
# define MGA_BOP_SRC (12 << 16)
|
||||
# define MGA_BOP_ONE (15 << 16)
|
||||
# define MGA_TRANS_SHIFT 20
|
||||
# define MGA_TRANS_MASK (15 << 20)
|
||||
# define MGA_BLTMOD_MASK (15 << 25)
|
||||
# define MGA_BLTMOD_BMONOLEF (0 << 25)
|
||||
# define MGA_BLTMOD_BMONOWF (4 << 25)
|
||||
# define MGA_BLTMOD_PLAN (1 << 25)
|
||||
# define MGA_BLTMOD_BFCOL (2 << 25)
|
||||
# define MGA_BLTMOD_BU32BGR (3 << 25)
|
||||
# define MGA_BLTMOD_BU32RGB (7 << 25)
|
||||
# define MGA_BLTMOD_BU24BGR (11 << 25)
|
||||
# define MGA_BLTMOD_BU24RGB (15 << 25)
|
||||
# define MGA_PATTERN (1 << 29)
|
||||
# define MGA_TRANSC (1 << 30)
|
||||
# define MGA_CLIPDIS (1 << 31)
|
||||
#define MGA_DWGSYNC 0x2c4c
|
||||
|
||||
#define MGA_FCOL 0x1c24
|
||||
#define MGA_FIFOSTATUS 0x1e10
|
||||
#define MGA_FOGCOL 0x1cf4
|
||||
#define MGA_FXBNDRY 0x1c84
|
||||
#define MGA_FXLEFT 0x1ca8
|
||||
#define MGA_FXRIGHT 0x1cac
|
||||
|
||||
#define MGA_ICLEAR 0x1e18
|
||||
# define MGA_SOFTRAPICLR (1 << 0)
|
||||
# define MGA_VLINEICLR (1 << 5)
|
||||
#define MGA_IEN 0x1e1c
|
||||
# define MGA_SOFTRAPIEN (1 << 0)
|
||||
# define MGA_VLINEIEN (1 << 5)
|
||||
|
||||
#define MGA_LEN 0x1c5c
|
||||
|
||||
#define MGA_MACCESS 0x1c04
|
||||
|
||||
#define MGA_PITCH 0x1c8c
|
||||
#define MGA_PLNWT 0x1c1c
|
||||
#define MGA_PRIMADDRESS 0x1e58
|
||||
# define MGA_DMA_GENERAL (0 << 0)
|
||||
# define MGA_DMA_BLIT (1 << 0)
|
||||
# define MGA_DMA_VECTOR (2 << 0)
|
||||
# define MGA_DMA_VERTEX (3 << 0)
|
||||
#define MGA_PRIMEND 0x1e5c
|
||||
# define MGA_PRIMNOSTART (1 << 0)
|
||||
# define MGA_PAGPXFER (1 << 1)
|
||||
#define MGA_PRIMPTR 0x1e50
|
||||
# define MGA_PRIMPTREN0 (1 << 0)
|
||||
# define MGA_PRIMPTREN1 (1 << 1)
|
||||
|
||||
#define MGA_RST 0x1e40
|
||||
# define MGA_SOFTRESET (1 << 0)
|
||||
# define MGA_SOFTEXTRST (1 << 1)
|
||||
|
||||
#define MGA_SECADDRESS 0x2c40
|
||||
#define MGA_SECEND 0x2c44
|
||||
#define MGA_SETUPADDRESS 0x2cd0
|
||||
#define MGA_SETUPEND 0x2cd4
|
||||
#define MGA_SGN 0x1c58
|
||||
#define MGA_SOFTRAP 0x2c48
|
||||
#define MGA_SRCORG 0x2cb4
|
||||
# define MGA_SRMMAP_MASK (1 << 0)
|
||||
# define MGA_SRCMAP_FB (0 << 0)
|
||||
# define MGA_SRCMAP_SYSMEM (1 << 0)
|
||||
# define MGA_SRCACC_MASK (1 << 1)
|
||||
# define MGA_SRCACC_PCI (0 << 1)
|
||||
# define MGA_SRCACC_AGP (1 << 1)
|
||||
#define MGA_STATUS 0x1e14
|
||||
# define MGA_SOFTRAPEN (1 << 0)
|
||||
# define MGA_VSYNCPEN (1 << 4)
|
||||
# define MGA_VLINEPEN (1 << 5)
|
||||
# define MGA_DWGENGSTS (1 << 16)
|
||||
# define MGA_ENDPRDMASTS (1 << 17)
|
||||
#define MGA_STENCIL 0x2cc8
|
||||
#define MGA_STENCILCTL 0x2ccc
|
||||
|
||||
#define MGA_TDUALSTAGE0 0x2cf8
|
||||
#define MGA_TDUALSTAGE1 0x2cfc
|
||||
#define MGA_TEXBORDERCOL 0x2c5c
|
||||
#define MGA_TEXCTL 0x2c30
|
||||
#define MGA_TEXCTL2 0x2c3c
|
||||
# define MGA_DUALTEX (1 << 7)
|
||||
# define MGA_G400_TC2_MAGIC (1 << 15)
|
||||
# define MGA_MAP1_ENABLE (1 << 31)
|
||||
#define MGA_TEXFILTER 0x2c58
|
||||
#define MGA_TEXHEIGHT 0x2c2c
|
||||
#define MGA_TEXORG 0x2c24
|
||||
# define MGA_TEXORGMAP_MASK (1 << 0)
|
||||
# define MGA_TEXORGMAP_FB (0 << 0)
|
||||
# define MGA_TEXORGMAP_SYSMEM (1 << 0)
|
||||
# define MGA_TEXORGACC_MASK (1 << 1)
|
||||
# define MGA_TEXORGACC_PCI (0 << 1)
|
||||
# define MGA_TEXORGACC_AGP (1 << 1)
|
||||
#define MGA_TEXORG1 0x2ca4
|
||||
#define MGA_TEXORG2 0x2ca8
|
||||
#define MGA_TEXORG3 0x2cac
|
||||
#define MGA_TEXORG4 0x2cb0
|
||||
#define MGA_TEXTRANS 0x2c34
|
||||
#define MGA_TEXTRANSHIGH 0x2c38
|
||||
#define MGA_TEXWIDTH 0x2c28
|
||||
|
||||
#define MGA_WACCEPTSEQ 0x1dd4
|
||||
#define MGA_WCODEADDR 0x1e6c
|
||||
#define MGA_WFLAG 0x1dc4
|
||||
#define MGA_WFLAG1 0x1de0
|
||||
#define MGA_WFLAGNB 0x1e64
|
||||
#define MGA_WFLAGNB1 0x1e08
|
||||
#define MGA_WGETMSB 0x1dc8
|
||||
#define MGA_WIADDR 0x1dc0
|
||||
#define MGA_WIADDR2 0x1dd8
|
||||
# define MGA_WMODE_SUSPEND (0 << 0)
|
||||
# define MGA_WMODE_RESUME (1 << 0)
|
||||
# define MGA_WMODE_JUMP (2 << 0)
|
||||
# define MGA_WMODE_START (3 << 0)
|
||||
# define MGA_WAGP_ENABLE (1 << 2)
|
||||
#define MGA_WMISC 0x1e70
|
||||
# define MGA_WUCODECACHE_ENABLE (1 << 0)
|
||||
# define MGA_WMASTER_ENABLE (1 << 1)
|
||||
# define MGA_WCACHEFLUSH_ENABLE (1 << 3)
|
||||
#define MGA_WVRTXSZ 0x1dcc
|
||||
|
||||
#define MGA_YBOT 0x1c9c
|
||||
#define MGA_YDST 0x1c90
|
||||
#define MGA_YDSTLEN 0x1c88
|
||||
#define MGA_YDSTORG 0x1c94
|
||||
#define MGA_YTOP 0x1c98
|
||||
|
||||
#define MGA_ZORG 0x1c0c
|
||||
|
||||
/* This finishes the current batch of commands
|
||||
*/
|
||||
#define MGA_EXEC 0x0100
|
||||
|
||||
/* AGP PLL encoding (for G200 only).
|
||||
*/
|
||||
#define MGA_AGP_PLL 0x1e4c
|
||||
# define MGA_AGP2XPLL_DISABLE (0 << 0)
|
||||
# define MGA_AGP2XPLL_ENABLE (1 << 0)
|
||||
|
||||
/* Warp registers
|
||||
*/
|
||||
#define MGA_WR0 0x2d00
|
||||
#define MGA_WR1 0x2d04
|
||||
#define MGA_WR2 0x2d08
|
||||
#define MGA_WR3 0x2d0c
|
||||
#define MGA_WR4 0x2d10
|
||||
#define MGA_WR5 0x2d14
|
||||
#define MGA_WR6 0x2d18
|
||||
#define MGA_WR7 0x2d1c
|
||||
#define MGA_WR8 0x2d20
|
||||
#define MGA_WR9 0x2d24
|
||||
#define MGA_WR10 0x2d28
|
||||
#define MGA_WR11 0x2d2c
|
||||
#define MGA_WR12 0x2d30
|
||||
#define MGA_WR13 0x2d34
|
||||
#define MGA_WR14 0x2d38
|
||||
#define MGA_WR15 0x2d3c
|
||||
#define MGA_WR16 0x2d40
|
||||
#define MGA_WR17 0x2d44
|
||||
#define MGA_WR18 0x2d48
|
||||
#define MGA_WR19 0x2d4c
|
||||
#define MGA_WR20 0x2d50
|
||||
#define MGA_WR21 0x2d54
|
||||
#define MGA_WR22 0x2d58
|
||||
#define MGA_WR23 0x2d5c
|
||||
#define MGA_WR24 0x2d60
|
||||
#define MGA_WR25 0x2d64
|
||||
#define MGA_WR26 0x2d68
|
||||
#define MGA_WR27 0x2d6c
|
||||
#define MGA_WR28 0x2d70
|
||||
#define MGA_WR29 0x2d74
|
||||
#define MGA_WR30 0x2d78
|
||||
#define MGA_WR31 0x2d7c
|
||||
#define MGA_WR32 0x2d80
|
||||
#define MGA_WR33 0x2d84
|
||||
#define MGA_WR34 0x2d88
|
||||
#define MGA_WR35 0x2d8c
|
||||
#define MGA_WR36 0x2d90
|
||||
#define MGA_WR37 0x2d94
|
||||
#define MGA_WR38 0x2d98
|
||||
#define MGA_WR39 0x2d9c
|
||||
#define MGA_WR40 0x2da0
|
||||
#define MGA_WR41 0x2da4
|
||||
#define MGA_WR42 0x2da8
|
||||
#define MGA_WR43 0x2dac
|
||||
#define MGA_WR44 0x2db0
|
||||
#define MGA_WR45 0x2db4
|
||||
#define MGA_WR46 0x2db8
|
||||
#define MGA_WR47 0x2dbc
|
||||
#define MGA_WR48 0x2dc0
|
||||
#define MGA_WR49 0x2dc4
|
||||
#define MGA_WR50 0x2dc8
|
||||
#define MGA_WR51 0x2dcc
|
||||
#define MGA_WR52 0x2dd0
|
||||
#define MGA_WR53 0x2dd4
|
||||
#define MGA_WR54 0x2dd8
|
||||
#define MGA_WR55 0x2ddc
|
||||
#define MGA_WR56 0x2de0
|
||||
#define MGA_WR57 0x2de4
|
||||
#define MGA_WR58 0x2de8
|
||||
#define MGA_WR59 0x2dec
|
||||
#define MGA_WR60 0x2df0
|
||||
#define MGA_WR61 0x2df4
|
||||
#define MGA_WR62 0x2df8
|
||||
#define MGA_WR63 0x2dfc
|
||||
# define MGA_G400_WR_MAGIC (1 << 6)
|
||||
# define MGA_G400_WR56_MAGIC 0x46480000 /* 12800.0f */
|
||||
|
||||
#define MGA_ILOAD_ALIGN 64
|
||||
#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1)
|
||||
|
||||
#define MGA_DWGCTL_FLUSH (MGA_OPCOD_TEXTURE_TRAP | \
|
||||
MGA_ATYPE_I | \
|
||||
MGA_ZMODE_NOZCMP | \
|
||||
MGA_ARZERO | \
|
||||
MGA_SGNZERO | \
|
||||
MGA_BOP_SRC | \
|
||||
(15 << MGA_TRANS_SHIFT))
|
||||
|
||||
#define MGA_DWGCTL_CLEAR (MGA_OPCOD_TRAP | \
|
||||
MGA_ZMODE_NOZCMP | \
|
||||
MGA_SOLID | \
|
||||
MGA_ARZERO | \
|
||||
MGA_SGNZERO | \
|
||||
MGA_SHIFTZERO | \
|
||||
MGA_BOP_SRC | \
|
||||
(0 << MGA_TRANS_SHIFT) | \
|
||||
MGA_BLTMOD_BMONOLEF | \
|
||||
MGA_TRANSC | \
|
||||
MGA_CLIPDIS)
|
||||
|
||||
#define MGA_DWGCTL_COPY (MGA_OPCOD_BITBLT | \
|
||||
MGA_ATYPE_RPL | \
|
||||
MGA_SGNZERO | \
|
||||
MGA_SHIFTZERO | \
|
||||
MGA_BOP_SRC | \
|
||||
(0 << MGA_TRANS_SHIFT) | \
|
||||
MGA_BLTMOD_BFCOL | \
|
||||
MGA_CLIPDIS)
|
||||
|
||||
/* Simple idle test.
|
||||
*/
|
||||
static __inline__ int mga_is_idle(drm_mga_private_t *dev_priv)
|
||||
{
|
||||
u32 status = MGA_READ(MGA_STATUS) & MGA_ENGINE_IDLE_MASK;
|
||||
return (status == MGA_ENDPRDMASTS);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,197 +0,0 @@
|
|||
/*
|
||||
* \file mga_ioc32.c
|
||||
*
|
||||
* 32-bit ioctl compatibility routines for the MGA DRM.
|
||||
*
|
||||
* \author Dave Airlie <airlied@linux.ie> with code from patches by Egbert Eich
|
||||
*
|
||||
*
|
||||
* Copyright (C) Paul Mackerras 2005
|
||||
* Copyright (C) Egbert Eich 2003,2004
|
||||
* Copyright (C) Dave Airlie 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/compat.h>
|
||||
|
||||
#include "mga_drv.h"
|
||||
|
||||
typedef struct drm32_mga_init {
|
||||
int func;
|
||||
u32 sarea_priv_offset;
|
||||
struct_group(always32bit,
|
||||
int chipset;
|
||||
int sgram;
|
||||
unsigned int maccess;
|
||||
unsigned int fb_cpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
unsigned int depth_cpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
unsigned int texture_offset[MGA_NR_TEX_HEAPS];
|
||||
unsigned int texture_size[MGA_NR_TEX_HEAPS];
|
||||
);
|
||||
u32 fb_offset;
|
||||
u32 mmio_offset;
|
||||
u32 status_offset;
|
||||
u32 warp_offset;
|
||||
u32 primary_offset;
|
||||
u32 buffers_offset;
|
||||
} drm_mga_init32_t;
|
||||
|
||||
static int compat_mga_init(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_mga_init32_t init32;
|
||||
drm_mga_init_t init;
|
||||
|
||||
if (copy_from_user(&init32, (void __user *)arg, sizeof(init32)))
|
||||
return -EFAULT;
|
||||
|
||||
init.func = init32.func;
|
||||
init.sarea_priv_offset = init32.sarea_priv_offset;
|
||||
memcpy(&init.always32bit, &init32.always32bit,
|
||||
sizeof(init32.always32bit));
|
||||
init.fb_offset = init32.fb_offset;
|
||||
init.mmio_offset = init32.mmio_offset;
|
||||
init.status_offset = init32.status_offset;
|
||||
init.warp_offset = init32.warp_offset;
|
||||
init.primary_offset = init32.primary_offset;
|
||||
init.buffers_offset = init32.buffers_offset;
|
||||
|
||||
return drm_ioctl_kernel(file, mga_dma_init, &init,
|
||||
DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY);
|
||||
}
|
||||
|
||||
typedef struct drm_mga_getparam32 {
|
||||
int param;
|
||||
u32 value;
|
||||
} drm_mga_getparam32_t;
|
||||
|
||||
static int compat_mga_getparam(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_mga_getparam32_t getparam32;
|
||||
drm_mga_getparam_t getparam;
|
||||
|
||||
if (copy_from_user(&getparam32, (void __user *)arg, sizeof(getparam32)))
|
||||
return -EFAULT;
|
||||
|
||||
getparam.param = getparam32.param;
|
||||
getparam.value = compat_ptr(getparam32.value);
|
||||
return drm_ioctl_kernel(file, mga_getparam, &getparam, DRM_AUTH);
|
||||
}
|
||||
|
||||
typedef struct drm_mga_drm_bootstrap32 {
|
||||
u32 texture_handle;
|
||||
u32 texture_size;
|
||||
u32 primary_size;
|
||||
u32 secondary_bin_count;
|
||||
u32 secondary_bin_size;
|
||||
u32 agp_mode;
|
||||
u8 agp_size;
|
||||
} drm_mga_dma_bootstrap32_t;
|
||||
|
||||
static int compat_mga_dma_bootstrap(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_mga_dma_bootstrap32_t dma_bootstrap32;
|
||||
drm_mga_dma_bootstrap_t dma_bootstrap;
|
||||
int err;
|
||||
|
||||
if (copy_from_user(&dma_bootstrap32, (void __user *)arg,
|
||||
sizeof(dma_bootstrap32)))
|
||||
return -EFAULT;
|
||||
|
||||
dma_bootstrap.texture_handle = dma_bootstrap32.texture_handle;
|
||||
dma_bootstrap.texture_size = dma_bootstrap32.texture_size;
|
||||
dma_bootstrap.primary_size = dma_bootstrap32.primary_size;
|
||||
dma_bootstrap.secondary_bin_count = dma_bootstrap32.secondary_bin_count;
|
||||
dma_bootstrap.secondary_bin_size = dma_bootstrap32.secondary_bin_size;
|
||||
dma_bootstrap.agp_mode = dma_bootstrap32.agp_mode;
|
||||
dma_bootstrap.agp_size = dma_bootstrap32.agp_size;
|
||||
|
||||
err = drm_ioctl_kernel(file, mga_dma_bootstrap, &dma_bootstrap,
|
||||
DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
dma_bootstrap32.texture_handle = dma_bootstrap.texture_handle;
|
||||
dma_bootstrap32.texture_size = dma_bootstrap.texture_size;
|
||||
dma_bootstrap32.primary_size = dma_bootstrap.primary_size;
|
||||
dma_bootstrap32.secondary_bin_count = dma_bootstrap.secondary_bin_count;
|
||||
dma_bootstrap32.secondary_bin_size = dma_bootstrap.secondary_bin_size;
|
||||
dma_bootstrap32.agp_mode = dma_bootstrap.agp_mode;
|
||||
dma_bootstrap32.agp_size = dma_bootstrap.agp_size;
|
||||
if (copy_to_user((void __user *)arg, &dma_bootstrap32,
|
||||
sizeof(dma_bootstrap32)))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct {
|
||||
drm_ioctl_compat_t *fn;
|
||||
char *name;
|
||||
} mga_compat_ioctls[] = {
|
||||
#define DRM_IOCTL32_DEF(n, f)[DRM_##n] = {.fn = f, .name = #n}
|
||||
DRM_IOCTL32_DEF(MGA_INIT, compat_mga_init),
|
||||
DRM_IOCTL32_DEF(MGA_GETPARAM, compat_mga_getparam),
|
||||
DRM_IOCTL32_DEF(MGA_DMA_BOOTSTRAP, compat_mga_dma_bootstrap),
|
||||
};
|
||||
|
||||
/**
|
||||
* mga_compat_ioctl - Called whenever a 32-bit process running under
|
||||
* a 64-bit kernel performs an ioctl on /dev/dri/card<n>.
|
||||
*
|
||||
* @filp: file pointer.
|
||||
* @cmd: command.
|
||||
* @arg: user argument.
|
||||
* return: zero on success or negative number on failure.
|
||||
*/
|
||||
long mga_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
unsigned int nr = DRM_IOCTL_NR(cmd);
|
||||
struct drm_file *file_priv = filp->private_data;
|
||||
drm_ioctl_compat_t *fn = NULL;
|
||||
int ret;
|
||||
|
||||
if (nr < DRM_COMMAND_BASE)
|
||||
return drm_compat_ioctl(filp, cmd, arg);
|
||||
|
||||
if (nr >= DRM_COMMAND_BASE + ARRAY_SIZE(mga_compat_ioctls))
|
||||
return drm_ioctl(filp, cmd, arg);
|
||||
|
||||
fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE].fn;
|
||||
if (!fn)
|
||||
return drm_ioctl(filp, cmd, arg);
|
||||
|
||||
DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n",
|
||||
task_pid_nr(current),
|
||||
(long)old_encode_dev(file_priv->minor->kdev->devt),
|
||||
file_priv->authenticated,
|
||||
mga_compat_ioctls[nr - DRM_COMMAND_BASE].name);
|
||||
ret = (*fn) (filp, cmd, arg);
|
||||
if (ret)
|
||||
DRM_DEBUG("ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
/* mga_irq.c -- IRQ handling for radeon -*- linux-c -*-
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
|
||||
*
|
||||
* The Weather Channel (TM) funded Tungsten Graphics to develop the
|
||||
* initial release of the Radeon 8500 driver under the XFree86 license.
|
||||
* This notice must be preserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
* Eric Anholt <anholt@FreeBSD.org>
|
||||
*/
|
||||
|
||||
#include "mga_drv.h"
|
||||
|
||||
u32 mga_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
|
||||
{
|
||||
const drm_mga_private_t *const dev_priv =
|
||||
(drm_mga_private_t *) dev->dev_private;
|
||||
|
||||
if (pipe != 0)
|
||||
return 0;
|
||||
|
||||
return atomic_read(&dev_priv->vbl_received);
|
||||
}
|
||||
|
||||
|
||||
irqreturn_t mga_driver_irq_handler(int irq, void *arg)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) arg;
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
||||
int status;
|
||||
int handled = 0;
|
||||
|
||||
status = MGA_READ(MGA_STATUS);
|
||||
|
||||
/* VBLANK interrupt */
|
||||
if (status & MGA_VLINEPEN) {
|
||||
MGA_WRITE(MGA_ICLEAR, MGA_VLINEICLR);
|
||||
atomic_inc(&dev_priv->vbl_received);
|
||||
drm_handle_vblank(dev, 0);
|
||||
handled = 1;
|
||||
}
|
||||
|
||||
/* SOFTRAP interrupt */
|
||||
if (status & MGA_SOFTRAPEN) {
|
||||
const u32 prim_start = MGA_READ(MGA_PRIMADDRESS);
|
||||
const u32 prim_end = MGA_READ(MGA_PRIMEND);
|
||||
|
||||
|
||||
MGA_WRITE(MGA_ICLEAR, MGA_SOFTRAPICLR);
|
||||
|
||||
/* In addition to clearing the interrupt-pending bit, we
|
||||
* have to write to MGA_PRIMEND to re-start the DMA operation.
|
||||
*/
|
||||
if ((prim_start & ~0x03) != (prim_end & ~0x03))
|
||||
MGA_WRITE(MGA_PRIMEND, prim_end);
|
||||
|
||||
atomic_inc(&dev_priv->last_fence_retired);
|
||||
wake_up(&dev_priv->fence_queue);
|
||||
handled = 1;
|
||||
}
|
||||
|
||||
if (handled)
|
||||
return IRQ_HANDLED;
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
int mga_enable_vblank(struct drm_device *dev, unsigned int pipe)
|
||||
{
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
||||
|
||||
if (pipe != 0) {
|
||||
DRM_ERROR("tried to enable vblank on non-existent crtc %u\n",
|
||||
pipe);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void mga_disable_vblank(struct drm_device *dev, unsigned int pipe)
|
||||
{
|
||||
if (pipe != 0) {
|
||||
DRM_ERROR("tried to disable vblank on non-existent crtc %u\n",
|
||||
pipe);
|
||||
}
|
||||
|
||||
/* Do *NOT* disable the vertical refresh interrupt. MGA doesn't have
|
||||
* a nice hardware counter that tracks the number of refreshes when
|
||||
* the interrupt is disabled, and the kernel doesn't know the refresh
|
||||
* rate to calculate an estimate.
|
||||
*/
|
||||
/* MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); */
|
||||
}
|
||||
|
||||
void mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence)
|
||||
{
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
||||
unsigned int cur_fence;
|
||||
|
||||
/* Assume that the user has missed the current sequence number
|
||||
* by about a day rather than she wants to wait for years
|
||||
* using fences.
|
||||
*/
|
||||
wait_event_timeout(dev_priv->fence_queue,
|
||||
(((cur_fence = atomic_read(&dev_priv->last_fence_retired))
|
||||
- *sequence) <= (1 << 23)),
|
||||
msecs_to_jiffies(3000));
|
||||
|
||||
*sequence = cur_fence;
|
||||
}
|
||||
|
||||
void mga_driver_irq_preinstall(struct drm_device *dev)
|
||||
{
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
||||
|
||||
/* Disable *all* interrupts */
|
||||
MGA_WRITE(MGA_IEN, 0);
|
||||
/* Clear bits if they're already high */
|
||||
MGA_WRITE(MGA_ICLEAR, ~0);
|
||||
}
|
||||
|
||||
int mga_driver_irq_postinstall(struct drm_device *dev)
|
||||
{
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
||||
|
||||
init_waitqueue_head(&dev_priv->fence_queue);
|
||||
|
||||
/* Turn on soft trap interrupt. Vertical blank interrupts are enabled
|
||||
* in mga_enable_vblank.
|
||||
*/
|
||||
MGA_WRITE(MGA_IEN, MGA_SOFTRAPEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mga_driver_irq_uninstall(struct drm_device *dev)
|
||||
{
|
||||
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
||||
if (!dev_priv)
|
||||
return;
|
||||
|
||||
/* Disable *all* interrupts */
|
||||
MGA_WRITE(MGA_IEN, 0);
|
||||
|
||||
dev->irq_enabled = false;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue