Skip to contentSkip to conversation

picodlp projector driver

PATCH Superseded Mayuresh Janorkar 2 participants 19 messages Apr 18, 2011 – Apr 26, 2011

Subsystems (4)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover picodlp projector driver

picodlp projector is supported by OMAP.
OMAP4430 SDP and EVM boards have an on board projector called as picodlp projector. picodlp would be connected to display sub system as a display panel.

The panel would be connected using 24 bit parallel interface. It is a WVGA panel with 864 X 480 resolution.

To know more about picodlp please visit:
http://omappedia.org/wiki/PicoDLP_projector_guide

picodlp is muxed with DSI2 so we can either use secondary LCD or picodlp. So the channel used is OMAP_DSS_CHANNEL_LCD2.

GPIO pin settings are also required and are done in board file. Configuartion of picodlp involves passing number of commands through i2c. All these commands are defined in a panel header file.

About DLP (Digital Light Processing):
DLP is Texas Instruments award-winning display technology which has powered the worlds top projectors and displays, delivering pictures rich with color, contrast, clarity and brightness to screens of all sizes.
Every DLP chip features an array of up to 2.2 million microscopic mirrors that switch at ultra high speeds an innovative advantage that remains cutting edge and ideal for current and future applications alike. The results are high-resolution, highly reliable, razor-sharp images, that even work with fast motion video.
To learn more about DLP technology, please visit www.DLP.com

picodlp on OMAP4430 boards would make use of same technology. picodlp makes use of i2c bus device at 0x1b address for sending configuration commands to panel. In software picodlp panel driver has an i2c client.

To know more about picodlp configuration commands please visit:
http://focus.ti.com/lit/ug/dlpu002a/dlpu002a.pdf
The link talks more about the timing specific things:
http://focus.ti.com/lit/ds/dlps019b/dlps019b.pdf

To know more about i2c_client model please visit:
http://lxr.linux.no/#linux+v2.6.38/Documentation/i2c/writing-clients

------------------------------------------------------------------------------
These patches have been developed on top of master branch of Tomi's gitorious tree.

I am maintaining a gitorious tree for these patches and can be found at:
http://gitorious.org/~mayuresh/linux-omap-dss2/mayuresh-picodlp/commits/picodlp

The driver has been tested when compiled as a module.

Validated with a Penguin logos on OMAP4430 SDP ES2.1

Checkpatch.pl warnings: Nil
New compilation warnings introduced: Nil
-----------------------------------------------------------------------------

Mayuresh Janorkar (3):
OMAP: DSS: Adding a header file for picodlp panel data
OMAP: DSS: Add i2c client driver for picodlp
OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file

Mythri P K (4):
OMAP: DSS: Adding a picodlp panel header file
OMAP: DSS: Adding a picodlp panel driver
OMAP: DSS: Adding initialization routine to picodlp panel
OMAP4: DSS: Adding picodlp panel entry in Kconfig and Makefile

 arch/arm/mach-omap2/board-4430sdp.c             |   40 ++
 arch/arm/plat-omap/include/plat/panel-picodlp.h |   25 +
 drivers/video/omap2/displays/Kconfig            |    7 +
 drivers/video/omap2/displays/Makefile           |    1 +
 drivers/video/omap2/displays/panel-picodlp.c    |  667 +++++++++++++++++++++++
 drivers/video/omap2/displays/panel-picodlp.h    |  287 ++++++++++
 6 files changed, 1027 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/panel-picodlp.h
 create mode 100644 drivers/video/omap2/displays/panel-picodlp.c
 create mode 100644 drivers/video/omap2/displays/panel-picodlp.h
#1 lore raw

PATCH 1/7 OMAP: DSS: Adding a header file for picodlp panel data

picodlp is a TI projector panel supported by OMAP
picodlp makes use of i2c interface for transferring commands to the panel panel data is required for identifying i2c_adapter id and dlp GPIOs

A new header file has been added for panel data and picodlp_panel_data struct has been introduced

---
 arch/arm/plat-omap/include/plat/panel-picodlp.h |   25 +++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/panel-picodlp.h
arch/arm/plat-omap/include/plat/panel-picodlp.h new file +25 -0
new file mode 100644
index 0000000..89ac4b9
@@ -0,0 +1,25 @@
+/*
+ * panel data for picodlp panel
+ *
+ * Copyright (C) 2011 Texas Instruments
+ *
+ * Author: Mayuresh Janorkar <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ARCH_ARM_PLAT_PANEL_PICODLP_H
+#define __ARCH_ARM_PLAT_PANEL_PICODLP_H
+/**
+ * struct : picodlp panel data
+ * picodlp_adapter_id:	i2c_adapter number for picodlp
+ */
+struct picodlp_panel_data {
+	int picodlp_adapter_id;
+	int phy_reset_gpio;
+	int ready_reset_gpio;
+	int park_gpio;
+	int display_sel_gpio;
+};
+#endif /* __ARCH_ARM_PLAT_PANEL_PICODLP_H */
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/7 OMAP: DSS: Adding a picodlp panel header file

In reply to Mayuresh Janorkar

From: Mythri P K <[email protected]>

picodlp is a projector panel connected supported by OMAP.

The panel requires various commands for configurations defined together in this header file.
To know more about commands please visit:
http://focus.ti.com/lit/ug/dlpu002a/dlpu002a.pdf

---
 drivers/video/omap2/displays/panel-picodlp.h |  287 ++++++++++++++++++++++++++
 1 files changed, 287 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap2/displays/panel-picodlp.h
drivers/video/omap2/displays/panel-picodlp.h new file +287 -0
new file mode 100644
index 0000000..1c0bab4
@@ -0,0 +1,287 @@
+/*
+ * Header file required by picodlp panel driver
+ *
+ * Copyright (C) 2009-2011 Texas Instruments
+ * Author: Mythri P K <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __OMAP2_DISPLAY_PANEL_PICODLP_H
+#define __OMAP2_DISPLAY_PANEL_PICODLP_H
+
+/* Commands used for configuring picodlp panel */
+
+#define MAIN_STATUS			0x03
+#define PBC_CONTROL			0x08
+#define INPUT_SOURCE			0x0B
+#define INPUT_RESOLUTION		0x0C
+#define DATA_FORMAT			0x0D
+#define IMG_ROTATION			0x0E
+#define LONG_FLIP			0x0F
+#define SHORT_FLIP			0x10
+#define TEST_PAT_SELECT			0x11
+#define R_DRIVE_CURRENT			0x12
+#define G_DRIVE_CURRENT			0x13
+#define B_DRIVE_CURRENT			0x14
+#define READ_REG_SELECT			0x15
+#define RGB_DRIVER_ENABLE		0x16
+
+#define CPU_IF_MODE			0x18
+#define FRAME_RATE			0x19
+#define CPU_IF_SYNC_METHOD		0x1A
+#define CPU_IF_SOF			0x1B
+#define CPU_IF_EOF			0x1C
+#define CPU_IF_SLEEP			0x1D
+
+#define SEQUENCE_MODE			0x1E
+#define SOFT_RESET			0x1F
+#define FRONT_END_RESET			0x21
+#define AUTO_PWR_ENABLE			0x22
+
+#define VSYNC_LINE_DELAY		0x23
+#define CPU_PI_HORIZ_START		0x24
+#define CPU_PI_VERT_START		0x25
+#define CPU_PI_HORIZ_WIDTH		0x26
+#define CPU_PI_VERT_HEIGHT		0x27
+
+#define PIXEL_MASK_CROP			0x28
+#define CROP_FIRST_LINE			0x29
+#define CROP_LAST_LINE			0x2A
+#define CROP_FIRST_PIXEL		0x2B
+#define CROP_LAST_PIXEL			0x2C
+#define DMD_PARK_TRIGGER		0x2D
+
+#define MISC_REG			0x30
+
+/* AGC registers */
+#define AGC_CTRL			0x50
+#define AGC_CLIPPED_PIXS		0x55
+#define AGC_BRIGHT_PIXS			0x56
+#define AGC_BG_PIXS			0x57
+#define AGC_SAFETY_MARGIN		0x17
+
+/* Color Coordinate Adjustment registers */
+#define CCA_ENABLE		0x5E
+#define CCA_C1A			0x5F
+#define CCA_C1B			0x60
+#define CCA_C1C			0x61
+#define CCA_C2A			0x62
+#define CCA_C2B			0x63
+#define CCA_C2C			0x64
+#define CCA_C3A			0x65
+#define CCA_C3B			0x66
+#define CCA_C3C			0x67
+#define CCA_C7A			0x71
+#define CCA_C7B			0x72
+#define CCA_C7C			0x73
+
+/**
+ * DLP Pico Processor 2600 comes with flash
+ * We can do DMA operations from flash for accessing Look Up Tables
+ */
+#define FLASH_ADDR_BYTES		0x74
+#define FLASH_DUMMY_BYTES		0x75
+#define FLASH_WRITE_BYTES		0x76
+#define FLASH_READ_BYTES		0x77
+#define FLASH_OPCODE			0x78
+#define FLASH_START_ADDR		0x79
+#define FLASH_DUMMY2			0x7A
+#define FLASH_WRITE_DATA		0x7B
+
+#define TEMPORAL_DITH_DISABLE		0x7E
+#define SEQ_CONTROL			0x82
+#define SEQ_VECTOR			0x83
+
+/* DMD is Digital Micromirror Device */
+#define DMD_BLOCK_COUNT			0x84
+#define DMD_VCC_CONTROL			0x86
+#define DMD_PARK_PULSE_COUNT		0x87
+#define DMD_PARK_PULSE_WIDTH		0x88
+#define DMD_PARK_DELAY			0x89
+#define DMD_SHADOW_ENABLE		0x8E
+#define SEQ_STATUS			0x8F
+#define FLASH_CLOCK_CONTROL		0x98
+#define DMD_PARK			0x2D
+
+#define SDRAM_BIST_ENABLE		0x46
+#define DDR_DRIVER_STRENGTH		0x9A
+#define SDC_ENABLE			0x9D
+#define SDC_BUFF_SWAP_DISABLE		0xA3
+#define CURTAIN_CONTROL			0xA6
+#define DDR_BUS_SWAP_ENABLE		0xA7
+#define DMD_TRC_ENABLE			0xA8
+#define DMD_BUS_SWAP_ENABLE		0xA9
+
+#define ACTGEN_ENABLE			0xAE
+#define ACTGEN_CONTROL			0xAF
+#define ACTGEN_HORIZ_BP			0xB0
+#define ACTGEN_VERT_BP			0xB1
+
+/* Look Up Table access */
+#define CMT_SPLASH_LUT_START_ADDR	0xFA
+#define CMT_SPLASH_LUT_DEST_SELECT	0xFB
+#define CMT_SPLASH_LUT_DATA		0xFC
+#define SEQ_RESET_LUT_START_ADDR	0xFD
+#define SEQ_RESET_LUT_DEST_SELECT	0xFE
+#define SEQ_RESET_LUT_DATA		0xFF
+
+/* Input source definitions */
+#define PARALLEL_RGB		0
+#define INT_TEST_PATTERN	1
+#define SPLASH_SCREEN		2
+#define CPU_INTF		3
+#define BT656			4
+
+/* Standard input resolution definitions */
+#define QWVGA_LANDSCAPE		3	/* (427h*240v) */
+#define WVGA_864_LANDSCAPE	21	/* (864h*480v) */
+#define WVGA_DMD_OPTICAL_TEST	35	/* (608h*684v) */
+
+/* Standard data format definitions */
+#define RGB565			0
+#define RGB666			1
+#define RGB888			2
+
+/* Test Pattern definitions */
+#define TPG_CHECKERBOARD	0
+#define TPG_BLACK		1
+#define TPG_WHITE		2
+#define TPG_RED			3
+#define TPG_BLUE		4
+#define TPG_GREEN		5
+#define TPG_VLINES_BLACK	6
+#define TPG_HLINES_BLACK	7
+#define TPG_VLINES_ALT		8
+#define TPG_HLINES_ALT		9
+#define TPG_DIAG_LINES		10
+#define TPG_GREYRAMP_VERT	11
+#define TPG_GREYRAMP_HORIZ	12
+#define TPG_ANSI_CHECKERBOARD	13
+
+/* sequence mode definitions */
+#define SEQ_FREE_RUN		0
+#define SEQ_LOCK		1
+
+/* curtain color definitions */
+#define CURTAIN_BLACK		0
+#define CURTAIN_RED		1
+#define CURTAIN_GREEN		2
+#define CURTAIN_BLUE		3
+#define CURTAIN_YELLOW		4
+#define CURTAIN_MAGENTA		5
+#define CURTAIN_CYAN		6
+#define CURTAIN_WHITE		7
+
+/* LUT definitions */
+#define CMT_LUT_NONE		0
+#define CMT_LUT_GREEN		1
+#define CMT_LUT_RED		2
+#define CMT_LUT_BLUE		3
+#define CMT_LUT_ALL		4
+#define SPLASH_LUT		5
+
+#define SEQ_LUT_NONE		0
+#define SEQ_DRC_LUT_0		1
+#define SEQ_DRC_LUT_1		2
+#define SEQ_DRC_LUT_2		3
+#define SEQ_DRC_LUT_3		4
+#define SEQ_SEQ_LUT		5
+#define SEQ_DRC_LUT_ALL		6
+#define WPC_PROGRAM_LUT		7
+
+#define BITSTREAM_START_ADDR		0x00000000
+#define BITSTREAM_SIZE			0x00040000
+
+#define WPC_FW_0_START_ADDR		0x00040000
+#define WPC_FW_0_SIZE			0x00000ce8
+
+#define SEQUENCE_0_START_ADDR		0x00044000
+#define SEQUENCE_0_SIZE			0x00001000
+
+#define SEQUENCE_1_START_ADDR		0x00045000
+#define SEQUENCE_1_SIZE			0x00000d10
+
+#define SEQUENCE_2_START_ADDR		0x00046000
+#define SEQUENCE_2_SIZE			0x00000d10
+
+#define SEQUENCE_3_START_ADDR		0x00047000
+#define SEQUENCE_3_SIZE			0x00000d10
+
+#define SEQUENCE_4_START_ADDR		0x00048000
+#define SEQUENCE_4_SIZE			0x00000d10
+
+#define SEQUENCE_5_START_ADDR		0x00049000
+#define SEQUENCE_5_SIZE			0x00000d10
+
+#define SEQUENCE_6_START_ADDR		0x0004a000
+#define SEQUENCE_6_SIZE			0x00000d10
+
+#define CMT_LUT_0_START_ADDR		0x0004b200
+#define CMT_LUT_0_SIZE			0x00000600
+
+#define CMT_LUT_1_START_ADDR		0x0004b800
+#define CMT_LUT_1_SIZE			0x00000600
+
+#define CMT_LUT_2_START_ADDR		0x0004be00
+#define CMT_LUT_2_SIZE			0x00000600
+
+#define CMT_LUT_3_START_ADDR		0x0004c400
+#define CMT_LUT_3_SIZE			0x00000600
+
+#define CMT_LUT_4_START_ADDR		0x0004ca00
+#define CMT_LUT_4_SIZE			0x00000600
+
+#define CMT_LUT_5_START_ADDR		0x0004d000
+#define CMT_LUT_5_SIZE			0x00000600
+
+#define CMT_LUT_6_START_ADDR		0x0004d600
+#define CMT_LUT_6_SIZE			0x00000600
+
+#define DRC_TABLE_0_START_ADDR		0x0004dc00
+#define DRC_TABLE_0_SIZE		0x00000100
+
+#define SPLASH_0_START_ADDR		0x0004dd00
+#define SPLASH_0_SIZE			0x00032280
+
+#define SEQUENCE_7_START_ADDR		0x00080000
+#define SEQUENCE_7_SIZE			0x00000d10
+
+#define SEQUENCE_8_START_ADDR		0x00081800
+#define SEQUENCE_8_SIZE			0x00000d10
+
+#define SEQUENCE_9_START_ADDR		0x00083000
+#define SEQUENCE_9_SIZE			0x00000d10
+
+#define CMT_LUT_7_START_ADDR		0x0008e000
+#define CMT_LUT_7_SIZE			0x00000600
+
+#define CMT_LUT_8_START_ADDR		0x0008e800
+#define CMT_LUT_8_SIZE			0x00000600
+
+#define CMT_LUT_9_START_ADDR		0x0008f000
+#define CMT_LUT_9_SIZE			0x00000600
+
+#define SPLASH_1_START_ADDR		0x0009a000
+#define SPLASH_1_SIZE			0x00032280
+
+#define SPLASH_2_START_ADDR		0x000cd000
+#define SPLASH_2_SIZE			0x00032280
+
+#define SPLASH_3_START_ADDR		0x00100000
+#define SPLASH_3_SIZE			0x00032280
+
+#define OPT_SPLASH_0_START_ADDR		0x00134000
+#define OPT_SPLASH_0_SIZE		0x000cb100
+
+#endif
Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/7 OMAP: DSS: Adding a picodlp panel driver

