linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] picodlp projector driver
@ 2011-05-02 14:52 Mayuresh Janorkar
  2011-05-02 14:52 ` [PATCH v2 1/7] OMAP: DSS: Adding a header file for picodlp panel data Mayuresh Janorkar
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Mayuresh Janorkar @ 2011-05-02 14:52 UTC (permalink / raw)
  To: linux-omap; +Cc: tomi.valkeinen, Mayuresh Janorkar

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.
It has a dlp processor dpp2600.

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:
WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt
I think this warning can be ignored

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    |  554 +++++++++++++++++++++++
 drivers/video/omap2/displays/panel-picodlp.h    |  287 ++++++++++++
 6 files changed, 914 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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 1/7] OMAP: DSS: Adding a header file for picodlp panel data
  2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
@ 2011-05-02 14:52 ` Mayuresh Janorkar
  2011-05-03 18:33   ` Tomi Valkeinen
  2011-05-02 14:52 ` [PATCH v2 2/7] OMAP: DSS: Adding a picodlp panel header file Mayuresh Janorkar
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Mayuresh Janorkar @ 2011-05-02 14:52 UTC (permalink / raw)
  To: linux-omap; +Cc: tomi.valkeinen, Mayuresh Janorkar

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

Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
---
Changes since v1: Nil

 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

