Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ allOf:

properties:
compatible:
const: samsung,s6e3hc4
enum:
- samsung,s6e3hc3
- samsung,s6e3hc4

reg:
maxItems: 1
Expand All @@ -39,7 +41,15 @@ properties:
required:
- compatible
- reg
- reset-gpios

if:
properties:
compatible:
contains:
const: samsung,s6e3hc4
then:
required:
- reset-gpios

unevaluatedProperties: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ description:

properties:
compatible:
enum:
- google,gs201-decon
- google,zuma-decon
- google,zumapro-decon
oneOf:
- enum:
- google,gs201-decon
- google,zuma-decon
- google,zumapro-decon
- items:
- const: google,gs101-decon
- const: google,gs201-decon

reg:
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ properties:
- const: google,gs201-dsim
- items:
- enum:
- google,gs101-dsim
- google,zuma-dsim
- google,zumapro-dsim
- const: google,gs201-dsim
Expand Down
5 changes: 5 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -8498,6 +8498,11 @@ S: Maintained
F: Documentation/devicetree/bindings/display/panel/samsung,s6e3ha8.yaml
F: drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c

DRM DRIVER FOR SAMSUNG S6E3HC3 PANELS
M: saiththerobo <the.tom.sharp@gmail.com>
S: Maintained
F: drivers/gpu/drm/panel/panel-samsung-s6e3hc3.c

DRM DRIVER FOR SAMSUNG S6E8FC0 PANELS
M: Yedaya Katsman <yedaya.ka@gmail.com>
S: Maintained
Expand Down
49 changes: 49 additions & 0 deletions arch/arm64/boot/dts/exynos/google/gs101-raven.dts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@
constant-charge-voltage-max-microvolt = <4450000>;
constant-charge-current-max-microamp = <1466730>;
};

reserved-memory {
/*
* Scanout buffers for gs-decon: DPP0 takes 32-bit addresses and
* the DPU SysMMU is bypassed (as on cheetah). Five 1440x3120
* XRGB8888 buffers; reusable while unused.
*/
display_pool: display-pool {
compatible = "shared-dma-pool";
reusable;
size = <0x5c00000>;
alignment = <0x0 0x200000>;
/* Not in 3.75-4 GiB: DPP0's reads from 0xf2c00000+ hung silently */
alloc-ranges = <0x0 0xa0000000 0x40000000>;
};
};
};

&acpm_ipc {
Expand Down Expand Up @@ -155,6 +171,25 @@
status = "okay";
};

/* The display: gs-decon takes over the bootloader's pipeline from simpledrm */
&decon0 {
memory-region = <&display_pool>, <&cont_splash_mem>;
memory-region-names = "pool", "boot-framebuffer";
status = "okay";
};

&dsi0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

/* brightness, display on/off and 60/120 Hz; the bootloader runs it */
panel@0 {
compatible = "samsung,s6e3hc3";
reg = <0>;
};
};

&framebuffer0 {
width = <1440>;
height = <3120>;
Expand Down Expand Up @@ -342,3 +377,17 @@
cirrus,boost-ctl-microvolt = <7500000>;
};
};

/*
* The panel's rails (the framebuffer's vci and vddi supplies). simpledrm
* holds them; when gs-decon takes the display over, simpledrm goes away and
* releases them, the panel lost power and DECON stalled on its first flip.
* The S6E3HC3 driver doesn't switch them, so they stay on.
*/
&s2mpg10_ldo22m {
regulator-always-on;
};

&s2mpg11_bucka {
regulator-always-on;
};
42 changes: 42 additions & 0 deletions arch/arm64/boot/dts/exynos/google/gs101.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,48 @@
clocks = <&cmu_dpu CLK_GOUT_DPU_SYSREG_DPU_PCLK>;
};

/*
* The display pipeline as the bootloader leaves it running:
* DECON0 in DSI command mode, scanning out through the DPP0
* read DMA, into DSIM0 (Google's gs101-drm-dpu.dtsi). No
* power-domains: nothing may power the DPU down under DECON.
*/
decon0: display-controller@1c300000 {
compatible = "google,gs101-decon", "google,gs201-decon";
reg = <0x1c300000 0x6000>, <0x1c0b0000 0x1000>;
reg-names = "main", "dma";
interrupts = <GIC_SPI 338 IRQ_TYPE_LEVEL_HIGH 0>,
<GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH 0>,
<GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH 0>;
interrupt-names = "frame_start", "frame_done", "extra";
clocks = <&acpm_ipc GS101_CLK_ACPM_DVFS_MIF>,
<&acpm_ipc GS101_CLK_ACPM_DVFS_DISP>;
clock-names = "mif", "disp";
status = "disabled";

port {
decon0_out: endpoint {
remote-endpoint = <&dsi0_in>;
};
};
};

