Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db962818 authored by Arun kumar's avatar Arun kumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: Add SPI display driver



Add Mdp3 and display SPI interface driver to support SPI panel,
since limited by SPI rate, the current max fps only reach to
27fps and only support RGB565.

Change-Id: Id452b70ed51c1f29aef7b89c1d2f54214c3a7b37
Signed-off-by: default avatarArun kumar <akanak@codeaurora.org>
parent 43a526a7
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. mdss-spi-client

mdss-spi-client is for SPI display to send the FB data to SPI master.

Required properties:
- compatible : should be "qcom,mdss-spi-client"
- spi-max-frequency : Maximum SPI clocking speed of device in Hz

Optional properties:
- label: A string used to describe the controller used.
- spi-cpol : Boolean property indicating device requires inverse
  clock polarity (CPOL) mode
- spi-cpha :  Empty property indicating device requires shifted
  clock phase (CPHA) mode
- spi-cs-high :  Empty property indicating device requires
  chip select active high

Example:
spi@78b9000 { /* BLSP1 QUP5 */
	qcom,mdss_spi_client {
		reg = <0>;
		compatible = "qcom,mdss-spi-client";
		label = "MDSS SPI QUP5 CLIENT";
		spi-max-frequency = <50000000>;
	};
};
+203 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. mdss-spi-panel

mdss-spi-panel is a SPI panel device which supports panels that
are compatible with display serial interface specification.

Required properties:
- qcom,mdss-spi-panel-controller:	Specifies the phandle for the SPI controller that
					this panel will be mapped to.
- qcom,mdss-spi-panel-width:		Specifies panel width in pixels.
- qcom,mdss-spi-panel-height:		Specifies panel height in pixels.
- qcom,mdss-spi-bpp:			Specifies the panel bits per pixels.
					3  = for rgb111
					8  = for rgb332
					12 = for rgb444
					16 = for rgb565
					18 = for rgb666
					24 = for rgb888
- qcom,mdss-spi-panel-destination:	A string that specifies the destination display for the panel.
					"display_1" = DISPLAY_1
					"display_2" = DISPLAY_2
- qcom,mdss-spi-on-command:		A byte stream formed by multiple packets
					byte 0: wait number of specified ms after command
						 transmitted
					byte 1: 8 bits length in network byte order
					byte 3 and beyond: number byte of payload
- qcom,mdss-spi-off-command:		A byte stream formed by multiple packets
					byte 0: wait number of specified ms after command
						 transmitted
					byte 1: 8 bits length in network byte order
					byte 3 and beyond: number byte of payload
Optional properties:
- qcom,mdss-spi-panel-name:		A string used as a descriptive name of the panel
- qcom,cont-splash-enabled:		Boolean used to enable continuous splash mode.
					If this property is specified, it is required to
					to specify the memory reserved for the splash
					screen using the qcom,memblock-reserve binding
					for the framebuffer device attached to the panel.
- qcom,mdss-spi-h-back-porch:		Horizontal back porch value in pixels.
					6 = default value.
- qcom,mdss-spi-h-front-porch:		Horizontal front porch value in pixels.
					6 = default value.
- qcom,mdss-spi-h-pulse-width:		Horizontal pulse width.
					2 = default value.
- qcom,mdss-spi-h-sync-skew:		Horizontal sync skew value.
					0 = default value.
- qcom,mdss-spi-v-back-porch:		Vertical back porch value in pixels.
					6 = default value.
- qcom,mdss-spi-v-front-porch:		Vertical front porch value in pixels.
					6 = default value.
- qcom,mdss-spi-v-pulse-width:		Vertical pulse width.
					2 = default value.
- qcom,mdss-spi-bl-pmic-control-type:	A string that specifies the implementation of backlight
					control for this panel.
					"bl_ctrl_pwm" = Backlight controlled by PWM gpio.
					"bl_ctrl_wled" = Backlight controlled by WLED.
					other: Unknown backlight control. (default)