diff --git a/arch/arm/plat-omap/include/plat/panel-picodlp.h b/arch/arm/plat-omap/include/plat/panel-picodlp.h
new file mode 100644
index 0000000..89ac4b9
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/panel-picodlp.h
@@ -0,0 +1,25 @@
+/*
+ * panel data for picodlp panel
+ *
+ * Copyright (C) 2011 Texas Instruments
+ *
+ * Author: Mayuresh Janorkar <mayur@ti.com>
+ *
+ * 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 */
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 2/7] OMAP: DSS: Adding a picodlp panel header file
  2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
  2011-05-02 14:52 ` [PATCH v2 1/7] OMAP: DSS: Adding a header file for picodlp panel data Mayuresh Janorkar
@ 2011-05-02 14:52 ` Mayuresh Janorkar
  2011-05-02 14:52 ` [PATCH v2 3/7] OMAP: DSS: Adding a picodlp panel driver Mayuresh Janorkar
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Mayuresh Janorkar @ 2011-05-02 14:52 UTC (permalink / raw)
  To: linux-omap; +Cc: tomi.valkeinen, Mythri P K, Mayuresh Janorkar

From: Mythri P K <mythripk@ti.com>

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

Signed-off-by: Mythri P K <mythripk@ti.com>
Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
---
Changes since v1: Nil

 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

diff --git a/drivers/video/omap2/displays/panel-picodlp.h b/drivers/video/omap2/displays/panel-picodlp.h
new file mode 100644
index 0000000..1c0bab4
--- /dev/null
+++ b/drivers/video/omap2/displays/panel-picodlp.h
@@ -0,0 +1,287 @@
+/*
+ * Header file required by picodlp panel driver
+ *
+ * Copyright (C) 2009-2011 Texas Instruments
+ * Author: Mythri P K <mythripk@ti.com>
+ *
+ * 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
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 3/7] OMAP: DSS: Adding a picodlp panel driver
  2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
  2011-05-02 14:52 ` [PATCH v2 1/7] OMAP: DSS: Adding a header file for picodlp panel data Mayuresh Janorkar
  2011-05-02 14:52 ` [PATCH v2 2/7] OMAP: DSS: Adding a picodlp panel header file Mayuresh Janorkar
@ 2011-05-02 14:52 ` Mayuresh Janorkar
  2011-05-03 18:26   ` Tomi Valkeinen
  2011-05-02 14:52 ` [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp Mayuresh Janorkar
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Mayuresh Janorkar @ 2011-05-02 14:52 UTC (permalink / raw)
  To: linux-omap; +Cc: tomi.valkeinen, Mythri P K, Mayuresh Janorkar

From: Mythri P K <mythripk@ti.com>

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.

Signed-off-by: Mythri P K <mythripk@ti.com>
Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
---
Changes since v1:
	1. Removed msleep
	
 drivers/video/omap2/displays/panel-picodlp.c |  226 ++++++++++++++++++++++++++
 1 files changed, 226 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/omap2/displays/panel-picodlp.c

diff --git a/drivers/video/omap2/displays/panel-picodlp.c b/drivers/video/omap2/displays/panel-picodlp.c
new file mode 100644
index 0000000..e83e399
--- /dev/null
+++ b/drivers/video/omap2/displays/panel-picodlp.c
@@ -0,0 +1,226 @@
+/*
+ * picodlp panel driver
+ *
+ * Copyright (C) 2009-2011 Texas Instruments
+ * Author: Mythri P K <mythripk@ti.com>
+ *
+ * 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;
+	}
+	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 <mythripk@ti.com>");
+MODULE_DESCRIPTION("picodlp driver");
+MODULE_LICENSE("GPL");
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp
  2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
                   ` (2 preceding siblings ...)
  2011-05-02 14:52 ` [PATCH v2 3/7] OMAP: DSS: Adding a picodlp panel driver Mayuresh Janorkar
@ 2011-05-02 14:52 ` Mayuresh Janorkar
  2011-05-03 18:44   ` Tomi Valkeinen
  2011-05-02 14:52 ` [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to picodlp panel Mayuresh Janorkar
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Mayuresh Janorkar @ 2011-05-02 14:52 UTC (permalink / raw)
  To: linux-omap; +Cc: tomi.valkeinen, Mayuresh Janorkar, Mythri P K

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

dpp2600 requires 4 gpio lines for interfacing it with any processor,
phy_reset, ready_reset, park, display_select

Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
Signed-off-by: Mythri P K <mythripk@ti.com>
---
Changes since v2:
	1. Removed unused variable picodlp_i2c_data
	2. Removed msleep

checkpatch.pl warning:
WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt

But I think this can be ignored.

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

diff --git a/drivers/video/omap2/displays/panel-picodlp.c b/drivers/video/omap2/displays/panel-picodlp.c
index e83e399..fdbfdcf 100644
--- a/drivers/video/omap2/displays/panel-picodlp.c
+++ b/drivers/video/omap2/displays/panel-picodlp.c
@@ -1,8 +1,10 @@
 /*
  * picodlp panel driver
+ * picodlp_i2c_driver: i2c_client driver
  *
  * Copyright (C) 2009-2011 Texas Instruments
  * Author: Mythri P K <mythripk@ti.com>
+ * Mayuresh Janorkar <mayur@ti.com>
  *
  * 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,56 @@ 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;
+
+	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);
@@ -63,8 +128,7 @@ static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 	}
 	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
-	return 0;
-
+	return r;
 err:
 	if (dssdev->platform_disable)
 		dssdev->platform_disable(dssdev);
@@ -83,6 +147,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;
@@ -94,8 +163,36 @@ 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);
+	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)
@@ -129,6 +226,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 */
@@ -210,11 +312,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);
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to picodlp panel
  2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
                   ` (3 preceding siblings ...)
  2011-05-02 14:52 ` [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp Mayuresh Janorkar
@ 2011-05-02 14:52 ` Mayuresh Janorkar
  2011-05-03 18:58   ` Tomi Valkeinen
  2011-05-02 14:52 ` [PATCH v2 6/7] OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file Mayuresh Janorkar
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Mayuresh Janorkar @ 2011-05-02 14:52 UTC (permalink / raw)
  To: linux-omap; +Cc: tomi.valkeinen, Mythri P K, Mayuresh Janorkar

From: Mythri P K <mythripk@ti.com>

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.

Signed-off-by: Mythri P K <mythripk@ti.com>
Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
---
Changes since v1:
	1. Removed initial splash screen
	2. i2c_commands regrouped
	3. Removed long msleep
	4. Added try-after-sleep in i2c_write

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

diff --git a/drivers/video/omap2/displays/panel-picodlp.c b/drivers/video/omap2/displays/panel-picodlp.c
index fdbfdcf..493a411 100644
--- a/drivers/video/omap2/displays/panel-picodlp.c
+++ b/drivers/video/omap2/displays/panel-picodlp.c
@@ -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,197 @@ 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, msg_count = 1, trial = 4;
+
+	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;
+	}
+retry:
+	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, msg_count);
+	mutex_unlock(&picodlp_i2c_data->xfer_lock);
+
+	/*
+	 * i2c_transfer returns:
+	 * number of messages sent in case of success
+	 * a negative error number in case of failure
+	 * i2c controller might timeout, in such a case sleep for sometime
+	 * and then retry
+	 */
+	if (r != msg_count) {
+		msleep(2);
+		if (trial--)
+			goto retry;
+
+		dev_err(&client->dev, " picodlp_i2c_write error\n");
+		return r;
+	}
+
+	/* In case of success */
+	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;
+}
+
+static int picodlp_i2c_write(struct i2c_client *client, u8 reg, u32 value)
+{
+	u8 data[5];
+	int i;
+
+	data[0] = reg;
+	for (i = 1; i < 5; i++)
+		data[i] = (value >> (32 - (i) * 8)) & 0xFF;
+
+	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_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},
+		{PBC_CONTROL, 0},
+		{FLASH_START_ADDR, CMT_LUT_0_START_ADDR},
+		{FLASH_READ_BYTES, CMT_LUT_0_SIZE},
+		{CMT_SPLASH_LUT_START_ADDR, 0},
+		{CMT_SPLASH_LUT_DEST_SELECT, CMT_LUT_ALL},
+		{PBC_CONTROL, 1},
+	};
+
+	static const struct picodlp_i2c_command init_cmd_set2[] = {
+		{PBC_CONTROL, 0},
+		{CMT_SPLASH_LUT_DEST_SELECT, 0},
+		{PBC_CONTROL, 0},
+		{FLASH_START_ADDR, SEQUENCE_0_START_ADDR},
+		{FLASH_READ_BYTES, SEQUENCE_0_SIZE},
+		{SEQ_RESET_LUT_START_ADDR, 0},
+		{SEQ_RESET_LUT_DEST_SELECT, SEQ_SEQ_LUT},
+		{PBC_CONTROL, 1},
+	};
+
+	static const struct picodlp_i2c_command init_cmd_set3[] = {
+		{PBC_CONTROL, 0},
+		{SEQ_RESET_LUT_DEST_SELECT, 0},
+		{PBC_CONTROL, 0},
+		{FLASH_START_ADDR, DRC_TABLE_0_START_ADDR},
+		{FLASH_READ_BYTES, DRC_TABLE_0_SIZE},
+		{SEQ_RESET_LUT_START_ADDR, 0},
+		{SEQ_RESET_LUT_DEST_SELECT, SEQ_DRC_LUT_ALL},
+		{PBC_CONTROL, 1},
+	};
+
+	static const struct picodlp_i2c_command init_cmd_set4[] = {
+		{PBC_CONTROL, 0},
+		{SEQ_RESET_LUT_DEST_SELECT, 0},
+		{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},
+		{DMD_PARK_TRIGGER, 0},
+		{R_DRIVE_CURRENT, 0x298},
+		{G_DRIVE_CURRENT, 0x298},
+		{B_DRIVE_CURRENT, 0x298},
+		{RGB_DRIVER_ENABLE, 7},
+		{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, init_cmd_set1,
+						ARRAY_SIZE(init_cmd_set1));
+	if (r)
+		return r;
+	msleep(2);
+
+	r = picodlp_i2c_write_array(client, init_cmd_set2,
+					ARRAY_SIZE(init_cmd_set2));
+	if (r)
+		return r;
+	msleep(2);
+
+	r = picodlp_i2c_write_array(client, init_cmd_set3,
+					ARRAY_SIZE(init_cmd_set3));
+	if (r)
+		return r;
+	msleep(2);
+
+	r = picodlp_i2c_write_array(client, init_cmd_set4,
+					ARRAY_SIZE(init_cmd_set4));
+	if (r)
+		return r;
+
+	return 0;
+}
+
 static int picodlp_i2c_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
@@ -109,6 +313,7 @@ static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 	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);
@@ -128,6 +333,13 @@ static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
 	}
 	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
+	picodlp_i2c_data =
+		i2c_get_clientdata(picod->picodlp_i2c_client);
+
+	r = picodlp_i2c_init(picod->picodlp_i2c_client);
+	if (r)
+		goto err;
+
 	return r;
 err:
 	if (dssdev->platform_disable)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 6/7] OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file
  2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
                   ` (4 preceding siblings ...)
  2011-05-02 14:52 ` [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to picodlp panel Mayuresh Janorkar
@ 2011-05-02 14:52 ` Mayuresh Janorkar
  2011-05-02 14:52 ` [PATCH v2 7/7] OMAP4: DSS: Adding picodlp panel entry in Kconfig and Makefile Mayuresh Janorkar
  2011-05-03 19:06 ` [PATCH v2 0/7] picodlp projector driver Tomi Valkeinen
  7 siblings, 0 replies; 19+ messages in thread
From: Mayuresh Janorkar @ 2011-05-02 14:52 UTC (permalink / raw)
  To: linux-omap; +Cc: tomi.valkeinen, Mayuresh Janorkar, Mythri P K

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.

Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
Signed-off-by: Mythri P K <mythripk@ti.com>
---
Changes since v1: Removed unnecessary changes

 arch/arm/mach-omap2/board-4430sdp.c |   38 +++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 570e83f..979eab7 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -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"
@@ -812,9 +813,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 +864,7 @@ void omap_4430sdp_display_init(void)
 {
 	sdp4430_lcd_init();
 	sdp4430_hdmi_mux_init();
+	sdp4430_picodlp_init();
 	omap_display_init(&sdp4430_dss_data);
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 7/7] OMAP4: DSS: Adding picodlp panel entry in Kconfig and Makefile
  2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
                   ` (5 preceding siblings ...)
  2011-05-02 14:52 ` [PATCH v2 6/7] OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file Mayuresh Janorkar
@ 2011-05-02 14:52 ` Mayuresh Janorkar
  2011-05-03 19:06 ` [PATCH v2 0/7] picodlp projector driver Tomi Valkeinen
  7 siblings, 0 replies; 19+ messages in thread
From: Mayuresh Janorkar @ 2011-05-02 14:52 UTC (permalink / raw)
  To: linux-omap; +Cc: tomi.valkeinen, Mythri P K, Mayuresh Janorkar

From: Mythri P K <mythripk@ti.com>

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

Signed-off-by: Mythri P K <mythripk@ti.com>
Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
---
Changes since v1: Nil

 drivers/video/omap2/displays/Kconfig  |    7 +++++++
 drivers/video/omap2/displays/Makefile |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
index 609a280..0b05593 100644
--- a/drivers/video/omap2/displays/Kconfig
+++ b/drivers/video/omap2/displays/Kconfig
@@ -30,6 +30,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
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
index 0f601ab..d90f73c 100644
--- a/drivers/video/omap2/displays/Makefile
+++ b/drivers/video/omap2/displays/Makefile
@@ -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
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/7] OMAP: DSS: Adding a picodlp panel driver
  2011-05-02 14:52 ` [PATCH v2 3/7] OMAP: DSS: Adding a picodlp panel driver Mayuresh Janorkar
@ 2011-05-03 18:26   ` Tomi Valkeinen
  2011-05-04  9:24     ` Janorkar, Mayuresh
  0 siblings, 1 reply; 19+ messages in thread
From: Tomi Valkeinen @ 2011-05-03 18:26 UTC (permalink / raw)
  To: Mayuresh Janorkar; +Cc: linux-omap, Mythri P K

On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> From: Mythri P K <mythripk@ti.com>
> 
> 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.
> 
> Signed-off-by: Mythri P K <mythripk@ti.com>
> Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
> ---
> Changes since v1:
> 	1. Removed msleep
> 	
>  drivers/video/omap2/displays/panel-picodlp.c |  226 ++++++++++++++++++++++++++
>  1 files changed, 226 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/video/omap2/displays/panel-picodlp.c

<snip>

> +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);

Many of the debug prints in this file have an extra space in the
beginning of the string, like above.

You should try to keep the code inside lock and unlock as minimal as
possible. Here the dev_dbg() could as well be outside the lock (granted,
dev_dbg() is a null op if DEBUG is not defined, but still).

Additionally, usually it's good to print the debug print before doing
the action, so here (and similar cases elsewhere in this file) it would
make sense to move the dev_dbg() before the 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");

This is not a debug print, but an error. Similar problem in the function
below.

 Tomi



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/7] OMAP: DSS: Adding a header file for picodlp panel data
  2011-05-02 14:52 ` [PATCH v2 1/7] OMAP: DSS: Adding a header file for picodlp panel data Mayuresh Janorkar
