linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
       [not found] <20090519232905.12760.15490.stgit@localhost>
@ 2009-05-19 23:37 ` Tony Lindgren
  2009-05-25  9:29   ` Russell King - ARM Linux
  2009-05-19 23:44 ` [PATCH 10/10] ARM: OMAP2: 2430SDP: Add FB support to board file Tony Lindgren
  1 sibling, 1 reply; 16+ messages in thread
From: Tony Lindgren @ 2009-05-19 23:37 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Imre Deak, Andrew de Quincey, linux-omap, linux-fbdev-devel

Make 770 LCD work by passing the clock from platform data.
Also remove the old unused functions.

Cc: linux-fbdev-devel@lists.sourceforge.net
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/board-nokia770.c     |   16 ++++++++++++++++
 arch/arm/plat-omap/include/mach/hwa742.h |    5 +----
 drivers/video/omap/hwa742.c              |   26 ++++++++++----------------
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 8780ca6..2c4785e 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -33,6 +33,7 @@
 #include <mach/common.h>
 #include <mach/dsp_common.h>
 #include <mach/omapfb.h>
+#include <mach/hwa742.h>
 #include <mach/lcd_mipid.h>
 #include <mach/mmc.h>
 #include <mach/usb.h>
@@ -163,6 +164,20 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
 	},
 };
 
+static struct hwa742_platform_data nokia770_hwa742_platform_data = {
+	.sys_ck 		= NULL,
+	.te_connected		= 1,
+};
+
+static void hwa742_dev_init(void)
+{
+	nokia770_hwa742_platform_data.sys_ck = clk_get(NULL, "bclk");
+	if (IS_ERR(nokia770_hwa742_platform_data.sys_ck)) {
+		printk(KERN_ERR "can't get HWA742 clock\n");
+	} else {
+		omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
+	}
+}
 
 /* assume no Mini-AB port */
 
@@ -371,6 +386,7 @@ static void __init omap_nokia770_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_dsp_init();
+	hwa742_dev_init();
 	ads7846_dev_init();
 	mipid_dev_init();
 	omap_usb_init(&nokia770_usb_config);
diff --git a/arch/arm/plat-omap/include/mach/hwa742.h b/arch/arm/plat-omap/include/mach/hwa742.h
index 577f492..c00e05d 100644
--- a/arch/arm/plat-omap/include/mach/hwa742.h
+++ b/arch/arm/plat-omap/include/mach/hwa742.h
@@ -2,10 +2,7 @@
 #define _HWA742_H
 
 struct hwa742_platform_data {
-	void		(*power_up)(struct device *dev);
-	void		(*power_down)(struct device *dev);
-	unsigned long	(*get_clock_rate)(struct device *dev);
-
+	struct clk 	*sys_ck;
 	unsigned	te_connected:1;
 };
 
diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c
index 8aa6e47..1230476 100644
--- a/drivers/video/omap/hwa742.c
+++ b/drivers/video/omap/hwa742.c
@@ -133,8 +133,7 @@ struct {
 	struct lcd_ctrl_extif	*extif;
 	struct lcd_ctrl		*int_ctrl;
 
-	void			(*power_up)(struct device *dev);
-	void			(*power_down)(struct device *dev);
+	struct clk		*sys_ck;
 } hwa742;
 
 struct lcd_ctrl hwa742_ctrl;
@@ -915,14 +914,13 @@ static void hwa742_suspend(void)
 	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
 	/* Enable sleep mode */
 	hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1);
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(hwa742.fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 }
 
 static void hwa742_resume(void)
 {
-	if (hwa742.power_up != NULL)
-		hwa742.power_up(hwa742.fbdev->dev);
+	clk_enable(hwa742.sys_ck);
+
 	/* Disable sleep mode */
 	hwa742_write_reg(HWA742_POWER_SAVE, 0);
 	while (1) {
@@ -955,14 +953,13 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 	omapfb_conf = fbdev->dev->platform_data;
 	ctrl_conf = omapfb_conf->ctrl_platform_data;
 
-	if (ctrl_conf == NULL || ctrl_conf->get_clock_rate == NULL) {
+	if (ctrl_conf == NULL || ctrl_conf->sys_ck == NULL) {
 		dev_err(fbdev->dev, "HWA742: missing platform data\n");
 		r = -ENOENT;
 		goto err1;
 	}
 
-	hwa742.power_down = ctrl_conf->power_down;
-	hwa742.power_up = ctrl_conf->power_up;
+	hwa742.sys_ck = ctrl_conf->sys_ck;
 
 	spin_lock_init(&hwa742.req_lock);
 
@@ -972,12 +969,11 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 	if ((r = hwa742.extif->init(fbdev)) < 0)
 		goto err2;
 
-	ext_clk = ctrl_conf->get_clock_rate(fbdev->dev);
+	ext_clk = clk_get_rate(hwa742.sys_ck);
 	if ((r = calc_extif_timings(ext_clk, &extif_mem_div)) < 0)
 		goto err3;
 	hwa742.extif->set_timings(&hwa742.reg_timings);
-	if (hwa742.power_up != NULL)
-		hwa742.power_up(fbdev->dev);
+	clk_enable(hwa742.sys_ck);
 
 	calc_hwa742_clk_rates(ext_clk, &sys_clk, &pix_clk);
 	if ((r = calc_extif_timings(sys_clk, &extif_mem_div)) < 0)
@@ -1040,8 +1036,7 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 
 	return 0;
 err4:
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 err3:
 	hwa742.extif->cleanup();
 err2:
@@ -1055,8 +1050,7 @@ static void hwa742_cleanup(void)
 	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
 	hwa742.extif->cleanup();
 	hwa742.int_ctrl->cleanup();
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(hwa742.fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 }
 
 struct lcd_ctrl hwa742_ctrl = {


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

* [PATCH 10/10] ARM: OMAP2: 2430SDP: Add FB support to board file
       [not found] <20090519232905.12760.15490.stgit@localhost>
  2009-05-19 23:37 ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Tony Lindgren
@ 2009-05-19 23:44 ` Tony Lindgren
  2009-05-25 17:42   ` [PATCH 11/10] ARM: OMAP: Add some entries to MAINTAINERS Tony Lindgren
  1 sibling, 1 reply; 16+ messages in thread
From: Tony Lindgren @ 2009-05-19 23:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kevin Hilman, Imre Deak, linux-omap, linux-fbdev-devel,
	Hunyue Yau

From: Imre Deak <imre.deak@nokia.com>

Based on an earlier patch by Hunyue Yau <hyau@mvista.com> with
board-*.c changes split to avoid conflicts with other device updates.

Cc: linux-fbdev-devel@lists.sourceforge.net
Signed-off-by: Hunyue Yau <hyau@mvista.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-2430sdp.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 788cfce..d1d467d 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -41,6 +41,7 @@
 #include "mmc-twl4030.h"
 
 #define SDP2430_CS0_BASE	0x04000000
+#define SECONDARY_LCD_GPIO		147
 
 static struct mtd_partition sdp2430_partitions[] = {
 	/* bootloader (U-Boot, etc) in first sector */
@@ -96,8 +97,18 @@ static struct platform_device sdp2430_flash_device = {
 	.resource	= &sdp2430_flash_resource,
 };
 
+static struct platform_device sdp2430_lcd_device = {
+	.name		= "sdp2430_lcd",
+	.id		= -1,
+};
+
 static struct platform_device *sdp2430_devices[] __initdata = {
 	&sdp2430_flash_device,
+	&sdp2430_lcd_device,
+};
+
+static struct omap_lcd_config sdp2430_lcd_config __initdata = {
+	.ctrl_name	= "internal",
 };
 
 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE)
@@ -135,6 +146,7 @@ static struct omap_uart_config sdp2430_uart_config __initdata = {
 
 static struct omap_board_config_kernel sdp2430_config[] = {
 	{OMAP_TAG_UART, &sdp2430_uart_config},
+	{OMAP_TAG_LCD, &sdp2430_lcd_config},
 };
 
 
@@ -182,6 +194,8 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
 
 static void __init omap_2430sdp_init(void)
 {
+	int ret;
+
 	omap2430_i2c_init();
 
 	platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
@@ -191,6 +205,11 @@ static void __init omap_2430sdp_init(void)
 	twl4030_mmc_init(mmc);
 	usb_musb_init();
 	board_smc91x_init();
+
+	/* Turn off secondary LCD backlight */
+	ret = gpio_request(SECONDARY_LCD_GPIO, "Secondary LCD backlight");
+	if (ret == 0)
+		gpio_direction_output(SECONDARY_LCD_GPIO, 0);
 }
 
 static void __init omap_2430sdp_map_io(void)


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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-19 23:37 ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Tony Lindgren
@ 2009-05-25  9:29   ` Russell King - ARM Linux
  2009-05-25 13:21     ` Andrew de Quincey
  0 siblings, 1 reply; 16+ messages in thread
From: Russell King - ARM Linux @ 2009-05-25  9:29 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-arm-kernel, Imre Deak, Andrew de Quincey, linux-omap,
	linux-fbdev-devel

On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
> Make 770 LCD work by passing the clock from platform data.
> Also remove the old unused functions.

I don't like this - because its passing struct clk's through platform
data.  That's not how things are supposed to work.

The way PXA solves this problem is to have clock aliases - see
clk_add_alias().

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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-25  9:29   ` Russell King - ARM Linux
@ 2009-05-25 13:21     ` Andrew de Quincey
  2009-05-25 16:40       ` Andrew de Quincey
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew de Quincey @ 2009-05-25 13:21 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Tony Lindgren, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:

> On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
>> Make 770 LCD work by passing the clock from platform data.
>> Also remove the old unused functions.
>
> I don't like this - because its passing struct clk's through platform
> data.  That's not how things are supposed to work.
>
> The way PXA solves this problem is to have clock aliases - see
> clk_add_alias().

Interesting idea - I now have a prototype patch implementing this,  
which I'll send when I get home (otherwise it would be an "it  
compiles" "test" :)

There isn't a common definition of clk_add_alias() though - that  
symbol is defined in arch/arm/mach-pxa/clock.c, so I had to copy it  
into arch/arm/plat-omap/clock.c



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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-25 13:21     ` Andrew de Quincey
@ 2009-05-25 16:40       ` Andrew de Quincey
  2009-05-28 18:20         ` Tony Lindgren
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew de Quincey @ 2009-05-25 16:40 UTC (permalink / raw)
  To: Andrew de Quincey
  Cc: Russell King - ARM Linux, Tony Lindgren, linux-arm-kernel,
	Imre Deak, linux-omap, linux-fbdev-devel

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]

Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:

> Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:
>
>> On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
>>> Make 770 LCD work by passing the clock from platform data.
>>> Also remove the old unused functions.
>>
>> I don't like this - because its passing struct clk's through platform
>> data.  That's not how things are supposed to work.
>>
>> The way PXA solves this problem is to have clock aliases - see
>> clk_add_alias().
>
> Interesting idea - I now have a prototype patch implementing this,  
> which I'll send when I get home (otherwise it would be an "it  
> compiles" "test" :)
>
> There isn't a common definition of clk_add_alias() though - that  
> symbol is defined in arch/arm/mach-pxa/clock.c, so I had to copy it  
> into arch/arm/plat-omap/clock.c

Attached is a patch implementing this method. I don't like the  
duplication of the clk_alias code, but I imagine that could be  
resolved if this method was chosen....

[-- Attachment #2: hwa-clk-alias.patch --]
[-- Type: text/x-patch, Size: 6007 bytes --]

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 8780ca6..e70fc7c 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -33,9 +33,11 @@
 #include <mach/common.h>
 #include <mach/dsp_common.h>
 #include <mach/omapfb.h>
+#include <mach/hwa742.h>
 #include <mach/lcd_mipid.h>
 #include <mach/mmc.h>
 #include <mach/usb.h>
+#include <mach/clock.h>
 
 #define ADS7846_PENDOWN_GPIO	15
 
@@ -163,6 +165,15 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
 	},
 };
 
+static struct hwa742_platform_data nokia770_hwa742_platform_data = {
+	.te_connected		= 1,
+};
+
+static void hwa742_dev_init(void)
+{
+	clk_add_alias("hwa_sys_ck", NULL, "bclk", NULL);
+	omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
+}
 
 /* assume no Mini-AB port */
 
@@ -371,6 +382,7 @@ static void __init omap_nokia770_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_dsp_init();
+	hwa742_dev_init();
 	ads7846_dev_init();
 	mipid_dev_init();
 	omap_usb_init(&nokia770_usb_config);
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 29efc27..862eefd 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -24,6 +24,7 @@
 #include <linux/debugfs.h>
 #include <linux/io.h>
 
+#include <asm/clkdev.h>
 #include <mach/clock.h>
 
 static LIST_HEAD(clocks);
@@ -359,6 +360,24 @@ static int __init clk_disable_unused(void)
 late_initcall(clk_disable_unused);
 #endif
 
+int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
+	struct device *dev)
+{
+	struct clk *r = clk_get(dev, id);
+	struct clk_lookup *l;
+
+	if (!r)
+		return -ENODEV;
+
+	l = clkdev_alloc(r, alias, alias_dev_name);
+	clk_put(r);
+	if (!l)
+		return -ENODEV;
+	clkdev_add(l);
+	return 0;
+}
+EXPORT_SYMBOL(clk_add_alias);												
+
 int __init clk_init(struct clk_functions * custom_clocks)
 {
 	if (!custom_clocks) {
diff --git a/arch/arm/plat-omap/include/mach/clock.h b/arch/arm/plat-omap/include/mach/clock.h
index 073a2c5..b53b047 100644
--- a/arch/arm/plat-omap/include/mach/clock.h
+++ b/arch/arm/plat-omap/include/mach/clock.h
@@ -127,12 +127,14 @@ extern void propagate_rate(struct clk *clk);
 extern void recalculate_root_clocks(void);
 extern unsigned long followparent_recalc(struct clk *clk);
 extern void clk_enable_init_clocks(void);
+extern int clk_add_alias(const char *alias, const char *alias_dev_name, char *id, struct device *dev); 	
 #ifdef CONFIG_CPU_FREQ
 extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
 #endif
 
 extern const struct clkops clkops_null;
 
+
 /* Clock flags */
 /* bit 0 is free */
 #define RATE_FIXED		(1 << 1)	/* Fixed clock rate */
diff --git a/arch/arm/plat-omap/include/mach/hwa742.h b/arch/arm/plat-omap/include/mach/hwa742.h
index 577f492..886248d 100644
--- a/arch/arm/plat-omap/include/mach/hwa742.h
+++ b/arch/arm/plat-omap/include/mach/hwa742.h
@@ -2,10 +2,6 @@
 #define _HWA742_H
 
 struct hwa742_platform_data {
-	void		(*power_up)(struct device *dev);
-	void		(*power_down)(struct device *dev);
-	unsigned long	(*get_clock_rate)(struct device *dev);
-
 	unsigned	te_connected:1;
 };
 
diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c
index 8aa6e47..5d4f348 100644
--- a/drivers/video/omap/hwa742.c
+++ b/drivers/video/omap/hwa742.c
@@ -133,8 +133,7 @@ struct {
 	struct lcd_ctrl_extif	*extif;
 	struct lcd_ctrl		*int_ctrl;
 
-	void			(*power_up)(struct device *dev);
-	void			(*power_down)(struct device *dev);
+	struct clk		*sys_ck;
 } hwa742;
 
 struct lcd_ctrl hwa742_ctrl;
@@ -915,14 +914,13 @@ static void hwa742_suspend(void)
 	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
 	/* Enable sleep mode */
 	hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1);
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(hwa742.fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 }
 
 static void hwa742_resume(void)
 {
-	if (hwa742.power_up != NULL)
-		hwa742.power_up(hwa742.fbdev->dev);
+	clk_enable(hwa742.sys_ck);
+
 	/* Disable sleep mode */
 	hwa742_write_reg(HWA742_POWER_SAVE, 0);
 	while (1) {
@@ -955,14 +953,13 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 	omapfb_conf = fbdev->dev->platform_data;
 	ctrl_conf = omapfb_conf->ctrl_platform_data;
 
-	if (ctrl_conf == NULL || ctrl_conf->get_clock_rate == NULL) {
+	if (ctrl_conf == NULL) {
 		dev_err(fbdev->dev, "HWA742: missing platform data\n");
 		r = -ENOENT;
 		goto err1;
 	}
 
-	hwa742.power_down = ctrl_conf->power_down;
-	hwa742.power_up = ctrl_conf->power_up;
+	hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck");
 
 	spin_lock_init(&hwa742.req_lock);
 
@@ -972,12 +969,11 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 	if ((r = hwa742.extif->init(fbdev)) < 0)
 		goto err2;
 
-	ext_clk = ctrl_conf->get_clock_rate(fbdev->dev);
+	ext_clk = clk_get_rate(hwa742.sys_ck);
 	if ((r = calc_extif_timings(ext_clk, &extif_mem_div)) < 0)
 		goto err3;
 	hwa742.extif->set_timings(&hwa742.reg_timings);
-	if (hwa742.power_up != NULL)
-		hwa742.power_up(fbdev->dev);
+	clk_enable(hwa742.sys_ck);
 
 	calc_hwa742_clk_rates(ext_clk, &sys_clk, &pix_clk);
 	if ((r = calc_extif_timings(sys_clk, &extif_mem_div)) < 0)
@@ -1040,8 +1036,7 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 
 	return 0;
 err4:
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 err3:
 	hwa742.extif->cleanup();
 err2:
@@ -1055,8 +1050,7 @@ static void hwa742_cleanup(void)
 	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
 	hwa742.extif->cleanup();
 	hwa742.int_ctrl->cleanup();
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(hwa742.fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 }
 
 struct lcd_ctrl hwa742_ctrl = {

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

* [PATCH 11/10] ARM: OMAP: Add some entries to MAINTAINERS
  2009-05-19 23:44 ` [PATCH 10/10] ARM: OMAP2: 2430SDP: Add FB support to board file Tony Lindgren