dsi0: dsi@1c2c0000 {
compatible = "google,gs101-dsim", "google,gs201-dsim";
reg = <0x1c2c0000 0x300>,
<0x1c2e0100 0x700>,
<0x1c2e0000 0x100>;
reg-names = "dsi", "dphy", "dphy-extra";
interrupts = <GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH 0>;
status = "disabled";

port {
dsi0_in: endpoint {
remote-endpoint = <&decon0_out>;
};
};
};

gpu: gpu@1c500000 {
compatible = "google,gs101-mali", "arm,mali-valhall-jm";
reg = <0x1c500000 0x5000>;
Expand Down
68 changes: 63 additions & 5 deletions drivers/gpu/drm/google/gs-decon.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
*
* Register layout from Google's GPL display driver
* (google-modules/display/samsung/cal_9845/regs-decon.h and regs-dpp.h),
* which gs201 shares with gs101. G3 and G4 offsets and the fourteen-window
* mask follow cal_9865/regs-decon.h and regs-dpp.h in the same GPL driver,
* which builds that CAL for both.
* which gs201 shares with gs101. On gs101 only DECON0's address and the
* interrupt numbers differ (device tree). G3 and G4 offsets and the
* fourteen-window mask follow cal_9865/regs-decon.h and regs-dpp.h in the
* same GPL driver, which builds that CAL for both.
*/

#include <linux/aperture.h>
Expand All @@ -53,6 +54,7 @@
#include <linux/of_graph.h>
#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
Expand Down Expand Up @@ -268,6 +270,10 @@ struct gs_decon_soc_data {
bool start_hw_trigger;
/* the bootloader leaves MIF and DISP above the 120 Hz floors */
bool floors_optional;
/* hold the boot framebuffer's aperture after evicting simpledrm */
bool hold_boot_fb;
/* a VT switch around system sleep only with the fbdev console */
bool vt_switch_fbdev_only;
};

static const struct gs_decon_soc_data gs201_decon_data = {
Expand All @@ -278,6 +284,20 @@ static const struct gs_decon_soc_data gs201_decon_data = {
.shadow_update_mask = SHD_REG_UP_REQ_FLIP(SHD_REG_UP_REQ_ALL_WIN),
};

/*
* gs101 is gs201's DECON; the boot framebuffer and sleep handling below were
* found and tested on raven only, so they stay off for gs201.
*/
static const struct gs_decon_soc_data gs101_decon_data = {
.modes = gs_decon_modes,
.num_modes = ARRAY_SIZE(gs_decon_modes),
.image_size_reg = RDMA_IMG_SIZE,
.source_offset_reg = RDMA_SRC_OFFSET,
.shadow_update_mask = SHD_REG_UP_REQ_FLIP(SHD_REG_UP_REQ_ALL_WIN),
.hold_boot_fb = true,
.vt_switch_fbdev_only = true,
};

static const struct gs_decon_soc_data zumapro_decon_data = {
.modes = tegu_decon_modes,
.num_modes = ARRAY_SIZE(tegu_decon_modes),
Expand Down Expand Up @@ -331,6 +351,8 @@ struct gs_decon {

/* optional ACPM DVFS domains, floors at 120 Hz */
struct clk *mif;
/* MIF before any 120 Hz floor, put back when the floor goes */
unsigned long mif_rest;
struct clk *disp;

/* the link and panel, for rate switching; NULL: 60 Hz only */
Expand Down Expand Up @@ -706,6 +728,17 @@ static void gs_decon_set_floors(struct gs_decon *dc, unsigned int hz)
if (ret)
dev_warn(dc->dev, "DISP floor for %u Hz: %d\n", hz, ret);

/*
* Nothing else votes on MIF yet, so without this it would stay at the
* 120 Hz floor after every 120 Hz stint, screen off included.
*/
if (!high && dc->mif_rest && clk_get_rate(dc->mif) > dc->mif_rest) {
ret = clk_set_rate(dc->mif, dc->mif_rest);
if (ret)
dev_warn(dc->dev, "MIF back to %lu Hz: %d\n",
dc->mif_rest, ret);
}

if (high)
dev_dbg(dc->dev, "MIF %lu Hz, DISP %lu Hz\n",
clk_get_rate(dc->mif), clk_get_rate(dc->disp));
Expand Down Expand Up @@ -1468,8 +1501,10 @@ static int gs_decon_probe(struct platform_device *pdev)
dc->disp = devm_clk_get_optional(dev, "disp");
if (IS_ERR(dc->disp))
return dev_err_probe(dev, PTR_ERR(dc->disp), "disp clock\n");
if (dc->mif)
dev_info(dev, "MIF at %lu Hz\n", clk_get_rate(dc->mif));
if (dc->mif) {
dc->mif_rest = clk_get_rate(dc->mif);
dev_info(dev, "MIF at %lu Hz\n", dc->mif_rest);
}
if (dc->disp)
dev_info(dev, "DISP at %lu Hz\n", clk_get_rate(dc->disp));

Expand Down Expand Up @@ -1518,6 +1553,17 @@ static int gs_decon_probe(struct platform_device *pdev)
gs_decon_driver.name);
if (ret)
goto err_irqs;
/*
* and keep it: on raven simpledrm probed 30 ms after us, found the
* aperture free and stayed as a second, phantom output. Holding the
* range makes its own acquire fail with -EBUSY.
*/
if (dc->soc->hold_boot_fb) {
ret = devm_aperture_acquire_for_platform_device(pdev, dc->boot_fb.start,
resource_size(&dc->boot_fb));
if (ret)
goto err_irqs;
}

dc->kms = true;
ret = drm_dev_register(&dc->drm, 0);
Expand All @@ -1531,6 +1577,15 @@ static int gs_decon_probe(struct platform_device *pdev)
*/
if (fbdev)
drm_client_setup(&dc->drm, NULL);

/*
* Without an fbdev console, a VT switch around system sleep has
* nothing to show, and it costs the compositor its input devices:
* logind takes the session away and gives it back, and the key press
* that woke the phone is lost with the device it was queued on.
*/
if (dc->soc->vt_switch_fbdev_only)
pm_vt_switch_required(dev, fbdev);
dev_info(dev, "flip-only KMS on DECON0, %ux%u, up to %u Hz (at %u Hz)\n",
dc->width, dc->height, dc->max_hz, dc->hz);

Expand All @@ -1549,6 +1604,8 @@ static void gs_decon_remove(struct platform_device *pdev)
struct gs_decon *dc = platform_get_drvdata(pdev);

if (dc->kms) {
if (dc->soc->vt_switch_fbdev_only)
pm_vt_switch_unregister(&pdev->dev);
dc->going_down = true;
drm_dev_unplug(&dc->drm);
drm_atomic_helper_shutdown(&dc->drm);
Expand Down Expand Up @@ -1579,6 +1636,7 @@ static void gs_decon_shutdown(struct platform_device *pdev)
}

static const struct of_device_id gs_decon_of_match[] = {
{ .compatible = "google,gs101-decon", .data = &gs101_decon_data },
{ .compatible = "google,gs201-decon", .data = &gs201_decon_data },
{ .compatible = "google,zuma-decon", .data = &zuma_decon_data },
{ .compatible = "google,zumapro-decon", .data = &zumapro_decon_data },
Expand Down
12 changes: 12 additions & 0 deletions drivers/gpu/drm/panel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,18 @@ config DRM_PANEL_SAMSUNG_S6E3HA8
Samsung AMB577PX01 (found in the Samsung S9 smartphone)


config DRM_PANEL_SAMSUNG_S6E3HC3
tristate "Samsung S6E3HC3 DSI command mode panel"
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
help
Say Y or M here to control the Samsung S6E3HC3 command-mode AMOLED
panel in the Google Pixel 6 Pro: its brightness through a backlight
device, and display on and off. The panel is used as the bootloader
left it running: the driver sends no initialisation sequence, and
the display modes come from the display controller's driver.

config DRM_PANEL_SAMSUNG_S6E3HC4
tristate "Samsung S6E3HC4 DSI command mode panel"
depends on GPIOLIB
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/panel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3FC2X01) += panel-samsung-s6e3fc2x01.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3FC3) += panel-samsung-s6e3fc3.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA8) += panel-samsung-s6e3ha8.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HC3) += panel-samsung-s6e3hc3.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HC4) += panel-samsung-s6e3hc4.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o
Expand Down
Loading