In reply to Mayuresh Janorkar

From: Mythri P K <[email protected]>

A projector panel named picodlp is supported by OMAP. panel driver is required to be added with the name picodlp_panel.

It is a WVGA panel with resolution 864 X 480 and panel timing data is defined in the panel driver.

picodlp makes use of parallel (DPI) interface multiplexed with secondary lcd in case of OMAP4.

---
 drivers/video/omap2/displays/panel-picodlp.c |  228 ++++++++++++++++++++++++++
 1 files changed, 228 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap2/displays/panel-picodlp.c
drivers/video/omap2/displays/panel-picodlp.c new file +228 -0
new file mode 100644
index 0000000..4f12903
@@ -0,0 +1,228 @@
+/*
+ * picodlp panel driver
+ *
+ * Copyright (C) 2009-2011 Texas Instruments
+ * Author: Mythri P K <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/input.h>
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
+#include <linux/firmware.h>
+#include <linux/slab.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+
+#include <plat/display.h>
+#include <plat/panel-picodlp.h>
+
+struct picodlp_data {
+	struct mutex lock;
+};
+
+static struct omap_video_timings pico_ls_timings = {
+	.x_res		= 864,
+	.y_res		= 480,
+	.hsw		= 7,
+	.hfp		= 11,
+	.hbp		= 7,
+
+	.pixel_clock	= 19200,
+
+	.vsw		= 2,
+	.vfp		= 3,
+	.vbp		= 14,
+};
+
+static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
+{
+	int r;
+
+	if (dssdev->platform_enable) {
+		r = dssdev->platform_enable(dssdev);
+		if (r)
+			return r;
+	}
+
+	r = omapdss_dpi_display_enable(dssdev);
+	if (r) {
+		dev_err(&dssdev->dev, "failed to enable DPI\n");
+		goto err;
+	}
+	/* after enabling, wait for some initialize sync interrupts */
+	msleep(675);
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+	return 0;
+
+err:
+	if (dssdev->platform_disable)
+		dssdev->platform_disable(dssdev);
+
+	return r;
+}
+
+static void picodlp_panel_power_off(struct omap_dss_device *dssdev)
+{
+	omapdss_dpi_display_disable(dssdev);
+
+	if (dssdev->platform_disable)
+		dssdev->platform_disable(dssdev);
+}
+
+static int picodlp_panel_probe(struct omap_dss_device *dssdev)
+{
+	struct picodlp_data *picod;
+
+	dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_ONOFF |
+				OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IVS;
+	dssdev->panel.acb = 0x0;
+	dssdev->panel.timings = pico_ls_timings;
+
+	picod =  kzalloc(sizeof(struct picodlp_data), GFP_KERNEL);
+	if (!picod)
+		return -ENOMEM;
+
+	mutex_init(&picod->lock);
+	dev_set_drvdata(&dssdev->dev, picod);
+	return 0;
+}
+
+static void picodlp_panel_remove(struct omap_dss_device *dssdev)
+{
+	struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
+
+	dev_set_drvdata(&dssdev->dev, NULL);
+	dev_dbg(&dssdev->dev, " removing picodlp panel\n");
+	kfree(picod);
+}
+
+static int picodlp_panel_enable(struct omap_dss_device *dssdev)
+{
+	struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
+	int r;
+
+	dev_dbg(&dssdev->dev, "enabling picodlp panel\n");
+
+	mutex_lock(&picod->lock);
+	if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
+		mutex_unlock(&picod->lock);
+		return -EINVAL;
+	}
+
+	r = picodlp_panel_power_on(dssdev);
+	mutex_unlock(&picod->lock);
+
+	return r;
+}
+
+static void picodlp_panel_disable(struct omap_dss_device *dssdev)
+{
+	struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
+
+	mutex_lock(&picod->lock);
+	/* Turn off DLP Power */
+	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
+		picodlp_panel_power_off(dssdev);
+
+	dev_dbg(&dssdev->dev, " disabling picodlp panel\n");
+	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
+	mutex_unlock(&picod->lock);
+}
+
+static int picodlp_panel_suspend(struct omap_dss_device *dssdev)
+{
+	struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
+
+	mutex_lock(&picod->lock);
+	/* Turn off DLP Power */
+	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
+		dev_dbg(&dssdev->dev, " unable to suspend picodlp panel,"\
+						" panel is not ACTIVE\n");
+		mutex_unlock(&picod->lock);
+		return -EINVAL;
+	}
+
+	picodlp_panel_power_off(dssdev);
+
+	dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
+	dev_dbg(&dssdev->dev, " suspending picodlp panel\n");
+
+	mutex_unlock(&picod->lock);
+	return 0;
+}
+
+static int picodlp_panel_resume(struct omap_dss_device *dssdev)
+{
+	struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
+	int r;
+
+	mutex_lock(&picod->lock);
+	if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) {
+		dev_dbg(&dssdev->dev, " unable to resume picodlp panel,"
+					" panel is not ACTIVE\n");
+		mutex_unlock(&picod->lock);
+		return -EINVAL;
+	}
+
+	dev_dbg(&dssdev->dev, " resuming picodlp panel\n");
+	r = picodlp_panel_power_on(dssdev);
+	mutex_unlock(&picod->lock);
+
+	return r;
+}
+
+static void picodlp_get_resolution(struct omap_dss_device *dssdev,
+					u16 *xres, u16 *yres)
+{
+	*xres = dssdev->panel.timings.x_res;
+	*yres = dssdev->panel.timings.y_res;
+}
+
+static struct omap_dss_driver picodlp_driver = {
+	.probe		= picodlp_panel_probe,
+	.remove		= picodlp_panel_remove,
+
+	.enable		= picodlp_panel_enable,
+	.disable	= picodlp_panel_disable,
+
+	.get_resolution	= picodlp_get_resolution,
+
+	.suspend	= picodlp_panel_suspend,
+	.resume		= picodlp_panel_resume,
+
+	.driver		= {
+		.name	= "picodlp_panel",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init picodlp_init(void)
+{
+	return omap_dss_register_driver(&picodlp_driver);
+}
+
+static void __exit picodlp_exit(void)
+{
+	omap_dss_unregister_driver(&picodlp_driver);
+}
+
+module_init(picodlp_init);
+module_exit(picodlp_exit);
+
+MODULE_AUTHOR("Mythri P K <[email protected]>");
+MODULE_DESCRIPTION("picodlp driver");
+MODULE_LICENSE("GPL");
Signature · 1 line
1.7.1
#7 lore raw

PATCH 4/7 OMAP: DSS: Add i2c client driver for picodlp

In reply to Mayuresh Janorkar

The configurations and data transfer with picodlp panel happens through i2c. An i2c client with name "picodlp_i2c_driver" is registered inside panel.

---
 drivers/video/omap2/displays/panel-picodlp.c |  130 +++++++++++++++++++++++++-
 1 files changed, 126 insertions(+), 4 deletions(-)
drivers/video/omap2/displays/panel-picodlp.c +126 -4
index 4f12903..e361674 100644
@@ -1,8 +1,10 @@
 /*
  * picodlp panel driver
+ * picodlp_i2c_driver: i2c_client driver
  *
  * Copyright (C) 2009-2011 Texas Instruments
  * Author: Mythri P K <[email protected]>
+ * Mayuresh Janorkar <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published by
@@ -23,13 +25,29 @@
 #include <linux/firmware.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
+#include <linux/i2c.h>
 #include <linux/delay.h>
+#include <linux/gpio.h>
 
 #include <plat/display.h>
 #include <plat/panel-picodlp.h>
 
+#define DRIVER_NAME	"picodlp_i2c_driver"
 struct picodlp_data {
 	struct mutex lock;
+	struct i2c_client *picodlp_i2c_client;
+};
+
+static struct i2c_board_info picodlp_i2c_board_info = {
+	I2C_BOARD_INFO("picodlp_i2c_driver", 0x1b),
+};
+
+struct picodlp_i2c_data {
+	struct mutex xfer_lock;
+};
+
+struct i2c_device_id picodlp_i2c_id[] = {
+	{ "picodlp_i2c_driver", 0 },
 };
 
 static struct omap_video_timings pico_ls_timings = {
@@ -46,9 +64,57 @@ static struct omap_video_timings pico_ls_timings = {
 	.vbp		= 14,
 };
 
+static inline struct picodlp_panel_data
+		*get_panel_data(const struct omap_dss_device *dssdev)
+{
+	return (struct picodlp_panel_data *) dssdev->data;
+}
+
+static int picodlp_i2c_probe(struct i2c_client *client,
+		const struct i2c_device_id *id)
+{
+	struct picodlp_i2c_data *picodlp_i2c_data;
+
+	picodlp_i2c_data = kzalloc(sizeof(struct picodlp_i2c_data), GFP_KERNEL);
+
+	if (!picodlp_i2c_data)
+		return -ENOMEM;
+
+	i2c_set_clientdata(client, picodlp_i2c_data);
+
+	return 0;
+}
+
+static int picodlp_i2c_remove(struct i2c_client *client)
+{
+	struct picodlp_i2c_data *picodlp_i2c_data =
+					i2c_get_clientdata(client);
+
+	kfree(picodlp_i2c_data);
+	i2c_unregister_device(client);
+	return 0;
+}
+
+static struct i2c_driver picodlp_i2c_driver = {
+	.driver = {
+		.name	= "picodlp_i2c_driver",
+	},
+	.probe		= picodlp_i2c_probe,
+	.remove		= picodlp_i2c_remove,
+	.id_table	= picodlp_i2c_id,
+};
+
 static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 {
-	int r;
+	int r = 0;
+	struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
+	struct picodlp_panel_data *picodlp_pdata;
+	struct picodlp_i2c_data *picodlp_i2c_data;
+
+	picodlp_pdata = get_panel_data(dssdev);
+	gpio_set_value(picodlp_pdata->display_sel_gpio, 1);
+	gpio_set_value(picodlp_pdata->park_gpio, 1);
+	gpio_set_value(picodlp_pdata->phy_reset_gpio, 1);
 
 	if (dssdev->platform_enable) {
 		r = dssdev->platform_enable(dssdev);
@@ -65,8 +131,10 @@ static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 	msleep(675);
 	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
-	return 0;
+	picodlp_i2c_data =
+		i2c_get_clientdata(picod->picodlp_i2c_client);
 
+	return r;
 err:
 	if (dssdev->platform_disable)
 		dssdev->platform_disable(dssdev);
@@ -85,6 +153,11 @@ static void picodlp_panel_power_off(struct omap_dss_device *dssdev)
 static int picodlp_panel_probe(struct omap_dss_device *dssdev)
 {
 	struct picodlp_data *picod;
+	struct picodlp_panel_data *picodlp_pdata;
+	struct i2c_adapter *adapter;
+	struct i2c_client *picodlp_i2c_client;
+	struct picodlp_i2c_data *picodlp_i2c_data;
+	int r = 0, picodlp_adapter_id;
 
 	dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_ONOFF |
 				OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IVS;
@@ -96,8 +169,38 @@ static int picodlp_panel_probe(struct omap_dss_device *dssdev)
 		return -ENOMEM;
 
 	mutex_init(&picod->lock);
+
+	picodlp_pdata = get_panel_data(dssdev);
+	picodlp_adapter_id = picodlp_pdata->picodlp_adapter_id;
+
+	adapter = i2c_get_adapter(picodlp_adapter_id);
+	if (!adapter) {
+		dev_err(&dssdev->dev, "can't get i2c adapter\n");
+		r = -ENODEV;
+		goto err;
+	}
+
+	picodlp_i2c_client = i2c_new_device(adapter, &picodlp_i2c_board_info);
+	/* wait till i2c device creation is done */
+	msleep(700);
+	if (!picodlp_i2c_client) {
+		dev_err(&dssdev->dev, "can't add i2c device::"
+					 " picodlp_i2c_client is NULL\n");
+		r = -ENODEV;
+		goto err;
+	}
+
+	picod->picodlp_i2c_client = picodlp_i2c_client;
+
+	picodlp_i2c_data =
+		i2c_get_clientdata(picod->picodlp_i2c_client);
+
+	mutex_init(&picodlp_i2c_data->xfer_lock);
 	dev_set_drvdata(&dssdev->dev, picod);
-	return 0;
+	return r;
+err:
+	kfree(picod);
+	return r;
 }
 
 static void picodlp_panel_remove(struct omap_dss_device *dssdev)
@@ -131,6 +234,11 @@ static int picodlp_panel_enable(struct omap_dss_device *dssdev)
 static void picodlp_panel_disable(struct omap_dss_device *dssdev)
 {
 	struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
+	struct picodlp_panel_data *picodlp_pdata;
+
+	picodlp_pdata = get_panel_data(dssdev);
+	gpio_set_value(picodlp_pdata->phy_reset_gpio, 0);
+	gpio_set_value(picodlp_pdata->park_gpio, 0);
 
 	mutex_lock(&picod->lock);
 	/* Turn off DLP Power */
@@ -212,11 +320,25 @@ static struct omap_dss_driver picodlp_driver = {
 
 static int __init picodlp_init(void)
 {
-	return omap_dss_register_driver(&picodlp_driver);
+	int r = 0;
+
+	r = i2c_add_driver(&picodlp_i2c_driver);
+	if (r < 0) {
+		printk(KERN_WARNING DRIVER_NAME
+			" driver registration failed\n");
+		return r;
+	}
+
+	r = omap_dss_register_driver(&picodlp_driver);
+	if (r)
+		i2c_del_driver(&picodlp_i2c_driver);
+
+	return r;
 }
 
 static void __exit picodlp_exit(void)
 {
+	i2c_del_driver(&picodlp_i2c_driver);
 	omap_dss_unregister_driver(&picodlp_driver);
 }
 
Signature · 1 line
1.7.1
#11 lore raw

PATCH 5/7 OMAP: DSS: Adding initialization routine to picodlp panel

In reply to Mayuresh Janorkar

From: Mythri P K <[email protected]>

picodlp_i2c_client needs to send commands over i2c as a part of initialiazation. system controller dlp pico processor dpp2600 is used.
It configures the splash screen of picodlp using a sequence of commands. A programmer's guide is available at:
http://focus.ti.com/lit/ug/dlpu002a/dlpu002a.pdf

API is defined for sending command over i2c as an i2c_write operation.

---
 drivers/video/omap2/displays/panel-picodlp.c |  317 ++++++++++++++++++++++++++
 1 files changed, 317 insertions(+), 0 deletions(-)
drivers/video/omap2/displays/panel-picodlp.c +317 -0
index e361674..785e406 100644
@@ -32,7 +32,15 @@
 #include <plat/display.h>
 #include <plat/panel-picodlp.h>
 
+#include "panel-picodlp.h"
+
 #define DRIVER_NAME	"picodlp_i2c_driver"
+
+/* This defines the minit of data which is allowed into single write block */
+#define MAX_I2C_WRITE_BLOCK_SIZE	32
+#define PICO_MAJOR			1 /* 2 bits */
+#define PICO_MINOR			1 /* 2 bits */
+
 struct picodlp_data {
 	struct mutex lock;
 	struct i2c_client *picodlp_i2c_client;
@@ -50,6 +58,11 @@ struct i2c_device_id picodlp_i2c_id[] = {
 	{ "picodlp_i2c_driver", 0 },
 };
 
+struct picodlp_i2c_command {
+	u8 reg;
+	u32 value;
+};
+
 static struct omap_video_timings pico_ls_timings = {
 	.x_res		= 864,
 	.y_res		= 480,
@@ -70,6 +83,305 @@ static inline struct picodlp_panel_data
 	return (struct picodlp_panel_data *) dssdev->data;
 }
 
+static int picodlp_i2c_write_block(struct i2c_client *client,
+					u8 *data, int len)
+{
+	struct i2c_msg msg;
+	int i, r;
+
+	struct picodlp_i2c_data *picodlp_i2c_data = i2c_get_clientdata(client);
+
+	if (len < 1 || len > MAX_I2C_WRITE_BLOCK_SIZE) {
+		dev_err(&client->dev,
+			"too long syn_write_block len %d\n", len);
+		return -EIO;
+	}
+
+	mutex_lock(&picodlp_i2c_data->xfer_lock);
+
+	msg.addr = client->addr;
+	msg.flags = 0;
+	msg.len = len;
+	msg.buf = data;
+
+	r = i2c_transfer(client->adapter, &msg, 1);
+	mutex_unlock(&picodlp_i2c_data->xfer_lock);
+
+	if (r == 1) {
+		for (i = 0; i < len; i++)
+			dev_dbg(&client->dev,
+				"addr %x bw 0x%02x[%d]: 0x%02x\n",
+				client->addr, data[0] + i, i, data[i]);
+		return 0;
+	}
+
+	dev_err(&client->dev, " picodlp_i2c_write error\n");
+	return r;
+}
+
+static int picodlp_i2c_write(struct i2c_client *client, u8 reg, u32 value)
+{
+	u8 data[5];
+
+	data[0] = reg;
+	data[1] = (value & 0xFF000000) >> 24;
+	data[2] = (value & 0x00FF0000) >> 16;
+	data[3] = (value & 0x0000FF00) >> 8;
+	data[4] = (value & 0x000000FF);
+
+	return picodlp_i2c_write_block(client, data, 5);
+}
+
+static int picodlp_i2c_write_array(struct i2c_client *client,
+			const struct picodlp_i2c_command commands[],
+			int count)
+{
+	int i, r = 0;
+	for (i = 0; i < count; i++) {
+		r = picodlp_i2c_write(client, commands[i].reg,
+						commands[i].value);
+		if (r)
+			return r;
+	}
+	return r;
+}
+
+/**
+ * picodlp_dpp2600_flash_dma - return parameter as 0 on success or error code
+ * Configure datapath for splash image operation
+ * dpp2600 : digitally programmable potentiometer
+ * It is a system controller used for picodlp
+ *
+ * @client:		i2c_client required for operations
+ * @flash_address:	splash image to be loaded from flash
+ * @flash_num_bytes:	size in bytes for flash
+ * @cmt_seqz:		select mailbox to load data to
+ *			0 = sequence/DRC,
+ *			1 = CMT/splash
+ * @table_number:	table_number to load flash
+ *
+ * @return
+ *		0	-	no errors
+ *		-ENXIO	- invalid flash address specified
+ *		-EINVAL - invalid mailbox specified OR invalid table_number
+ *				OR mailbox combination
+ */
+static int picodlp_dpp2600_flash_dma(struct i2c_client *client,
+		int flash_address, int flash_num_bytes, int cmt_seqz,
+		int table_number)
+{
+	int mailbox_address, mailbox_select;
+	int r = 0;
+
+	/* check argument validity */
+	if (flash_address > 0x1fffff)
+		return -ENXIO;
+
+	if ((cmt_seqz > 1) || (cmt_seqz == 0 && table_number > 6) ||
+				(cmt_seqz == 1 && table_number > 5))
+		return -EINVAL;
+
+	/* set mailbox parameters */
+	if (cmt_seqz) {
+		mailbox_address = CMT_SPLASH_LUT_START_ADDR;
+		mailbox_select = CMT_SPLASH_LUT_DEST_SELECT;
+	} else {
+		mailbox_address = SEQ_RESET_LUT_START_ADDR;
+		mailbox_select = SEQ_RESET_LUT_DEST_SELECT;
+	}
+
+	/* configure DMA from flash to LUT */
+	r = picodlp_i2c_write(client, PBC_CONTROL, 0);
+	if (r)
+		return r;
+
+	 r = picodlp_i2c_write(client, FLASH_START_ADDR, flash_address);
+	 if (r)
+		return r;
+
+	 r = picodlp_i2c_write(client, FLASH_READ_BYTES, flash_num_bytes);
+	if (r)
+		return r;
+
+	r = picodlp_i2c_write(client, mailbox_address, 0);
+	if (r)
+		return r;
+
+	r = picodlp_i2c_write(client, mailbox_select, table_number);
+	if (r)
+		return r;
+
+	/* transfer control to flash controller */
+	r = picodlp_i2c_write(client, PBC_CONTROL, 1);
+	if (r)
+		return r;
+
+	/**
+	 * wait for control transfer
+	 * this usually takes close to 5ms
+	 */
+	msleep(5);
+
+	/* return register access to i2c client */
+	 r = picodlp_i2c_write(client, PBC_CONTROL, 0);
+	 if (r)
+		return r;
+
+	/* close LUT access */
+	 r = picodlp_i2c_write(client, mailbox_select, 0);
+	 if (r)
+		return r;
+
+	return 0;
+}
+
+/**
+ * picodlp_dpp2600_config_rgb: returns 0 on success and error code on failure
+ * Configure datapath for parallel RGB operation
+ * dpp2600 : digitally programmable potentiometer
+ * It is a system controller used for picodlp
+ *
+ * @client: i2c_client:		i2c_client required for communication
+ * @return:
+ *			0	: Success, no error
+ *		 error code	: Failure
+ */
+static int picodlp_dpp2600_config_rgb(struct i2c_client *client)
+{
+	int r = 0;
+
+	static const struct picodlp_i2c_command config_commands[] = {
+		{SEQ_CONTROL, 0}, {ACTGEN_CONTROL, 0x10},
+		{SEQUENCE_MODE, SEQ_LOCK}, {DATA_FORMAT, RGB888},
+		{INPUT_RESOLUTION, WVGA_864_LANDSCAPE},
+		{INPUT_SOURCE, PARALLEL_RGB}, {CPU_IF_SYNC_METHOD, 1},
+		{SEQ_CONTROL, 1}
+	};
+
+	r = picodlp_i2c_write_array(client, config_commands,
+					ARRAY_SIZE(config_commands));
+	return r;
+}
+
+/**
+ * picodlp_dpp2600_config_splash returns 0 on success and
+ *					error code in case of failure
+ * Configure datapath for splash image operation
+ * dpp2600 : digitally programmable potentiometer
+ * It is a system controller used for picodlp
+ *
+ * @return
+ *		0	- no errors
+ *		-EINVAL - invalid image_number specified
+ */
+static int picodlp_dpp2600_config_splash(struct i2c_client *client)
+{
+	int r;
+
+	static const struct picodlp_i2c_command splash_cmd[] = {
+		{SEQ_CONTROL, 0}, {SEQUENCE_MODE, SEQ_FREE_RUN},
+		{DATA_FORMAT, RGB565}, {INPUT_RESOLUTION, QWVGA_LANDSCAPE},
+		{INPUT_SOURCE, SPLASH_SCREEN}
+	};
+
+	r = picodlp_i2c_write_array(client, splash_cmd,
+					ARRAY_SIZE(splash_cmd));
+	if (r)
+		return r;
+
+	r = picodlp_dpp2600_flash_dma(client, SPLASH_1_START_ADDR,
+					SPLASH_1_SIZE, 1, SPLASH_LUT);
+	if (r)
+		return r;
+
+	/* turn image back on */
+	r = picodlp_i2c_write(client, SEQ_CONTROL, 1);
+	if (r)
+		return r;
+
+	return 0;
+}
+
+/**
+ * picodlp_i2c_init:	i2c_initialization routine
+ * client:	i2c_client for communication
+ *
+ * @return
+ *		0	: Success, no error
+ *	error code	: Failure
+ */
+static int picodlp_i2c_init(struct i2c_client *client)
+{
+	int r;
+	static const struct picodlp_i2c_command init_cmd_set1[] = {
+		{SOFT_RESET, 1}, {DMD_PARK_TRIGGER, 1},
+		{MISC_REG, (PICO_MAJOR << 2 | PICO_MINOR)}, {SEQ_CONTROL, 0},
+		{SEQ_VECTOR, 0x100}, {DMD_BLOCK_COUNT, 7},
+		{DMD_VCC_CONTROL, 0x109}, {DMD_PARK_PULSE_COUNT, 0xA},
+		{DMD_PARK_PULSE_WIDTH, 0xB}, {DMD_PARK_DELAY, 0x2ED},
+		{DMD_SHADOW_ENABLE, 0}, {FLASH_OPCODE, 0xB},
+		{FLASH_DUMMY_BYTES, 1}, {FLASH_ADDR_BYTES, 3},
+	};
+
+	static const struct picodlp_i2c_command init_cmd_set2[] = {
+		{SDC_ENABLE, 1}, {AGC_CTRL, 7},	{CCA_C1A, 0x100},
+		{CCA_C1B, 0x0},	{CCA_C1C, 0x0},	{CCA_C2A, 0x0},
+		{CCA_C2B, 0x100}, {CCA_C2C, 0x0}, {CCA_C3A, 0x0},
+		{CCA_C3B, 0x0},	{CCA_C3C, 0x100}, {CCA_C7A, 0x100},
+		{CCA_C7B, 0x100}, {CCA_C7C, 0x100}, {CCA_ENABLE, 1},
+		{CPU_IF_MODE, 1}, {SHORT_FLIP, 1}, {CURTAIN_CONTROL, 0},
+	};
+
+	static const struct picodlp_i2c_command init_cmd_set3[] = {
+		{DMD_PARK_TRIGGER, 0}, {R_DRIVE_CURRENT, 0x298},
+		{G_DRIVE_CURRENT, 0x298}, {B_DRIVE_CURRENT, 0x298},
+		{RGB_DRIVER_ENABLE, 7},
+	};
+
+	r = picodlp_i2c_write_array(client, init_cmd_set1,
+						ARRAY_SIZE(init_cmd_set1));
+	if (r)
+		return r;
+
+	/* configure DMA from flash to LUT */
+	r = picodlp_dpp2600_flash_dma(client, CMT_LUT_0_START_ADDR,
+					CMT_LUT_0_SIZE, 1, CMT_LUT_ALL);
+	if (r)
+		return r;
+
+	/* SEQ and DRC look-up tables */
+	r = picodlp_dpp2600_flash_dma(client, SEQUENCE_0_START_ADDR,
+					SEQUENCE_0_SIZE, 0, SEQ_SEQ_LUT);
+	if (r)
+		return r;
+
+	r = picodlp_dpp2600_flash_dma(client, DRC_TABLE_0_START_ADDR,
+					DRC_TABLE_0_SIZE, 0, SEQ_DRC_LUT_ALL);
+	if (r)
+		return r;
+
+	r = picodlp_i2c_write_array(client, init_cmd_set2,
+					ARRAY_SIZE(init_cmd_set2));
+	if (r)
+		return r;
+
+	/* display logo splash image */
+	r = picodlp_dpp2600_config_splash(client);
+	if (r)
+		return r;
+
+	r = picodlp_i2c_write_array(client, init_cmd_set3,
+					ARRAY_SIZE(init_cmd_set3));
+	if (r)
+		return r;
+
+	r = picodlp_dpp2600_config_rgb(client);
+	if (r)
+		return r;
+
+	return 0;
+}
+
 static int picodlp_i2c_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
@@ -134,6 +446,11 @@ static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 	picodlp_i2c_data =
 		i2c_get_clientdata(picod->picodlp_i2c_client);
 
+	msleep(700); /* sleep till panel is settled */
+	r = picodlp_i2c_init(picod->picodlp_i2c_client);
+	if (r)
+		goto err;
+
 	return r;
 err:
 	if (dssdev->platform_disable)
Signature · 1 line
1.7.1
#15 lore raw

PATCH 6/7 OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file

In reply to Mayuresh Janorkar

An on-board panel named picodlp projector is available for OMAP4430 SDP.

Entry for this panel is being added in dss_devices in the board file. It also needs 4 GPIO pins and are defined and used in board file. picodlp also needs an i2c client over i2c controller-2 at address 0x1b.

---
 arch/arm/mach-omap2/board-4430sdp.c |   40 +++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-4430sdp.c +40 -0
index 1503f0b..6827612
@@ -38,6 +38,7 @@
 #include <plat/omap4-keypad.h>
 #include <plat/display.h>
 #include <plat/nokia-dsi-panel.h>
+#include <plat/panel-picodlp.h>
 
 #include "mux.h"
 #include "hsmmc.h"
@@ -585,6 +586,7 @@ static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
 		.platform_data = &sdp4430_twldata,
 	},
 };
+
 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("tmp105", 0x48),
@@ -598,6 +600,7 @@ static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
 		I2C_BOARD_INFO("hmc5843", 0x1e),
 	},
 };
