* Re: [PATCH V2] video: implement a simple framebuffer driver
From: Stephen Warren @ 2013-04-11 16:06 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <2569832.XQDrhUGNaI@avalon>
On 04/11/2013 03:56 AM, Laurent Pinchart wrote:
> On Monday 08 April 2013 17:16:37 Andrew Morton wrote:
>> On Wed, 3 Apr 2013 20:39:43 -0600 Stephen Warren wrote:
>>> A simple frame-buffer describes a raw memory region that may be rendered
>>> to, with the assumption that the display hardware has already been set
>>> up to scan out from that buffer.
>>>
>>> This is useful in cases where a bootloader exists and has set up the
>>> display hardware, but a Linux driver doesn't yet exist for the display
>>> hardware.
>>>
>>> ...
>>>
>>> +config FB_SIMPLE
>>> + bool "Simple framebuffer support"
>>> + depends on (FB = y) && OF
>>
>> It's sad that this simple little thing requires Open Firmware. Could
>> it be generalised in some way so that the small amount of setup info
>> could be provided by other means (eg, module_param) or does the
>> dependency go deeper than that?
>
> I second that request. I like the idea of a simple framebuffer driver if it
> helps deprecating fbdev in the long term, but I don't want it to offer an
> excuse not to implement a DRM/KMS driver. In particular adding DT bindings
> would force us to keep supporting the ABI for a (too) long time.
The platforms I intend to use this with only support device tree. Adding
support for platform data right now would just be dead code. If somebody
wants to use this driver with a board file based system rather than a DT
based system, it would be trivial do modify the driver to add a platform
data structure at that time.
Adding support for a platform data structure won't remove the need for
DT support in the driver; any platform that uses DT will always
configure this driver through the DT binding irrespective of whether
some other platform could configure it using platform_data.
I don't believe the DT bindings imply that they must be implemented by
an FB driver rather than a KMS driver. It's just that it's much simpler
to do so at present. If the whole FB subsystem goes away at some time,
it should be possible to implement a simplest-possible KMS driver that
supports the same DT binding. I didn't do it this way because supporting
a pre-allocated FB in DRM/KMS apparently means implementing a custom
memory allocator for this in the driver, which would be a lot of code
overhead when right now the driver can just use the FB subsystem and
simply return the address directly. The simplest possible FB driver
appears much simpler (less code size, less maintenance) than the
simplest possible KMS driver.
My inclination is that for many platforms, the bootloader support for
graphics output will appear first (before the kernel's), and this driver
will allow for the kernel to have a graphical console, allowing a more
complete/useful system to be available earlier. In many cases, that
window may be small; a DRM/KMS driver may appear soon after the basic
CPU/board/... support, and then people can switch to using it if they want.
That said, I also don't really see a problem not implementing a DRM/KMS
driver for a platform; a dumb frame-buffer works perfectly well for my
needs. Nobody would be forced to continue using it once a better
alternative existed.
^ permalink raw reply
* [PATCH 4/8] video: atmel_lcdfb: add device tree suport
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365692422-9565-1-git-send-email-plagnioj@jcrosoft.com>
get display timings from device tree
Use videomode helpers to get display timings and configurations from
device tree
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
.../devicetree/bindings/video/atmel,lcdc.txt | 75 ++++++
drivers/video/Kconfig | 2 +
drivers/video/atmel_lcdfb.c | 244 +++++++++++++++++---
3 files changed, 289 insertions(+), 32 deletions(-)
create mode 100644 Documentation/devicetree/bindings/video/atmel,lcdc.txt
diff --git a/Documentation/devicetree/bindings/video/atmel,lcdc.txt b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
new file mode 100644
index 0000000..1ec175e
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
@@ -0,0 +1,75 @@
+Atmel LCDC Framebuffer
+-----------------------------------------------------
+
+Required properties:
+- compatible :
+ "atmel,at91sam9261-lcdc" ,
+ "atmel,at91sam9263-lcdc" ,
+ "atmel,at91sam9g10-lcdc" ,
+ "atmel,at91sam9g45-lcdc" ,
+ "atmel,at91sam9g45es-lcdc" ,
+ "atmel,at91sam9rl-lcdc" ,
+ "atmel,at32ap-lcdc"
+- reg : Should contain 1 register ranges(address and length)
+- interrupts : framebuffer controller interrupt
+- display: a phandle pointing to the display node
+
+Required nodes:
+- display: a display node is required to initialize the lcd panel
+ This should be in the board dts.
+- default-mode: a videomode within the display with timing parameters
+ as specified below.
+
+Example:
+
+ fb0: fb@0x00500000 {
+ compatible = "atmel,at91sam9g45-lcdc";
+ reg = <0x00500000 0x1000>;
+ interrupts = <23 3 0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_fb>;
+ display = <&display0>;
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ };
+
+Atmel LCDC Display
+-----------------------------------------------------
+Required properties (as per of_videomode_helper):
+
+ - atmel,dmacon: dma controler configuration
+ - atmel,lcdcon2: lcd controler configuration
+ - atmel,guard-time: lcd guard time (Delay in frame periods)
+ - bits-per-pixel: lcd panel bit-depth.
+
+Optional properties (as per of_videomode_helper):
+ - atmel,lcdcon-backlight: enable backlight
+ - atmel,lcd-wiring-mode: lcd wiring mode "RGB" or "BRG"
+ - atmel,power-control-gpio: gpio to power on or off the LCD (as many as needed)
+
+Example:
+ display0: display {
+ bits-per-pixel = <32>;
+ atmel,lcdcon-backlight;
+ atmel,dmacon = <0x1>;
+ atmel,lcdcon2 = <0x80008002>;
+ atmel,guard-time = <9>;
+ atmel,lcd-wiring-mode = <1>;
+
+ display-timings {
+ native-mode = <&timing0>;
+ timing0: timing0 {
+ clock-frequency = <9000000>;
+ hactive = <480>;
+ vactive = <272>;
+ hback-porch = <1>;
+ hfront-porch = <1>;
+ vback-porch = <40>;
+ vfront-porch = <1>;
+ hsync-len = <45>;
+ vsync-len = <1>;
+ };
+ };
+ };
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4c1546f..0687482 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1018,6 +1018,8 @@ config FB_ATMEL
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
+ select FB_MODE_HELPERS
+ select OF_VIDEOMODE
help
This enables support for the AT91/AT32 LCD Controller.
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index f67e226..4a31570 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -20,7 +20,11 @@
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/platform_data/atmel.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <video/of_display_timing.h>
+#include <video/videomode.h>
#include <mach/cpu.h>
#include <asm/gpio.h>
@@ -59,6 +63,13 @@ struct atmel_lcdfb_info {
struct atmel_lcdfb_config *config;
};
+struct atmel_lcdfb_power_ctrl_gpio {
+ int gpio;
+ int active_low;
+
+ struct list_head list;
+};
+
#define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
#define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
@@ -945,16 +956,187 @@ static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
clk_disable(sinfo->lcdc_clk);
}
+#ifdef CONFIG_OF
+static const struct of_device_id atmel_lcdfb_dt_ids[] = {
+ { .compatible = "atmel,at91sam9261-lcdc" , .data = &at91sam9261_config, },
+ { .compatible = "atmel,at91sam9263-lcdc" , .data = &at91sam9263_config, },
+ { .compatible = "atmel,at91sam9g10-lcdc" , .data = &at91sam9g10_config, },
+ { .compatible = "atmel,at91sam9g45-lcdc" , .data = &at91sam9g45_config, },
+ { .compatible = "atmel,at91sam9g45es-lcdc" , .data = &at91sam9g45es_config, },
+ { .compatible = "atmel,at91sam9rl-lcdc" , .data = &at91sam9rl_config, },
+ { .compatible = "atmel,at32ap-lcdc" , .data = &at32ap_config, },
+ { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_lcdfb_dt_ids);
+
+static const char *atmel_lcdfb_wiring_modes[] = {
+ [ATMEL_LCDC_WIRING_BGR] = "BRG",
+ [ATMEL_LCDC_WIRING_RGB] = "RGB",
+};
+
+const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
+{
+ const char *mode;
+ int err, i;
+
+ err = of_property_read_string(np, "atmel,lcd-wiring-mode", &mode);
+ if (err < 0)
+ return ATMEL_LCDC_WIRING_BGR;
+
+ for (i = 0; i < ARRAY_SIZE(atmel_lcdfb_wiring_modes); i++)
+ if (!strcasecmp(mode, atmel_lcdfb_wiring_modes[i]))
+ return i;
+
+ return -ENODEV;
+}
+
+static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int on)
+{
+ struct atmel_lcdfb_power_ctrl_gpio *og;
+
+ list_for_each_entry(og, &pdata->pwr_gpios, list)
+ gpio_set_value(og->gpio, on);
+}
+
+static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
+{
+ struct fb_info *info = sinfo->info;
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+ struct fb_var_screeninfo *var = &info->var;
+ struct device *dev = &sinfo->pdev->dev;
+ struct device_node *np Þv->of_node;
+ struct device_node *display_np;
+ struct device_node *timings_np;
+ struct display_timings *timings;
+ enum of_gpio_flags flags;
+ struct atmel_lcdfb_power_ctrl_gpio *og;
+ bool is_gpio_power = false;
+ int ret = -ENOENT;
+ int i, gpio;
+
+ sinfo->config = (struct atmel_lcdfb_config*)
+ of_match_device(atmel_lcdfb_dt_ids, dev)->data;
+
+ display_np = of_parse_phandle(np, "display", 0);
+ if (!display_np) {
+ dev_err(dev, "failed to find display phandle\n");
+ return -ENOENT;
+ }
+
+ ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel);
+ if (ret < 0) {
+ dev_err(dev, "failed to get property bits-per-pixel\n");
+ goto put_display_node;
+ }
+
+ ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time);
+ if (ret < 0) {
+ dev_err(dev, "failed to get property atmel,guard-time\n");
+ goto put_display_node;
+ }
+
+ ret = of_property_read_u32(display_np, "atmel,lcdcon2", &pdata->default_lcdcon2);
+ if (ret < 0) {
+ dev_err(dev, "failed to get property atmel,lcdcon2\n");
+ goto put_display_node;
+ }
+
+ ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon);
+ if (ret < 0) {
+ dev_err(dev, "failed to get property bits-per-pixel\n");
+ goto put_display_node;
+ }
+
+ ret = -ENOMEM;
+ for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) {
+ gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio",
+ i, &flags);
+ if (gpio < 0)
+ continue;
+
+ og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
+ if (!og)
+ goto put_display_node;
+
+ og->gpio = gpio;
+ og->active_low = flags & OF_GPIO_ACTIVE_LOW;
+ is_gpio_power = true;
+ ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio");
+ if (ret) {
+ dev_err(dev, "request gpio %d failed\n", gpio);
+ goto put_display_node;
+ }
+
+ ret = gpio_direction_output(gpio, og->active_low);
+ if (ret) {
+ dev_err(dev, "set direction output gpio %d failed\n", gpio);
+ goto put_display_node;
+ }
+ }
+
+ if (is_gpio_power)
+ pdata->atmel_lcdfb_power_control = atmel_lcdfb_power_control_gpio;
+
+ ret = atmel_lcdfb_get_of_wiring_modes(display_np);
+ if (ret < 0) {
+ dev_err(dev, "invalid atmel,lcd-wiring-mode\n");
+ goto put_display_node;
+ }
+ pdata->lcd_wiring_mode = ret;
+
+ pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight");
+
+ timings = of_get_display_timings(display_np);
+ if (!timings) {
+ dev_err(dev, "failed to get display timings\n");
+ goto put_display_node;
+ }
+
+ timings_np = of_find_node_by_name(display_np, "display-timings");
+ if (!timings_np) {
+ dev_err(dev, "failed to find display-timings node\n");
+ goto put_display_node;
+ }
+
+ for (i = 0; i < of_get_child_count(timings_np); i++) {
+ struct videomode vm;
+ struct fb_videomode fb_vm;
+
+ ret = videomode_from_timing(timings, &vm, i);
+ if (ret < 0)
+ goto put_timings_node;
+ ret = fb_videomode_from_videomode(&vm, &fb_vm);
+ if (ret < 0)
+ goto put_timings_node;
+
+ fb_add_videomode(&fb_vm, &info->modelist);
+ }
+
+ return 0;
+
+put_timings_node:
+ of_node_put(timings_np);
+put_display_node:
+ of_node_put(display_np);
+ return ret;
+}
+#else
+static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
+{
+ return 0;
+}
+#endif
static int __init atmel_lcdfb_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct fb_info *info;
struct atmel_lcdfb_info *sinfo;
- struct atmel_lcdfb_pdata *pdata;
- struct fb_videomode fbmode;
+ struct atmel_lcdfb_pdata *pdata = NULL;
struct resource *regs = NULL;
struct resource *map = NULL;
+ struct fb_modelist *modelist;
int ret;
dev_dbg(dev, "%s BEGIN\n", __func__);
@@ -967,17 +1149,35 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
}
sinfo = info->par;
+ sinfo->pdev = pdev;
+ sinfo->info = info;
+
+ INIT_LIST_HEAD(&info->modelist);
- if (dev->platform_data) {
- pdata = (struct atmel_lcdfb_pdata *)dev->platform_data;
+ if (pdev->dev.of_node) {
+ ret = atmel_lcdfb_of_init(sinfo);
+ if (ret)
+ goto free_info;
+ } else if (dev->platform_data) {
+ struct fb_monspecs *monspecs;
+ int i;
+
+ pdata = dev->platform_data;
+ monspecs = pdata->default_monspecs;
sinfo->pdata = *pdata;
+
+ for (i = 0; i < monspecs->modedb_len; i++)
+ fb_add_videomode(&monspecs->modedb[i], &info->modelist);
+
+ sinfo->config = atmel_lcdfb_get_config(pdev);
+
+ info->var.bits_per_pixel = pdata->default_bpp ? pdata->default_bpp : 16;
+ memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
} else {
dev_err(dev, "cannot get default configuration\n");
goto free_info;
}
- sinfo->info = info;
- sinfo->pdev = pdev;
- sinfo->config = atmel_lcdfb_get_config(pdev);
+
if (!sinfo->config)
goto free_info;
@@ -986,7 +1186,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
info->pseudo_palette = sinfo->pseudo_palette;
info->fbops = &atmel_lcdfb_ops;
- memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
info->fix = atmel_lcdfb_fix;
/* Enable LCDC Clocks */
@@ -1002,14 +1201,11 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
}
atmel_lcdfb_start_clock(sinfo);
- ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
- info->monspecs.modedb_len, info->monspecs.modedb,
- pdata->default_bpp);
- if (!ret) {
- dev_err(dev, "no suitable video mode found\n");
- goto stop_clk;
- }
+ modelist = list_first_entry(&info->modelist,
+ struct fb_modelist, list);
+ fb_videomode_to_var(&info->var, &modelist->mode);
+ atmel_lcdfb_check_var(&info->var, info);
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs) {
@@ -1093,18 +1289,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
goto unregister_irqs;
}
- /*
- * This makes sure that our colour bitfield
- * descriptors are correctly initialised.
- */
- atmel_lcdfb_check_var(&info->var, info);
-
- ret = fb_set_var(info, &info->var);
- if (ret) {
- dev_warn(dev, "unable to set display parameters\n");
- goto free_cmap;
- }
-
dev_set_drvdata(dev, info);
/*
@@ -1116,10 +1300,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
goto reset_drvdata;
}
- /* add selected videomode to modelist */
- fb_var_to_videomode(&fbmode, &info->var);
- fb_add_videomode(&fbmode, &info->modelist);
-
/* Power up the LCDC screen */
atmel_lcdfb_power_control(sinfo, 1);
@@ -1130,7 +1310,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
reset_drvdata:
dev_set_drvdata(dev, NULL);
-free_cmap:
fb_dealloc_cmap(&info->cmap);
unregister_irqs:
cancel_work_sync(&sinfo->task);
@@ -1249,6 +1428,7 @@ static struct platform_driver atmel_lcdfb_driver = {
.driver = {
.name = "atmel_lcdfb",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(atmel_lcdfb_dt_ids),
},
};
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/8] video: atmel_lcdfb: pass the pdata as params
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365692422-9565-1-git-send-email-plagnioj@jcrosoft.com>
so we can use have list gpio as example (probe via DT)
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
arch/arm/mach-at91/board-sam9261ek.c | 4 ++--
arch/arm/mach-at91/board-sam9263ek.c | 2 +-
arch/arm/mach-at91/board-sam9rlek.c | 2 +-
arch/avr32/boards/atngw100/evklcd10x.c | 2 +-
drivers/video/atmel_lcdfb.c | 2 +-
include/video/atmel_lcdc.h | 4 +++-
6 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index c819e29..9a6618a 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -393,7 +393,7 @@ static struct fb_monspecs at91fb_default_stn_monspecs = {
| ATMEL_LCDC_IFWIDTH_4 \
| ATMEL_LCDC_SCANMOD_SINGLE)
-static void at91_lcdc_stn_power_control(int on)
+static void at91_lcdc_stn_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
/* backlight */
if (on) { /* power up */
@@ -452,7 +452,7 @@ static struct fb_monspecs at91fb_default_tft_monspecs = {
| ATMEL_LCDC_DISTYPE_TFT \
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
-static void at91_lcdc_tft_power_control(int on)
+static void at91_lcdc_tft_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
if (on)
at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 0fdae3f..8b4942c 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -275,7 +275,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
| ATMEL_LCDC_DISTYPE_TFT \
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
-static void at91_lcdc_power_control(int on)
+static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
at91_set_gpio_value(AT91_PIN_PA30, on);
}
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index b77d7a9..604eecf 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -170,7 +170,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
| ATMEL_LCDC_DISTYPE_TFT \
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
-static void at91_lcdc_power_control(int on)
+static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
if (on)
at91_set_gpio_value(AT91_PIN_PC1, 0); /* power up */
diff --git a/arch/avr32/boards/atngw100/evklcd10x.c b/arch/avr32/boards/atngw100/evklcd10x.c
index dc42804..64919b0 100644
--- a/arch/avr32/boards/atngw100/evklcd10x.c
+++ b/arch/avr32/boards/atngw100/evklcd10x.c
@@ -145,7 +145,7 @@ static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
};
#endif
-static void atevklcd10x_lcdc_power_control(int on)
+static void atevklcd10x_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
gpio_set_value(GPIO_PIN_PB(15), on);
}
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 9574c47..f67e226 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -288,7 +288,7 @@ static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int
struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(on);
+ pdata->atmel_lcdfb_power_control(pdata, on);
}
static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 2eb601c..f624c51 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -40,8 +40,10 @@ struct atmel_lcdfb_pdata {
u8 lcd_wiring_mode;
unsigned int default_lcdcon2;
unsigned int default_dmacon;
- void (*atmel_lcdfb_power_control)(int on);
+ void (*atmel_lcdfb_power_control)(struct atmel_lcdfb_pdata *pdata, int on);
struct fb_monspecs *default_monspecs;
+
+ struct list_head pwr_gpios;
};
#define ATMEL_LCDC_DMABADDR1 0x00
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/8] video: atmel_lcdfb: introduce atmel_lcdfb_power_control
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365692422-9565-1-git-send-email-plagnioj@jcrosoft.com>
to simplify the check on the presence of the callback
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
drivers/video/atmel_lcdfb.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 98733cd4..9574c47 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -283,6 +283,13 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo)
init_backlight(sinfo);
}
+static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on)
+{
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+
+ if (pdata->atmel_lcdfb_power_control)
+ pdata->atmel_lcdfb_power_control(on);
+}
static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
.type = FB_TYPE_PACKED_PIXELS,
@@ -1114,8 +1121,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
fb_add_videomode(&fbmode, &info->modelist);
/* Power up the LCDC screen */
- if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(1);
+ atmel_lcdfb_power_control(sinfo, 1);
dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n",
info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
@@ -1169,8 +1175,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
cancel_work_sync(&sinfo->task);
exit_backlight(sinfo);
- if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(0);
+ atmel_lcdfb_power_control(sinfo, 0);
unregister_framebuffer(info);
atmel_lcdfb_stop_clock(sinfo);
clk_put(sinfo->lcdc_clk);
@@ -1198,7 +1203,6 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
{
struct fb_info *info = platform_get_drvdata(pdev);
struct atmel_lcdfb_info *sinfo = info->par;
- struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
/*
* We don't want to handle interrupts while the clock is
@@ -1208,9 +1212,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
- if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(0);
-
+ atmel_lcdfb_power_control(sinfo, 0);
atmel_lcdfb_stop(sinfo);
atmel_lcdfb_stop_clock(sinfo);
@@ -1221,12 +1223,10 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
{
struct fb_info *info = platform_get_drvdata(pdev);
struct atmel_lcdfb_info *sinfo = info->par;
- struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
atmel_lcdfb_start_clock(sinfo);
atmel_lcdfb_start(sinfo);
- if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(1);
+ atmel_lcdfb_power_control(sinfo, 1);
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
/* Enable FIFO & DMA errors */
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/8] video: atmel_lcdfb: fix platform data struct
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20130411145741.GB25242@game.jcrosoft.org>
Today we mix pdata and drivers data in the struct atmel_lcdfb_info
Fix it and introduce a new struct atmel_lcdfb_pdata for platform data only
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
---
arch/arm/mach-at91/at91sam9261_devices.c | 6 +-
arch/arm/mach-at91/at91sam9263_devices.c | 6 +-
arch/arm/mach-at91/at91sam9g45_devices.c | 6 +-
arch/arm/mach-at91/at91sam9rl_devices.c | 6 +-
arch/arm/mach-at91/board-sam9261ek.c | 6 +-
arch/arm/mach-at91/board-sam9263ek.c | 4 +-
arch/arm/mach-at91/board-sam9m10g45ek.c | 4 +-
arch/arm/mach-at91/board-sam9rlek.c | 4 +-
arch/arm/mach-at91/board.h | 4 +-
arch/avr32/boards/atngw100/evklcd10x.c | 6 +-
arch/avr32/boards/atngw100/mrmt.c | 4 +-
arch/avr32/boards/atstk1000/atstk1000.h | 2 +-
arch/avr32/boards/atstk1000/setup.c | 2 +-
arch/avr32/boards/favr-32/setup.c | 2 +-
arch/avr32/boards/hammerhead/setup.c | 2 +-
arch/avr32/boards/merisc/display.c | 2 +-
arch/avr32/boards/mimc200/setup.c | 4 +-
arch/avr32/mach-at32ap/at32ap700x.c | 8 +--
arch/avr32/mach-at32ap/include/mach/board.h | 4 +-
drivers/video/atmel_lcdfb.c | 104 +++++++++++++++++----------
include/video/atmel_lcdc.h | 24 +------
21 files changed, 109 insertions(+), 101 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 629ea5f..b2a3474 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -465,7 +465,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
static u64 lcdc_dmamask = DMA_BIT_MASK(32);
-static struct atmel_lcdfb_info lcdc_data;
+static struct atmel_lcdfb_pdata lcdc_data;
static struct resource lcdc_resources[] = {
[0] = {
@@ -498,7 +498,7 @@ static struct platform_device at91_lcdc_device = {
.num_resources = ARRAY_SIZE(lcdc_resources),
};
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
{
if (!data) {
return;
@@ -559,7 +559,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
platform_device_register(&at91_lcdc_device);
}
#else
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
#endif
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 858c8aa..4aeaddd 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -832,7 +832,7 @@ void __init at91_add_device_can(struct at91_can_data *data) {}
#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
static u64 lcdc_dmamask = DMA_BIT_MASK(32);
-static struct atmel_lcdfb_info lcdc_data;
+static struct atmel_lcdfb_pdata lcdc_data;
static struct resource lcdc_resources[] = {
[0] = {
@@ -859,7 +859,7 @@ static struct platform_device at91_lcdc_device = {
.num_resources = ARRAY_SIZE(lcdc_resources),
};
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
{
if (!data)
return;
@@ -891,7 +891,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
platform_device_register(&at91_lcdc_device);
}
#else
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
#endif
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index fe626d4..82636c7 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -965,7 +965,7 @@ void __init at91_add_device_isi(struct isi_platform_data *data,
#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
static u64 lcdc_dmamask = DMA_BIT_MASK(32);
-static struct atmel_lcdfb_info lcdc_data;
+static struct atmel_lcdfb_pdata lcdc_data;
static struct resource lcdc_resources[] = {
[0] = {
@@ -991,7 +991,7 @@ static struct platform_device at91_lcdc_device = {
.num_resources = ARRAY_SIZE(lcdc_resources),
};
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
{
if (!data)
return;
@@ -1037,7 +1037,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
platform_device_register(&at91_lcdc_device);
}
#else
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
#endif
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 352468f..a698bda 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -498,7 +498,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
static u64 lcdc_dmamask = DMA_BIT_MASK(32);
-static struct atmel_lcdfb_info lcdc_data;
+static struct atmel_lcdfb_pdata lcdc_data;
static struct resource lcdc_resources[] = {
[0] = {
@@ -525,7 +525,7 @@ static struct platform_device at91_lcdc_device = {
.num_resources = ARRAY_SIZE(lcdc_resources),
};
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
{
if (!data) {
return;
@@ -557,7 +557,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
platform_device_register(&at91_lcdc_device);
}
#else
-void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
+void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
#endif
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index b446645..c819e29 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -405,7 +405,7 @@ static void at91_lcdc_stn_power_control(int on)
}
}
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
.default_bpp = 1,
.default_dmacon = ATMEL_LCDC_DMAEN,
.default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2,
@@ -460,7 +460,7 @@ static void at91_lcdc_tft_power_control(int on)
at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */
}
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
.lcdcon_is_backlight = true,
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN,
@@ -475,7 +475,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
#endif
#else
-static struct atmel_lcdfb_info __initdata ek_lcdc_data;
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
#endif
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 3284df0..0fdae3f 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -281,7 +281,7 @@ static void at91_lcdc_power_control(int on)
}
/* Driver datas */
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
.lcdcon_is_backlight = true,
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN,
@@ -292,7 +292,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
};
#else
-static struct atmel_lcdfb_info __initdata ek_lcdc_data;
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
#endif
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 2a94896..ef39078 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -284,7 +284,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
/* Driver datas */
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
.lcdcon_is_backlight = true,
.default_bpp = 32,
.default_dmacon = ATMEL_LCDC_DMAEN,
@@ -295,7 +295,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
};
#else
-static struct atmel_lcdfb_info __initdata ek_lcdc_data;
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
#endif
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index aa265dc..b77d7a9 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -179,7 +179,7 @@ static void at91_lcdc_power_control(int on)
}
/* Driver datas */
-static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
.lcdcon_is_backlight = true,
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN,
@@ -191,7 +191,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
};
#else
-static struct atmel_lcdfb_info __initdata ek_lcdc_data;
+static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
#endif
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 4a234fb..6c08b34 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -107,8 +107,8 @@ extern void __init at91_add_device_pwm(u32 mask);
extern void __init at91_add_device_ssc(unsigned id, unsigned pins);
/* LCD Controller */
-struct atmel_lcdfb_info;
-extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data);
+struct atmel_lcdfb_pdata;
+extern void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data);
/* AC97 */
extern void __init at91_add_device_ac97(struct ac97c_platform_data *data);
diff --git a/arch/avr32/boards/atngw100/evklcd10x.c b/arch/avr32/boards/atngw100/evklcd10x.c
index 2038875..dc42804 100644
--- a/arch/avr32/boards/atngw100/evklcd10x.c
+++ b/arch/avr32/boards/atngw100/evklcd10x.c
@@ -58,7 +58,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
.dclkmax = 28330000,
};
-static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
@@ -96,7 +96,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
.dclkmax = 7000000,
};
-static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
@@ -134,7 +134,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
.dclkmax = 6400000,
};
-static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
index f914319..ccc9599 100644
--- a/arch/avr32/boards/atngw100/mrmt.c
+++ b/arch/avr32/boards/atngw100/mrmt.c
@@ -83,7 +83,7 @@ static struct fb_monspecs __initdata lcd_fb_default_monspecs = {
.dclkmax = 9260000,
};
-static struct atmel_lcdfb_info __initdata rmt_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata rmt_lcdc_data = {
.default_bpp = 24,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
@@ -126,7 +126,7 @@ static struct fb_monspecs __initdata lcd_fb_default_monspecs = {
.dclkmax = 9260000,
};
-static struct atmel_lcdfb_info __initdata rmt_lcdc_data = {
+static struct atmel_lcdfb_pdata __initdata rmt_lcdc_data = {
.default_bpp = 24,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/atstk1000/atstk1000.h b/arch/avr32/boards/atstk1000/atstk1000.h
index 9392d32..653cc09 100644
--- a/arch/avr32/boards/atstk1000/atstk1000.h
+++ b/arch/avr32/boards/atstk1000/atstk1000.h
@@ -10,7 +10,7 @@
#ifndef __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H
#define __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H
-extern struct atmel_lcdfb_info atstk1000_lcdc_data;
+extern struct atmel_lcdfb_pdata atstk1000_lcdc_data;
void atstk1000_setup_j2_leds(void);
diff --git a/arch/avr32/boards/atstk1000/setup.c b/arch/avr32/boards/atstk1000/setup.c
index 2d6b560..b6b88f5 100644
--- a/arch/avr32/boards/atstk1000/setup.c
+++ b/arch/avr32/boards/atstk1000/setup.c
@@ -55,7 +55,7 @@ static struct fb_monspecs __initdata atstk1000_default_monspecs = {
.dclkmax = 30000000,
};
-struct atmel_lcdfb_info __initdata atstk1000_lcdc_data = {
+struct atmel_lcdfb_pdata __initdata atstk1000_lcdc_data = {
.default_bpp = 24,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 27bd6fb..7b1f2cd 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -125,7 +125,7 @@ static struct fb_monspecs __initdata favr32_default_monspecs = {
.dclkmax = 28000000,
};
-struct atmel_lcdfb_info __initdata favr32_lcdc_data = {
+struct atmel_lcdfb_pdata __initdata favr32_lcdc_data = {
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
index 9d1efd1..dc0e317 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -77,7 +77,7 @@ static struct fb_monspecs __initdata hammerhead_hda350t_monspecs = {
.dclkmax = 10000000,
};
-struct atmel_lcdfb_info __initdata hammerhead_lcdc_data = {
+struct atmel_lcdfb_pdata __initdata hammerhead_lcdc_data = {
.default_bpp = 24,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/merisc/display.c b/arch/avr32/boards/merisc/display.c
index 85a543c..e7683ee 100644
--- a/arch/avr32/boards/merisc/display.c
+++ b/arch/avr32/boards/merisc/display.c
@@ -45,7 +45,7 @@ static struct fb_monspecs merisc_fb_monspecs = {
.dclkmax = 30000000,
};
-struct atmel_lcdfb_info merisc_lcdc_data = {
+struct atmel_lcdfb_pdata merisc_lcdc_data = {
.default_bpp = 24,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
index 05358aa..1cb8e9c 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -8,7 +8,7 @@
* published by the Free Software Foundation.
*/
-extern struct atmel_lcdfb_info mimc200_lcdc_data;
+extern struct atmel_lcdfb_pdata mimc200_lcdc_data;
#include <linux/clk.h>
#include <linux/etherdevice.h>
@@ -71,7 +71,7 @@ static struct fb_monspecs __initdata mimc200_default_monspecs = {
.dclkmax = 25200000,
};
-struct atmel_lcdfb_info __initdata mimc200_lcdc_data = {
+struct atmel_lcdfb_pdata __initdata mimc200_lcdc_data = {
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
.default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 7c2f668..0badb05 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1437,7 +1437,7 @@ fail:
* LCDC
* -------------------------------------------------------------------- */
#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
-static struct atmel_lcdfb_info atmel_lcdfb0_data;
+static struct atmel_lcdfb_pdata atmel_lcdfb0_data;
static struct resource atmel_lcdfb0_resource[] = {
{
.start = 0xff000000,
@@ -1465,12 +1465,12 @@ static struct clk atmel_lcdfb0_pixclk = {
};
struct platform_device *__init
-at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
+at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_pdata *data,
unsigned long fbmem_start, unsigned long fbmem_len,
u64 pin_mask)
{
struct platform_device *pdev;
- struct atmel_lcdfb_info *info;
+ struct atmel_lcdfb_pdata *info;
struct fb_monspecs *monspecs;
struct fb_videomode *modedb;
unsigned int modedb_size;
@@ -1527,7 +1527,7 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
}
info = pdev->dev.platform_data;
- memcpy(info, data, sizeof(struct atmel_lcdfb_info));
+ memcpy(info, data, sizeof(struct atmel_lcdfb_pdata));
info->default_monspecs = monspecs;
pdev->name = "at32ap-lcdfb";
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index d485b03..f1a316d 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -44,9 +44,9 @@ struct platform_device *
at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n);
void at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, unsigned int n);
-struct atmel_lcdfb_info;
+struct atmel_lcdfb_pdata;
struct platform_device *
-at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
+at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_pdata *data,
unsigned long fbmem_start, unsigned long fbmem_len,
u64 pin_mask);
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index c1a2914..98733cd4 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -20,12 +20,45 @@
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/platform_data/atmel.h>
+#include <video/of_display_timing.h>
#include <mach/cpu.h>
#include <asm/gpio.h>
#include <video/atmel_lcdc.h>
+struct atmel_lcdfb_config {
+ bool have_alt_pixclock;
+ bool have_hozval;
+ bool have_intensity_bit;
+};
+
+ /* LCD Controller info data structure, stored in device platform_data */
+struct atmel_lcdfb_info {
+ spinlock_t lock;
+ struct fb_info *info;
+ void __iomem *mmio;
+ int irq_base;
+ struct work_struct task;
+
+ unsigned int smem_len;
+ struct platform_device *pdev;
+ struct clk *bus_clk;
+ struct clk *lcdc_clk;
+
+ struct backlight_device *backlight;
+ u8 bl_power;
+ bool lcdcon_pol_negative;
+ u8 saved_lcdcon;
+
+ u32 pseudo_palette[16];
+ bool have_intensity_bit;
+
+ struct atmel_lcdfb_pdata pdata;
+
+ struct atmel_lcdfb_config *config;
+};
+
#define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
#define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
@@ -34,12 +67,6 @@
#define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */
#define ATMEL_LCDC_FIFO_SIZE 512 /* words */
-struct atmel_lcdfb_config {
- bool have_alt_pixclock;
- bool have_hozval;
- bool have_intensity_bit;
-};
-
static struct atmel_lcdfb_config at91sam9261_config = {
.have_hozval = true,
.have_intensity_bit = true,
@@ -242,6 +269,8 @@ static void exit_backlight(struct atmel_lcdfb_info *sinfo)
static void init_contrast(struct atmel_lcdfb_info *sinfo)
{
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+
/* contrast pwm can be 'inverted' */
if (sinfo->lcdcon_pol_negative)
contrast_ctr &= ~(ATMEL_LCDC_POL_POSITIVE);
@@ -250,7 +279,7 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo)
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
- if (sinfo->lcdcon_is_backlight)
+ if (pdata->lcdcon_is_backlight)
init_backlight(sinfo);
}
@@ -293,9 +322,11 @@ static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo,
static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo)
{
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+
/* Turn off the LCD controller and the DMA controller */
lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
- sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
+ pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
/* Wait for the LCDC core to become idle */
while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
@@ -315,9 +346,11 @@ static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo)
static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)
{
- lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon);
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+
+ lcdc_writel(sinfo, ATMEL_LCDC_DMACON, pdata->default_dmacon);
lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
- (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
+ (pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
| ATMEL_LCDC_PWR);
}
@@ -418,6 +451,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
{
struct device *dev = info->device;
struct atmel_lcdfb_info *sinfo = info->par;
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
unsigned long clk_value_khz;
clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
@@ -501,7 +535,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
else
var->green.length = 6;
- if (sinfo->lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB) {
+ if (pdata->lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB) {
/* RGB:5X5 mode */
var->red.offset = var->green.length + 5;
var->blue.offset = 0;
@@ -518,7 +552,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
var->transp.length = 8;
/* fall through */
case 24:
- if (sinfo->lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB) {
+ if (pdata->lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB) {
/* RGB:888 mode */
var->red.offset = 16;
var->blue.offset = 0;
@@ -567,6 +601,7 @@ static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo)
static int atmel_lcdfb_set_par(struct fb_info *info)
{
struct atmel_lcdfb_info *sinfo = info->par;
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
unsigned long hozval_linesz;
unsigned long value;
unsigned long clk_value_khz;
@@ -628,7 +663,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
/* Initialize control register 2 */
- value = sinfo->default_lcdcon2;
+ value = pdata->default_lcdcon2;
if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT))
value |= ATMEL_LCDC_INVLINE_INVERTED;
@@ -732,6 +767,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
unsigned int transp, struct fb_info *info)
{
struct atmel_lcdfb_info *sinfo = info->par;
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
unsigned int val;
u32 *pal;
int ret = 1;
@@ -768,8 +804,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
*/
} else {
/* new style BGR:565 / RGB:565 */
- if (sinfo->lcd_wiring_mode =
- ATMEL_LCDC_WIRING_RGB) {
+ if (pdata->lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB) {
val = ((blue >> 11) & 0x001f);
val |= ((red >> 0) & 0xf800);
} else {
@@ -909,7 +944,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct fb_info *info;
struct atmel_lcdfb_info *sinfo;
- struct atmel_lcdfb_info *pdata_sinfo;
+ struct atmel_lcdfb_pdata *pdata;
struct fb_videomode fbmode;
struct resource *regs = NULL;
struct resource *map = NULL;
@@ -927,17 +962,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
sinfo = info->par;
if (dev->platform_data) {
- pdata_sinfo = (struct atmel_lcdfb_info *)dev->platform_data;
- sinfo->default_bpp = pdata_sinfo->default_bpp;
- sinfo->default_dmacon = pdata_sinfo->default_dmacon;
- sinfo->default_lcdcon2 = pdata_sinfo->default_lcdcon2;
- sinfo->default_monspecs = pdata_sinfo->default_monspecs;
- sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control;
- sinfo->guard_time = pdata_sinfo->guard_time;
- sinfo->smem_len = pdata_sinfo->smem_len;
- sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight;
- sinfo->lcdcon_pol_negative = pdata_sinfo->lcdcon_pol_negative;
- sinfo->lcd_wiring_mode = pdata_sinfo->lcd_wiring_mode;
+ pdata = (struct atmel_lcdfb_pdata *)dev->platform_data;
+ sinfo->pdata = *pdata;
} else {
dev_err(dev, "cannot get default configuration\n");
goto free_info;
@@ -953,7 +979,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
info->pseudo_palette = sinfo->pseudo_palette;
info->fbops = &atmel_lcdfb_ops;
- memcpy(&info->monspecs, sinfo->default_monspecs, sizeof(info->monspecs));
+ memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
info->fix = atmel_lcdfb_fix;
/* Enable LCDC Clocks */
@@ -971,7 +997,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
info->monspecs.modedb_len, info->monspecs.modedb,
- sinfo->default_bpp);
+ pdata->default_bpp);
if (!ret) {
dev_err(dev, "no suitable video mode found\n");
goto stop_clk;
@@ -1088,8 +1114,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
fb_add_videomode(&fbmode, &info->modelist);
/* Power up the LCDC screen */
- if (sinfo->atmel_lcdfb_power_control)
- sinfo->atmel_lcdfb_power_control(1);
+ if (pdata->atmel_lcdfb_power_control)
+ pdata->atmel_lcdfb_power_control(1);
dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n",
info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
@@ -1134,15 +1160,17 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct fb_info *info = dev_get_drvdata(dev);
struct atmel_lcdfb_info *sinfo;
+ struct atmel_lcdfb_pdata *pdata;
if (!info || !info->par)
return 0;
sinfo = info->par;
+ pdata = &sinfo->pdata;
cancel_work_sync(&sinfo->task);
exit_backlight(sinfo);
- if (sinfo->atmel_lcdfb_power_control)
- sinfo->atmel_lcdfb_power_control(0);
+ if (pdata->atmel_lcdfb_power_control)
+ pdata->atmel_lcdfb_power_control(0);
unregister_framebuffer(info);
atmel_lcdfb_stop_clock(sinfo);
clk_put(sinfo->lcdc_clk);
@@ -1170,6 +1198,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
{
struct fb_info *info = platform_get_drvdata(pdev);
struct atmel_lcdfb_info *sinfo = info->par;
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
/*
* We don't want to handle interrupts while the clock is
@@ -1179,8 +1208,8 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
- if (sinfo->atmel_lcdfb_power_control)
- sinfo->atmel_lcdfb_power_control(0);
+ if (pdata->atmel_lcdfb_power_control)
+ pdata->atmel_lcdfb_power_control(0);
atmel_lcdfb_stop(sinfo);
atmel_lcdfb_stop_clock(sinfo);
@@ -1192,11 +1221,12 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
{
struct fb_info *info = platform_get_drvdata(pdev);
struct atmel_lcdfb_info *sinfo = info->par;
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
atmel_lcdfb_start_clock(sinfo);
atmel_lcdfb_start(sinfo);
- if (sinfo->atmel_lcdfb_power_control)
- sinfo->atmel_lcdfb_power_control(1);
+ if (pdata->atmel_lcdfb_power_control)
+ pdata->atmel_lcdfb_power_control(1);
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
/* Enable FIFO & DMA errors */
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 0f5a2fc..2eb601c 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -31,39 +31,17 @@
#define ATMEL_LCDC_WIRING_BGR 0
#define ATMEL_LCDC_WIRING_RGB 1
-struct atmel_lcdfb_config;
/* LCD Controller info data structure, stored in device platform_data */
-struct atmel_lcdfb_info {
- spinlock_t lock;
- struct fb_info *info;
- void __iomem *mmio;
- int irq_base;
- struct work_struct task;
-
+struct atmel_lcdfb_pdata {
unsigned int guard_time;
- unsigned int smem_len;
- struct platform_device *pdev;
- struct clk *bus_clk;
- struct clk *lcdc_clk;
-
-#ifdef CONFIG_BACKLIGHT_ATMEL_LCDC
- struct backlight_device *backlight;
- u8 bl_power;
-#endif
bool lcdcon_is_backlight;
- bool lcdcon_pol_negative;
- u8 saved_lcdcon;
-
u8 default_bpp;
u8 lcd_wiring_mode;
unsigned int default_lcdcon2;
unsigned int default_dmacon;
void (*atmel_lcdfb_power_control)(int on);
struct fb_monspecs *default_monspecs;
- u32 pseudo_palette[16];
-
- struct atmel_lcdfb_config *config;
};
#define ATMEL_LCDC_DMABADDR1 0x00
--
1.7.10.4
^ permalink raw reply related
* [PATCH 0/8] ARM: at91: atmel_lcdc: add DT support
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 14:57 UTC (permalink / raw)
To: inux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Andrew Morton
HI,
The following patch series add the DT support of the Atmel LCDC
controler and update the 9263 and 9g45 Atmel Reference board
At the same time some cleanup is done on the drivers implementation as
we was using the internal data struct as platform data
The following changes since commit d920129d817acc5f7ebfadeb7ecbce70ab161f6c:
ARM: at91/avr32/atmel_lcdfb: add platform device-id table (2013-04-11 21:00:56 +0800)
are available in the git repository at:
git://github.com/at91linux/linux-at91.git j/for-3.10_atmel_lcd_dt
for you to fetch changes up to 6354e161060c2d90f0935d14d037e2f126b8c6e5:
ARM: at91: sam9263ek: add dt lcd support (2013-04-11 21:18:21 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (8):
video: atmel_lcdfb: fix platform data struct
video: atmel_lcdfb: introduce atmel_lcdfb_power_control
video: atmel_lcdfb: pass the pdata as params
video: atmel_lcdfb: add device tree suport
ARM: at91: sam9g45: add lcd support
ARM: at91: sam9263: add fb dt support
ARM: at91: at9sam9m10g45ek: add dt lcd support
ARM: at91: sam9263ek: add dt lcd support
Documentation/devicetree/bindings/video/atmel,lcdc.txt | 75 +++++++++++++++++++++++++++++++++++++
arch/arm/boot/dts/at91sam9263.dtsi | 39 ++++++++++++++++++++
arch/arm/boot/dts/at91sam9263ek.dts | 30 +++++++++++++++
arch/arm/boot/dts/at91sam9g45.dtsi | 47 +++++++++++++++++++++++
arch/arm/boot/dts/at91sam9m10g45ek.dts | 29 +++++++++++++++
arch/arm/mach-at91/at91sam9261_devices.c | 6 +--
arch/arm/mach-at91/at91sam9263_devices.c | 6 +--
arch/arm/mach-at91/at91sam9g45_devices.c | 6 +--
arch/arm/mach-at91/at91sam9rl_devices.c | 6 +--
arch/arm/mach-at91/board-sam9261ek.c | 10 ++---
arch/arm/mach-at91/board-sam9263ek.c | 6 +--
arch/arm/mach-at91/board-sam9m10g45ek.c | 4 +-
arch/arm/mach-at91/board-sam9rlek.c | 6 +--
arch/arm/mach-at91/board.h | 4 +-
arch/avr32/boards/atngw100/evklcd10x.c | 8 ++--
arch/avr32/boards/atngw100/mrmt.c | 4 +-
arch/avr32/boards/atstk1000/atstk1000.h | 2 +-
arch/avr32/boards/atstk1000/setup.c | 2 +-
arch/avr32/boards/favr-32/setup.c | 2 +-
arch/avr32/boards/hammerhead/setup.c | 2 +-
arch/avr32/boards/merisc/display.c | 2 +-
arch/avr32/boards/mimc200/setup.c | 4 +-
arch/avr32/mach-at32ap/at32ap700x.c | 8 ++--
arch/avr32/mach-at32ap/include/mach/board.h | 4 +-
drivers/video/Kconfig | 2 +
drivers/video/atmel_lcdfb.c | 342 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
include/video/atmel_lcdc.h | 26 ++-----------
27 files changed, 547 insertions(+), 135 deletions(-)
create mode 100644 Documentation/devicetree/bindings/video/atmel,lcdc.txt
Best Regards,
J.
^ permalink raw reply
* Re: [PATCH 12/30] video/exynos: remove unnecessary header inclusions
From: Arnd Bergmann @ 2013-04-11 12:08 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <5166A3DB.6060700@ti.com>
On Thursday 11 April 2013 14:51:55 Tomi Valkeinen wrote:
> I've applied this and the next patch ([PATCH 13/30] video/s3c: move
> platform_data out of arch/arm) to fbdev.
>
> I also fixed the extra space mentioned by Jingoo.
Thanks!
Arnd
^ permalink raw reply
* Re: [PATCH 12/30] video/exynos: remove unnecessary header inclusions
From: Tomi Valkeinen @ 2013-04-11 11:51 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365638712-1028578-13-git-send-email-arnd@arndb.de>
[-- Attachment #1: Type: text/plain, Size: 809 bytes --]
Hi,
On 2013-04-11 03:04, Arnd Bergmann wrote:
> In multiplatform configurations, we cannot include headers
> provided by only the exynos platform. Fortunately a number
> of drivers that include those headers do not actually need
> them, so we can just remove the inclusions.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/video/exynos/exynos_mipi_dsi.c | 2 --
> drivers/video/exynos/exynos_mipi_dsi_common.c | 2 --
> drivers/video/exynos/exynos_mipi_dsi_lowlevel.c | 2 --
> 3 files changed, 6 deletions(-)
I've applied this and the next patch ([PATCH 13/30] video/s3c: move
platform_data out of arch/arm) to fbdev.
I also fixed the extra space mentioned by Jingoo.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]
^ permalink raw reply
* Re: [PATCH V2] video: implement a simple framebuffer driver
From: Geert Uytterhoeven @ 2013-04-11 10:42 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365043183-28905-1-git-send-email-swarren@wwwdotorg.org>
On Thu, Apr 4, 2013 at 4:39 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> + { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0} },
Why "r5g6b5" instead of "rgb565", which is what's commonly used?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH V2] video: implement a simple framebuffer driver
From: Laurent Pinchart @ 2013-04-11 9:56 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20130408171637.98b5ad1f867bcbda883af68b@linux-foundation.org>
On Monday 08 April 2013 17:16:37 Andrew Morton wrote:
> On Wed, 3 Apr 2013 20:39:43 -0600 Stephen Warren wrote:
> > A simple frame-buffer describes a raw memory region that may be rendered
> > to, with the assumption that the display hardware has already been set
> > up to scan out from that buffer.
> >
> > This is useful in cases where a bootloader exists and has set up the
> > display hardware, but a Linux driver doesn't yet exist for the display
> > hardware.
> >
> > ...
> >
> > +config FB_SIMPLE
> > + bool "Simple framebuffer support"
> > + depends on (FB = y) && OF
>
> It's sad that this simple little thing requires Open Firmware. Could
> it be generalised in some way so that the small amount of setup info
> could be provided by other means (eg, module_param) or does the
> dependency go deeper than that?
I second that request. I like the idea of a simple framebuffer driver if it
helps deprecating fbdev in the long term, but I don't want it to offer an
excuse not to implement a DRM/KMS driver. In particular adding DT bindings
would force us to keep supporting the ABI for a (too) long time.
> > +struct simplefb_format simplefb_formats[] = {
> > + { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0} },
> > +};
>
> I'll make this static.
--
Regards,
Laurent Pinchart
^ permalink raw reply
* Re: How to manage OMAP display drivers in the future
From: Laurent Pinchart @ 2013-04-11 9:49 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-fbdev, dri-devel@lists.freedesktop.org
In-Reply-To: <5165382F.8050401@ti.com>
[-- Attachment #1: Type: text/plain, Size: 3246 bytes --]
Hi Tomi,
On Wednesday 10 April 2013 13:00:15 Tomi Valkeinen wrote:
> On 2013-03-13 10:57, Tomi Valkeinen wrote:
> > Hi Dave,
> >
> > I'm writing this mail to get some ideas how we should manage OMAP's
> > display drivers in the future.
> >
> > As a short intro, we have the following players around:
> >
> > omapdss - omapdss handles the DSS (display subsystem) hardware. omapdss
> > doesn't do any buffer management or expose any userspace API (except a
> > few sysfs files), so it doesn't do anything by itself.
> > (drivers/video/omap2/dss/)
> >
> > panel drivers - Drivers for various panel models. The panel drivers use
> > omapdss API to manage the video bus. (drivers/video/omap2/displays/)
> >
> > omapfb - Framebuffer driver, uses omapdss to handle the HW.
> > (drivers/video/omap2/omapfb/)
> >
> > omap_vout - V4L2 driver for showing video, uses omapdss to handle the
> > HW. (drivers/media/platform/omap/)
> >
> > omapdrm - DRM driver, uses omapdss to handle the HW.
> > (drivers/gpu/drm/omapdrm/)
> >
> > omapdss and the panel drivers form the lowest level layer. omapfb and
> > omap_vout can be used at the same time, but omapdrm must be used alone,
> > without omapfb or omap_vout.
> >
> > omapfb and omap_vout are not much developed anymore, even though they
> > are still commonly used. Most of the development happens in omapdss,
> > panel drivers and omapdrm.
> >
> > So that's what we have now. In the distant future I see omapfb and
> > omap_vout disappear totally,
I'm all for that, but we need a migration plan. I plan to port my omap3-isp-
live application to omapdrm, I'll report any issue with my use cases.
> > the panel drivers would be made generic using Common Display Framework,
> > and omapdss and omapdrm would more or less be merged together. However,
> > all that is still far away, and we need some plan to go forward for now.
> >
> > Most pressing question is how to get OMAP display patches merged. It
> > seems that there's not really an fbdev maintainer for the time being,
> > and fbdev tree has been the route for omapdss, panels and omapfb in the
> > past. Now that omapdrm is the new main driver for omap display, fbdev
> > would be somewhat wrong in any case.
> >
> > Dave, how would you feel about merging changes to all the above
> > components through DRM tree? Merging all the above together would be the
> > easiest way, as the changes may have dependencies to each other.
> >
> > As I said, most of the development should be in omapdss, panels and
> > omapdrm. There would be an occasional fix for omapfb and omap_vout, or
> > small changes when omapdss changes require changes elsewhere.
>
> Ping. Do you have any thoughts of the above?
>
> We have a few patches for omapdrm for 3.10 that depend on omapdss
> patches. I'm currently acting as a fbdev maintainer (well, more like
> somebody who collects the fbdev patches that are quite surely ok), so I
> can take the problematic omapdrm patches via fbdev tree with the omapdss
> patches, if that's ok for you. And send the other omapdrm patches to be
> merged via drm tree.
>
> Or, I could take all the omapdrm patches via fbdev tree, if that's
> better. There aren't too many of them for 3.10.
--
Regards,
Laurent Pinchart
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* [PATCH 2/2] OMAPDSS: DPI: widen the pck search when using dss fck
From: Tomi Valkeinen @ 2013-04-11 9:35 UTC (permalink / raw)
To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen
In-Reply-To: <1365672662-612-1-git-send-email-tomi.valkeinen@ti.com>
When not using DSI PLL to generate the pixel clock, but DSS FCK, the
possible pixel clock rates are rather limited. DSS FCK is currently used
on OMAP2 and OMAP3.
When using Beagleboard with a monitor that supports high resolutions,
the clock rates do not match (at least for me) for the monitor's pixel
clocks within the current threshold in the code, which is +/- 1MHz.
This patch widens the search up to +/- 15MHz. The search is done in
steps, i.e. it first tries to find a rather exact clock, than a bit less
exact, etc. so this should not change the cases where a clock was
already found.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dpi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index abe1a4e2..e93c4de 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -222,10 +222,10 @@ static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx)
* DSS fck gives us very few possibilities, so finding a good pixel
* clock may not be possible. We try multiple times to find the clock,
* each time widening the pixel clock range we look for, up to
- * +/- 1MHz.
+ * +/- ~15MHz.
*/
- for (i = 0; i < 10; ++i) {
+ for (i = 0; i < 25; ++i) {
bool ok;
memset(ctx, 0, sizeof(*ctx));
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/2] OMAPDSS: fix dss_fck clock rate rounding
From: Tomi Valkeinen @ 2013-04-11 9:31 UTC (permalink / raw)
To: linux-omap, linux-fbdev, Archit Taneja; +Cc: Tomi Valkeinen
DSS func clock is calculated with prate / div * m. However, the current
omapdss code calculates it with prate * m / div, which yields a slightly
different result when there's a remainder. For example, 432000000 / 14 *
2 = 61714284, but 432000000 * 2 / 14 = 61714285.
In addition to that, the clock framework wants the clock rate given with
clk_set_rate to be higher than the actual (truncated) end result. So, if
prate is 432000000, and div is 14, the real result is 30857142.8571...
We need to call clk_set_rate with 30857143, which gives us a clock of
30857142. That's why we need to use DIV_ROUND_UP() when calling
clk_set_rate.
This patch fixes the clock calculation.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dss.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index fdd32e8..b9f6f24 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -480,6 +480,7 @@ bool dss_div_calc(unsigned long fck_min, dss_div_calc_func func, void *data)
unsigned long fck_hw_max;
unsigned long fckd_hw_max;
unsigned long prate;
+ unsigned m;
if (dss.dpll4_m4_ck = NULL) {
/*
@@ -495,15 +496,16 @@ bool dss_div_calc(unsigned long fck_min, dss_div_calc_func func, void *data)
fck_hw_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
fckd_hw_max = dss.feat->fck_div_max;
- prate = dss_get_dpll4_rate() * dss.feat->dss_fck_multiplier;
+ m = dss.feat->dss_fck_multiplier;
+ prate = dss_get_dpll4_rate();
fck_min = fck_min ? fck_min : 1;
- fckd_start = min(prate / fck_min, fckd_hw_max);
- fckd_stop = max(DIV_ROUND_UP(prate, fck_hw_max), 1ul);
+ fckd_start = min(prate * m / fck_min, fckd_hw_max);
+ fckd_stop = max(DIV_ROUND_UP(prate * m, fck_hw_max), 1ul);
for (fckd = fckd_start; fckd >= fckd_stop; --fckd) {
- fck = prate / fckd;
+ fck = prate / fckd * m;
if (func(fckd, fck, data))
return true;
@@ -521,7 +523,8 @@ int dss_set_clock_div(struct dss_clock_info *cinfo)
prate = clk_get_rate(clk_get_parent(dss.dpll4_m4_ck));
DSSDBG("dpll4_m4 = %ld\n", prate);
- r = clk_set_rate(dss.dpll4_m4_ck, prate / cinfo->fck_div);
+ r = clk_set_rate(dss.dpll4_m4_ck,
+ DIV_ROUND_UP(prate, cinfo->fck_div));
if (r)
return r;
} else {
@@ -531,7 +534,9 @@ int dss_set_clock_div(struct dss_clock_info *cinfo)
dss.dss_clk_rate = clk_get_rate(dss.dss_clk);
- WARN_ONCE(dss.dss_clk_rate != cinfo->fck, "clk rate mismatch");
+ WARN_ONCE(dss.dss_clk_rate != cinfo->fck,
+ "clk rate mismatch: %lu != %lu", dss.dss_clk_rate,
+ cinfo->fck);
DSSDBG("fck = %ld (%d)\n", cinfo->fck, cinfo->fck_div);
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH 13/30] video/s3c: move platform_data out of arch/arm
From: Jingoo Han @ 2013-04-11 5:12 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365638712-1028578-14-git-send-email-arnd@arndb.de>
On Thursday, April 11, 2013 9:05 AM, Arnd Bergmann wrote:
>
> The s3c-fb driver requires header files from the samsung platforms
> to find its platform_data definition, but this no longer works on
> multiplatform kernels, so let's move the data into a new header
> file under include/linux/platform_data.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Jingoo Han <jg1.han@samsung.com>
> ---
> arch/arm/plat-samsung/include/plat/fb.h | 50 +-----------------------------
> drivers/video/s3c-fb.c | 3 +-
> include/linux/platform_data/video_s3c.h | 54 +++++++++++++++++++++++++++++++++
> 3 files changed, 56 insertions(+), 51 deletions(-)
> create mode 100644 include/linux/platform_data/video_s3c.h
>
[.....]
> +struct s3c_fb_platdata {
> + void (*setup_gpio)(void);
> +
> + struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN];
> + struct fb_videomode *vtiming;
> +
> + u32 vidcon0;
> + u32 vidcon1;
> +};
> +
There is an unnecessary space.
When the patch is merged, this space should be removed.
Best regards,
Jingoo Han
> +#endif
> --
> 1.8.1.2
^ permalink raw reply
* Re: [PATCH 12/30] video/exynos: remove unnecessary header inclusions
From: Jingoo Han @ 2013-04-11 5:07 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365638712-1028578-13-git-send-email-arnd@arndb.de>
On Thursday, April 11, 2013 9:05 AM, Arnd Bergmann wrote:
>
> In multiplatform configurations, we cannot include headers
> provided by only the exynos platform. Fortunately a number
> of drivers that include those headers do not actually need
> them, so we can just remove the inclusions.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Jingoo Han <jg1.han@samsung.com>
CC'ed Tomi Valkeinen, Inki Dae, Donghwa Lee, Kyungmin Park
Acked-by: Jingoo Han <jg1.han@samsung.com>
Best regards,
Jingoo Han
> ---
> drivers/video/exynos/exynos_mipi_dsi.c | 2 --
> drivers/video/exynos/exynos_mipi_dsi_common.c | 2 --
> drivers/video/exynos/exynos_mipi_dsi_lowlevel.c | 2 --
> 3 files changed, 6 deletions(-)
>
> diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c
> index fac7df6..3dd43ca 100644
> --- a/drivers/video/exynos/exynos_mipi_dsi.c
> +++ b/drivers/video/exynos/exynos_mipi_dsi.c
> @@ -35,8 +35,6 @@
>
> #include <video/exynos_mipi_dsim.h>
>
> -#include <plat/fb.h>
> -
> #include "exynos_mipi_dsi_common.h"
> #include "exynos_mipi_dsi_lowlevel.h"
>
> diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c
> b/drivers/video/exynos/exynos_mipi_dsi_common.c
> index c70cb89..520fc9b 100644
> --- a/drivers/video/exynos/exynos_mipi_dsi_common.c
> +++ b/drivers/video/exynos/exynos_mipi_dsi_common.c
> @@ -31,8 +31,6 @@
> #include <video/mipi_display.h>
> #include <video/exynos_mipi_dsim.h>
>
> -#include <mach/map.h>
> -
> #include "exynos_mipi_dsi_regs.h"
> #include "exynos_mipi_dsi_lowlevel.h"
> #include "exynos_mipi_dsi_common.h"
> diff --git a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
> b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
> index 95cb99a..15c5abd 100644
> --- a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
> +++ b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
> @@ -26,8 +26,6 @@
>
> #include <video/exynos_mipi_dsim.h>
>
> -#include <mach/map.h>
> -
> #include "exynos_mipi_dsi_regs.h"
>
> void exynos_mipi_dsi_func_reset(struct mipi_dsim_device *dsim)
> --
> 1.8.1.2
^ permalink raw reply
* Re: [PATCH 13/30] video/s3c: move platform_data out of arch/arm
From: Jingoo Han @ 2013-04-11 4:34 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365638712-1028578-14-git-send-email-arnd@arndb.de>
On Thursday, April 11, 2013 9:05 AM, Arnd Bergmann wrote:
>
> The s3c-fb driver requires header files from the samsung platforms
> to find its platform_data definition, but this no longer works on
> multiplatform kernels, so let's move the data into a new header
> file under include/linux/platform_data.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Jingoo Han <jg1.han@samsung.com>
CC'ed Tomi Valkeinen.
Hi Arnd,
It looks good. Thank you for your patch. :)
Acked-by: Jingoo Han <jg1.han@samsung.com>
Best regards,
Jingoo Han
> ---
> arch/arm/plat-samsung/include/plat/fb.h | 50 +-----------------------------
> drivers/video/s3c-fb.c | 3 +-
> include/linux/platform_data/video_s3c.h | 54 +++++++++++++++++++++++++++++++++
> 3 files changed, 56 insertions(+), 51 deletions(-)
> create mode 100644 include/linux/platform_data/video_s3c.h
>
> diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h
> index b885322..9ae5072 100644
> --- a/arch/arm/plat-samsung/include/plat/fb.h
> +++ b/arch/arm/plat-samsung/include/plat/fb.h
> @@ -15,55 +15,7 @@
> #ifndef __PLAT_S3C_FB_H
> #define __PLAT_S3C_FB_H __FILE__
>
> -/* S3C_FB_MAX_WIN
> - * Set to the maximum number of windows that any of the supported hardware
> - * can use. Since the platform data uses this for an array size, having it
> - * set to the maximum of any version of the hardware can do is safe.
> - */
> -#define S3C_FB_MAX_WIN (5)
> -
> -/**
> - * struct s3c_fb_pd_win - per window setup data
> - * @xres : The window X size.
> - * @yres : The window Y size.
> - * @virtual_x: The virtual X size.
> - * @virtual_y: The virtual Y size.
> - */
> -struct s3c_fb_pd_win {
> - unsigned short default_bpp;
> - unsigned short max_bpp;
> - unsigned short xres;
> - unsigned short yres;
> - unsigned short virtual_x;
> - unsigned short virtual_y;
> -};
> -
> -/**
> - * struct s3c_fb_platdata - S3C driver platform specific information
> - * @setup_gpio: Setup the external GPIO pins to the right state to transfer
> - * the data from the display system to the connected display
> - * device.
> - * @vidcon0: The base vidcon0 values to control the panel data format.
> - * @vidcon1: The base vidcon1 values to control the panel data output.
> - * @vtiming: Video timing when connected to a RGB type panel.
> - * @win: The setup data for each hardware window, or NULL for unused.
> - * @display_mode: The LCD output display mode.
> - *
> - * The platform data supplies the video driver with all the information
> - * it requires to work with the display(s) attached to the machine. It
> - * controls the initial mode, the number of display windows (0 is always
> - * the base framebuffer) that are initialised etc.
> - *
> - */
> -struct s3c_fb_platdata {
> - void (*setup_gpio)(void);
> -
> - struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN];
> - struct fb_videomode *vtiming;
> -
> - u32 vidcon0;
> - u32 vidcon1;
> -};
> +#include <linux/platform_data/video_s3c.h>
>
> /**
> * s3c_fb_set_platdata() - Setup the FB device with platform data.
> diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
> index 968a625..2e7991c 100644
> --- a/drivers/video/s3c-fb.c
> +++ b/drivers/video/s3c-fb.c
> @@ -24,10 +24,9 @@
> #include <linux/uaccess.h>
> #include <linux/interrupt.h>
> #include <linux/pm_runtime.h>
> +#include <linux/platform_data/video_s3c.h>
>
> #include <video/samsung_fimd.h>
> -#include <mach/map.h>
> -#include <plat/fb.h>
>
> /* This driver will export a number of framebuffer interfaces depending
> * on the configuration passed in via the platform data. Each fb instance
> diff --git a/include/linux/platform_data/video_s3c.h b/include/linux/platform_data/video_s3c.h
> new file mode 100644
> index 0000000..fa40f96
> --- /dev/null
> +++ b/include/linux/platform_data/video_s3c.h
> @@ -0,0 +1,54 @@
> +#ifndef __PLATFORM_DATA_VIDEO_S3C
> +#define __PLATFORM_DATA_VIDEO_S3C
> +
> +/* S3C_FB_MAX_WIN
> + * Set to the maximum number of windows that any of the supported hardware
> + * can use. Since the platform data uses this for an array size, having it
> + * set to the maximum of any version of the hardware can do is safe.
> + */
> +#define S3C_FB_MAX_WIN (5)
> +
> +/**
> + * struct s3c_fb_pd_win - per window setup data
> + * @xres : The window X size.
> + * @yres : The window Y size.
> + * @virtual_x: The virtual X size.
> + * @virtual_y: The virtual Y size.
> + */
> +struct s3c_fb_pd_win {
> + unsigned short default_bpp;
> + unsigned short max_bpp;
> + unsigned short xres;
> + unsigned short yres;
> + unsigned short virtual_x;
> + unsigned short virtual_y;
> +};
> +
> +/**
> + * struct s3c_fb_platdata - S3C driver platform specific information
> + * @setup_gpio: Setup the external GPIO pins to the right state to transfer
> + * the data from the display system to the connected display
> + * device.
> + * @vidcon0: The base vidcon0 values to control the panel data format.
> + * @vidcon1: The base vidcon1 values to control the panel data output.
> + * @vtiming: Video timing when connected to a RGB type panel.
> + * @win: The setup data for each hardware window, or NULL for unused.
> + * @display_mode: The LCD output display mode.
> + *
> + * The platform data supplies the video driver with all the information
> + * it requires to work with the display(s) attached to the machine. It
> + * controls the initial mode, the number of display windows (0 is always
> + * the base framebuffer) that are initialised etc.
> + *
> + */
> +struct s3c_fb_platdata {
> + void (*setup_gpio)(void);
> +
> + struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN];
> + struct fb_videomode *vtiming;
> +
> + u32 vidcon0;
> + u32 vidcon1;
> +};
> +
> +#endif
> --
> 1.8.1.2
^ permalink raw reply
* [PATCH 13/30] video/s3c: move platform_data out of arch/arm
From: Arnd Bergmann @ 2013-04-11 0:04 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365638712-1028578-1-git-send-email-arnd@arndb.de>
The s3c-fb driver requires header files from the samsung platforms
to find its platform_data definition, but this no longer works on
multiplatform kernels, so let's move the data into a new header
file under include/linux/platform_data.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: linux-fbdev@vger.kernel.org
Cc: Jingoo Han <jg1.han@samsung.com>
---
arch/arm/plat-samsung/include/plat/fb.h | 50 +-----------------------------
drivers/video/s3c-fb.c | 3 +-
include/linux/platform_data/video_s3c.h | 54 +++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 51 deletions(-)
create mode 100644 include/linux/platform_data/video_s3c.h
diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h
index b885322..9ae5072 100644
--- a/arch/arm/plat-samsung/include/plat/fb.h
+++ b/arch/arm/plat-samsung/include/plat/fb.h
@@ -15,55 +15,7 @@
#ifndef __PLAT_S3C_FB_H
#define __PLAT_S3C_FB_H __FILE__
-/* S3C_FB_MAX_WIN
- * Set to the maximum number of windows that any of the supported hardware
- * can use. Since the platform data uses this for an array size, having it
- * set to the maximum of any version of the hardware can do is safe.
- */
-#define S3C_FB_MAX_WIN (5)
-
-/**
- * struct s3c_fb_pd_win - per window setup data
- * @xres : The window X size.
- * @yres : The window Y size.
- * @virtual_x: The virtual X size.
- * @virtual_y: The virtual Y size.
- */
-struct s3c_fb_pd_win {
- unsigned short default_bpp;
- unsigned short max_bpp;
- unsigned short xres;
- unsigned short yres;
- unsigned short virtual_x;
- unsigned short virtual_y;
-};
-
-/**
- * struct s3c_fb_platdata - S3C driver platform specific information
- * @setup_gpio: Setup the external GPIO pins to the right state to transfer
- * the data from the display system to the connected display
- * device.
- * @vidcon0: The base vidcon0 values to control the panel data format.
- * @vidcon1: The base vidcon1 values to control the panel data output.
- * @vtiming: Video timing when connected to a RGB type panel.
- * @win: The setup data for each hardware window, or NULL for unused.
- * @display_mode: The LCD output display mode.
- *
- * The platform data supplies the video driver with all the information
- * it requires to work with the display(s) attached to the machine. It
- * controls the initial mode, the number of display windows (0 is always
- * the base framebuffer) that are initialised etc.
- *
- */
-struct s3c_fb_platdata {
- void (*setup_gpio)(void);
-
- struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN];
- struct fb_videomode *vtiming;
-
- u32 vidcon0;
- u32 vidcon1;
-};
+#include <linux/platform_data/video_s3c.h>
/**
* s3c_fb_set_platdata() - Setup the FB device with platform data.
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 968a625..2e7991c 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -24,10 +24,9 @@
#include <linux/uaccess.h>
#include <linux/interrupt.h>
#include <linux/pm_runtime.h>
+#include <linux/platform_data/video_s3c.h>
#include <video/samsung_fimd.h>
-#include <mach/map.h>
-#include <plat/fb.h>
/* This driver will export a number of framebuffer interfaces depending
* on the configuration passed in via the platform data. Each fb instance
diff --git a/include/linux/platform_data/video_s3c.h b/include/linux/platform_data/video_s3c.h
new file mode 100644
index 0000000..fa40f96
--- /dev/null
+++ b/include/linux/platform_data/video_s3c.h
@@ -0,0 +1,54 @@
+#ifndef __PLATFORM_DATA_VIDEO_S3C
+#define __PLATFORM_DATA_VIDEO_S3C
+
+/* S3C_FB_MAX_WIN
+ * Set to the maximum number of windows that any of the supported hardware
+ * can use. Since the platform data uses this for an array size, having it
+ * set to the maximum of any version of the hardware can do is safe.
+ */
+#define S3C_FB_MAX_WIN (5)
+
+/**
+ * struct s3c_fb_pd_win - per window setup data
+ * @xres : The window X size.
+ * @yres : The window Y size.
+ * @virtual_x: The virtual X size.
+ * @virtual_y: The virtual Y size.
+ */
+struct s3c_fb_pd_win {
+ unsigned short default_bpp;
+ unsigned short max_bpp;
+ unsigned short xres;
+ unsigned short yres;
+ unsigned short virtual_x;
+ unsigned short virtual_y;
+};
+
+/**
+ * struct s3c_fb_platdata - S3C driver platform specific information
+ * @setup_gpio: Setup the external GPIO pins to the right state to transfer
+ * the data from the display system to the connected display
+ * device.
+ * @vidcon0: The base vidcon0 values to control the panel data format.
+ * @vidcon1: The base vidcon1 values to control the panel data output.
+ * @vtiming: Video timing when connected to a RGB type panel.
+ * @win: The setup data for each hardware window, or NULL for unused.
+ * @display_mode: The LCD output display mode.
+ *
+ * The platform data supplies the video driver with all the information
+ * it requires to work with the display(s) attached to the machine. It
+ * controls the initial mode, the number of display windows (0 is always
+ * the base framebuffer) that are initialised etc.
+ *
+ */
+struct s3c_fb_platdata {
+ void (*setup_gpio)(void);
+
+ struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN];
+ struct fb_videomode *vtiming;
+
+ u32 vidcon0;
+ u32 vidcon1;
+};
+
+#endif
--
1.8.1.2
^ permalink raw reply related
* [PATCH 12/30] video/exynos: remove unnecessary header inclusions
From: Arnd Bergmann @ 2013-04-11 0:04 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1365638712-1028578-1-git-send-email-arnd@arndb.de>
In multiplatform configurations, we cannot include headers
provided by only the exynos platform. Fortunately a number
of drivers that include those headers do not actually need
them, so we can just remove the inclusions.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: linux-fbdev@vger.kernel.org
Cc: Jingoo Han <jg1.han@samsung.com>
---
drivers/video/exynos/exynos_mipi_dsi.c | 2 --
drivers/video/exynos/exynos_mipi_dsi_common.c | 2 --
drivers/video/exynos/exynos_mipi_dsi_lowlevel.c | 2 --
3 files changed, 6 deletions(-)
diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c
index fac7df6..3dd43ca 100644
--- a/drivers/video/exynos/exynos_mipi_dsi.c
+++ b/drivers/video/exynos/exynos_mipi_dsi.c
@@ -35,8 +35,6 @@
#include <video/exynos_mipi_dsim.h>
-#include <plat/fb.h>
-
#include "exynos_mipi_dsi_common.h"
#include "exynos_mipi_dsi_lowlevel.h"
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c b/drivers/video/exynos/exynos_mipi_dsi_common.c
index c70cb89..520fc9b 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_common.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_common.c
@@ -31,8 +31,6 @@
#include <video/mipi_display.h>
#include <video/exynos_mipi_dsim.h>
-#include <mach/map.h>
-
#include "exynos_mipi_dsi_regs.h"
#include "exynos_mipi_dsi_lowlevel.h"
#include "exynos_mipi_dsi_common.h"
diff --git a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
index 95cb99a..15c5abd 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
@@ -26,8 +26,6 @@
#include <video/exynos_mipi_dsim.h>
-#include <mach/map.h>
-
#include "exynos_mipi_dsi_regs.h"
void exynos_mipi_dsi_func_reset(struct mipi_dsim_device *dsim)
--
1.8.1.2
^ permalink raw reply related
* [PATCH 00/30] ARM: exynos multiplatform support
From: Arnd Bergmann @ 2013-04-11 0:04 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, Kukjin Kim, linux-samsung-soc, Arnd Bergmann, stern,
a.zummo, ben-linux, cjb, dwmw2, grant.likely, gregkh, jg1.han,
john.stultz, broonie, mchehab, mturquette, padma.kvr,
thierry.reding, tglx, t.figa, wsa, rui.zhang, alsa-devel,
linux-fbdev, linux-i2c, linux-media, linux-mmc, linux-mtd,
linux-pm, linux-serial, linux-usb, rtc-linux, spi-devel-general
Hi everyone,
I have updated my series for multiplatform support of the ARM exynos
platform, based on what is currently queued up in arm-soc.
It would be really nice to still get this merged for 3.10. A lot of
the patches are really trivial, but there are some complex ones
as well.
To all subsystem maintainers: feel free to directly apply the patches
for your subsystem, there should be no dependencies between any of them,
aside from the last patch requiring all of the earlier ones to be applied
first. Getting an Ack is also fine so we can put the patches into arm-soc.
Arnd
Arnd Bergmann (30):
ARM: exynos: introduce EXYNOS_ATAGS symbol
ARM: exynos: prepare for sparse IRQ
ARM: exynos: move debug-macro.S to include/debug/
ARM: samsung: move mfc device definition to s5p-dev-mfc.c
tty: serial/samsung: prepare for common clock API
tty: serial/samsung: make register definitions global
tty: serial/samsung: fix modular build
i2c: s3c2410: make header file local
mmc: sdhci-s3c: remove platform dependencies
usb: exynos: do not include plat/usb-phy.h
[media] exynos: remove unnecessary header inclusions
video/exynos: remove unnecessary header inclusions
video/s3c: move platform_data out of arch/arm
thermal/exynos: remove unnecessary header inclusions
mtd: onenand/samsung: make regs-onenand.h file local
rtc: s3c: make header file local
pwm: samsung: repair the worst MMIO abuses
ASoC: samsung: move plat/ headers to local directory
ASoC: samsung: use irq resource for idma
ASoC: samsung: convert to dmaengine API
ASoC: samsung/i2s: fix module_device_table
ASoC: samsung/idma: export idma_reg_addr_init
clk: exynos: prepare for multiplatform
clocksource: exynos_mct: remove platform header dependency
irqchip: exynos: pass max combiner number to combiner_init
irqchip: exynos: allocate combiner_data dynamically
irqchip: exynos: localize irq lookup for ATAGS
irqchip: exynos: pass irq_base from platform
spi: s3c64xx: move to generic dmaengine API
ARM: exynos: enable multiplatform support
arch/arm/Kconfig | 10 +-
arch/arm/Kconfig.debug | 8 +
arch/arm/configs/exynos4_defconfig | 2 +-
.../mach/debug-macro.S => include/debug/exynos.S} | 12 +-
.../plat/debug-macro.S => include/debug/samsung.S} | 2 +-
arch/arm/mach-exynos/Kconfig | 40 ++-
arch/arm/mach-exynos/Makefile | 5 +-
arch/arm/mach-exynos/common.c | 26 +-
arch/arm/mach-exynos/common.h | 7 +-
arch/arm/mach-exynos/dev-uart.c | 1 +
arch/arm/mach-exynos/include/mach/irqs.h | 5 +-
arch/arm/mach-exynos/mach-armlex4210.c | 2 +
arch/arm/mach-exynos/mach-exynos4-dt.c | 3 +
arch/arm/mach-exynos/mach-exynos5-dt.c | 2 +
arch/arm/mach-exynos/mach-nuri.c | 2 +
arch/arm/mach-exynos/mach-origen.c | 2 +
arch/arm/mach-exynos/mach-smdk4x12.c | 2 +
arch/arm/mach-exynos/mach-smdkv310.c | 3 +
arch/arm/mach-exynos/setup-sdhci-gpio.c | 2 +-
arch/arm/mach-exynos/setup-usb-phy.c | 8 +-
arch/arm/mach-s3c24xx/clock-s3c2440.c | 5 +
arch/arm/mach-s3c24xx/common.c | 5 +
arch/arm/mach-s3c24xx/dma-s3c2410.c | 2 -
arch/arm/mach-s3c24xx/dma-s3c2412.c | 2 -
arch/arm/mach-s3c24xx/dma-s3c2440.c | 2 -
arch/arm/mach-s3c24xx/dma-s3c2443.c | 2 -
arch/arm/mach-s3c24xx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s3c24xx/mach-rx1950.c | 1 -
arch/arm/mach-s3c64xx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s3c64xx/setup-usb-phy.c | 4 +-
arch/arm/mach-s5p64x0/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s5pc100/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s5pc100/setup-sdhci-gpio.c | 1 -
arch/arm/mach-s5pv210/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s5pv210/setup-sdhci-gpio.c | 1 -
arch/arm/mach-s5pv210/setup-usb-phy.c | 4 +-
arch/arm/plat-samsung/Kconfig | 7 +-
arch/arm/plat-samsung/Makefile | 8 +-
arch/arm/plat-samsung/devs.c | 62 ++---
arch/arm/plat-samsung/include/plat/fb.h | 50 +---
arch/arm/plat-samsung/include/plat/pm.h | 5 +
arch/arm/plat-samsung/include/plat/regs-serial.h | 282 +--------------------
arch/arm/plat-samsung/include/plat/sdhci.h | 56 +---
arch/arm/plat-samsung/include/plat/usb-phy.h | 5 +-
arch/arm/plat-samsung/irq-vic-timer.c | 1 +
arch/arm/plat-samsung/pm.c | 1 +
arch/arm/plat-samsung/s5p-dev-mfc.c | 42 ++-
arch/arm/plat-samsung/s5p-irq.c | 1 +
drivers/clk/samsung/clk-exynos4.c | 93 +++----
drivers/clk/samsung/clk-exynos5250.c | 1 -
drivers/clk/samsung/clk-exynos5440.c | 1 -
drivers/clk/samsung/clk.h | 2 -
drivers/clocksource/exynos_mct.c | 21 +-
drivers/gpio/Makefile | 2 +-
drivers/i2c/busses/i2c-s3c2410.c | 3 +-
.../regs-iic.h => drivers/i2c/busses/i2c-s3c2410.h | 0
drivers/irqchip/exynos-combiner.c | 116 +++++----
drivers/media/platform/exynos-gsc/gsc-regs.c | 1 -
drivers/media/platform/s5p-tv/sii9234_drv.c | 3 -
drivers/mmc/host/Kconfig | 2 +-
.../mmc/host/sdhci-s3c-regs.h | 0
drivers/mmc/host/sdhci-s3c.c | 5 +-
drivers/mtd/onenand/samsung.c | 4 +-
.../mtd/onenand/samsung.h | 2 -
drivers/pwm/pwm-samsung.c | 60 +++--
drivers/rtc/rtc-s3c.c | 3 +-
.../plat/regs-rtc.h => drivers/rtc/rtc-s3c.h | 3 +-
drivers/spi/spi-s3c64xx.c | 185 ++++++++++----
drivers/thermal/exynos_thermal.c | 2 -
drivers/tty/serial/samsung.c | 17 +-
drivers/tty/serial/samsung.h | 4 +-
drivers/usb/host/ehci-s5p.c | 1 -
drivers/usb/host/ohci-exynos.c | 1 -
drivers/video/exynos/exynos_mipi_dsi.c | 2 -
drivers/video/exynos/exynos_mipi_dsi_common.c | 2 -
drivers/video/exynos/exynos_mipi_dsi_lowlevel.c | 2 -
drivers/video/s3c-fb.c | 3 +-
include/linux/platform_data/mmc-sdhci-s3c.h | 56 ++++
include/linux/platform_data/spi-s3c64xx.h | 3 +
include/linux/platform_data/video_s3c.h | 54 ++++
include/linux/serial_s3c.h | 260 +++++++++++++++++++
sound/soc/samsung/ac97.c | 2 +-
sound/soc/samsung/dma.c | 219 ++++++++++++++++
sound/soc/samsung/dma.h | 15 +-
sound/soc/samsung/h1940_uda1380.c | 2 +-
sound/soc/samsung/i2s.c | 4 +-
sound/soc/samsung/idma.c | 11 +-
sound/soc/samsung/neo1973_wm8753.c | 2 +-
sound/soc/samsung/pcm.c | 1 -
.../include/plat => sound/soc/samsung}/regs-ac97.h | 0
.../include/plat => sound/soc/samsung}/regs-iis.h | 0
sound/soc/samsung/rx1950_uda1380.c | 2 +-
sound/soc/samsung/s3c24xx-i2s.c | 2 +-
sound/soc/samsung/s3c24xx_uda134x.c | 2 +-
sound/soc/samsung/spdif.c | 1 -
95 files changed, 1146 insertions(+), 734 deletions(-)
rename arch/arm/{mach-exynos/include/mach/debug-macro.S => include/debug/exynos.S} (84%)
rename arch/arm/{plat-samsung/include/plat/debug-macro.S => include/debug/samsung.S} (98%)
rename arch/arm/plat-samsung/include/plat/regs-iic.h => drivers/i2c/busses/i2c-s3c2410.h (100%)
rename arch/arm/plat-samsung/include/plat/regs-sdhci.h => drivers/mmc/host/sdhci-s3c-regs.h (100%)
rename arch/arm/plat-samsung/include/plat/regs-onenand.h => drivers/mtd/onenand/samsung.h (98%)
rename arch/arm/plat-samsung/include/plat/regs-rtc.h => drivers/rtc/rtc-s3c.h (97%)
create mode 100644 include/linux/platform_data/mmc-sdhci-s3c.h
create mode 100644 include/linux/platform_data/video_s3c.h
create mode 100644 include/linux/serial_s3c.h
rename {arch/arm/plat-samsung/include/plat => sound/soc/samsung}/regs-ac97.h (100%)
rename {arch/arm/plat-samsung/include/plat => sound/soc/samsung}/regs-iis.h (100%)
--
1.8.1.2
Cc: stern@rowland.harvard.edu
Cc: a.zummo@towertech.it
Cc: ben-linux@fluff.org
Cc: cjb@laptop.org
Cc: dwmw2@infradead.org
Cc: grant.likely@secretlab.ca
Cc: gregkh@linuxfoundation.org
Cc: jg1.han@samsung.com
Cc: john.stultz@linaro.org
Cc: broonie@opensource.wolfsonmicro.com
Cc: mchehab@redhat.com
Cc: mturquette@linaro.org
Cc: padma.kvr@gmail.com
Cc: thierry.reding@avionic-design.de
Cc: tglx@linutronix.de
Cc: t.figa@samsung.com
Cc: wsa@the-dreams.de
Cc: rui.zhang@intel.com
Cc: alsa-devel@alsa-project.org
Cc: linux-fbdev@vger.kernel.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: linux-mmc@vger.kernel.org
Cc: linux-mtd@lists.infradead.org
Cc: linux-pm@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: rtc-linux@googlegroups.com
Cc: spi-devel-general@lists.sourceforge.net
.
^ permalink raw reply
* Re: How to manage OMAP display drivers in the future
From: Tomi Valkeinen @ 2013-04-10 10:00 UTC (permalink / raw)
To: Dave Airlie; +Cc: linux-fbdev, dri-devel@lists.freedesktop.org
In-Reply-To: <51403F91.7070401@iki.fi>
[-- Attachment #1: Type: text/plain, Size: 2959 bytes --]
Hi Dave,
On 2013-03-13 10:57, Tomi Valkeinen wrote:
> Hi Dave,
>
> I'm writing this mail to get some ideas how we should manage OMAP's
> display drivers in the future.
>
> As a short intro, we have the following players around:
>
> omapdss - omapdss handles the DSS (display subsystem) hardware. omapdss
> doesn't do any buffer management or expose any userspace API (except a
> few sysfs files), so it doesn't do anything by itself.
> (drivers/video/omap2/dss/)
>
> panel drivers - Drivers for various panel models. The panel drivers use
> omapdss API to manage the video bus. (drivers/video/omap2/displays/)
>
> omapfb - Framebuffer driver, uses omapdss to handle the HW.
> (drivers/video/omap2/omapfb/)
>
> omap_vout - V4L2 driver for showing video, uses omapdss to handle the
> HW. (drivers/media/platform/omap/)
>
> omapdrm - DRM driver, uses omapdss to handle the HW.
> (drivers/gpu/drm/omapdrm/)
>
> omapdss and the panel drivers form the lowest level layer. omapfb and
> omap_vout can be used at the same time, but omapdrm must be used alone,
> without omapfb or omap_vout.
>
> omapfb and omap_vout are not much developed anymore, even though they
> are still commonly used. Most of the development happens in omapdss,
> panel drivers and omapdrm.
>
> So that's what we have now. In the distant future I see omapfb and
> omap_vout disappear totally, the panel drivers would be made generic
> using Common Display Framework, and omapdss and omapdrm would more or
> less be merged together. However, all that is still far away, and we
> need some plan to go forward for now.
>
> Most pressing question is how to get OMAP display patches merged. It
> seems that there's not really an fbdev maintainer for the time being,
> and fbdev tree has been the route for omapdss, panels and omapfb in the
> past. Now that omapdrm is the new main driver for omap display, fbdev
> would be somewhat wrong in any case.
>
> Dave, how would you feel about merging changes to all the above
> components through DRM tree? Merging all the above together would be the
> easiest way, as the changes may have dependencies to each other.
>
> As I said, most of the development should be in omapdss, panels and
> omapdrm. There would be an occasional fix for omapfb and omap_vout, or
> small changes when omapdss changes require changes elsewhere.
Ping. Do you have any thoughts of the above?
We have a few patches for omapdrm for 3.10 that depend on omapdss
patches. I'm currently acting as a fbdev maintainer (well, more like
somebody who collects the fbdev patches that are quite surely ok), so I
can take the problematic omapdrm patches via fbdev tree with the omapdss
patches, if that's ok for you. And send the other omapdrm patches to be
merged via drm tree.
Or, I could take all the omapdrm patches via fbdev tree, if that's
better. There aren't too many of them for 3.10.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]
^ permalink raw reply
* Re: [PATCH] omapdss: use devm_clk_get()
From: Archit Taneja @ 2013-04-10 9:41 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <516530B1.80203@ti.com>
On Wednesday 10 April 2013 02:58 PM, Archit Taneja wrote:
> On Wednesday 10 April 2013 02:49 PM, Tomi Valkeinen wrote:
>> On 2013-04-10 11:37, Archit Taneja wrote:
>>> On Wednesday 10 April 2013 01:43 PM, Tomi Valkeinen wrote:
>>>> On 2013-04-08 11:55, Archit Taneja wrote:
>>>>> Use devm_clk_get() instead of clk_get() for dss, and for outputs hdmi
>>>>> and venc.
>>>>> This reduces reduces code and simplifies error handling.
>>>>>
>>>>> Signed-off-by: Archit Taneja <archit@ti.com>
>>>>> ---
>>>>> drivers/video/omap2/dss/dss.c | 18 +++---------------
>>>>> drivers/video/omap2/dss/hdmi.c | 16 ++--------------
>>>>> drivers/video/omap2/dss/venc.c | 10 +---------
>>>>> 3 files changed, 6 insertions(+), 38 deletions(-)
>>>>>
>>>>> diff --git a/drivers/video/omap2/dss/dss.c
>>>>> b/drivers/video/omap2/dss/dss.c
>>>>> index 054c2a2..645b3bc 100644
>>>>> --- a/drivers/video/omap2/dss/dss.c
>>>>> +++ b/drivers/video/omap2/dss/dss.c
>>>>> @@ -767,13 +767,11 @@ int dss_dpi_select_source(enum omap_channel
>>>>> channel)
>>>>> static int dss_get_clocks(void)
>>>>> {
>>>>> struct clk *clk;
>>>>> - int r;
>>>>>
>>>>> - clk = clk_get(&dss.pdev->dev, "fck");
>>>>> + clk = devm_clk_get(&dss.pdev->dev, "fck");
>>>>> if (IS_ERR(clk)) {
>>>>> DSSERR("can't get clock fck\n");
>>>>> - r = PTR_ERR(clk);
>>>>> - goto err;
>>>>> + return PTR_ERR(clk);
>>>>> }
>>>>>
>>>>> dss.dss_clk = clk;
>>>>> @@ -782,8 +780,7 @@ static int dss_get_clocks(void)
>>>>> clk = clk_get(NULL, dss.feat->clk_name);
>>>>> if (IS_ERR(clk)) {
>>>>> DSSERR("Failed to get %s\n", dss.feat->clk_name);
>>>>> - r = PTR_ERR(clk);
>>>>> - goto err;
>>>>> + return PTR_ERR(clk);
>>>>> }
>>>>> } else {
>>>>> clk = NULL;
>>>>> @@ -792,21 +789,12 @@ static int dss_get_clocks(void)
>>>>> dss.dpll4_m4_ck = clk;
>>>>>
>>>>> return 0;
>>>>> -
>>>>> -err:
>>>>> - if (dss.dss_clk)
>>>>> - clk_put(dss.dss_clk);
>>>>> - if (dss.dpll4_m4_ck)
>>>>> - clk_put(dss.dpll4_m4_ck);
>>>>> -
>>>>> - return r;
>>>>> }
>>>>
>>>> Why didn't you use devm_clk_get for the dpll4_m4_ck clock also?
>>>
>>> clk_get of dpll4_m4_ck isn't tied to a device:
>>>
>>> clk = clk_get(NULL, dss.feat->clk_name);
>>>
>>> We can't use devm_clk_get() if we don't tie it to a device, right?
>>
>> Ah, true.
>>
>>> I think the dss.dss_clk clock above is same as the dpll4_m4_ck for all
>>> OMAPs. We could probably remove the dpll4_m4_clk all together, and use
>>> dss_clk to get the rate of DSS_FCK coming from PRCM.
>>
>> Hmm, no, if I recall right, dpll4_m4_clk is the parent of dss clock (or
>> parent of the parent of...), and the dss_fck_multiplier affects the
>> resulting dss fck. Or something like that. It's a bit messy, especially
>> as we can't just use the dss fck to change the rate, we need to change
>> the rate at the parent for some reason.
>
> Ah ok, I remember it now. One of the DPLL's divider's output is DSS_FCK.
> We get the parent's rate and iterate through all the possible hsdivider
> values to get the closest pixel clock. We don't/can't change
> dpll4_m4_clk as such, we just need to know it's rate for our calculations.
>
> So yes, we need dpll4_m4_clk, we just need to rename it to a better
> thing. Like dss_clk_parent.
>
> Anyway,
Sorry, hit the send button before completing the message. I wanted to
add that we could push this patch as it is.
Archit
^ permalink raw reply
* Re: [PATCH] omapdss: use devm_clk_get()
From: Archit Taneja @ 2013-04-10 9:40 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <51652EA4.9010606@ti.com>
On Wednesday 10 April 2013 02:49 PM, Tomi Valkeinen wrote:
> On 2013-04-10 11:37, Archit Taneja wrote:
>> On Wednesday 10 April 2013 01:43 PM, Tomi Valkeinen wrote:
>>> On 2013-04-08 11:55, Archit Taneja wrote:
>>>> Use devm_clk_get() instead of clk_get() for dss, and for outputs hdmi
>>>> and venc.
>>>> This reduces reduces code and simplifies error handling.
>>>>
>>>> Signed-off-by: Archit Taneja <archit@ti.com>
>>>> ---
>>>> drivers/video/omap2/dss/dss.c | 18 +++---------------
>>>> drivers/video/omap2/dss/hdmi.c | 16 ++--------------
>>>> drivers/video/omap2/dss/venc.c | 10 +---------
>>>> 3 files changed, 6 insertions(+), 38 deletions(-)
>>>>
>>>> diff --git a/drivers/video/omap2/dss/dss.c
>>>> b/drivers/video/omap2/dss/dss.c
>>>> index 054c2a2..645b3bc 100644
>>>> --- a/drivers/video/omap2/dss/dss.c
>>>> +++ b/drivers/video/omap2/dss/dss.c
>>>> @@ -767,13 +767,11 @@ int dss_dpi_select_source(enum omap_channel
>>>> channel)
>>>> static int dss_get_clocks(void)
>>>> {
>>>> struct clk *clk;
>>>> - int r;
>>>>
>>>> - clk = clk_get(&dss.pdev->dev, "fck");
>>>> + clk = devm_clk_get(&dss.pdev->dev, "fck");
>>>> if (IS_ERR(clk)) {
>>>> DSSERR("can't get clock fck\n");
>>>> - r = PTR_ERR(clk);
>>>> - goto err;
>>>> + return PTR_ERR(clk);
>>>> }
>>>>
>>>> dss.dss_clk = clk;
>>>> @@ -782,8 +780,7 @@ static int dss_get_clocks(void)
>>>> clk = clk_get(NULL, dss.feat->clk_name);
>>>> if (IS_ERR(clk)) {
>>>> DSSERR("Failed to get %s\n", dss.feat->clk_name);
>>>> - r = PTR_ERR(clk);
>>>> - goto err;
>>>> + return PTR_ERR(clk);
>>>> }
>>>> } else {
>>>> clk = NULL;
>>>> @@ -792,21 +789,12 @@ static int dss_get_clocks(void)
>>>> dss.dpll4_m4_ck = clk;
>>>>
>>>> return 0;
>>>> -
>>>> -err:
>>>> - if (dss.dss_clk)
>>>> - clk_put(dss.dss_clk);
>>>> - if (dss.dpll4_m4_ck)
>>>> - clk_put(dss.dpll4_m4_ck);
>>>> -
>>>> - return r;
>>>> }
>>>
>>> Why didn't you use devm_clk_get for the dpll4_m4_ck clock also?
>>
>> clk_get of dpll4_m4_ck isn't tied to a device:
>>
>> clk = clk_get(NULL, dss.feat->clk_name);
>>
>> We can't use devm_clk_get() if we don't tie it to a device, right?
>
> Ah, true.
>
>> I think the dss.dss_clk clock above is same as the dpll4_m4_ck for all
>> OMAPs. We could probably remove the dpll4_m4_clk all together, and use
>> dss_clk to get the rate of DSS_FCK coming from PRCM.
>
> Hmm, no, if I recall right, dpll4_m4_clk is the parent of dss clock (or
> parent of the parent of...), and the dss_fck_multiplier affects the
> resulting dss fck. Or something like that. It's a bit messy, especially
> as we can't just use the dss fck to change the rate, we need to change
> the rate at the parent for some reason.
Ah ok, I remember it now. One of the DPLL's divider's output is DSS_FCK.
We get the parent's rate and iterate through all the possible hsdivider
values to get the closest pixel clock. We don't/can't change
dpll4_m4_clk as such, we just need to know it's rate for our calculations.
So yes, we need dpll4_m4_clk, we just need to rename it to a better
thing. Like dss_clk_parent.
Anyway,
Archit
^ permalink raw reply
* Re: [PATCH] omapdss: use devm_clk_get()
From: Tomi Valkeinen @ 2013-04-10 9:32 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
In-Reply-To: <516530B1.80203@ti.com>
[-- Attachment #1: Type: text/plain, Size: 732 bytes --]
On 2013-04-10 12:28, Archit Taneja wrote:
> Ah ok, I remember it now. One of the DPLL's divider's output is DSS_FCK.
> We get the parent's rate and iterate through all the possible hsdivider
> values to get the closest pixel clock. We don't/can't change
> dpll4_m4_clk as such, we just need to know it's rate for our calculations.
>
> So yes, we need dpll4_m4_clk, we just need to rename it to a better
> thing. Like dss_clk_parent.
Right. And the field name in struct dss_features, "clk_name" is rather
vague.
At some point we should fix the omap clk framework so that we can set
the dss fck directly. Presuming there's no good reason to have it as it
is now.
I'll apply the patch as it is now.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]
^ permalink raw reply
* Re: [PATCH] omapdss: use devm_clk_get()
From: Tomi Valkeinen @ 2013-04-10 9:19 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-omap, linux-fbdev
In-Reply-To: <516524B8.60205@ti.com>
[-- Attachment #1: Type: text/plain, Size: 2818 bytes --]
On 2013-04-10 11:37, Archit Taneja wrote:
> On Wednesday 10 April 2013 01:43 PM, Tomi Valkeinen wrote:
>> On 2013-04-08 11:55, Archit Taneja wrote:
>>> Use devm_clk_get() instead of clk_get() for dss, and for outputs hdmi
>>> and venc.
>>> This reduces reduces code and simplifies error handling.
>>>
>>> Signed-off-by: Archit Taneja <archit@ti.com>
>>> ---
>>> drivers/video/omap2/dss/dss.c | 18 +++---------------
>>> drivers/video/omap2/dss/hdmi.c | 16 ++--------------
>>> drivers/video/omap2/dss/venc.c | 10 +---------
>>> 3 files changed, 6 insertions(+), 38 deletions(-)
>>>
>>> diff --git a/drivers/video/omap2/dss/dss.c
>>> b/drivers/video/omap2/dss/dss.c
>>> index 054c2a2..645b3bc 100644
>>> --- a/drivers/video/omap2/dss/dss.c
>>> +++ b/drivers/video/omap2/dss/dss.c
>>> @@ -767,13 +767,11 @@ int dss_dpi_select_source(enum omap_channel
>>> channel)
>>> static int dss_get_clocks(void)
>>> {
>>> struct clk *clk;
>>> - int r;
>>>
>>> - clk = clk_get(&dss.pdev->dev, "fck");
>>> + clk = devm_clk_get(&dss.pdev->dev, "fck");
>>> if (IS_ERR(clk)) {
>>> DSSERR("can't get clock fck\n");
>>> - r = PTR_ERR(clk);
>>> - goto err;
>>> + return PTR_ERR(clk);
>>> }
>>>
>>> dss.dss_clk = clk;
>>> @@ -782,8 +780,7 @@ static int dss_get_clocks(void)
>>> clk = clk_get(NULL, dss.feat->clk_name);
>>> if (IS_ERR(clk)) {
>>> DSSERR("Failed to get %s\n", dss.feat->clk_name);
>>> - r = PTR_ERR(clk);
>>> - goto err;
>>> + return PTR_ERR(clk);
>>> }
>>> } else {
>>> clk = NULL;
>>> @@ -792,21 +789,12 @@ static int dss_get_clocks(void)
>>> dss.dpll4_m4_ck = clk;
>>>
>>> return 0;
>>> -
>>> -err:
>>> - if (dss.dss_clk)
>>> - clk_put(dss.dss_clk);
>>> - if (dss.dpll4_m4_ck)
>>> - clk_put(dss.dpll4_m4_ck);
>>> -
>>> - return r;
>>> }
>>
>> Why didn't you use devm_clk_get for the dpll4_m4_ck clock also?
>
> clk_get of dpll4_m4_ck isn't tied to a device:
>
> clk = clk_get(NULL, dss.feat->clk_name);
>
> We can't use devm_clk_get() if we don't tie it to a device, right?
Ah, true.
> I think the dss.dss_clk clock above is same as the dpll4_m4_ck for all
> OMAPs. We could probably remove the dpll4_m4_clk all together, and use
> dss_clk to get the rate of DSS_FCK coming from PRCM.
Hmm, no, if I recall right, dpll4_m4_clk is the parent of dss clock (or
parent of the parent of...), and the dss_fck_multiplier affects the
resulting dss fck. Or something like that. It's a bit messy, especially
as we can't just use the dss fck to change the rate, we need to change
the rate at the parent for some reason.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]
^ permalink raw reply
* Re: [PATCH] omapdss: use devm_clk_get()
From: Archit Taneja @ 2013-04-10 8:49 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <51651F25.3020302@ti.com>
On Wednesday 10 April 2013 01:43 PM, Tomi Valkeinen wrote:
> On 2013-04-08 11:55, Archit Taneja wrote:
>> Use devm_clk_get() instead of clk_get() for dss, and for outputs hdmi and venc.
>> This reduces reduces code and simplifies error handling.
>>
>> Signed-off-by: Archit Taneja <archit@ti.com>
>> ---
>> drivers/video/omap2/dss/dss.c | 18 +++---------------
>> drivers/video/omap2/dss/hdmi.c | 16 ++--------------
>> drivers/video/omap2/dss/venc.c | 10 +---------
>> 3 files changed, 6 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
>> index 054c2a2..645b3bc 100644
>> --- a/drivers/video/omap2/dss/dss.c
>> +++ b/drivers/video/omap2/dss/dss.c
>> @@ -767,13 +767,11 @@ int dss_dpi_select_source(enum omap_channel channel)
>> static int dss_get_clocks(void)
>> {
>> struct clk *clk;
>> - int r;
>>
>> - clk = clk_get(&dss.pdev->dev, "fck");
>> + clk = devm_clk_get(&dss.pdev->dev, "fck");
>> if (IS_ERR(clk)) {
>> DSSERR("can't get clock fck\n");
>> - r = PTR_ERR(clk);
>> - goto err;
>> + return PTR_ERR(clk);
>> }
>>
>> dss.dss_clk = clk;
>> @@ -782,8 +780,7 @@ static int dss_get_clocks(void)
>> clk = clk_get(NULL, dss.feat->clk_name);
>> if (IS_ERR(clk)) {
>> DSSERR("Failed to get %s\n", dss.feat->clk_name);
>> - r = PTR_ERR(clk);
>> - goto err;
>> + return PTR_ERR(clk);
>> }
>> } else {
>> clk = NULL;
>> @@ -792,21 +789,12 @@ static int dss_get_clocks(void)
>> dss.dpll4_m4_ck = clk;
>>
>> return 0;
>> -
>> -err:
>> - if (dss.dss_clk)
>> - clk_put(dss.dss_clk);
>> - if (dss.dpll4_m4_ck)
>> - clk_put(dss.dpll4_m4_ck);
>> -
>> - return r;
>> }
>
> Why didn't you use devm_clk_get for the dpll4_m4_ck clock also?
clk_get of dpll4_m4_ck isn't tied to a device:
clk = clk_get(NULL, dss.feat->clk_name);
We can't use devm_clk_get() if we don't tie it to a device, right?
I think the dss.dss_clk clock above is same as the dpll4_m4_ck for all
OMAPs. We could probably remove the dpll4_m4_clk all together, and use
dss_clk to get the rate of DSS_FCK coming from PRCM.
Archit
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox