Skip to content

Rpi 4.4.y firmware kms #1637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions arch/arm/boot/dts/bcm2708_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,26 @@
status = "disabled";
};

firmwarekms: firmwarekms@7e600000 {
compatible = "raspberrypi,rpi-firmware-kms";
/* SMI interrupt reg */
reg = <0x7e600000 0x100>;
interrupts = <2 16>;
brcm,firmware = <&firmware>;
status = "disabled";
};

smi: smi@7e600000 {
compatible = "brcm,bcm2835-smi";
reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>;
interrupts = <2 16>;
brcm,smi-clock-source = <6>;
brcm,smi-clock-divisor = <4>;
dmas = <&dma 4>;
dma-names = "rx-tx";
status = "disabled";
};

dsi1: dsi@7e700000 {
#address-cells = <1>;
#size-cells = <0>;
Expand Down Expand Up @@ -325,17 +345,6 @@
status = "disabled";
};

smi: smi@7e600000 {
compatible = "brcm,bcm2835-smi";
reg = <0x7e600000 0x44>, <0x7e1010b0 0x8>;
interrupts = <2 16>;
brcm,smi-clock-source = <6>;
brcm,smi-clock-divisor = <4>;
dmas = <&dma 4>;
dma-names = "rx-tx";
status = "disabled";
};

pixelvalve2: pixelvalve@7e807000 {
compatible = "brcm,bcm2835-pixelvalve2";
reg = <0x7e807000 0x100>;
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ dtbo-$(RPI_DT_OVERLAYS) += spi2-2cs.dtbo
dtbo-$(RPI_DT_OVERLAYS) += spi2-3cs.dtbo
dtbo-$(RPI_DT_OVERLAYS) += tinylcd35.dtbo
dtbo-$(RPI_DT_OVERLAYS) += uart1.dtbo
dtbo-$(RPI_DT_OVERLAYS) += vc4-fkms-v3d.dtbo
dtbo-$(RPI_DT_OVERLAYS) += vc4-kms-v3d.dtbo
dtbo-$(RPI_DT_OVERLAYS) += vga666.dtbo
dtbo-$(RPI_DT_OVERLAYS) += w1-gpio.dtbo
Expand Down
11 changes: 11 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,17 @@ Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14)
rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15)


Name: vc4-fkms-v3d
Info: Enable Eric Anholt's DRM VC4 V3D driver on top of the dispmanx
display stack.
Load: dtoverlay=vc4-fkms-v3d,<param>
Params: cma-256 CMA is 256MB, 256MB-aligned (needs 1GB)
cma-192 CMA is 192MB, 256MB-aligned (needs 1GB)
cma-128 CMA is 128MB, 128MB-aligned
cma-96 CMA is 96MB, 128MB-aligned
cma-64 CMA is 64MB, 64MB-aligned


Name: vc4-kms-v3d
Info: Enable Eric Anholt's DRM VC4 HDMI/HVS/V3D driver. Running startx or
booting to GUI while this overlay is in use will cause interesting
Expand Down
89 changes: 89 additions & 0 deletions arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* vc4-fkms-v3d-overlay.dts
*/

/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

fragment@0 {
target-path = "/chosen";
__overlay__ {
bootargs = "cma=256M@256M";
};
};

fragment@1 {
target-path = "/chosen";
__dormant__ {
bootargs = "cma=192M@256M";
};
};

fragment@2 {
target-path = "/chosen";
__dormant__ {
bootargs = "cma=128M@128M";
};
};

fragment@3 {
target-path = "/chosen";
__dormant__ {
bootargs = "cma=96M@128M";
};
};

fragment@4 {
target-path = "/chosen";
__dormant__ {
bootargs = "cma=64M@64M";
};
};

fragment@5 {
target = <&fb>;
__overlay__ {
status = "disabled";
};
};

fragment@6 {
target = <&firmwarekms>;
__overlay__ {
status = "okay";
};
};

fragment@7 {
target = <&v3d>;
__overlay__ {
interrupts = <1 10>;
status = "okay";
};
};