@ 2011-05-03 18:33   ` Tomi Valkeinen
  0 siblings, 0 replies; 19+ messages in thread
From: Tomi Valkeinen @ 2011-05-03 18:33 UTC (permalink / raw)
  To: Mayuresh Janorkar; +Cc: linux-omap

On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> 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
> 
> Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
> ---
> Changes since v1: Nil
> 
>  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
> 
> diff --git a/arch/arm/plat-omap/include/plat/panel-picodlp.h b/arch/arm/plat-omap/include/plat/panel-picodlp.h
> new file mode 100644
> index 0000000..89ac4b9
> --- /dev/null
> +++ b/arch/arm/plat-omap/include/plat/panel-picodlp.h
> @@ -0,0 +1,25 @@
> +/*
> + * panel data for picodlp panel
> + *
> + * Copyright (C) 2011 Texas Instruments
> + *
> + * Author: Mayuresh Janorkar <mayur@ti.com>
> + *
> + * 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;
> +};

I think I've asked this before: where do the names of the GPIOs come
from? I can't find them from the documentation.

 Tomi



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp
  2011-05-02 14:52 ` [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp Mayuresh Janorkar
@ 2011-05-03 18:44   ` Tomi Valkeinen
  2011-05-04 10:01     ` Janorkar, Mayuresh
  0 siblings, 1 reply; 19+ messages in thread
From: Tomi Valkeinen @ 2011-05-03 18:44 UTC (permalink / raw)
  To: Mayuresh Janorkar; +Cc: linux-omap, Mythri P K

On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> The configurations and data transfer with picodlp panel happens through i2c.
> An i2c client with name "picodlp_i2c_driver" is registered inside panel.
> 
> dpp2600 requires 4 gpio lines for interfacing it with any processor,
> phy_reset, ready_reset, park, display_select

Hmm, so what is dpp2600? It's mentioned here for the first time, the
documentation doesn't mention it.

If it means the picodlp, just use the same name all the time. If not,
you could tell what it is first.

 Tomi



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to picodlp panel
  2011-05-02 14:52 ` [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to picodlp panel Mayuresh Janorkar
@ 2011-05-03 18:58   ` Tomi Valkeinen
  2011-05-04 14:31     ` Janorkar, Mayuresh
  0 siblings, 1 reply; 19+ messages in thread
From: Tomi Valkeinen @ 2011-05-03 18:58 UTC (permalink / raw)
  To: Mayuresh Janorkar; +Cc: linux-omap, Mythri P K

On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> From: Mythri P K <mythripk@ti.com>
> 
> 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.
> 
> Signed-off-by: Mythri P K <mythripk@ti.com>
> Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
> ---
> Changes since v1:
> 	1. Removed initial splash screen
> 	2. i2c_commands regrouped
> 	3. Removed long msleep
> 	4. Added try-after-sleep in i2c_write
> 
>  drivers/video/omap2/displays/panel-picodlp.c |  212 ++++++++++++++++++++++++++
>  1 files changed, 212 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/omap2/displays/panel-picodlp.c b/drivers/video/omap2/displays/panel-picodlp.c
> index fdbfdcf..493a411 100644
> --- a/drivers/video/omap2/displays/panel-picodlp.c
> +++ b/drivers/video/omap2/displays/panel-picodlp.c
> @@ -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,197 @@ 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, msg_count = 1, trial = 4;
> +
> +	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;
> +	}
> +retry:
> +	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, msg_count);
> +	mutex_unlock(&picodlp_i2c_data->xfer_lock);
> +
> +	/*
> +	 * i2c_transfer returns:
> +	 * number of messages sent in case of success
> +	 * a negative error number in case of failure
> +	 * i2c controller might timeout, in such a case sleep for sometime
> +	 * and then retry
> +	 */
> +	if (r != msg_count) {
> +		msleep(2);
> +		if (trial--)
> +			goto retry;

This is not good. Hacks like these should only be used as a last option.

I'm still saying that you should find the document mentioned in the
documents you have. I refuse to believe that we (TI) do not know what
our hardware does, especially in a basic issue like this.

I'm 99% sure there is documentation telling the required power-up
sequence. And if that 1% happens, we should find the HW designers and
yell at them until they make the documents.

 Tomi



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 0/7] picodlp projector driver
  2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
                   ` (6 preceding siblings ...)
  2011-05-02 14:52 ` [PATCH v2 7/7] OMAP4: DSS: Adding picodlp panel entry in Kconfig and Makefile Mayuresh Janorkar
@ 2011-05-03 19:06 ` Tomi Valkeinen
  7 siblings, 0 replies; 19+ messages in thread
From: Tomi Valkeinen @ 2011-05-03 19:06 UTC (permalink / raw)
  To: Mayuresh Janorkar; +Cc: linux-omap

On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> 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.
> It has a dlp processor dpp2600.
> 
> 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

I think patches 3, 4, 5, 7 can be squashed into one. panel-picodlp.c is
not that big of a file, and the division is quite artificial to my eyes.
In theory the dss part and the i2c part could be in separate patches,
but that doesn't make much sense here as the dss part won't function
without the i2c part.

It's much easier to review one whole patch, than pieces of the whole.

 Tomi



^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH v2 3/7] OMAP: DSS: Adding a picodlp panel driver
  2011-05-03 18:26   ` Tomi Valkeinen
@ 2011-05-04  9:24     ` Janorkar, Mayuresh
  0 siblings, 0 replies; 19+ messages in thread