+
 static int __init omap4_i2c_init(void)
 {
 	/*
@@ -812,9 +815,45 @@ static struct omap_dss_device sdp4430_hdmi_device = {
 	.channel = OMAP_DSS_CHANNEL_DIGIT,
 };
 
+static struct picodlp_panel_data sdp4430_picodlp_pdata = {
+	.picodlp_adapter_id	= 2,
+	.phy_reset_gpio		= 40,
+	.ready_reset_gpio	= 44,
+	.park_gpio		= 45,
+	.display_sel_gpio	= 59,
+};
+
+static void sdp4430_picodlp_init(void)
+{
+	int status = 0;
+	struct gpio picodlp_gpios[] = {
+		{sdp4430_picodlp_pdata.phy_reset_gpio, GPIOF_OUT_INIT_LOW,
+			"DLP PHY RESET"},
+		{sdp4430_picodlp_pdata.ready_reset_gpio, GPIOF_IN,
+			"DLP REDY RESET"},
+		{sdp4430_picodlp_pdata.park_gpio, GPIOF_INIT_LOW, "DLP PARK"},
+		{sdp4430_picodlp_pdata.display_sel_gpio, GPIOF_OUT_INIT_LOW,
+			"DLP DISPLAY SEL"},
+	};
+
+	status = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios));
+	if (status)
+		pr_err("Cannot request OMAP4_DLP_GPIOs, error %d\n", status);
+}
+
+static struct omap_dss_device sdp4430_picodlp_device = {
+	.name			= "picodlp",
+	.driver_name		= "picodlp_panel",
+	.type			= OMAP_DISPLAY_TYPE_DPI,
+	.phy.dpi.data_lines	= 24,
+	.channel		= OMAP_DSS_CHANNEL_LCD2,
+	.data			= &sdp4430_picodlp_pdata,
+};
+
 static struct omap_dss_device *sdp4430_dss_devices[] = {
 	&sdp4430_lcd_device,
 	&sdp4430_hdmi_device,
+	&sdp4430_picodlp_device,
 };
 
 static struct omap_dss_board_info sdp4430_dss_data = {
@@ -827,6 +866,7 @@ void omap_4430sdp_display_init(void)
 {
 	sdp4430_lcd_init();
 	sdp4430_hdmi_mux_init();
+	sdp4430_picodlp_init();
 	omap_display_init(&sdp4430_dss_data);
 }
 
Signature · 1 line
1.7.1
#18 lore raw

PATCH 7/7 OMAP4: DSS: Adding picodlp panel entry in Kconfig and Makefile

In reply to Mayuresh Janorkar

From: Mythri P K <[email protected]>

A new panel picodlp for OMAP4 has been introduced picodlp is a projector available on OMAP4430SDP and EVM platforms.

---
 drivers/video/omap2/displays/Kconfig  |    7 +++++++
 drivers/video/omap2/displays/Makefile |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/video/omap2/displays/Kconfig +7 -0
index d18ad6b..374c06c 100644
@@ -29,6 +29,13 @@ config PANEL_NEC_NL8048HL11_01B
 		This NEC NL8048HL11-01B panel is TFT LCD
 		used in the Zoom2/3/3630 sdp boards.
 
+config PANEL_PICODLP
+	tristate "OMAP PICO DLP Panel"
+	depends on OMAP2_DSS
+	help
+		Projector Panel used in TI's SDP4430 and EVM boards
+		For more info please visit http://www.dlp.com/projector/
+
 config PANEL_TAAL
         tristate "Taal DSI Panel"
         depends on OMAP2_DSS_DSI
drivers/video/omap2/displays/Makefile +1 -0
index 0f601ab..d90f73c 100644
@@ -4,5 +4,6 @@ obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
 obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o
 
 obj-$(CONFIG_PANEL_TAAL) += panel-taal.o
+obj-$(CONFIG_PANEL_PICODLP) +=  panel-picodlp.o
 obj-$(CONFIG_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o
 obj-$(CONFIG_PANEL_ACX565AKM) += panel-acx565akm.o
Signature · 1 line
1.7.1
#4 lore raw

Re: [PATCH 3/7] OMAP: DSS: Adding a picodlp panel driver

In reply to Mayuresh Janorkar
Quoted 89 lines · Mayuresh Janorkar

From: Mythri P K <[email protected]>

A projector panel named picodlp is supported by OMAP. panel driver is required to be added with the name picodlp_panel.

It is a WVGA panel with resolution 864 X 480 and panel timing data is defined in the panel driver.

picodlp makes use of parallel (DPI) interface multiplexed with secondary lcd in case of OMAP4.

---
 drivers/video/omap2/displays/panel-picodlp.c |  228 ++++++++++++++++++++++++++
 1 files changed, 228 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap2/displays/panel-picodlp.c
drivers/video/omap2/displays/panel-picodlp.c new file +65 -0
new file mode 100644
index 0000000..4f12903
@@ -0,0 +1,228 @@
+/*
+ * picodlp panel driver
+ *
+ * Copyright (C) 2009-2011 Texas Instruments
+ * Author: Mythri P K <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/input.h>
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
+#include <linux/firmware.h>
+#include <linux/slab.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+
+#include <plat/display.h>
+#include <plat/panel-picodlp.h>
+
+struct picodlp_data {
+	struct mutex lock;
+};
+
+static struct omap_video_timings pico_ls_timings = {
+	.x_res		= 864,
+	.y_res		= 480,
+	.hsw		= 7,
+	.hfp		= 11,
+	.hbp		= 7,
+
+	.pixel_clock	= 19200,
+
+	.vsw		= 2,
+	.vfp		= 3,
+	.vbp		= 14,
+};
+
+static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
+{
+	int r;
+
+	if (dssdev->platform_enable) {
+		r = dssdev->platform_enable(dssdev);
+		if (r)
+			return r;
+	}
+
+	r = omapdss_dpi_display_enable(dssdev);
+	if (r) {
+		dev_err(&dssdev->dev, "failed to enable DPI\n");
+		goto err;
+	}
+	/* after enabling, wait for some initialize sync interrupts */
+	msleep(675);

drivers/video/omap2/displays/panel-picodlp.c line 75

Quoted 10 lines
drivers/video/omap2/displays/panel-picodlp.c new file +10 -0
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+	return 0;
+
+err:
+	if (dssdev->platform_disable)
+		dssdev->platform_disable(dssdev);
+
+	return r;
+}