fragment@8 {
target = <&gpu>;
__overlay__ {
status = "okay";
};
};

fragment@9 {
target-path = "/soc/dma";
__overlay__ {
brcm,dma-channel-mask = <0x7f35>;
};
};

__overrides__ {
cma-256 = <0>,"+0-1-2-3-4";
cma-192 = <0>,"-0+1-2-3-4";
cma-128 = <0>,"-0-1+2-3-4";
cma-96 = <0>,"-0-1-2+3-4";
cma-64 = <0>,"-0-1-2-3+4";
};
};
3 changes: 2 additions & 1 deletion drivers/firmware/raspberrypi.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void response_callback(struct mbox_client *cl, void *msg)
* Sends a request to the firmware through the BCM2835 mailbox driver,
* and synchronously waits for the reply.
*/
static int
int
rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data)
{
u32 message = MBOX_MSG(chan, data);
Expand All @@ -63,6 +63,7 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data)

return ret;
}
EXPORT_SYMBOL_GPL(rpi_firmware_transaction);

/**
* rpi_firmware_property_list - Submit firmware property list
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/vc4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vc4-y := \
vc4_drv.o \
vc4_dpi.o \
vc4_dsi.o \
vc4_firmware_kms.o \
vc4_kms.o \
vc4_gem.o \
vc4_hdmi.o \
Expand Down
13 changes: 13 additions & 0 deletions drivers/gpu/drm/vc4/vc4_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
int vblank_lines;
int ret = 0;

if (vc4->firmware_kms)
return 0;

/*
* XXX Doesn't work well in interlaced mode yet, partially due
* to problems in vc4 kms or drm core interlaced mode handling,
Expand Down Expand Up @@ -639,6 +642,11 @@ int vc4_enable_vblank(struct drm_device *dev, unsigned int crtc_id)
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id];

if (vc4->firmware_kms) {
/* XXX: Can we mask the SMI interrupt? */
return 0;
}

CRTC_WRITE(PV_INTEN, PV_INT_VFP_START);

return 0;
Expand All @@ -649,6 +657,11 @@ void vc4_disable_vblank(struct drm_device *dev, unsigned int crtc_id)
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_crtc *vc4_crtc = vc4->crtc[crtc_id];

if (vc4->firmware_kms) {
/* XXX: Can we mask the SMI interrupt? */
return;
}

CRTC_WRITE(PV_INTEN, 0);
}

Expand Down
10 changes: 8 additions & 2 deletions drivers/gpu/drm/vc4/vc4_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index)

static void vc4_drm_preclose(struct drm_device *dev, struct drm_file *file)
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct drm_crtc *crtc;

list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
vc4_cancel_page_flip(crtc, file);
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
if (vc4->firmware_kms)
vc4_fkms_cancel_page_flip(crtc, file);
else
vc4_cancel_page_flip(crtc, file);
}
}

void vc4_dump_regs32(const struct debugfs_reg32 *regs, unsigned int num_regs,
Expand Down Expand Up @@ -331,6 +336,7 @@ static struct platform_driver *const component_drivers[] = {
&vc4_dsi_driver,
&vc4_hvs_driver,
&vc4_crtc_driver,
&vc4_firmware_kms_driver,
&vc4_v3d_driver,
};

Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/vc4/vc4_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ struct debugfs_reg32;
struct vc4_dev {
struct drm_device *dev;

bool firmware_kms;
struct rpi_firmware *firmware;

struct vc4_hdmi *hdmi;
struct vc4_hvs *hvs;
struct vc4_crtc *crtc[3];
Expand Down Expand Up @@ -461,6 +464,10 @@ int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused);
extern struct platform_driver vc4_dsi_driver;
int vc4_dsi_debugfs_regs(struct seq_file *m, void *unused);

/* vc4_firmware_kms.c */
extern struct platform_driver vc4_firmware_kms_driver;
void vc4_fkms_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file);

/* vc4_gem.c */
void vc4_gem_init(struct drm_device *dev);
void vc4_gem_destroy(struct drm_device *dev);
Expand Down
Loading