From: Janorkar, Mayuresh @ 2011-05-04  9:24 UTC (permalink / raw)
  To: Valkeinen, Tomi; +Cc: linux-omap, K, Mythri P



> -----Original Message-----
> From: Valkeinen, Tomi
> Sent: Tuesday, May 03, 2011 11:56 PM
> To: Janorkar, Mayuresh
> Cc: linux-omap@vger.kernel.org; K, Mythri P
> Subject: Re: [PATCH v2 3/7] OMAP: DSS: Adding a picodlp panel driver
> 
> On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> > From: Mythri P K <mythripk@ti.com>
> >
> > 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.
> >
> > Signed-off-by: Mythri P K <mythripk@ti.com>
> > Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
> > ---
> > Changes since v1:
> > 	1. Removed msleep
> >
> >  drivers/video/omap2/displays/panel-picodlp.c |  226
> ++++++++++++++++++++++++++
> >  1 files changed, 226 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/video/omap2/displays/panel-picodlp.c
> 
> <snip>
> 
> > +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);
> 
> Many of the debug prints in this file have an extra space in the
> beginning of the string, like above.
> 
> You should try to keep the code inside lock and unlock as minimal as
> possible. Here the dev_dbg() could as well be outside the lock (granted,
> dev_dbg() is a null op if DEBUG is not defined, but still).
> 
> Additionally, usually it's good to print the debug print before doing
> the action, so here (and similar cases elsewhere in this file) it would
> make sense to move the dev_dbg() before the lock.

