Skip to contentSkip to conversation

board_nokia770: add hwa742 platform data

PATCH In review Arnaud Patard (Rtp) 3 participants 3 messages Mar 4, 2007 – Mar 7, 2007

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board_nokia770: add hwa742 platform data

The n800fb changes introduced some platform_data for the hwa742 and needs now to be defined for getting it working. This patch adds the necessary bits needed for getting fb working again on n770. This patch comes from the n800 kernel from maemo.org

---
arch/arm/mach-omap1/board-nokia770.c | 45 45 + 0 - 0 !

 1 file changed, 45 insertions(+)
arch/arm/mach-omap1/board-nokia770.c +45 -0
Index: linux-omap-2.6/arch/arm/mach-omap1/board-nokia770.c
===================================================================
@@ -34,7 +34,9 @@
 #include <asm/arch/dsp_common.h>
 #include <asm/arch/aic23.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/omapfb.h>
 #include <asm/arch/lcd_mipid.h>
+#include <asm/arch/hwa742.h>
 
 #include "../plat-omap/dsp/dsp_common.h"
 
@@ -164,6 +166,48 @@ static struct spi_board_info nokia770_sp
 	},
 };
 
+static struct {
+	struct clk *sys_ck;
+} hwa742;
+
+static int hwa742_get_clocks(void)
+{
+	hwa742.sys_ck = clk_get(NULL, "bclk");
+	if (IS_ERR(hwa742.sys_ck)) {
+		printk(KERN_ERR "can't get HWA742 clock\n");
+		return PTR_ERR(hwa742.sys_ck);
+	}
+	return 0;
+}
+
+static unsigned long hwa742_get_clock_rate(struct device *dev)
+{
+	return clk_get_rate(hwa742.sys_ck);
+}
+
+static void hwa742_power_up(struct device *dev)
+{
+	clk_enable(hwa742.sys_ck);
+}
+
+static void hwa742_power_down(struct device *dev)
+{
+	clk_disable(hwa742.sys_ck);
+}
+
+static struct hwa742_platform_data nokia770_hwa742_platform_data = {
+	.get_clock_rate	= hwa742_get_clock_rate,
+	.power_up	= hwa742_power_up,
+	.power_down	= hwa742_power_down,
+	.te_connected	= 1,
+};
+
+static void hwa742_dev_init(void)
+{
+	hwa742_get_clocks();
+	omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
+}
+
 
 /* assume no Mini-AB port */
 
@@ -332,6 +376,7 @@ static void __init omap_nokia770_init(vo
 	omap_gpio_init();
 	omap_serial_init();
 	omap_dsp_init();
+	hwa742_dev_init();
 	lph8923_dev_init();
 	ads7846_dev_init();
 }
#1 lore raw
Quoted 8 lines · Arnaud Patard

The n800fb changes introduced some platform_data for the hwa742 and needs now to be defined for getting it working. This patch adds the necessary bits needed for getting fb working again on n770. This patch comes from the n800 kernel from maemo.org

Thanks for pointing this out. In this updated patch I adding missing init / registration for other devices, as well as API fixes for the SoSSI / HWA742 code.

With these LCD, touchscreen should work ok on the N770, after the omap_uwire code is merged from upstream.

--Imre

Quoted 1 line

From 177959ac68f637dd0397e8f22e29a9f080fb0e36 Mon Sep 17 00:00:00 2001

From: Imre Deak <[email protected]>
Date: Tue, 6 Mar 2007 18:20:00 +0200
Subject: [PATCH] ARM: N770: add missing LCD, LCD controller, touchscreen device registration

These were left out from the board file when merging these drivers, add them here.

Call GPIO init from the board file as well, since the platform device init code uses the GPIO API.

---
 arch/arm/mach-omap1/board-nokia770.c |   88 ++++++++++++++++++++++++++++++++++
 1 files changed, 88 insertions(+), 0 deletions(-)
arch/arm/mach-omap1/board-nokia770.c +88 -0
index 8ea0cef..acb2331 100644
@@ -33,9 +33,14 @@
 #include <asm/arch/dsp_common.h>
 #include <asm/arch/aic23.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/omapfb.h>
+#include <asm/arch/hwa742.h>
+#include <asm/arch/lcd_mipid.h>
 
 #include "../plat-omap/dsp/dsp_common.h"
 