- qcom,mdss-spi-bl-min-level:		Specifies the min backlight level supported by the panel.
					0 = default value.
- qcom,mdss-spi-bl-max-level:		Specifies the max backlight level supported by the panel.
					255 = default value.
- qcom,mdss-spi-panel-framerate:	Specifies the frame rate for the panel.
- qcom,esd-check-enabled:		Boolean used to enable ESD recovery feature.
- qcom,mdss-spi-panel-status-check-mode:Specifies the panel status check method for ESD recovery.
					"send_init_command" = send init code to recover panel status.
					"reg_read" = Read register value to check the panel status.
- qcom,mdss-spi-panel-status-reg:Unsigned 8bits integer value to specifies the value
					of panel status register address.
- qcom,mdss-spi-panel-status-read-length:Unsigned 8bits integer value that specifies
					the expected read-back length of the panel register.
- qcom,mdss-spi-panel-status-value:An unsigned 8bits integer araray that specifies the
					values of the panel status register which is used to
					check the panel status.
					The size of this array is specified by
					qcom,mdss-dsi-panel-status-read-length.

Example:
&mdss_mdp {
	spi_gc9305_qvga_cmd: qcom,mdss_spi_gc9305_qvga_cmd {
		qcom,mdss-spi-panel-name = "gc9305 qvga command mode spi panel";
		qcom,mdss-spi-panel-destination = "display_1";
		qcom,mdss-spi-panel-controller = <&mdss_spi>;
		qcom,mdss-spi-panel-framerate = <30>;
		qcom,mdss-spi-panel-width = <240>;
		qcom,mdss-spi-panel-height = <320>;
		qcom,mdss-spi-h-front-porch = <79>;
		qcom,mdss-spi-h-back-porch = <59>;
		qcom,mdss-spi-h-pulse-width = <60>;
		qcom,mdss-spi-v-back-porch = <10>;
		qcom,mdss-spi-v-front-porch = <7>;
		qcom,mdss-spi-v-pulse-width = <2>;
		qcom,mdss-spi-h-left-border = <0>;
		qcom,mdss-spi-h-right-border = <0>;
		qcom,mdss-spi-v-top-border = <0>;
		qcom,mdss-spi-v-bottom-border = <0>;
		qcom,mdss-spi-bpp = <16>;
		qcom,mdss-spi-on-command = [00 01 FE
			00 01 EF
			00 02 36 48
			00 02 3A 05
			00 02 35 00
			00 03 A4 44 44
			00 03 A5 42 42
			00 03 AA 88 88
			00 03 E8 12 40
			00 03 E3 01 10
			00 02 FF 61
			00 02 AC 00
			00 03 A6 2A 2A
			00 03 A7 2B 2B
			00 03 A8 18 18
			00 03 A9 2A 2A
			00 02 AD 33
			00 02 AF 55
			00 02 AE 2B
			00 05 2A 00 00 00 EF
			00 05 2B 00 00 01 3F
			00 01 2C
			00 07 F0 02 02 00 08 0C 10
			00 07 F1 01 00 00 14 1D 0E
			00 07 F2 10 09 37 04 04 48
			00 07 F3 10 0B 3F 05 05 4E
			00 07 F4 0D 19 17 1D 1E 0F
			00 07 F5 06 12 13 1A 1B 0F
			78 01 11
			00 01 29
			00 01 2C];
		qcom,mdss-spi-off-command = [20 01 28
			20 01 10];
		qcom,mdss-spi-bl-min-level = <1>;
		qcom,mdss-spi-bl-max-level = <4095>;
		qcom,esd-check-enabled;
		qcom,mdss-spi-panel-status-check-mode = "reg_read";
		qcom,mdss-spi-panel-status-reg = /bits/ 8 <0x09>;
		qcom,mdss-spi-panel-status-read-length = <4>;
		qcom,mdss-spi-panel-status-value = /bits/ 8 <0x52 0x29 0x83 0x00>;
	};
};