Why is the msleep needed there? It's a huge sleep, and can't find information about it from the documents you gave links to. I think I've asked this three times already.

Also, it's rather strange to sleep at the end of the function. Normally you would sleep between two actions.

Tomi

#8 lore raw

Re: [PATCH 4/7] OMAP: DSS: Add i2c client driver for picodlp

In reply to Mayuresh Janorkar
Quoted 35 lines · Mayuresh Janorkar

The configurations and data transfer with picodlp panel happens through i2c. An i2c client with name "picodlp_i2c_driver" is registered inside panel.

---
 drivers/video/omap2/displays/panel-picodlp.c |  130 +++++++++++++++++++++++++-
 1 files changed, 126 insertions(+), 4 deletions(-)
drivers/video/omap2/displays/panel-picodlp.c +4 -0
index 4f12903..e361674 100644
@@ -1,8 +1,10 @@
 /*
  * picodlp panel driver
+ * picodlp_i2c_driver: i2c_client driver
  *
  * Copyright (C) 2009-2011 Texas Instruments
  * Author: Mythri P K <[email protected]>
+ * Mayuresh Janorkar <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published by
@@ -23,13 +25,29 @@
 #include <linux/firmware.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
+#include <linux/i2c.h>
 #include <linux/delay.h>
+#include <linux/gpio.h>
 
 #include <plat/display.h>
 #include <plat/panel-picodlp.h>

drivers/video/omap2/displays/panel-picodlp.c line 43

Quoted 10 lines
drivers/video/omap2/displays/panel-picodlp.c +7 -0
 
+#define DRIVER_NAME	"picodlp_i2c_driver"
 struct picodlp_data {
 	struct mutex lock;
+	struct i2c_client *picodlp_i2c_client;
+};
+
+static struct i2c_board_info picodlp_i2c_board_info = {
+	I2C_BOARD_INFO("picodlp_i2c_driver", 0x1b),
+};

Can this be const?

drivers/video/omap2/displays/panel-picodlp.c line 51

Quoted 7 lines
drivers/video/omap2/displays/panel-picodlp.c +6 -0
+struct picodlp_i2c_data {
+	struct mutex xfer_lock;
+};
+
+struct i2c_device_id picodlp_i2c_id[] = {
+	{ "picodlp_i2c_driver", 0 },
 };

This should be static. Probably also const.

Quoted 42 lines
drivers/video/omap2/displays/panel-picodlp.c +37 -0
 static struct omap_video_timings pico_ls_timings = {
@@ -46,9 +64,57 @@ static struct omap_video_timings pico_ls_timings = {
 	.vbp		= 14,
 };
 
+static inline struct picodlp_panel_data
+		*get_panel_data(const struct omap_dss_device *dssdev)
+{
+	return (struct picodlp_panel_data *) dssdev->data;
+}
+
+static int picodlp_i2c_probe(struct i2c_client *client,
+		const struct i2c_device_id *id)
+{
+	struct picodlp_i2c_data *picodlp_i2c_data;
+
+	picodlp_i2c_data = kzalloc(sizeof(struct picodlp_i2c_data), GFP_KERNEL);
+
+	if (!picodlp_i2c_data)
+		return -ENOMEM;
+
+	i2c_set_clientdata(client, picodlp_i2c_data);
+
+	return 0;
+}
+
+static int picodlp_i2c_remove(struct i2c_client *client)
+{
+	struct picodlp_i2c_data *picodlp_i2c_data =
+					i2c_get_clientdata(client);
+
+	kfree(picodlp_i2c_data);
+	i2c_unregister_device(client);
+	return 0;
+}
+
+static struct i2c_driver picodlp_i2c_driver = {
+	.driver = {
+		.name	= "picodlp_i2c_driver",
+	},
+	.probe		= picodlp_i2c_probe,
+	.remove		= picodlp_i2c_remove,

drivers/video/omap2/displays/panel-picodlp.c static struct omap_video_timings pico_ls_timings = { · line 112

Quoted 10 lines
drivers/video/omap2/displays/panel-picodlp.c +7 -1
+	.id_table	= picodlp_i2c_id,
+};
+
 static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 {
-	int r;
+	int r = 0;
+	struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
+	struct picodlp_panel_data *picodlp_pdata;
+	struct picodlp_i2c_data *picodlp_i2c_data;

Local variables don't need to be very long. The reader knows this is pico dlp driver, so prepending the variable names with "picodlp_" is quite extra and only make the code more difficult to read.

drivers/video/omap2/displays/panel-picodlp.c static struct omap_video_timings pico_ls_timings = { · line 117

Quoted 4 lines
drivers/video/omap2/displays/panel-picodlp.c +4 -0
+	picodlp_pdata = get_panel_data(dssdev);
+	gpio_set_value(picodlp_pdata->display_sel_gpio, 1);
+	gpio_set_value(picodlp_pdata->park_gpio, 1);
+	gpio_set_value(picodlp_pdata->phy_reset_gpio, 1);

Are these GIOs related to i2c? I can't find these from the DLP documents, at least with these names.

Quoted 34 lines
drivers/video/omap2/displays/panel-picodlp.c +12 -1
 	if (dssdev->platform_enable) {
 		r = dssdev->platform_enable(dssdev);
@@ -65,8 +131,10 @@ static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 	msleep(675);
 	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
-	return 0;
+	picodlp_i2c_data =
+		i2c_get_clientdata(picod->picodlp_i2c_client);
 
+	return r;
 err:
 	if (dssdev->platform_disable)
 		dssdev->platform_disable(dssdev);
@@ -85,6 +153,11 @@ static void picodlp_panel_power_off(struct omap_dss_device *dssdev)
 static int picodlp_panel_probe(struct omap_dss_device *dssdev)
 {
 	struct picodlp_data *picod;
+	struct picodlp_panel_data *picodlp_pdata;
+	struct i2c_adapter *adapter;
+	struct i2c_client *picodlp_i2c_client;
+	struct picodlp_i2c_data *picodlp_i2c_data;
+	int r = 0, picodlp_adapter_id;
 
 	dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_ONOFF |
 				OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IVS;
@@ -96,8 +169,38 @@ static int picodlp_panel_probe(struct omap_dss_device *dssdev)
 		return -ENOMEM;
 
 	mutex_init(&picod->lock);
+
+	picodlp_pdata = get_panel_data(dssdev);
+	picodlp_adapter_id = picodlp_pdata->picodlp_adapter_id;
+

drivers/video/omap2/displays/panel-picodlp.c static int picodlp_panel_probe(struct omap_dss_device *dssdev) · line 185

Quoted 10 lines
drivers/video/omap2/displays/panel-picodlp.c +10 -0
+	adapter = i2c_get_adapter(picodlp_adapter_id);
+	if (!adapter) {
+		dev_err(&dssdev->dev, "can't get i2c adapter\n");
+		r = -ENODEV;
+		goto err;
+	}
+
+	picodlp_i2c_client = i2c_new_device(adapter, &picodlp_i2c_board_info);
+	/* wait till i2c device creation is done */
+	msleep(700);