+#define ADS7846_PENDOWN_GPIO	15
+
 static void __init omap_nokia770_init_irq(void)
 {
 	/* On Nokia 770, the SleepX signal is masked with an
@@ -96,6 +101,41 @@ static struct platform_device *nokia770_devices[] __initdata = {
 	&nokia770_kp_device,
 };
 
+static void mipid_shutdown(struct mipid_platform_data *pdata)
+{
+	if (pdata->nreset_gpio != -1) {
+		printk(KERN_INFO "shutdown LCD\n");
+		omap_set_gpio_dataout(pdata->nreset_gpio, 0);
+		msleep(120);
+	}
+}
+
+static struct mipid_platform_data nokia770_mipid_platform_data = {
+	.shutdown = mipid_shutdown,
+};
+
+static void mipid_dev_init(void)
+{
+	const struct omap_lcd_config *conf;
+
+	conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
+	if (conf != NULL) {
+		nokia770_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
+		nokia770_mipid_platform_data.data_lines = conf->data_lines;
+	}
+}
+
+static void ads7846_dev_init(void)
+{
+	if (omap_request_gpio(ADS7846_PENDOWN_GPIO) < 0)
+		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
+}
+
+static int ads7846_get_pendown_state(void)
+{
+	return !omap_get_gpio_datain(ADS7846_PENDOWN_GPIO);
+}
+
 static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
 	.x_max		= 0x0fff,
 	.y_max		= 0x0fff,
@@ -103,6 +143,8 @@ static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata =
 	.pressure_max	= 255,
 	.debounce_max	= 10,
 	.debounce_tol	= 3,
+	.debounce_rep	= 1,
+	.get_pendown_state	= ads7846_get_pendown_state,
 };
 
 static struct spi_board_info nokia770_spi_board_info[] __initdata = {
@@ -111,6 +153,7 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
 		.bus_num        = 2,
 		.chip_select    = 3,
 		.max_speed_hz   = 12000000,
+		.platform_data	= &nokia770_mipid_platform_data,
 	},
 	[1] = {
 		.modalias       = "ads7846",
@@ -122,6 +165,47 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
 	},
 };
 
+static struct {
+	struct clk *sys_ck;
+} hwa742;
+
+static int hwa742_get_clocks(void)
+{
+	hwa742.sys_ck = clk_get(NULL, "bclk");
+	if (IS_ERR(hwa742.sys_ck)) {
+		printk(KERN_ERR "can't get HWA742 clock\n");
+		return PTR_ERR(hwa742.sys_ck);
+	}
+	return 0;
+}
+
+static unsigned long hwa742_get_clock_rate(struct device *dev)
+{
+	return clk_get_rate(hwa742.sys_ck);
+}
+
+static void hwa742_power_up(struct device *dev)
+{
+	clk_enable(hwa742.sys_ck);
+}
+
+static void hwa742_power_down(struct device *dev)
+{
+	clk_disable(hwa742.sys_ck);
+}
+
+static struct hwa742_platform_data nokia770_hwa742_platform_data = {
+	.get_clock_rate	= hwa742_get_clock_rate,
+	.power_up	= hwa742_power_up,
+	.power_down	= hwa742_power_down,
+	.te_connected	= 1,
+};
+
+static void hwa742_dev_init(void)
+{
+	hwa742_get_clocks();
+	omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
+}
 
 /* assume no Mini-AB port */
 
@@ -287,8 +371,12 @@ static void __init omap_nokia770_init(void)
 				ARRAY_SIZE(nokia770_spi_board_info));
 	omap_board_config = nokia770_config;
 	omap_board_config_size = ARRAY_SIZE(nokia770_config);
+	omap_gpio_init();
 	omap_serial_init();
 	omap_dsp_init();
+	hwa742_dev_init();
+	ads7846_dev_init();
+	mipid_dev_init();
 }
 
 static void __init omap_nokia770_map_io(void)
Signature · 1 line
1.5.0.rc3
Quoted 1 line

From 1b1197720183c12f9202b11ed6dd4328f31cc37e Mon Sep 17 00:00:00 2001

From: Imre Deak <[email protected]>
Date: Tue, 6 Mar 2007 18:27:16 +0200
Subject: [PATCH] ARM: OMAP1: SoSSI: update IRQ name and callback table name

These were changed in the generic FB code, but not updated for the OMAP1 specific parts.