mdss-spi-display is a spi interface display which support send frame
data and command to panel, compatible with SPI interface specification.

Required properties:
- compatible:	This property applies to SPI panels only.
			compatible = "qcom,mdss-spi-display".
- vdd-supply:	Phandle for vdd regulator device node.
- vddio-supply:	Phandle for vdd-io regulator device node.
- qcom,mdss-fb-map:	pHandle that specifies the framebuffer to which the interface is mapped.
- qcom,mdss-mdp:	pHandle that specifies the mdss-mdp device.
- qcom,panel-supply-entries:	A node that lists the elements of the supply used to
				power the DSI panel. There can be more than one instance
				of this binding, in which case the entry would be appended
				with the supply entry index. For a detailed description
				fields in the supply entry, refer to the qcom,ctrl-supply-entries
				binding above.
- qcom,platform-spi-dc-gpio: 	Pull down this gpio indicate current package is command,
				Pull up this gpio indicate current package is parameter or pixels.

Optional properties:
- label:A string used to describe the controller used.
	-- qcom,supply-name: name of the supply (vdd/vdda/vddio)
	-- qcom,supply-min-voltage: minimum voltage level (uV)
	-- qcom,supply-max-voltage: maximum voltage level (uV)
	-- qcom,supply-enable-load: load drawn (uA) from enabled supply
	-- qcom,supply-disable-load: load drawn (uA) from disabled supply
	-- qcom,supply-pre-on-sleep: time to sleep (ms) before turning on
	-- qcom,supply-post-on-sleep: time to sleep (ms) after turning on
	-- qcom,supply-pre-off-sleep: time to sleep (ms) before turning off
	-- qcom,supply-post-off-sleep: time to sleep (ms) after turning off

Example:
	mdss_spi: qcom,mdss_spi {
		compatible = "qcom,mdss-spi-display";
		label = "mdss spi panel";

		qcom,mdss-fb-map = <&mdss_fb0>;
		qcom,mdss-mdp = <&mdss_mdp>;
		vdd-supply = <&pm8909_l17>;
		vddio-supply = <&pm8909_l6>;
		qcom,platform-spi-dc-gpio = <&msm_gpio 110 0>;

		qcom,panel-supply-entries {
			#address-cells = <1>;
			#size-cells = <0>;

			qcom,panel-supply-entry@0 {
				reg = <0>;
				qcom,supply-name = "vdd";
				qcom,supply-min-voltage = <2850000>;
				qcom,supply-max-voltage = <2850000>;
				qcom,supply-enable-load = <100000>;
				qcom,supply-disable-load = <100>;
			};

			qcom,panel-supply-entry@1 {
				reg = <1>;
				qcom,supply-name = "vddio";
				qcom,supply-min-voltage = <1800000>;
				qcom,supply-max-voltage = <1800000>;
				qcom,supply-enable-load = <100000>;
				qcom,supply-disable-load = <100>;
			};
		};
	};
+10 −0
Original line number Diff line number Diff line
@@ -82,6 +82,16 @@ config FB_MSM_MDSS_HDMI_MHL_SII8334
	MHL (Mobile High-Definition Link) technology
	uses USB connector to output HDMI content

config FB_MSM_MDSS_SPI_PANEL
        depends on FB_MSM_MDSS
        bool "Support SPI panel feature"
        default n
        ---help---
        The MDSS SPI Panel provides support for transmittimg SPI signals of
        MDSS frame buffer data to connected panel. Limited by SPI rate, the
        current max fps only reach to 27 fps, and limited by MDP hardware
        architecture only supply on MDP3

config FB_MSM_MDSS_MHL3
	depends on FB_MSM_MDSS_HDMI_PANEL
	bool "MHL3 SII8620 Support"