What is this sleep for? I'm quite sure the device is already created when i2c_new_device() returns.

Tomi

#9 lore raw

Re: [PATCH 4/7] OMAP: DSS: Add i2c client driver for picodlp

In reply to Mayuresh Janorkar
Quoted 9 lines · Mayuresh Janorkar

The configurations and data transfer with picodlp panel happens through i2c. An i2c client with name "picodlp_i2c_driver" is registered inside panel.

---
 drivers/video/omap2/displays/panel-picodlp.c |  130 +++++++++++++++++++++++++-
 1 files changed, 126 insertions(+), 4 deletions(-)

<snip>

drivers/video/omap2/displays/panel-picodlp.c static int picodlp_panel_power_on(struct omap_dss_device *dssdev) · line 135

Quoted 7 lines
drivers/video/omap2/displays/panel-picodlp.c +2 -1
@@ -65,8 +131,10 @@ static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 	msleep(675);
 	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
-	return 0;
+	picodlp_i2c_data =
+		i2c_get_clientdata(picod->picodlp_i2c_client);

This variable is not used at all.

Tomi

#12 lore raw

Re: [PATCH 5/7] OMAP: DSS: Adding initialization routine to picodlp panel

In reply to Mayuresh Janorkar
Quoted 76 lines · Mayuresh Janorkar

From: Mythri P K <[email protected]>

picodlp_i2c_client needs to send commands over i2c as a part of initialiazation. system controller dlp pico processor dpp2600 is used.
It configures the splash screen of picodlp using a sequence of commands. A programmer's guide is available at:
http://focus.ti.com/lit/ug/dlpu002a/dlpu002a.pdf

API is defined for sending command over i2c as an i2c_write operation.

---
 drivers/video/omap2/displays/panel-picodlp.c |  317 ++++++++++++++++++++++++++
 1 files changed, 317 insertions(+), 0 deletions(-)
drivers/video/omap2/displays/panel-picodlp.c +37 -0
index e361674..785e406 100644
@@ -32,7 +32,15 @@
 #include <plat/display.h>
 #include <plat/panel-picodlp.h>
 
+#include "panel-picodlp.h"
+
 #define DRIVER_NAME	"picodlp_i2c_driver"