---
 drivers/video/omap/sossi.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/video/omap/sossi.c +4 -2
index 71467b3..505b932 100644
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/clk.h>
+#include <linux/irq.h>
 
 #include <asm/io.h>
 
@@ -640,7 +641,8 @@ static int sossi_init(struct omapfb_device *fbdev)
 	l &= ~(1 << 31); /* REORDERING */
 	sossi_write_reg(SOSSI_INIT1_REG, l);
 
-	if ((r = request_irq(INT_SOSSI_MATCH, sossi_match_irq, IRQT_FALLING,
+	if ((r = request_irq(INT_1610_SoSSI_MATCH, sossi_match_irq,
+			     IRQT_FALLING,
 	     "sossi_match", sossi.fbdev->dev)) < 0) {
 		dev_err(sossi.fbdev->dev, "can't get SoSSI match IRQ\n");
 		goto err;
@@ -661,7 +663,7 @@ static void sossi_cleanup(void)
 	clk_put(sossi.fck);
 }
 
-struct lcd_ctrl_extif sossi_extif = {
+struct lcd_ctrl_extif omap1_ext_if = {
 	.init			= sossi_init,
 	.cleanup		= sossi_cleanup,
 	.get_clk_info		= sossi_get_clk_info,
Signature · 1 line
1.5.0.rc3
Quoted 1 line

From 45e70c8c6cb959b1b3e5d8a2077fcb86b822ec1a Mon Sep 17 00:00:00 2001

From: Imre Deak <[email protected]>
Date: Tue, 6 Mar 2007 18:35:00 +0200
Subject: [PATCH] ARM: OMAP: HWA742: fix capability query callback

This was changed in the generic FB code, but not updated in the HWA742 specific part.

---
 drivers/video/omap/hwa742.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
drivers/video/omap/hwa742.c +7 -6
index 67a7484..5d92f59 100644
@@ -893,14 +893,15 @@ static int setup_tearsync(unsigned long pix_clk, int extif_div)
 					    hs_pol_inv, vs_pol_inv, extif_div);
 }
 
-static unsigned long hwa742_get_caps(void)
+static void hwa742_get_caps(int plane, struct omapfb_caps *caps)
 {
-	unsigned long caps;
-
-	caps = OMAPFB_CAPS_MANUAL_UPDATE;
+	hwa742.int_ctrl->get_caps(plane, caps);
+	caps->ctrl |= OMAPFB_CAPS_MANUAL_UPDATE |
+		      OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE;
 	if (hwa742.te_connected)
-		caps |= OMAPFB_CAPS_TEARSYNC;
-	return caps;
+		caps->ctrl |= OMAPFB_CAPS_TEARSYNC;
+	caps->wnd_color |= (1 << OMAPFB_COLOR_RGB565) |
+			   (1 << OMAPFB_COLOR_YUV420);
 }
 
 static void hwa742_suspend(void)
Signature · 1 line
1.5.0.rc3
Quoted 1 line

From 902056d8e38ebca482c927492e2d2dee0e3dc6da Mon Sep 17 00:00:00 2001

From: Imre Deak <[email protected]>
Date: Tue, 6 Mar 2007 18:46:48 +0200
Subject: [PATCH] ARM: N770: update n770_defconfig

Add lcd_mipid.

---
 arch/arm/configs/n770_defconfig |  307 ++++++++++++++++++++++++++++-----------
 1 files changed, 222 insertions(+), 85 deletions(-)
arch/arm/configs/n770_defconfig +222 -85

901 lines not on this page · raw message

Signature · 1 line
1.5.0.rc3
reviewer
#2 lore raw
Quoted 8 lines · Imre Deak
Quoted 7 lines · Arnaud Patard

The n800fb changes introduced some platform_data for the hwa742 and needs now to be defined for getting it working. This patch adds the necessary bits needed for getting fb working again on n770. This patch comes from the n800 kernel from maemo.org

Quoted 8 lines
Quoted 1 line

Thanks for pointing this out. In this updated patch I adding missing init / registration for other devices, as well as API fixes for the SoSSI / HWA742 code.

With these LCD, touchscreen should work ok on the N770, after the omap_uwire code is merged from upstream.

Pushing patch 1 to omap-upstream, 2 - 3 to omap-drivers, and 4 to master branch.

Tony