@ 2009-05-25 17:42   ` Tony Lindgren
  0 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2009-05-25 17:42 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kevin Hilman, jhnikula, Imre Deak, linux-omap, linux-fbdev-devel,
	Hunyue Yau, paul, jarkko.lavinen, dsaxena, felipe.balbi

[-- Attachment #1: Type: text/plain, Size: 101 bytes --]

Hi all,

Here are few omap entries to MAINTAINERS as discussed several times
before.

Regards,

Tony

[-- Attachment #2: maintainers.patch --]
[-- Type: text/x-diff, Size: 2656 bytes --]

From 7b0476d90c713d7315161bbbfe7bdcd98f3f9853 Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Mon, 25 May 2009 10:04:16 -0700
Subject: [PATCH] ARM: OMAP: Add some entries to MAINTAINERS

Add some entries to MAINTAINERS.

Also regroup all omap entries together, and remove an inactive
MMC maintainers entry, and Jarkko Lavinen instead.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/MAINTAINERS b/MAINTAINERS
index 2b349ba..177f216 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4119,6 +4119,69 @@ S:	Maintained
 F:	drivers/video/riva/
 F:	drivers/video/nvidia/
 
+OMAP SUPPORT
+P:	Tony Lindgren <tony@atomide.com>
+M:	tony@atomide.com
+L:	linux-omap@vger.kernel.org
+W:	http://www.muru.com/linux/omap/
+W:	http://linux.omap.com/
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git
+S:	Maintained
+F:	arch/arm/*omap*
+
+OMAP CLOCK FRAMEWORK SUPPORT
+P:	Paul Walmsley
+M:	paul@pwsan.com
+L:	linux-omap@vger.kernel.org
+S:	Maintained
+F:	arch/arm/*omap*/*clock*
+
+OMAP POWER MANAGEMENT SUPPORT
+P:	Kevin Hilman
+M:	khilman@deeprootsystems.com
+L:	linux-omap@vger.kernel.org
+S:	Maintained
+F:	arch/arm/*omap*/*pm*
+
+OMAP AUDIO SUPPORT
+P:	Jarkko Nikula
+M:	jhnikula@gmail.com
+L:	alsa-devel@alsa-project.org (subscribers-only)
+L:	linux-omap@vger.kernel.org
+S:	Maintained
+F:	sound/soc/omap/
+
+OMAP FRAMEBUFFER SUPPORT
+P:	Imre Deak
+M:	imre.deak@nokia.com
+L:	linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
+L:	linux-omap@vger.kernel.org
+S:	Maintained
+F:	drivers/video/omap/
+
+OMAP MMC SUPPORT
+P:	Jarkko Lavinen
+M:	jarkko.lavinen@nokia.com
+L:	linux-kernel@vger.kernel.org
+L:	linux-omap@vger.kernel.org
+S:	Maintained
+F:	drivers/mmc/host/*omap*
+
+OMAP RANDOM NUMBER GENERATOR SUPPORT
+P:	Deepak Saxena
+M:	dsaxena@plexity.net
+S:	Maintained
+F:	drivers/char/hw_random/omap-rng.c
+
+OMAP USB SUPPORT
+P:	Felipe Balbi
+M:	felipe.balbi@nokia.com
+P:	David Brownell
+M:	dbrownell@users.sourceforge.net
+L:	linux-usb@vger.kernel.org
+L:	linux-omap@vger.kernel.org
+S:	Maintained
+
 OMFS FILESYSTEM
 P:	Bob Copeland
 M:	me@bobcopeland.com
@@ -5507,20 +5570,6 @@ F:	drivers/misc/tifm*
 F:	drivers/mmc/host/tifm_sd.c
 F:	include/linux/tifm.h
 
-TI OMAP MMC INTERFACE DRIVER
-P:	Carlos Aguiar, Anderson Briglia and Syed Khasim
-M:	linux-omap@vger.kernel.org
-W:	http://linux.omap.com
-W:	http://www.muru.com/linux/omap/
-S:	Maintained
-F:	drivers/mmc/host/omap.c
-
-TI OMAP RANDOM NUMBER GENERATOR SUPPORT
-P:	Deepak Saxena
-M:	dsaxena@plexity.net
-S:	Maintained
-F:	drivers/char/hw_random/omap-rng.c
-
 TIPC NETWORK LAYER
 P:	Per Liden
 M:	per.liden@ericsson.com

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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-25 16:40       ` Andrew de Quincey
@ 2009-05-28 18:20         ` Tony Lindgren
  2009-05-28 18:44           ` Andrew de Quincey
                             ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Tony Lindgren @ 2009-05-28 18:20 UTC (permalink / raw)
  To: Andrew de Quincey
  Cc: Russell King - ARM Linux, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

* Andrew de Quincey <adq_dvb@lidskialf.net> [090525 09:41]:
> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>
>> Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:
>>
>>> On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
>>>> Make 770 LCD work by passing the clock from platform data.
>>>> Also remove the old unused functions.
>>>
>>> I don't like this - because its passing struct clk's through platform
>>> data.  That's not how things are supposed to work.
>>>
>>> The way PXA solves this problem is to have clock aliases - see
>>> clk_add_alias().
>>
>> Interesting idea - I now have a prototype patch implementing this,  
>> which I'll send when I get home (otherwise it would be an "it  
>> compiles" "test" :)
>>
>> There isn't a common definition of clk_add_alias() though - that  
>> symbol is defined in arch/arm/mach-pxa/clock.c, so I had to copy it  
>> into arch/arm/plat-omap/clock.c
>
> Attached is a patch implementing this method. I don't like the  
> duplication of the clk_alias code, but I imagine that could be resolved 
> if this method was chosen....

Andrew, can you please reply with your Signed-off-by?

Thanks,

Tony

> diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
> index 8780ca6..e70fc7c 100644
> --- a/arch/arm/mach-omap1/board-nokia770.c
> +++ b/arch/arm/mach-omap1/board-nokia770.c
> @@ -33,9 +33,11 @@
>  #include <mach/common.h>
>  #include <mach/dsp_common.h>
>  #include <mach/omapfb.h>
> +#include <mach/hwa742.h>
>  #include <mach/lcd_mipid.h>
>  #include <mach/mmc.h>
>  #include <mach/usb.h>
> +#include <mach/clock.h>
>  
>  #define ADS7846_PENDOWN_GPIO	15
>  
> @@ -163,6 +165,15 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
>  	},
>  };
>  
> +static struct hwa742_platform_data nokia770_hwa742_platform_data = {
> +	.te_connected		= 1,
> +};
> +
> +static void hwa742_dev_init(void)
> +{
> +	clk_add_alias("hwa_sys_ck", NULL, "bclk", NULL);
> +	omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
> +}
>  
>  /* assume no Mini-AB port */
>  
> @@ -371,6 +382,7 @@ static void __init omap_nokia770_init(void)
>  	omap_serial_init();
>  	omap_register_i2c_bus(1, 100, NULL, 0);
>  	omap_dsp_init();
> +	hwa742_dev_init();
>  	ads7846_dev_init();
>  	mipid_dev_init();
>  	omap_usb_init(&nokia770_usb_config);
> diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
> index 29efc27..862eefd 100644
> --- a/arch/arm/plat-omap/clock.c
> +++ b/arch/arm/plat-omap/clock.c
> @@ -24,6 +24,7 @@
>  #include <linux/debugfs.h>
>  #include <linux/io.h>
>  
> +#include <asm/clkdev.h>
>  #include <mach/clock.h>
>  
>  static LIST_HEAD(clocks);
> @@ -359,6 +360,24 @@ static int __init clk_disable_unused(void)
>  late_initcall(clk_disable_unused);
>  #endif
>  
> +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> +	struct device *dev)
> +{
> +	struct clk *r = clk_get(dev, id);
> +	struct clk_lookup *l;
> +
> +	if (!r)
> +		return -ENODEV;
> +
> +	l = clkdev_alloc(r, alias, alias_dev_name);
> +	clk_put(r);
> +	if (!l)
> +		return -ENODEV;
> +	clkdev_add(l);
> +	return 0;
> +}
> +EXPORT_SYMBOL(clk_add_alias);												
> +
>  int __init clk_init(struct clk_functions * custom_clocks)
>  {
>  	if (!custom_clocks) {
> diff --git a/arch/arm/plat-omap/include/mach/clock.h b/arch/arm/plat-omap/include/mach/clock.h
> index 073a2c5..b53b047 100644
> --- a/arch/arm/plat-omap/include/mach/clock.h
> +++ b/arch/arm/plat-omap/include/mach/clock.h
> @@ -127,12 +127,14 @@ extern void propagate_rate(struct clk *clk);
>  extern void recalculate_root_clocks(void);
>  extern unsigned long followparent_recalc(struct clk *clk);
>  extern void clk_enable_init_clocks(void);
> +extern int clk_add_alias(const char *alias, const char *alias_dev_name, char *id, struct device *dev); 	
>  #ifdef CONFIG_CPU_FREQ
>  extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
>  #endif
>  
>  extern const struct clkops clkops_null;
>  
> +
>  /* Clock flags */
>  /* bit 0 is free */
>  #define RATE_FIXED		(1 << 1)	/* Fixed clock rate */
> diff --git a/arch/arm/plat-omap/include/mach/hwa742.h b/arch/arm/plat-omap/include/mach/hwa742.h
> index 577f492..886248d 100644
> --- a/arch/arm/plat-omap/include/mach/hwa742.h
> +++ b/arch/arm/plat-omap/include/mach/hwa742.h
> @@ -2,10 +2,6 @@
>  #define _HWA742_H
>  
>  struct hwa742_platform_data {
> -	void		(*power_up)(struct device *dev);
> -	void		(*power_down)(struct device *dev);
> -	unsigned long	(*get_clock_rate)(struct device *dev);
> -
>  	unsigned	te_connected:1;
>  };
>  
> diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c
> index 8aa6e47..5d4f348 100644
> --- a/drivers/video/omap/hwa742.c
> +++ b/drivers/video/omap/hwa742.c
> @@ -133,8 +133,7 @@ struct {
>  	struct lcd_ctrl_extif	*extif;
>  	struct lcd_ctrl		*int_ctrl;
>  
> -	void			(*power_up)(struct device *dev);
> -	void			(*power_down)(struct device *dev);
> +	struct clk		*sys_ck;
>  } hwa742;
>  
>  struct lcd_ctrl hwa742_ctrl;
> @@ -915,14 +914,13 @@ static void hwa742_suspend(void)
>  	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
>  	/* Enable sleep mode */
>  	hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1);
> -	if (hwa742.power_down != NULL)
> -		hwa742.power_down(hwa742.fbdev->dev);
> +	clk_disable(hwa742.sys_ck);
>  }
>  
>  static void hwa742_resume(void)
>  {
> -	if (hwa742.power_up != NULL)
> -		hwa742.power_up(hwa742.fbdev->dev);
> +	clk_enable(hwa742.sys_ck);
> +
>  	/* Disable sleep mode */
>  	hwa742_write_reg(HWA742_POWER_SAVE, 0);
>  	while (1) {
> @@ -955,14 +953,13 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
>  	omapfb_conf = fbdev->dev->platform_data;
>  	ctrl_conf = omapfb_conf->ctrl_platform_data;
>  
> -	if (ctrl_conf == NULL || ctrl_conf->get_clock_rate == NULL) {
> +	if (ctrl_conf == NULL) {
>  		dev_err(fbdev->dev, "HWA742: missing platform data\n");
>  		r = -ENOENT;
>  		goto err1;
>  	}
>  
> -	hwa742.power_down = ctrl_conf->power_down;
> -	hwa742.power_up = ctrl_conf->power_up;
> +	hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck");
>  
>  	spin_lock_init(&hwa742.req_lock);
>  
> @@ -972,12 +969,11 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
>  	if ((r = hwa742.extif->init(fbdev)) < 0)
>  		goto err2;
>  
> -	ext_clk = ctrl_conf->get_clock_rate(fbdev->dev);
> +	ext_clk = clk_get_rate(hwa742.sys_ck);
>  	if ((r = calc_extif_timings(ext_clk, &extif_mem_div)) < 0)
>  		goto err3;
>  	hwa742.extif->set_timings(&hwa742.reg_timings);
> -	if (hwa742.power_up != NULL)
> -		hwa742.power_up(fbdev->dev);
> +	clk_enable(hwa742.sys_ck);
>  
>  	calc_hwa742_clk_rates(ext_clk, &sys_clk, &pix_clk);
>  	if ((r = calc_extif_timings(sys_clk, &extif_mem_div)) < 0)
> @@ -1040,8 +1036,7 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
>  
>  	return 0;
>  err4:
> -	if (hwa742.power_down != NULL)
> -		hwa742.power_down(fbdev->dev);
> +	clk_disable(hwa742.sys_ck);
>  err3:
>  	hwa742.extif->cleanup();
>  err2:
> @@ -1055,8 +1050,7 @@ static void hwa742_cleanup(void)
>  	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
>  	hwa742.extif->cleanup();
>  	hwa742.int_ctrl->cleanup();
> -	if (hwa742.power_down != NULL)
> -		hwa742.power_down(hwa742.fbdev->dev);
> +	clk_disable(hwa742.sys_ck);
>  }
>  
>  struct lcd_ctrl hwa742_ctrl = {

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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-28 18:20         ` Tony Lindgren
@ 2009-05-28 18:44           ` Andrew de Quincey
  2009-05-28 19:11             ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v2 Tony Lindgren
  2009-05-28 19:50           ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Russell King - ARM Linux
  2009-05-28 19:53           ` Russell King - ARM Linux
  2 siblings, 1 reply; 16+ messages in thread
From: Andrew de Quincey @ 2009-05-28 18:44 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Russell King - ARM Linux, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

Quoting Tony Lindgren <tony@atomide.com>:

> * Andrew de Quincey <adq_dvb@lidskialf.net> [090525 09:41]:
>> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>>
>>> Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:
>>>
>>>> On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
>>>>> Make 770 LCD work by passing the clock from platform data.
>>>>> Also remove the old unused functions.
>>>>
>>>> I don't like this - because its passing struct clk's through platform
>>>> data.  That's not how things are supposed to work.
>>>>
>>>> The way PXA solves this problem is to have clock aliases - see
>>>> clk_add_alias().
>>>
>>> Interesting idea - I now have a prototype patch implementing this,
>>> which I'll send when I get home (otherwise it would be an "it
>>> compiles" "test" :)
>>>
>>> There isn't a common definition of clk_add_alias() though - that
>>> symbol is defined in arch/arm/mach-pxa/clock.c, so I had to copy it
>>> into arch/arm/plat-omap/clock.c
>>
>> Attached is a patch implementing this method. I don't like the
>> duplication of the clk_alias code, but I imagine that could be resolved
>> if this method was chosen....
>
> Andrew, can you please reply with your Signed-off-by?

Sure - sorry I was holding off in case there were any comments on the  
method...

Signed-off-by: Andrew de Quincey <adq@lidskialf.net>


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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v2
  2009-05-28 18:44           ` Andrew de Quincey
@ 2009-05-28 19:11             ` Tony Lindgren
  2009-05-28 21:03               ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v3 Tony Lindgren
  0 siblings, 1 reply; 16+ messages in thread
From: Tony Lindgren @ 2009-05-28 19:11 UTC (permalink / raw)
  To: Andrew de Quincey
  Cc: Russell King - ARM Linux, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

* Andrew de Quincey <adq_dvb@lidskialf.net> [090528 11:44]:
> Quoting Tony Lindgren <tony@atomide.com>:
>
>> * Andrew de Quincey <adq_dvb@lidskialf.net> [090525 09:41]:
>>> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>>>
>>>> Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:
>>>>
>>>>> On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
>>>>>> Make 770 LCD work by passing the clock from platform data.
>>>>>> Also remove the old unused functions.
>>>>>
>>>>> I don't like this - because its passing struct clk's through platform
>>>>> data.  That's not how things are supposed to work.
>>>>>
>>>>> The way PXA solves this problem is to have clock aliases - see
>>>>> clk_add_alias().
>>>>
>>>> Interesting idea - I now have a prototype patch implementing this,
>>>> which I'll send when I get home (otherwise it would be an "it
>>>> compiles" "test" :)
>>>>
>>>> There isn't a common definition of clk_add_alias() though - that
>>>> symbol is defined in arch/arm/mach-pxa/clock.c, so I had to copy it
>>>> into arch/arm/plat-omap/clock.c
>>>
>>> Attached is a patch implementing this method. I don't like the
>>> duplication of the clk_alias code, but I imagine that could be resolved
>>> if this method was chosen....
>>
>> Andrew, can you please reply with your Signed-off-by?
>
> Sure - sorry I was holding off in case there were any comments on the  
> method...

I added a note about maybe moving the clk_add_alias() to
arch/arm/common/clkdev.c later.

Also noticed there were some whitespace errors, updated version below.

Regards,

Tony

> Signed-off-by: Andrew de Quincey <adq@lidskialf.net>
>

[-- Attachment #2: n770-clk-alias.patch --]
[-- Type: text/x-diff, Size: 6111 bytes --]

From ad4db2847911f5847efe678d3693ca13bd3ac2ea Mon Sep 17 00:00:00 2001
From: Andrew de Quincey <adq_dvb@lidskialf.net>
Date: Thu, 28 May 2009 11:54:31 -0700
Subject: [PATCH] ARM: OMAP1: Make 770 LCD work

Make 770 LCD work by adding clk_add_alias().
Also remove the old unused functions.

Note that the clk_add_alias() could probably be moved
to arch/arm/clkdev.c later on.

Cc: linux-fbdev-devel@lists.sourceforge.net
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com

--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -33,9 +33,11 @@
 #include <mach/common.h>
 #include <mach/dsp_common.h>
 #include <mach/omapfb.h>
+#include <mach/hwa742.h>
 #include <mach/lcd_mipid.h>
 #include <mach/mmc.h>
 #include <mach/usb.h>
+#include <mach/clock.h>

 #define ADS7846_PENDOWN_GPIO	15

@@ -163,6 +165,15 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
 	},
 };

+static struct hwa742_platform_data nokia770_hwa742_platform_data = {
+	.te_connected		= 1,
+};
+
+static void hwa742_dev_init(void)
+{
+	clk_add_alias("hwa_sys_ck", NULL, "bclk", NULL);
+	omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
+}

 /* assume no Mini-AB port */

@@ -371,6 +382,7 @@ static void __init omap_nokia770_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_dsp_init();
+	hwa742_dev_init();
 	ads7846_dev_init();
 	mipid_dev_init();
 	omap_usb_init(&nokia770_usb_config);

diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 29efc27..d137d42 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -24,6 +24,7 @@
 #include <linux/debugfs.h>
 #include <linux/io.h>
 
+#include <asm/clkdev.h>
 #include <mach/clock.h>
 
 static LIST_HEAD(clocks);
@@ -359,6 +360,24 @@ static int __init clk_disable_unused(void)
 late_initcall(clk_disable_unused);
 #endif
 
+int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
+	struct device *dev)
+{
+	struct clk *r = clk_get(dev, id);
+	struct clk_lookup *l;
+
+	if (!r)
+		return -ENODEV;
+
+	l = clkdev_alloc(r, alias, alias_dev_name);
+	clk_put(r);
+	if (!l)
+		return -ENODEV;
+	clkdev_add(l);
+	return 0;
+}
+EXPORT_SYMBOL(clk_add_alias);
+
 int __init clk_init(struct clk_functions * custom_clocks)
 {
 	if (!custom_clocks) {
diff --git a/arch/arm/plat-omap/include/mach/clock.h b/arch/arm/plat-omap/include/mach/clock.h
index 073a2c5..cf32d1b 100644
--- a/arch/arm/plat-omap/include/mach/clock.h
+++ b/arch/arm/plat-omap/include/mach/clock.h
@@ -127,6 +127,8 @@ extern void propagate_rate(struct clk *clk);
 extern void recalculate_root_clocks(void);
 extern unsigned long followparent_recalc(struct clk *clk);
 extern void clk_enable_init_clocks(void);
+extern int clk_add_alias(const char *alias, const char *alias_dev_name,
+				char *id, struct device *dev);
 #ifdef CONFIG_CPU_FREQ
 extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
 #endif
diff --git a/arch/arm/plat-omap/include/mach/hwa742.h b/arch/arm/plat-omap/include/mach/hwa742.h
index 577f492..886248d 100644
--- a/arch/arm/plat-omap/include/mach/hwa742.h
+++ b/arch/arm/plat-omap/include/mach/hwa742.h
@@ -2,10 +2,6 @@
 #define _HWA742_H
 
 struct hwa742_platform_data {
-	void		(*power_up)(struct device *dev);
-	void		(*power_down)(struct device *dev);
-	unsigned long	(*get_clock_rate)(struct device *dev);
-
 	unsigned	te_connected:1;
 };
 
diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c
index 8aa6e47..5d4f348 100644
--- a/drivers/video/omap/hwa742.c
+++ b/drivers/video/omap/hwa742.c
@@ -133,8 +133,7 @@ struct {
 	struct lcd_ctrl_extif	*extif;
 	struct lcd_ctrl		*int_ctrl;
 
-	void			(*power_up)(struct device *dev);
-	void			(*power_down)(struct device *dev);
+	struct clk		*sys_ck;
 } hwa742;
 
 struct lcd_ctrl hwa742_ctrl;
@@ -915,14 +914,13 @@ static void hwa742_suspend(void)
 	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
 	/* Enable sleep mode */
 	hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1);
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(hwa742.fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 }
 
 static void hwa742_resume(void)
 {
-	if (hwa742.power_up != NULL)
-		hwa742.power_up(hwa742.fbdev->dev);
+	clk_enable(hwa742.sys_ck);
+
 	/* Disable sleep mode */
 	hwa742_write_reg(HWA742_POWER_SAVE, 0);
 	while (1) {
@@ -955,14 +953,13 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 	omapfb_conf = fbdev->dev->platform_data;
 	ctrl_conf = omapfb_conf->ctrl_platform_data;
 
-	if (ctrl_conf == NULL || ctrl_conf->get_clock_rate == NULL) {
+	if (ctrl_conf == NULL) {
 		dev_err(fbdev->dev, "HWA742: missing platform data\n");
 		r = -ENOENT;
 		goto err1;
 	}
 
-	hwa742.power_down = ctrl_conf->power_down;
-	hwa742.power_up = ctrl_conf->power_up;
+	hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck");
 
 	spin_lock_init(&hwa742.req_lock);
 
@@ -972,12 +969,11 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 	if ((r = hwa742.extif->init(fbdev)) < 0)
 		goto err2;
 
-	ext_clk = ctrl_conf->get_clock_rate(fbdev->dev);
+	ext_clk = clk_get_rate(hwa742.sys_ck);
 	if ((r = calc_extif_timings(ext_clk, &extif_mem_div)) < 0)
 		goto err3;
 	hwa742.extif->set_timings(&hwa742.reg_timings);
-	if (hwa742.power_up != NULL)
-		hwa742.power_up(fbdev->dev);
+	clk_enable(hwa742.sys_ck);
 
 	calc_hwa742_clk_rates(ext_clk, &sys_clk, &pix_clk);
 	if ((r = calc_extif_timings(sys_clk, &extif_mem_div)) < 0)
@@ -1040,8 +1036,7 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 
 	return 0;
 err4:
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 err3:
 	hwa742.extif->cleanup();
 err2:
@@ -1055,8 +1050,7 @@ static void hwa742_cleanup(void)
 	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
 	hwa742.extif->cleanup();
 	hwa742.int_ctrl->cleanup();
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(hwa742.fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 }
 
 struct lcd_ctrl hwa742_ctrl = {

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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-28 18:20         ` Tony Lindgren
  2009-05-28 18:44           ` Andrew de Quincey
@ 2009-05-28 19:50           ` Russell King - ARM Linux
  2009-05-29  0:29             ` Andrew de Quincey
  2009-05-28 19:53           ` Russell King - ARM Linux
  2 siblings, 1 reply; 16+ messages in thread
From: Russell King - ARM Linux @ 2009-05-28 19:50 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Andrew de Quincey, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

On Thu, May 28, 2009 at 11:20:48AM -0700, Tony Lindgren wrote:
> * Andrew de Quincey <adq_dvb@lidskialf.net> [090525 09:41]:
> > Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
> >
> >> Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:
> >>
> >>> On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
> >>>> Make 770 LCD work by passing the clock from platform data.
> >>>> Also remove the old unused functions.
> >>>
> >>> I don't like this - because its passing struct clk's through platform
> >>> data.  That's not how things are supposed to work.
> >>>
> >>> The way PXA solves this problem is to have clock aliases - see
> >>> clk_add_alias().
> >>
> >> Interesting idea - I now have a prototype patch implementing this,  
> >> which I'll send when I get home (otherwise it would be an "it  
> >> compiles" "test" :)
> >>
> >> There isn't a common definition of clk_add_alias() though - that  
> >> symbol is defined in arch/arm/mach-pxa/clock.c, so I had to copy it  
> >> into arch/arm/plat-omap/clock.c
> >
> > Attached is a patch implementing this method. I don't like the  
> > duplication of the clk_alias code, but I imagine that could be resolved 
> > if this method was chosen....
> 
> Andrew, can you please reply with your Signed-off-by?

Actually, I'm very tempted to suggest that clk_add_alias() should go
into arch/arm/common/clkdev.c if we're going to have more people use it.

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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-28 18:20         ` Tony Lindgren
  2009-05-28 18:44           ` Andrew de Quincey
  2009-05-28 19:50           ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Russell King - ARM Linux
@ 2009-05-28 19:53           ` Russell King - ARM Linux
  2009-05-28 21:02             ` [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c (Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work) Tony Lindgren
  2 siblings, 1 reply; 16+ messages in thread
From: Russell King - ARM Linux @ 2009-05-28 19:53 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Andrew de Quincey, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

On Thu, May 28, 2009 at 11:20:48AM -0700, Tony Lindgren wrote:
> > +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> > +	struct device *dev)
> > +{
> > +	struct clk *r = clk_get(dev, id);
> > +	struct clk_lookup *l;
> > +
> > +	if (!r)
> > +		return -ENODEV;
> > +
> > +	l = clkdev_alloc(r, alias, alias_dev_name);
> > +	clk_put(r);
> > +	if (!l)
> > +		return -ENODEV;
> > +	clkdev_add(l);
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL(clk_add_alias);

Oh, and a really good thing to do would be to fix the error checking and
returning in there (why did I miss it in the original PXA version...)

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

* [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c (Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work)
  2009-05-28 19:53           ` Russell King - ARM Linux
@ 2009-05-28 21:02             ` Tony Lindgren
  2009-06-03 16:44               ` Tony Lindgren
  0 siblings, 1 reply; 16+ messages in thread
From: Tony Lindgren @ 2009-05-28 21:02 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Andrew de Quincey, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

[-- Attachment #1: Type: text/plain, Size: 797 bytes --]

* Russell King - ARM Linux <linux@arm.linux.org.uk> [090528 12:53]:
> On Thu, May 28, 2009 at 11:20:48AM -0700, Tony Lindgren wrote:
> > > +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> > > +	struct device *dev)
> > > +{
> > > +	struct clk *r = clk_get(dev, id);
> > > +	struct clk_lookup *l;
> > > +
> > > +	if (!r)
> > > +		return -ENODEV;
> > > +
> > > +	l = clkdev_alloc(r, alias, alias_dev_name);
> > > +	clk_put(r);
> > > +	if (!l)
> > > +		return -ENODEV;
> > > +	clkdev_add(l);
> > > +	return 0;
> > > +}
> > > +EXPORT_SYMBOL(clk_add_alias);
> 
> Oh, and a really good thing to do would be to fix the error checking and
> returning in there (why did I miss it in the original PXA version...)

How about this? The prototype is in clk.h now, is that OK?

Tony

[-- Attachment #2: clk-add-alias.patch --]
[-- Type: text/x-diff, Size: 2445 bytes --]

From e4e651822967b0530a9d092894c04149e28efe39 Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Thu, 28 May 2009 13:24:12 -0700
Subject: [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c

This can be used for other arm platforms too as discussed
on the linux-arm-kernel list.

Also check the return value with IS_ERR and return PTR_ERR
as suggested by Russell King.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
index 5589444..f37afd9 100644
--- a/arch/arm/common/clkdev.c
+++ b/arch/arm/common/clkdev.c
@@ -135,6 +135,24 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
 }
 EXPORT_SYMBOL(clkdev_alloc);
 
+int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
+	struct device *dev)
+{
+	struct clk *r = clk_get(dev, id);
+	struct clk_lookup *l;
+
+	if (IS_ERR(r))
+		return PTR_ERR(r);
+
+	l = clkdev_alloc(r, alias, alias_dev_name);
+	clk_put(r);
+	if (!l)
+		return -ENODEV;
+	clkdev_add(l);
+	return 0;
+}
+EXPORT_SYMBOL(clk_add_alias);
+
 /*
  * clkdev_drop - remove a clock dynamically allocated
  */
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index db52d2c..49ae382 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -86,20 +86,3 @@ void clks_register(struct clk_lookup *clks, size_t num)
 	for (i = 0; i < num; i++)
 		clkdev_add(&clks[i]);
 }
-
-int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
-	struct device *dev)
-{
-	struct clk *r = clk_get(dev, id);
-	struct clk_lookup *l;
-
-	if (!r)
-		return -ENODEV;
-
-	l = clkdev_alloc(r, alias, alias_dev_name);
-	clk_put(r);
-	if (!l)
-		return -ENODEV;
-	clkdev_add(l);
-	return 0;
-}
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 1db9bbf..1d37f42 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -142,4 +142,17 @@ struct clk *clk_get_parent(struct clk *clk);
  */
 struct clk *clk_get_sys(const char *dev_id, const char *con_id);
 
+/**
+ * clk_add_alias - add a new clock alias
+ * @alias: name for clock alias
+ * @alias_dev_name: device name
+ * @id: platform specific clock name
+ * @dev: device
+ *
+ * Allows using generic clock names for drivers by adding a new alias.
+ * Assumes clkdev, see clkdev.h for more info.
+ */
+int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
+			struct device *dev);
+
 #endif

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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v3
  2009-05-28 19:11             ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v2 Tony Lindgren
@ 2009-05-28 21:03               ` Tony Lindgren
  0 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2009-05-28 21:03 UTC (permalink / raw)
  To: Andrew de Quincey
  Cc: Russell King - ARM Linux, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

[-- Attachment #1: Type: text/plain, Size: 1751 bytes --]

* Tony Lindgren <tony@atomide.com> [090528 12:12]:
> * Andrew de Quincey <adq_dvb@lidskialf.net> [090528 11:44]:
> > Quoting Tony Lindgren <tony@atomide.com>:
> >
> >> * Andrew de Quincey <adq_dvb@lidskialf.net> [090525 09:41]:
> >>> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
> >>>
> >>>> Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:
> >>>>
> >>>>> On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
> >>>>>> Make 770 LCD work by passing the clock from platform data.
> >>>>>> Also remove the old unused functions.
> >>>>>
> >>>>> I don't like this - because its passing struct clk's through platform
> >>>>> data.  That's not how things are supposed to work.
> >>>>>
> >>>>> The way PXA solves this problem is to have clock aliases - see
> >>>>> clk_add_alias().
> >>>>
> >>>> Interesting idea - I now have a prototype patch implementing this,
> >>>> which I'll send when I get home (otherwise it would be an "it
> >>>> compiles" "test" :)
> >>>>
> >>>> There isn't a common definition of clk_add_alias() though - that
> >>>> symbol is defined in arch/arm/mach-pxa/clock.c, so I had to copy it
> >>>> into arch/arm/plat-omap/clock.c
> >>>
> >>> Attached is a patch implementing this method. I don't like the
> >>> duplication of the clk_alias code, but I imagine that could be resolved
> >>> if this method was chosen....
> >>
> >> Andrew, can you please reply with your Signed-off-by?
> >
> > Sure - sorry I was holding off in case there were any comments on the  
> > method...
> 
> I added a note about maybe moving the clk_add_alias() to
> arch/arm/common/clkdev.c later.
> 
> Also noticed there were some whitespace errors, updated version below.

One more time with clk_add_alias() in a separate patch.

Tony

[-- Attachment #2: n770-clk-alias-v3.patch --]
[-- Type: text/x-diff, Size: 4728 bytes --]

From b2b1702dccf8ab070ecf3fdb59c77c552bbc103f Mon Sep 17 00:00:00 2001
From: Andrew de Quincey <adq_dvb@lidskialf.net>
Date: Thu, 28 May 2009 13:47:48 -0700
Subject: [PATCH] ARM: OMAP1: Make 770 LCD work

Make 770 LCD work by adding clk_add_alias().
Also remove the old unused functions.

Note that the clk_add_alias() could probably be moved
to arch/arm/clkdev.c later on.

Cc: linux-fbdev-devel@lists.sourceforge.net
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 8780ca6..e70fc7c 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -33,9 +33,11 @@
 #include <mach/common.h>
 #include <mach/dsp_common.h>
 #include <mach/omapfb.h>
+#include <mach/hwa742.h>
 #include <mach/lcd_mipid.h>
 #include <mach/mmc.h>
 #include <mach/usb.h>
+#include <mach/clock.h>
 
 #define ADS7846_PENDOWN_GPIO	15
 
@@ -163,6 +165,15 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
 	},
 };
 
+static struct hwa742_platform_data nokia770_hwa742_platform_data = {
+	.te_connected		= 1,
+};
+
+static void hwa742_dev_init(void)
+{
+	clk_add_alias("hwa_sys_ck", NULL, "bclk", NULL);
+	omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data);
+}
 
 /* assume no Mini-AB port */
 
@@ -371,6 +382,7 @@ static void __init omap_nokia770_init(void)
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_dsp_init();
+	hwa742_dev_init();
 	ads7846_dev_init();
 	mipid_dev_init();
 	omap_usb_init(&nokia770_usb_config);
diff --git a/arch/arm/plat-omap/include/mach/hwa742.h b/arch/arm/plat-omap/include/mach/hwa742.h
index 577f492..886248d 100644
--- a/arch/arm/plat-omap/include/mach/hwa742.h
+++ b/arch/arm/plat-omap/include/mach/hwa742.h
@@ -2,10 +2,6 @@
 #define _HWA742_H
 
 struct hwa742_platform_data {
-	void		(*power_up)(struct device *dev);
-	void		(*power_down)(struct device *dev);
-	unsigned long	(*get_clock_rate)(struct device *dev);
-
 	unsigned	te_connected:1;
 };
 
diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c
index 8aa6e47..5d4f348 100644
--- a/drivers/video/omap/hwa742.c
+++ b/drivers/video/omap/hwa742.c
@@ -133,8 +133,7 @@ struct {
 	struct lcd_ctrl_extif	*extif;
 	struct lcd_ctrl		*int_ctrl;
 
-	void			(*power_up)(struct device *dev);
-	void			(*power_down)(struct device *dev);
+	struct clk		*sys_ck;
 } hwa742;
 
 struct lcd_ctrl hwa742_ctrl;
@@ -915,14 +914,13 @@ static void hwa742_suspend(void)
 	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
 	/* Enable sleep mode */
 	hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1);
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(hwa742.fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 }
 
 static void hwa742_resume(void)
 {
-	if (hwa742.power_up != NULL)
-		hwa742.power_up(hwa742.fbdev->dev);
+	clk_enable(hwa742.sys_ck);
+
 	/* Disable sleep mode */
 	hwa742_write_reg(HWA742_POWER_SAVE, 0);
 	while (1) {
@@ -955,14 +953,13 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 	omapfb_conf = fbdev->dev->platform_data;
 	ctrl_conf = omapfb_conf->ctrl_platform_data;
 
-	if (ctrl_conf == NULL || ctrl_conf->get_clock_rate == NULL) {
+	if (ctrl_conf == NULL) {
 		dev_err(fbdev->dev, "HWA742: missing platform data\n");
 		r = -ENOENT;
 		goto err1;
 	}
 
-	hwa742.power_down = ctrl_conf->power_down;
-	hwa742.power_up = ctrl_conf->power_up;
+	hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck");
 
 	spin_lock_init(&hwa742.req_lock);
 
@@ -972,12 +969,11 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 	if ((r = hwa742.extif->init(fbdev)) < 0)
 		goto err2;
 
-	ext_clk = ctrl_conf->get_clock_rate(fbdev->dev);
+	ext_clk = clk_get_rate(hwa742.sys_ck);
 	if ((r = calc_extif_timings(ext_clk, &extif_mem_div)) < 0)
 		goto err3;
 	hwa742.extif->set_timings(&hwa742.reg_timings);
-	if (hwa742.power_up != NULL)
-		hwa742.power_up(fbdev->dev);
+	clk_enable(hwa742.sys_ck);
 
 	calc_hwa742_clk_rates(ext_clk, &sys_clk, &pix_clk);
 	if ((r = calc_extif_timings(sys_clk, &extif_mem_div)) < 0)
@@ -1040,8 +1036,7 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode,
 
 	return 0;
 err4:
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 err3:
 	hwa742.extif->cleanup();
 err2:
@@ -1055,8 +1050,7 @@ static void hwa742_cleanup(void)
 	hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
 	hwa742.extif->cleanup();
 	hwa742.int_ctrl->cleanup();
-	if (hwa742.power_down != NULL)
-		hwa742.power_down(hwa742.fbdev->dev);
+	clk_disable(hwa742.sys_ck);
 }
 
 struct lcd_ctrl hwa742_ctrl = {

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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-28 19:50           ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Russell King - ARM Linux
@ 2009-05-29  0:29             ` Andrew de Quincey
  2009-06-01 13:57               ` Kalle Valo
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew de Quincey @ 2009-05-29  0:29 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Tony Lindgren, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:

> On Thu, May 28, 2009 at 11:20:48AM -0700, Tony Lindgren wrote:
>> * Andrew de Quincey <adq_dvb@lidskialf.net> [090525 09:41]:
>> > Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>> >
>> >> Quoting Russell King - ARM Linux <linux@arm.linux.org.uk>:
>> >>
>> >>> On Tue, May 19, 2009 at 04:37:32PM -0700, Tony Lindgren wrote:
>> >>>> Make 770 LCD work by passing the clock from platform data.
>> >>>> Also remove the old unused functions.
>> >>>
>> >>> I don't like this - because its passing struct clk's through platform
>> >>> data.  That's not how things are supposed to work.
>> >>>
>> >>> The way PXA solves this problem is to have clock aliases - see
>> >>> clk_add_alias().
>> >>
>> >> Interesting idea - I now have a prototype patch implementing this,
>> >> which I'll send when I get home (otherwise it would be an "it
>> >> compiles" "test" :)
>> >>
>> >> There isn't a common definition of clk_add_alias() though - that
>> >> symbol is defined in arch/arm/mach-pxa/clock.c, so I had to copy it
>> >> into arch/arm/plat-omap/clock.c
>> >
>> > Attached is a patch implementing this method. I don't like the
>> > duplication of the clk_alias code, but I imagine that could be resolved
>> > if this method was chosen....
>>
>> Andrew, can you please reply with your Signed-off-by?
>
> Actually, I'm very tempted to suggest that clk_add_alias() should go
> into arch/arm/common/clkdev.c if we're going to have more people use it.

Cool!

Out of interest, what is the best practice way to pass platform  
specific GPIOs around? There are a number of other n770 related  
drivers I'm intending on cleaning up, several of which have GPIO  
numbers hardcoded in them. Should these be passed in platform  
structures, or is there something analogous to the clk_alias for GPIOs?


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

* Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work
  2009-05-29  0:29             ` Andrew de Quincey
@ 2009-06-01 13:57               ` Kalle Valo
  0 siblings, 0 replies; 16+ messages in thread
From: Kalle Valo @ 2009-06-01 13:57 UTC (permalink / raw)
  To: Andrew de Quincey
  Cc: Russell King - ARM Linux, Tony Lindgren, linux-arm-kernel,
	Imre Deak, linux-omap, linux-fbdev-devel

Andrew de Quincey <adq_dvb@lidskialf.net> writes:

> Out of interest, what is the best practice way to pass platform
> specific GPIOs around? There are a number of other n770 related
> drivers I'm intending on cleaning up, several of which have GPIO
> numbers hardcoded in them. Should these be passed in platform
> structures, or is there something analogous to the clk_alias for
> GPIOs?

I was told that platform structures are the preferred way. For wl12xx (a
wi-fi driver) I created a set_power function pointer which will control
the power gpio line:

27 struct wl12xx_platform_data {
28         void (*set_power)(bool enable);
29 };

http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=blob;f=include/linux/spi/wl12xx.h;h=11430cab2aad71242946ebfc7c0ce778d8bf26a1;hb=HEAD

And the irq is configured in the board file and provided to wl12xx with
struct spi_device.irq. So wl12xx doesn't use gpio code at all, it's all
done in the board file. 

Please comment if this isn't the correct way to do this.

-- 
Kalle Valo

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

* Re: [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c (Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work)
  2009-05-28 21:02             ` [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c (Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work) Tony Lindgren
@ 2009-06-03 16:44               ` Tony Lindgren
  0 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2009-06-03 16:44 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Andrew de Quincey, linux-arm-kernel, Imre Deak, linux-omap,
	linux-fbdev-devel

* Tony Lindgren <tony@atomide.com> [090528 14:05]:
> * Russell King - ARM Linux <linux@arm.linux.org.uk> [090528 12:53]:
> > On Thu, May 28, 2009 at 11:20:48AM -0700, Tony Lindgren wrote:
> > > > +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> > > > +	struct device *dev)
> > > > +{
> > > > +	struct clk *r = clk_get(dev, id);
> > > > +	struct clk_lookup *l;
> > > > +
> > > > +	if (!r)
> > > > +		return -ENODEV;
> > > > +
> > > > +	l = clkdev_alloc(r, alias, alias_dev_name);
> > > > +	clk_put(r);
> > > > +	if (!l)
> > > > +		return -ENODEV;
> > > > +	clkdev_add(l);
> > > > +	return 0;
> > > > +}
> > > > +EXPORT_SYMBOL(clk_add_alias);
> > 
> > Oh, and a really good thing to do would be to fix the error checking and
> > returning in there (why did I miss it in the original PXA version...)
> 
> How about this? The prototype is in clk.h now, is that OK?

Added to patch tracking as 5536/1.
 
> Tony

> From e4e651822967b0530a9d092894c04149e28efe39 Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony@atomide.com>
> Date: Thu, 28 May 2009 13:24:12 -0700
> Subject: [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c
> 
> This can be used for other arm platforms too as discussed
> on the linux-arm-kernel list.
> 
> Also check the return value with IS_ERR and return PTR_ERR
> as suggested by Russell King.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
> index 5589444..f37afd9 100644
> --- a/arch/arm/common/clkdev.c
> +++ b/arch/arm/common/clkdev.c
> @@ -135,6 +135,24 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
>  }
>  EXPORT_SYMBOL(clkdev_alloc);
>  
> +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> +	struct device *dev)
> +{
> +	struct clk *r = clk_get(dev, id);
> +	struct clk_lookup *l;
> +
> +	if (IS_ERR(r))
> +		return PTR_ERR(r);
> +
> +	l = clkdev_alloc(r, alias, alias_dev_name);
> +	clk_put(r);
> +	if (!l)
> +		return -ENODEV;
> +	clkdev_add(l);
> +	return 0;
> +}
> +EXPORT_SYMBOL(clk_add_alias);
> +
>  /*
>   * clkdev_drop - remove a clock dynamically allocated
>   */
> diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
> index db52d2c..49ae382 100644
> --- a/arch/arm/mach-pxa/clock.c
> +++ b/arch/arm/mach-pxa/clock.c
> @@ -86,20 +86,3 @@ void clks_register(struct clk_lookup *clks, size_t num)
>  	for (i = 0; i < num; i++)
>  		clkdev_add(&clks[i]);
>  }
> -
> -int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> -	struct device *dev)
> -{
> -	struct clk *r = clk_get(dev, id);
> -	struct clk_lookup *l;
> -
> -	if (!r)
> -		return -ENODEV;
> -
> -	l = clkdev_alloc(r, alias, alias_dev_name);
> -	clk_put(r);
> -	if (!l)
> -		return -ENODEV;
> -	clkdev_add(l);
> -	return 0;
> -}
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 1db9bbf..1d37f42 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -142,4 +142,17 @@ struct clk *clk_get_parent(struct clk *clk);
>   */
>  struct clk *clk_get_sys(const char *dev_id, const char *con_id);
>  
> +/**
> + * clk_add_alias - add a new clock alias
> + * @alias: name for clock alias
> + * @alias_dev_name: device name
> + * @id: platform specific clock name
> + * @dev: device
> + *
> + * Allows using generic clock names for drivers by adding a new alias.
> + * Assumes clkdev, see clkdev.h for more info.
> + */
> +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> +			struct device *dev);
> +
>  #endif


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

end of thread, other threads:[~2009-06-03 16:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20090519232905.12760.15490.stgit@localhost>
2009-05-19 23:37 ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Tony Lindgren
2009-05-25  9:29   ` Russell King - ARM Linux
2009-05-25 13:21     ` Andrew de Quincey
2009-05-25 16:40       ` Andrew de Quincey
2009-05-28 18:20         ` Tony Lindgren
2009-05-28 18:44           ` Andrew de Quincey
2009-05-28 19:11             ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v2 Tony Lindgren
2009-05-28 21:03               ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v3 Tony Lindgren
2009-05-28 19:50           ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Russell King - ARM Linux
2009-05-29  0:29             ` Andrew de Quincey
2009-06-01 13:57               ` Kalle Valo
2009-05-28 19:53           ` Russell King - ARM Linux
2009-05-28 21:02             ` [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c (Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work) Tony Lindgren
2009-06-03 16:44               ` Tony Lindgren
2009-05-19 23:44 ` [PATCH 10/10] ARM: OMAP2: 2430SDP: Add FB support to board file Tony Lindgren
2009-05-25 17:42   ` [PATCH 11/10] ARM: OMAP: Add some entries to MAINTAINERS Tony Lindgren

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).