+
+/* This defines the minit of data which is allowed into single write block */
+#define MAX_I2C_WRITE_BLOCK_SIZE	32
+#define PICO_MAJOR			1 /* 2 bits */
+#define PICO_MINOR			1 /* 2 bits */
+
 struct picodlp_data {
 	struct mutex lock;
 	struct i2c_client *picodlp_i2c_client;
@@ -50,6 +58,11 @@ struct i2c_device_id picodlp_i2c_id[] = {
 	{ "picodlp_i2c_driver", 0 },
 };
 
+struct picodlp_i2c_command {
+	u8 reg;
+	u32 value;
+};
+
 static struct omap_video_timings pico_ls_timings = {
 	.x_res		= 864,
 	.y_res		= 480,
@@ -70,6 +83,305 @@ static inline struct picodlp_panel_data
 	return (struct picodlp_panel_data *) dssdev->data;
 }
 
+static int picodlp_i2c_write_block(struct i2c_client *client,
+					u8 *data, int len)
+{
+	struct i2c_msg msg;
+	int i, r;
+
+	struct picodlp_i2c_data *picodlp_i2c_data = i2c_get_clientdata(client);
+
+	if (len < 1 || len > MAX_I2C_WRITE_BLOCK_SIZE) {
+		dev_err(&client->dev,
+			"too long syn_write_block len %d\n", len);
+		return -EIO;
+	}
+
+	mutex_lock(&picodlp_i2c_data->xfer_lock);
+
+	msg.addr = client->addr;
+	msg.flags = 0;
+	msg.len = len;
+	msg.buf = data;
+
+	r = i2c_transfer(client->adapter, &msg, 1);
+	mutex_unlock(&picodlp_i2c_data->xfer_lock);
+

drivers/video/omap2/displays/panel-picodlp.c static inline struct picodlp_panel_data · line 119

Quoted 10 lines
drivers/video/omap2/displays/panel-picodlp.c +10 -0
+	if (r == 1) {
+		for (i = 0; i < len; i++)
+			dev_dbg(&client->dev,
+				"addr %x bw 0x%02x[%d]: 0x%02x\n",
+				client->addr, data[0] + i, i, data[i]);
+		return 0;
+	}
+
+	dev_err(&client->dev, " picodlp_i2c_write error\n");
+	return r;

This is, at least to my eyes, a bit uncommon way to do this. Usually the error path is handled inside an if(), and the ok path is at the end of the function.

Quoted 195 lines
drivers/video/omap2/displays/panel-picodlp.c +195 -0
+}
+
+static int picodlp_i2c_write(struct i2c_client *client, u8 reg, u32 value)
+{
+	u8 data[5];
+
+	data[0] = reg;
+	data[1] = (value & 0xFF000000) >> 24;
+	data[2] = (value & 0x00FF0000) >> 16;
+	data[3] = (value & 0x0000FF00) >> 8;
+	data[4] = (value & 0x000000FF);
+
+	return picodlp_i2c_write_block(client, data, 5);
+}
+
+static int picodlp_i2c_write_array(struct i2c_client *client,
+			const struct picodlp_i2c_command commands[],
+			int count)
+{
+	int i, r = 0;
+	for (i = 0; i < count; i++) {
+		r = picodlp_i2c_write(client, commands[i].reg,
+						commands[i].value);
+		if (r)
+			return r;
+	}
+	return r;
+}
+
+/**
+ * picodlp_dpp2600_flash_dma - return parameter as 0 on success or error code
+ * Configure datapath for splash image operation
+ * dpp2600 : digitally programmable potentiometer
+ * It is a system controller used for picodlp
+ *
+ * @client:		i2c_client required for operations
+ * @flash_address:	splash image to be loaded from flash
+ * @flash_num_bytes:	size in bytes for flash
+ * @cmt_seqz:		select mailbox to load data to
+ *			0 = sequence/DRC,
+ *			1 = CMT/splash
+ * @table_number:	table_number to load flash
+ *
+ * @return
+ *		0	-	no errors
+ *		-ENXIO	- invalid flash address specified
+ *		-EINVAL - invalid mailbox specified OR invalid table_number
+ *				OR mailbox combination
+ */
+static int picodlp_dpp2600_flash_dma(struct i2c_client *client,
+		int flash_address, int flash_num_bytes, int cmt_seqz,
+		int table_number)
+{
+	int mailbox_address, mailbox_select;
+	int r = 0;
+
+	/* check argument validity */
+	if (flash_address > 0x1fffff)
+		return -ENXIO;
+
+	if ((cmt_seqz > 1) || (cmt_seqz == 0 && table_number > 6) ||
+				(cmt_seqz == 1 && table_number > 5))
+		return -EINVAL;
+
+	/* set mailbox parameters */
+	if (cmt_seqz) {
+		mailbox_address = CMT_SPLASH_LUT_START_ADDR;
+		mailbox_select = CMT_SPLASH_LUT_DEST_SELECT;
+	} else {
+		mailbox_address = SEQ_RESET_LUT_START_ADDR;
+		mailbox_select = SEQ_RESET_LUT_DEST_SELECT;
+	}
+
+	/* configure DMA from flash to LUT */
+	r = picodlp_i2c_write(client, PBC_CONTROL, 0);
+	if (r)
+		return r;
+
+	 r = picodlp_i2c_write(client, FLASH_START_ADDR, flash_address);
+	 if (r)
+		return r;
+
+	 r = picodlp_i2c_write(client, FLASH_READ_BYTES, flash_num_bytes);
+	if (r)
+		return r;
+
+	r = picodlp_i2c_write(client, mailbox_address, 0);
+	if (r)
+		return r;
+
+	r = picodlp_i2c_write(client, mailbox_select, table_number);
+	if (r)
+		return r;
+
+	/* transfer control to flash controller */
+	r = picodlp_i2c_write(client, PBC_CONTROL, 1);
+	if (r)
+		return r;
+
+	/**
+	 * wait for control transfer
+	 * this usually takes close to 5ms
+	 */
+	msleep(5);
+
+	/* return register access to i2c client */
+	 r = picodlp_i2c_write(client, PBC_CONTROL, 0);
+	 if (r)
+		return r;
+
+	/* close LUT access */
+	 r = picodlp_i2c_write(client, mailbox_select, 0);
+	 if (r)
+		return r;
+
+	return 0;
+}
+
+/**
+ * picodlp_dpp2600_config_rgb: returns 0 on success and error code on failure
+ * Configure datapath for parallel RGB operation
+ * dpp2600 : digitally programmable potentiometer
+ * It is a system controller used for picodlp
+ *
+ * @client: i2c_client:		i2c_client required for communication
+ * @return:
+ *			0	: Success, no error
+ *		 error code	: Failure
+ */
+static int picodlp_dpp2600_config_rgb(struct i2c_client *client)
+{
+	int r = 0;
+
+	static const struct picodlp_i2c_command config_commands[] = {
+		{SEQ_CONTROL, 0}, {ACTGEN_CONTROL, 0x10},
+		{SEQUENCE_MODE, SEQ_LOCK}, {DATA_FORMAT, RGB888},
+		{INPUT_RESOLUTION, WVGA_864_LANDSCAPE},
+		{INPUT_SOURCE, PARALLEL_RGB}, {CPU_IF_SYNC_METHOD, 1},
+		{SEQ_CONTROL, 1}
+	};
+
+	r = picodlp_i2c_write_array(client, config_commands,
+					ARRAY_SIZE(config_commands));
+	return r;
+}
+
+/**
+ * picodlp_dpp2600_config_splash returns 0 on success and
+ *					error code in case of failure
+ * Configure datapath for splash image operation
+ * dpp2600 : digitally programmable potentiometer
+ * It is a system controller used for picodlp
+ *
+ * @return
+ *		0	- no errors
+ *		-EINVAL - invalid image_number specified
+ */
+static int picodlp_dpp2600_config_splash(struct i2c_client *client)
+{
+	int r;
+
+	static const struct picodlp_i2c_command splash_cmd[] = {
+		{SEQ_CONTROL, 0}, {SEQUENCE_MODE, SEQ_FREE_RUN},
+		{DATA_FORMAT, RGB565}, {INPUT_RESOLUTION, QWVGA_LANDSCAPE},
+		{INPUT_SOURCE, SPLASH_SCREEN}
+	};
+
+	r = picodlp_i2c_write_array(client, splash_cmd,
+					ARRAY_SIZE(splash_cmd));
+	if (r)
+		return r;
+
+	r = picodlp_dpp2600_flash_dma(client, SPLASH_1_START_ADDR,
+					SPLASH_1_SIZE, 1, SPLASH_LUT);
+	if (r)
+		return r;
+
+	/* turn image back on */
+	r = picodlp_i2c_write(client, SEQ_CONTROL, 1);
+	if (r)
+		return r;
+
+	return 0;
+}
+
+/**
+ * picodlp_i2c_init:	i2c_initialization routine
+ * client:	i2c_client for communication
+ *
+ * @return
+ *		0	: Success, no error
+ *	error code	: Failure
+ */
+static int picodlp_i2c_init(struct i2c_client *client)
+{

drivers/video/omap2/displays/panel-picodlp.c static inline struct picodlp_panel_data · line 324

Quoted 10 lines
drivers/video/omap2/displays/panel-picodlp.c +10 -0
+	int r;
+	static const struct picodlp_i2c_command init_cmd_set1[] = {
+		{SOFT_RESET, 1}, {DMD_PARK_TRIGGER, 1},
+		{MISC_REG, (PICO_MAJOR << 2 | PICO_MINOR)}, {SEQ_CONTROL, 0},
+		{SEQ_VECTOR, 0x100}, {DMD_BLOCK_COUNT, 7},
+		{DMD_VCC_CONTROL, 0x109}, {DMD_PARK_PULSE_COUNT, 0xA},
+		{DMD_PARK_PULSE_WIDTH, 0xB}, {DMD_PARK_DELAY, 0x2ED},
+		{DMD_SHADOW_ENABLE, 0}, {FLASH_OPCODE, 0xB},
+		{FLASH_DUMMY_BYTES, 1}, {FLASH_ADDR_BYTES, 3},
+	};

It would make these command lists clearer if there was only one command per line.

Quoted 37 lines
drivers/video/omap2/displays/panel-picodlp.c +37 -0
+
+	static const struct picodlp_i2c_command init_cmd_set2[] = {
+		{SDC_ENABLE, 1}, {AGC_CTRL, 7},	{CCA_C1A, 0x100},
+		{CCA_C1B, 0x0},	{CCA_C1C, 0x0},	{CCA_C2A, 0x0},
+		{CCA_C2B, 0x100}, {CCA_C2C, 0x0}, {CCA_C3A, 0x0},
+		{CCA_C3B, 0x0},	{CCA_C3C, 0x100}, {CCA_C7A, 0x100},
+		{CCA_C7B, 0x100}, {CCA_C7C, 0x100}, {CCA_ENABLE, 1},
+		{CPU_IF_MODE, 1}, {SHORT_FLIP, 1}, {CURTAIN_CONTROL, 0},
+	};
+
+	static const struct picodlp_i2c_command init_cmd_set3[] = {
+		{DMD_PARK_TRIGGER, 0}, {R_DRIVE_CURRENT, 0x298},
+		{G_DRIVE_CURRENT, 0x298}, {B_DRIVE_CURRENT, 0x298},
+		{RGB_DRIVER_ENABLE, 7},
+	};
+
+	r = picodlp_i2c_write_array(client, init_cmd_set1,
+						ARRAY_SIZE(init_cmd_set1));
+	if (r)
+		return r;
+
+	/* configure DMA from flash to LUT */
+	r = picodlp_dpp2600_flash_dma(client, CMT_LUT_0_START_ADDR,
+					CMT_LUT_0_SIZE, 1, CMT_LUT_ALL);
+	if (r)
+		return r;
+
+	/* SEQ and DRC look-up tables */
+	r = picodlp_dpp2600_flash_dma(client, SEQUENCE_0_START_ADDR,
+					SEQUENCE_0_SIZE, 0, SEQ_SEQ_LUT);
+	if (r)
+		return r;
+
+	r = picodlp_dpp2600_flash_dma(client, DRC_TABLE_0_START_ADDR,
+					DRC_TABLE_0_SIZE, 0, SEQ_DRC_LUT_ALL);
+	if (r)
+		return r;

drivers/video/omap2/displays/panel-picodlp.c static inline struct picodlp_panel_data · line 371

Quoted 10 lines
drivers/video/omap2/displays/panel-picodlp.c +10 -0
+
+	r = picodlp_i2c_write_array(client, init_cmd_set2,
+					ARRAY_SIZE(init_cmd_set2));
+	if (r)
+		return r;
+
+	/* display logo splash image */
+	r = picodlp_dpp2600_config_splash(client);
+	if (r)
+		return r;

So this will show some hardcoded splash screen? How much of the code could be removed if the splash screen feature is removed? I don't see much point in such a feature, and it looks to me that at least two of the functions above are just for the splash screen. It's just extra code for a feature nobody wants.

Quoted 16 lines
drivers/video/omap2/displays/panel-picodlp.c +12 -0
+	r = picodlp_i2c_write_array(client, init_cmd_set3,
+					ARRAY_SIZE(init_cmd_set3));
+	if (r)
+		return r;
+
+	r = picodlp_dpp2600_config_rgb(client);
+	if (r)
+		return r;
+
+	return 0;
+}
+
 static int picodlp_i2c_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {

drivers/video/omap2/displays/panel-picodlp.c static int picodlp_panel_power_on(struct omap_dss_device *dssdev) · line 449

Quoted 4 lines
drivers/video/omap2/displays/panel-picodlp.c +1 -0
@@ -134,6 +446,11 @@ static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 	picodlp_i2c_data =
 		i2c_get_clientdata(picod->picodlp_i2c_client);
 
+	msleep(700); /* sleep till panel is settled */

And another huge sleep. This, unlike the other sleeps, make some sense, as there's an i2c transaction done below.

Somehow I get the feeling that you've just put big sleeps here and there until the driver started working... Can you point me to the documentation that describes the delays required?

Quoted 7 lines
drivers/video/omap2/displays/panel-picodlp.c +4 -0
+	r = picodlp_i2c_init(picod->picodlp_i2c_client);
+	if (r)
+		goto err;
+
 	return r;
 err:
 	if (dssdev->platform_disable)
#16 lore raw

Re: [PATCH 6/7] OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file

In reply to Mayuresh Janorkar
Quoted 24 lines · Mayuresh Janorkar

An on-board panel named picodlp projector is available for OMAP4430 SDP.

Entry for this panel is being added in dss_devices in the board file. It also needs 4 GPIO pins and are defined and used in board file. picodlp also needs an i2c client over i2c controller-2 at address 0x1b.

---
 arch/arm/mach-omap2/board-4430sdp.c |   40 +++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-4430sdp.c +1 -0
index 1503f0b..6827612
@@ -38,6 +38,7 @@
 #include <plat/omap4-keypad.h>
 #include <plat/display.h>
 #include <plat/nokia-dsi-panel.h>
+#include <plat/panel-picodlp.h>
 
 #include "mux.h"
 #include "hsmmc.h"

arch/arm/mach-omap2/board-4430sdp.c static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = { · line 589

Quoted 4 lines
arch/arm/mach-omap2/board-4430sdp.c +1 -0
@@ -585,6 +586,7 @@ static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
 		.platform_data = &sdp4430_twldata,
 	},
 };
+

Unneeded change.

arch/arm/mach-omap2/board-4430sdp.c static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { · line 603

Quoted 8 lines
arch/arm/mach-omap2/board-4430sdp.c +1 -0
 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("tmp105", 0x48),
@@ -598,6 +600,7 @@ static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
 		I2C_BOARD_INFO("hmc5843", 0x1e),
 	},
 };