I will take care of this

> 
> > +}
> > +
> > +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");
> 
> This is not a debug print, but an error. Similar problem in the function
> below.

Fine

> 
>  Tomi
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp
  2011-05-03 18:44   ` Tomi Valkeinen
@ 2011-05-04 10:01     ` Janorkar, Mayuresh
  2011-05-04 11:05       ` Tomi Valkeinen
  0 siblings, 1 reply; 19+ messages in thread
From: Janorkar, Mayuresh @ 2011-05-04 10:01 UTC (permalink / raw)
  To: Valkeinen, Tomi; +Cc: linux-omap, K, Mythri P



> -----Original Message-----
> From: Valkeinen, Tomi
> Sent: Wednesday, May 04, 2011 12:15 AM
> To: Janorkar, Mayuresh
> Cc: linux-omap@vger.kernel.org; K, Mythri P
> Subject: Re: [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp
> 
> On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> > The configurations and data transfer with picodlp panel happens through
> i2c.
> > An i2c client with name "picodlp_i2c_driver" is registered inside panel.
> >
> > dpp2600 requires 4 gpio lines for interfacing it with any processor,
> > phy_reset, ready_reset, park, display_select
> 
> Hmm, so what is dpp2600? It's mentioned here for the first time, the
> documentation doesn't mention it.

Patch 0 does mention about dpp2600. It means DLP Pico Processor
and I have also provided link to wiki page which talks more about dpp2600.
Earlier version of patch also had functions dpp2600_configure_flash.

> 
> If it means the picodlp, just use the same name all the time. If not,
> you could tell what it is first.

DPP means DLP pico processor.
> 
>  Tomi
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp
  2011-05-04 10:01     ` Janorkar, Mayuresh
