* [PATCH 00/21] OMAPDSS: DT preparation patches
@ 2012-03-07 12:44 Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling Tomi Valkeinen
` (20 more replies)
0 siblings, 21 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
Hi,
I started cleaning up and restructuring omapdss for device tree, and here's the
first set of patches from that ordeal. There's nothing DT specific in these
patches, but they are mostly generic cleanups that make sense even without DT.
The custom pdev creation depends on the following patches posted on l-o:
ARM: OMAP: remove omap_device_parent
ARM: OMAP: omap_device: Expose omap_device_{alloc, delete, register}
This series can also be found from:
git://gitorious.org/linux-omap-dss2/linux.git work/devtree-base
Tomi
Tomi Valkeinen (21):
OMAPDSS: panel-dvi: add PD gpio handling
OMAP: board-files: remove custom PD GPIO handling for DVI output
OMAPDSS: TFP410: rename dvi -> tfp410
OMAPDSS: TFP410: rename dvi files to tfp410
OMAPDSS: TFP410: pdata rewrite
OMAPDSS: DSI: use dsi_get_dsidev_id(dsidev) instead of dsidev->id
OMAPDSS: Taal: move reset gpio handling to taal driver
OMAPDSS: clean up the omapdss platform data mess
OMAPDSS: remove return from platform_driver_unreg
OMAPDSS: use platform_driver_probe for core/dispc/dss
OMAPDSS: register dss drivers in module init
OMAPDSS: create custom pdevs for DSS omap_devices
OMAPDSS: create DPI & SDI devices
OMAPDSS: create DPI & SDI drivers
OMAPDSS: remove uses of dss_runtime_get/put
OMAPDSS: handle output-driver reg/unreg more dynamically
OMAPDSS: move the creation of debugfs files
OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi
OMAPDSS: add __init & __exit
OMAPFB: add __init & __exit
OMAPDSS: change default_device handling
arch/arm/mach-omap2/board-3430sdp.c | 38 +---
arch/arm/mach-omap2/board-4430sdp.c | 16 --
arch/arm/mach-omap2/board-am3517evm.c | 25 +--
arch/arm/mach-omap2/board-cm-t35.c | 30 +--
arch/arm/mach-omap2/board-devkit8000.c | 30 +--
arch/arm/mach-omap2/board-igep0020.c | 32 +--
arch/arm/mach-omap2/board-omap3beagle.c | 37 +---
arch/arm/mach-omap2/board-omap3evm.c | 29 +--
arch/arm/mach-omap2/board-omap3stalker.c | 29 +--
arch/arm/mach-omap2/board-omap4panda.c | 39 +---
arch/arm/mach-omap2/board-overo.c | 25 +--
arch/arm/mach-omap2/display.c | 172 +++++++++++--
drivers/video/omap2/displays/Kconfig | 8 +-
drivers/video/omap2/displays/Makefile | 2 +-
drivers/video/omap2/displays/panel-taal.c | 15 ++
.../omap2/displays/{panel-dvi.c => panel-tfp410.c} | 186 ++++++++------
drivers/video/omap2/dss/core.c | 260 +++++++++++++-------
drivers/video/omap2/dss/dispc.c | 50 ++---
drivers/video/omap2/dss/dpi.c | 38 ++--
drivers/video/omap2/dss/dsi.c | 86 ++-----
drivers/video/omap2/dss/dss.c | 46 ++---
drivers/video/omap2/dss/dss.h | 76 +-----
drivers/video/omap2/dss/hdmi.c | 55 +----
drivers/video/omap2/dss/rfbi.c | 31 +--
drivers/video/omap2/dss/sdi.c | 31 ++-
drivers/video/omap2/dss/venc.c | 31 +--
drivers/video/omap2/omapfb/omapfb-main.c | 9 +-
.../{omap-panel-dvi.h => omap-panel-tfp410.h} | 18 +-
include/video/omapdss.h | 5 -
29 files changed, 628 insertions(+), 821 deletions(-)
rename drivers/video/omap2/displays/{panel-dvi.c => panel-tfp410.c} (56%)
rename include/video/{omap-panel-dvi.h => omap-panel-tfp410.h} (63%)
--
1.7.4.1
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 17:59 ` Archit Taneja
2012-03-07 12:44 ` [PATCH 02/21] OMAP: board-files: remove custom PD GPIO handling for DVI output Tomi Valkeinen
` (19 subsequent siblings)
20 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
The driver for the DVI framer should handle the power-down signal of the
framer, instead of the current way of handling it in the board files.
This patch adds power_down_gpio into the device's platform data, and
adds the necessary code in the driver to request and handle the GPIO.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/displays/panel-dvi.c | 31 ++++++++++++++++++++++++++++++
include/video/omap-panel-dvi.h | 2 +
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-dvi.c b/drivers/video/omap2/displays/panel-dvi.c
index 03eb14a..876b798 100644
--- a/drivers/video/omap2/displays/panel-dvi.c
+++ b/drivers/video/omap2/displays/panel-dvi.c
@@ -21,6 +21,7 @@
#include <linux/slab.h>
#include <video/omapdss.h>
#include <linux/i2c.h>
+#include <linux/gpio.h>
#include <drm/drm_edid.h>
#include <video/omap-panel-dvi.h>
@@ -44,6 +45,8 @@ struct panel_drv_data {
struct omap_dss_device *dssdev;
struct mutex lock;
+
+ int pd_gpio;
};
static inline struct panel_dvi_platform_data
@@ -54,6 +57,7 @@ static inline struct panel_dvi_platform_data
static int panel_dvi_power_on(struct omap_dss_device *dssdev)
{
+ struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
int r;
@@ -70,6 +74,9 @@ static int panel_dvi_power_on(struct omap_dss_device *dssdev)
goto err1;
}
+ if (gpio_is_valid(ddata->pd_gpio))
+ gpio_set_value(ddata->pd_gpio, 1);
+
return 0;
err1:
omapdss_dpi_display_disable(dssdev);
@@ -79,11 +86,15 @@ err0:
static void panel_dvi_power_off(struct omap_dss_device *dssdev)
{
+ struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
return;
+ if (gpio_is_valid(ddata->pd_gpio))
+ gpio_set_value(ddata->pd_gpio, 0);
+
if (pdata->platform_disable)
pdata->platform_disable(dssdev);
@@ -92,7 +103,9 @@ static void panel_dvi_power_off(struct omap_dss_device *dssdev)
static int panel_dvi_probe(struct omap_dss_device *dssdev)
{
+ struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
struct panel_drv_data *ddata;
+ int r;
ddata = kzalloc(sizeof(*ddata), GFP_KERNEL);
if (!ddata)
@@ -104,6 +117,21 @@ static int panel_dvi_probe(struct omap_dss_device *dssdev)
ddata->dssdev = dssdev;
mutex_init(&ddata->lock);
+ if (pdata)
+ ddata->pd_gpio = pdata->power_down_gpio;
+ else
+ ddata->pd_gpio = -1;
+
+ if (gpio_is_valid(ddata->pd_gpio)) {
+ r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW,
+ "tfp410 pd");
+ if (r) {
+ dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
+ ddata->pd_gpio);
+ ddata->pd_gpio = -1;
+ }
+ }
+
dev_set_drvdata(&dssdev->dev, ddata);
return 0;
@@ -115,6 +143,9 @@ static void __exit panel_dvi_remove(struct omap_dss_device *dssdev)
mutex_lock(&ddata->lock);
+ if (gpio_is_valid(ddata->pd_gpio))
+ gpio_free(ddata->pd_gpio);
+
dev_set_drvdata(&dssdev->dev, NULL);
mutex_unlock(&ddata->lock);
diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-dvi.h
index 87ad567b..4ad41fc 100644
--- a/include/video/omap-panel-dvi.h
+++ b/include/video/omap-panel-dvi.h
@@ -27,11 +27,13 @@ struct omap_dss_device;
* @platform_enable: platform specific panel enable function
* @platform_disable: platform specific panel disable function
* @i2c_bus_num: i2c bus id for the panel
+ * @power_down_gpio: gpio number for PD pin (or -1 if not available)
*/
struct panel_dvi_platform_data {
int (*platform_enable)(struct omap_dss_device *dssdev);
void (*platform_disable)(struct omap_dss_device *dssdev);
u16 i2c_bus_num;
+ int power_down_gpio;
};
#endif /* __OMAP_PANEL_DVI_H */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 02/21] OMAP: board-files: remove custom PD GPIO handling for DVI output
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 03/21] OMAPDSS: TFP410: rename dvi -> tfp410 Tomi Valkeinen
` (18 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen, Tony Lindgren
Now that the panel-dvi driver handles the PD (power-down) GPIO, we can
remove the custom PD handling from the board files.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 32 +----------------------------
arch/arm/mach-omap2/board-am3517evm.c | 19 +----------------
arch/arm/mach-omap2/board-cm-t35.c | 24 +--------------------
arch/arm/mach-omap2/board-devkit8000.c | 24 +--------------------
arch/arm/mach-omap2/board-igep0020.c | 26 +---------------------
arch/arm/mach-omap2/board-omap3beagle.c | 31 +--------------------------
arch/arm/mach-omap2/board-omap3evm.c | 23 +--------------------
arch/arm/mach-omap2/board-omap3stalker.c | 23 +--------------------
arch/arm/mach-omap2/board-omap4panda.c | 33 +----------------------------
arch/arm/mach-omap2/board-overo.c | 19 +----------------
drivers/video/omap2/displays/panel-dvi.c | 13 -----------
include/video/omap-panel-dvi.h | 4 ---
12 files changed, 14 insertions(+), 257 deletions(-)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 383717b..7105005 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -113,9 +113,6 @@ static struct gpio sdp3430_dss_gpios[] __initdata = {
{SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"},
};
-static int lcd_enabled;
-static int dvi_enabled;
-
static void __init sdp3430_display_init(void)
{
int r;
@@ -129,44 +126,18 @@ static void __init sdp3430_display_init(void)
static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
{
- if (dvi_enabled) {
- printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
- return -EINVAL;
- }
-
gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1);
gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1);
- lcd_enabled = 1;
-
return 0;
}
static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
{
- lcd_enabled = 0;
-
gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0);
gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0);
}
-static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
-{
- if (lcd_enabled) {
- printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
- return -EINVAL;
- }
-
- dvi_enabled = 1;
-
- return 0;
-}
-
-static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
-{
- dvi_enabled = 0;
-}
-
static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
{
return 0;
@@ -187,8 +158,7 @@ static struct omap_dss_device sdp3430_lcd_device = {
};
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = sdp3430_panel_enable_dvi,
- .platform_disable = sdp3430_panel_disable_dvi,
+ .power_down_gpio = -1,
};
static struct omap_dss_device sdp3430_dvi_device = {
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 4b1cfe3..958dd97 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -320,25 +320,8 @@ static struct omap_dss_device am3517_evm_tv_device = {
.platform_disable = am3517_evm_panel_disable_tv,
};
-static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev)
-{
- if (lcd_enabled) {
- printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
- return -EINVAL;
- }
- dvi_enabled = 1;
-
- return 0;
-}
-
-static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
-{
- dvi_enabled = 0;
-}
-
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = am3517_evm_panel_enable_dvi,
- .platform_disable = am3517_evm_panel_disable_dvi,
+ .power_down_gpio = -1,
};
static struct omap_dss_device am3517_evm_dvi_device = {
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index d73316e..5a361c9 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -202,25 +202,6 @@ static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev)
gpio_set_value(CM_T35_LCD_EN_GPIO, 0);
}
-static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
-{
- if (lcd_enabled) {
- printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
- return -EINVAL;
- }
-
- gpio_set_value(CM_T35_DVI_EN_GPIO, 0);
- dvi_enabled = 1;
-
- return 0;
-}
-
-static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev)
-{
- gpio_set_value(CM_T35_DVI_EN_GPIO, 1);
- dvi_enabled = 0;
-}
-
static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev)
{
return 0;
@@ -245,8 +226,7 @@ static struct omap_dss_device cm_t35_lcd_device = {
};
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = cm_t35_panel_enable_dvi,
- .platform_disable = cm_t35_panel_disable_dvi,
+ .power_down_gpio = CM_T35_DVI_EN_GPIO,
};
static struct omap_dss_device cm_t35_dvi_device = {
@@ -301,7 +281,6 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = {
static struct gpio cm_t35_dss_gpios[] __initdata = {
{ CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" },
{ CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" },
- { CM_T35_DVI_EN_GPIO, GPIOF_OUT_INIT_HIGH, "dvi enable" },
};
static void __init cm_t35_init_display(void)
@@ -320,7 +299,6 @@ static void __init cm_t35_init_display(void)
gpio_export(CM_T35_LCD_EN_GPIO, 0);
gpio_export(CM_T35_LCD_BL_GPIO, 0);
- gpio_export(CM_T35_DVI_EN_GPIO, 0);
msleep(50);
gpio_set_value(CM_T35_LCD_EN_GPIO, 1);
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index e873063..07edb6d 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -117,19 +117,6 @@ static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev)
gpio_set_value_cansleep(dssdev->reset_gpio, 0);
}
-static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev)
-{
- if (gpio_is_valid(dssdev->reset_gpio))
- gpio_set_value_cansleep(dssdev->reset_gpio, 1);
- return 0;
-}
-
-static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev)
-{
- if (gpio_is_valid(dssdev->reset_gpio))
- gpio_set_value_cansleep(dssdev->reset_gpio, 0);
-}
-
static struct regulator_consumer_supply devkit8000_vmmc1_supply[] = {
REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
};
@@ -154,8 +141,7 @@ static struct omap_dss_device devkit8000_lcd_device = {
};
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = devkit8000_panel_enable_dvi,
- .platform_disable = devkit8000_panel_disable_dvi,
+ .power_down_gpio = -1,
};
static struct omap_dss_device devkit8000_dvi_device = {
@@ -243,13 +229,7 @@ static int devkit8000_twl_gpio_setup(struct device *dev,
}
/* gpio + 7 is "DVI_PD" (out, active low) */
- devkit8000_dvi_device.reset_gpio = gpio + 7;
- ret = gpio_request_one(devkit8000_dvi_device.reset_gpio,
- GPIOF_OUT_INIT_LOW, "DVI PowerDown");
- if (ret < 0) {
- devkit8000_dvi_device.reset_gpio = -EINVAL;
- printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n");
- }
+ dvi_panel.power_down_gpio = gpio + 7;
return 0;
}
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index a59ace0..21188f8 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -443,22 +443,9 @@ static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
.setup = igep_twl_gpio_setup,
};
-static int igep2_enable_dvi(struct omap_dss_device *dssdev)
-{
- gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
-
- return 0;
-}
-
-static void igep2_disable_dvi(struct omap_dss_device *dssdev)
-{
- gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
-}
-
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = igep2_enable_dvi,
- .platform_disable = igep2_disable_dvi,
- .i2c_bus_num = 3,
+ .i2c_bus_num = 3,
+ .power_down_gpio = IGEP2_GPIO_DVI_PUP,
};
static struct omap_dss_device igep2_dvi_device = {
@@ -479,14 +466,6 @@ static struct omap_dss_board_info igep2_dss_data = {
.default_device = &igep2_dvi_device,
};
-static void __init igep2_display_init(void)
-{
- int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH,
- "GPIO_DVI_PUP");
- if (err)
- pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
-}
-
static struct platform_device *igep_devices[] __initdata = {
&igep_vwlan_device,
};
@@ -658,7 +637,6 @@ static void __init igep_init(void)
if (machine_is_igep0020()) {
omap_display_init(&igep2_dss_data);
- igep2_display_init();
igep2_init_smsc911x();
usbhs_init(&igep2_usbhs_bdata);
} else {
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 7ffcd28..26c9df4 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -189,24 +189,9 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
/* DSS */
-static int beagle_enable_dvi(struct omap_dss_device *dssdev)
-{
- if (gpio_is_valid(dssdev->reset_gpio))
- gpio_set_value(dssdev->reset_gpio, 1);
-
- return 0;
-}
-
-static void beagle_disable_dvi(struct omap_dss_device *dssdev)
-{
- if (gpio_is_valid(dssdev->reset_gpio))
- gpio_set_value(dssdev->reset_gpio, 0);
-}
-
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = beagle_enable_dvi,
- .platform_disable = beagle_disable_dvi,
.i2c_bus_num = 3,
+ .power_down_gpio = -1,
};
static struct omap_dss_device beagle_dvi_device = {
@@ -215,7 +200,6 @@ static struct omap_dss_device beagle_dvi_device = {
.driver_name = "dvi",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
- .reset_gpio = -EINVAL,
};
static struct omap_dss_device beagle_tv_device = {
@@ -236,16 +220,6 @@ static struct omap_dss_board_info beagle_dss_data = {
.default_device = &beagle_dvi_device,
};
-static void __init beagle_display_init(void)
-{
- int r;
-
- r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
- "DVI reset");
- if (r < 0)
- printk(KERN_ERR "Unable to get DVI reset GPIO\n");
-}
-
#include "sdram-micron-mt46h32m32lf-6.h"
static struct omap2_hsmmc_info mmc[] = {
@@ -310,7 +284,7 @@ static int beagle_twl_gpio_setup(struct device *dev,
if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
pr_err("%s: unable to configure EHCI_nOC\n", __func__);
}
- beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
+ dvi_panel.power_down_gpio = beagle_config.reset_gpio;
gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
"nEN_USB_PWR");
@@ -548,7 +522,6 @@ static void __init omap3_beagle_init(void)
omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
- beagle_display_init();
beagle_opp_init();
}
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index c877236..1467fbf 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -228,29 +228,8 @@ static struct omap_dss_device omap3_evm_tv_device = {
.platform_disable = omap3_evm_disable_tv,
};
-static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev)
-{
- if (lcd_enabled) {
- printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
- return -EINVAL;
- }
-
- gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 1);
-
- dvi_enabled = 1;
- return 0;
-}
-
-static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev)
-{
- gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 0);
-
- dvi_enabled = 0;
-}
-
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = omap3_evm_enable_dvi,
- .platform_disable = omap3_evm_disable_dvi,
+ .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO,
};
static struct omap_dss_device omap3_evm_dvi_device = {
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index cb089a4..22444c2 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -100,9 +100,6 @@ static inline void __init omap3stalker_init_eth(void)
#define LCD_PANEL_BKLIGHT_GPIO 210
#define ENABLE_VPLL2_DEV_GRP 0xE0
-static int lcd_enabled;
-static int dvi_enabled;
-
static void __init omap3_stalker_display_init(void)
{
return;
@@ -130,26 +127,8 @@ static struct omap_dss_device omap3_stalker_tv_device = {
.platform_disable = omap3_stalker_disable_tv,
};
-static int omap3_stalker_enable_dvi(struct omap_dss_device *dssdev)
-{
- if (lcd_enabled) {
- printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
- return -EINVAL;
- }
- gpio_set_value(DSS_ENABLE_GPIO, 1);
- dvi_enabled = 1;
- return 0;
-}
-
-static void omap3_stalker_disable_dvi(struct omap_dss_device *dssdev)
-{
- gpio_set_value(DSS_ENABLE_GPIO, 0);
- dvi_enabled = 0;
-}
-
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = omap3_stalker_enable_dvi,
- .platform_disable = omap3_stalker_disable_dvi,
+ .power_down_gpio = DSS_ENABLE_GPIO,
};
static struct omap_dss_device omap3_stalker_dvi_device = {
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 28fc271..e773f28 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -372,22 +372,10 @@ static struct omap_board_mux board_mux[] __initdata = {
/* Display DVI */
#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
-static int omap4_panda_enable_dvi(struct omap_dss_device *dssdev)
-{
- gpio_set_value(dssdev->reset_gpio, 1);
- return 0;
-}
-
-static void omap4_panda_disable_dvi(struct omap_dss_device *dssdev)
-{
- gpio_set_value(dssdev->reset_gpio, 0);
-}
-
/* Using generic display panel */
static struct panel_dvi_platform_data omap4_dvi_panel = {
- .platform_enable = omap4_panda_enable_dvi,
- .platform_disable = omap4_panda_disable_dvi,
- .i2c_bus_num = 3,
+ .i2c_bus_num = 3,
+ .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
};
struct omap_dss_device omap4_panda_dvi_device = {
@@ -400,18 +388,6 @@ struct omap_dss_device omap4_panda_dvi_device = {
.channel = OMAP_DSS_CHANNEL_LCD2,
};
-int __init omap4_panda_dvi_init(void)
-{
- int r;
-
- /* Requesting TFP410 DVI GPIO and disabling it, at bootup */
- r = gpio_request_one(omap4_panda_dvi_device.reset_gpio,
- GPIOF_OUT_INIT_LOW, "DVI PD");
- if (r)
- pr_err("Failed to get DVI powerdown GPIO\n");
-
- return r;
-}
static struct gpio panda_hdmi_gpios[] = {
{ HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
@@ -463,11 +439,6 @@ static struct omap_dss_board_info omap4_panda_dss_data = {
void omap4_panda_display_init(void)
{
- int r;
-
- r = omap4_panda_dvi_init();
- if (r)
- pr_err("error initializing panda DVI\n");
omap_display_init(&omap4_panda_dss_data);
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 52c0cef..21e900e 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -167,26 +167,9 @@ static void __init overo_display_init(void)
gpio_export(OVERO_GPIO_LCD_BL, 0);
}
-static int overo_panel_enable_dvi(struct omap_dss_device *dssdev)
-{
- if (lcd_enabled) {
- printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
- return -EINVAL;
- }
- dvi_enabled = 1;
-
- return 0;
-}
-
-static void overo_panel_disable_dvi(struct omap_dss_device *dssdev)
-{
- dvi_enabled = 0;
-}
-
static struct panel_dvi_platform_data dvi_panel = {
- .platform_enable = overo_panel_enable_dvi,
- .platform_disable = overo_panel_disable_dvi,
.i2c_bus_num = 3,
+ .power_down_gpio = -1,
};
static struct omap_dss_device overo_dvi_device = {
diff --git a/drivers/video/omap2/displays/panel-dvi.c b/drivers/video/omap2/displays/panel-dvi.c
index 876b798..7e8cadd 100644
--- a/drivers/video/omap2/displays/panel-dvi.c
+++ b/drivers/video/omap2/displays/panel-dvi.c
@@ -58,7 +58,6 @@ static inline struct panel_dvi_platform_data
static int panel_dvi_power_on(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
- struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
int r;
if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE)
@@ -68,18 +67,10 @@ static int panel_dvi_power_on(struct omap_dss_device *dssdev)
if (r)
goto err0;
- if (pdata->platform_enable) {
- r = pdata->platform_enable(dssdev);
- if (r)
- goto err1;
- }
-
if (gpio_is_valid(ddata->pd_gpio))
gpio_set_value(ddata->pd_gpio, 1);
return 0;
-err1:
- omapdss_dpi_display_disable(dssdev);
err0:
return r;
}
@@ -87,7 +78,6 @@ err0:
static void panel_dvi_power_off(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
- struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
return;
@@ -95,9 +85,6 @@ static void panel_dvi_power_off(struct omap_dss_device *dssdev)
if (gpio_is_valid(ddata->pd_gpio))
gpio_set_value(ddata->pd_gpio, 0);
- if (pdata->platform_disable)
- pdata->platform_disable(dssdev);
-
omapdss_dpi_display_disable(dssdev);
}
diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-dvi.h
index 4ad41fc..a782124 100644
--- a/include/video/omap-panel-dvi.h
+++ b/include/video/omap-panel-dvi.h
@@ -24,14 +24,10 @@ struct omap_dss_device;
/**
* struct panel_dvi_platform_data - panel driver configuration data
- * @platform_enable: platform specific panel enable function
- * @platform_disable: platform specific panel disable function
* @i2c_bus_num: i2c bus id for the panel
* @power_down_gpio: gpio number for PD pin (or -1 if not available)
*/
struct panel_dvi_platform_data {
- int (*platform_enable)(struct omap_dss_device *dssdev);
- void (*platform_disable)(struct omap_dss_device *dssdev);
u16 i2c_bus_num;
int power_down_gpio;
};
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 03/21] OMAPDSS: TFP410: rename dvi -> tfp410
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 02/21] OMAP: board-files: remove custom PD GPIO handling for DVI output Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 04/21] OMAPDSS: TFP410: rename dvi files to tfp410 Tomi Valkeinen
` (17 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen, Tony Lindgren
The driver for the TFP410 DVI framer chip was named quite badly as "DVI
panel driver". This patch renames the code to use tfp410 name for the
driver.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 4 +-
arch/arm/mach-omap2/board-am3517evm.c | 4 +-
arch/arm/mach-omap2/board-cm-t35.c | 4 +-
arch/arm/mach-omap2/board-devkit8000.c | 4 +-
arch/arm/mach-omap2/board-igep0020.c | 4 +-
arch/arm/mach-omap2/board-omap3beagle.c | 4 +-
arch/arm/mach-omap2/board-omap3evm.c | 4 +-
arch/arm/mach-omap2/board-omap3stalker.c | 4 +-
arch/arm/mach-omap2/board-omap4panda.c | 4 +-
arch/arm/mach-omap2/board-overo.c | 4 +-
drivers/video/omap2/displays/Kconfig | 8 +-
drivers/video/omap2/displays/Makefile | 2 +-
drivers/video/omap2/displays/panel-dvi.c | 94 +++++++++++++++---------------
include/video/omap-panel-dvi.h | 12 ++--
14 files changed, 78 insertions(+), 78 deletions(-)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 7105005..2c153bb 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -157,14 +157,14 @@ static struct omap_dss_device sdp3430_lcd_device = {
.platform_disable = sdp3430_panel_disable_lcd,
};
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio = -1,
};
static struct omap_dss_device sdp3430_dvi_device = {
.name = "dvi",
.type = OMAP_DISPLAY_TYPE_DPI,
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 958dd97..c38dac1 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -320,14 +320,14 @@ static struct omap_dss_device am3517_evm_tv_device = {
.platform_disable = am3517_evm_panel_disable_tv,
};
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio = -1,
};
static struct omap_dss_device am3517_evm_dvi_device = {
.type = OMAP_DISPLAY_TYPE_DPI,
.name = "dvi",
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 5a361c9..94d5167 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -225,14 +225,14 @@ static struct omap_dss_device cm_t35_lcd_device = {
.phy.dpi.data_lines = 18,
};
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio = CM_T35_DVI_EN_GPIO,
};
static struct omap_dss_device cm_t35_dvi_device = {
.name = "dvi",
.type = OMAP_DISPLAY_TYPE_DPI,
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 07edb6d..d1bead0 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -140,14 +140,14 @@ static struct omap_dss_device devkit8000_lcd_device = {
.phy.dpi.data_lines = 24,
};
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio = -1,
};
static struct omap_dss_device devkit8000_dvi_device = {
.name = "dvi",
.type = OMAP_DISPLAY_TYPE_DPI,
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 21188f8..ae1b157 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -443,7 +443,7 @@ static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
.setup = igep_twl_gpio_setup,
};
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.i2c_bus_num = 3,
.power_down_gpio = IGEP2_GPIO_DVI_PUP,
};
@@ -451,7 +451,7 @@ static struct panel_dvi_platform_data dvi_panel = {
static struct omap_dss_device igep2_dvi_device = {
.type = OMAP_DISPLAY_TYPE_DPI,
.name = "dvi",
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 26c9df4..5f858e9 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -189,7 +189,7 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
/* DSS */
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.i2c_bus_num = 3,
.power_down_gpio = -1,
};
@@ -197,7 +197,7 @@ static struct panel_dvi_platform_data dvi_panel = {
static struct omap_dss_device beagle_dvi_device = {
.type = OMAP_DISPLAY_TYPE_DPI,
.name = "dvi",
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 1467fbf..840fb99 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -228,14 +228,14 @@ static struct omap_dss_device omap3_evm_tv_device = {
.platform_disable = omap3_evm_disable_tv,
};
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO,
};
static struct omap_dss_device omap3_evm_dvi_device = {
.name = "dvi",
.type = OMAP_DISPLAY_TYPE_DPI,
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 22444c2..8a292cc 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -127,14 +127,14 @@ static struct omap_dss_device omap3_stalker_tv_device = {
.platform_disable = omap3_stalker_disable_tv,
};
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.power_down_gpio = DSS_ENABLE_GPIO,
};
static struct omap_dss_device omap3_stalker_dvi_device = {
.name = "dvi",
.type = OMAP_DISPLAY_TYPE_DPI,
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index e773f28..8196d6e 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -373,7 +373,7 @@ static struct omap_board_mux board_mux[] __initdata = {
#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
/* Using generic display panel */
-static struct panel_dvi_platform_data omap4_dvi_panel = {
+static struct tfp410_platform_data omap4_dvi_panel = {
.i2c_bus_num = 3,
.power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
};
@@ -381,7 +381,7 @@ static struct panel_dvi_platform_data omap4_dvi_panel = {
struct omap_dss_device omap4_panda_dvi_device = {
.type = OMAP_DISPLAY_TYPE_DPI,
.name = "dvi",
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &omap4_dvi_panel,
.phy.dpi.data_lines = 24,
.reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 21e900e..76e06e4 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -167,7 +167,7 @@ static void __init overo_display_init(void)
gpio_export(OVERO_GPIO_LCD_BL, 0);
}
-static struct panel_dvi_platform_data dvi_panel = {
+static struct tfp410_platform_data dvi_panel = {
.i2c_bus_num = 3,
.power_down_gpio = -1,
};
@@ -175,7 +175,7 @@ static struct panel_dvi_platform_data dvi_panel = {
static struct omap_dss_device overo_dvi_device = {
.name = "dvi",
.type = OMAP_DISPLAY_TYPE_DPI,
- .driver_name = "dvi",
+ .driver_name = "tfp410",
.data = &dvi_panel,
.phy.dpi.data_lines = 24,
};
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
index 408a992..1395438 100644
--- a/drivers/video/omap2/displays/Kconfig
+++ b/drivers/video/omap2/displays/Kconfig
@@ -10,12 +10,12 @@ config PANEL_GENERIC_DPI
Supports LCD Panel used in TI SDP3430 and EVM boards,
OMAP3517 EVM boards and CM-T35.
-config PANEL_DVI
- tristate "DVI output"
+config PANEL_TFP410
+ tristate "TFP410 DVI Framer"
depends on OMAP2_DSS_DPI && I2C
help
- Driver for external monitors, connected via DVI. The driver uses i2c
- to read EDID information from the monitor.
+ Driver for TFP410 DVI framer chip. The driver uses i2c to read EDID
+ information from the monitor.
config PANEL_LGPHILIPS_LB035Q02
tristate "LG.Philips LB035Q02 LCD Panel"
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
index fbfafc6..58905ef0 100644
--- a/drivers/video/omap2/displays/Makefile
+++ b/drivers/video/omap2/displays/Makefile
@@ -1,5 +1,5 @@
obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o
-obj-$(CONFIG_PANEL_DVI) += panel-dvi.o
+obj-$(CONFIG_PANEL_TFP410) += panel-dvi.o
obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o
obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o
diff --git a/drivers/video/omap2/displays/panel-dvi.c b/drivers/video/omap2/displays/panel-dvi.c
index 7e8cadd..1ec996d 100644
--- a/drivers/video/omap2/displays/panel-dvi.c
+++ b/drivers/video/omap2/displays/panel-dvi.c
@@ -1,5 +1,5 @@
/*
- * DVI output support
+ * TFP410 DVI framer chip
*
* Copyright (C) 2011 Texas Instruments Inc
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
@@ -26,7 +26,7 @@
#include <video/omap-panel-dvi.h>
-static const struct omap_video_timings panel_dvi_default_timings = {
+static const struct omap_video_timings tfp410_default_timings = {
.x_res = 640,
.y_res = 480,
@@ -49,13 +49,13 @@ struct panel_drv_data {
int pd_gpio;
};
-static inline struct panel_dvi_platform_data
+static inline struct tfp410_platform_data
*get_pdata(const struct omap_dss_device *dssdev)
{
return dssdev->data;
}
-static int panel_dvi_power_on(struct omap_dss_device *dssdev)
+static int tfp410_power_on(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
int r;
@@ -75,7 +75,7 @@ err0:
return r;
}
-static void panel_dvi_power_off(struct omap_dss_device *dssdev)
+static void tfp410_power_off(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
@@ -88,9 +88,9 @@ static void panel_dvi_power_off(struct omap_dss_device *dssdev)
omapdss_dpi_display_disable(dssdev);
}
-static int panel_dvi_probe(struct omap_dss_device *dssdev)
+static int tfp410_probe(struct omap_dss_device *dssdev)
{
- struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
+ struct tfp410_platform_data *pdata = get_pdata(dssdev);
struct panel_drv_data *ddata;
int r;
@@ -98,7 +98,7 @@ static int panel_dvi_probe(struct omap_dss_device *dssdev)
if (!ddata)
return -ENOMEM;
- dssdev->panel.timings = panel_dvi_default_timings;
+ dssdev->panel.timings = tfp410_default_timings;
dssdev->panel.config = OMAP_DSS_LCD_TFT;
ddata->dssdev = dssdev;
@@ -124,7 +124,7 @@ static int panel_dvi_probe(struct omap_dss_device *dssdev)
return 0;
}
-static void __exit panel_dvi_remove(struct omap_dss_device *dssdev)
+static void __exit tfp410_remove(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
@@ -140,14 +140,14 @@ static void __exit panel_dvi_remove(struct omap_dss_device *dssdev)
kfree(ddata);
}
-static int panel_dvi_enable(struct omap_dss_device *dssdev)
+static int tfp410_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
int r;
mutex_lock(&ddata->lock);
- r = panel_dvi_power_on(dssdev);
+ r = tfp410_power_on(dssdev);
if (r = 0)
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
@@ -156,26 +156,26 @@ static int panel_dvi_enable(struct omap_dss_device *dssdev)
return r;
}
-static void panel_dvi_disable(struct omap_dss_device *dssdev)
+static void tfp410_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
mutex_lock(&ddata->lock);
- panel_dvi_power_off(dssdev);
+ tfp410_power_off(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
mutex_unlock(&ddata->lock);
}
-static int panel_dvi_suspend(struct omap_dss_device *dssdev)
+static int tfp410_suspend(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
mutex_lock(&ddata->lock);
- panel_dvi_power_off(dssdev);
+ tfp410_power_off(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
@@ -184,14 +184,14 @@ static int panel_dvi_suspend(struct omap_dss_device *dssdev)
return 0;
}
-static int panel_dvi_resume(struct omap_dss_device *dssdev)
+static int tfp410_resume(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
int r;
mutex_lock(&ddata->lock);
- r = panel_dvi_power_on(dssdev);
+ r = tfp410_power_on(dssdev);
if (r = 0)
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
@@ -200,7 +200,7 @@ static int panel_dvi_resume(struct omap_dss_device *dssdev)
return r;
}
-static void panel_dvi_set_timings(struct omap_dss_device *dssdev,
+static void tfp410_set_timings(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
@@ -210,7 +210,7 @@ static void panel_dvi_set_timings(struct omap_dss_device *dssdev,
mutex_unlock(&ddata->lock);
}
-static void panel_dvi_get_timings(struct omap_dss_device *dssdev,
+static void tfp410_get_timings(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
@@ -220,7 +220,7 @@ static void panel_dvi_get_timings(struct omap_dss_device *dssdev,
mutex_unlock(&ddata->lock);
}
-static int panel_dvi_check_timings(struct omap_dss_device *dssdev,
+static int tfp410_check_timings(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
@@ -234,7 +234,7 @@ static int panel_dvi_check_timings(struct omap_dss_device *dssdev,
}
-static int panel_dvi_ddc_read(struct i2c_adapter *adapter,
+static int tfp410_ddc_read(struct i2c_adapter *adapter,
unsigned char *buf, u16 count, u8 offset)
{
int r, retries;
@@ -265,11 +265,11 @@ static int panel_dvi_ddc_read(struct i2c_adapter *adapter,
return r < 0 ? r : -EIO;
}
-static int panel_dvi_read_edid(struct omap_dss_device *dssdev,
+static int tfp410_read_edid(struct omap_dss_device *dssdev,
u8 *edid, int len)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
- struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
+ struct tfp410_platform_data *pdata = get_pdata(dssdev);
struct i2c_adapter *adapter;
int r, l, bytes_read;
@@ -289,7 +289,7 @@ static int panel_dvi_read_edid(struct omap_dss_device *dssdev,
}
l = min(EDID_LENGTH, len);
- r = panel_dvi_ddc_read(adapter, edid, l, 0);
+ r = tfp410_ddc_read(adapter, edid, l, 0);
if (r)
goto err;
@@ -299,7 +299,7 @@ static int panel_dvi_read_edid(struct omap_dss_device *dssdev,
if (len > EDID_LENGTH && edid[0x7e] > 0) {
l = min(EDID_LENGTH, len - EDID_LENGTH);
- r = panel_dvi_ddc_read(adapter, edid + EDID_LENGTH,
+ r = tfp410_ddc_read(adapter, edid + EDID_LENGTH,
l, EDID_LENGTH);
if (r)
goto err;
@@ -316,10 +316,10 @@ err:
return r;
}
-static bool panel_dvi_detect(struct omap_dss_device *dssdev)
+static bool tfp410_detect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
- struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
+ struct tfp410_platform_data *pdata = get_pdata(dssdev);
struct i2c_adapter *adapter;
unsigned char out;
int r;
@@ -333,7 +333,7 @@ static bool panel_dvi_detect(struct omap_dss_device *dssdev)
if (!adapter)
goto out;
- r = panel_dvi_ddc_read(adapter, &out, 1, 0);
+ r = tfp410_ddc_read(adapter, &out, 1, 0);
mutex_unlock(&ddata->lock);
@@ -344,38 +344,38 @@ out:
return true;
}
-static struct omap_dss_driver panel_dvi_driver = {
- .probe = panel_dvi_probe,
- .remove = __exit_p(panel_dvi_remove),
+static struct omap_dss_driver tfp410_driver = {
+ .probe = tfp410_probe,
+ .remove = __exit_p(tfp410_remove),
- .enable = panel_dvi_enable,
- .disable = panel_dvi_disable,
- .suspend = panel_dvi_suspend,
- .resume = panel_dvi_resume,
+ .enable = tfp410_enable,
+ .disable = tfp410_disable,
+ .suspend = tfp410_suspend,
+ .resume = tfp410_resume,
- .set_timings = panel_dvi_set_timings,
- .get_timings = panel_dvi_get_timings,
- .check_timings = panel_dvi_check_timings,
+ .set_timings = tfp410_set_timings,
+ .get_timings = tfp410_get_timings,
+ .check_timings = tfp410_check_timings,
- .read_edid = panel_dvi_read_edid,
- .detect = panel_dvi_detect,
+ .read_edid = tfp410_read_edid,
+ .detect = tfp410_detect,
.driver = {
- .name = "dvi",
+ .name = "tfp410",
.owner = THIS_MODULE,
},
};
-static int __init panel_dvi_init(void)
+static int __init tfp410_init(void)
{
- return omap_dss_register_driver(&panel_dvi_driver);
+ return omap_dss_register_driver(&tfp410_driver);
}
-static void __exit panel_dvi_exit(void)
+static void __exit tfp410_exit(void)
{
- omap_dss_unregister_driver(&panel_dvi_driver);
+ omap_dss_unregister_driver(&tfp410_driver);
}
-module_init(panel_dvi_init);
-module_exit(panel_dvi_exit);
+module_init(tfp410_init);
+module_exit(tfp410_exit);
MODULE_LICENSE("GPL");
diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-dvi.h
index a782124..68c31d7 100644
--- a/include/video/omap-panel-dvi.h
+++ b/include/video/omap-panel-dvi.h
@@ -1,5 +1,5 @@
/*
- * Header for DVI output driver
+ * Header for TFP410 chip driver
*
* Copyright (C) 2011 Texas Instruments Inc
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
@@ -17,19 +17,19 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __OMAP_PANEL_DVI_H
-#define __OMAP_PANEL_DVI_H
+#ifndef __OMAP_PANEL_TFP410_H
+#define __OMAP_PANEL_TFP410_H
struct omap_dss_device;
/**
- * struct panel_dvi_platform_data - panel driver configuration data
+ * struct tfp410_platform_data - panel driver configuration data
* @i2c_bus_num: i2c bus id for the panel
* @power_down_gpio: gpio number for PD pin (or -1 if not available)
*/
-struct panel_dvi_platform_data {
+struct tfp410_platform_data {
u16 i2c_bus_num;
int power_down_gpio;
};
-#endif /* __OMAP_PANEL_DVI_H */
+#endif /* __OMAP_PANEL_TFP410_H */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 04/21] OMAPDSS: TFP410: rename dvi files to tfp410
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (2 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 03/21] OMAPDSS: TFP410: rename dvi -> tfp410 Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 05/21] OMAPDSS: TFP410: pdata rewrite Tomi Valkeinen
` (16 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen, Tony Lindgren
Now that the tfp410 driver has been renamed in the code, this patch
finishes the renaming by renaming the files.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 2 +-
arch/arm/mach-omap2/board-am3517evm.c | 2 +-
arch/arm/mach-omap2/board-cm-t35.c | 2 +-
arch/arm/mach-omap2/board-devkit8000.c | 2 +-
arch/arm/mach-omap2/board-igep0020.c | 2 +-
arch/arm/mach-omap2/board-omap3beagle.c | 2 +-
arch/arm/mach-omap2/board-omap3evm.c | 2 +-
arch/arm/mach-omap2/board-omap3stalker.c | 2 +-
arch/arm/mach-omap2/board-omap4panda.c | 2 +-
arch/arm/mach-omap2/board-overo.c | 2 +-
drivers/video/omap2/displays/Makefile | 2 +-
.../omap2/displays/{panel-dvi.c => panel-tfp410.c} | 2 +-
.../{omap-panel-dvi.h => omap-panel-tfp410.h} | 0
13 files changed, 12 insertions(+), 12 deletions(-)
rename drivers/video/omap2/displays/{panel-dvi.c => panel-tfp410.c} (99%)
rename include/video/{omap-panel-dvi.h => omap-panel-tfp410.h} (100%)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 2c153bb..fdcbaaf 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -37,7 +37,7 @@
#include <plat/dma.h>
#include <plat/gpmc.h>
#include <video/omapdss.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include <plat/gpmc-smc91x.h>
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index c38dac1..fadd25f 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -37,7 +37,7 @@
#include <plat/usb.h>
#include <video/omapdss.h>
#include <video/omap-panel-generic-dpi.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include "mux.h"
#include "control.h"
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 94d5167..54d8f0f 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -43,7 +43,7 @@
#include <plat/usb.h>
#include <video/omapdss.h>
#include <video/omap-panel-generic-dpi.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include <plat/mcspi.h>
#include <mach/hardware.h>
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index d1bead0..677f16e 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -47,7 +47,7 @@
#include <plat/usb.h>
#include <video/omapdss.h>
#include <video/omap-panel-generic-dpi.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include <plat/mcspi.h>
#include <linux/input/matrix_keypad.h>
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index ae1b157..6e56ccc 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -32,7 +32,7 @@
#include <plat/gpmc.h>
#include <plat/usb.h>
#include <video/omapdss.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include <plat/onenand.h>
#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 5f858e9..df6acae 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -42,7 +42,7 @@
#include <plat/board.h>
#include "common.h"
#include <video/omapdss.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include <plat/gpmc.h>
#include <plat/nand.h>
#include <plat/usb.h>
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 840fb99..1a34bee 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -46,7 +46,7 @@
#include "common.h"
#include <plat/mcspi.h>
#include <video/omapdss.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include "mux.h"
#include "sdram-micron-mt46h32m32lf-6.h"
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 8a292cc..d05e7a7 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -41,7 +41,7 @@
#include <plat/usb.h>
#include <video/omapdss.h>
#include <video/omap-panel-generic-dpi.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include <plat/mcspi.h>
#include <linux/input/matrix_keypad.h>
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 8196d6e..959b4ed 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -40,7 +40,7 @@
#include "common.h"
#include <plat/usb.h>
#include <plat/mmc.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include "hsmmc.h"
#include "control.h"
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 76e06e4..ceb7187 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -46,7 +46,7 @@
#include "common.h"
#include <video/omapdss.h>
#include <video/omap-panel-generic-dpi.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
#include <plat/gpmc.h>
#include <mach/hardware.h>
#include <plat/nand.h>
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
index 58905ef0..58a5176 100644
--- a/drivers/video/omap2/displays/Makefile
+++ b/drivers/video/omap2/displays/Makefile
@@ -1,5 +1,5 @@
obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o
-obj-$(CONFIG_PANEL_TFP410) += panel-dvi.o
+obj-$(CONFIG_PANEL_TFP410) += panel-tfp410.o
obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o
obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o
diff --git a/drivers/video/omap2/displays/panel-dvi.c b/drivers/video/omap2/displays/panel-tfp410.c
similarity index 99%
rename from drivers/video/omap2/displays/panel-dvi.c
rename to drivers/video/omap2/displays/panel-tfp410.c
index 1ec996d..4b867bf 100644
--- a/drivers/video/omap2/displays/panel-dvi.c
+++ b/drivers/video/omap2/displays/panel-tfp410.c
@@ -24,7 +24,7 @@
#include <linux/gpio.h>
#include <drm/drm_edid.h>
-#include <video/omap-panel-dvi.h>
+#include <video/omap-panel-tfp410.h>
static const struct omap_video_timings tfp410_default_timings = {
.x_res = 640,
diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-tfp410.h
similarity index 100%
rename from include/video/omap-panel-dvi.h
rename to include/video/omap-panel-tfp410.h
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 05/21] OMAPDSS: TFP410: pdata rewrite
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (3 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 04/21] OMAPDSS: TFP410: rename dvi files to tfp410 Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 06/21] OMAPDSS: DSI: use dsi_get_dsidev_id(dsidev) instead of dsidev->id Tomi Valkeinen
` (15 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
To ease device tree adaptation in the future, rewrite TFP410 platform
data handling to be done inside probe(), so that probe() is the only
place where we need to handle the DT/pdata choice.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/displays/panel-tfp410.c | 72 ++++++++++++++-------------
1 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-tfp410.c b/drivers/video/omap2/displays/panel-tfp410.c
index 4b867bf..a369d2c 100644
--- a/drivers/video/omap2/displays/panel-tfp410.c
+++ b/drivers/video/omap2/displays/panel-tfp410.c
@@ -47,13 +47,9 @@ struct panel_drv_data {
struct mutex lock;
int pd_gpio;
-};
-static inline struct tfp410_platform_data
-*get_pdata(const struct omap_dss_device *dssdev)
-{
- return dssdev->data;
-}
+ struct i2c_adapter *i2c_adapter;
+};
static int tfp410_power_on(struct omap_dss_device *dssdev)
{
@@ -90,11 +86,11 @@ static void tfp410_power_off(struct omap_dss_device *dssdev)
static int tfp410_probe(struct omap_dss_device *dssdev)
{
- struct tfp410_platform_data *pdata = get_pdata(dssdev);
struct panel_drv_data *ddata;
int r;
+ int i2c_bus_num;
- ddata = kzalloc(sizeof(*ddata), GFP_KERNEL);
+ ddata = devm_kzalloc(&dssdev->dev, sizeof(*ddata), GFP_KERNEL);
if (!ddata)
return -ENOMEM;
@@ -104,10 +100,15 @@ static int tfp410_probe(struct omap_dss_device *dssdev)
ddata->dssdev = dssdev;
mutex_init(&ddata->lock);
- if (pdata)
+ if (dssdev->data) {
+ struct tfp410_platform_data *pdata = dssdev->data;
+
ddata->pd_gpio = pdata->power_down_gpio;
- else
+ i2c_bus_num = pdata->i2c_bus_num;
+ } else {
ddata->pd_gpio = -1;
+ i2c_bus_num = -1;
+ }
if (gpio_is_valid(ddata->pd_gpio)) {
r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW,
@@ -115,13 +116,31 @@ static int tfp410_probe(struct omap_dss_device *dssdev)
if (r) {
dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
ddata->pd_gpio);
- ddata->pd_gpio = -1;
+ return r;
}
}
+ if (i2c_bus_num != -1) {
+ struct i2c_adapter *adapter;
+
+ adapter = i2c_get_adapter(i2c_bus_num);
+ if (!adapter) {
+ dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n",
+ i2c_bus_num);
+ r = -EINVAL;
+ goto err_i2c;
+ }
+
+ ddata->i2c_adapter = adapter;
+ }
+
dev_set_drvdata(&dssdev->dev, ddata);
return 0;
+err_i2c:
+ if (gpio_is_valid(ddata->pd_gpio))
+ gpio_free(ddata->pd_gpio);
+ return r;
}
static void __exit tfp410_remove(struct omap_dss_device *dssdev)
@@ -130,14 +149,15 @@ static void __exit tfp410_remove(struct omap_dss_device *dssdev)
mutex_lock(&ddata->lock);
+ if (ddata->i2c_adapter)
+ i2c_put_adapter(ddata->i2c_adapter);
+
if (gpio_is_valid(ddata->pd_gpio))
gpio_free(ddata->pd_gpio);
dev_set_drvdata(&dssdev->dev, NULL);
mutex_unlock(&ddata->lock);
-
- kfree(ddata);
}
static int tfp410_enable(struct omap_dss_device *dssdev)
@@ -269,27 +289,17 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev,
u8 *edid, int len)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
- struct tfp410_platform_data *pdata = get_pdata(dssdev);
- struct i2c_adapter *adapter;
int r, l, bytes_read;
mutex_lock(&ddata->lock);
- if (pdata->i2c_bus_num = 0) {
+ if (!ddata->i2c_adapter) {
r = -ENODEV;
goto err;
}
- adapter = i2c_get_adapter(pdata->i2c_bus_num);
- if (!adapter) {
- dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n",
- pdata->i2c_bus_num);
- r = -EINVAL;
- goto err;
- }
-
l = min(EDID_LENGTH, len);
- r = tfp410_ddc_read(adapter, edid, l, 0);
+ r = tfp410_ddc_read(ddata->i2c_adapter, edid, l, 0);
if (r)
goto err;
@@ -299,7 +309,7 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev,
if (len > EDID_LENGTH && edid[0x7e] > 0) {
l = min(EDID_LENGTH, len - EDID_LENGTH);
- r = tfp410_ddc_read(adapter, edid + EDID_LENGTH,
+ r = tfp410_ddc_read(ddata->i2c_adapter, edid + EDID_LENGTH,
l, EDID_LENGTH);
if (r)
goto err;
@@ -319,21 +329,15 @@ err:
static bool tfp410_detect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
- struct tfp410_platform_data *pdata = get_pdata(dssdev);
- struct i2c_adapter *adapter;
unsigned char out;
int r;
mutex_lock(&ddata->lock);
- if (pdata->i2c_bus_num = 0)
- goto out;
-
- adapter = i2c_get_adapter(pdata->i2c_bus_num);
- if (!adapter)
+ if (!ddata->i2c_adapter)
goto out;
- r = tfp410_ddc_read(adapter, &out, 1, 0);
+ r = tfp410_ddc_read(ddata->i2c_adapter, &out, 1, 0);
mutex_unlock(&ddata->lock);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 06/21] OMAPDSS: DSI: use dsi_get_dsidev_id(dsidev) instead of dsidev->id
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (4 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 05/21] OMAPDSS: TFP410: pdata rewrite Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 07/21] OMAPDSS: Taal: move reset gpio handling to taal driver Tomi Valkeinen
` (14 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
The DSI driver uses dsi_get_dsidev_id() to get the ID number for the DSI
instance. However, there were a few places where dsidev->id was used
instead of the function. Fix those places to use the function.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dsi.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 662d14f..3e656be 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -2396,7 +2396,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
DSSDBGF();
- r = dsi->enable_pads(dsidev->id, dsi_get_lane_mask(dssdev));
+ r = dsi->enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
if (r)
return r;
@@ -2506,7 +2506,7 @@ err_cio_pwr:
dsi_cio_disable_lane_override(dsidev);
err_scp_clk_dom:
dsi_disable_scp_clk(dsidev);
- dsi->disable_pads(dsidev->id, dsi_get_lane_mask(dssdev));
+ dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
return r;
}
@@ -2520,7 +2520,7 @@ static void dsi_cio_uninit(struct omap_dss_device *dssdev)
dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF);
dsi_disable_scp_clk(dsidev);
- dsi->disable_pads(dsidev->id, dsi_get_lane_mask(dssdev));
+ dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
}
static void dsi_config_tx_fifo(struct platform_device *dsidev,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 07/21] OMAPDSS: Taal: move reset gpio handling to taal driver
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (5 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 06/21] OMAPDSS: DSI: use dsi_get_dsidev_id(dsidev) instead of dsidev->id Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess Tomi Valkeinen
` (13 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
The reset GPIO for Taal panel driver is currently requested in the
4430sdp board file. This patch moves the gpio request/free into the Taal
driver, where it should be.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/mach-omap2/board-4430sdp.c | 16 ----------------
drivers/video/omap2/displays/panel-taal.c | 15 +++++++++++++++
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 4e90715..3a05173 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -724,21 +724,6 @@ static struct omap_dss_device sdp4430_lcd2_device = {
.channel = OMAP_DSS_CHANNEL_LCD2,
};
-static void sdp4430_lcd_init(void)
-{
- int r;
-
- r = gpio_request_one(dsi1_panel.reset_gpio, GPIOF_DIR_OUT,
- "lcd1_reset_gpio");
- if (r)
- pr_err("%s: Could not get lcd1_reset_gpio\n", __func__);
-
- r = gpio_request_one(dsi2_panel.reset_gpio, GPIOF_DIR_OUT,
- "lcd2_reset_gpio");
- if (r)
- pr_err("%s: Could not get lcd2_reset_gpio\n", __func__);
-}
-
static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
.hpd_gpio = HDMI_GPIO_HPD,
};
@@ -824,7 +809,6 @@ static void __init omap_4430sdp_display_init(void)
if (r)
pr_err("%s: Could not get display_sel GPIO\n", __func__);
- sdp4430_lcd_init();
sdp4430_picodlp_init();
omap_display_init(&sdp4430_dss_data);
/*
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 00c5c61..6e240fe 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -993,6 +993,15 @@ static int taal_probe(struct omap_dss_device *dssdev)
dev_set_drvdata(&dssdev->dev, td);
+ if (gpio_is_valid(panel_data->reset_gpio)) {
+ r = gpio_request_one(panel_data->reset_gpio, GPIOF_OUT_INIT_LOW,
+ "taal rst");
+ if (r) {
+ dev_err(&dssdev->dev, "failed to request reset gpio\n");
+ goto err_rst_gpio;
+ }
+ }
+
taal_hw_reset(dssdev);
if (panel_data->use_dsi_backlight) {
@@ -1075,6 +1084,9 @@ err_gpio:
if (bldev != NULL)
backlight_device_unregister(bldev);
err_bl:
+ if (gpio_is_valid(panel_data->reset_gpio))
+ gpio_free(panel_data->reset_gpio);
+err_rst_gpio:
destroy_workqueue(td->workqueue);
err_wq:
free_regulators(panel_config->regulators, panel_config->num_regulators);
@@ -1115,6 +1127,9 @@ static void __exit taal_remove(struct omap_dss_device *dssdev)
/* reset, to be sure that the panel is in a valid state */
taal_hw_reset(dssdev);
+ if (gpio_is_valid(panel_data->reset_gpio))
+ gpio_free(panel_data->reset_gpio);
+
free_regulators(td->panel_config->regulators,
td->panel_config->num_regulators);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (6 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 07/21] OMAPDSS: Taal: move reset gpio handling to taal driver Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 18:23 ` Archit Taneja
2012-03-07 12:44 ` [PATCH 09/21] OMAPDSS: remove return from platform_driver_unreg Tomi Valkeinen
` (12 subsequent siblings)
20 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
The omapdss pdata handling is a mess. This is more evident when trying
to use device tree for DSS, as we don't have platform data anymore in
that case. This patch cleans the pdata handling by:
- Remove struct omap_display_platform_data. It was used just as a
wrapper for struct omap_dss_board_info.
- Pass the platform data only to omapdss device. The drivers for omap
dss hwmods do not need the platform data. This should also work better
for DT, as we can create omapdss device programmatically in generic omap
boot code, and thus we can pass the pdata to it.
- Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads
that the dss hwmod drivers can call.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/mach-omap2/display.c | 37 ++++++++++++++++++-------------------
drivers/video/omap2/dss/core.c | 35 +++++++++++++++++++++++++++++++++++
drivers/video/omap2/dss/dispc.c | 21 ++-------------------
drivers/video/omap2/dss/dsi.c | 17 +++--------------
drivers/video/omap2/dss/dss.h | 3 +++
drivers/video/omap2/dss/hdmi.c | 2 --
include/video/omapdss.h | 5 -----
7 files changed, 61 insertions(+), 59 deletions(-)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 3677b1f..279c124 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -185,10 +185,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
struct omap_hwmod *oh;
struct platform_device *pdev;
int i, oh_count;
- struct omap_display_platform_data pdata;
const struct omap_dss_hwmod_data *curr_dss_hwmod;
- memset(&pdata, 0, sizeof(pdata));
+ /* create omapdss device */
+
+ board_data->dsi_enable_pads = omap_dsi_enable_pads;
+ board_data->dsi_disable_pads = omap_dsi_disable_pads;
+ board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
+ omap_display_device.dev.platform_data = board_data;
+
+ r = platform_device_register(&omap_display_device);
+ if (r < 0) {
+ pr_err("Unable to register omapdss device\n");
+ return r;
+ }
+
+ /* create devices for dss hwmods */
if (cpu_is_omap24xx()) {
curr_dss_hwmod = omap2_dss_hwmod_data;
@@ -201,15 +214,6 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
}
- if (board_data->dsi_enable_pads = NULL)
- board_data->dsi_enable_pads = omap_dsi_enable_pads;
- if (board_data->dsi_disable_pads = NULL)
- board_data->dsi_disable_pads = omap_dsi_disable_pads;
-
- pdata.board_data = board_data;
- pdata.board_data->get_context_loss_count - omap_pm_get_dev_context_loss_count;
-
for (i = 0; i < oh_count; i++) {
oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
if (!oh) {
@@ -219,21 +223,16 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
}
pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
- curr_dss_hwmod[i].id, oh, &pdata,
- sizeof(struct omap_display_platform_data),
+ curr_dss_hwmod[i].id, oh,
+ NULL, 0,
NULL, 0, 0);
if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
curr_dss_hwmod[i].oh_name))
return -ENODEV;
}
- omap_display_device.dev.platform_data = board_data;
- r = platform_device_register(&omap_display_device);
- if (r < 0)
- printk(KERN_ERR "Unable to register OMAP-Display device\n");
-
- return r;
+ return 0;
}
static void dispc_disable_outputs(void)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 8613f86..3efd473 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
return reg;
}
+int dss_get_ctx_loss_count(struct device *dev)
+{
+ struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
+ int cnt;
+
+ if (!board_data || !board_data->get_context_loss_count)
+ return -ENOENT;
+
+ cnt = board_data->get_context_loss_count(dev);
+
+ WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt);
+
+ return cnt;
+}
+
+int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask)
+{
+ struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
+
+ if (!board_data || !board_data->dsi_enable_pads)
+ return -ENOENT;
+
+ return board_data->dsi_enable_pads(dsi_id, lane_mask);
+}
+
+void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask)
+{
+ struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
+
+ if (!board_data || !board_data->dsi_enable_pads)
+ return;
+
+ return board_data->dsi_disable_pads(dsi_id, lane_mask);
+}
+
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
static int dss_debug_show(struct seq_file *s, void *unused)
{
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index bddd64b..703bb20 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx)
return __raw_readl(dispc.base + idx);
}
-static int dispc_get_ctx_loss_count(void)
-{
- struct device *dev = &dispc.pdev->dev;
- struct omap_display_platform_data *pdata = dev->platform_data;
- struct omap_dss_board_info *board_data = pdata->board_data;
- int cnt;
-
- if (!board_data->get_context_loss_count)
- return -ENOENT;
-
- cnt = board_data->get_context_loss_count(dev);
-
- WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt);
-
- return cnt;
-}
-
#define SR(reg) \
dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg)
#define RR(reg) \
@@ -251,7 +234,7 @@ static void dispc_save_context(void)
if (dss_has_feature(FEAT_CORE_CLK_DIV))
SR(DIVISOR);
- dispc.ctx_loss_cnt = dispc_get_ctx_loss_count();
+ dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev);
dispc.ctx_valid = true;
DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt);
@@ -266,7 +249,7 @@ static void dispc_restore_context(void)
if (!dispc.ctx_valid)
return;
- ctx = dispc_get_ctx_loss_count();
+ ctx = dss_get_ctx_loss_count(&dispc.pdev->dev);
if (ctx >= 0 && ctx = dispc.ctx_loss_cnt)
return;
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 3e656be..4e2f7ff 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -261,9 +261,6 @@ struct dsi_data {
struct clk *dss_clk;
struct clk *sys_clk;
- int (*enable_pads)(int dsi_id, unsigned lane_mask);
- void (*disable_pads)(int dsi_id, unsigned lane_mask);
-
struct dsi_clock_info current_cinfo;
bool vdds_dsi_enabled;
@@ -2396,7 +2393,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
DSSDBGF();
- r = dsi->enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
+ r = dss_dsi_enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
if (r)
return r;
@@ -2506,21 +2503,20 @@ err_cio_pwr:
dsi_cio_disable_lane_override(dsidev);
err_scp_clk_dom:
dsi_disable_scp_clk(dsidev);
- dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
+ dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
return r;
}
static void dsi_cio_uninit(struct omap_dss_device *dssdev)
{
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
- struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
/* DDR_CLK_ALWAYS_ON */
REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13);
dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF);
dsi_disable_scp_clk(dsidev);
- dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
+ dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
}
static void dsi_config_tx_fifo(struct platform_device *dsidev,
@@ -4680,8 +4676,6 @@ static void dsi_put_clocks(struct platform_device *dsidev)
/* DSI1 HW IP initialisation */
static int omap_dsihw_probe(struct platform_device *dsidev)
{
- struct omap_display_platform_data *dss_plat_data;
- struct omap_dss_board_info *board_info;
u32 rev;
int r, i, dsi_module = dsi_get_dsidev_id(dsidev);
struct resource *dsi_mem;
@@ -4695,11 +4689,6 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
dsi_pdev_map[dsi_module] = dsidev;
dev_set_drvdata(&dsidev->dev, dsi);
- dss_plat_data = dsidev->dev.platform_data;
- board_info = dss_plat_data->board_data;
- dsi->enable_pads = board_info->dsi_enable_pads;
- dsi->disable_pads = board_info->dsi_disable_pads;
-
spin_lock_init(&dsi->irq_lock);
spin_lock_init(&dsi->errors_lock);
dsi->errors = 0;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index d4b3dff..d37ed80 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -162,6 +162,9 @@ struct platform_device;
struct bus_type *dss_get_bus(void);
struct regulator *dss_get_vdds_dsi(void);
struct regulator *dss_get_vdds_sdi(void);
+int dss_get_ctx_loss_count(struct device *dev);
+int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
+void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
/* apply */
void dss_apply_init(void);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c4b4f69..cacf856 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -63,7 +63,6 @@
static struct {
struct mutex lock;
- struct omap_display_platform_data *pdata;
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
@@ -796,7 +795,6 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
struct resource *hdmi_mem;
int r;
- hdmi.pdata = pdev->dev.platform_data;
hdmi.pdev = pdev;
mutex_init(&hdmi.lock);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 483f67c..b499ccb 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -316,11 +316,6 @@ extern int omap_display_init(struct omap_dss_board_info *board_data);
/* HDMI mux init*/
extern int omap_hdmi_init(enum omap_hdmi_flags flags);
-struct omap_display_platform_data {
- struct omap_dss_board_info *board_data;
- /* TODO: Additional members to be added when PM is considered */
-};
-
struct omap_video_timings {
/* Unit: pixels */
u16 x_res;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 09/21] OMAPDSS: remove return from platform_driver_unreg
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (7 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 10/21] OMAPDSS: use platform_driver_probe for core/dispc/dss Tomi Valkeinen
` (11 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
For unknown reasons we seem to have a return in each of the omapdss's
uninit functions, which is a void function.
Remove the returns.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dispc.c | 2 +-
drivers/video/omap2/dss/dsi.c | 2 +-
drivers/video/omap2/dss/dss.c | 2 +-
drivers/video/omap2/dss/hdmi.c | 2 +-
drivers/video/omap2/dss/rfbi.c | 2 +-
drivers/video/omap2/dss/venc.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 703bb20..5985c3c 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3447,5 +3447,5 @@ int dispc_init_platform_driver(void)
void dispc_uninit_platform_driver(void)
{
- return platform_driver_unregister(&omap_dispchw_driver);
+ platform_driver_unregister(&omap_dispchw_driver);
}
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 4e2f7ff..cf59f40 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4849,5 +4849,5 @@ int dsi_init_platform_driver(void)
void dsi_uninit_platform_driver(void)
{
- return platform_driver_unregister(&omap_dsihw_driver);
+ platform_driver_unregister(&omap_dsihw_driver);
}
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 4a6b5ee..7d3facc 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -857,5 +857,5 @@ int dss_init_platform_driver(void)
void dss_uninit_platform_driver(void)
{
- return platform_driver_unregister(&omap_dsshw_driver);
+ platform_driver_unregister(&omap_dsshw_driver);
}
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index cacf856..b4ad13b 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -915,5 +915,5 @@ int hdmi_init_platform_driver(void)
void hdmi_uninit_platform_driver(void)
{
- return platform_driver_unregister(&omapdss_hdmihw_driver);
+ platform_driver_unregister(&omapdss_hdmihw_driver);
}
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 788a0ef..dfd8ec5 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -1019,5 +1019,5 @@ int rfbi_init_platform_driver(void)
void rfbi_uninit_platform_driver(void)
{
- return platform_driver_unregister(&omap_rfbihw_driver);
+ platform_driver_unregister(&omap_rfbihw_driver);
}
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 9c3daf7..c933733 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -909,5 +909,5 @@ void venc_uninit_platform_driver(void)
if (cpu_is_omap44xx())
return;
- return platform_driver_unregister(&omap_venchw_driver);
+ platform_driver_unregister(&omap_venchw_driver);
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 10/21] OMAPDSS: use platform_driver_probe for core/dispc/dss
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (8 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 09/21] OMAPDSS: remove return from platform_driver_unreg Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 11/21] OMAPDSS: register dss drivers in module init Tomi Valkeinen
` (10 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
The platform devices for omapdss, dss and dispc drivers are always
present, so we can use platform_driver_probe instead of
platform_driver_register.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 3 +--
drivers/video/omap2/dss/dispc.c | 3 +--
drivers/video/omap2/dss/dss.c | 3 +--
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 3efd473..80fbfd7 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -341,7 +341,6 @@ static int omap_dss_resume(struct platform_device *pdev)
}
static struct platform_driver omap_dss_driver = {
- .probe = omap_dss_probe,
.remove = omap_dss_remove,
.shutdown = omap_dss_shutdown,
.suspend = omap_dss_suspend,
@@ -576,7 +575,7 @@ static int __init omap_dss_init(void)
if (r)
return r;
- r = platform_driver_register(&omap_dss_driver);
+ r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
if (r) {
omap_dss_bus_unregister();
return r;
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 5985c3c..c71d4c5 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3431,7 +3431,6 @@ static const struct dev_pm_ops dispc_pm_ops = {
};
static struct platform_driver omap_dispchw_driver = {
- .probe = omap_dispchw_probe,
.remove = omap_dispchw_remove,
.driver = {
.name = "omapdss_dispc",
@@ -3442,7 +3441,7 @@ static struct platform_driver omap_dispchw_driver = {
int dispc_init_platform_driver(void)
{
- return platform_driver_register(&omap_dispchw_driver);
+ return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe);
}
void dispc_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 7d3facc..34cc84f 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -841,7 +841,6 @@ static const struct dev_pm_ops dss_pm_ops = {
};
static struct platform_driver omap_dsshw_driver = {
- .probe = omap_dsshw_probe,
.remove = omap_dsshw_remove,
.driver = {
.name = "omapdss_dss",
@@ -852,7 +851,7 @@ static struct platform_driver omap_dsshw_driver = {
int dss_init_platform_driver(void)
{
- return platform_driver_register(&omap_dsshw_driver);
+ return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe);
}
void dss_uninit_platform_driver(void)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 11/21] OMAPDSS: register dss drivers in module init
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (9 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 10/21] OMAPDSS: use platform_driver_probe for core/dispc/dss Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 12/21] OMAPDSS: create custom pdevs for DSS omap_devices Tomi Valkeinen
` (9 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
We do the dss driver registration in a rather strange way: we have the
higher level omapdss driver, and we use that driver's probe function to
register the drivers for the rest of the dss devices.
There doesn't seem to be any reason for that, so this patch changes the
registration for all drivers to happen in the module init.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 135 +++++++++++++++++++++++-----------------
1 files changed, 77 insertions(+), 58 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 80fbfd7..95d312c 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -218,42 +218,6 @@ static int omap_dss_probe(struct platform_device *pdev)
dss_init_overlay_managers(pdev);
dss_init_overlays(pdev);
- r = dss_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize DSS platform driver\n");
- goto err_dss;
- }
-
- r = dispc_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize dispc platform driver\n");
- goto err_dispc;
- }
-
- r = rfbi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize rfbi platform driver\n");
- goto err_rfbi;
- }
-
- r = venc_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize venc platform driver\n");
- goto err_venc;
- }
-
- r = dsi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize DSI platform driver\n");
- goto err_dsi;
- }
-
- r = hdmi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize hdmi\n");
- goto err_hdmi;
- }
-
r = dss_initialize_debugfs();
if (r)
goto err_debugfs;
@@ -281,18 +245,6 @@ static int omap_dss_probe(struct platform_device *pdev)
err_register:
dss_uninitialize_debugfs();
err_debugfs:
- hdmi_uninit_platform_driver();
-err_hdmi:
- dsi_uninit_platform_driver();
-err_dsi:
- venc_uninit_platform_driver();
-err_venc:
- dispc_uninit_platform_driver();
-err_dispc:
- rfbi_uninit_platform_driver();
-err_rfbi:
- dss_uninit_platform_driver();
-err_dss:
return r;
}
@@ -304,13 +256,6 @@ static int omap_dss_remove(struct platform_device *pdev)
dss_uninitialize_debugfs();
- hdmi_uninit_platform_driver();
- dsi_uninit_platform_driver();
- venc_uninit_platform_driver();
- rfbi_uninit_platform_driver();
- dispc_uninit_platform_driver();
- dss_uninit_platform_driver();
-
dss_uninit_overlays(pdev);
dss_uninit_overlay_managers(pdev);
@@ -559,6 +504,80 @@ static int omap_dss_bus_register(void)
/* INIT */
+static int __init omap_dss_register_drivers(void)
+{
+ int r;
+
+ r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
+ if (r)
+ return r;
+
+ r = dss_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize DSS platform driver\n");
+ goto err_dss;
+ }
+
+ r = dispc_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize dispc platform driver\n");
+ goto err_dispc;
+ }
+
+ r = rfbi_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize rfbi platform driver\n");
+ goto err_rfbi;
+ }
+
+ r = venc_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize venc platform driver\n");
+ goto err_venc;
+ }
+
+ r = dsi_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize DSI platform driver\n");
+ goto err_dsi;
+ }
+
+ r = hdmi_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize hdmi\n");
+ goto err_hdmi;
+ }
+
+ return 0;
+
+err_hdmi:
+ dsi_uninit_platform_driver();
+err_dsi:
+ venc_uninit_platform_driver();
+err_venc:
+ rfbi_uninit_platform_driver();
+err_rfbi:
+ dispc_uninit_platform_driver();
+err_dispc:
+ dss_uninit_platform_driver();
+err_dss:
+ platform_driver_unregister(&omap_dss_driver);
+
+ return r;
+}
+
+static void __exit omap_dss_unregister_drivers(void)
+{
+ hdmi_uninit_platform_driver();
+ dsi_uninit_platform_driver();
+ venc_uninit_platform_driver();
+ rfbi_uninit_platform_driver();
+ dispc_uninit_platform_driver();
+ dss_uninit_platform_driver();
+
+ platform_driver_unregister(&omap_dss_driver);
+}
+
#ifdef CONFIG_OMAP2_DSS_MODULE
static void omap_dss_bus_unregister(void)
{
@@ -575,7 +594,7 @@ static int __init omap_dss_init(void)
if (r)
return r;
- r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
+ r = omap_dss_register_drivers();
if (r) {
omap_dss_bus_unregister();
return r;
@@ -596,7 +615,7 @@ static void __exit omap_dss_exit(void)
core.vdds_sdi_reg = NULL;
}
- platform_driver_unregister(&omap_dss_driver);
+ omap_dss_unregister_drivers();
omap_dss_bus_unregister();
}
@@ -611,7 +630,7 @@ static int __init omap_dss_init(void)
static int __init omap_dss_init2(void)
{
- return platform_driver_register(&omap_dss_driver);
+ return omap_dss_register_drivers();
}
core_initcall(omap_dss_init);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 12/21] OMAPDSS: create custom pdevs for DSS omap_devices
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (10 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 11/21] OMAPDSS: register dss drivers in module init Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 13/21] OMAPDSS: create DPI & SDI devices Tomi Valkeinen
` (8 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
Instead of using omap_device_build() to create the omap_devices for DSS
hwmods, create them with a custom function. This will allow us to create
a parent-child hierarchy for the devices so that the omapdss_core device
is parent for the rest of the dss hwmod devices.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/mach-omap2/display.c | 88 ++++++++++++++++++++++++++++++++++------
1 files changed, 74 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 279c124..3227eca 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -179,13 +179,71 @@ static void omap_dsi_disable_pads(int dsi_id, unsigned lane_mask)
omap4_dsi_mux_pads(dsi_id, 0);
}
+static struct platform_device *create_dss_pdev(const char *pdev_name,
+ int pdev_id, const char *oh_name, void *pdata, int pdata_len,
+ struct platform_device *parent)
+{
+ struct platform_device *pdev;
+ struct omap_device *od;
+ struct omap_hwmod *ohs[1];
+ struct omap_hwmod *oh;
+ int r;
+
+ oh = omap_hwmod_lookup(oh_name);
+ if (!oh) {
+ pr_err("Could not look up %s\n", oh_name);
+ r = -ENODEV;
+ goto err;
+ }
+
+ pdev = platform_device_alloc(pdev_name, pdev_id);
+ if (!pdev) {
+ pr_err("Could not create pdev for %s\n", pdev_name);
+ r = -ENOMEM;
+ goto err;
+ }
+
+ if (parent != NULL)
+ pdev->dev.parent = &parent->dev;
+
+ if (pdev->id != -1)
+ dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
+ else
+ dev_set_name(&pdev->dev, "%s", pdev->name);
+
+ ohs[0] = oh;
+ od = omap_device_alloc(pdev, ohs, 1, NULL, 0);
+ if (!od) {
+ pr_err("Could not alloc omap_device for %s\n", pdev_name);
+ r = -ENOMEM;
+ goto err;
+ }
+
+ r = platform_device_add_data(pdev, pdata, pdata_len);
+ if (r) {
+ pr_err("Could not set pdata for %s\n", pdev_name);
+ goto err;
+ }
+
+ r = omap_device_register(pdev);
+ if (r) {
+ pr_err("Could not register omap_device for %s\n", pdev_name);
+ goto err;
+ }
+
+ return pdev;
+
+err:
+ return ERR_PTR(r);
+}
+
int __init omap_display_init(struct omap_dss_board_info *board_data)
{
int r = 0;
- struct omap_hwmod *oh;
struct platform_device *pdev;
int i, oh_count;
const struct omap_dss_hwmod_data *curr_dss_hwmod;
+ struct platform_device *dss_pdev;
/* create omapdss device */
@@ -214,22 +272,24 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
}
- for (i = 0; i < oh_count; i++) {
- oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
- if (!oh) {
- pr_err("Could not look up %s\n",
- curr_dss_hwmod[i].oh_name);
- return -ENODEV;
- }
+ dss_pdev = NULL;
- pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
- curr_dss_hwmod[i].id, oh,
+ for (i = 0; i < oh_count; i++) {
+ pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name,
+ curr_dss_hwmod[i].id,
+ curr_dss_hwmod[i].oh_name,
NULL, 0,
- NULL, 0, 0);
+ dss_pdev);
+
+ if (IS_ERR(pdev)) {
+ pr_err("Could not build omap_device for %s\n",
+ curr_dss_hwmod[i].oh_name);
+
+ return PTR_ERR(pdev);
+ }
- if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
- curr_dss_hwmod[i].oh_name))
- return -ENODEV;
+ if (i = 0)
+ dss_pdev = pdev;
}
return 0;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 13/21] OMAPDSS: create DPI & SDI devices
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (11 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 12/21] OMAPDSS: create custom pdevs for DSS omap_devices Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 14/21] OMAPDSS: create DPI & SDI drivers Tomi Valkeinen
` (7 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
We currently have separate device/driver for each DSS HW module. The DPI
and SDI outputs are more or less parts of the DSS or DISPC hardware
modules, but in SW it makes sense to represent them as device/driver
pairs similarly to all the other outputs. This also makes sense for
device tree, as each node under dss will be a platform device, and
handling DPI & SDI somehow differently than the rest would just make the
code more complex.
This patch modifies arch/arm/mach-omap2/display.c to create platform
devices for DPI and SDI, and later patches will implement driver for
them.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/mach-omap2/display.c | 57 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 3227eca..f102d1f 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -237,6 +237,46 @@ err:
return ERR_PTR(r);
}
+static struct platform_device *create_simple_dss_pdev(const char *pdev_name,
+ int pdev_id, void *pdata, int pdata_len,
+ struct platform_device *parent)
+{
+ struct platform_device *pdev;
+ int r;
+
+ pdev = platform_device_alloc(pdev_name, pdev_id);
+ if (!pdev) {
+ pr_err("Could not create pdev for %s\n", pdev_name);
+ r = -ENOMEM;
+ goto err;
+ }
+
+ if (parent != NULL)
+ pdev->dev.parent = &parent->dev;
+
+ if (pdev->id != -1)
+ dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
+ else
+ dev_set_name(&pdev->dev, "%s", pdev->name);
+
+ r = platform_device_add_data(pdev, pdata, pdata_len);
+ if (r) {
+ pr_err("Could not set pdata for %s\n", pdev_name);
+ goto err;
+ }
+
+ r = omap_device_register(pdev);
+ if (r) {
+ pr_err("Could not register omap_device for %s\n", pdev_name);
+ goto err;
+ }
+
+ return pdev;
+
+err:
+ return ERR_PTR(r);
+}
+
int __init omap_display_init(struct omap_dss_board_info *board_data)
{
int r = 0;
@@ -292,6 +332,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
dss_pdev = pdev;
}
+ /* Create devices for DPI and SDI */
+
+ pdev = create_simple_dss_pdev("omapdss_dpi", -1, NULL, 0, dss_pdev);
+ if (IS_ERR(pdev)) {
+ pr_err("Could not build platform_device for omapdss_dpi\n");
+ return PTR_ERR(pdev);
+ }
+
+ if (cpu_is_omap34xx()) {
+ pdev = create_simple_dss_pdev("omapdss_sdi", -1, NULL, 0,
+ dss_pdev);
+ if (IS_ERR(pdev)) {
+ pr_err("Could not build platform_device for omapdss_sdi\n");
+ return PTR_ERR(pdev);
+ }
+ }
+
return 0;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 14/21] OMAPDSS: create DPI & SDI drivers
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (12 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 13/21] OMAPDSS: create DPI & SDI devices Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 15/21] OMAPDSS: remove uses of dss_runtime_get/put Tomi Valkeinen
` (6 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
We currently have separate device/driver for each DSS HW module. The DPI
and SDI outputs are more or less parts of the DSS or DISPC hardware
modules, but in SW it makes sense to represent them as device/driver
pairs similarly to all the other outputs. This also makes sense for
device tree, as each node under dss will be a platform device, and
handling DPI & SDI somehow differently than the rest would just make the
code more complex.
This patch modifies the dpi.c and sdi.c to create drivers for the
platform devices.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 18 ++++++++++++++++++
drivers/video/omap2/dss/dpi.c | 23 +++++++++++++++++++++--
drivers/video/omap2/dss/dss.c | 20 +-------------------
drivers/video/omap2/dss/dss.h | 26 ++++++++------------------
drivers/video/omap2/dss/sdi.c | 25 +++++++++++++++++++++++--
5 files changed, 71 insertions(+), 41 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 95d312c..654962a 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -524,6 +524,18 @@ static int __init omap_dss_register_drivers(void)
goto err_dispc;
}
+ r = dpi_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize dpi platform driver\n");
+ goto err_dpi;
+ }
+
+ r = sdi_init_platform_driver();
+ if (r) {
+ DSSERR("Failed to initialize sdi platform driver\n");
+ goto err_sdi;
+ }
+
r = rfbi_init_platform_driver();
if (r) {
DSSERR("Failed to initialize rfbi platform driver\n");
@@ -557,6 +569,10 @@ err_dsi:
err_venc:
rfbi_uninit_platform_driver();
err_rfbi:
+ sdi_uninit_platform_driver();
+err_sdi:
+ dpi_uninit_platform_driver();
+err_dpi:
dispc_uninit_platform_driver();
err_dispc:
dss_uninit_platform_driver();
@@ -572,6 +588,8 @@ static void __exit omap_dss_unregister_drivers(void)
dsi_uninit_platform_driver();
venc_uninit_platform_driver();
rfbi_uninit_platform_driver();
+ sdi_uninit_platform_driver();
+ dpi_uninit_platform_driver();
dispc_uninit_platform_driver();
dss_uninit_platform_driver();
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index faaf305..5b7bbab 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -378,12 +378,31 @@ int dpi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-int dpi_init(void)
+static int omap_dpi_probe(struct platform_device *pdev)
{
return 0;
}
-void dpi_exit(void)
+static int omap_dpi_remove(struct platform_device *pdev)
{
+ return 0;
}
+static struct platform_driver omap_dpi_driver = {
+ .probe = omap_dpi_probe,
+ .remove = omap_dpi_remove,
+ .driver = {
+ .name = "omapdss_dpi",
+ .owner = THIS_MODULE,
+ },
+};
+
+int dpi_init_platform_driver(void)
+{
+ return platform_driver_register(&omap_dpi_driver);
+}
+
+void dpi_uninit_platform_driver(void)
+{
+ platform_driver_unregister(&omap_dpi_driver);
+}
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 34cc84f..3156851 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -782,18 +782,6 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK;
dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK;
- r = dpi_init();
- if (r) {
- DSSERR("Failed to initialize DPI\n");
- goto err_dpi;
- }
-
- r = sdi_init();
- if (r) {
- DSSERR("Failed to initialize SDI\n");
- goto err_sdi;
- }
-
rev = dss_read_reg(DSS_REVISION);
printk(KERN_INFO "OMAP DSS rev %d.%d\n",
FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
@@ -801,10 +789,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss_runtime_put();
return 0;
-err_sdi:
- dpi_exit();
-err_dpi:
- dss_runtime_put();
+
err_runtime_get:
pm_runtime_disable(&pdev->dev);
dss_put_clocks();
@@ -813,9 +798,6 @@ err_runtime_get:
static int omap_dsshw_remove(struct platform_device *pdev)
{
- dpi_exit();
- sdi_exit();
-
pm_runtime_disable(&pdev->dev);
dss_put_clocks();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index d37ed80..1981626 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -269,17 +269,12 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
/* SDI */
#ifdef CONFIG_OMAP2_DSS_SDI
-int sdi_init(void);
-void sdi_exit(void);
+int sdi_init_platform_driver(void);
+void sdi_uninit_platform_driver(void);
int sdi_init_display(struct omap_dss_device *display);
#else
-static inline int sdi_init(void)
-{
- return 0;
-}
-static inline void sdi_exit(void)
-{
-}
+static inline int sdi_init_platform_driver(void) { return 0; }
+static inline void sdi_uninit_platform_driver(void) { }
#endif
/* DSI */
@@ -381,17 +376,12 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module)
/* DPI */
#ifdef CONFIG_OMAP2_DSS_DPI
-int dpi_init(void);
-void dpi_exit(void);
+int dpi_init_platform_driver(void);
+void dpi_uninit_platform_driver(void);
int dpi_init_display(struct omap_dss_device *dssdev);
#else
-static inline int dpi_init(void)
-{
- return 0;
-}
-static inline void dpi_exit(void)
-{
-}
+static inline int dpi_init_platform_driver(void) { return 0; }
+static inline void dpi_uninit_platform_driver(void) { }
#endif
/* DISPC */
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 8266ca0..d886d93 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -24,6 +24,7 @@
#include <linux/err.h>
#include <linux/regulator/consumer.h>
#include <linux/export.h>
+#include <linux/platform_device.h>
#include <video/omapdss.h>
#include "dss.h"
@@ -182,11 +183,31 @@ int sdi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-int sdi_init(void)
+static int omap_sdi_probe(struct platform_device *pdev)
{
return 0;
}
-void sdi_exit(void)
+static int omap_sdi_remove(struct platform_device *pdev)
{
+ return 0;
+}
+
+static struct platform_driver omap_sdi_driver = {
+ .probe = omap_sdi_probe,
+ .remove = omap_sdi_remove,
+ .driver = {
+ .name = "omapdss_sdi",
+ .owner = THIS_MODULE,
+ },
+};
+
+int sdi_init_platform_driver(void)
+{
+ return platform_driver_register(&omap_sdi_driver);
+}
+
+void sdi_uninit_platform_driver(void)
+{
+ platform_driver_unregister(&omap_sdi_driver);
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 15/21] OMAPDSS: remove uses of dss_runtime_get/put
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (13 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 14/21] OMAPDSS: create DPI & SDI drivers Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically Tomi Valkeinen
` (5 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
Now that the omapdss_core device is the parent for all other dss
devices, we don't need to use the dss_runtime_get/put anymore. Instead,
enabling omapdss_core will happen automatically when a child device is
enabled.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dispc.c | 7 -------
drivers/video/omap2/dss/dpi.c | 16 +---------------
drivers/video/omap2/dss/dsi.c | 12 +-----------
drivers/video/omap2/dss/dss.c | 7 +++++--
drivers/video/omap2/dss/dss.h | 3 ---
drivers/video/omap2/dss/hdmi.c | 34 ++--------------------------------
drivers/video/omap2/dss/rfbi.c | 12 +-----------
drivers/video/omap2/dss/sdi.c | 7 -------
drivers/video/omap2/dss/venc.c | 12 +-----------
9 files changed, 11 insertions(+), 99 deletions(-)
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index c71d4c5..1fbe480 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3407,19 +3407,12 @@ static int omap_dispchw_remove(struct platform_device *pdev)
static int dispc_runtime_suspend(struct device *dev)
{
dispc_save_context();
- dss_runtime_put();
return 0;
}
static int dispc_runtime_resume(struct device *dev)
{
- int r;
-
- r = dss_runtime_get();
- if (r < 0)
- return r;
-
dispc_restore_context();
return 0;
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 5b7bbab..511df3c 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -202,10 +202,6 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev)
goto err_reg_enable;
}
- r = dss_runtime_get();
- if (r)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r)
goto err_get_dispc;
@@ -244,8 +240,6 @@ err_dsi_pll_init:
err_get_dsi:
dispc_runtime_put();
err_get_dispc:
- dss_runtime_put();
-err_get_dss:
if (cpu_is_omap34xx())
regulator_disable(dpi.vdds_dsi_reg);
err_reg_enable:
@@ -266,7 +260,6 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev)
}
dispc_runtime_put();
- dss_runtime_put();
if (cpu_is_omap34xx())
regulator_disable(dpi.vdds_dsi_reg);
@@ -283,21 +276,14 @@ void dpi_set_timings(struct omap_dss_device *dssdev,
DSSDBG("dpi_set_timings\n");
dssdev->panel.timings = *timings;
if (dssdev->state = OMAP_DSS_DISPLAY_ACTIVE) {
- r = dss_runtime_get();
- if (r)
- return;
-
r = dispc_runtime_get();
- if (r) {
- dss_runtime_put();
+ if (r)
return;
- }
dpi_set_mode(dssdev);
dispc_mgr_go(dssdev->manager->id);
dispc_runtime_put();
- dss_runtime_put();
}
}
EXPORT_SYMBOL(dpi_set_timings);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index cf59f40..4bee235 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4802,7 +4802,6 @@ static int omap_dsihw_remove(struct platform_device *dsidev)
static int dsi_runtime_suspend(struct device *dev)
{
dispc_runtime_put();
- dss_runtime_put();
return 0;
}
@@ -4811,20 +4810,11 @@ static int dsi_runtime_resume(struct device *dev)
{
int r;
- r = dss_runtime_get();
- if (r)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r)
- goto err_get_dispc;
+ return r;
return 0;
-
-err_get_dispc:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static const struct dev_pm_ops dsi_pm_ops = {
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 3156851..da528b7 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -59,6 +59,9 @@ struct dss_reg {
#define REG_FLD_MOD(idx, val, start, end) \
dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end))
+static int dss_runtime_get(void);
+static void dss_runtime_put(void);
+
static struct {
struct platform_device *pdev;
void __iomem *base;
@@ -703,7 +706,7 @@ static void dss_put_clocks(void)
clk_put(dss.dss_clk);
}
-int dss_runtime_get(void)
+static int dss_runtime_get(void)
{
int r;
@@ -714,7 +717,7 @@ int dss_runtime_get(void)
return r < 0 ? r : 0;
}
-void dss_runtime_put(void)
+static void dss_runtime_put(void)
{
int r;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 1981626..24aadde 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -230,9 +230,6 @@ int dss_ovl_check(struct omap_overlay *ovl,
int dss_init_platform_driver(void);
void dss_uninit_platform_driver(void);
-int dss_runtime_get(void);
-void dss_runtime_put(void);
-
void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select);
enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index b4ad13b..08a316b 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -129,25 +129,12 @@ static int hdmi_runtime_get(void)
DSSDBG("hdmi_runtime_get\n");
- /*
- * HACK: Add dss_runtime_get() to ensure DSS clock domain is enabled.
- * This should be removed later.
- */
- r = dss_runtime_get();
- if (r < 0)
- goto err_get_dss;
-
r = pm_runtime_get_sync(&hdmi.pdev->dev);
WARN_ON(r < 0);
if (r < 0)
- goto err_get_hdmi;
+ return r;
return 0;
-
-err_get_hdmi:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static void hdmi_runtime_put(void)
@@ -158,12 +145,6 @@ static void hdmi_runtime_put(void)
r = pm_runtime_put_sync(&hdmi.pdev->dev);
WARN_ON(r < 0);
-
- /*
- * HACK: This is added to complement the dss_runtime_get() call in
- * hdmi_runtime_get(). This should be removed later.
- */
- dss_runtime_put();
}
int hdmi_init_display(struct omap_dss_device *dssdev)
@@ -865,7 +846,6 @@ static int hdmi_runtime_suspend(struct device *dev)
clk_disable(hdmi.sys_clk);
dispc_runtime_put();
- dss_runtime_put();
return 0;
}
@@ -874,23 +854,13 @@ static int hdmi_runtime_resume(struct device *dev)
{
int r;
- r = dss_runtime_get();
- if (r < 0)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r < 0)
- goto err_get_dispc;
-
+ return r;
clk_enable(hdmi.sys_clk);
return 0;
-
-err_get_dispc:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static const struct dev_pm_ops hdmi_pm_ops = {
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index dfd8ec5..b6990ba 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -972,7 +972,6 @@ static int omap_rfbihw_remove(struct platform_device *pdev)
static int rfbi_runtime_suspend(struct device *dev)
{
dispc_runtime_put();
- dss_runtime_put();
return 0;
}
@@ -981,20 +980,11 @@ static int rfbi_runtime_resume(struct device *dev)
{
int r;
- r = dss_runtime_get();
- if (r < 0)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r < 0)
- goto err_get_dispc;
+ return r;
return 0;
-
-err_get_dispc:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static const struct dev_pm_ops rfbi_pm_ops = {
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index d886d93..684a4de 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -72,10 +72,6 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
if (r)
goto err_reg_enable;
- r = dss_runtime_get();
- if (r)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r)
goto err_get_dispc;
@@ -138,8 +134,6 @@ err_set_dss_clock_div:
err_calc_clock_div:
dispc_runtime_put();
err_get_dispc:
- dss_runtime_put();
-err_get_dss:
regulator_disable(sdi.vdds_sdi_reg);
err_reg_enable:
omap_dss_stop_device(dssdev);
@@ -155,7 +149,6 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev)
dss_sdi_disable();
dispc_runtime_put();
- dss_runtime_put();
regulator_disable(sdi.vdds_sdi_reg);
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index c933733..637abcb 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -853,7 +853,6 @@ static int venc_runtime_suspend(struct device *dev)
clk_disable(venc.tv_dac_clk);
dispc_runtime_put();
- dss_runtime_put();
return 0;
}
@@ -862,23 +861,14 @@ static int venc_runtime_resume(struct device *dev)
{
int r;
- r = dss_runtime_get();
- if (r < 0)
- goto err_get_dss;
-
r = dispc_runtime_get();
if (r < 0)
- goto err_get_dispc;
+ return r;
if (venc.tv_dac_clk)
clk_enable(venc.tv_dac_clk);
return 0;
-
-err_get_dispc:
- dss_runtime_put();
-err_get_dss:
- return r;
}
static const struct dev_pm_ops venc_pm_ops = {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (14 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 15/21] OMAPDSS: remove uses of dss_runtime_get/put Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-08 8:46 ` Archit Taneja
2012-03-07 12:44 ` [PATCH 17/21] OMAPDSS: move the creation of debugfs files Tomi Valkeinen
` (4 subsequent siblings)
20 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
Initialize and uninitialize the output drivers by using arrays of
pointers to the init/uninit functions. This simplifies the code
slightly.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 111 +++++++++++++++++++++-------------------
drivers/video/omap2/dss/dss.h | 41 ---------------
2 files changed, 59 insertions(+), 93 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 654962a..ac4f2cb 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -503,10 +503,54 @@ static int omap_dss_bus_register(void)
}
/* INIT */
+static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
+#ifdef CONFIG_OMAP2_DSS_DPI
+ dpi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_SDI
+ sdi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_RFBI
+ rfbi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_VENC
+ venc_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_DSI
+ dsi_init_platform_driver,
+#endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+ hdmi_init_platform_driver,
+#endif
+};
+
+static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = {
+#ifdef CONFIG_OMAP2_DSS_DPI
+ dpi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_SDI
+ sdi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_RFBI
+ rfbi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_VENC
+ venc_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP2_DSS_DSI
+ dsi_uninit_platform_driver,
+#endif
+#ifdef CONFIG_OMAP4_DSS_HDMI
+ hdmi_uninit_platform_driver,
+#endif
+};
+
+static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)];
static int __init omap_dss_register_drivers(void)
{
int r;
+ int i;
r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
if (r)
@@ -524,56 +568,18 @@ static int __init omap_dss_register_drivers(void)
goto err_dispc;
}
- r = dpi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize dpi platform driver\n");
- goto err_dpi;
- }
-
- r = sdi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize sdi platform driver\n");
- goto err_sdi;
- }
-
- r = rfbi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize rfbi platform driver\n");
- goto err_rfbi;
- }
-
- r = venc_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize venc platform driver\n");
- goto err_venc;
- }
-
- r = dsi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize DSI platform driver\n");
- goto err_dsi;
- }
-
- r = hdmi_init_platform_driver();
- if (r) {
- DSSERR("Failed to initialize hdmi\n");
- goto err_hdmi;
+ /*
+ * It's ok if the output-driver register fails. It happens, for example,
+ * when there is no output-device (e.g. SDI for OMAP4).
+ */
+ for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) {
+ r = dss_output_drv_reg_funcs[i]();
+ if (r = 0)
+ dss_output_drv_loaded[i] = true;
}
return 0;
-err_hdmi:
- dsi_uninit_platform_driver();
-err_dsi:
- venc_uninit_platform_driver();
-err_venc:
- rfbi_uninit_platform_driver();
-err_rfbi:
- sdi_uninit_platform_driver();
-err_sdi:
- dpi_uninit_platform_driver();
-err_dpi:
- dispc_uninit_platform_driver();
err_dispc:
dss_uninit_platform_driver();
err_dss:
@@ -584,12 +590,13 @@ err_dss:
static void __exit omap_dss_unregister_drivers(void)
{
- hdmi_uninit_platform_driver();
- dsi_uninit_platform_driver();
- venc_uninit_platform_driver();
- rfbi_uninit_platform_driver();
- sdi_uninit_platform_driver();
- dpi_uninit_platform_driver();
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) {
+ if (dss_output_drv_loaded[i])
+ dss_output_drv_unreg_funcs[i]();
+ }
+
dispc_uninit_platform_driver();
dss_uninit_platform_driver();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 24aadde..af7bed1 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -265,14 +265,9 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
struct dispc_clock_info *dispc_cinfo);
/* SDI */
-#ifdef CONFIG_OMAP2_DSS_SDI
int sdi_init_platform_driver(void);
void sdi_uninit_platform_driver(void);
int sdi_init_display(struct omap_dss_device *display);
-#else
-static inline int sdi_init_platform_driver(void) { return 0; }
-static inline void sdi_uninit_platform_driver(void) { }
-#endif
/* DSI */
#ifdef CONFIG_OMAP2_DSS_DSI
@@ -309,13 +304,6 @@ void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev);
void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev);
struct platform_device *dsi_get_dsidev_from_id(int module);
#else
-static inline int dsi_init_platform_driver(void)
-{
- return 0;
-}
-static inline void dsi_uninit_platform_driver(void)
-{
-}
static inline int dsi_runtime_get(struct platform_device *dsidev)
{
return 0;
@@ -372,14 +360,9 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module)
#endif
/* DPI */
-#ifdef CONFIG_OMAP2_DSS_DPI
int dpi_init_platform_driver(void);
void dpi_uninit_platform_driver(void);
int dpi_init_display(struct omap_dss_device *dssdev);
-#else
-static inline int dpi_init_platform_driver(void) { return 0; }
-static inline void dpi_uninit_platform_driver(void) { }
-#endif
/* DISPC */
int dispc_init_platform_driver(void);
@@ -456,13 +439,6 @@ void venc_dump_regs(struct seq_file *s);
int venc_init_display(struct omap_dss_device *display);
unsigned long venc_get_pixel_clock(void);
#else
-static inline int venc_init_platform_driver(void)
-{
- return 0;
-}
-static inline void venc_uninit_platform_driver(void)
-{
-}
static inline unsigned long venc_get_pixel_clock(void)
{
WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__);
@@ -482,13 +458,6 @@ static inline int hdmi_init_display(struct omap_dss_device *dssdev)
{
return 0;
}
-static inline int hdmi_init_platform_driver(void)
-{
- return 0;
-}
-static inline void hdmi_uninit_platform_driver(void)
-{
-}
static inline unsigned long hdmi_get_pixel_clock(void)
{
WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__);
@@ -506,20 +475,10 @@ int hdmi_panel_init(void);
void hdmi_panel_exit(void);
/* RFBI */
-#ifdef CONFIG_OMAP2_DSS_RFBI
int rfbi_init_platform_driver(void);
void rfbi_uninit_platform_driver(void);
void rfbi_dump_regs(struct seq_file *s);
int rfbi_init_display(struct omap_dss_device *display);
-#else
-static inline int rfbi_init_platform_driver(void)
-{
- return 0;
-}
-static inline void rfbi_uninit_platform_driver(void)
-{
-}
-#endif
#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 17/21] OMAPDSS: move the creation of debugfs files
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (15 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 18/21] OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi Tomi Valkeinen
` (3 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
Instead of having an ugly #ifdef mess in the core.c for creating debugfs
files, add a dss_debugfs_create_file() function that the dss drivers
can use to create the debugfs files.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 46 +++++++++++++++-----------------------
drivers/video/omap2/dss/dispc.c | 7 +++++-
drivers/video/omap2/dss/dsi.c | 42 +++++++++--------------------------
drivers/video/omap2/dss/dss.c | 4 ++-
drivers/video/omap2/dss/dss.h | 11 +--------
drivers/video/omap2/dss/hdmi.c | 4 ++-
drivers/video/omap2/dss/rfbi.c | 4 ++-
drivers/video/omap2/dss/venc.c | 4 ++-
8 files changed, 48 insertions(+), 74 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index ac4f2cb..a744474 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -156,34 +156,6 @@ static int dss_initialize_debugfs(void)
debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir,
&dss_debug_dump_clocks, &dss_debug_fops);
-#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
- debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir,
- &dispc_dump_irqs, &dss_debug_fops);
-#endif
-
-#if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS)
- dsi_create_debugfs_files_irq(dss_debugfs_dir, &dss_debug_fops);
-#endif
-
- debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir,
- &dss_dump_regs, &dss_debug_fops);
- debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir,
- &dispc_dump_regs, &dss_debug_fops);
-#ifdef CONFIG_OMAP2_DSS_RFBI
- debugfs_create_file("rfbi", S_IRUGO, dss_debugfs_dir,
- &rfbi_dump_regs, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP2_DSS_DSI
- dsi_create_debugfs_files_reg(dss_debugfs_dir, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP2_DSS_VENC
- debugfs_create_file("venc", S_IRUGO, dss_debugfs_dir,
- &venc_dump_regs, &dss_debug_fops);
-#endif
-#ifdef CONFIG_OMAP4_DSS_HDMI
- debugfs_create_file("hdmi", S_IRUGO, dss_debugfs_dir,
- &hdmi_dump_regs, &dss_debug_fops);
-#endif
return 0;
}
@@ -192,6 +164,19 @@ static void dss_uninitialize_debugfs(void)
if (dss_debugfs_dir)
debugfs_remove_recursive(dss_debugfs_dir);
}
+
+int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
+{
+ struct dentry *d;
+
+ d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
+ write, &dss_debug_fops);
+
+ if (IS_ERR(d))
+ return PTR_ERR(d);
+
+ return 0;
+}
#else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
static inline int dss_initialize_debugfs(void)
{
@@ -200,6 +185,11 @@ static inline int dss_initialize_debugfs(void)
static inline void dss_uninitialize_debugfs(void)
{
}
+static inline int dss_debugfs_create_file(const char *name,
+ void (*write)(struct seq_file *))
+{
+ return 0;
+}
#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
/* PLATFORM DEVICE */
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 1fbe480..a555e32 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2571,7 +2571,7 @@ void dispc_dump_irqs(struct seq_file *s)
}
#endif
-void dispc_dump_regs(struct seq_file *s)
+static void dispc_dump_regs(struct seq_file *s)
{
int i, j;
const char *mgr_names[] = {
@@ -3387,6 +3387,11 @@ static int omap_dispchw_probe(struct platform_device *pdev)
dispc_runtime_put();
+ dss_debugfs_create_file("dispc", dispc_dump_regs);
+
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+ dss_debugfs_create_file("dispc_irq", dispc_dump_irqs);
+#endif
return 0;
err_runtime_get:
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 4bee235..0a1c5e3 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -1883,22 +1883,6 @@ static void dsi2_dump_irqs(struct seq_file *s)
dsi_dump_dsidev_irqs(dsidev, s);
}
-
-void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
- const struct file_operations *debug_fops)
-{
- struct platform_device *dsidev;
-
- dsidev = dsi_get_dsidev_from_id(0);
- if (dsidev)
- debugfs_create_file("dsi1_irqs", S_IRUGO, debugfs_dir,
- &dsi1_dump_irqs, debug_fops);
-
- dsidev = dsi_get_dsidev_from_id(1);
- if (dsidev)
- debugfs_create_file("dsi2_irqs", S_IRUGO, debugfs_dir,
- &dsi2_dump_irqs, debug_fops);
-}
#endif
static void dsi_dump_dsidev_regs(struct platform_device *dsidev,
@@ -1999,21 +1983,6 @@ static void dsi2_dump_regs(struct seq_file *s)
dsi_dump_dsidev_regs(dsidev, s);
}
-void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
- const struct file_operations *debug_fops)
-{
- struct platform_device *dsidev;
-
- dsidev = dsi_get_dsidev_from_id(0);
- if (dsidev)
- debugfs_create_file("dsi1_regs", S_IRUGO, debugfs_dir,
- &dsi1_dump_regs, debug_fops);
-
- dsidev = dsi_get_dsidev_from_id(1);
- if (dsidev)
- debugfs_create_file("dsi2_regs", S_IRUGO, debugfs_dir,
- &dsi2_dump_regs, debug_fops);
-}
enum dsi_cio_power_state {
DSI_COMPLEXIO_POWER_OFF = 0x0,
DSI_COMPLEXIO_POWER_ON = 0x1,
@@ -4768,6 +4737,17 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
dsi_runtime_put(dsidev);
+ if (dsi_module = 0)
+ dss_debugfs_create_file("dsi1_regs", dsi1_dump_regs);
+ else if (dsi_module = 1)
+ dss_debugfs_create_file("dsi2_regs", dsi2_dump_regs);
+
+#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
+ if (dsi_module = 0)
+ dss_debugfs_create_file("dsi1_irqs", dsi1_dump_irqs);
+ else if (dsi_module = 1)
+ dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs);
+#endif
return 0;
err_runtime_get:
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index da528b7..47a4c2a 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -277,7 +277,7 @@ void dss_dump_clocks(struct seq_file *s)
dss_runtime_put();
}
-void dss_dump_regs(struct seq_file *s)
+static void dss_dump_regs(struct seq_file *s)
{
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r))
@@ -791,6 +791,8 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss_runtime_put();
+ dss_debugfs_create_file("dss", dss_dump_regs);
+
return 0;
err_runtime_get:
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index af7bed1..5746bed 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -165,6 +165,7 @@ struct regulator *dss_get_vdds_sdi(void);
int dss_get_ctx_loss_count(struct device *dev);
int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
+int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *));
/* apply */
void dss_apply_init(void);
@@ -235,7 +236,6 @@ enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);
void dss_dump_clocks(struct seq_file *s);
-void dss_dump_regs(struct seq_file *s);
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
void dss_debug_dump_clocks(struct seq_file *s);
#endif
@@ -282,10 +282,6 @@ int dsi_runtime_get(struct platform_device *dsidev);
void dsi_runtime_put(struct platform_device *dsidev);
void dsi_dump_clocks(struct seq_file *s);
-void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir,
- const struct file_operations *debug_fops);
-void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
- const struct file_operations *debug_fops);
int dsi_init_display(struct omap_dss_device *display);
void dsi_irq_handler(void);
@@ -368,8 +364,6 @@ int dpi_init_display(struct omap_dss_device *dssdev);
int dispc_init_platform_driver(void);
void dispc_uninit_platform_driver(void);
void dispc_dump_clocks(struct seq_file *s);
-void dispc_dump_irqs(struct seq_file *s);
-void dispc_dump_regs(struct seq_file *s);
void dispc_irq_handler(void);
void dispc_fake_vsync_irq(void);
@@ -435,7 +429,6 @@ void dispc_mgr_setup(enum omap_channel channel,
#ifdef CONFIG_OMAP2_DSS_VENC
int venc_init_platform_driver(void);
void venc_uninit_platform_driver(void);
-void venc_dump_regs(struct seq_file *s);
int venc_init_display(struct omap_dss_device *display);
unsigned long venc_get_pixel_clock(void);
#else
@@ -452,7 +445,6 @@ int hdmi_init_platform_driver(void);
void hdmi_uninit_platform_driver(void);
int hdmi_init_display(struct omap_dss_device *dssdev);
unsigned long hdmi_get_pixel_clock(void);
-void hdmi_dump_regs(struct seq_file *s);
#else
static inline int hdmi_init_display(struct omap_dss_device *dssdev)
{
@@ -477,7 +469,6 @@ void hdmi_panel_exit(void);
/* RFBI */
int rfbi_init_platform_driver(void);
void rfbi_uninit_platform_driver(void);
-void rfbi_dump_regs(struct seq_file *s);
int rfbi_init_display(struct omap_dss_device *display);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 08a316b..10295fc 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -419,7 +419,7 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev)
}
}
-void hdmi_dump_regs(struct seq_file *s)
+static void hdmi_dump_regs(struct seq_file *s)
{
mutex_lock(&hdmi.lock);
@@ -809,6 +809,8 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
hdmi_panel_init();
+ dss_debugfs_create_file("hdmi", hdmi_dump_regs);
+
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index b6990ba..b07010b 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -799,7 +799,7 @@ int omap_rfbi_update(struct omap_dss_device *dssdev,
}
EXPORT_SYMBOL(omap_rfbi_update);
-void rfbi_dump_regs(struct seq_file *s)
+static void rfbi_dump_regs(struct seq_file *s)
{
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r))
@@ -956,6 +956,8 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
rfbi_runtime_put();
+ dss_debugfs_create_file("rfbi", rfbi_dump_regs);
+
return 0;
err_runtime_get:
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 637abcb..a9c7c7c 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -695,7 +695,7 @@ int venc_init_display(struct omap_dss_device *dssdev)
return 0;
}
-void venc_dump_regs(struct seq_file *s)
+static void venc_dump_regs(struct seq_file *s)
{
#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r))
@@ -824,6 +824,8 @@ static int omap_venchw_probe(struct platform_device *pdev)
if (r)
goto err_reg_panel_driver;
+ dss_debugfs_create_file("venc", venc_dump_regs);
+
return 0;
err_reg_panel_driver:
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 18/21] OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (16 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 17/21] OMAPDSS: move the creation of debugfs files Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 19/21] OMAPDSS: add __init & __exit Tomi Valkeinen
` (2 subsequent siblings)
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
Now that the core.c doesn't fail if output driver's init fails, we can
change the uses of platform_driver_register to platform_driver_probe.
This will allow us to use __init in the following patches.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dpi.c | 3 +--
drivers/video/omap2/dss/dsi.c | 3 +--
drivers/video/omap2/dss/hdmi.c | 3 +--
drivers/video/omap2/dss/rfbi.c | 3 +--
drivers/video/omap2/dss/sdi.c | 3 +--
drivers/video/omap2/dss/venc.c | 3 +--
6 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 511df3c..5ca216b 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -375,7 +375,6 @@ static int omap_dpi_remove(struct platform_device *pdev)
}
static struct platform_driver omap_dpi_driver = {
- .probe = omap_dpi_probe,
.remove = omap_dpi_remove,
.driver = {
.name = "omapdss_dpi",
@@ -385,7 +384,7 @@ static struct platform_driver omap_dpi_driver = {
int dpi_init_platform_driver(void)
{
- return platform_driver_register(&omap_dpi_driver);
+ return platform_driver_probe(&omap_dpi_driver, omap_dpi_probe);
}
void dpi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 0a1c5e3..9402d00 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4803,7 +4803,6 @@ static const struct dev_pm_ops dsi_pm_ops = {
};
static struct platform_driver omap_dsihw_driver = {
- .probe = omap_dsihw_probe,
.remove = omap_dsihw_remove,
.driver = {
.name = "omapdss_dsi",
@@ -4814,7 +4813,7 @@ static struct platform_driver omap_dsihw_driver = {
int dsi_init_platform_driver(void)
{
- return platform_driver_register(&omap_dsihw_driver);
+ return platform_driver_probe(&omap_dsihw_driver, omap_dsihw_probe);
}
void dsi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 10295fc..2f369ed 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -871,7 +871,6 @@ static const struct dev_pm_ops hdmi_pm_ops = {
};
static struct platform_driver omapdss_hdmihw_driver = {
- .probe = omapdss_hdmihw_probe,
.remove = omapdss_hdmihw_remove,
.driver = {
.name = "omapdss_hdmi",
@@ -882,7 +881,7 @@ static struct platform_driver omapdss_hdmihw_driver = {
int hdmi_init_platform_driver(void)
{
- return platform_driver_register(&omapdss_hdmihw_driver);
+ return platform_driver_probe(&omapdss_hdmihw_driver, omapdss_hdmihw_probe);
}
void hdmi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index b07010b..b2b0d5e 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -995,7 +995,6 @@ static const struct dev_pm_ops rfbi_pm_ops = {
};
static struct platform_driver omap_rfbihw_driver = {
- .probe = omap_rfbihw_probe,
.remove = omap_rfbihw_remove,
.driver = {
.name = "omapdss_rfbi",
@@ -1006,7 +1005,7 @@ static struct platform_driver omap_rfbihw_driver = {
int rfbi_init_platform_driver(void)
{
- return platform_driver_register(&omap_rfbihw_driver);
+ return platform_driver_probe(&omap_rfbihw_driver, omap_rfbihw_probe);
}
void rfbi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 684a4de..2cbcc00 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -187,7 +187,6 @@ static int omap_sdi_remove(struct platform_device *pdev)
}
static struct platform_driver omap_sdi_driver = {
- .probe = omap_sdi_probe,
.remove = omap_sdi_remove,
.driver = {
.name = "omapdss_sdi",
@@ -197,7 +196,7 @@ static struct platform_driver omap_sdi_driver = {
int sdi_init_platform_driver(void)
{
- return platform_driver_register(&omap_sdi_driver);
+ return platform_driver_probe(&omap_sdi_driver, omap_sdi_probe);
}
void sdi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index a9c7c7c..ca0bcdd 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -879,7 +879,6 @@ static const struct dev_pm_ops venc_pm_ops = {
};
static struct platform_driver omap_venchw_driver = {
- .probe = omap_venchw_probe,
.remove = omap_venchw_remove,
.driver = {
.name = "omapdss_venc",
@@ -893,7 +892,7 @@ int venc_init_platform_driver(void)
if (cpu_is_omap44xx())
return 0;
- return platform_driver_register(&omap_venchw_driver);
+ return platform_driver_probe(&omap_venchw_driver, omap_venchw_probe);
}
void venc_uninit_platform_driver(void)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 19/21] OMAPDSS: add __init & __exit
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (17 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 18/21] OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 20/21] OMAPFB: " Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 21/21] OMAPDSS: change default_device handling Tomi Valkeinen
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
Now that we are using platform_driver_probe() we can add __inits and
__exits all around.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 4 ++--
drivers/video/omap2/dss/dispc.c | 10 +++++-----
drivers/video/omap2/dss/dpi.c | 10 +++++-----
drivers/video/omap2/dss/dsi.c | 10 +++++-----
drivers/video/omap2/dss/dss.c | 10 +++++-----
drivers/video/omap2/dss/hdmi.c | 10 +++++-----
drivers/video/omap2/dss/rfbi.c | 10 +++++-----
drivers/video/omap2/dss/sdi.c | 10 +++++-----
drivers/video/omap2/dss/venc.c | 10 +++++-----
9 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index a744474..aa294d7 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -193,7 +193,7 @@ static inline int dss_debugfs_create_file(const char *name,
#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
/* PLATFORM DEVICE */
-static int omap_dss_probe(struct platform_device *pdev)
+static int __init omap_dss_probe(struct platform_device *pdev)
{
struct omap_dss_board_info *pdata = pdev->dev.platform_data;
int r;
@@ -471,7 +471,7 @@ static void omap_dss_unregister_device(struct omap_dss_device *dssdev)
}
/* BUS */
-static int omap_dss_bus_register(void)
+static int __init omap_dss_bus_register(void)
{
int r;
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index a555e32..71272a6 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3318,7 +3318,7 @@ static void _omap_dispc_initial_config(void)
}
/* DISPC HW IP initialisation */
-static int omap_dispchw_probe(struct platform_device *pdev)
+static int __init omap_dispchw_probe(struct platform_device *pdev)
{
u32 rev;
int r = 0;
@@ -3400,7 +3400,7 @@ err_runtime_get:
return r;
}
-static int omap_dispchw_remove(struct platform_device *pdev)
+static int __exit omap_dispchw_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
@@ -3429,7 +3429,7 @@ static const struct dev_pm_ops dispc_pm_ops = {
};
static struct platform_driver omap_dispchw_driver = {
- .remove = omap_dispchw_remove,
+ .remove = __exit_p(omap_dispchw_remove),
.driver = {
.name = "omapdss_dispc",
.owner = THIS_MODULE,
@@ -3437,12 +3437,12 @@ static struct platform_driver omap_dispchw_driver = {
},
};
-int dispc_init_platform_driver(void)
+__init int dispc_init_platform_driver(void)
{
return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe);
}
-void dispc_uninit_platform_driver(void)
+__exit void dispc_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dispchw_driver);
}
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 5ca216b..f93c3ad 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -364,30 +364,30 @@ int dpi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-static int omap_dpi_probe(struct platform_device *pdev)
+static int __init omap_dpi_probe(struct platform_device *pdev)
{
return 0;
}
-static int omap_dpi_remove(struct platform_device *pdev)
+static int __exit omap_dpi_remove(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver omap_dpi_driver = {
- .remove = omap_dpi_remove,
+ .remove = __exit_p(omap_dpi_remove),
.driver = {
.name = "omapdss_dpi",
.owner = THIS_MODULE,
},
};
-int dpi_init_platform_driver(void)
+__init int dpi_init_platform_driver(void)
{
return platform_driver_probe(&omap_dpi_driver, omap_dpi_probe);
}
-void dpi_uninit_platform_driver(void)
+__exit void dpi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dpi_driver);
}
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 9402d00..d510d0e 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4643,7 +4643,7 @@ static void dsi_put_clocks(struct platform_device *dsidev)
}
/* DSI1 HW IP initialisation */
-static int omap_dsihw_probe(struct platform_device *dsidev)
+static int __init omap_dsihw_probe(struct platform_device *dsidev)
{
u32 rev;
int r, i, dsi_module = dsi_get_dsidev_id(dsidev);
@@ -4756,7 +4756,7 @@ err_runtime_get:
return r;
}
-static int omap_dsihw_remove(struct platform_device *dsidev)
+static int __exit omap_dsihw_remove(struct platform_device *dsidev)
{
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -4803,7 +4803,7 @@ static const struct dev_pm_ops dsi_pm_ops = {
};
static struct platform_driver omap_dsihw_driver = {
- .remove = omap_dsihw_remove,
+ .remove = __exit_p(omap_dsihw_remove),
.driver = {
.name = "omapdss_dsi",
.owner = THIS_MODULE,
@@ -4811,12 +4811,12 @@ static struct platform_driver omap_dsihw_driver = {
},
};
-int dsi_init_platform_driver(void)
+__init int dsi_init_platform_driver(void)
{
return platform_driver_probe(&omap_dsihw_driver, omap_dsihw_probe);
}
-void dsi_uninit_platform_driver(void)
+__exit void dsi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dsihw_driver);
}
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 47a4c2a..c1f7dec 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -740,7 +740,7 @@ void dss_debug_dump_clocks(struct seq_file *s)
#endif
/* DSS HW IP initialisation */
-static int omap_dsshw_probe(struct platform_device *pdev)
+static int __init omap_dsshw_probe(struct platform_device *pdev)
{
struct resource *dss_mem;
u32 rev;
@@ -801,7 +801,7 @@ err_runtime_get:
return r;
}
-static int omap_dsshw_remove(struct platform_device *pdev)
+static int __exit omap_dsshw_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
@@ -828,7 +828,7 @@ static const struct dev_pm_ops dss_pm_ops = {
};
static struct platform_driver omap_dsshw_driver = {
- .remove = omap_dsshw_remove,
+ .remove = __exit_p(omap_dsshw_remove),
.driver = {
.name = "omapdss_dss",
.owner = THIS_MODULE,
@@ -836,12 +836,12 @@ static struct platform_driver omap_dsshw_driver = {
},
};
-int dss_init_platform_driver(void)
+__init int dss_init_platform_driver(void)
{
return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe);
}
-void dss_uninit_platform_driver(void)
+__exit void dss_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_dsshw_driver);
}
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2f369ed..18e4b65 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -771,7 +771,7 @@ static void hdmi_put_clocks(void)
}
/* HDMI HW IP initialisation */
-static int omapdss_hdmihw_probe(struct platform_device *pdev)
+static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
{
struct resource *hdmi_mem;
int r;
@@ -825,7 +825,7 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
return 0;
}
-static int omapdss_hdmihw_remove(struct platform_device *pdev)
+static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
{
hdmi_panel_exit();
@@ -871,7 +871,7 @@ static const struct dev_pm_ops hdmi_pm_ops = {
};
static struct platform_driver omapdss_hdmihw_driver = {
- .remove = omapdss_hdmihw_remove,
+ .remove = __exit_p(omapdss_hdmihw_remove),
.driver = {
.name = "omapdss_hdmi",
.owner = THIS_MODULE,
@@ -879,12 +879,12 @@ static struct platform_driver omapdss_hdmihw_driver = {
},
};
-int hdmi_init_platform_driver(void)
+__init int hdmi_init_platform_driver(void)
{
return platform_driver_probe(&omapdss_hdmihw_driver, omapdss_hdmihw_probe);
}
-void hdmi_uninit_platform_driver(void)
+__exit void hdmi_uninit_platform_driver(void)
{
platform_driver_unregister(&omapdss_hdmihw_driver);
}
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index b2b0d5e..bc83d44 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -908,7 +908,7 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
}
/* RFBI HW IP initialisation */
-static int omap_rfbihw_probe(struct platform_device *pdev)
+static int __init omap_rfbihw_probe(struct platform_device *pdev)
{
u32 rev;
struct resource *rfbi_mem;
@@ -965,7 +965,7 @@ err_runtime_get:
return r;
}
-static int omap_rfbihw_remove(struct platform_device *pdev)
+static int __exit omap_rfbihw_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
return 0;
@@ -995,7 +995,7 @@ static const struct dev_pm_ops rfbi_pm_ops = {
};
static struct platform_driver omap_rfbihw_driver = {
- .remove = omap_rfbihw_remove,
+ .remove = __exit_p(omap_rfbihw_remove),
.driver = {
.name = "omapdss_rfbi",
.owner = THIS_MODULE,
@@ -1003,12 +1003,12 @@ static struct platform_driver omap_rfbihw_driver = {
},
};
-int rfbi_init_platform_driver(void)
+__init int rfbi_init_platform_driver(void)
{
return platform_driver_probe(&omap_rfbihw_driver, omap_rfbihw_probe);
}
-void rfbi_uninit_platform_driver(void)
+__exit void rfbi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_rfbihw_driver);
}
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 2cbcc00..df3b431 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -176,30 +176,30 @@ int sdi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-static int omap_sdi_probe(struct platform_device *pdev)
+static int __init omap_sdi_probe(struct platform_device *pdev)
{
return 0;
}
-static int omap_sdi_remove(struct platform_device *pdev)
+static int __exit omap_sdi_remove(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver omap_sdi_driver = {
- .remove = omap_sdi_remove,
+ .remove = __exit_p(omap_sdi_remove),
.driver = {
.name = "omapdss_sdi",
.owner = THIS_MODULE,
},
};
-int sdi_init_platform_driver(void)
+__init int sdi_init_platform_driver(void)
{
return platform_driver_probe(&omap_sdi_driver, omap_sdi_probe);
}
-void sdi_uninit_platform_driver(void)
+__exit void sdi_uninit_platform_driver(void)
{
platform_driver_unregister(&omap_sdi_driver);
}
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index ca0bcdd..cc772a7 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -780,7 +780,7 @@ static void venc_put_clocks(void)
}
/* VENC HW IP initialisation */
-static int omap_venchw_probe(struct platform_device *pdev)
+static int __init omap_venchw_probe(struct platform_device *pdev)
{
u8 rev_id;
struct resource *venc_mem;
@@ -835,7 +835,7 @@ err_runtime_get:
return r;
}
-static int omap_venchw_remove(struct platform_device *pdev)
+static int __exit omap_venchw_remove(struct platform_device *pdev)
{
if (venc.vdda_dac_reg != NULL) {
regulator_put(venc.vdda_dac_reg);
@@ -879,7 +879,7 @@ static const struct dev_pm_ops venc_pm_ops = {
};
static struct platform_driver omap_venchw_driver = {
- .remove = omap_venchw_remove,
+ .remove = __exit_p(omap_venchw_remove),
.driver = {
.name = "omapdss_venc",
.owner = THIS_MODULE,
@@ -887,7 +887,7 @@ static struct platform_driver omap_venchw_driver = {
},
};
-int venc_init_platform_driver(void)
+__init int venc_init_platform_driver(void)
{
if (cpu_is_omap44xx())
return 0;
@@ -895,7 +895,7 @@ int venc_init_platform_driver(void)
return platform_driver_probe(&omap_venchw_driver, omap_venchw_probe);
}
-void venc_uninit_platform_driver(void)
+__exit void venc_uninit_platform_driver(void)
{
if (cpu_is_omap44xx())
return;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 20/21] OMAPFB: add __init & __exit
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (18 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 19/21] OMAPDSS: add __init & __exit Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 21/21] OMAPDSS: change default_device handling Tomi Valkeinen
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
Change omapfb to use platform_driver_probe and add __init & __exit.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/omapfb/omapfb-main.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index b00db40..a0967dc 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2307,7 +2307,7 @@ static int omapfb_init_display(struct omapfb2_device *fbdev,
return 0;
}
-static int omapfb_probe(struct platform_device *pdev)
+static int __init omapfb_probe(struct platform_device *pdev)
{
struct omapfb2_device *fbdev = NULL;
int r = 0;
@@ -2448,7 +2448,7 @@ err0:
return r;
}
-static int omapfb_remove(struct platform_device *pdev)
+static int __exit omapfb_remove(struct platform_device *pdev)
{
struct omapfb2_device *fbdev = platform_get_drvdata(pdev);
@@ -2462,8 +2462,7 @@ static int omapfb_remove(struct platform_device *pdev)
}
static struct platform_driver omapfb_driver = {
- .probe = omapfb_probe,
- .remove = omapfb_remove,
+ .remove = __exit_p(omapfb_remove),
.driver = {
.name = "omapfb",
.owner = THIS_MODULE,
@@ -2474,7 +2473,7 @@ static int __init omapfb_init(void)
{
DBG("omapfb_init\n");
- if (platform_driver_register(&omapfb_driver)) {
+ if (platform_driver_probe(&omapfb_driver, omapfb_probe)) {
printk(KERN_ERR "failed to register omapfb driver\n");
return -ENODEV;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 21/21] OMAPDSS: change default_device handling
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
` (19 preceding siblings ...)
2012-03-07 12:44 ` [PATCH 20/21] OMAPFB: " Tomi Valkeinen
@ 2012-03-07 12:44 ` Tomi Valkeinen
20 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-07 12:44 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: archit, Tomi Valkeinen
We currently have a two ways to set a "default panel device" for dss, to
which the overlays are connected when the omapdss driver is loaded:
- in textual format (name of the display) as cmdline parameter
- as a pointer to the panel device from board file via pdata
The current code handles this in a bit too complex way by using both of
the above methods during runtime. However, with DT we don't have pdata
anymore, so the code handling the second case won't work anymore. The
current code has also the problem that it modifies the platform_data.
This patch simplifies the code a bit by using the pointer method only
inside the probe function, and stores the name of the panel device. This
way we only need to handle the textual format during operation and also
avoid modifying the platform_data.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index aa294d7..dd8f07c 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -43,6 +43,8 @@ static struct {
struct regulator *vdds_dsi_reg;
struct regulator *vdds_sdi_reg;
+
+ const char *default_display_name;
} core;
static char *def_disp_name;
@@ -212,6 +214,11 @@ static int __init omap_dss_probe(struct platform_device *pdev)
if (r)
goto err_debugfs;
+ if (def_disp_name)
+ core.default_display_name = def_disp_name;
+ else if (pdata->default_device)
+ core.default_display_name = pdata->default_device->name;
+
for (i = 0; i < pdata->num_devices; ++i) {
struct omap_dss_device *dssdev = pdata->devices[i];
@@ -225,9 +232,6 @@ static int __init omap_dss_probe(struct platform_device *pdev)
goto err_register;
}
-
- if (def_disp_name && strcmp(def_disp_name, dssdev->name) = 0)
- pdata->default_device = dssdev;
}
return 0;
@@ -350,7 +354,6 @@ static int dss_driver_probe(struct device *dev)
int r;
struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver);
struct omap_dss_device *dssdev = to_dss_device(dev);
- struct omap_dss_board_info *pdata = core.pdev->dev.platform_data;
bool force;
DSSDBG("driver_probe: dev %s/%s, drv %s\n",
@@ -359,7 +362,8 @@ static int dss_driver_probe(struct device *dev)
dss_init_device(core.pdev, dssdev);
- force = pdata->default_device = dssdev;
+ force = core.default_display_name &&
+ strcmp(core.default_display_name, dssdev->name) = 0;
dss_recheck_connections(dssdev, force);
r = dssdrv->probe(dssdev);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling
2012-03-07 12:44 ` [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling Tomi Valkeinen
@ 2012-03-07 17:59 ` Archit Taneja
2012-03-08 7:54 ` Tomi Valkeinen
0 siblings, 1 reply; 34+ messages in thread
From: Archit Taneja @ 2012-03-07 17:59 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
Hi,
On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> The driver for the DVI framer should handle the power-down signal of the
> framer, instead of the current way of handling it in the board files.
What does framer mean?
>
> This patch adds power_down_gpio into the device's platform data, and
> adds the necessary code in the driver to request and handle the GPIO.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> drivers/video/omap2/displays/panel-dvi.c | 31 ++++++++++++++++++++++++++++++
> include/video/omap-panel-dvi.h | 2 +
> 2 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/omap2/displays/panel-dvi.c b/drivers/video/omap2/displays/panel-dvi.c
> index 03eb14a..876b798 100644
> --- a/drivers/video/omap2/displays/panel-dvi.c
> +++ b/drivers/video/omap2/displays/panel-dvi.c
> @@ -21,6 +21,7 @@
> #include<linux/slab.h>
> #include<video/omapdss.h>
> #include<linux/i2c.h>
> +#include<linux/gpio.h>
> #include<drm/drm_edid.h>
>
> #include<video/omap-panel-dvi.h>
> @@ -44,6 +45,8 @@ struct panel_drv_data {
> struct omap_dss_device *dssdev;
>
> struct mutex lock;
> +
> + int pd_gpio;
> };
>
> static inline struct panel_dvi_platform_data
> @@ -54,6 +57,7 @@ static inline struct panel_dvi_platform_data
>
> static int panel_dvi_power_on(struct omap_dss_device *dssdev)
> {
> + struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
> int r;
>
> @@ -70,6 +74,9 @@ static int panel_dvi_power_on(struct omap_dss_device *dssdev)
> goto err1;
> }
>
> + if (gpio_is_valid(ddata->pd_gpio))
> + gpio_set_value(ddata->pd_gpio, 1);
> +
> return 0;
> err1:
> omapdss_dpi_display_disable(dssdev);
> @@ -79,11 +86,15 @@ err0:
>
> static void panel_dvi_power_off(struct omap_dss_device *dssdev)
> {
> + struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
> struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
>
> if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
> return;
>
> + if (gpio_is_valid(ddata->pd_gpio))
> + gpio_set_value(ddata->pd_gpio, 0);
> +
> if (pdata->platform_disable)
> pdata->platform_disable(dssdev);
>
> @@ -92,7 +103,9 @@ static void panel_dvi_power_off(struct omap_dss_device *dssdev)
>
> static int panel_dvi_probe(struct omap_dss_device *dssdev)
> {
> + struct panel_dvi_platform_data *pdata = get_pdata(dssdev);
> struct panel_drv_data *ddata;
> + int r;
>
> ddata = kzalloc(sizeof(*ddata), GFP_KERNEL);
> if (!ddata)
> @@ -104,6 +117,21 @@ static int panel_dvi_probe(struct omap_dss_device *dssdev)
> ddata->dssdev = dssdev;
> mutex_init(&ddata->lock);
>
> + if (pdata)
> + ddata->pd_gpio = pdata->power_down_gpio;
> + else
> + ddata->pd_gpio = -1;
> +
> + if (gpio_is_valid(ddata->pd_gpio)) {
> + r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW,
> + "tfp410 pd");
> + if (r) {
> + dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
> + ddata->pd_gpio);
> + ddata->pd_gpio = -1;
Is the power down gpio not a necessary thing? If it is, we should quit
here itself, shouldn't we?
Archit
> + }
> + }
> +
> dev_set_drvdata(&dssdev->dev, ddata);
>
> return 0;
> @@ -115,6 +143,9 @@ static void __exit panel_dvi_remove(struct omap_dss_device *dssdev)
>
> mutex_lock(&ddata->lock);
>
> + if (gpio_is_valid(ddata->pd_gpio))
> + gpio_free(ddata->pd_gpio);
> +
> dev_set_drvdata(&dssdev->dev, NULL);
>
> mutex_unlock(&ddata->lock);
> diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-dvi.h
> index 87ad567b..4ad41fc 100644
> --- a/include/video/omap-panel-dvi.h
> +++ b/include/video/omap-panel-dvi.h
> @@ -27,11 +27,13 @@ struct omap_dss_device;
> * @platform_enable: platform specific panel enable function
> * @platform_disable: platform specific panel disable function
> * @i2c_bus_num: i2c bus id for the panel
> + * @power_down_gpio: gpio number for PD pin (or -1 if not available)
> */
> struct panel_dvi_platform_data {
> int (*platform_enable)(struct omap_dss_device *dssdev);
> void (*platform_disable)(struct omap_dss_device *dssdev);
> u16 i2c_bus_num;
> + int power_down_gpio;
> };
>
> #endif /* __OMAP_PANEL_DVI_H */
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
2012-03-07 12:44 ` [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess Tomi Valkeinen
@ 2012-03-07 18:23 ` Archit Taneja
2012-03-08 8:02 ` Tomi Valkeinen
0 siblings, 1 reply; 34+ messages in thread
From: Archit Taneja @ 2012-03-07 18:23 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev, archit
On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> The omapdss pdata handling is a mess. This is more evident when trying
> to use device tree for DSS, as we don't have platform data anymore in
> that case. This patch cleans the pdata handling by:
>
> - Remove struct omap_display_platform_data. It was used just as a
> wrapper for struct omap_dss_board_info.
> - Pass the platform data only to omapdss device. The drivers for omap
> dss hwmods do not need the platform data. This should also work better
> for DT, as we can create omapdss device programmatically in generic omap
> boot code, and thus we can pass the pdata to it.
> - Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads
> that the dss hwmod drivers can call.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> arch/arm/mach-omap2/display.c | 37 ++++++++++++++++++-------------------
> drivers/video/omap2/dss/core.c | 35 +++++++++++++++++++++++++++++++++++
> drivers/video/omap2/dss/dispc.c | 21 ++-------------------
> drivers/video/omap2/dss/dsi.c | 17 +++--------------
> drivers/video/omap2/dss/dss.h | 3 +++
> drivers/video/omap2/dss/hdmi.c | 2 --
> include/video/omapdss.h | 5 -----
> 7 files changed, 61 insertions(+), 59 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> index 3677b1f..279c124 100644
> --- a/arch/arm/mach-omap2/display.c
> +++ b/arch/arm/mach-omap2/display.c
> @@ -185,10 +185,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> struct omap_hwmod *oh;
> struct platform_device *pdev;
> int i, oh_count;
> - struct omap_display_platform_data pdata;
> const struct omap_dss_hwmod_data *curr_dss_hwmod;
>
> - memset(&pdata, 0, sizeof(pdata));
> + /* create omapdss device */
> +
> + board_data->dsi_enable_pads = omap_dsi_enable_pads;
> + board_data->dsi_disable_pads = omap_dsi_disable_pads;
> + board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
Why are the checks for board data being NULL removed here?
> +
> + omap_display_device.dev.platform_data = board_data;
> +
> + r = platform_device_register(&omap_display_device);
> + if (r< 0) {
> + pr_err("Unable to register omapdss device\n");
> + return r;
> + }
> +
> + /* create devices for dss hwmods */
>
> if (cpu_is_omap24xx()) {
> curr_dss_hwmod = omap2_dss_hwmod_data;
> @@ -201,15 +214,6 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
> }
>
> - if (board_data->dsi_enable_pads = NULL)
> - board_data->dsi_enable_pads = omap_dsi_enable_pads;
> - if (board_data->dsi_disable_pads = NULL)
> - board_data->dsi_disable_pads = omap_dsi_disable_pads;
> -
> - pdata.board_data = board_data;
> - pdata.board_data->get_context_loss_count > - omap_pm_get_dev_context_loss_count;
> -
> for (i = 0; i< oh_count; i++) {
> oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
> if (!oh) {
> @@ -219,21 +223,16 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> }
>
> pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
> - curr_dss_hwmod[i].id, oh,&pdata,
> - sizeof(struct omap_display_platform_data),
> + curr_dss_hwmod[i].id, oh,
> + NULL, 0,
> NULL, 0, 0);
>
> if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
> curr_dss_hwmod[i].oh_name))
> return -ENODEV;
> }
> - omap_display_device.dev.platform_data = board_data;
>
> - r = platform_device_register(&omap_display_device);
> - if (r< 0)
> - printk(KERN_ERR "Unable to register OMAP-Display device\n");
> -
> - return r;
> + return 0;
> }
>
> static void dispc_disable_outputs(void)
> diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
> index 8613f86..3efd473 100644
> --- a/drivers/video/omap2/dss/core.c
> +++ b/drivers/video/omap2/dss/core.c
> @@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
> return reg;
> }
>
> +int dss_get_ctx_loss_count(struct device *dev)
> +{
> + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
> + int cnt;
> +
> + if (!board_data || !board_data->get_context_loss_count)
> + return -ENOENT;
why do we check board_data being NULL here and not in omap_display_init()?
Archit
> +
> + cnt = board_data->get_context_loss_count(dev);
> +
> + WARN_ONCE(cnt< 0, "get_context_loss_count failed: %d\n", cnt);
> +
> + return cnt;
> +}
> +
> +int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask)
> +{
> + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
> +
> + if (!board_data || !board_data->dsi_enable_pads)
> + return -ENOENT;
> +
> + return board_data->dsi_enable_pads(dsi_id, lane_mask);
> +}
> +
> +void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask)
> +{
> + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
> +
> + if (!board_data || !board_data->dsi_enable_pads)
> + return;
> +
> + return board_data->dsi_disable_pads(dsi_id, lane_mask);
> +}
> +
> #if defined(CONFIG_DEBUG_FS)&& defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
> static int dss_debug_show(struct seq_file *s, void *unused)
> {
> diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
> index bddd64b..703bb20 100644
> --- a/drivers/video/omap2/dss/dispc.c
> +++ b/drivers/video/omap2/dss/dispc.c
> @@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx)
> return __raw_readl(dispc.base + idx);
> }
>
> -static int dispc_get_ctx_loss_count(void)
> -{
> - struct device *dev =&dispc.pdev->dev;
> - struct omap_display_platform_data *pdata = dev->platform_data;
> - struct omap_dss_board_info *board_data = pdata->board_data;
> - int cnt;
> -
> - if (!board_data->get_context_loss_count)
> - return -ENOENT;
> -
> - cnt = board_data->get_context_loss_count(dev);
> -
> - WARN_ONCE(cnt< 0, "get_context_loss_count failed: %d\n", cnt);
> -
> - return cnt;
> -}
> -
> #define SR(reg) \
> dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg)
> #define RR(reg) \
> @@ -251,7 +234,7 @@ static void dispc_save_context(void)
> if (dss_has_feature(FEAT_CORE_CLK_DIV))
> SR(DIVISOR);
>
> - dispc.ctx_loss_cnt = dispc_get_ctx_loss_count();
> + dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev);
> dispc.ctx_valid = true;
>
> DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt);
> @@ -266,7 +249,7 @@ static void dispc_restore_context(void)
> if (!dispc.ctx_valid)
> return;
>
> - ctx = dispc_get_ctx_loss_count();
> + ctx = dss_get_ctx_loss_count(&dispc.pdev->dev);
>
> if (ctx>= 0&& ctx = dispc.ctx_loss_cnt)
> return;
> diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
> index 3e656be..4e2f7ff 100644
> --- a/drivers/video/omap2/dss/dsi.c
> +++ b/drivers/video/omap2/dss/dsi.c
> @@ -261,9 +261,6 @@ struct dsi_data {
> struct clk *dss_clk;
> struct clk *sys_clk;
>
> - int (*enable_pads)(int dsi_id, unsigned lane_mask);
> - void (*disable_pads)(int dsi_id, unsigned lane_mask);
> -
> struct dsi_clock_info current_cinfo;
>
> bool vdds_dsi_enabled;
> @@ -2396,7 +2393,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)
>
> DSSDBGF();
>
> - r = dsi->enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> + r = dss_dsi_enable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> if (r)
> return r;
>
> @@ -2506,21 +2503,20 @@ err_cio_pwr:
> dsi_cio_disable_lane_override(dsidev);
> err_scp_clk_dom:
> dsi_disable_scp_clk(dsidev);
> - dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> + dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> return r;
> }
>
> static void dsi_cio_uninit(struct omap_dss_device *dssdev)
> {
> struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
> - struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
>
> /* DDR_CLK_ALWAYS_ON */
> REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13);
>
> dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF);
> dsi_disable_scp_clk(dsidev);
> - dsi->disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> + dss_dsi_disable_pads(dsi_get_dsidev_id(dsidev), dsi_get_lane_mask(dssdev));
> }
>
> static void dsi_config_tx_fifo(struct platform_device *dsidev,
> @@ -4680,8 +4676,6 @@ static void dsi_put_clocks(struct platform_device *dsidev)
> /* DSI1 HW IP initialisation */
> static int omap_dsihw_probe(struct platform_device *dsidev)
> {
> - struct omap_display_platform_data *dss_plat_data;
> - struct omap_dss_board_info *board_info;
> u32 rev;
> int r, i, dsi_module = dsi_get_dsidev_id(dsidev);
> struct resource *dsi_mem;
> @@ -4695,11 +4689,6 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
> dsi_pdev_map[dsi_module] = dsidev;
> dev_set_drvdata(&dsidev->dev, dsi);
>
> - dss_plat_data = dsidev->dev.platform_data;
> - board_info = dss_plat_data->board_data;
> - dsi->enable_pads = board_info->dsi_enable_pads;
> - dsi->disable_pads = board_info->dsi_disable_pads;
> -
> spin_lock_init(&dsi->irq_lock);
> spin_lock_init(&dsi->errors_lock);
> dsi->errors = 0;
> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
> index d4b3dff..d37ed80 100644
> --- a/drivers/video/omap2/dss/dss.h
> +++ b/drivers/video/omap2/dss/dss.h
> @@ -162,6 +162,9 @@ struct platform_device;
> struct bus_type *dss_get_bus(void);
> struct regulator *dss_get_vdds_dsi(void);
> struct regulator *dss_get_vdds_sdi(void);
> +int dss_get_ctx_loss_count(struct device *dev);
> +int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
> +void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
>
> /* apply */
> void dss_apply_init(void);
> diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
> index c4b4f69..cacf856 100644
> --- a/drivers/video/omap2/dss/hdmi.c
> +++ b/drivers/video/omap2/dss/hdmi.c
> @@ -63,7 +63,6 @@
>
> static struct {
> struct mutex lock;
> - struct omap_display_platform_data *pdata;
> struct platform_device *pdev;
> struct hdmi_ip_data ip_data;
>
> @@ -796,7 +795,6 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
> struct resource *hdmi_mem;
> int r;
>
> - hdmi.pdata = pdev->dev.platform_data;
> hdmi.pdev = pdev;
>
> mutex_init(&hdmi.lock);
> diff --git a/include/video/omapdss.h b/include/video/omapdss.h
> index 483f67c..b499ccb 100644
> --- a/include/video/omapdss.h
> +++ b/include/video/omapdss.h
> @@ -316,11 +316,6 @@ extern int omap_display_init(struct omap_dss_board_info *board_data);
> /* HDMI mux init*/
> extern int omap_hdmi_init(enum omap_hdmi_flags flags);
>
> -struct omap_display_platform_data {
> - struct omap_dss_board_info *board_data;
> - /* TODO: Additional members to be added when PM is considered */
> -};
> -
> struct omap_video_timings {
> /* Unit: pixels */
> u16 x_res;
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling
2012-03-07 17:59 ` Archit Taneja
@ 2012-03-08 7:54 ` Tomi Valkeinen
0 siblings, 0 replies; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-08 7:54 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]
On Wed, 2012-03-07 at 23:17 +0530, Archit Taneja wrote:
> Hi,
>
> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> > The driver for the DVI framer should handle the power-down signal of the
> > framer, instead of the current way of handling it in the board files.
>
> What does framer mean?
I don't know where the word has come, and I can't find it in the TFP410
documentation. I guess the idea with the word was that the chip
"frames", i.e. packetizes, the incoming parallel data to DVI.
But I think it's better to remove the use of the word to avoid any
confusion. I'll make the change.
> > + if (gpio_is_valid(ddata->pd_gpio)) {
> > + r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW,
> > + "tfp410 pd");
> > + if (r) {
> > + dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
> > + ddata->pd_gpio);
> > + ddata->pd_gpio = -1;
>
> Is the power down gpio not a necessary thing? If it is, we should quit
> here itself, shouldn't we?
Hmm, yes, I think you are right.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
2012-03-07 18:23 ` Archit Taneja
@ 2012-03-08 8:02 ` Tomi Valkeinen
2012-03-08 8:29 ` Archit Taneja
0 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-08 8:02 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev, archit
[-- Attachment #1: Type: text/plain, Size: 3802 bytes --]
On Wed, 2012-03-07 at 23:41 +0530, Archit Taneja wrote:
> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> > The omapdss pdata handling is a mess. This is more evident when trying
> > to use device tree for DSS, as we don't have platform data anymore in
> > that case. This patch cleans the pdata handling by:
> >
> > - Remove struct omap_display_platform_data. It was used just as a
> > wrapper for struct omap_dss_board_info.
> > - Pass the platform data only to omapdss device. The drivers for omap
> > dss hwmods do not need the platform data. This should also work better
> > for DT, as we can create omapdss device programmatically in generic omap
> > boot code, and thus we can pass the pdata to it.
> > - Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads
> > that the dss hwmod drivers can call.
> >
> > Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> > ---
> > arch/arm/mach-omap2/display.c | 37 ++++++++++++++++++-------------------
> > drivers/video/omap2/dss/core.c | 35 +++++++++++++++++++++++++++++++++++
> > drivers/video/omap2/dss/dispc.c | 21 ++-------------------
> > drivers/video/omap2/dss/dsi.c | 17 +++--------------
> > drivers/video/omap2/dss/dss.h | 3 +++
> > drivers/video/omap2/dss/hdmi.c | 2 --
> > include/video/omapdss.h | 5 -----
> > 7 files changed, 61 insertions(+), 59 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> > index 3677b1f..279c124 100644
> > --- a/arch/arm/mach-omap2/display.c
> > +++ b/arch/arm/mach-omap2/display.c
> > @@ -185,10 +185,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> > struct omap_hwmod *oh;
> > struct platform_device *pdev;
> > int i, oh_count;
> > - struct omap_display_platform_data pdata;
> > const struct omap_dss_hwmod_data *curr_dss_hwmod;
> >
> > - memset(&pdata, 0, sizeof(pdata));
> > + /* create omapdss device */
> > +
> > + board_data->dsi_enable_pads = omap_dsi_enable_pads;
> > + board_data->dsi_disable_pads = omap_dsi_disable_pads;
> > + board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
>
> Why are the checks for board data being NULL removed here?
We didn't check if board_data is NULL in the earlier version either. And
I don't think there's need to check that, because if the board file
calls this function, it should also give the board data.
However, the earlier version didn't set the func pointers if the func
pointer in the board_data was != NULL. Did you mean that? I removed that
check, as I don't see a need for it. The func pointers should be set by
this function, and I don't see why the board file would need to use its
own versions.
> > diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
> > index 8613f86..3efd473 100644
> > --- a/drivers/video/omap2/dss/core.c
> > +++ b/drivers/video/omap2/dss/core.c
> > @@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
> > return reg;
> > }
> >
> > +int dss_get_ctx_loss_count(struct device *dev)
> > +{
> > + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
> > + int cnt;
> > +
> > + if (!board_data || !board_data->get_context_loss_count)
> > + return -ENOENT;
>
> why do we check board_data being NULL here and not in omap_display_init()?
I added it for DT case, because then we don't have board_data for the
devices defined in the DT data. However, for now we always have the
board_data, and in this patch I should just move the code. So I'll
remove the check, and add it later with DT code if needed.
(and actually, I don' think the check is needed in DT case either...)
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
2012-03-08 8:02 ` Tomi Valkeinen
@ 2012-03-08 8:29 ` Archit Taneja
2012-03-08 8:33 ` Tomi Valkeinen
0 siblings, 1 reply; 34+ messages in thread
From: Archit Taneja @ 2012-03-08 8:29 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
On Thursday 08 March 2012 01:32 PM, Tomi Valkeinen wrote:
> On Wed, 2012-03-07 at 23:41 +0530, Archit Taneja wrote:
>> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
>>> The omapdss pdata handling is a mess. This is more evident when trying
>>> to use device tree for DSS, as we don't have platform data anymore in
>>> that case. This patch cleans the pdata handling by:
>>>
>>> - Remove struct omap_display_platform_data. It was used just as a
>>> wrapper for struct omap_dss_board_info.
>>> - Pass the platform data only to omapdss device. The drivers for omap
>>> dss hwmods do not need the platform data. This should also work better
>>> for DT, as we can create omapdss device programmatically in generic omap
>>> boot code, and thus we can pass the pdata to it.
>>> - Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads
>>> that the dss hwmod drivers can call.
>>>
>>> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
>>> ---
>>> arch/arm/mach-omap2/display.c | 37 ++++++++++++++++++-------------------
>>> drivers/video/omap2/dss/core.c | 35 +++++++++++++++++++++++++++++++++++
>>> drivers/video/omap2/dss/dispc.c | 21 ++-------------------
>>> drivers/video/omap2/dss/dsi.c | 17 +++--------------
>>> drivers/video/omap2/dss/dss.h | 3 +++
>>> drivers/video/omap2/dss/hdmi.c | 2 --
>>> include/video/omapdss.h | 5 -----
>>> 7 files changed, 61 insertions(+), 59 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
>>> index 3677b1f..279c124 100644
>>> --- a/arch/arm/mach-omap2/display.c
>>> +++ b/arch/arm/mach-omap2/display.c
>>> @@ -185,10 +185,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
>>> struct omap_hwmod *oh;
>>> struct platform_device *pdev;
>>> int i, oh_count;
>>> - struct omap_display_platform_data pdata;
>>> const struct omap_dss_hwmod_data *curr_dss_hwmod;
>>>
>>> - memset(&pdata, 0, sizeof(pdata));
>>> + /* create omapdss device */
>>> +
>>> + board_data->dsi_enable_pads = omap_dsi_enable_pads;
>>> + board_data->dsi_disable_pads = omap_dsi_disable_pads;
>>> + board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
>>
>> Why are the checks for board data being NULL removed here?
>
> We didn't check if board_data is NULL in the earlier version either. And
> I don't think there's need to check that, because if the board file
> calls this function, it should also give the board data.
>
> However, the earlier version didn't set the func pointers if the func
> pointer in the board_data was != NULL. Did you mean that? I removed that
> check, as I don't see a need for it. The func pointers should be set by
> this function, and I don't see why the board file would need to use its
> own versions.
Yes, I had meant the function pointers being != NULL, yes it doesn't
make sense for the board file to populate these.
>
>>> diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
>>> index 8613f86..3efd473 100644
>>> --- a/drivers/video/omap2/dss/core.c
>>> +++ b/drivers/video/omap2/dss/core.c
>>> @@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
>>> return reg;
>>> }
>>>
>>> +int dss_get_ctx_loss_count(struct device *dev)
>>> +{
>>> + struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
>>> + int cnt;
>>> +
>>> + if (!board_data || !board_data->get_context_loss_count)
>>> + return -ENOENT;
>>
>> why do we check board_data being NULL here and not in omap_display_init()?
>
> I added it for DT case, because then we don't have board_data for the
> devices defined in the DT data. However, for now we always have the
> board_data, and in this patch I should just move the code. So I'll
> remove the check, and add it later with DT code if needed.
Ok. When DT will be in use, would omap_display_init() be called or not?
>
> (and actually, I don' think the check is needed in DT case either...)
I don't know how things would work in DT case. So I'm not sure what's
happening here.
Archit
>
> Tomi
>
>
>
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
2012-03-08 8:29 ` Archit Taneja
@ 2012-03-08 8:33 ` Tomi Valkeinen
2012-03-08 8:55 ` Archit Taneja
0 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-08 8:33 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]
On Thu, 2012-03-08 at 13:47 +0530, Archit Taneja wrote:
> On Thursday 08 March 2012 01:32 PM, Tomi Valkeinen wrote:
> >> why do we check board_data being NULL here and not in omap_display_init()?
> >
> > I added it for DT case, because then we don't have board_data for the
> > devices defined in the DT data. However, for now we always have the
> > board_data, and in this patch I should just move the code. So I'll
> > remove the check, and add it later with DT code if needed.
>
> Ok. When DT will be in use, would omap_display_init() be called or not?
No. Currently the board files create and fill the board_data, and then
call omap_display_init.
With DT, the DT data will contain all the dynamic, per-board
information. Something like:
dss {
dpi {
dvi {
pd-gpio = <10>;
...
};
};
dsi@1 {
taal {
reset-gpio = <20>;
...
};
}
...
};
The DT data will be passed individually to each dss driver (i.e. dsi
driver will get its DT node, etc.). The drivers will read the data, and
initialize themselves with that, more or less the same manner they'd do
with the board_data from board files.
However, we currently have this "omapdss" device, which is not a hwmod
device at all. In the long run I think the omapdss device should be
removed, but for now we need it. And device has to be created in the
arch code, the same way it's now created in omap_display_init().
So with DT we need a new func, omap_display_init_dt() or such, which
creates the omapdss device, and also creates a board_data which contains
the ctx_loss etc function pointers. But the board data won't have any
display data, those come directly from DT data.
It's a bit messy solution, but it should allow us to have both DT and
non-DT working at the same time, with quite minimal changes to the board
files.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
2012-03-08 8:46 ` Archit Taneja
@ 2012-03-08 8:46 ` Tomi Valkeinen
2012-03-08 9:34 ` Archit Taneja
0 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-08 8:46 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 2330 bytes --]
On Thu, 2012-03-08 at 14:04 +0530, Archit Taneja wrote:
> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> > - r = hdmi_init_platform_driver();
> > - if (r) {
> > - DSSERR("Failed to initialize hdmi\n");
> > - goto err_hdmi;
> > + /*
> > + * It's ok if the output-driver register fails. It happens, for example,
> > + * when there is no output-device (e.g. SDI for OMAP4).
> > + */
>
> Suppose we do a omap2plus_defconfig, CONFIG_OMAP2_DSS_SDI would be
> selected, and sdi.c would be built, if we boot on OMAP4, why would a sdi
> driver register cause a failure? Wouldn't the sdi driver just get
> registered, and wait till eternity for the corresponding sdi platform
> device to get registered?
No. Well, yes.
Currently we use platform_driver_register() to register the drivers, and
it does just what you described. But a few patches later I change
platform_driver_register() to platform_driver_probe(), which will return
ENODEV if there are no matching devices for the driver.
I originally had the platform_driver_probe() patch before this patch,
and thus the comment above made sense. Now the patch is after this
patch, so the comment is not exactly right until the probe patch is also
applied.
The point with platform_driver_probe() is that it can be used with
non-removable devices which are created at boot time, like the DSS
components. With platform_driver_probe() the probe function is called
only at that one time, and never afterwards. So probe can be in __init
section, and thrown away after init.
One side effect of using platform_driver_probe() is that it returns
ENODEV is there are no devices. In a simple module, the error can be
then returned from module_init, thus causing the whole module to be
unloaded. Our case is a bit more complex as we have multiple drivers in
the same module.
A downside with that is that we don't really know if the ENODEV error
happened because there were no devices (which is ok), or if it came from
probe function (which is not so ok). However, I thought that it doesn't
matter if an output driver has failed. We can still continue with the
other output drivers just fine.
Actually, there is a small problem. If, for example, DSI driver fails to
load, and DPI driver tries to use DSI PLL...
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
2012-03-07 12:44 ` [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically Tomi Valkeinen
@ 2012-03-08 8:46 ` Archit Taneja
2012-03-08 8:46 ` Tomi Valkeinen
0 siblings, 1 reply; 34+ messages in thread
From: Archit Taneja @ 2012-03-08 8:46 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> Initialize and uninitialize the output drivers by using arrays of
> pointers to the init/uninit functions. This simplifies the code
> slightly.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> drivers/video/omap2/dss/core.c | 111 +++++++++++++++++++++-------------------
> drivers/video/omap2/dss/dss.h | 41 ---------------
> 2 files changed, 59 insertions(+), 93 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
> index 654962a..ac4f2cb 100644
> --- a/drivers/video/omap2/dss/core.c
> +++ b/drivers/video/omap2/dss/core.c
> @@ -503,10 +503,54 @@ static int omap_dss_bus_register(void)
> }
>
> /* INIT */
> +static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
> +#ifdef CONFIG_OMAP2_DSS_DPI
> + dpi_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_SDI
> + sdi_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_RFBI
> + rfbi_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_VENC
> + venc_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_DSI
> + dsi_init_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP4_DSS_HDMI
> + hdmi_init_platform_driver,
> +#endif
> +};
> +
> +static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = {
> +#ifdef CONFIG_OMAP2_DSS_DPI
> + dpi_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_SDI
> + sdi_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_RFBI
> + rfbi_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_VENC
> + venc_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP2_DSS_DSI
> + dsi_uninit_platform_driver,
> +#endif
> +#ifdef CONFIG_OMAP4_DSS_HDMI
> + hdmi_uninit_platform_driver,
> +#endif
> +};
> +
> +static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)];
>
> static int __init omap_dss_register_drivers(void)
> {
> int r;
> + int i;
>
> r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
> if (r)
> @@ -524,56 +568,18 @@ static int __init omap_dss_register_drivers(void)
> goto err_dispc;
> }
>
> - r = dpi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize dpi platform driver\n");
> - goto err_dpi;
> - }
> -
> - r = sdi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize sdi platform driver\n");
> - goto err_sdi;
> - }
> -
> - r = rfbi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize rfbi platform driver\n");
> - goto err_rfbi;
> - }
> -
> - r = venc_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize venc platform driver\n");
> - goto err_venc;
> - }
> -
> - r = dsi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize DSI platform driver\n");
> - goto err_dsi;
> - }
> -
> - r = hdmi_init_platform_driver();
> - if (r) {
> - DSSERR("Failed to initialize hdmi\n");
> - goto err_hdmi;
> + /*
> + * It's ok if the output-driver register fails. It happens, for example,
> + * when there is no output-device (e.g. SDI for OMAP4).
> + */
Suppose we do a omap2plus_defconfig, CONFIG_OMAP2_DSS_SDI would be
selected, and sdi.c would be built, if we boot on OMAP4, why would a sdi
driver register cause a failure? Wouldn't the sdi driver just get
registered, and wait till eternity for the corresponding sdi platform
device to get registered?
Archit
> + for (i = 0; i< ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) {
> + r = dss_output_drv_reg_funcs[i]();
> + if (r = 0)
> + dss_output_drv_loaded[i] = true;
> }
>
> return 0;
>
> -err_hdmi:
> - dsi_uninit_platform_driver();
> -err_dsi:
> - venc_uninit_platform_driver();
> -err_venc:
> - rfbi_uninit_platform_driver();
> -err_rfbi:
> - sdi_uninit_platform_driver();
> -err_sdi:
> - dpi_uninit_platform_driver();
> -err_dpi:
> - dispc_uninit_platform_driver();
> err_dispc:
> dss_uninit_platform_driver();
> err_dss:
> @@ -584,12 +590,13 @@ err_dss:
>
> static void __exit omap_dss_unregister_drivers(void)
> {
> - hdmi_uninit_platform_driver();
> - dsi_uninit_platform_driver();
> - venc_uninit_platform_driver();
> - rfbi_uninit_platform_driver();
> - sdi_uninit_platform_driver();
> - dpi_uninit_platform_driver();
> + int i;
> +
> + for (i = 0; i< ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) {
> + if (dss_output_drv_loaded[i])
> + dss_output_drv_unreg_funcs[i]();
> + }
> +
> dispc_uninit_platform_driver();
> dss_uninit_platform_driver();
>
> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
> index 24aadde..af7bed1 100644
> --- a/drivers/video/omap2/dss/dss.h
> +++ b/drivers/video/omap2/dss/dss.h
> @@ -265,14 +265,9 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
> struct dispc_clock_info *dispc_cinfo);
>
> /* SDI */
> -#ifdef CONFIG_OMAP2_DSS_SDI
> int sdi_init_platform_driver(void);
> void sdi_uninit_platform_driver(void);
> int sdi_init_display(struct omap_dss_device *display);
> -#else
> -static inline int sdi_init_platform_driver(void) { return 0; }
> -static inline void sdi_uninit_platform_driver(void) { }
> -#endif
>
> /* DSI */
> #ifdef CONFIG_OMAP2_DSS_DSI
> @@ -309,13 +304,6 @@ void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev);
> void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev);
> struct platform_device *dsi_get_dsidev_from_id(int module);
> #else
> -static inline int dsi_init_platform_driver(void)
> -{
> - return 0;
> -}
> -static inline void dsi_uninit_platform_driver(void)
> -{
> -}
> static inline int dsi_runtime_get(struct platform_device *dsidev)
> {
> return 0;
> @@ -372,14 +360,9 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module)
> #endif
>
> /* DPI */
> -#ifdef CONFIG_OMAP2_DSS_DPI
> int dpi_init_platform_driver(void);
> void dpi_uninit_platform_driver(void);
> int dpi_init_display(struct omap_dss_device *dssdev);
> -#else
> -static inline int dpi_init_platform_driver(void) { return 0; }
> -static inline void dpi_uninit_platform_driver(void) { }
> -#endif
>
> /* DISPC */
> int dispc_init_platform_driver(void);
> @@ -456,13 +439,6 @@ void venc_dump_regs(struct seq_file *s);
> int venc_init_display(struct omap_dss_device *display);
> unsigned long venc_get_pixel_clock(void);
> #else
> -static inline int venc_init_platform_driver(void)
> -{
> - return 0;
> -}
> -static inline void venc_uninit_platform_driver(void)
> -{
> -}
> static inline unsigned long venc_get_pixel_clock(void)
> {
> WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__);
> @@ -482,13 +458,6 @@ static inline int hdmi_init_display(struct omap_dss_device *dssdev)
> {
> return 0;
> }
> -static inline int hdmi_init_platform_driver(void)
> -{
> - return 0;
> -}
> -static inline void hdmi_uninit_platform_driver(void)
> -{
> -}
> static inline unsigned long hdmi_get_pixel_clock(void)
> {
> WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__);
> @@ -506,20 +475,10 @@ int hdmi_panel_init(void);
> void hdmi_panel_exit(void);
>
> /* RFBI */
> -#ifdef CONFIG_OMAP2_DSS_RFBI
> int rfbi_init_platform_driver(void);
> void rfbi_uninit_platform_driver(void);
> void rfbi_dump_regs(struct seq_file *s);
> int rfbi_init_display(struct omap_dss_device *display);
> -#else
> -static inline int rfbi_init_platform_driver(void)
> -{
> - return 0;
> -}
> -static inline void rfbi_uninit_platform_driver(void)
> -{
> -}
> -#endif
>
>
> #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess
2012-03-08 8:33 ` Tomi Valkeinen
@ 2012-03-08 8:55 ` Archit Taneja
0 siblings, 0 replies; 34+ messages in thread
From: Archit Taneja @ 2012-03-08 8:55 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
On Thursday 08 March 2012 02:03 PM, Tomi Valkeinen wrote:
> On Thu, 2012-03-08 at 13:47 +0530, Archit Taneja wrote:
>> On Thursday 08 March 2012 01:32 PM, Tomi Valkeinen wrote:
>
>>>> why do we check board_data being NULL here and not in omap_display_init()?
>>>
>>> I added it for DT case, because then we don't have board_data for the
>>> devices defined in the DT data. However, for now we always have the
>>> board_data, and in this patch I should just move the code. So I'll
>>> remove the check, and add it later with DT code if needed.
>>
>> Ok. When DT will be in use, would omap_display_init() be called or not?
>
> No. Currently the board files create and fill the board_data, and then
> call omap_display_init.
>
> With DT, the DT data will contain all the dynamic, per-board
> information. Something like:
>
> dss {
> dpi {
> dvi {
> pd-gpio =<10>;
> ...
> };
> };
>
> dsi@1 {
> taal {
> reset-gpio =<20>;
> ...
> };
> }
>
> ...
> };
>
> The DT data will be passed individually to each dss driver (i.e. dsi
> driver will get its DT node, etc.). The drivers will read the data, and
> initialize themselves with that, more or less the same manner they'd do
> with the board_data from board files.
>
> However, we currently have this "omapdss" device, which is not a hwmod
> device at all. In the long run I think the omapdss device should be
> removed, but for now we need it. And device has to be created in the
> arch code, the same way it's now created in omap_display_init().
>
> So with DT we need a new func, omap_display_init_dt() or such, which
> creates the omapdss device, and also creates a board_data which contains
> the ctx_loss etc function pointers. But the board data won't have any
> display data, those come directly from DT data.
>
> It's a bit messy solution, but it should allow us to have both DT and
> non-DT working at the same time, with quite minimal changes to the board
> files.
Okay, thanks for the clarification.
Archit
>
> Tomi
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
2012-03-08 8:46 ` Tomi Valkeinen
@ 2012-03-08 9:34 ` Archit Taneja
2012-03-08 9:34 ` Tomi Valkeinen
0 siblings, 1 reply; 34+ messages in thread
From: Archit Taneja @ 2012-03-08 9:34 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
On Thursday 08 March 2012 02:16 PM, Tomi Valkeinen wrote:
> On Thu, 2012-03-08 at 14:04 +0530, Archit Taneja wrote:
>> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
>
>>> - r = hdmi_init_platform_driver();
>>> - if (r) {
>>> - DSSERR("Failed to initialize hdmi\n");
>>> - goto err_hdmi;
>>> + /*
>>> + * It's ok if the output-driver register fails. It happens, for example,
>>> + * when there is no output-device (e.g. SDI for OMAP4).
>>> + */
>>
>> Suppose we do a omap2plus_defconfig, CONFIG_OMAP2_DSS_SDI would be
>> selected, and sdi.c would be built, if we boot on OMAP4, why would a sdi
>> driver register cause a failure? Wouldn't the sdi driver just get
>> registered, and wait till eternity for the corresponding sdi platform
>> device to get registered?
>
> No. Well, yes.
>
> Currently we use platform_driver_register() to register the drivers, and
> it does just what you described. But a few patches later I change
> platform_driver_register() to platform_driver_probe(), which will return
> ENODEV if there are no matching devices for the driver.
>
> I originally had the platform_driver_probe() patch before this patch,
> and thus the comment above made sense. Now the patch is after this
> patch, so the comment is not exactly right until the probe patch is also
> applied.
Oh okay. But the comment after the patch set still says "It's ok if the
output-driver register fails.", we could change it to "It's ok if the
output-driver probe fails."
>
> The point with platform_driver_probe() is that it can be used with
> non-removable devices which are created at boot time, like the DSS
> components. With platform_driver_probe() the probe function is called
> only at that one time, and never afterwards. So probe can be in __init
> section, and thrown away after init.
So platform_driver_probe() is like a driver_register() + probe().
Okay, in our case, all the devices are created at boot time, and if
omapdss were a module, the probes would have been thrown away after
module_init(), right?
>
> One side effect of using platform_driver_probe() is that it returns
> ENODEV is there are no devices. In a simple module, the error can be
> then returned from module_init, thus causing the whole module to be
> unloaded. Our case is a bit more complex as we have multiple drivers in
> the same module.
>
> A downside with that is that we don't really know if the ENODEV error
> happened because there were no devices (which is ok), or if it came from
> probe function (which is not so ok). However, I thought that it doesn't
> matter if an output driver has failed. We can still continue with the
> other output drivers just fine.
If we ensure that none of our probes return ENODEV(even though it may
make sense to return it if a func within probe fails), we could
differentiate between the 2 cases, right?
>
> Actually, there is a small problem. If, for example, DSI driver fails to
> load, and DPI driver tries to use DSI PLL...
If we could differentiate between an error occuring because the device
doesn't exist and an error occuring because the probe failed, we could
bail out if any of the probes fail, right?
Archit
>
> Tomi
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
2012-03-08 9:34 ` Archit Taneja
@ 2012-03-08 9:34 ` Tomi Valkeinen
2012-03-08 9:51 ` Archit Taneja
0 siblings, 1 reply; 34+ messages in thread
From: Tomi Valkeinen @ 2012-03-08 9:34 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 5275 bytes --]
On Thu, 2012-03-08 at 14:52 +0530, Archit Taneja wrote:
> On Thursday 08 March 2012 02:16 PM, Tomi Valkeinen wrote:
> > On Thu, 2012-03-08 at 14:04 +0530, Archit Taneja wrote:
> >> On Wednesday 07 March 2012 06:14 PM, Tomi Valkeinen wrote:
> >
> >>> - r = hdmi_init_platform_driver();
> >>> - if (r) {
> >>> - DSSERR("Failed to initialize hdmi\n");
> >>> - goto err_hdmi;
> >>> + /*
> >>> + * It's ok if the output-driver register fails. It happens, for example,
> >>> + * when there is no output-device (e.g. SDI for OMAP4).
> >>> + */
> >>
> >> Suppose we do a omap2plus_defconfig, CONFIG_OMAP2_DSS_SDI would be
> >> selected, and sdi.c would be built, if we boot on OMAP4, why would a sdi
> >> driver register cause a failure? Wouldn't the sdi driver just get
> >> registered, and wait till eternity for the corresponding sdi platform
> >> device to get registered?
> >
> > No. Well, yes.
> >
> > Currently we use platform_driver_register() to register the drivers, and
> > it does just what you described. But a few patches later I change
> > platform_driver_register() to platform_driver_probe(), which will return
> > ENODEV if there are no matching devices for the driver.
> >
> > I originally had the platform_driver_probe() patch before this patch,
> > and thus the comment above made sense. Now the patch is after this
> > patch, so the comment is not exactly right until the probe patch is also
> > applied.
>
> Oh okay. But the comment after the patch set still says "It's ok if the
> output-driver register fails.", we could change it to "It's ok if the
> output-driver probe fails."
Well, I guess this goes into nitpicking area, but if there are no
devices, probe is not called at all. So I think it's the driver register
that fails in that case. If there is a device, and it is probed, and
that fails, then it's probe which fails.
> > The point with platform_driver_probe() is that it can be used with
> > non-removable devices which are created at boot time, like the DSS
> > components. With platform_driver_probe() the probe function is called
> > only at that one time, and never afterwards. So probe can be in __init
> > section, and thrown away after init.
>
> So platform_driver_probe() is like a driver_register() + probe().
Yes. Well, when platform_driver_register() is called, and the devices
are already present, it will call the probe also. So in that sense they
are similar. The difference is that for platform_driver_register() the
probe pointer must be in the driver struct, and it stays there even
after init. For platform_driver_probe(), the probe pointer is given as
an argument to the function, and thus it's not stored anywhere and can
be thrown away afterwards.
> Okay, in our case, all the devices are created at boot time, and if
> omapdss were a module, the probes would have been thrown away after
> module_init(), right?
Yes. If omapdss is a module, the functions marked with __init are
discarded after the module_init is done. If omapdss is built-in, the
__init funcs are thrown away after the kernel's init done.
> > One side effect of using platform_driver_probe() is that it returns
> > ENODEV is there are no devices. In a simple module, the error can be
> > then returned from module_init, thus causing the whole module to be
> > unloaded. Our case is a bit more complex as we have multiple drivers in
> > the same module.
> >
> > A downside with that is that we don't really know if the ENODEV error
> > happened because there were no devices (which is ok), or if it came from
> > probe function (which is not so ok). However, I thought that it doesn't
> > matter if an output driver has failed. We can still continue with the
> > other output drivers just fine.
>
> If we ensure that none of our probes return ENODEV(even though it may
> make sense to return it if a func within probe fails), we could
> differentiate between the 2 cases, right?
True, I thought about that. But we can never be sure that the functions
called by the probe (clk_get, or whatever) won't return ENODEV. Of
course, we could check what they return, and change the error to
something else, but I'm not sure if that's good either.
> >
> > Actually, there is a small problem. If, for example, DSI driver fails to
> > load, and DPI driver tries to use DSI PLL...
>
> If we could differentiate between an error occuring because the device
> doesn't exist and an error occuring because the probe failed, we could
> bail out if any of the probes fail, right?
Yes, but it feels a bit hackish to try to use the error as I pointed out
above. So I'd rather go the other way: the drivers should somehow
register the stuff they offer, so for example when the DSI1 is probed,
it should register the DSI1 PLL to dss core. And DPI would have to ask
for the DSI1 PLL from dss core.
That, of course, is not a trivial change, so for the moment this stuff
is slightly broken in error cases. Perhaps we could figure out some kind
of clean hack for that...
Alternatively, if the platform driver code was changed to tell us
clearly if it was the probe that failed or if there just weren't any
devices, we could also use that.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically
2012-03-08 9:34 ` Tomi Valkeinen
@ 2012-03-08 9:51 ` Archit Taneja
0 siblings, 0 replies; 34+ messages in thread
From: Archit Taneja @ 2012-03-08 9:51 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
On Thursday 08 March 2012 03:04 PM, Tomi Valkeinen wrote:
> On Thu, 2012-03-08 at 14:52 +0530, Archit Taneja wrote:
>> On Thursday 08 March 2012 02:16 PM, Tomi Valkeinen wrote:
>>> On Thu, 2012-03-08 at 14:04 +0530, Archit Taneja wrote:
<snip>
>> Oh okay. But the comment after the patch set still says "It's ok if the
>> output-driver register fails.", we could change it to "It's ok if the
>> output-driver probe fails."
>
> Well, I guess this goes into nitpicking area, but if there are no
> devices, probe is not called at all. So I think it's the driver register
> that fails in that case. If there is a device, and it is probed, and
> that fails, then it's probe which fails.
Yes, that's fair enough I guess.
<snip>
>>
>> If we ensure that none of our probes return ENODEV(even though it may
>> make sense to return it if a func within probe fails), we could
>> differentiate between the 2 cases, right?
>
> True, I thought about that. But we can never be sure that the functions
> called by the probe (clk_get, or whatever) won't return ENODEV. Of
> course, we could check what they return, and change the error to
> something else, but I'm not sure if that's good either.
That's true.
<snip>
> Alternatively, if the platform driver code was changed to tell us
> clearly if it was the probe that failed or if there just weren't any
> devices, we could also use that.
Yes, I wonder how that could be done.
Archit
>
> Tomi
>
^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2012-03-08 9:51 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-07 12:44 [PATCH 00/21] OMAPDSS: DT preparation patches Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 01/21] OMAPDSS: panel-dvi: add PD gpio handling Tomi Valkeinen
2012-03-07 17:59 ` Archit Taneja
2012-03-08 7:54 ` Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 02/21] OMAP: board-files: remove custom PD GPIO handling for DVI output Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 03/21] OMAPDSS: TFP410: rename dvi -> tfp410 Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 04/21] OMAPDSS: TFP410: rename dvi files to tfp410 Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 05/21] OMAPDSS: TFP410: pdata rewrite Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 06/21] OMAPDSS: DSI: use dsi_get_dsidev_id(dsidev) instead of dsidev->id Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 07/21] OMAPDSS: Taal: move reset gpio handling to taal driver Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 08/21] OMAPDSS: clean up the omapdss platform data mess Tomi Valkeinen
2012-03-07 18:23 ` Archit Taneja
2012-03-08 8:02 ` Tomi Valkeinen
2012-03-08 8:29 ` Archit Taneja
2012-03-08 8:33 ` Tomi Valkeinen
2012-03-08 8:55 ` Archit Taneja
2012-03-07 12:44 ` [PATCH 09/21] OMAPDSS: remove return from platform_driver_unreg Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 10/21] OMAPDSS: use platform_driver_probe for core/dispc/dss Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 11/21] OMAPDSS: register dss drivers in module init Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 12/21] OMAPDSS: create custom pdevs for DSS omap_devices Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 13/21] OMAPDSS: create DPI & SDI devices Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 14/21] OMAPDSS: create DPI & SDI drivers Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 15/21] OMAPDSS: remove uses of dss_runtime_get/put Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 16/21] OMAPDSS: handle output-driver reg/unreg more dynamically Tomi Valkeinen
2012-03-08 8:46 ` Archit Taneja
2012-03-08 8:46 ` Tomi Valkeinen
2012-03-08 9:34 ` Archit Taneja
2012-03-08 9:34 ` Tomi Valkeinen
2012-03-08 9:51 ` Archit Taneja
2012-03-07 12:44 ` [PATCH 17/21] OMAPDSS: move the creation of debugfs files Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 18/21] OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 19/21] OMAPDSS: add __init & __exit Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 20/21] OMAPFB: " Tomi Valkeinen
2012-03-07 12:44 ` [PATCH 21/21] OMAPDSS: change default_device handling 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).