+

Unneeded change.

Tomi

#5 lore raw

RE: [PATCH 3/7] OMAP: DSS: Adding a picodlp panel driver

In reply to Tomi Valkeinen
Quoted 114 lines

-----Original Message-----
From: Valkeinen, Tomi
Sent: Tuesday, April 19, 2011 4:40 PM
To: Janorkar, Mayuresh
Cc: [email protected]; K, Mythri P
Subject: Re: [PATCH 3/7] OMAP: DSS: Adding a picodlp panel driver

Quoted 9 lines · Mayuresh Janorkar

From: Mythri P K <[email protected]>

A projector panel named picodlp is supported by OMAP. panel driver is required to be added with the name picodlp_panel.

It is a WVGA panel with resolution 864 X 480 and panel timing data is defined in the panel driver.

picodlp makes use of parallel (DPI) interface multiplexed with secondary

lcd

Quoted 6 lines

in case of OMAP4.

---
 drivers/video/omap2/displays/panel-picodlp.c |  228

++++++++++++++++++++++++++

Review

Quoted 4 lines
 1 files changed, 228 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap2/displays/panel-picodlp.c
(quoted diff) +0 -0

b/drivers/video/omap2/displays/panel-picodlp.c

drivers/video/omap2/displays/panel-picodlp.c line 7

Quoted 12 lines

new file mode 100644
index 0000000..4f12903

drivers/video/omap2/displays/panel-picodlp.c new file +7 -0
@@ -0,0 +1,228 @@
+/*
+ * picodlp panel driver
+ *
+ * Copyright (C) 2009-2011 Texas Instruments
+ * Author: Mythri P K <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify

it

drivers/video/omap2/displays/panel-picodlp.c line 8

Quoted 1 line
drivers/video/omap2/displays/panel-picodlp.c new file +1 -0
+ * under the terms of the GNU General Public License version 2 as

published by

drivers/video/omap2/displays/panel-picodlp.c

Quoted 3 lines
drivers/video/omap2/displays/panel-picodlp.c new file +3 -0
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but

WITHOUT

drivers/video/omap2/displays/panel-picodlp.c line 12

Quoted 1 line
drivers/video/omap2/displays/panel-picodlp.c new file +1 -0
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY

or

drivers/video/omap2/displays/panel-picodlp.c line 13

Quoted 1 line
drivers/video/omap2/displays/panel-picodlp.c new file +1 -0
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public

License for

drivers/video/omap2/displays/panel-picodlp.c

Quoted 3 lines
drivers/video/omap2/displays/panel-picodlp.c new file +3 -0
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License

along with

Quoted 55 lines
drivers/video/omap2/displays/panel-picodlp.c new file +55 -0
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/input.h>
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
+#include <linux/firmware.h>
+#include <linux/slab.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+
+#include <plat/display.h>
+#include <plat/panel-picodlp.h>
+
+struct picodlp_data {
+	struct mutex lock;
+};
+
+static struct omap_video_timings pico_ls_timings = {
+	.x_res		= 864,
+	.y_res		= 480,
+	.hsw		= 7,
+	.hfp		= 11,
+	.hbp		= 7,
+
+	.pixel_clock	= 19200,
+
+	.vsw		= 2,
+	.vfp		= 3,
+	.vbp		= 14,
+};
+
+static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
+{
+	int r;
+
+	if (dssdev->platform_enable) {
+		r = dssdev->platform_enable(dssdev);
+		if (r)
+			return r;
+	}
+
+	r = omapdss_dpi_display_enable(dssdev);
+	if (r) {
+		dev_err(&dssdev->dev, "failed to enable DPI\n");
+		goto err;
+	}
+	/* after enabling, wait for some initialize sync interrupts */
+	msleep(675);
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+	return 0;
+
+err:
+	if (dssdev->platform_disable)
Quoted 9 lines

drivers/video/omap2/displays/panel-picodlp.c line 75

Quoted 4 lines
drivers/video/omap2/displays/panel-picodlp.c new file +4 -0
+		dssdev->platform_disable(dssdev);
+
+	return r;
+}

Why is the msleep needed there? It's a huge sleep, and can't find information about it from the documents you gave links to. I think I've asked this three times already.

It is practically observed that without this delay the pico panel does not get initialized.

Quoted 2 lines

Also, it's rather strange to sleep at the end of the function. Normally you would sleep between two actions.

Some of the panels in drivers/video/omap2/displays sleep after dpi_display_enable.

I agree here the sleep is huge. But I could not minimize it below this value. I can handle it in some other ways:
See if the i2c_pakcet is sent. If not sent wait for some time ~50ms and then resend.

Quoted 3 lines

Tomi

#10 lore raw

RE: [PATCH 4/7] OMAP: DSS: Add i2c client driver for picodlp

In reply to Tomi Valkeinen
Quoted 26 lines

-----Original Message-----
From: Valkeinen, Tomi
Sent: Tuesday, April 19, 2011 5:12 PM
To: Janorkar, Mayuresh
Cc: [email protected]; K, Mythri P
Subject: Re: [PATCH 4/7] OMAP: DSS: Add i2c client driver for picodlp

Quoted 1 line · Mayuresh Janorkar

The configurations and data transfer with picodlp panel happens through

i2c.

Quoted 7 lines

An i2c client with name "picodlp_i2c_driver" is registered inside panel.

---
 drivers/video/omap2/displays/panel-picodlp.c |  130

+++++++++++++++++++++++++-

Quoted 1 line
 1 files changed, 126 insertions(+), 4 deletions(-)

<snip>