@ 2011-05-04 11:05       ` Tomi Valkeinen
  2011-05-04 14:29         ` Janorkar, Mayuresh
  0 siblings, 1 reply; 19+ messages in thread
From: Tomi Valkeinen @ 2011-05-04 11:05 UTC (permalink / raw)
  To: Janorkar, Mayuresh; +Cc: linux-omap, K, Mythri P

On Wed, 2011-05-04 at 15:31 +0530, Janorkar, Mayuresh wrote:
> 
> > -----Original Message-----
> > From: Valkeinen, Tomi
> > Sent: Wednesday, May 04, 2011 12:15 AM
> > To: Janorkar, Mayuresh
> > Cc: linux-omap@vger.kernel.org; K, Mythri P
> > Subject: Re: [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp
> > 
> > On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> > > The configurations and data transfer with picodlp panel happens through
> > i2c.
> > > An i2c client with name "picodlp_i2c_driver" is registered inside panel.
> > >
> > > dpp2600 requires 4 gpio lines for interfacing it with any processor,
> > > phy_reset, ready_reset, park, display_select
> > 
> > Hmm, so what is dpp2600? It's mentioned here for the first time, the
> > documentation doesn't mention it.
> 
> Patch 0 does mention about dpp2600. It means DLP Pico Processor
> and I have also provided link to wiki page which talks more about dpp2600.
> Earlier version of patch also had functions dpp2600_configure_flash.

Remember that patch 0 is just an intro for the patch set. It's not
included in the kernel tree. So the basic rule is that patch 0 should
not contain any important info that is not available from the patches
itself.

Where does the DPP2600 name come from? The documentation doesn't mention
it, it's only mentioned in the wiki page written by you. I didn't find
anything with a quick googling either.

> > If it means the picodlp, just use the same name all the time. If not,
> > you could tell what it is first.
> 
> DPP means DLP pico processor.

So DPP is the processor part inside the projector? I'm not sure if that
knowledge is relevant here. From the kernel driver's point of view
there's just the projector, where the GPIOs, i2c and video lines go.
Does it matter that there's a DPP2600 processor inside?

Also, in the patch comment above you write "picodlp panel". The PicoDLP
is not panel, so you shouldn't speak of picodlp panel.

 Tomi



^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp
  2011-05-04 11:05       ` Tomi Valkeinen
@ 2011-05-04 14:29         ` Janorkar, Mayuresh
  0 siblings, 0 replies; 19+ messages in thread
From: Janorkar, Mayuresh @ 2011-05-04 14:29 UTC (permalink / raw)
  To: Valkeinen, Tomi; +Cc: linux-omap, K, Mythri P



> -----Original Message-----
> From: Valkeinen, Tomi
> Sent: Wednesday, May 04, 2011 4:36 PM
> To: Janorkar, Mayuresh
> Cc: linux-omap@vger.kernel.org; K, Mythri P
> Subject: RE: [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp
> 
> On Wed, 2011-05-04 at 15:31 +0530, Janorkar, Mayuresh wrote:
> >
> > > -----Original Message-----
> > > From: Valkeinen, Tomi
> > > Sent: Wednesday, May 04, 2011 12:15 AM
> > > To: Janorkar, Mayuresh
> > > Cc: linux-omap@vger.kernel.org; K, Mythri P
> > > Subject: Re: [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for
> picodlp
> > >
> > > On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> > > > The configurations and data transfer with picodlp panel happens
> through
> > > i2c.
> > > > An i2c client with name "picodlp_i2c_driver" is registered inside
> panel.
> > > >
> > > > dpp2600 requires 4 gpio lines for interfacing it with any processor,
> > > > phy_reset, ready_reset, park, display_select
> > >
> > > Hmm, so what is dpp2600? It's mentioned here for the first time, the
> > > documentation doesn't mention it.
> >
> > Patch 0 does mention about dpp2600. It means DLP Pico Processor
> > and I have also provided link to wiki page which talks more about
> dpp2600.
> > Earlier version of patch also had functions dpp2600_configure_flash.
> 
> Remember that patch 0 is just an intro for the patch set. It's not
> included in the kernel tree. So the basic rule is that patch 0 should
> not contain any important info that is not available from the patches
> itself.
> 
> Where does the DPP2600 name come from? The documentation doesn't mention
> it, it's only mentioned in the wiki page written by you. I didn't find
> anything with a quick googling either.

You can check it here:
https://focus.ti.com/myti/docs/extranet.tsp?sectionId=403
You might have to create an extranet account to access it.

> 
> > > If it means the picodlp, just use the same name all the time. If not,
> > > you could tell what it is first.
> >
> > DPP means DLP pico processor.
> 
> So DPP is the processor part inside the projector? I'm not sure if that
> knowledge is relevant here. From the kernel driver's point of view
> there's just the projector, where the GPIOs, i2c and video lines go.
> Does it matter that there's a DPP2600 processor inside?

My bad it means DLP Pico Projector.
There is no processor.

> 
> Also, in the patch comment above you write "picodlp panel". The PicoDLP
> is not panel, so you shouldn't speak of picodlp panel.
> 
>  Tomi
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to picodlp panel
  2011-05-03 18:58   ` Tomi Valkeinen
@ 2011-05-04 14:31     ` Janorkar, Mayuresh
  2011-05-05  9:35       ` Tomi Valkeinen
  0 siblings, 1 reply; 19+ messages in thread
From: Janorkar, Mayuresh @ 2011-05-04 14:31 UTC (permalink / raw)
  To: Valkeinen, Tomi; +Cc: linux-omap, K, Mythri P



> -----Original Message-----
> From: Valkeinen, Tomi
> Sent: Wednesday, May 04, 2011 12:28 AM
> To: Janorkar, Mayuresh
> Cc: linux-omap@vger.kernel.org; K, Mythri P
> Subject: Re: [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to
> picodlp panel
> 
> On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> > From: Mythri P K <mythripk@ti.com>
> >
> > 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.
> >
> > Signed-off-by: Mythri P K <mythripk@ti.com>
> > Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
> > ---
> > Changes since v1:
> > 	1. Removed initial splash screen
> > 	2. i2c_commands regrouped
> > 	3. Removed long msleep
> > 	4. Added try-after-sleep in i2c_write
> >
> >  drivers/video/omap2/displays/panel-picodlp.c |  212
> ++++++++++++++++++++++++++
> >  1 files changed, 212 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/video/omap2/displays/panel-picodlp.c
> b/drivers/video/omap2/displays/panel-picodlp.c
> > index fdbfdcf..493a411 100644
> > --- a/drivers/video/omap2/displays/panel-picodlp.c
> > +++ b/drivers/video/omap2/displays/panel-picodlp.c
> > @@ -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,197 @@ 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, msg_count = 1, trial = 4;
> > +
> > +	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;
> > +	}
> > +retry:
> > +	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, msg_count);
> > +	mutex_unlock(&picodlp_i2c_data->xfer_lock);
> > +
> > +	/*
> > +	 * i2c_transfer returns:
> > +	 * number of messages sent in case of success
> > +	 * a negative error number in case of failure
> > +	 * i2c controller might timeout, in such a case sleep for sometime
> > +	 * and then retry
> > +	 */
> > +	if (r != msg_count) {
> > +		msleep(2);
> > +		if (trial--)
> > +			goto retry;
> 
> This is not good. Hacks like these should only be used as a last option.
> 
> I'm still saying that you should find the document mentioned in the
> documents you have. I refuse to believe that we (TI) do not know what
> our hardware does, especially in a basic issue like this.
> 
> I'm 99% sure there is documentation telling the required power-up
> sequence. And if that 1% happens, we should find the HW designers and
> yell at them until they make the documents.

Yes it is mentioned.
You can check it here:
https://focus.ti.com/myti/docs/extranet.tsp?sectionId=403

A delay is required after i2c client creation and it is 1 second.
So this part of code would be removed.

> 
>  Tomi
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* RE: [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to picodlp panel
  2011-05-04 14:31     ` Janorkar, Mayuresh
@ 2011-05-05  9:35       ` Tomi Valkeinen
  0 siblings, 0 replies; 19+ messages in thread
From: Tomi Valkeinen @ 2011-05-05  9:35 UTC (permalink / raw)
  To: Janorkar, Mayuresh; +Cc: linux-omap, K, Mythri P

On Wed, 2011-05-04 at 20:01 +0530, Janorkar, Mayuresh wrote:
> 
> > -----Original Message-----
> > From: Valkeinen, Tomi
> > Sent: Wednesday, May 04, 2011 12:28 AM
> > To: Janorkar, Mayuresh
> > Cc: linux-omap@vger.kernel.org; K, Mythri P
> > Subject: Re: [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to
> > picodlp panel
> > 
> > On Mon, 2011-05-02 at 20:22 +0530, Mayuresh Janorkar wrote:
> > > From: Mythri P K <mythripk@ti.com>
> > >
> > > 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.
> > >
> > > Signed-off-by: Mythri P K <mythripk@ti.com>
> > > Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
> > > ---
> > > Changes since v1:
> > > 	1. Removed initial splash screen
> > > 	2. i2c_commands regrouped
> > > 	3. Removed long msleep
> > > 	4. Added try-after-sleep in i2c_write
> > >
> > >  drivers/video/omap2/displays/panel-picodlp.c |  212
> > ++++++++++++++++++++++++++
> > >  1 files changed, 212 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/drivers/video/omap2/displays/panel-picodlp.c
> > b/drivers/video/omap2/displays/panel-picodlp.c
> > > index fdbfdcf..493a411 100644
> > > --- a/drivers/video/omap2/displays/panel-picodlp.c
> > > +++ b/drivers/video/omap2/displays/panel-picodlp.c
> > > @@ -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,197 @@ 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, msg_count = 1, trial = 4;
> > > +
> > > +	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;
> > > +	}
> > > +retry:
> > > +	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, msg_count);
> > > +	mutex_unlock(&picodlp_i2c_data->xfer_lock);
> > > +
> > > +	/*
> > > +	 * i2c_transfer returns:
> > > +	 * number of messages sent in case of success
> > > +	 * a negative error number in case of failure
> > > +	 * i2c controller might timeout, in such a case sleep for sometime
> > > +	 * and then retry
> > > +	 */
> > > +	if (r != msg_count) {
> > > +		msleep(2);
> > > +		if (trial--)
> > > +			goto retry;
> > 
> > This is not good. Hacks like these should only be used as a last option.
> > 
> > I'm still saying that you should find the document mentioned in the
> > documents you have. I refuse to believe that we (TI) do not know what
> > our hardware does, especially in a basic issue like this.
> > 
> > I'm 99% sure there is documentation telling the required power-up
> > sequence. And if that 1% happens, we should find the HW designers and
> > yell at them until they make the documents.
> 
> Yes it is mentioned.
> You can check it here:
> https://focus.ti.com/myti/docs/extranet.tsp?sectionId=403
> 
> A delay is required after i2c client creation and it is 1 second.
> So this part of code would be removed.

The document says that time between when PWRGOOD goes high and when the
first i2c command can be sent is 1 second. (although I have no idea what
PWRGOOD is since the gpio names in the code do not match any documents).

In that case you should probably store the current time when PWRGOOD is
set high, and wait before sending the first i2c commands so that one
second has passed since PWRGOOD.

If that happens in the same function it's most likely just the same to
use msleep(1) there.

 Tomi



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-05-05  9:35 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-02 14:52 [PATCH v2 0/7] picodlp projector driver Mayuresh Janorkar
2011-05-02 14:52 ` [PATCH v2 1/7] OMAP: DSS: Adding a header file for picodlp panel data Mayuresh Janorkar
2011-05-03 18:33   ` Tomi Valkeinen
2011-05-02 14:52 ` [PATCH v2 2/7] OMAP: DSS: Adding a picodlp panel header file Mayuresh Janorkar
2011-05-02 14:52 ` [PATCH v2 3/7] OMAP: DSS: Adding a picodlp panel driver Mayuresh Janorkar
2011-05-03 18:26   ` Tomi Valkeinen
2011-05-04  9:24     ` Janorkar, Mayuresh
2011-05-02 14:52 ` [PATCH v2 4/7] OMAP: DSS: Add i2c client driver for picodlp Mayuresh Janorkar
2011-05-03 18:44   ` Tomi Valkeinen
2011-05-04 10:01     ` Janorkar, Mayuresh
2011-05-04 11:05       ` Tomi Valkeinen
2011-05-04 14:29         ` Janorkar, Mayuresh
2011-05-02 14:52 ` [PATCH v2 5/7] OMAP: DSS: Adding initialization routine to picodlp panel Mayuresh Janorkar
2011-05-03 18:58   ` Tomi Valkeinen
2011-05-04 14:31     ` Janorkar, Mayuresh
2011-05-05  9:35       ` Tomi Valkeinen
2011-05-02 14:52 ` [PATCH v2 6/7] OMAP4: DSS: Adding a picodlp in OMAP4430 SDP board file Mayuresh Janorkar
2011-05-02 14:52 ` [PATCH v2 7/7] OMAP4: DSS: Adding picodlp panel entry in Kconfig and Makefile Mayuresh Janorkar
2011-05-03 19:06 ` [PATCH v2 0/7] picodlp projector driver Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).