+5 −0
Original line number Diff line number Diff line
@@ -46,6 +46,11 @@ mdss-dsi-objs += mdss_dsi_clk.o
obj-$(CONFIG_FB_MSM_MDSS) += mdss-dsi.o
obj-$(CONFIG_FB_MSM_MDSS) += mdss_panel.o

ifeq ($(CONFIG_SPI_QUP), y)
obj-$(CONFIG_FB_MSM_MDSS_SPI_PANEL) += mdss_spi_client.o
obj-$(CONFIG_FB_MSM_MDSS_SPI_PANEL) += mdss_spi_panel.o
endif

ifneq ($(CONFIG_FB_MSM_MDSS_MDP3), y)
obj-$(CONFIG_FB_MSM_MDSS) += mdss_hdmi_util.o
obj-$(CONFIG_FB_MSM_MDSS) += mdss_hdmi_edid.o
+77 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include "mdss_dsi.h"
#include "mdp3_ctrl.h"
#include "mdss_spi_panel.h"

/*
 * mdp3_check_te_status() - Check the status of panel for TE based ESD.
@@ -165,3 +166,79 @@ void mdp3_check_dsi_ctrl_status(struct work_struct *work,
	mdss_fb_report_panel_dead(pdsi_status->mfd);
}

#if defined(CONFIG_FB_MSM_MDSS_SPI_PANEL)
void mdp3_check_spi_panel_status(struct work_struct *work, uint32_t interval)
{
	struct dsi_status_data *pdsi_status = NULL;
	struct mdss_panel_data *pdata = NULL;
	struct spi_panel_data *ctrl_pdata = NULL;
	struct mdp3_session_data *mdp3_session = NULL;
	int ret = 0;

	pdsi_status = container_of(to_delayed_work(work),
			struct dsi_status_data, check_status);

	if (!pdsi_status || !(pdsi_status->mfd)) {
		pr_err("%s: mfd not available\n", __func__);
		return;
	}

	pdata = dev_get_platdata(&pdsi_status->mfd->pdev->dev);
	if (!pdata) {
		pr_err("%s: panel data not available\n", __func__);
		return;
	}

	ctrl_pdata = container_of(pdata, struct spi_panel_data, panel_data);
	if (!ctrl_pdata || !ctrl_pdata->check_status) {
		pr_err("%s: Dsi ctrl or status_check callback not available\n",
				__func__);
		return;
	}

	mdp3_session = pdsi_status->mfd->mdp.private1;
	if (!mdp3_session) {
		pr_err("%s: Display is off\n", __func__);
		return;
	}

	if (mdp3_session->in_splash_screen) {
		schedule_delayed_work(&pdsi_status->check_status,
			msecs_to_jiffies(interval));
		pr_debug("%s: cont splash is on\n", __func__);
		return;
	}

	mutex_lock(&mdp3_session->lock);
	if (!mdp3_session->status) {
		pr_debug("%s: display off already\n", __func__);
		mutex_unlock(&mdp3_session->lock);
		return;
	}

	if (!ret)
		ret = ctrl_pdata->check_status(ctrl_pdata);
	else
		pr_err("%s:wait_for_dma_done error\n", __func__);
	mutex_unlock(&mdp3_session->lock);

	if (mdss_fb_is_power_on_interactive(pdsi_status->mfd)) {
		if (ret > 0) {
			schedule_delayed_work(&pdsi_status->check_status,
				msecs_to_jiffies(interval));
		} else {
			char *envp[2] = {"PANEL_ALIVE=0", NULL};

			pdata->panel_info.panel_dead = true;
			ret = kobject_uevent_env(
			&pdsi_status->mfd->fbi->dev->kobj, KOBJ_CHANGE, envp);
			pr_err("%s:panel has gone bad, sending uevent - %s\n",
			 __func__, envp[0]);
		}
	}
}
#else
void mdp3_check_spi_panel_status(struct work_struct *work, uint32_t interval)
{
}
#endif
Loading