Review static int picodlp_panel_power_on(struct

Quoted 1 line
(quoted diff) +0 -0
@@ -65,8 +131,10 @@ static int picodlp_panel_power_on(struct

omap_dss_device *dssdev)

Quoted 8 lines

drivers/video/omap2/displays/panel-picodlp.c static int picodlp_panel_power_on(struct omap_dss_device *dssdev) · line 135

Quoted 6 lines
drivers/video/omap2/displays/panel-picodlp.c +2 -1
 	msleep(675);
 	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
-	return 0;
+	picodlp_i2c_data =
+		i2c_get_clientdata(picod->picodlp_i2c_client);

This variable is not used at all.

Not in this patch but it is used in next patch. I would add it as a part of next patch where it is used.

Quoted 3 lines

Tomi

#13 lore raw

RE: [PATCH 5/7] OMAP: DSS: Adding initialization routine to picodlp panel

In reply to Tomi Valkeinen
Quoted 98 lines

-----Original Message-----
From: Valkeinen, Tomi
Sent: Tuesday, April 19, 2011 5:23 PM
To: Janorkar, Mayuresh
Cc: [email protected]; K, Mythri P
Subject: Re: [PATCH 5/7] OMAP: DSS: Adding initialization routine to picodlp panel

Quoted 3 lines · Mayuresh Janorkar

From: Mythri P K <[email protected]>

picodlp_i2c_client needs to send commands over i2c as a part of

initialiazation.

Quoted 11 lines

system controller dlp pico processor dpp2600 is used.
It configures the splash screen of picodlp using a sequence of commands. A programmer's guide is available at:
http://focus.ti.com/lit/ug/dlpu002a/dlpu002a.pdf

API is defined for sending command over i2c as an i2c_write operation.

---
 drivers/video/omap2/displays/panel-picodlp.c |  317

++++++++++++++++++++++++++

Review

Quoted 3 lines
 1 files changed, 317 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/video/omap2/displays/panel-picodlp.c

drivers/video/omap2/displays/panel-picodlp.c line 39

Quoted 12 lines

index e361674..785e406 100644

drivers/video/omap2/displays/panel-picodlp.c +4 -0
@@ -32,7 +32,15 @@
 #include <plat/display.h>
 #include <plat/panel-picodlp.h>
 
+#include "panel-picodlp.h"
+
 #define DRIVER_NAME	"picodlp_i2c_driver"
+
+/* This defines the minit of data which is allowed into single write

block */

Quoted 20 lines
drivers/video/omap2/displays/panel-picodlp.c +9 -0
+#define MAX_I2C_WRITE_BLOCK_SIZE	32
+#define PICO_MAJOR			1 /* 2 bits */
+#define PICO_MINOR			1 /* 2 bits */
+
 struct picodlp_data {
 	struct mutex lock;
 	struct i2c_client *picodlp_i2c_client;
@@ -50,6 +58,11 @@ struct i2c_device_id picodlp_i2c_id[] = {
 	{ "picodlp_i2c_driver", 0 },
 };
 
+struct picodlp_i2c_command {
+	u8 reg;
+	u32 value;
+};
+
 static struct omap_video_timings pico_ls_timings = {
 	.x_res		= 864,
 	.y_res		= 480,

drivers/video/omap2/displays/panel-picodlp.c static inline struct picodlp_panel_data · line 92

Quoted 10 lines
drivers/video/omap2/displays/panel-picodlp.c +7 -0
@@ -70,6 +83,305 @@ static inline struct picodlp_panel_data
 	return (struct picodlp_panel_data *) dssdev->data;
 }
 
+static int picodlp_i2c_write_block(struct i2c_client *client,
+					u8 *data, int len)
+{
+	struct i2c_msg msg;
+	int i, r;
+
+	struct picodlp_i2c_data *picodlp_i2c_data =

i2c_get_clientdata(client);

Quoted 23 lines
drivers/video/omap2/displays/panel-picodlp.c +23 -0
+
+	if (len < 1 || len > MAX_I2C_WRITE_BLOCK_SIZE) {
+		dev_err(&client->dev,
+			"too long syn_write_block len %d\n", len);
+		return -EIO;
+	}
+
+	mutex_lock(&picodlp_i2c_data->xfer_lock);
+
+	msg.addr = client->addr;
+	msg.flags = 0;
+	msg.len = len;
+	msg.buf = data;
+
+	r = i2c_transfer(client->adapter, &msg, 1);
+	mutex_unlock(&picodlp_i2c_data->xfer_lock);
+
+	if (r == 1) {
+		for (i = 0; i < len; i++)
+			dev_dbg(&client->dev,
+				"addr %x bw 0x%02x[%d]: 0x%02x\n",
+				client->addr, data[0] + i, i, data[i]);
+		return 0;
Quoted 8 lines

drivers/video/omap2/displays/panel-picodlp.c static inline struct picodlp_panel_data · line 119

Quoted 4 lines
drivers/video/omap2/displays/panel-picodlp.c +4 -0
+	}
+
+	dev_err(&client->dev, " picodlp_i2c_write error\n");
+	return r;

This is, at least to my eyes, a bit uncommon way to do this. Usually the error path is handled inside an if(), and the ok path is at the end of the function.

Would change this as per the most used formats.

Quoted 15 lines

drivers/video/omap2/displays/panel-picodlp.c static inline struct picodlp_panel_data · line 324

Quoted 12 lines
drivers/video/omap2/displays/panel-picodlp.c +11 -0
+}
+	int r;
+	static const struct picodlp_i2c_command init_cmd_set1[] = {
+		{SOFT_RESET, 1}, {DMD_PARK_TRIGGER, 1},
+		{MISC_REG, (PICO_MAJOR << 2 | PICO_MINOR)}, {SEQ_CONTROL, 0},
+		{SEQ_VECTOR, 0x100}, {DMD_BLOCK_COUNT, 7},
+		{DMD_VCC_CONTROL, 0x109}, {DMD_PARK_PULSE_COUNT, 0xA},
+		{DMD_PARK_PULSE_WIDTH, 0xB}, {DMD_PARK_DELAY, 0x2ED},
+		{DMD_SHADOW_ENABLE, 0}, {FLASH_OPCODE, 0xB},
+		{FLASH_DUMMY_BYTES, 1}, {FLASH_ADDR_BYTES, 3},
+	};

It would make these command lists clearer if there was only one command per line.

Fine

Quoted 15 lines

drivers/video/omap2/displays/panel-picodlp.c static inline struct picodlp_panel_data · line 371

Quoted 9 lines
drivers/video/omap2/displays/panel-picodlp.c +8 -0
+
+	if (r)
+		return r;
+
+	/* display logo splash image */
+	r = picodlp_dpp2600_config_splash(client);
+	if (r)
+		return r;

So this will show some hardcoded splash screen? How much of the code could be removed if the splash screen feature is removed? I don't see much point in such a feature, and it looks to me that at least two of the functions above are just for the splash screen. It's just extra code for a feature nobody wants.

Yes, this would show a hardcoded splash screen.

Quoted 21 lines

drivers/video/omap2/displays/panel-picodlp.c static int picodlp_panel_power_on(struct

Quoted 17 lines
drivers/video/omap2/displays/panel-picodlp.c +12 -0
+	r = picodlp_i2c_write_array(client, init_cmd_set3,
+					ARRAY_SIZE(init_cmd_set3));
+	if (r)
+		return r;
+
+	r = picodlp_dpp2600_config_rgb(client);
+	if (r)
+		return r;
+
+	return 0;
+}
+
 static int picodlp_i2c_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
@@ -134,6 +446,11 @@ static int picodlp_panel_power_on(struct

omap_dss_device *dssdev)

Quoted 3 lines
drivers/video/omap2/displays/panel-picodlp.c +0 -0
 	picodlp_i2c_data =
 		i2c_get_clientdata(picod->picodlp_i2c_client);
 
Quoted 8 lines

drivers/video/omap2/displays/panel-picodlp.c static int picodlp_panel_power_on(struct omap_dss_device *dssdev) · line 449

Quoted 1 line
drivers/video/omap2/displays/panel-picodlp.c +1 -0
+	msleep(700); /* sleep till panel is settled */

And another huge sleep. This, unlike the other sleeps, make some sense, as there's an i2c transaction done below.

Somehow I get the feeling that you've just put big sleeps here and there until the driver started working... Can you point me to the documentation that describes the delays required?

Except msleep(5) in
/* transfer control to flash controller */

r = picodlp_i2c_write(client, PBC_CONTROL, 1);
        msleep(5);

r = picodlp_i2c_write(client, PBC_CONTROL, 0);

Other delays are not documented. But it is practically observed that we need to wait otherwise the i2c_packet does not succeed.

As I mentioned earlier, I can follow one approach, in i2c_write see if packet transfer happens. If not, sleep for some time and retry.

This approach would remove these delays from this place.

Quoted 8 lines
Quoted 7 lines
drivers/video/omap2/displays/panel-picodlp.c +4 -0
+	r = picodlp_i2c_init(picod->picodlp_i2c_client);
+	if (r)
+		goto err;
+
 	return r;
 err:
 	if (dssdev->platform_disable)
#17 lore raw

RE: [PATCH 6/7] OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file

In reply to Tomi Valkeinen
Quoted 38 lines

-----Original Message-----
From: Valkeinen, Tomi
Sent: Tuesday, April 19, 2011 5:24 PM
To: Janorkar, Mayuresh
Cc: [email protected]; K, Mythri P
Subject: Re: [PATCH 6/7] OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file

Quoted 10 lines · Mayuresh Janorkar

An on-board panel named picodlp projector is available for OMAP4430 SDP.

Entry for this panel is being added in dss_devices in the board file. It also needs 4 GPIO pins and are defined and used in board file. picodlp also needs an i2c client over i2c controller-2 at address 0x1b.

---
 arch/arm/mach-omap2/board-4430sdp.c |   40

+++++++++++++++++++++++++++++++++++

arch/arm/mach-

Quoted 2 lines
 1 files changed, 40 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/board-4430sdp.c +0 -0

omap2/board-4430sdp.c

arch/arm/mach-omap2/board-4430sdp.c static struct i2c_board_info __initdata

Quoted 12 lines

index 1503f0b..6827612

arch/arm/mach-omap2/board-4430sdp.c +1 -0
@@ -38,6 +38,7 @@
 #include <plat/omap4-keypad.h>
 #include <plat/display.h>
 #include <plat/nokia-dsi-panel.h>
+#include <plat/panel-picodlp.h>
 
 #include "mux.h"
 #include "hsmmc.h"
@@ -585,6 +586,7 @@ static struct i2c_board_info __initdata

sdp4430_i2c_boardinfo[] = {

Quoted 6 lines

arch/arm/mach-omap2/board-4430sdp.c static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = { · line 589

Quoted 4 lines
arch/arm/mach-omap2/board-4430sdp.c +1 -0
 		.platform_data = &sdp4430_twldata,
 	},
 };
+

Unneeded change.

Fine.

Quoted 6 lines

arch/arm/mach-omap2/board-4430sdp.c static struct i2c_board_info __initdata

Quoted 5 lines
arch/arm/mach-omap2/board-4430sdp.c +0 -0
 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("tmp105", 0x48),
@@ -598,6 +600,7 @@ static struct i2c_board_info __initdata

sdp4430_i2c_4_boardinfo[] = {

Quoted 6 lines

arch/arm/mach-omap2/board-4430sdp.c static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { · line 603

Quoted 4 lines
arch/arm/mach-omap2/board-4430sdp.c +1 -0
 		I2C_BOARD_INFO("hmc5843", 0x1e),
 	},
 };
+

Unneeded change.

Fine

Quoted 3 lines

Tomi

#6 lore raw

RE: [PATCH 3/7] OMAP: DSS: Adding a picodlp panel driver

In reply to Janorkar, Mayuresh
Quoted 43 lines · Mayuresh
Quoted 33 lines

-----Original Message-----
From: Valkeinen, Tomi
Sent: Tuesday, April 19, 2011 4:40 PM
To: Janorkar, Mayuresh
Cc: [email protected]; K, Mythri P
Subject: Re: [PATCH 3/7] OMAP: DSS: Adding a picodlp panel driver

Quoted 23 lines · Mayuresh Janorkar
drivers/video/omap2/displays/panel-picodlp.c new file +23 -0
+static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
+{
+	int r;
+
+	if (dssdev->platform_enable) {
+		r = dssdev->platform_enable(dssdev);
+		if (r)
+			return r;
+	}
+
+	r = omapdss_dpi_display_enable(dssdev);
+	if (r) {
+		dev_err(&dssdev->dev, "failed to enable DPI\n");
+		goto err;
+	}
+	/* after enabling, wait for some initialize sync interrupts */
+	msleep(675);
+	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
+
+	return 0;
+
+err:
+	if (dssdev->platform_disable)
Quoted 9 lines

drivers/video/omap2/displays/panel-picodlp.c line 75

Quoted 4 lines
drivers/video/omap2/displays/panel-picodlp.c new file +4 -0
+		dssdev->platform_disable(dssdev);
+
+	return r;
+}

Why is the msleep needed there? It's a huge sleep, and can't find information about it from the documents you gave links to. I think I've asked this three times already.

Quoted 6 lines

It is practically observed that without this delay the pico panel does not get initialized.

Quoted 2 lines

Also, it's rather strange to sleep at the end of the function. Normally you would sleep between two actions.

Some of the panels in drivers/video/omap2/displays sleep after dpi_display_enable.

Yes, but the drivers sleep between dpi_display_enable and platform_enable. They don't sleep at the end of a function, they sleep between two actions because the second action requires the first action to be stabilized. More exactly, the panel needs to get the pixel clock for a few frames to initialize itself, so that the image is stable when the panel is taken out of reset.

Quoted 3 lines

I agree here the sleep is huge. But I could not minimize it below this value. I can handle it in some other ways:
See if the i2c_pakcet is sent. If not sent wait for some time ~50ms and then resend.

You need to find the documentation describing the power-up times to understand what is required and where.

Most likely the case here is that picodlp takes rather long to wake up after it's taken out of reset (i.e. platform_enabl. dpi_display_enable probably doesn't have anything to do with this), and you need to wait that time before sending i2c messages.

And if that is the case, you don't need to sleep after platform_enable or dpi_display_enable, but before sending the first i2c message. And as the sleep here is such a long sleep, I think it warrants some optimization. If the sending of the i2c message happens in some other function, you can store the timestamp at the time when the reset is removed, and before sending the i2c message use the timestamp to sleep enough to be sure the picodlp is up and running.

Tomi

#14 lore raw

RE: [PATCH 5/7] OMAP: DSS: Adding initialization routine to picodlp panel

In reply to Janorkar, Mayuresh
Quoted 10 lines · Mayuresh
Quoted 10 lines

-----Original Message-----
From: Valkeinen, Tomi
Sent: Tuesday, April 19, 2011 5:23 PM
To: Janorkar, Mayuresh
Cc: [email protected]; K, Mythri P
Subject: Re: [PATCH 5/7] OMAP: DSS: Adding initialization routine to picodlp panel

On Mon, 2011-04-18 at 11:45 +0530, Mayuresh Janorkar wrote:

<snip>

Quoted 17 lines
Quoted 8 lines

drivers/video/omap2/displays/panel-picodlp.c static int picodlp_panel_power_on(struct

Quoted 4 lines

static int picodlp_i2c_probe(struct i2c_client *client,

drivers/video/omap2/displays/panel-picodlp.c +0 -0
 		const struct i2c_device_id *id)
 {
@@ -134,6 +446,11 @@ static int picodlp_panel_power_on(struct

omap_dss_device *dssdev)

Quoted 3 lines
drivers/video/omap2/displays/panel-picodlp.c +0 -0
 	picodlp_i2c_data =
 		i2c_get_clientdata(picod->picodlp_i2c_client);
 
Quoted 8 lines

drivers/video/omap2/displays/panel-picodlp.c static int picodlp_panel_power_on(struct omap_dss_device *dssdev) · line 449

Quoted 1 line
drivers/video/omap2/displays/panel-picodlp.c +1 -0
+	msleep(700); /* sleep till panel is settled */

And another huge sleep. This, unlike the other sleeps, make some sense, as there's an i2c transaction done below.

Somehow I get the feeling that you've just put big sleeps here and there until the driver started working... Can you point me to the documentation that describes the delays required?

Quoted 7 lines

Except msleep(5) in
/* transfer control to flash controller */

r = picodlp_i2c_write(client, PBC_CONTROL, 1);
        msleep(5);

r = picodlp_i2c_write(client, PBC_CONTROL, 0);

Other delays are not documented. But it is practically observed that we need to wait otherwise the i2c_packet does not succeed.

Then we need to contact the HW guys developing picodlp. They are TIers, aren't they? We can't just put sleeps here and there and be sure it'll work properly.

What if your sleep of 700ms has, by luck, caused a 900ms sleep in your tests (sleeps can take considerably longer than the given value), and the hardware requires 800ms sleep? Your tests show it works, but for some other user the sleep may cause a 750ms sleep, causing picodlp to fail to start.

Tomi