aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-11-20 08:42:02 -0500
committerJiri Kosina <jkosina@suse.cz>2014-11-20 08:42:02 -0500
commita02001086bbfb4da35d1228bebc2f1b442db455f (patch)
tree62ab47936cef06fd08657ca5b6cd1df98c19be57 /drivers/video
parenteff264efeeb0898408e8c9df72d8a32621035bed (diff)
parentfc14f9c1272f62c3e8d01300f52467c0d9af50f9 (diff)
Merge Linus' tree to be be to apply submitted patches to newer code than
current trivial.git base
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/88pm860x_bl.c1
-rw-r--r--drivers/video/backlight/Kconfig20
-rw-r--r--drivers/video/backlight/Makefile2
-rw-r--r--drivers/video/backlight/aat2870_bl.c7
-rw-r--r--drivers/video/backlight/adp5520_bl.c2
-rw-r--r--drivers/video/backlight/adp8860_bl.c3
-rw-r--r--drivers/video/backlight/adp8870_bl.c4
-rw-r--r--drivers/video/backlight/ams369fg06.c12
-rw-r--r--drivers/video/backlight/as3711_bl.c1
-rw-r--r--drivers/video/backlight/atmel-pwm-bl.c223
-rw-r--r--drivers/video/backlight/backlight.c2
-rw-r--r--drivers/video/backlight/bd6107.c6
-rw-r--r--drivers/video/backlight/corgi_lcd.c1
-rw-r--r--drivers/video/backlight/cr_bllcd.c1
-rw-r--r--drivers/video/backlight/da903x_bl.c1
-rw-r--r--drivers/video/backlight/da9052_bl.c1
-rw-r--r--drivers/video/backlight/ep93xx_bl.c1
-rw-r--r--drivers/video/backlight/generic_bl.c18
-rw-r--r--drivers/video/backlight/gpio_backlight.c7
-rw-r--r--drivers/video/backlight/ili922x.c11
-rw-r--r--drivers/video/backlight/ipaq_micro_bl.c83
-rw-r--r--drivers/video/backlight/jornada720_bl.c6
-rw-r--r--drivers/video/backlight/jornada720_lcd.c43
-rw-r--r--drivers/video/backlight/ld9040.c12
-rw-r--r--drivers/video/backlight/lm3533_bl.c1
-rw-r--r--drivers/video/backlight/lm3639_bl.c2
-rw-r--r--drivers/video/backlight/lms501kf03.c12
-rw-r--r--drivers/video/backlight/lp855x_bl.c8
-rw-r--r--drivers/video/backlight/lp8788_bl.c7
-rw-r--r--drivers/video/backlight/lv5207lp.c6
-rw-r--r--drivers/video/backlight/max8925_bl.c1
-rw-r--r--drivers/video/backlight/omap1_bl.c1
-rw-r--r--drivers/video/backlight/ot200_bl.c1
-rw-r--r--drivers/video/backlight/pandora_bl.c7
-rw-r--r--drivers/video/backlight/pcf50633-backlight.c1
-rw-r--r--drivers/video/backlight/platform_lcd.c1
-rw-r--r--drivers/video/backlight/pwm_bl.c15
-rw-r--r--drivers/video/backlight/s6e63m0.c18
-rw-r--r--drivers/video/backlight/tdo24m.c2
-rw-r--r--drivers/video/backlight/tps65217_bl.c7
-rw-r--r--drivers/video/backlight/wm831x_bl.c2
-rw-r--r--drivers/video/console/bitblit.c3
-rw-r--r--drivers/video/console/fbcon.c19
-rw-r--r--drivers/video/console/fbcon_ccw.c3
-rw-r--r--drivers/video/console/fbcon_cw.c3
-rw-r--r--drivers/video/console/fbcon_ud.c3
-rw-r--r--drivers/video/console/vgacon.c24
-rw-r--r--drivers/video/fbdev/68328fb.c8
-rw-r--r--drivers/video/fbdev/Kconfig40
-rw-r--r--drivers/video/fbdev/Makefile4
-rw-r--r--drivers/video/fbdev/amba-clcd-versatile.c182
-rw-r--r--drivers/video/fbdev/amba-clcd.c274
-rw-r--r--drivers/video/fbdev/atmel_lcdfb.c26
-rw-r--r--drivers/video/fbdev/aty/aty128fb.c69
-rw-r--r--drivers/video/fbdev/aty/atyfb_base.c6
-rw-r--r--drivers/video/fbdev/aty/radeon_backlight.c6
-rw-r--r--drivers/video/fbdev/au1100fb.c39
-rw-r--r--drivers/video/fbdev/au1100fb.h1
-rw-r--r--drivers/video/fbdev/au1200fb.c82
-rw-r--r--drivers/video/fbdev/chipsfb.c2
-rw-r--r--drivers/video/fbdev/clps711x-fb.c397
-rw-r--r--drivers/video/fbdev/controlfb.c15
-rw-r--r--drivers/video/fbdev/core/Makefile1
-rw-r--r--drivers/video/fbdev/core/cfbcopyarea.c13
-rw-r--r--drivers/video/fbdev/core/fb_cmdline.c110
-rw-r--r--drivers/video/fbdev/core/fbmem.c92
-rw-r--r--drivers/video/fbdev/core/fbsysfs.c12
-rw-r--r--drivers/video/fbdev/core/modedb.c3
-rw-r--r--drivers/video/fbdev/cyber2000fb.c16
-rw-r--r--drivers/video/fbdev/da8xx-fb.c11
-rw-r--r--drivers/video/fbdev/exynos/s6e8ax0.c6
-rw-r--r--drivers/video/fbdev/hyperv_fb.c64
-rw-r--r--drivers/video/fbdev/i740fb.c2
-rw-r--r--drivers/video/fbdev/intelfb/intelfbhw.c3
-rw-r--r--drivers/video/fbdev/matrox/matroxfb_base.c52
-rw-r--r--drivers/video/fbdev/matrox/matroxfb_maven.c20
-rw-r--r--drivers/video/fbdev/mbx/mbxfb.c4
-rw-r--r--drivers/video/fbdev/msm/mddi_client_dummy.c19
-rw-r--r--drivers/video/fbdev/msm/msm_fb.c25
-rw-r--r--drivers/video/fbdev/mx3fb.c5
-rw-r--r--drivers/video/fbdev/nvidia/nv_backlight.c6
-rw-r--r--drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c3
-rw-r--r--drivers/video/fbdev/omap2/displays-new/connector-dvi.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/connector-hdmi.c20
-rw-r--r--drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c21
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-dpi.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c6
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c1
-rw-r--r--drivers/video/fbdev/omap2/dss/Kconfig1
-rw-r--r--drivers/video/fbdev/omap2/dss/apply.c2
-rw-r--r--drivers/video/fbdev/omap2/dss/dispc-compat.c9
-rw-r--r--drivers/video/fbdev/omap2/dss/dispc.c30
-rw-r--r--drivers/video/fbdev/omap2/dss/dispc.h3
-rw-r--r--drivers/video/fbdev/omap2/dss/dpi.c1
-rw-r--r--drivers/video/fbdev/omap2/dss/dsi.c22
-rw-r--r--drivers/video/fbdev/omap2/dss/dss.c1
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi.h107
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi4.c54
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi4_core.c164
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi4_core.h1
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi5.c54
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi5_core.c124
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi_common.c316
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi_pll.c13
-rw-r--r--drivers/video/fbdev/omap2/dss/manager-sysfs.c16
-rw-r--r--drivers/video/fbdev/omap2/dss/rfbi.c1
-rw-r--r--drivers/video/fbdev/omap2/dss/sdi.c1
-rw-r--r--drivers/video/fbdev/omap2/dss/venc.c1
-rw-r--r--drivers/video/fbdev/omap2/omapfb/omapfb-main.c32
-rw-r--r--drivers/video/fbdev/pvr2fb.c2
-rw-r--r--drivers/video/fbdev/pxafb.c20
-rw-r--r--drivers/video/fbdev/riva/fbdev.c6
-rw-r--r--drivers/video/fbdev/riva/riva_hw.c1
-rw-r--r--drivers/video/fbdev/s3c-fb.c65
-rw-r--r--drivers/video/fbdev/s3c2410fb.c20
-rw-r--r--drivers/video/fbdev/sa1100fb.c18
-rw-r--r--drivers/video/fbdev/sh_mobile_hdmi.c44
-rw-r--r--drivers/video/fbdev/sis/init.c2
-rw-r--r--drivers/video/fbdev/sis/init301.c2
-rw-r--r--drivers/video/fbdev/sis/sis_main.c72
-rw-r--r--drivers/video/fbdev/sm501fb.c4
-rw-r--r--drivers/video/fbdev/stifb.c4
-rw-r--r--drivers/video/fbdev/udlfb.c7
-rw-r--r--drivers/video/fbdev/valkyriefb.c14
-rw-r--r--drivers/video/fbdev/vermilion/vermilion.c1
-rw-r--r--drivers/video/fbdev/via/via-gpio.c10
-rw-r--r--drivers/video/fbdev/xen-fbfront.c5
-rw-r--r--drivers/video/of_display_timing.c4
134 files changed, 1913 insertions, 1630 deletions
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c
index a6f7cc0a0883..9a23698b6fe8 100644
--- a/drivers/video/backlight/88pm860x_bl.c
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -265,7 +265,6 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
265static struct platform_driver pm860x_backlight_driver = { 265static struct platform_driver pm860x_backlight_driver = {
266 .driver = { 266 .driver = {
267 .name = "88pm860x-backlight", 267 .name = "88pm860x-backlight",
268 .owner = THIS_MODULE,
269 }, 268 },
270 .probe = pm860x_backlight_probe, 269 .probe = pm860x_backlight_probe,
271}; 270};
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5d449059a556..8d03924749b8 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -178,17 +178,6 @@ config BACKLIGHT_ATMEL_LCDC
178 If in doubt, it's safe to enable this option; it doesn't kick 178 If in doubt, it's safe to enable this option; it doesn't kick
179 in unless the board's description says it's wired that way. 179 in unless the board's description says it's wired that way.
180 180
181config BACKLIGHT_ATMEL_PWM
182 tristate "Atmel PWM backlight control"
183 depends on ATMEL_PWM
184 help
185 Say Y here if you want to use the PWM peripheral in Atmel AT91 and
186 AVR32 devices. This driver will need additional platform data to know
187 which PWM instance to use and how to configure it.
188
189 To compile this driver as a module, choose M here: the module will be
190 called atmel-pwm-bl.
191
192config BACKLIGHT_EP93XX 181config BACKLIGHT_EP93XX
193 tristate "Cirrus EP93xx Backlight Driver" 182 tristate "Cirrus EP93xx Backlight Driver"
194 depends on FB_EP93XX 183 depends on FB_EP93XX
@@ -207,6 +196,15 @@ config BACKLIGHT_GENERIC
207 known as the Corgi backlight driver. If you have a Sharp Zaurus 196 known as the Corgi backlight driver. If you have a Sharp Zaurus
208 SL-C7xx, SL-Cxx00 or SL-6000x say y. 197 SL-C7xx, SL-Cxx00 or SL-6000x say y.
209 198
199config BACKLIGHT_IPAQ_MICRO
200 tristate "iPAQ microcontroller backlight driver"
201 depends on MFD_IPAQ_MICRO
202 default y
203 help
204 Say y to enable the backlight driver for Compaq iPAQ handheld
205 computers. Say yes if you have one of the h3100/h3600/h3700
206 machines.
207
210config BACKLIGHT_LM3533 208config BACKLIGHT_LM3533
211 tristate "Backlight Driver for LM3533" 209 tristate "Backlight Driver for LM3533"
212 depends on BACKLIGHT_CLASS_DEVICE 210 depends on BACKLIGHT_CLASS_DEVICE
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb820024f346..fcd50b732165 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o
25obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o 25obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o
26obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o 26obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o
27obj-$(CONFIG_BACKLIGHT_AS3711) += as3711_bl.o 27obj-$(CONFIG_BACKLIGHT_AS3711) += as3711_bl.o
28obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o
29obj-$(CONFIG_BACKLIGHT_BD6107) += bd6107.o 28obj-$(CONFIG_BACKLIGHT_BD6107) += bd6107.o
30obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o 29obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
31obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o 30obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
@@ -36,6 +35,7 @@ obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o
36obj-$(CONFIG_BACKLIGHT_GPIO) += gpio_backlight.o 35obj-$(CONFIG_BACKLIGHT_GPIO) += gpio_backlight.o
37obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o 36obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
38obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o 37obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o
38obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o
39obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o 39obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
40obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o 40obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o
41obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o 41obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c
index ec5350f2c28a..50774e657700 100644
--- a/drivers/video/backlight/aat2870_bl.c
+++ b/drivers/video/backlight/aat2870_bl.c
@@ -67,11 +67,6 @@ static inline int aat2870_bl_disable(struct aat2870_bl_driver_data *aat2870_bl)
67 return aat2870->write(aat2870, AAT2870_BL_CH_EN, 0x0); 67 return aat2870->write(aat2870, AAT2870_BL_CH_EN, 0x0);
68} 68}
69 69
70static int aat2870_bl_get_brightness(struct backlight_device *bd)
71{
72 return bd->props.brightness;
73}
74
75static int aat2870_bl_update_status(struct backlight_device *bd) 70static int aat2870_bl_update_status(struct backlight_device *bd)
76{ 71{
77 struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd); 72 struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd);
@@ -120,7 +115,6 @@ static int aat2870_bl_check_fb(struct backlight_device *bd, struct fb_info *fi)
120 115
121static const struct backlight_ops aat2870_bl_ops = { 116static const struct backlight_ops aat2870_bl_ops = {
122 .options = BL_CORE_SUSPENDRESUME, 117 .options = BL_CORE_SUSPENDRESUME,
123 .get_brightness = aat2870_bl_get_brightness,
124 .update_status = aat2870_bl_update_status, 118 .update_status = aat2870_bl_update_status,
125 .check_fb = aat2870_bl_check_fb, 119 .check_fb = aat2870_bl_check_fb,
126}; 120};
@@ -217,7 +211,6 @@ static int aat2870_bl_remove(struct platform_device *pdev)
217static struct platform_driver aat2870_bl_driver = { 211static struct platform_driver aat2870_bl_driver = {
218 .driver = { 212 .driver = {
219 .name = "aat2870-backlight", 213 .name = "aat2870-backlight",
220 .owner = THIS_MODULE,
221 }, 214 },
222 .probe = aat2870_bl_probe, 215 .probe = aat2870_bl_probe,
223 .remove = aat2870_bl_remove, 216 .remove = aat2870_bl_remove,
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
index f37097a261a2..dd88ba1d71ce 100644
--- a/drivers/video/backlight/adp5520_bl.c
+++ b/drivers/video/backlight/adp5520_bl.c
@@ -67,6 +67,7 @@ static int adp5520_bl_set(struct backlight_device *bl, int brightness)
67static int adp5520_bl_update_status(struct backlight_device *bl) 67static int adp5520_bl_update_status(struct backlight_device *bl)
68{ 68{
69 int brightness = bl->props.brightness; 69 int brightness = bl->props.brightness;
70
70 if (bl->props.power != FB_BLANK_UNBLANK) 71 if (bl->props.power != FB_BLANK_UNBLANK)
71 brightness = 0; 72 brightness = 0;
72 73
@@ -374,7 +375,6 @@ static SIMPLE_DEV_PM_OPS(adp5520_bl_pm_ops, adp5520_bl_suspend,
374static struct platform_driver adp5520_bl_driver = { 375static struct platform_driver adp5520_bl_driver = {
375 .driver = { 376 .driver = {
376 .name = "adp5520-backlight", 377 .name = "adp5520-backlight",
377 .owner = THIS_MODULE,
378 .pm = &adp5520_bl_pm_ops, 378 .pm = &adp5520_bl_pm_ops,
379 }, 379 },
380 .probe = adp5520_bl_probe, 380 .probe = adp5520_bl_probe,
diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c
index be8d83deca7d..71147f4461b8 100644
--- a/drivers/video/backlight/adp8860_bl.c
+++ b/drivers/video/backlight/adp8860_bl.c
@@ -181,6 +181,7 @@ static int adp8860_clr_bits(struct i2c_client *client, int reg, uint8_t bit_mask
181static void adp8860_led_work(struct work_struct *work) 181static void adp8860_led_work(struct work_struct *work)
182{ 182{
183 struct adp8860_led *led = container_of(work, struct adp8860_led, work); 183 struct adp8860_led *led = container_of(work, struct adp8860_led, work);
184
184 adp8860_write(led->client, ADP8860_ISC1 - led->id + 1, 185 adp8860_write(led->client, ADP8860_ISC1 - led->id + 1,
185 led->new_brightness >> 1); 186 led->new_brightness >> 1);
186} 187}
@@ -362,6 +363,7 @@ static int adp8860_bl_set(struct backlight_device *bl, int brightness)
362static int adp8860_bl_update_status(struct backlight_device *bl) 363static int adp8860_bl_update_status(struct backlight_device *bl)
363{ 364{
364 int brightness = bl->props.brightness; 365 int brightness = bl->props.brightness;
366
365 if (bl->props.power != FB_BLANK_UNBLANK) 367 if (bl->props.power != FB_BLANK_UNBLANK)
366 brightness = 0; 368 brightness = 0;
367 369
@@ -499,6 +501,7 @@ static ssize_t adp8860_bl_l1_daylight_max_store(struct device *dev,
499{ 501{
500 struct adp8860_bl *data = dev_get_drvdata(dev); 502 struct adp8860_bl *data = dev_get_drvdata(dev);
501 int ret = kstrtoul(buf, 10, &data->cached_daylight_max); 503 int ret = kstrtoul(buf, 10, &data->cached_daylight_max);
504
502 if (ret) 505 if (ret)
503 return ret; 506 return ret;
504 507
diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c
index 251af4d38d86..037e43083343 100644
--- a/drivers/video/backlight/adp8870_bl.c
+++ b/drivers/video/backlight/adp8870_bl.c
@@ -144,6 +144,7 @@ static int adp8870_read(struct i2c_client *client, int reg, uint8_t *val)
144static int adp8870_write(struct i2c_client *client, u8 reg, u8 val) 144static int adp8870_write(struct i2c_client *client, u8 reg, u8 val)
145{ 145{
146 int ret = i2c_smbus_write_byte_data(client, reg, val); 146 int ret = i2c_smbus_write_byte_data(client, reg, val);
147
147 if (ret) 148 if (ret)
148 dev_err(&client->dev, "failed to write\n"); 149 dev_err(&client->dev, "failed to write\n");
149 150
@@ -195,6 +196,7 @@ static int adp8870_clr_bits(struct i2c_client *client, int reg, uint8_t bit_mask
195static void adp8870_led_work(struct work_struct *work) 196static void adp8870_led_work(struct work_struct *work)
196{ 197{
197 struct adp8870_led *led = container_of(work, struct adp8870_led, work); 198 struct adp8870_led *led = container_of(work, struct adp8870_led, work);
199
198 adp8870_write(led->client, ADP8870_ISC1 + led->id - 1, 200 adp8870_write(led->client, ADP8870_ISC1 + led->id - 1,
199 led->new_brightness >> 1); 201 led->new_brightness >> 1);
200} 202}
@@ -399,6 +401,7 @@ static int adp8870_bl_set(struct backlight_device *bl, int brightness)
399static int adp8870_bl_update_status(struct backlight_device *bl) 401static int adp8870_bl_update_status(struct backlight_device *bl)
400{ 402{
401 int brightness = bl->props.brightness; 403 int brightness = bl->props.brightness;
404
402 if (bl->props.power != FB_BLANK_UNBLANK) 405 if (bl->props.power != FB_BLANK_UNBLANK)
403 brightness = 0; 406 brightness = 0;
404 407
@@ -649,6 +652,7 @@ static ssize_t adp8870_bl_l1_daylight_max_store(struct device *dev,
649{ 652{
650 struct adp8870_bl *data = dev_get_drvdata(dev); 653 struct adp8870_bl *data = dev_get_drvdata(dev);
651 int ret = kstrtoul(buf, 10, &data->cached_daylight_max); 654 int ret = kstrtoul(buf, 10, &data->cached_daylight_max);
655
652 if (ret) 656 if (ret)
653 return ret; 657 return ret;
654 658
diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c
index d8952c4aa689..5f897f99cc9b 100644
--- a/drivers/video/backlight/ams369fg06.c
+++ b/drivers/video/backlight/ams369fg06.c
@@ -325,11 +325,11 @@ static int ams369fg06_power_on(struct ams369fg06 *lcd)
325 if (!pd->reset) { 325 if (!pd->reset) {
326 dev_err(lcd->dev, "reset is NULL.\n"); 326 dev_err(lcd->dev, "reset is NULL.\n");
327 return -EINVAL; 327 return -EINVAL;
328 } else {
329 pd->reset(lcd->ld);
330 msleep(pd->reset_delay);
331 } 328 }
332 329
330 pd->reset(lcd->ld);
331 msleep(pd->reset_delay);
332
333 ret = ams369fg06_ldi_init(lcd); 333 ret = ams369fg06_ldi_init(lcd);
334 if (ret) { 334 if (ret) {
335 dev_err(lcd->dev, "failed to initialize ldi.\n"); 335 dev_err(lcd->dev, "failed to initialize ldi.\n");
@@ -410,11 +410,6 @@ static int ams369fg06_set_power(struct lcd_device *ld, int power)
410 return ams369fg06_power(lcd, power); 410 return ams369fg06_power(lcd, power);
411} 411}
412 412
413static int ams369fg06_get_brightness(struct backlight_device *bd)
414{
415 return bd->props.brightness;
416}
417
418static int ams369fg06_set_brightness(struct backlight_device *bd) 413static int ams369fg06_set_brightness(struct backlight_device *bd)
419{ 414{
420 int ret = 0; 415 int ret = 0;
@@ -443,7 +438,6 @@ static struct lcd_ops ams369fg06_lcd_ops = {
443}; 438};
444 439
445static const struct backlight_ops ams369fg06_backlight_ops = { 440static const struct backlight_ops ams369fg06_backlight_ops = {
446 .get_brightness = ams369fg06_get_brightness,
447 .update_status = ams369fg06_set_brightness, 441 .update_status = ams369fg06_set_brightness,
448}; 442};
449 443
diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c
index bb1fc45b7549..734a9158946b 100644
--- a/drivers/video/backlight/as3711_bl.c
+++ b/drivers/video/backlight/as3711_bl.c
@@ -467,7 +467,6 @@ static int as3711_backlight_probe(struct platform_device *pdev)
467static struct platform_driver as3711_backlight_driver = { 467static struct platform_driver as3711_backlight_driver = {
468 .driver = { 468 .driver = {
469 .name = "as3711-backlight", 469 .name = "as3711-backlight",
470 .owner = THIS_MODULE,
471 }, 470 },
472 .probe = as3711_backlight_probe, 471 .probe = as3711_backlight_probe,
473}; 472};
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
deleted file mode 100644
index 261b1a4ec3d8..000000000000
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * Copyright (C) 2008 Atmel Corporation
3 *
4 * Backlight driver using Atmel PWM peripheral.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/module.h>
13#include <linux/platform_device.h>
14#include <linux/fb.h>
15#include <linux/gpio.h>
16#include <linux/backlight.h>
17#include <linux/atmel_pwm.h>
18#include <linux/atmel-pwm-bl.h>
19#include <linux/slab.h>
20
21struct atmel_pwm_bl {
22 const struct atmel_pwm_bl_platform_data *pdata;
23 struct backlight_device *bldev;
24 struct platform_device *pdev;
25 struct pwm_channel pwmc;
26 int gpio_on;
27};
28
29static void atmel_pwm_bl_set_gpio_on(struct atmel_pwm_bl *pwmbl, int on)
30{
31 if (!gpio_is_valid(pwmbl->gpio_on))
32 return;
33
34 gpio_set_value(pwmbl->gpio_on, on ^ pwmbl->pdata->on_active_low);
35}
36
37static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)
38{
39 struct atmel_pwm_bl *pwmbl = bl_get_data(bd);
40 int intensity = bd->props.brightness;
41 int pwm_duty;
42
43 if (bd->props.power != FB_BLANK_UNBLANK)
44 intensity = 0;
45 if (bd->props.fb_blank != FB_BLANK_UNBLANK)
46 intensity = 0;
47
48 if (pwmbl->pdata->pwm_active_low)
49 pwm_duty = pwmbl->pdata->pwm_duty_min + intensity;
50 else
51 pwm_duty = pwmbl->pdata->pwm_duty_max - intensity;
52
53 if (pwm_duty > pwmbl->pdata->pwm_duty_max)
54 pwm_duty = pwmbl->pdata->pwm_duty_max;
55 if (pwm_duty < pwmbl->pdata->pwm_duty_min)
56 pwm_duty = pwmbl->pdata->pwm_duty_min;
57
58 if (!intensity) {
59 atmel_pwm_bl_set_gpio_on(pwmbl, 0);
60 pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty);
61 pwm_channel_disable(&pwmbl->pwmc);
62 } else {
63 pwm_channel_enable(&pwmbl->pwmc);
64 pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty);
65 atmel_pwm_bl_set_gpio_on(pwmbl, 1);
66 }
67
68 return 0;
69}
70
71static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)
72{
73 struct atmel_pwm_bl *pwmbl = bl_get_data(bd);
74 u32 cdty;
75 u32 intensity;
76
77 cdty = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY);
78 if (pwmbl->pdata->pwm_active_low)
79 intensity = cdty - pwmbl->pdata->pwm_duty_min;
80 else
81 intensity = pwmbl->pdata->pwm_duty_max - cdty;
82
83 return intensity & 0xffff;
84}
85
86static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl)
87{
88 unsigned long pwm_rate = pwmbl->pwmc.mck;
89 unsigned long prescale = DIV_ROUND_UP(pwm_rate,
90 (pwmbl->pdata->pwm_frequency *
91 pwmbl->pdata->pwm_compare_max)) - 1;
92
93 /*
94 * Prescale must be power of two and maximum 0xf in size because of
95 * hardware limit. PWM speed will be:
96 * PWM module clock speed / (2 ^ prescale).
97 */
98 prescale = fls(prescale);
99 if (prescale > 0xf)
100 prescale = 0xf;
101
102 pwm_channel_writel(&pwmbl->pwmc, PWM_CMR, prescale);
103 pwm_channel_writel(&pwmbl->pwmc, PWM_CDTY,
104 pwmbl->pdata->pwm_duty_min +
105 pwmbl->bldev->props.brightness);
106 pwm_channel_writel(&pwmbl->pwmc, PWM_CPRD,
107 pwmbl->pdata->pwm_compare_max);
108
109 dev_info(&pwmbl->pdev->dev, "Atmel PWM backlight driver (%lu Hz)\n",
110 pwmbl->pwmc.mck / pwmbl->pdata->pwm_compare_max /
111 (1 << prescale));
112
113 return pwm_channel_enable(&pwmbl->pwmc);
114}
115
116static const struct backlight_ops atmel_pwm_bl_ops = {
117 .get_brightness = atmel_pwm_bl_get_intensity,
118 .update_status = atmel_pwm_bl_set_intensity,
119};
120
121static int atmel_pwm_bl_probe(struct platform_device *pdev)
122{
123 struct backlight_properties props;
124 const struct atmel_pwm_bl_platform_data *pdata;
125 struct backlight_device *bldev;
126 struct atmel_pwm_bl *pwmbl;
127 unsigned long flags;
128 int retval;
129
130 pdata = dev_get_platdata(&pdev->dev);
131 if (!pdata)
132 return -ENODEV;
133
134 if (pdata->pwm_compare_max < pdata->pwm_duty_max ||
135 pdata->pwm_duty_min > pdata->pwm_duty_max ||
136 pdata->pwm_frequency == 0)
137 return -EINVAL;
138
139 pwmbl = devm_kzalloc(&pdev->dev, sizeof(struct atmel_pwm_bl),
140 GFP_KERNEL);
141 if (!pwmbl)
142 return -ENOMEM;
143
144 pwmbl->pdev = pdev;
145 pwmbl->pdata = pdata;
146 pwmbl->gpio_on = pdata->gpio_on;
147
148 retval = pwm_channel_alloc(pdata->pwm_channel, &pwmbl->pwmc);
149 if (retval)
150 return retval;
151
152 if (gpio_is_valid(pwmbl->gpio_on)) {
153 /* Turn display off by default. */
154 if (pdata->on_active_low)
155 flags = GPIOF_OUT_INIT_HIGH;
156 else
157 flags = GPIOF_OUT_INIT_LOW;
158
159 retval = devm_gpio_request_one(&pdev->dev, pwmbl->gpio_on,
160 flags, "gpio_atmel_pwm_bl");
161 if (retval)
162 goto err_free_pwm;
163 }
164
165 memset(&props, 0, sizeof(struct backlight_properties));
166 props.type = BACKLIGHT_RAW;
167 props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min;
168 bldev = devm_backlight_device_register(&pdev->dev, "atmel-pwm-bl",
169 &pdev->dev, pwmbl, &atmel_pwm_bl_ops,
170 &props);
171 if (IS_ERR(bldev)) {
172 retval = PTR_ERR(bldev);
173 goto err_free_pwm;
174 }
175
176 pwmbl->bldev = bldev;
177
178 platform_set_drvdata(pdev, pwmbl);
179
180 /* Power up the backlight by default at middle intesity. */
181 bldev->props.power = FB_BLANK_UNBLANK;
182 bldev->props.brightness = bldev->props.max_brightness / 2;
183
184 retval = atmel_pwm_bl_init_pwm(pwmbl);
185 if (retval)
186 goto err_free_pwm;
187
188 atmel_pwm_bl_set_intensity(bldev);
189
190 return 0;
191
192err_free_pwm:
193 pwm_channel_free(&pwmbl->pwmc);
194
195 return retval;
196}
197
198static int atmel_pwm_bl_remove(struct platform_device *pdev)
199{
200 struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev);
201
202 atmel_pwm_bl_set_gpio_on(pwmbl, 0);
203 pwm_channel_disable(&pwmbl->pwmc);
204 pwm_channel_free(&pwmbl->pwmc);
205
206 return 0;
207}
208
209static struct platform_driver atmel_pwm_bl_driver = {
210 .driver = {
211 .name = "atmel-pwm-bl",
212 },
213 /* REVISIT add suspend() and resume() */
214 .probe = atmel_pwm_bl_probe,
215 .remove = atmel_pwm_bl_remove,
216};
217
218module_platform_driver(atmel_pwm_bl_driver);
219
220MODULE_AUTHOR("Hans-Christian egtvedt <hans-christian.egtvedt@atmel.com>");
221MODULE_DESCRIPTION("Atmel PWM backlight driver");
222MODULE_LICENSE("GPL");
223MODULE_ALIAS("platform:atmel-pwm-bl");
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 428089009cd5..bddc8b17a4d8 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -223,6 +223,8 @@ static ssize_t actual_brightness_show(struct device *dev,
223 mutex_lock(&bd->ops_lock); 223 mutex_lock(&bd->ops_lock);
224 if (bd->ops && bd->ops->get_brightness) 224 if (bd->ops && bd->ops->get_brightness)
225 rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd)); 225 rc = sprintf(buf, "%d\n", bd->ops->get_brightness(bd));
226 else
227 rc = sprintf(buf, "%d\n", bd->props.brightness);
226 mutex_unlock(&bd->ops_lock); 228 mutex_unlock(&bd->ops_lock);
227 229
228 return rc; 230 return rc;
diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c
index 16dd9bc625bd..fdb2f7e2c6b5 100644
--- a/drivers/video/backlight/bd6107.c
+++ b/drivers/video/backlight/bd6107.c
@@ -105,11 +105,6 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight)
105 return 0; 105 return 0;
106} 106}
107 107
108static int bd6107_backlight_get_brightness(struct backlight_device *backlight)
109{
110 return backlight->props.brightness;
111}
112
113static int bd6107_backlight_check_fb(struct backlight_device *backlight, 108static int bd6107_backlight_check_fb(struct backlight_device *backlight,
114 struct fb_info *info) 109 struct fb_info *info)
115{ 110{
@@ -121,7 +116,6 @@ static int bd6107_backlight_check_fb(struct backlight_device *backlight,
121static const struct backlight_ops bd6107_backlight_ops = { 116static const struct backlight_ops bd6107_backlight_ops = {
122 .options = BL_CORE_SUSPENDRESUME, 117 .options = BL_CORE_SUSPENDRESUME,
123 .update_status = bd6107_backlight_update_status, 118 .update_status = bd6107_backlight_update_status,
124 .get_brightness = bd6107_backlight_get_brightness,
125 .check_fb = bd6107_backlight_check_fb, 119 .check_fb = bd6107_backlight_check_fb,
126}; 120};
127 121
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 51d18d637e2b..d7c37a8ccd1f 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -143,6 +143,7 @@ static void lcdtg_i2c_send_byte(struct corgi_lcd *lcd,
143 uint8_t base, uint8_t data) 143 uint8_t base, uint8_t data)
144{ 144{
145 int i; 145 int i;
146
146 for (i = 0; i < 8; i++) { 147 for (i = 0; i < 8; i++) {
147 if (data & 0x80) 148 if (data & 0x80)
148 lcdtg_i2c_send_bit(lcd, base | POWER0_COM_DOUT); 149 lcdtg_i2c_send_bit(lcd, base | POWER0_COM_DOUT);
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c
index f3fed9ef745f..3e3880fc8c8e 100644
--- a/drivers/video/backlight/cr_bllcd.c
+++ b/drivers/video/backlight/cr_bllcd.c
@@ -235,6 +235,7 @@ static int cr_backlight_probe(struct platform_device *pdev)
235static int cr_backlight_remove(struct platform_device *pdev) 235static int cr_backlight_remove(struct platform_device *pdev)
236{ 236{
237 struct cr_panel *crp = platform_get_drvdata(pdev); 237 struct cr_panel *crp = platform_get_drvdata(pdev);
238
238 crp->cr_backlight_device->props.power = FB_BLANK_POWERDOWN; 239 crp->cr_backlight_device->props.power = FB_BLANK_POWERDOWN;
239 crp->cr_backlight_device->props.brightness = 0; 240 crp->cr_backlight_device->props.brightness = 0;
240 crp->cr_backlight_device->props.max_brightness = 0; 241 crp->cr_backlight_device->props.max_brightness = 0;
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c
index 12c5d840c590..f793738f06fb 100644
--- a/drivers/video/backlight/da903x_bl.c
+++ b/drivers/video/backlight/da903x_bl.c
@@ -162,7 +162,6 @@ static int da903x_backlight_probe(struct platform_device *pdev)
162static struct platform_driver da903x_backlight_driver = { 162static struct platform_driver da903x_backlight_driver = {
163 .driver = { 163 .driver = {
164 .name = "da903x-backlight", 164 .name = "da903x-backlight",
165 .owner = THIS_MODULE,
166 }, 165 },
167 .probe = da903x_backlight_probe, 166 .probe = da903x_backlight_probe,
168}; 167};
diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
index 20d55becaa74..d4bd74bd5070 100644
--- a/drivers/video/backlight/da9052_bl.c
+++ b/drivers/video/backlight/da9052_bl.c
@@ -173,7 +173,6 @@ static struct platform_driver da9052_wled_driver = {
173 .id_table = da9052_wled_ids, 173 .id_table = da9052_wled_ids,
174 .driver = { 174 .driver = {
175 .name = "da9052-wled", 175 .name = "da9052-wled",
176 .owner = THIS_MODULE,
177 }, 176 },
178}; 177};
179 178
diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c
index 0d1f633c6480..0067931821c6 100644
--- a/drivers/video/backlight/ep93xx_bl.c
+++ b/drivers/video/backlight/ep93xx_bl.c
@@ -128,7 +128,6 @@ static SIMPLE_DEV_PM_OPS(ep93xxbl_pm_ops, ep93xxbl_suspend, ep93xxbl_resume);
128static struct platform_driver ep93xxbl_driver = { 128static struct platform_driver ep93xxbl_driver = {
129 .driver = { 129 .driver = {
130 .name = "ep93xx-bl", 130 .name = "ep93xx-bl",
131 .owner = THIS_MODULE,
132 .pm = &ep93xxbl_pm_ops, 131 .pm = &ep93xxbl_pm_ops,
133 }, 132 },
134 .probe = ep93xxbl_probe, 133 .probe = ep93xxbl_probe,
diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c
index 5d8d65200db7..67dfb939a514 100644
--- a/drivers/video/backlight/generic_bl.c
+++ b/drivers/video/backlight/generic_bl.c
@@ -52,24 +52,6 @@ static int genericbl_get_intensity(struct backlight_device *bd)
52 return genericbl_intensity; 52 return genericbl_intensity;
53} 53}
54 54
55/*
56 * Called when the battery is low to limit the backlight intensity.
57 * If limit==0 clear any limit, otherwise limit the intensity
58 */
59void genericbl_limit_intensity(int limit)
60{
61 struct backlight_device *bd = generic_backlight_device;
62
63 mutex_lock(&bd->ops_lock);
64 if (limit)
65 bd->props.state |= GENERICBL_BATTLOW;
66 else
67 bd->props.state &= ~GENERICBL_BATTLOW;
68 backlight_update_status(generic_backlight_device);
69 mutex_unlock(&bd->ops_lock);
70}
71EXPORT_SYMBOL(genericbl_limit_intensity);
72
73static const struct backlight_ops genericbl_ops = { 55static const struct backlight_ops genericbl_ops = {
74 .options = BL_CORE_SUSPENDRESUME, 56 .options = BL_CORE_SUSPENDRESUME,
75 .get_brightness = genericbl_get_intensity, 57 .get_brightness = genericbl_get_intensity,
diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index 1cea68848f1a..439feb2389a8 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -44,11 +44,6 @@ static int gpio_backlight_update_status(struct backlight_device *bl)
44 return 0; 44 return 0;
45} 45}
46 46
47static int gpio_backlight_get_brightness(struct backlight_device *bl)
48{
49 return bl->props.brightness;
50}
51
52static int gpio_backlight_check_fb(struct backlight_device *bl, 47static int gpio_backlight_check_fb(struct backlight_device *bl,
53 struct fb_info *info) 48 struct fb_info *info)
54{ 49{
@@ -60,7 +55,6 @@ static int gpio_backlight_check_fb(struct backlight_device *bl,
60static const struct backlight_ops gpio_backlight_ops = { 55static const struct backlight_ops gpio_backlight_ops = {
61 .options = BL_CORE_SUSPENDRESUME, 56 .options = BL_CORE_SUSPENDRESUME,
62 .update_status = gpio_backlight_update_status, 57 .update_status = gpio_backlight_update_status,
63 .get_brightness = gpio_backlight_get_brightness,
64 .check_fb = gpio_backlight_check_fb, 58 .check_fb = gpio_backlight_check_fb,
65}; 59};
66 60
@@ -157,7 +151,6 @@ static struct of_device_id gpio_backlight_of_match[] = {
157static struct platform_driver gpio_backlight_driver = { 151static struct platform_driver gpio_backlight_driver = {
158 .driver = { 152 .driver = {
159 .name = "gpio-backlight", 153 .name = "gpio-backlight",
160 .owner = THIS_MODULE,
161 .of_match_table = of_match_ptr(gpio_backlight_of_match), 154 .of_match_table = of_match_ptr(gpio_backlight_of_match),
162 }, 155 },
163 .probe = gpio_backlight_probe, 156 .probe = gpio_backlight_probe,
diff --git a/drivers/video/backlight/ili922x.c b/drivers/video/backlight/ili922x.c
index ea67fe199e34..e7f0890cc211 100644
--- a/drivers/video/backlight/ili922x.c
+++ b/drivers/video/backlight/ili922x.c
@@ -495,17 +495,18 @@ static int ili922x_probe(struct spi_device *spi)
495 "no LCD found: Chip ID 0x%x, ret %d\n", 495 "no LCD found: Chip ID 0x%x, ret %d\n",
496 reg, ret); 496 reg, ret);
497 return -ENODEV; 497 return -ENODEV;
498 } else {
499 dev_info(&spi->dev, "ILI%x found, SPI freq %d, mode %d\n",
500 reg, spi->max_speed_hz, spi->mode);
501 } 498 }
502 499
500 dev_info(&spi->dev, "ILI%x found, SPI freq %d, mode %d\n",
501 reg, spi->max_speed_hz, spi->mode);
502
503 ret = ili922x_read_status(spi, &reg); 503 ret = ili922x_read_status(spi, &reg);
504 if (ret) { 504 if (ret) {
505 dev_err(&spi->dev, "reading RS failed...\n"); 505 dev_err(&spi->dev, "reading RS failed...\n");
506 return ret; 506 return ret;
507 } else 507 }
508 dev_dbg(&spi->dev, "status: 0x%x\n", reg); 508
509 dev_dbg(&spi->dev, "status: 0x%x\n", reg);
509 510
510 ili922x_display_init(spi); 511 ili922x_display_init(spi);
511 512
diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c
new file mode 100644
index 000000000000..347dc11d4ceb
--- /dev/null
+++ b/drivers/video/backlight/ipaq_micro_bl.c
@@ -0,0 +1,83 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * iPAQ microcontroller backlight support
7 * Author : Linus Walleij <linus.walleij@linaro.org>
8 */
9
10#include <linux/backlight.h>
11#include <linux/err.h>
12#include <linux/fb.h>
13#include <linux/init.h>
14#include <linux/mfd/ipaq-micro.h>
15#include <linux/module.h>
16#include <linux/platform_device.h>
17
18static int micro_bl_update_status(struct backlight_device *bd)
19{
20 struct ipaq_micro *micro = dev_get_drvdata(&bd->dev);
21 int intensity = bd->props.brightness;
22 struct ipaq_micro_msg msg = {
23 .id = MSG_BACKLIGHT,
24 .tx_len = 3,
25 };
26
27 if (bd->props.power != FB_BLANK_UNBLANK)
28 intensity = 0;
29 if (bd->props.state & (BL_CORE_FBBLANK | BL_CORE_SUSPENDED))
30 intensity = 0;
31
32 /*
33 * Message format:
34 * Byte 0: backlight instance (usually 1)
35 * Byte 1: on/off
36 * Byte 2: intensity, 0-255
37 */
38 msg.tx_data[0] = 0x01;
39 msg.tx_data[1] = intensity > 0 ? 1 : 0;
40 msg.tx_data[2] = intensity;
41 return ipaq_micro_tx_msg_sync(micro, &msg);
42}
43
44static const struct backlight_ops micro_bl_ops = {
45 .options = BL_CORE_SUSPENDRESUME,
46 .update_status = micro_bl_update_status,
47};
48
49static struct backlight_properties micro_bl_props = {
50 .type = BACKLIGHT_RAW,
51 .max_brightness = 255,
52 .power = FB_BLANK_UNBLANK,
53 .brightness = 64,
54};
55
56static int micro_backlight_probe(struct platform_device *pdev)
57{
58 struct backlight_device *bd;
59 struct ipaq_micro *micro = dev_get_drvdata(pdev->dev.parent);
60
61 bd = devm_backlight_device_register(&pdev->dev, "ipaq-micro-backlight",
62 &pdev->dev, micro, &micro_bl_ops,
63 &micro_bl_props);
64 if (IS_ERR(bd))
65 return PTR_ERR(bd);
66
67 platform_set_drvdata(pdev, bd);
68 backlight_update_status(bd);
69
70 return 0;
71}
72
73static struct platform_driver micro_backlight_device_driver = {
74 .driver = {
75 .name = "ipaq-micro-backlight",
76 },
77 .probe = micro_backlight_probe,
78};
79module_platform_driver(micro_backlight_device_driver);
80
81MODULE_LICENSE("GPL v2");
82MODULE_DESCRIPTION("driver for iPAQ Atmel micro backlight");
83MODULE_ALIAS("platform:ipaq-micro-backlight");
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c
index 6ce96b4a8796..7e6ff5346892 100644
--- a/drivers/video/backlight/jornada720_bl.c
+++ b/drivers/video/backlight/jornada720_bl.c
@@ -41,11 +41,11 @@ static int jornada_bl_get_brightness(struct backlight_device *bd)
41 dev_err(&bd->dev, "get brightness timeout\n"); 41 dev_err(&bd->dev, "get brightness timeout\n");
42 jornada_ssp_end(); 42 jornada_ssp_end();
43 return -ETIMEDOUT; 43 return -ETIMEDOUT;
44 } else {
45 /* exchange txdummy for value */
46 ret = jornada_ssp_byte(TXDUMMY);
47 } 44 }
48 45
46 /* exchange txdummy for value */
47 ret = jornada_ssp_byte(TXDUMMY);
48
49 jornada_ssp_end(); 49 jornada_ssp_end();
50 50
51 return BL_MAX_BRIGHT - ret; 51 return BL_MAX_BRIGHT - ret;
diff --git a/drivers/video/backlight/jornada720_lcd.c b/drivers/video/backlight/jornada720_lcd.c
index da3876c9b3ae..dfa0fa0d5c78 100644
--- a/drivers/video/backlight/jornada720_lcd.c
+++ b/drivers/video/backlight/jornada720_lcd.c
@@ -27,11 +27,7 @@
27 27
28static int jornada_lcd_get_power(struct lcd_device *ld) 28static int jornada_lcd_get_power(struct lcd_device *ld)
29{ 29{
30 /* LDD2 in PPC = LCD POWER */ 30 return PPSR & PPC_LDD2 ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
31 if (PPSR & PPC_LDD2)
32 return FB_BLANK_UNBLANK; /* PW ON */
33 else
34 return FB_BLANK_POWERDOWN; /* PW OFF */
35} 31}
36 32
37static int jornada_lcd_get_contrast(struct lcd_device *ld) 33static int jornada_lcd_get_contrast(struct lcd_device *ld)
@@ -43,37 +39,38 @@ static int jornada_lcd_get_contrast(struct lcd_device *ld)
43 39
44 jornada_ssp_start(); 40 jornada_ssp_start();
45 41
46 if (jornada_ssp_byte(GETCONTRAST) != TXDUMMY) { 42 if (jornada_ssp_byte(GETCONTRAST) == TXDUMMY) {
47 dev_err(&ld->dev, "get contrast failed\n");
48 jornada_ssp_end();
49 return -ETIMEDOUT;
50 } else {
51 ret = jornada_ssp_byte(TXDUMMY); 43 ret = jornada_ssp_byte(TXDUMMY);
52 jornada_ssp_end(); 44 goto success;
53 return ret;
54 } 45 }
46
47 dev_err(&ld->dev, "failed to set contrast\n");
48 ret = -ETIMEDOUT;
49
50success:
51 jornada_ssp_end();
52 return ret;
55} 53}
56 54
57static int jornada_lcd_set_contrast(struct lcd_device *ld, int value) 55static int jornada_lcd_set_contrast(struct lcd_device *ld, int value)
58{ 56{
59 int ret; 57 int ret = 0;
60 58
61 jornada_ssp_start(); 59 jornada_ssp_start();
62 60
63 /* start by sending our set contrast cmd to mcu */ 61 /* start by sending our set contrast cmd to mcu */
64 ret = jornada_ssp_byte(SETCONTRAST); 62 if (jornada_ssp_byte(SETCONTRAST) == TXDUMMY) {
65 63 /* if successful push the new value */
66 /* push the new value */ 64 if (jornada_ssp_byte(value) == TXDUMMY)
67 if (jornada_ssp_byte(value) != TXDUMMY) { 65 goto success;
68 dev_err(&ld->dev, "set contrast failed\n");
69 jornada_ssp_end();
70 return -ETIMEDOUT;
71 } 66 }
72 67
73 /* if we get here we can assume everything went well */ 68 dev_err(&ld->dev, "failed to set contrast\n");
74 jornada_ssp_end(); 69 ret = -ETIMEDOUT;
75 70
76 return 0; 71success:
72 jornada_ssp_end();
73 return ret;
77} 74}
78 75
79static int jornada_lcd_set_power(struct lcd_device *ld, int power) 76static int jornada_lcd_set_power(struct lcd_device *ld, int power)
diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c
index 506a6c236039..f71eaf10c4eb 100644
--- a/drivers/video/backlight/ld9040.c
+++ b/drivers/video/backlight/ld9040.c
@@ -566,11 +566,11 @@ static int ld9040_power_on(struct ld9040 *lcd)
566 if (!pd->reset) { 566 if (!pd->reset) {
567 dev_err(lcd->dev, "reset is NULL.\n"); 567 dev_err(lcd->dev, "reset is NULL.\n");
568 return -EINVAL; 568 return -EINVAL;
569 } else {
570 pd->reset(lcd->ld);
571 msleep(pd->reset_delay);
572 } 569 }
573 570
571 pd->reset(lcd->ld);
572 msleep(pd->reset_delay);
573
574 ret = ld9040_ldi_init(lcd); 574 ret = ld9040_ldi_init(lcd);
575 if (ret) { 575 if (ret) {
576 dev_err(lcd->dev, "failed to initialize ldi.\n"); 576 dev_err(lcd->dev, "failed to initialize ldi.\n");
@@ -642,11 +642,6 @@ static int ld9040_get_power(struct lcd_device *ld)
642 return lcd->power; 642 return lcd->power;
643} 643}
644 644
645static int ld9040_get_brightness(struct backlight_device *bd)
646{
647 return bd->props.brightness;
648}
649
650static int ld9040_set_brightness(struct backlight_device *bd) 645static int ld9040_set_brightness(struct backlight_device *bd)
651{ 646{
652 int ret = 0, brightness = bd->props.brightness; 647 int ret = 0, brightness = bd->props.brightness;
@@ -674,7 +669,6 @@ static struct lcd_ops ld9040_lcd_ops = {
674}; 669};
675 670
676static const struct backlight_ops ld9040_backlight_ops = { 671static const struct backlight_ops ld9040_backlight_ops = {
677 .get_brightness = ld9040_get_brightness,
678 .update_status = ld9040_set_brightness, 672 .update_status = ld9040_set_brightness,
679}; 673};
680 674
diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
index cff1fbe89a1b..0e2337f367b6 100644
--- a/drivers/video/backlight/lm3533_bl.c
+++ b/drivers/video/backlight/lm3533_bl.c
@@ -397,7 +397,6 @@ static void lm3533_bl_shutdown(struct platform_device *pdev)
397static struct platform_driver lm3533_bl_driver = { 397static struct platform_driver lm3533_bl_driver = {
398 .driver = { 398 .driver = {
399 .name = "lm3533-backlight", 399 .name = "lm3533-backlight",
400 .owner = THIS_MODULE,
401 .pm = &lm3533_bl_pm_ops, 400 .pm = &lm3533_bl_pm_ops,
402 }, 401 },
403 .probe = lm3533_bl_probe, 402 .probe = lm3533_bl_probe,
diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c
index 5f36808d214f..cd50df5807ea 100644
--- a/drivers/video/backlight/lm3639_bl.c
+++ b/drivers/video/backlight/lm3639_bl.c
@@ -254,7 +254,6 @@ static void lm3639_torch_brightness_set(struct led_classdev *cdev,
254 return; 254 return;
255out: 255out:
256 dev_err(pchip->dev, "i2c failed to access register\n"); 256 dev_err(pchip->dev, "i2c failed to access register\n");
257 return;
258} 257}
259 258
260/* flash */ 259/* flash */
@@ -293,7 +292,6 @@ static void lm3639_flash_brightness_set(struct led_classdev *cdev,
293 return; 292 return;
294out: 293out:
295 dev_err(pchip->dev, "i2c failed to access register\n"); 294 dev_err(pchip->dev, "i2c failed to access register\n");
296 return;
297} 295}
298 296
299static const struct regmap_config lm3639_regmap = { 297static const struct regmap_config lm3639_regmap = {
diff --git a/drivers/video/backlight/lms501kf03.c b/drivers/video/backlight/lms501kf03.c
index 77258b7b04be..7e3810308c3e 100644
--- a/drivers/video/backlight/lms501kf03.c
+++ b/drivers/video/backlight/lms501kf03.c
@@ -232,19 +232,19 @@ static int lms501kf03_power_on(struct lms501kf03 *lcd)
232 if (!pd->power_on) { 232 if (!pd->power_on) {
233 dev_err(lcd->dev, "power_on is NULL.\n"); 233 dev_err(lcd->dev, "power_on is NULL.\n");
234 return -EINVAL; 234 return -EINVAL;
235 } else {
236 pd->power_on(lcd->ld, 1);
237 msleep(pd->power_on_delay);
238 } 235 }
239 236
237 pd->power_on(lcd->ld, 1);
238 msleep(pd->power_on_delay);
239
240 if (!pd->reset) { 240 if (!pd->reset) {
241 dev_err(lcd->dev, "reset is NULL.\n"); 241 dev_err(lcd->dev, "reset is NULL.\n");
242 return -EINVAL; 242 return -EINVAL;
243 } else {
244 pd->reset(lcd->ld);
245 msleep(pd->reset_delay);
246 } 243 }
247 244
245 pd->reset(lcd->ld);
246 msleep(pd->reset_delay);
247
248 ret = lms501kf03_ldi_init(lcd); 248 ret = lms501kf03_ldi_init(lcd);
249 if (ret) { 249 if (ret) {
250 dev_err(lcd->dev, "failed to initialize ldi.\n"); 250 dev_err(lcd->dev, "failed to initialize ldi.\n");
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 2ca3a040007b..25fb8e3d75b1 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -268,21 +268,16 @@ static int lp855x_bl_update_status(struct backlight_device *bl)
268 268
269 } else if (lp->mode == REGISTER_BASED) { 269 } else if (lp->mode == REGISTER_BASED) {
270 u8 val = bl->props.brightness; 270 u8 val = bl->props.brightness;
271
271 lp855x_write_byte(lp, lp->cfg->reg_brightness, val); 272 lp855x_write_byte(lp, lp->cfg->reg_brightness, val);
272 } 273 }
273 274
274 return 0; 275 return 0;
275} 276}
276 277
277static int lp855x_bl_get_brightness(struct backlight_device *bl)
278{
279 return bl->props.brightness;
280}
281
282static const struct backlight_ops lp855x_bl_ops = { 278static const struct backlight_ops lp855x_bl_ops = {
283 .options = BL_CORE_SUSPENDRESUME, 279 .options = BL_CORE_SUSPENDRESUME,
284 .update_status = lp855x_bl_update_status, 280 .update_status = lp855x_bl_update_status,
285 .get_brightness = lp855x_bl_get_brightness,
286}; 281};
287 282
288static int lp855x_backlight_register(struct lp855x *lp) 283static int lp855x_backlight_register(struct lp855x *lp)
@@ -314,6 +309,7 @@ static ssize_t lp855x_get_chip_id(struct device *dev,
314 struct device_attribute *attr, char *buf) 309 struct device_attribute *attr, char *buf)
315{ 310{
316 struct lp855x *lp = dev_get_drvdata(dev); 311 struct lp855x *lp = dev_get_drvdata(dev);
312
317 return scnprintf(buf, PAGE_SIZE, "%s\n", lp->chipname); 313 return scnprintf(buf, PAGE_SIZE, "%s\n", lp->chipname);
318} 314}
319 315
diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c
index daba34dc46d4..e418d5b1aa55 100644
--- a/drivers/video/backlight/lp8788_bl.c
+++ b/drivers/video/backlight/lp8788_bl.c
@@ -176,15 +176,9 @@ static int lp8788_bl_update_status(struct backlight_device *bl_dev)
176 return 0; 176 return 0;
177} 177}
178 178
179static int lp8788_bl_get_brightness(struct backlight_device *bl_dev)
180{
181 return bl_dev->props.brightness;
182}
183
184static const struct backlight_ops lp8788_bl_ops = { 179static const struct backlight_ops lp8788_bl_ops = {
185 .options = BL_CORE_SUSPENDRESUME, 180 .options = BL_CORE_SUSPENDRESUME,
186 .update_status = lp8788_bl_update_status, 181 .update_status = lp8788_bl_update_status,
187 .get_brightness = lp8788_bl_get_brightness,
188}; 182};
189 183
190static int lp8788_backlight_register(struct lp8788_bl *bl) 184static int lp8788_backlight_register(struct lp8788_bl *bl)
@@ -321,7 +315,6 @@ static struct platform_driver lp8788_bl_driver = {
321 .remove = lp8788_backlight_remove, 315 .remove = lp8788_backlight_remove,
322 .driver = { 316 .driver = {
323 .name = LP8788_DEV_BACKLIGHT, 317 .name = LP8788_DEV_BACKLIGHT,
324 .owner = THIS_MODULE,
325 }, 318 },
326}; 319};
327module_platform_driver(lp8788_bl_driver); 320module_platform_driver(lp8788_bl_driver);
diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c
index 1802b2d1357d..8ab7297b118a 100644
--- a/drivers/video/backlight/lv5207lp.c
+++ b/drivers/video/backlight/lv5207lp.c
@@ -70,11 +70,6 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight)
70 return 0; 70 return 0;
71} 71}
72 72
73static int lv5207lp_backlight_get_brightness(struct backlight_device *backlight)
74{
75 return backlight->props.brightness;
76}
77
78static int lv5207lp_backlight_check_fb(struct backlight_device *backlight, 73static int lv5207lp_backlight_check_fb(struct backlight_device *backlight,
79 struct fb_info *info) 74 struct fb_info *info)
80{ 75{
@@ -86,7 +81,6 @@ static int lv5207lp_backlight_check_fb(struct backlight_device *backlight,
86static const struct backlight_ops lv5207lp_backlight_ops = { 81static const struct backlight_ops lv5207lp_backlight_ops = {
87 .options = BL_CORE_SUSPENDRESUME, 82 .options = BL_CORE_SUSPENDRESUME,
88 .update_status = lv5207lp_backlight_update_status, 83 .update_status = lv5207lp_backlight_update_status,
89 .get_brightness = lv5207lp_backlight_get_brightness,
90 .check_fb = lv5207lp_backlight_check_fb, 84 .check_fb = lv5207lp_backlight_check_fb,
91}; 85};
92 86
diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c
index 66fa08c920d2..7b738d60ecc2 100644
--- a/drivers/video/backlight/max8925_bl.c
+++ b/drivers/video/backlight/max8925_bl.c
@@ -197,7 +197,6 @@ static int max8925_backlight_probe(struct platform_device *pdev)
197static struct platform_driver max8925_backlight_driver = { 197static struct platform_driver max8925_backlight_driver = {
198 .driver = { 198 .driver = {
199 .name = "max8925-backlight", 199 .name = "max8925-backlight",
200 .owner = THIS_MODULE,
201 }, 200 },
202 .probe = max8925_backlight_probe, 201 .probe = max8925_backlight_probe,
203}; 202};
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c
index a0dcd88ac74f..546d94df21d5 100644
--- a/drivers/video/backlight/omap1_bl.c
+++ b/drivers/video/backlight/omap1_bl.c
@@ -120,6 +120,7 @@ static int omapbl_update_status(struct backlight_device *dev)
120static int omapbl_get_intensity(struct backlight_device *dev) 120static int omapbl_get_intensity(struct backlight_device *dev)
121{ 121{
122 struct omap_backlight *bl = bl_get_data(dev); 122 struct omap_backlight *bl = bl_get_data(dev);
123
123 return bl->current_intensity; 124 return bl->current_intensity;
124} 125}
125 126
diff --git a/drivers/video/backlight/ot200_bl.c b/drivers/video/backlight/ot200_bl.c
index f5a5202dd79d..3acdb9f646ed 100644
--- a/drivers/video/backlight/ot200_bl.c
+++ b/drivers/video/backlight/ot200_bl.c
@@ -152,7 +152,6 @@ static int ot200_backlight_remove(struct platform_device *pdev)
152static struct platform_driver ot200_backlight_driver = { 152static struct platform_driver ot200_backlight_driver = {
153 .driver = { 153 .driver = {
154 .name = "ot200-backlight", 154 .name = "ot200-backlight",
155 .owner = THIS_MODULE,
156 }, 155 },
157 .probe = ot200_backlight_probe, 156 .probe = ot200_backlight_probe,
158 .remove = ot200_backlight_remove, 157 .remove = ot200_backlight_remove,
diff --git a/drivers/video/backlight/pandora_bl.c b/drivers/video/backlight/pandora_bl.c
index 2098c5d6efb9..5d8bb8b20183 100644
--- a/drivers/video/backlight/pandora_bl.c
+++ b/drivers/video/backlight/pandora_bl.c
@@ -100,15 +100,9 @@ done:
100 return 0; 100 return 0;
101} 101}
102 102
103static int pandora_backlight_get_brightness(struct backlight_device *bl)
104{
105 return bl->props.brightness;
106}
107
108static const struct backlight_ops pandora_backlight_ops = { 103static const struct backlight_ops pandora_backlight_ops = {
109 .options = BL_CORE_SUSPENDRESUME, 104 .options = BL_CORE_SUSPENDRESUME,
110 .update_status = pandora_backlight_update_status, 105 .update_status = pandora_backlight_update_status,
111 .get_brightness = pandora_backlight_get_brightness,
112}; 106};
113 107
114static int pandora_backlight_probe(struct platform_device *pdev) 108static int pandora_backlight_probe(struct platform_device *pdev)
@@ -148,7 +142,6 @@ static int pandora_backlight_probe(struct platform_device *pdev)
148static struct platform_driver pandora_backlight_driver = { 142static struct platform_driver pandora_backlight_driver = {
149 .driver = { 143 .driver = {
150 .name = "pandora-backlight", 144 .name = "pandora-backlight",
151 .owner = THIS_MODULE,
152 }, 145 },
153 .probe = pandora_backlight_probe, 146 .probe = pandora_backlight_probe,
154}; 147};
diff --git a/drivers/video/backlight/pcf50633-backlight.c b/drivers/video/backlight/pcf50633-backlight.c
index b95d3b0aaffe..85bd573b6d15 100644
--- a/drivers/video/backlight/pcf50633-backlight.c
+++ b/drivers/video/backlight/pcf50633-backlight.c
@@ -90,6 +90,7 @@ static int pcf50633_bl_update_status(struct backlight_device *bl)
90static int pcf50633_bl_get_brightness(struct backlight_device *bl) 90static int pcf50633_bl_get_brightness(struct backlight_device *bl)
91{ 91{
92 struct pcf50633_bl *pcf_bl = bl_get_data(bl); 92 struct pcf50633_bl *pcf_bl = bl_get_data(bl);
93
93 return pcf_bl->brightness; 94 return pcf_bl->brightness;
94} 95}
95 96
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c
index c3d2e209fc8f..872a3bf21faf 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -148,7 +148,6 @@ MODULE_DEVICE_TABLE(of, platform_lcd_of_match);
148static struct platform_driver platform_lcd_driver = { 148static struct platform_driver platform_lcd_driver = {
149 .driver = { 149 .driver = {
150 .name = "platform-lcd", 150 .name = "platform-lcd",
151 .owner = THIS_MODULE,
152 .pm = &platform_lcd_pm_ops, 151 .pm = &platform_lcd_pm_ops,
153 .of_match_table = of_match_ptr(platform_lcd_of_match), 152 .of_match_table = of_match_ptr(platform_lcd_of_match),
154 }, 153 },
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 38ca88bc5c3e..cb5ae4c08469 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -115,11 +115,6 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
115 return 0; 115 return 0;
116} 116}
117 117
118static int pwm_backlight_get_brightness(struct backlight_device *bl)
119{
120 return bl->props.brightness;
121}
122
123static int pwm_backlight_check_fb(struct backlight_device *bl, 118static int pwm_backlight_check_fb(struct backlight_device *bl,
124 struct fb_info *info) 119 struct fb_info *info)
125{ 120{
@@ -130,7 +125,6 @@ static int pwm_backlight_check_fb(struct backlight_device *bl,
130 125
131static const struct backlight_ops pwm_backlight_ops = { 126static const struct backlight_ops pwm_backlight_ops = {
132 .update_status = pwm_backlight_update_status, 127 .update_status = pwm_backlight_update_status,
133 .get_brightness = pwm_backlight_get_brightness,
134 .check_fb = pwm_backlight_check_fb, 128 .check_fb = pwm_backlight_check_fb,
135}; 129};
136 130
@@ -179,6 +173,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
179 data->max_brightness--; 173 data->max_brightness--;
180 } 174 }
181 175
176 data->enable_gpio = -EINVAL;
182 return 0; 177 return 0;
183} 178}
184 179
@@ -245,13 +240,10 @@ static int pwm_backlight_probe(struct platform_device *pdev)
245 pb->dev = &pdev->dev; 240 pb->dev = &pdev->dev;
246 pb->enabled = false; 241 pb->enabled = false;
247 242
248 pb->enable_gpio = devm_gpiod_get(&pdev->dev, "enable"); 243 pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable");
249 if (IS_ERR(pb->enable_gpio)) { 244 if (IS_ERR(pb->enable_gpio)) {
250 ret = PTR_ERR(pb->enable_gpio); 245 ret = PTR_ERR(pb->enable_gpio);
251 if (ret == -ENOENT) 246 goto err_alloc;
252 pb->enable_gpio = NULL;
253 else
254 goto err_alloc;
255 } 247 }
256 248
257 /* 249 /*
@@ -398,7 +390,6 @@ static const struct dev_pm_ops pwm_backlight_pm_ops = {
398static struct platform_driver pwm_backlight_driver = { 390static struct platform_driver pwm_backlight_driver = {
399 .driver = { 391 .driver = {
400 .name = "pwm-backlight", 392 .name = "pwm-backlight",
401 .owner = THIS_MODULE,
402 .pm = &pwm_backlight_pm_ops, 393 .pm = &pwm_backlight_pm_ops,
403 .of_match_table = of_match_ptr(pwm_backlight_of_match), 394 .of_match_table = of_match_ptr(pwm_backlight_of_match),
404 }, 395 },
diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c
index 2d6d48196c6d..28bfa127fee4 100644
--- a/drivers/video/backlight/s6e63m0.c
+++ b/drivers/video/backlight/s6e63m0.c
@@ -507,19 +507,19 @@ static int s6e63m0_power_on(struct s6e63m0 *lcd)
507 if (!pd->power_on) { 507 if (!pd->power_on) {
508 dev_err(lcd->dev, "power_on is NULL.\n"); 508 dev_err(lcd->dev, "power_on is NULL.\n");
509 return -EINVAL; 509 return -EINVAL;
510 } else {
511 pd->power_on(lcd->ld, 1);
512 msleep(pd->power_on_delay);
513 } 510 }
514 511
512 pd->power_on(lcd->ld, 1);
513 msleep(pd->power_on_delay);
514
515 if (!pd->reset) { 515 if (!pd->reset) {
516 dev_err(lcd->dev, "reset is NULL.\n"); 516 dev_err(lcd->dev, "reset is NULL.\n");
517 return -EINVAL; 517 return -EINVAL;
518 } else {
519 pd->reset(lcd->ld);
520 msleep(pd->reset_delay);
521 } 518 }
522 519
520 pd->reset(lcd->ld);
521 msleep(pd->reset_delay);
522
523 ret = s6e63m0_ldi_init(lcd); 523 ret = s6e63m0_ldi_init(lcd);
524 if (ret) { 524 if (ret) {
525 dev_err(lcd->dev, "failed to initialize ldi.\n"); 525 dev_err(lcd->dev, "failed to initialize ldi.\n");
@@ -597,11 +597,6 @@ static int s6e63m0_get_power(struct lcd_device *ld)
597 return lcd->power; 597 return lcd->power;
598} 598}
599 599
600static int s6e63m0_get_brightness(struct backlight_device *bd)
601{
602 return bd->props.brightness;
603}
604
605static int s6e63m0_set_brightness(struct backlight_device *bd) 600static int s6e63m0_set_brightness(struct backlight_device *bd)
606{ 601{
607 int ret = 0, brightness = bd->props.brightness; 602 int ret = 0, brightness = bd->props.brightness;
@@ -629,7 +624,6 @@ static struct lcd_ops s6e63m0_lcd_ops = {
629}; 624};
630 625
631static const struct backlight_ops s6e63m0_backlight_ops = { 626static const struct backlight_ops s6e63m0_backlight_ops = {
632 .get_brightness = s6e63m0_get_brightness,
633 .update_status = s6e63m0_set_brightness, 627 .update_status = s6e63m0_set_brightness,
634}; 628};
635 629
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index 908016fc5829..30afce33ef2a 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -300,12 +300,14 @@ static int tdo24m_power(struct tdo24m *lcd, int power)
300static int tdo24m_set_power(struct lcd_device *ld, int power) 300static int tdo24m_set_power(struct lcd_device *ld, int power)
301{ 301{
302 struct tdo24m *lcd = lcd_get_data(ld); 302 struct tdo24m *lcd = lcd_get_data(ld);
303
303 return tdo24m_power(lcd, power); 304 return tdo24m_power(lcd, power);
304} 305}
305 306
306static int tdo24m_get_power(struct lcd_device *ld) 307static int tdo24m_get_power(struct lcd_device *ld)
307{ 308{
308 struct tdo24m *lcd = lcd_get_data(ld); 309 struct tdo24m *lcd = lcd_get_data(ld);
310
309 return lcd->power; 311 return lcd->power;
310} 312}
311 313
diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c
index 595dcf561020..61d72bffd402 100644
--- a/drivers/video/backlight/tps65217_bl.c
+++ b/drivers/video/backlight/tps65217_bl.c
@@ -109,15 +109,9 @@ static int tps65217_bl_update_status(struct backlight_device *bl)
109 return rc; 109 return rc;
110} 110}
111 111
112static int tps65217_bl_get_brightness(struct backlight_device *bl)
113{
114 return bl->props.brightness;
115}
116
117static const struct backlight_ops tps65217_bl_ops = { 112static const struct backlight_ops tps65217_bl_ops = {
118 .options = BL_CORE_SUSPENDRESUME, 113 .options = BL_CORE_SUSPENDRESUME,
119 .update_status = tps65217_bl_update_status, 114 .update_status = tps65217_bl_update_status,
120 .get_brightness = tps65217_bl_get_brightness
121}; 115};
122 116
123static int tps65217_bl_hw_init(struct tps65217_bl *tps65217_bl, 117static int tps65217_bl_hw_init(struct tps65217_bl *tps65217_bl,
@@ -329,7 +323,6 @@ static int tps65217_bl_probe(struct platform_device *pdev)
329static struct platform_driver tps65217_bl_driver = { 323static struct platform_driver tps65217_bl_driver = {
330 .probe = tps65217_bl_probe, 324 .probe = tps65217_bl_probe,
331 .driver = { 325 .driver = {
332 .owner = THIS_MODULE,
333 .name = "tps65217-bl", 326 .name = "tps65217-bl",
334 }, 327 },
335}; 328};
diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c
index 8b9455e93069..6eab0d6c262a 100644
--- a/drivers/video/backlight/wm831x_bl.c
+++ b/drivers/video/backlight/wm831x_bl.c
@@ -111,6 +111,7 @@ static int wm831x_backlight_update_status(struct backlight_device *bl)
111static int wm831x_backlight_get_brightness(struct backlight_device *bl) 111static int wm831x_backlight_get_brightness(struct backlight_device *bl)
112{ 112{
113 struct wm831x_backlight_data *data = bl_get_data(bl); 113 struct wm831x_backlight_data *data = bl_get_data(bl);
114
114 return data->current_brightness; 115 return data->current_brightness;
115} 116}
116 117
@@ -217,7 +218,6 @@ static int wm831x_backlight_probe(struct platform_device *pdev)
217static struct platform_driver wm831x_backlight_driver = { 218static struct platform_driver wm831x_backlight_driver = {
218 .driver = { 219 .driver = {
219 .name = "wm831x-backlight", 220 .name = "wm831x-backlight",
220 .owner = THIS_MODULE,
221 }, 221 },
222 .probe = wm831x_backlight_probe, 222 .probe = wm831x_backlight_probe,
223}; 223};
diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
index 61b182bf32a2..dbfe4eecf12e 100644
--- a/drivers/video/console/bitblit.c
+++ b/drivers/video/console/bitblit.c
@@ -205,7 +205,6 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
205static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, 205static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
206 int bottom_only) 206 int bottom_only)
207{ 207{
208 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
209 unsigned int cw = vc->vc_font.width; 208 unsigned int cw = vc->vc_font.width;
210 unsigned int ch = vc->vc_font.height; 209 unsigned int ch = vc->vc_font.height;
211 unsigned int rw = info->var.xres - (vc->vc_cols*cw); 210 unsigned int rw = info->var.xres - (vc->vc_cols*cw);
@@ -214,7 +213,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
214 unsigned int bs = info->var.yres - bh; 213 unsigned int bs = info->var.yres - bh;
215 struct fb_fillrect region; 214 struct fb_fillrect region;
216 215
217 region.color = attr_bgcol_ec(bgshift, vc, info); 216 region.color = 0;
218 region.rop = ROP_COPY; 217 region.rop = ROP_COPY;
219 218
220 if (rw && !bottom_only) { 219 if (rw && !bottom_only) {
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 57b1d44acbfe..eb976ee3a02f 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -448,8 +448,10 @@ static int __init fb_console_setup(char *this_opt)
448 return 1; 448 return 1;
449 449
450 while ((options = strsep(&this_opt, ",")) != NULL) { 450 while ((options = strsep(&this_opt, ",")) != NULL) {
451 if (!strncmp(options, "font:", 5)) 451 if (!strncmp(options, "font:", 5)) {
452 strlcpy(fontname, options + 5, sizeof(fontname)); 452 strlcpy(fontname, options + 5, sizeof(fontname));
453 continue;
454 }
453 455
454 if (!strncmp(options, "scrollback:", 11)) { 456 if (!strncmp(options, "scrollback:", 11)) {
455 options += 11; 457 options += 11;
@@ -457,13 +459,9 @@ static int __init fb_console_setup(char *this_opt)
457 fbcon_softback_size = simple_strtoul(options, &options, 0); 459 fbcon_softback_size = simple_strtoul(options, &options, 0);
458 if (*options == 'k' || *options == 'K') { 460 if (*options == 'k' || *options == 'K') {
459 fbcon_softback_size *= 1024; 461 fbcon_softback_size *= 1024;
460 options++;
461 } 462 }
462 if (*options != ',') 463 }
463 return 1; 464 continue;
464 options++;
465 } else
466 return 1;
467 } 465 }
468 466
469 if (!strncmp(options, "map:", 4)) { 467 if (!strncmp(options, "map:", 4)) {
@@ -478,8 +476,7 @@ static int __init fb_console_setup(char *this_opt)
478 476
479 fbcon_map_override(); 477 fbcon_map_override();
480 } 478 }
481 479 continue;
482 return 1;
483 } 480 }
484 481
485 if (!strncmp(options, "vc:", 3)) { 482 if (!strncmp(options, "vc:", 3)) {
@@ -491,7 +488,8 @@ static int __init fb_console_setup(char *this_opt)
491 if (*options++ == '-') 488 if (*options++ == '-')
492 last_fb_vc = simple_strtoul(options, &options, 10) - 1; 489 last_fb_vc = simple_strtoul(options, &options, 10) - 1;
493 fbcon_is_default = 0; 490 fbcon_is_default = 0;
494 } 491 continue;
492 }
495 493
496 if (!strncmp(options, "rotate:", 7)) { 494 if (!strncmp(options, "rotate:", 7)) {
497 options += 7; 495 options += 7;
@@ -499,6 +497,7 @@ static int __init fb_console_setup(char *this_opt)
499 initial_rotation = simple_strtoul(options, &options, 0); 497 initial_rotation = simple_strtoul(options, &options, 0);
500 if (initial_rotation > 3) 498 if (initial_rotation > 3)
501 initial_rotation = 0; 499 initial_rotation = 0;
500 continue;
502 } 501 }
503 } 502 }
504 return 1; 503 return 1;
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c
index 41b32ae23dac..5a3cbf6dff4d 100644
--- a/drivers/video/console/fbcon_ccw.c
+++ b/drivers/video/console/fbcon_ccw.c
@@ -197,9 +197,8 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info,
197 unsigned int bh = info->var.xres - (vc->vc_rows*ch); 197 unsigned int bh = info->var.xres - (vc->vc_rows*ch);
198 unsigned int bs = vc->vc_rows*ch; 198 unsigned int bs = vc->vc_rows*ch;
199 struct fb_fillrect region; 199 struct fb_fillrect region;
200 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
201 200
202 region.color = attr_bgcol_ec(bgshift,vc,info); 201 region.color = 0;
203 region.rop = ROP_COPY; 202 region.rop = ROP_COPY;
204 203
205 if (rw && !bottom_only) { 204 if (rw && !bottom_only) {
diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c
index a93670ef7f89..e7ee44db4e98 100644
--- a/drivers/video/console/fbcon_cw.c
+++ b/drivers/video/console/fbcon_cw.c
@@ -180,9 +180,8 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info,
180 unsigned int bh = info->var.xres - (vc->vc_rows*ch); 180 unsigned int bh = info->var.xres - (vc->vc_rows*ch);
181 unsigned int rs = info->var.yres - rw; 181 unsigned int rs = info->var.yres - rw;
182 struct fb_fillrect region; 182 struct fb_fillrect region;
183 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
184 183
185 region.color = attr_bgcol_ec(bgshift,vc,info); 184 region.color = 0;
186 region.rop = ROP_COPY; 185 region.rop = ROP_COPY;
187 186
188 if (rw && !bottom_only) { 187 if (rw && !bottom_only) {
diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c
index ff0872c0498b..19e3714abfe8 100644
--- a/drivers/video/console/fbcon_ud.c
+++ b/drivers/video/console/fbcon_ud.c
@@ -227,9 +227,8 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info,
227 unsigned int rw = info->var.xres - (vc->vc_cols*cw); 227 unsigned int rw = info->var.xres - (vc->vc_cols*cw);
228 unsigned int bh = info->var.yres - (vc->vc_rows*ch); 228 unsigned int bh = info->var.yres - (vc->vc_rows*ch);
229 struct fb_fillrect region; 229 struct fb_fillrect region;
230 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
231 230
232 region.color = attr_bgcol_ec(bgshift,vc,info); 231 region.color = 0;
233 region.rop = ROP_COPY; 232 region.rop = ROP_COPY;
234 233
235 if (rw && !bottom_only) { 234 if (rw && !bottom_only) {
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 6e6aa704fe84..517f565b65d7 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -56,7 +56,7 @@ static int cursor_size_lastfrom;
56static int cursor_size_lastto; 56static int cursor_size_lastto;
57static u32 vgacon_xres; 57static u32 vgacon_xres;
58static u32 vgacon_yres; 58static u32 vgacon_yres;
59static struct vgastate state; 59static struct vgastate vgastate;
60 60
61#define BLANK 0x0020 61#define BLANK 0x0020
62 62
@@ -400,7 +400,7 @@ static const char *vgacon_startup(void)
400 400
401 vga_video_num_lines = screen_info.orig_video_lines; 401 vga_video_num_lines = screen_info.orig_video_lines;
402 vga_video_num_columns = screen_info.orig_video_cols; 402 vga_video_num_columns = screen_info.orig_video_cols;
403 state.vgabase = NULL; 403 vgastate.vgabase = NULL;
404 404
405 if (screen_info.orig_video_mode == 7) { 405 if (screen_info.orig_video_mode == 7) {
406 /* Monochrome display */ 406 /* Monochrome display */
@@ -851,12 +851,12 @@ static void vga_set_palette(struct vc_data *vc, unsigned char *table)
851{ 851{
852 int i, j; 852 int i, j;
853 853
854 vga_w(state.vgabase, VGA_PEL_MSK, 0xff); 854 vga_w(vgastate.vgabase, VGA_PEL_MSK, 0xff);
855 for (i = j = 0; i < 16; i++) { 855 for (i = j = 0; i < 16; i++) {
856 vga_w(state.vgabase, VGA_PEL_IW, table[i]); 856 vga_w(vgastate.vgabase, VGA_PEL_IW, table[i]);
857 vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); 857 vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
858 vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); 858 vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
859 vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); 859 vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);
860 } 860 }
861} 861}
862 862
@@ -1008,7 +1008,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch)
1008 switch (blank) { 1008 switch (blank) {
1009 case 0: /* Unblank */ 1009 case 0: /* Unblank */
1010 if (vga_vesa_blanked) { 1010 if (vga_vesa_blanked) {
1011 vga_vesa_unblank(&state); 1011 vga_vesa_unblank(&vgastate);
1012 vga_vesa_blanked = 0; 1012 vga_vesa_blanked = 0;
1013 } 1013 }
1014 if (vga_palette_blanked) { 1014 if (vga_palette_blanked) {
@@ -1022,7 +1022,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch)
1022 case 1: /* Normal blanking */ 1022 case 1: /* Normal blanking */
1023 case -1: /* Obsolete */ 1023 case -1: /* Obsolete */
1024 if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) { 1024 if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) {
1025 vga_pal_blank(&state); 1025 vga_pal_blank(&vgastate);
1026 vga_palette_blanked = 1; 1026 vga_palette_blanked = 1;
1027 return 0; 1027 return 0;
1028 } 1028 }
@@ -1034,7 +1034,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch)
1034 return 1; 1034 return 1;
1035 default: /* VESA blanking */ 1035 default: /* VESA blanking */
1036 if (vga_video_type == VIDEO_TYPE_VGAC) { 1036 if (vga_video_type == VIDEO_TYPE_VGAC) {
1037 vga_vesa_blank(&state, blank - 1); 1037 vga_vesa_blank(&vgastate, blank - 1);
1038 vga_vesa_blanked = blank; 1038 vga_vesa_blanked = blank;
1039 } 1039 }
1040 return 0; 1040 return 0;
@@ -1280,7 +1280,7 @@ static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigne
1280 (charcount != 256 && charcount != 512)) 1280 (charcount != 256 && charcount != 512))
1281 return -EINVAL; 1281 return -EINVAL;
1282 1282
1283 rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512); 1283 rc = vgacon_do_font_op(&vgastate, font->data, 1, charcount == 512);
1284 if (rc) 1284 if (rc)
1285 return rc; 1285 return rc;
1286 1286
@@ -1299,7 +1299,7 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font)
1299 font->charcount = vga_512_chars ? 512 : 256; 1299 font->charcount = vga_512_chars ? 512 : 256;
1300 if (!font->data) 1300 if (!font->data)
1301 return 0; 1301 return 0;
1302 return vgacon_do_font_op(&state, font->data, 0, vga_512_chars); 1302 return vgacon_do_font_op(&vgastate, font->data, 0, vga_512_chars);
1303} 1303}
1304 1304
1305#else 1305#else
diff --git a/drivers/video/fbdev/68328fb.c b/drivers/video/fbdev/68328fb.c
index 552258c8f99d..17f21cedff9b 100644
--- a/drivers/video/fbdev/68328fb.c
+++ b/drivers/video/fbdev/68328fb.c
@@ -49,12 +49,6 @@
49#error wrong architecture for the MC68x328 frame buffer device 49#error wrong architecture for the MC68x328 frame buffer device
50#endif 50#endif
51 51
52#if defined(CONFIG_FB_68328_INVERT)
53#define MC68X328FB_MONO_VISUAL FB_VISUAL_MONO01
54#else
55#define MC68X328FB_MONO_VISUAL FB_VISUAL_MONO10
56#endif
57
58static u_long videomemory; 52static u_long videomemory;
59static u_long videomemorysize; 53static u_long videomemorysize;
60 54
@@ -462,7 +456,7 @@ int __init mc68x328fb_init(void)
462 fb_info.fix.line_length = 456 fb_info.fix.line_length =
463 get_line_length(mc68x328fb_default.xres_virtual, mc68x328fb_default.bits_per_pixel); 457 get_line_length(mc68x328fb_default.xres_virtual, mc68x328fb_default.bits_per_pixel);
464 fb_info.fix.visual = (mc68x328fb_default.bits_per_pixel) == 1 ? 458 fb_info.fix.visual = (mc68x328fb_default.bits_per_pixel) == 1 ?
465 MC68X328FB_MONO_VISUAL : FB_VISUAL_PSEUDOCOLOR; 459 FB_VISUAL_MONO10 : FB_VISUAL_PSEUDOCOLOR;
466 if (fb_info.var.bits_per_pixel == 1) { 460 if (fb_info.var.bits_per_pixel == 1) {
467 fb_info.var.red.length = fb_info.var.green.length = fb_info.var.blue.length = 1; 461 fb_info.var.red.length = fb_info.var.green.length = fb_info.var.blue.length = 1;
468 fb_info.var.red.offset = fb_info.var.green.offset = fb_info.var.blue.offset = 0; 462 fb_info.var.red.offset = fb_info.var.green.offset = fb_info.var.blue.offset = 0;
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 59c98bfd5a8a..c7bf606a8706 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -4,6 +4,7 @@
4 4
5menuconfig FB 5menuconfig FB
6 tristate "Support for frame buffer devices" 6 tristate "Support for frame buffer devices"
7 select FB_CMDLINE
7 ---help--- 8 ---help---
8 The frame buffer device provides an abstraction for the graphics 9 The frame buffer device provides an abstraction for the graphics
9 hardware. It represents the frame buffer of some video hardware and 10 hardware. It represents the frame buffer of some video hardware and
@@ -52,6 +53,9 @@ config FIRMWARE_EDID
52 combination with certain motherboards and monitors are known to 53 combination with certain motherboards and monitors are known to
53 suffer from this problem. 54 suffer from this problem.
54 55
56config FB_CMDLINE
57 bool
58
55config FB_DDC 59config FB_DDC
56 tristate 60 tristate
57 depends on FB 61 depends on FB
@@ -280,6 +284,8 @@ config FB_ARMCLCD
280 select FB_CFB_FILLRECT 284 select FB_CFB_FILLRECT
281 select FB_CFB_COPYAREA 285 select FB_CFB_COPYAREA
282 select FB_CFB_IMAGEBLIT 286 select FB_CFB_IMAGEBLIT
287 select FB_MODE_HELPERS if OF
288 select VIDEOMODE_HELPERS if OF
283 help 289 help
284 This framebuffer device driver is for the ARM PrimeCell PL110 290 This framebuffer device driver is for the ARM PrimeCell PL110
285 Colour LCD controller. ARM PrimeCells provide the building 291 Colour LCD controller. ARM PrimeCells provide the building
@@ -290,6 +296,12 @@ config FB_ARMCLCD
290 here and read <file:Documentation/kbuild/modules.txt>. The module 296 here and read <file:Documentation/kbuild/modules.txt>. The module
291 will be called amba-clcd. 297 will be called amba-clcd.
292 298
299# Helper logic selected only by the ARM Versatile platform family.
300config PLAT_VERSATILE_CLCD
301 def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS
302 depends on ARM
303 depends on FB_ARMCLCD && FB=y
304
293config FB_ACORN 305config FB_ACORN
294 bool "Acorn VIDC support" 306 bool "Acorn VIDC support"
295 depends on (FB = y) && ARM && ARCH_ACORN 307 depends on (FB = y) && ARM && ARCH_ACORN
@@ -301,15 +313,26 @@ config FB_ACORN
301 hardware found in Acorn RISC PCs and other ARM-based machines. If 313 hardware found in Acorn RISC PCs and other ARM-based machines. If
302 unsure, say N. 314 unsure, say N.
303 315
304config FB_CLPS711X 316config FB_CLPS711X_OLD
305 bool "CLPS711X LCD support" 317 tristate
306 depends on (FB = y) && ARM && ARCH_CLPS711X
307 select FB_CFB_FILLRECT 318 select FB_CFB_FILLRECT
308 select FB_CFB_COPYAREA 319 select FB_CFB_COPYAREA
309 select FB_CFB_IMAGEBLIT 320 select FB_CFB_IMAGEBLIT
321
322config FB_CLPS711X
323 tristate "CLPS711X LCD support"
324 depends on FB && (ARCH_CLPS711X || COMPILE_TEST)
325 select FB_CLPS711X_OLD if ARCH_CLPS711X && !ARCH_MULTIPLATFORM
326 select BACKLIGHT_LCD_SUPPORT
327 select FB_MODE_HELPERS
328 select FB_SYS_FILLRECT
329 select FB_SYS_COPYAREA
330 select FB_SYS_IMAGEBLIT
331 select LCD_CLASS_DEVICE
332 select VIDEOMODE_HELPERS
310 help 333 help
311 Say Y to enable the Framebuffer driver for the CLPS7111 and 334 Say Y to enable the Framebuffer driver for the Cirrus Logic
312 EP7212 processors. 335 CLPS711X CPUs.
313 336
314config FB_SA1100 337config FB_SA1100
315 bool "SA-1100 LCD support" 338 bool "SA-1100 LCD support"
@@ -2018,8 +2041,8 @@ config FB_TMIO_ACCELL
2018 2041
2019config FB_S3C 2042config FB_S3C
2020 tristate "Samsung S3C framebuffer support" 2043 tristate "Samsung S3C framebuffer support"
2021 depends on FB && (CPU_S3C2416 || ARCH_S3C64XX || ARCH_S5P64X0 || \ 2044 depends on FB && (CPU_S3C2416 || ARCH_S3C64XX || \
2022 ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS) 2045 ARCH_S5PV210 || ARCH_EXYNOS)
2023 select FB_CFB_FILLRECT 2046 select FB_CFB_FILLRECT
2024 select FB_CFB_COPYAREA 2047 select FB_CFB_COPYAREA
2025 select FB_CFB_IMAGEBLIT 2048 select FB_CFB_IMAGEBLIT
@@ -2333,10 +2356,11 @@ config FB_MSM
2333config FB_MX3 2356config FB_MX3
2334 tristate "MX3 Framebuffer support" 2357 tristate "MX3 Framebuffer support"
2335 depends on FB && MX3_IPU 2358 depends on FB && MX3_IPU
2359 select BACKLIGHT_CLASS_DEVICE
2360 select BACKLIGHT_LCD_SUPPORT
2336 select FB_CFB_FILLRECT 2361 select FB_CFB_FILLRECT
2337 select FB_CFB_COPYAREA 2362 select FB_CFB_COPYAREA
2338 select FB_CFB_IMAGEBLIT 2363 select FB_CFB_IMAGEBLIT
2339 select BACKLIGHT_CLASS_DEVICE
2340 default y 2364 default y
2341 help 2365 help
2342 This is a framebuffer device for the i.MX31 LCD Controller. So 2366 This is a framebuffer device for the i.MX31 LCD Controller. So
diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile
index 0284f2a12538..1979afffccfe 100644
--- a/drivers/video/fbdev/Makefile
+++ b/drivers/video/fbdev/Makefile
@@ -14,7 +14,8 @@ obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o
14# Hardware specific drivers go first 14# Hardware specific drivers go first
15obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o 15obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o
16obj-$(CONFIG_FB_ARC) += arcfb.o 16obj-$(CONFIG_FB_ARC) += arcfb.o
17obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o 17obj-$(CONFIG_FB_CLPS711X) += clps711x-fb.o
18obj-$(CONFIG_FB_CLPS711X_OLD) += clps711xfb.o
18obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o 19obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o
19obj-$(CONFIG_FB_GRVGA) += grvga.o 20obj-$(CONFIG_FB_GRVGA) += grvga.o
20obj-$(CONFIG_FB_PM2) += pm2fb.o 21obj-$(CONFIG_FB_PM2) += pm2fb.o
@@ -78,6 +79,7 @@ obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o
78obj-$(CONFIG_FB_PVR2) += pvr2fb.o 79obj-$(CONFIG_FB_PVR2) += pvr2fb.o
79obj-$(CONFIG_FB_VOODOO1) += sstfb.o 80obj-$(CONFIG_FB_VOODOO1) += sstfb.o
80obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o 81obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o
82obj-$(CONFIG_PLAT_VERSATILE_CLCD) += amba-clcd-versatile.o
81obj-$(CONFIG_FB_GOLDFISH) += goldfishfb.o 83obj-$(CONFIG_FB_GOLDFISH) += goldfishfb.o
82obj-$(CONFIG_FB_68328) += 68328fb.o 84obj-$(CONFIG_FB_68328) += 68328fb.o
83obj-$(CONFIG_FB_GBE) += gbefb.o 85obj-$(CONFIG_FB_GBE) += gbefb.o
diff --git a/drivers/video/fbdev/amba-clcd-versatile.c b/drivers/video/fbdev/amba-clcd-versatile.c
new file mode 100644
index 000000000000..7a8afcd4573e
--- /dev/null
+++ b/drivers/video/fbdev/amba-clcd-versatile.c
@@ -0,0 +1,182 @@
1#include <linux/device.h>
2#include <linux/dma-mapping.h>
3#include <linux/amba/bus.h>
4#include <linux/amba/clcd.h>
5#include <linux/platform_data/video-clcd-versatile.h>
6
7static struct clcd_panel vga = {
8 .mode = {
9 .name = "VGA",
10 .refresh = 60,
11 .xres = 640,
12 .yres = 480,
13 .pixclock = 39721,
14 .left_margin = 40,
15 .right_margin = 24,
16 .upper_margin = 32,
17 .lower_margin = 11,
18 .hsync_len = 96,
19 .vsync_len = 2,
20 .sync = 0,
21 .vmode = FB_VMODE_NONINTERLACED,
22 },
23 .width = -1,
24 .height = -1,
25 .tim2 = TIM2_BCD | TIM2_IPC,
26 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
27 .caps = CLCD_CAP_5551 | CLCD_CAP_565 | CLCD_CAP_888,
28 .bpp = 16,
29};
30
31static struct clcd_panel xvga = {
32 .mode = {
33 .name = "XVGA",
34 .refresh = 60,
35 .xres = 1024,
36 .yres = 768,
37 .pixclock = 15748,
38 .left_margin = 152,
39 .right_margin = 48,
40 .upper_margin = 23,
41 .lower_margin = 3,
42 .hsync_len = 104,
43 .vsync_len = 4,
44 .sync = 0,
45 .vmode = FB_VMODE_NONINTERLACED,
46 },
47 .width = -1,
48 .height = -1,
49 .tim2 = TIM2_BCD | TIM2_IPC,
50 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
51 .caps = CLCD_CAP_5551 | CLCD_CAP_565 | CLCD_CAP_888,
52 .bpp = 16,
53};
54
55/* Sanyo TM38QV67A02A - 3.8 inch QVGA (320x240) Color TFT */
56static struct clcd_panel sanyo_tm38qv67a02a = {
57 .mode = {
58 .name = "Sanyo TM38QV67A02A",
59 .refresh = 116,
60 .xres = 320,
61 .yres = 240,
62 .pixclock = 100000,
63 .left_margin = 6,
64 .right_margin = 6,
65 .upper_margin = 5,
66 .lower_margin = 5,
67 .hsync_len = 6,
68 .vsync_len = 6,
69 .sync = 0,
70 .vmode = FB_VMODE_NONINTERLACED,
71 },
72 .width = -1,
73 .height = -1,
74 .tim2 = TIM2_BCD,
75 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
76 .caps = CLCD_CAP_5551,
77 .bpp = 16,
78};
79
80static struct clcd_panel sanyo_2_5_in = {
81 .mode = {
82 .name = "Sanyo QVGA Portrait",
83 .refresh = 116,
84 .xres = 240,
85 .yres = 320,
86 .pixclock = 100000,
87 .left_margin = 20,
88 .right_margin = 10,
89 .upper_margin = 2,
90 .lower_margin = 2,
91 .hsync_len = 10,
92 .vsync_len = 2,
93 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
94 .vmode = FB_VMODE_NONINTERLACED,
95 },
96 .width = -1,
97 .height = -1,
98 .tim2 = TIM2_IVS | TIM2_IHS | TIM2_IPC,
99 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
100 .caps = CLCD_CAP_5551,
101 .bpp = 16,
102};
103
104/* Epson L2F50113T00 - 2.2 inch 176x220 Color TFT */
105static struct clcd_panel epson_l2f50113t00 = {
106 .mode = {
107 .name = "Epson L2F50113T00",
108 .refresh = 390,
109 .xres = 176,
110 .yres = 220,
111 .pixclock = 62500,
112 .left_margin = 3,
113 .right_margin = 2,
114 .upper_margin = 1,
115 .lower_margin = 0,
116 .hsync_len = 3,
117 .vsync_len = 2,
118 .sync = 0,
119 .vmode = FB_VMODE_NONINTERLACED,
120 },
121 .width = -1,
122 .height = -1,
123 .tim2 = TIM2_BCD | TIM2_IPC,
124 .cntl = CNTL_LCDTFT | CNTL_BGR | CNTL_LCDVCOMP(1),
125 .caps = CLCD_CAP_5551,
126 .bpp = 16,
127};
128
129static struct clcd_panel *panels[] = {
130 &vga,
131 &xvga,
132 &sanyo_tm38qv67a02a,
133 &sanyo_2_5_in,
134 &epson_l2f50113t00,
135};
136
137struct clcd_panel *versatile_clcd_get_panel(const char *name)
138{
139 int i;
140
141 for (i = 0; i < ARRAY_SIZE(panels); i++)
142 if (strcmp(panels[i]->mode.name, name) == 0)
143 break;
144
145 if (i < ARRAY_SIZE(panels))
146 return panels[i];
147
148 pr_err("CLCD: couldn't get parameters for panel %s\n", name);
149
150 return NULL;
151}
152
153int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
154{
155 dma_addr_t dma;
156
157 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
158 &dma, GFP_KERNEL);
159 if (!fb->fb.screen_base) {
160 pr_err("CLCD: unable to map framebuffer\n");
161 return -ENOMEM;
162 }
163
164 fb->fb.fix.smem_start = dma;
165 fb->fb.fix.smem_len = framesize;
166
167 return 0;
168}
169
170int versatile_clcd_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vma)
171{
172 return dma_mmap_writecombine(&fb->dev->dev, vma,
173 fb->fb.screen_base,
174 fb->fb.fix.smem_start,
175 fb->fb.fix.smem_len);
176}
177
178void versatile_clcd_remove_dma(struct clcd_fb *fb)
179{
180 dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
181 fb->fb.screen_base, fb->fb.fix.smem_start);
182}
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c
index 14d6b3793e0a..6ad23bd3523a 100644
--- a/drivers/video/fbdev/amba-clcd.c
+++ b/drivers/video/fbdev/amba-clcd.c
@@ -24,8 +24,16 @@
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/clcd.h> 26#include <linux/amba/clcd.h>
27#include <linux/bitops.h>
27#include <linux/clk.h> 28#include <linux/clk.h>
28#include <linux/hardirq.h> 29#include <linux/hardirq.h>
30#include <linux/dma-mapping.h>
31#include <linux/of.h>
32#include <linux/of_address.h>
33#include <linux/of_graph.h>
34#include <video/display_timing.h>
35#include <video/of_display_timing.h>
36#include <video/videomode.h>
29 37
30#include <asm/sizes.h> 38#include <asm/sizes.h>
31 39
@@ -543,6 +551,269 @@ static int clcdfb_register(struct clcd_fb *fb)
543 return ret; 551 return ret;
544} 552}
545 553
554#ifdef CONFIG_OF
555static int clcdfb_of_get_dpi_panel_mode(struct device_node *node,
556 struct fb_videomode *mode)
557{
558 int err;
559 struct display_timing timing;
560 struct videomode video;
561
562 err = of_get_display_timing(node, "panel-timing", &timing);
563 if (err)
564 return err;
565
566 videomode_from_timing(&timing, &video);
567
568 err = fb_videomode_from_videomode(&video, mode);
569 if (err)
570 return err;
571
572 return 0;
573}
574
575static int clcdfb_snprintf_mode(char *buf, int size, struct fb_videomode *mode)
576{
577 return snprintf(buf, size, "%ux%u@%u", mode->xres, mode->yres,
578 mode->refresh);
579}
580
581static int clcdfb_of_get_mode(struct device *dev, struct device_node *endpoint,
582 struct fb_videomode *mode)
583{
584 int err;
585 struct device_node *panel;
586 char *name;
587 int len;
588
589 panel = of_graph_get_remote_port_parent(endpoint);
590 if (!panel)
591 return -ENODEV;
592
593 /* Only directly connected DPI panels supported for now */
594 if (of_device_is_compatible(panel, "panel-dpi"))
595 err = clcdfb_of_get_dpi_panel_mode(panel, mode);
596 else
597 err = -ENOENT;
598 if (err)
599 return err;
600
601 len = clcdfb_snprintf_mode(NULL, 0, mode);
602 name = devm_kzalloc(dev, len + 1, GFP_KERNEL);
603 clcdfb_snprintf_mode(name, len + 1, mode);
604 mode->name = name;
605
606 return 0;
607}
608
609static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0)
610{
611 static struct {
612 unsigned int part;
613 u32 r0, g0, b0;
614 u32 caps;
615 } panels[] = {
616 { 0x110, 1, 7, 13, CLCD_CAP_5551 },
617 { 0x110, 0, 8, 16, CLCD_CAP_888 },
618 { 0x111, 4, 14, 20, CLCD_CAP_444 },
619 { 0x111, 3, 11, 19, CLCD_CAP_444 | CLCD_CAP_5551 },
620 { 0x111, 3, 10, 19, CLCD_CAP_444 | CLCD_CAP_5551 |
621 CLCD_CAP_565 },
622 { 0x111, 0, 8, 16, CLCD_CAP_444 | CLCD_CAP_5551 |
623 CLCD_CAP_565 | CLCD_CAP_888 },
624 };
625 int i;
626
627 /* Bypass pixel clock divider, data output on the falling edge */
628 fb->panel->tim2 = TIM2_BCD | TIM2_IPC;
629
630 /* TFT display, vert. comp. interrupt at the start of the back porch */
631 fb->panel->cntl |= CNTL_LCDTFT | CNTL_LCDVCOMP(1);
632
633 fb->panel->caps = 0;
634
635 /* Match the setup with known variants */
636 for (i = 0; i < ARRAY_SIZE(panels) && !fb->panel->caps; i++) {
637 if (amba_part(fb->dev) != panels[i].part)
638 continue;
639 if (g0 != panels[i].g0)
640 continue;
641 if (r0 == panels[i].r0 && b0 == panels[i].b0)
642 fb->panel->caps = panels[i].caps;
643 }
644
645 return fb->panel->caps ? 0 : -EINVAL;
646}
647
648static int clcdfb_of_init_display(struct clcd_fb *fb)
649{
650 struct device_node *endpoint;
651 int err;
652 unsigned int bpp;
653 u32 max_bandwidth;
654 u32 tft_r0b0g0[3];
655
656 fb->panel = devm_kzalloc(&fb->dev->dev, sizeof(*fb->panel), GFP_KERNEL);
657 if (!fb->panel)
658 return -ENOMEM;
659
660 endpoint = of_graph_get_next_endpoint(fb->dev->dev.of_node, NULL);
661 if (!endpoint)
662 return -ENODEV;
663
664 err = clcdfb_of_get_mode(&fb->dev->dev, endpoint, &fb->panel->mode);
665 if (err)
666 return err;
667
668 err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth",
669 &max_bandwidth);
670 if (!err) {
671 /*
672 * max_bandwidth is in bytes per second and pixclock in
673 * pico-seconds, so the maximum allowed bits per pixel is
674 * 8 * max_bandwidth / (PICOS2KHZ(pixclock) * 1000)
675 * Rearrange this calculation to avoid overflow and then ensure
676 * result is a valid format.
677 */
678 bpp = max_bandwidth / (1000 / 8)
679 / PICOS2KHZ(fb->panel->mode.pixclock);
680 bpp = rounddown_pow_of_two(bpp);
681 if (bpp > 32)
682 bpp = 32;
683 } else
684 bpp = 32;
685 fb->panel->bpp = bpp;
686
687#ifdef CONFIG_CPU_BIG_ENDIAN
688 fb->panel->cntl |= CNTL_BEBO;
689#endif
690 fb->panel->width = -1;
691 fb->panel->height = -1;
692
693 if (of_property_read_u32_array(endpoint,
694 "arm,pl11x,tft-r0g0b0-pads",
695 tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) == 0)
696 return clcdfb_of_init_tft_panel(fb, tft_r0b0g0[0],
697 tft_r0b0g0[1], tft_r0b0g0[2]);
698
699 return -ENOENT;
700}
701
702static int clcdfb_of_vram_setup(struct clcd_fb *fb)
703{
704 int err;
705 struct device_node *memory;
706 u64 size;
707
708 err = clcdfb_of_init_display(fb);
709 if (err)
710 return err;
711
712 memory = of_parse_phandle(fb->dev->dev.of_node, "memory-region", 0);
713 if (!memory)
714 return -ENODEV;
715
716 fb->fb.screen_base = of_iomap(memory, 0);
717 if (!fb->fb.screen_base)
718 return -ENOMEM;
719
720 fb->fb.fix.smem_start = of_translate_address(memory,
721 of_get_address(memory, 0, &size, NULL));
722 fb->fb.fix.smem_len = size;
723
724 return 0;
725}
726
727static int clcdfb_of_vram_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
728{
729 unsigned long off, user_size, kernel_size;
730
731
732 off = vma->vm_pgoff << PAGE_SHIFT;
733 user_size = vma->vm_end - vma->vm_start;
734 kernel_size = fb->fb.fix.smem_len;
735
736 if (off >= kernel_size || user_size > (kernel_size - off))
737 return -ENXIO;
738
739 return remap_pfn_range(vma, vma->vm_start,
740 __phys_to_pfn(fb->fb.fix.smem_start) + vma->vm_pgoff,
741 user_size,
742 pgprot_writecombine(vma->vm_page_prot));
743}
744
745static void clcdfb_of_vram_remove(struct clcd_fb *fb)
746{
747 iounmap(fb->fb.screen_base);
748}
749
750static int clcdfb_of_dma_setup(struct clcd_fb *fb)
751{
752 unsigned long framesize;
753 dma_addr_t dma;
754 int err;
755
756 err = clcdfb_of_init_display(fb);
757 if (err)
758 return err;
759
760 framesize = fb->panel->mode.xres * fb->panel->mode.yres *
761 fb->panel->bpp / 8;
762 fb->fb.screen_base = dma_alloc_coherent(&fb->dev->dev, framesize,
763 &dma, GFP_KERNEL);
764 if (!fb->fb.screen_base)
765 return -ENOMEM;
766
767 fb->fb.fix.smem_start = dma;
768 fb->fb.fix.smem_len = framesize;
769
770 return 0;
771}
772
773static int clcdfb_of_dma_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
774{
775 return dma_mmap_writecombine(&fb->dev->dev, vma, fb->fb.screen_base,
776 fb->fb.fix.smem_start, fb->fb.fix.smem_len);
777}
778
779static void clcdfb_of_dma_remove(struct clcd_fb *fb)
780{
781 dma_free_coherent(&fb->dev->dev, fb->fb.fix.smem_len,
782 fb->fb.screen_base, fb->fb.fix.smem_start);
783}
784
785static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
786{
787 struct clcd_board *board = devm_kzalloc(&dev->dev, sizeof(*board),
788 GFP_KERNEL);
789 struct device_node *node = dev->dev.of_node;
790
791 if (!board)
792 return NULL;
793
794 board->name = of_node_full_name(node);
795 board->caps = CLCD_CAP_ALL;
796 board->check = clcdfb_check;
797 board->decode = clcdfb_decode;
798 if (of_find_property(node, "memory-region", NULL)) {
799 board->setup = clcdfb_of_vram_setup;
800 board->mmap = clcdfb_of_vram_mmap;
801 board->remove = clcdfb_of_vram_remove;
802 } else {
803 board->setup = clcdfb_of_dma_setup;
804 board->mmap = clcdfb_of_dma_mmap;
805 board->remove = clcdfb_of_dma_remove;
806 }
807
808 return board;
809}
810#else
811static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
812{
813 return NULL;
814}
815#endif
816
546static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id) 817static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)
547{ 818{
548 struct clcd_board *board = dev_get_platdata(&dev->dev); 819 struct clcd_board *board = dev_get_platdata(&dev->dev);
@@ -550,6 +821,9 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)
550 int ret; 821 int ret;
551 822
552 if (!board) 823 if (!board)
824 board = clcdfb_of_get_board(dev);
825
826 if (!board)
553 return -EINVAL; 827 return -EINVAL;
554 828
555 ret = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)); 829 ret = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index d36e830d6fc6..9ec81d46fc57 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -24,9 +24,9 @@
24#include <linux/of_device.h> 24#include <linux/of_device.h>
25#include <linux/of_gpio.h> 25#include <linux/of_gpio.h>
26#include <video/of_display_timing.h> 26#include <video/of_display_timing.h>
27#include <linux/regulator/consumer.h>
27#include <video/videomode.h> 28#include <video/videomode.h>
28 29
29#include <mach/cpu.h>
30#include <asm/gpio.h> 30#include <asm/gpio.h>
31 31
32#include <video/atmel_lcdc.h> 32#include <video/atmel_lcdc.h>
@@ -60,6 +60,7 @@ struct atmel_lcdfb_info {
60 struct atmel_lcdfb_pdata pdata; 60 struct atmel_lcdfb_pdata pdata;
61 61
62 struct atmel_lcdfb_config *config; 62 struct atmel_lcdfb_config *config;
63 struct regulator *reg_lcd;
63}; 64};
64 65
65struct atmel_lcdfb_power_ctrl_gpio { 66struct atmel_lcdfb_power_ctrl_gpio {
@@ -290,7 +291,7 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo)
290 291
291 /* contrast pwm can be 'inverted' */ 292 /* contrast pwm can be 'inverted' */
292 if (pdata->lcdcon_pol_negative) 293 if (pdata->lcdcon_pol_negative)
293 contrast_ctr &= ~(ATMEL_LCDC_POL_POSITIVE); 294 contrast_ctr &= ~(ATMEL_LCDC_POL_POSITIVE);
294 295
295 /* have some default contrast/backlight settings */ 296 /* have some default contrast/backlight settings */
296 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr); 297 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
@@ -302,10 +303,24 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo)
302 303
303static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on) 304static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on)
304{ 305{
306 int ret;
305 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; 307 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
306 308
307 if (pdata->atmel_lcdfb_power_control) 309 if (pdata->atmel_lcdfb_power_control)
308 pdata->atmel_lcdfb_power_control(pdata, on); 310 pdata->atmel_lcdfb_power_control(pdata, on);
311 else if (sinfo->reg_lcd) {
312 if (on) {
313 ret = regulator_enable(sinfo->reg_lcd);
314 if (ret)
315 dev_err(&sinfo->pdev->dev,
316 "lcd regulator enable failed: %d\n", ret);
317 } else {
318 ret = regulator_disable(sinfo->reg_lcd);
319 if (ret)
320 dev_err(&sinfo->pdev->dev,
321 "lcd regulator disable failed: %d\n", ret);
322 }
323 }
309} 324}
310 325
311static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = { 326static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
@@ -1097,16 +1112,19 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
1097 pdata->lcd_wiring_mode = ret; 1112 pdata->lcd_wiring_mode = ret;
1098 1113
1099 pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight"); 1114 pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight");
1115 pdata->lcdcon_pol_negative = of_property_read_bool(display_np, "atmel,lcdcon-backlight-inverted");
1100 1116
1101 timings = of_get_display_timings(display_np); 1117 timings = of_get_display_timings(display_np);
1102 if (!timings) { 1118 if (!timings) {
1103 dev_err(dev, "failed to get display timings\n"); 1119 dev_err(dev, "failed to get display timings\n");
1120 ret = -EINVAL;
1104 goto put_display_node; 1121 goto put_display_node;
1105 } 1122 }
1106 1123
1107 timings_np = of_find_node_by_name(display_np, "display-timings"); 1124 timings_np = of_find_node_by_name(display_np, "display-timings");
1108 if (!timings_np) { 1125 if (!timings_np) {
1109 dev_err(dev, "failed to find display-timings node\n"); 1126 dev_err(dev, "failed to find display-timings node\n");
1127 ret = -ENODEV;
1110 goto put_display_node; 1128 goto put_display_node;
1111 } 1129 }
1112 1130
@@ -1192,6 +1210,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
1192 if (!sinfo->config) 1210 if (!sinfo->config)
1193 goto free_info; 1211 goto free_info;
1194 1212
1213 sinfo->reg_lcd = devm_regulator_get(&pdev->dev, "lcd");
1214 if (IS_ERR(sinfo->reg_lcd))
1215 sinfo->reg_lcd = NULL;
1216
1195 info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; 1217 info->flags = ATMEL_LCDFB_FBINFO_DEFAULT;
1196 info->pseudo_palette = sinfo->pseudo_palette; 1218 info->pseudo_palette = sinfo->pseudo_palette;
1197 info->fbops = &atmel_lcdfb_ops; 1219 info->fbops = &atmel_lcdfb_ops;
diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index 52108be69e77..aedf2fbf9bf6 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -324,14 +324,61 @@ struct aty128_meminfo {
324}; 324};
325 325
326/* various memory configurations */ 326/* various memory configurations */
327static const struct aty128_meminfo sdr_128 = 327static const struct aty128_meminfo sdr_128 = {
328 { 4, 4, 3, 3, 1, 3, 1, 16, 30, 16, "128-bit SDR SGRAM (1:1)" }; 328 .ML = 4,
329static const struct aty128_meminfo sdr_64 = 329 .MB = 4,
330 { 4, 8, 3, 3, 1, 3, 1, 17, 46, 17, "64-bit SDR SGRAM (1:1)" }; 330 .Trcd = 3,
331static const struct aty128_meminfo sdr_sgram = 331 .Trp = 3,
332 { 4, 4, 1, 2, 1, 2, 1, 16, 24, 16, "64-bit SDR SGRAM (2:1)" }; 332 .Twr = 1,
333static const struct aty128_meminfo ddr_sgram = 333 .CL = 3,
334 { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" }; 334 .Tr2w = 1,
335 .LoopLatency = 16,
336 .DspOn = 30,
337 .Rloop = 16,
338 .name = "128-bit SDR SGRAM (1:1)",
339};
340
341static const struct aty128_meminfo sdr_64 = {
342 .ML = 4,
343 .MB = 8,
344 .Trcd = 3,
345 .Trp = 3,
346 .Twr = 1,
347 .CL = 3,
348 .Tr2w = 1,
349 .LoopLatency = 17,
350 .DspOn = 46,
351 .Rloop = 17,
352 .name = "64-bit SDR SGRAM (1:1)",
353};
354
355static const struct aty128_meminfo sdr_sgram = {
356 .ML = 4,
357 .MB = 4,
358 .Trcd = 1,
359 .Trp = 2,
360 .Twr = 1,
361 .CL = 2,
362 .Tr2w = 1,
363 .LoopLatency = 16,
364 .DspOn = 24,
365 .Rloop = 16,
366 .name = "64-bit SDR SGRAM (2:1)",
367};
368
369static const struct aty128_meminfo ddr_sgram = {
370 .ML = 4,
371 .MB = 4,
372 .Trcd = 3,
373 .Trp = 3,
374 .Twr = 2,
375 .CL = 3,
376 .Tr2w = 1,
377 .LoopLatency = 16,
378 .DspOn = 31,
379 .Rloop = 16,
380 .name = "64-bit DDR SGRAM",
381};
335 382
336static struct fb_fix_screeninfo aty128fb_fix = { 383static struct fb_fix_screeninfo aty128fb_fix = {
337 .id = "ATY Rage128", 384 .id = "ATY Rage128",
@@ -1802,13 +1849,7 @@ static int aty128_bl_update_status(struct backlight_device *bd)
1802 return 0; 1849 return 0;
1803} 1850}
1804 1851
1805static int aty128_bl_get_brightness(struct backlight_device *bd)
1806{
1807 return bd->props.brightness;
1808}
1809
1810static const struct backlight_ops aty128_bl_data = { 1852static const struct backlight_ops aty128_bl_data = {
1811 .get_brightness = aty128_bl_get_brightness,
1812 .update_status = aty128_bl_update_status, 1853 .update_status = aty128_bl_update_status,
1813}; 1854};
1814 1855
diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index c3d0074a32db..37ec09b3fffd 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -2211,13 +2211,7 @@ static int aty_bl_update_status(struct backlight_device *bd)
2211 return 0; 2211 return 0;
2212} 2212}
2213 2213
2214static int aty_bl_get_brightness(struct backlight_device *bd)
2215{
2216 return bd->props.brightness;
2217}
2218
2219static const struct backlight_ops aty_bl_data = { 2214static const struct backlight_ops aty_bl_data = {
2220 .get_brightness = aty_bl_get_brightness,
2221 .update_status = aty_bl_update_status, 2215 .update_status = aty_bl_update_status,
2222}; 2216};
2223 2217
diff --git a/drivers/video/fbdev/aty/radeon_backlight.c b/drivers/video/fbdev/aty/radeon_backlight.c
index db572df7e1ef..301d6d6aeead 100644
--- a/drivers/video/fbdev/aty/radeon_backlight.c
+++ b/drivers/video/fbdev/aty/radeon_backlight.c
@@ -123,13 +123,7 @@ static int radeon_bl_update_status(struct backlight_device *bd)
123 return 0; 123 return 0;
124} 124}
125 125
126static int radeon_bl_get_brightness(struct backlight_device *bd)
127{
128 return bd->props.brightness;
129}
130
131static const struct backlight_ops radeon_bl_data = { 126static const struct backlight_ops radeon_bl_data = {
132 .get_brightness = radeon_bl_get_brightness,
133 .update_status = radeon_bl_update_status, 127 .update_status = radeon_bl_update_status,
134}; 128};
135 129
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index 372d4aea9d1c..0676746ec68c 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -41,6 +41,7 @@
41 * with this program; if not, write to the Free Software Foundation, Inc., 41 * with this program; if not, write to the Free Software Foundation, Inc.,
42 * 675 Mass Ave, Cambridge, MA 02139, USA. 42 * 675 Mass Ave, Cambridge, MA 02139, USA.
43 */ 43 */
44#include <linux/clk.h>
44#include <linux/module.h> 45#include <linux/module.h>
45#include <linux/kernel.h> 46#include <linux/kernel.h>
46#include <linux/errno.h> 47#include <linux/errno.h>
@@ -113,7 +114,7 @@ static int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi)
113 case VESA_NO_BLANKING: 114 case VESA_NO_BLANKING:
114 /* Turn on panel */ 115 /* Turn on panel */
115 fbdev->regs->lcd_control |= LCD_CONTROL_GO; 116 fbdev->regs->lcd_control |= LCD_CONTROL_GO;
116 au_sync(); 117 wmb(); /* drain writebuffer */
117 break; 118 break;
118 119
119 case VESA_VSYNC_SUSPEND: 120 case VESA_VSYNC_SUSPEND:
@@ -121,7 +122,7 @@ static int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi)
121 case VESA_POWERDOWN: 122 case VESA_POWERDOWN:
122 /* Turn off panel */ 123 /* Turn off panel */
123 fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; 124 fbdev->regs->lcd_control &= ~LCD_CONTROL_GO;
124 au_sync(); 125 wmb(); /* drain writebuffer */
125 break; 126 break;
126 default: 127 default:
127 break; 128 break;
@@ -434,7 +435,7 @@ static int au1100fb_drv_probe(struct platform_device *dev)
434 struct au1100fb_device *fbdev = NULL; 435 struct au1100fb_device *fbdev = NULL;
435 struct resource *regs_res; 436 struct resource *regs_res;
436 unsigned long page; 437 unsigned long page;
437 u32 sys_clksrc; 438 struct clk *c;
438 439
439 /* Allocate new device private */ 440 /* Allocate new device private */
440 fbdev = devm_kzalloc(&dev->dev, sizeof(struct au1100fb_device), 441 fbdev = devm_kzalloc(&dev->dev, sizeof(struct au1100fb_device),
@@ -473,6 +474,13 @@ static int au1100fb_drv_probe(struct platform_device *dev)
473 print_dbg("Register memory map at %p", fbdev->regs); 474 print_dbg("Register memory map at %p", fbdev->regs);
474 print_dbg("phys=0x%08x, size=%d", fbdev->regs_phys, fbdev->regs_len); 475 print_dbg("phys=0x%08x, size=%d", fbdev->regs_phys, fbdev->regs_len);
475 476
477 c = clk_get(NULL, "lcd_intclk");
478 if (!IS_ERR(c)) {
479 fbdev->lcdclk = c;
480 clk_set_rate(c, 48000000);
481 clk_prepare_enable(c);
482 }
483
476 /* Allocate the framebuffer to the maximum screen size * nbr of video buffers */ 484 /* Allocate the framebuffer to the maximum screen size * nbr of video buffers */
477 fbdev->fb_len = fbdev->panel->xres * fbdev->panel->yres * 485 fbdev->fb_len = fbdev->panel->xres * fbdev->panel->yres *
478 (fbdev->panel->bpp >> 3) * AU1100FB_NBR_VIDEO_BUFFERS; 486 (fbdev->panel->bpp >> 3) * AU1100FB_NBR_VIDEO_BUFFERS;
@@ -506,10 +514,6 @@ static int au1100fb_drv_probe(struct platform_device *dev)
506 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem); 514 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem);
507 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024); 515 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024);
508 516
509 /* Setup LCD clock to AUX (48 MHz) */
510 sys_clksrc = au_readl(SYS_CLKSRC) & ~(SYS_CS_ML_MASK | SYS_CS_DL | SYS_CS_CL);
511 au_writel((sys_clksrc | (1 << SYS_CS_ML_BIT)), SYS_CLKSRC);
512
513 /* load the panel info into the var struct */ 517 /* load the panel info into the var struct */
514 au1100fb_var.bits_per_pixel = fbdev->panel->bpp; 518 au1100fb_var.bits_per_pixel = fbdev->panel->bpp;
515 au1100fb_var.xres = fbdev->panel->xres; 519 au1100fb_var.xres = fbdev->panel->xres;
@@ -546,6 +550,10 @@ static int au1100fb_drv_probe(struct platform_device *dev)
546 return 0; 550 return 0;
547 551
548failed: 552failed:
553 if (fbdev->lcdclk) {
554 clk_disable_unprepare(fbdev->lcdclk);
555 clk_put(fbdev->lcdclk);
556 }
549 if (fbdev->fb_mem) { 557 if (fbdev->fb_mem) {
550 dma_free_noncoherent(&dev->dev, fbdev->fb_len, fbdev->fb_mem, 558 dma_free_noncoherent(&dev->dev, fbdev->fb_len, fbdev->fb_mem,
551 fbdev->fb_phys); 559 fbdev->fb_phys);
@@ -576,11 +584,15 @@ int au1100fb_drv_remove(struct platform_device *dev)
576 584
577 fb_dealloc_cmap(&fbdev->info.cmap); 585 fb_dealloc_cmap(&fbdev->info.cmap);
578 586
587 if (fbdev->lcdclk) {
588 clk_disable_unprepare(fbdev->lcdclk);
589 clk_put(fbdev->lcdclk);
590 }
591
579 return 0; 592 return 0;
580} 593}
581 594
582#ifdef CONFIG_PM 595#ifdef CONFIG_PM
583static u32 sys_clksrc;
584static struct au1100fb_regs fbregs; 596static struct au1100fb_regs fbregs;
585 597
586int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state) 598int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state)
@@ -590,14 +602,11 @@ int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state)
590 if (!fbdev) 602 if (!fbdev)
591 return 0; 603 return 0;
592 604
593 /* Save the clock source state */
594 sys_clksrc = au_readl(SYS_CLKSRC);
595
596 /* Blank the LCD */ 605 /* Blank the LCD */
597 au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); 606 au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info);
598 607
599 /* Stop LCD clocking */ 608 if (fbdev->lcdclk)
600 au_writel(sys_clksrc & ~SYS_CS_ML_MASK, SYS_CLKSRC); 609 clk_disable(fbdev->lcdclk);
601 610
602 memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs)); 611 memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs));
603 612
@@ -613,8 +622,8 @@ int au1100fb_drv_resume(struct platform_device *dev)
613 622
614 memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs)); 623 memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
615 624
616 /* Restart LCD clocking */ 625 if (fbdev->lcdclk)
617 au_writel(sys_clksrc, SYS_CLKSRC); 626 clk_enable(fbdev->lcdclk);
618 627
619 /* Unblank the LCD */ 628 /* Unblank the LCD */
620 au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info); 629 au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
diff --git a/drivers/video/fbdev/au1100fb.h b/drivers/video/fbdev/au1100fb.h
index 12d9642d5465..9af19939a9c6 100644
--- a/drivers/video/fbdev/au1100fb.h
+++ b/drivers/video/fbdev/au1100fb.h
@@ -109,6 +109,7 @@ struct au1100fb_device {
109 size_t fb_len; 109 size_t fb_len;
110 dma_addr_t fb_phys; 110 dma_addr_t fb_phys;
111 int panel_idx; 111 int panel_idx;
112 struct clk *lcdclk;
112}; 113};
113 114
114/********************************************************************/ 115/********************************************************************/
diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c
index 4cfba78a1458..18600d4e1b3f 100644
--- a/drivers/video/fbdev/au1200fb.c
+++ b/drivers/video/fbdev/au1200fb.c
@@ -30,6 +30,7 @@
30 * 675 Mass Ave, Cambridge, MA 02139, USA. 30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */ 31 */
32 32
33#include <linux/clk.h>
33#include <linux/module.h> 34#include <linux/module.h>
34#include <linux/platform_device.h> 35#include <linux/platform_device.h>
35#include <linux/kernel.h> 36#include <linux/kernel.h>
@@ -330,9 +331,8 @@ struct panel_settings
330 uint32 mode_pwmhi; 331 uint32 mode_pwmhi;
331 uint32 mode_outmask; 332 uint32 mode_outmask;
332 uint32 mode_fifoctrl; 333 uint32 mode_fifoctrl;
333 uint32 mode_toyclksrc;
334 uint32 mode_backlight; 334 uint32 mode_backlight;
335 uint32 mode_auxpll; 335 uint32 lcdclk;
336#define Xres min_xres 336#define Xres min_xres
337#define Yres min_yres 337#define Yres min_yres
338 u32 min_xres; /* Minimum horizontal resolution */ 338 u32 min_xres; /* Minimum horizontal resolution */
@@ -379,9 +379,8 @@ static struct panel_settings known_lcd_panels[] =
379 .mode_pwmhi = 0x00000000, 379 .mode_pwmhi = 0x00000000,
380 .mode_outmask = 0x00FFFFFF, 380 .mode_outmask = 0x00FFFFFF,
381 .mode_fifoctrl = 0x2f2f2f2f, 381 .mode_fifoctrl = 0x2f2f2f2f,
382 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
383 .mode_backlight = 0x00000000, 382 .mode_backlight = 0x00000000,
384 .mode_auxpll = 8, /* 96MHz AUXPLL */ 383 .lcdclk = 96,
385 320, 320, 384 320, 320,
386 240, 240, 385 240, 240,
387 }, 386 },
@@ -407,9 +406,8 @@ static struct panel_settings known_lcd_panels[] =
407 .mode_pwmhi = 0x00000000, 406 .mode_pwmhi = 0x00000000,
408 .mode_outmask = 0x00FFFFFF, 407 .mode_outmask = 0x00FFFFFF,
409 .mode_fifoctrl = 0x2f2f2f2f, 408 .mode_fifoctrl = 0x2f2f2f2f,
410 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
411 .mode_backlight = 0x00000000, 409 .mode_backlight = 0x00000000,
412 .mode_auxpll = 8, /* 96MHz AUXPLL */ 410 .lcdclk = 96,
413 640, 480, 411 640, 480,
414 640, 480, 412 640, 480,
415 }, 413 },
@@ -435,9 +433,8 @@ static struct panel_settings known_lcd_panels[] =
435 .mode_pwmhi = 0x00000000, 433 .mode_pwmhi = 0x00000000,
436 .mode_outmask = 0x00FFFFFF, 434 .mode_outmask = 0x00FFFFFF,
437 .mode_fifoctrl = 0x2f2f2f2f, 435 .mode_fifoctrl = 0x2f2f2f2f,
438 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
439 .mode_backlight = 0x00000000, 436 .mode_backlight = 0x00000000,
440 .mode_auxpll = 8, /* 96MHz AUXPLL */ 437 .lcdclk = 96,
441 800, 800, 438 800, 800,
442 600, 600, 439 600, 600,
443 }, 440 },
@@ -463,9 +460,8 @@ static struct panel_settings known_lcd_panels[] =
463 .mode_pwmhi = 0x00000000, 460 .mode_pwmhi = 0x00000000,
464 .mode_outmask = 0x00FFFFFF, 461 .mode_outmask = 0x00FFFFFF,
465 .mode_fifoctrl = 0x2f2f2f2f, 462 .mode_fifoctrl = 0x2f2f2f2f,
466 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
467 .mode_backlight = 0x00000000, 463 .mode_backlight = 0x00000000,
468 .mode_auxpll = 6, /* 72MHz AUXPLL */ 464 .lcdclk = 72,
469 1024, 1024, 465 1024, 1024,
470 768, 768, 466 768, 768,
471 }, 467 },
@@ -491,9 +487,8 @@ static struct panel_settings known_lcd_panels[] =
491 .mode_pwmhi = 0x00000000, 487 .mode_pwmhi = 0x00000000,
492 .mode_outmask = 0x00FFFFFF, 488 .mode_outmask = 0x00FFFFFF,
493 .mode_fifoctrl = 0x2f2f2f2f, 489 .mode_fifoctrl = 0x2f2f2f2f,
494 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
495 .mode_backlight = 0x00000000, 490 .mode_backlight = 0x00000000,
496 .mode_auxpll = 10, /* 120MHz AUXPLL */ 491 .lcdclk = 120,
497 1280, 1280, 492 1280, 1280,
498 1024, 1024, 493 1024, 1024,
499 }, 494 },
@@ -519,9 +514,8 @@ static struct panel_settings known_lcd_panels[] =
519 .mode_pwmhi = 0x03400000, /* SCB 0x0 */ 514 .mode_pwmhi = 0x03400000, /* SCB 0x0 */
520 .mode_outmask = 0x00FFFFFF, 515 .mode_outmask = 0x00FFFFFF,
521 .mode_fifoctrl = 0x2f2f2f2f, 516 .mode_fifoctrl = 0x2f2f2f2f,
522 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
523 .mode_backlight = 0x00000000, 517 .mode_backlight = 0x00000000,
524 .mode_auxpll = 8, /* 96MHz AUXPLL */ 518 .lcdclk = 96,
525 1024, 1024, 519 1024, 1024,
526 768, 768, 520 768, 768,
527 }, 521 },
@@ -550,9 +544,8 @@ static struct panel_settings known_lcd_panels[] =
550 .mode_pwmhi = 0x03400000, 544 .mode_pwmhi = 0x03400000,
551 .mode_outmask = 0x00fcfcfc, 545 .mode_outmask = 0x00fcfcfc,
552 .mode_fifoctrl = 0x2f2f2f2f, 546 .mode_fifoctrl = 0x2f2f2f2f,
553 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
554 .mode_backlight = 0x00000000, 547 .mode_backlight = 0x00000000,
555 .mode_auxpll = 8, /* 96MHz AUXPLL */ 548 .lcdclk = 96,
556 640, 480, 549 640, 480,
557 640, 480, 550 640, 480,
558 }, 551 },
@@ -581,9 +574,8 @@ static struct panel_settings known_lcd_panels[] =
581 .mode_pwmhi = 0x03400000, 574 .mode_pwmhi = 0x03400000,
582 .mode_outmask = 0x00fcfcfc, 575 .mode_outmask = 0x00fcfcfc,
583 .mode_fifoctrl = 0x2f2f2f2f, 576 .mode_fifoctrl = 0x2f2f2f2f,
584 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
585 .mode_backlight = 0x00000000, 577 .mode_backlight = 0x00000000,
586 .mode_auxpll = 8, /* 96MHz AUXPLL */ 578 .lcdclk = 96, /* 96MHz AUXPLL */
587 320, 320, 579 320, 320,
588 240, 240, 580 240, 240,
589 }, 581 },
@@ -612,9 +604,8 @@ static struct panel_settings known_lcd_panels[] =
612 .mode_pwmhi = 0x03400000, 604 .mode_pwmhi = 0x03400000,
613 .mode_outmask = 0x00fcfcfc, 605 .mode_outmask = 0x00fcfcfc,
614 .mode_fifoctrl = 0x2f2f2f2f, 606 .mode_fifoctrl = 0x2f2f2f2f,
615 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
616 .mode_backlight = 0x00000000, 607 .mode_backlight = 0x00000000,
617 .mode_auxpll = 8, /* 96MHz AUXPLL */ 608 .lcdclk = 96,
618 856, 856, 609 856, 856,
619 480, 480, 610 480, 480,
620 }, 611 },
@@ -646,9 +637,8 @@ static struct panel_settings known_lcd_panels[] =
646 .mode_pwmhi = 0x00000000, 637 .mode_pwmhi = 0x00000000,
647 .mode_outmask = 0x00FFFFFF, 638 .mode_outmask = 0x00FFFFFF,
648 .mode_fifoctrl = 0x2f2f2f2f, 639 .mode_fifoctrl = 0x2f2f2f2f,
649 .mode_toyclksrc = 0x00000004, /* AUXPLL directly */
650 .mode_backlight = 0x00000000, 640 .mode_backlight = 0x00000000,
651 .mode_auxpll = (48/12) * 2, 641 .lcdclk = 96,
652 800, 800, 642 800, 800,
653 480, 480, 643 480, 480,
654 }, 644 },
@@ -764,7 +754,7 @@ static int au1200_setlocation (struct au1200fb_device *fbdev, int plane,
764 754
765 /* Disable the window while making changes, then restore WINEN */ 755 /* Disable the window while making changes, then restore WINEN */
766 winenable = lcd->winenable & (1 << plane); 756 winenable = lcd->winenable & (1 << plane);
767 au_sync(); 757 wmb(); /* drain writebuffer */
768 lcd->winenable &= ~(1 << plane); 758 lcd->winenable &= ~(1 << plane);
769 lcd->window[plane].winctrl0 = winctrl0; 759 lcd->window[plane].winctrl0 = winctrl0;
770 lcd->window[plane].winctrl1 = winctrl1; 760 lcd->window[plane].winctrl1 = winctrl1;
@@ -772,7 +762,7 @@ static int au1200_setlocation (struct au1200fb_device *fbdev, int plane,
772 lcd->window[plane].winbuf1 = fbdev->fb_phys; 762 lcd->window[plane].winbuf1 = fbdev->fb_phys;
773 lcd->window[plane].winbufctrl = 0; /* select winbuf0 */ 763 lcd->window[plane].winbufctrl = 0; /* select winbuf0 */
774 lcd->winenable |= winenable; 764 lcd->winenable |= winenable;
775 au_sync(); 765 wmb(); /* drain writebuffer */
776 766
777 return 0; 767 return 0;
778} 768}
@@ -788,22 +778,21 @@ static void au1200_setpanel(struct panel_settings *newpanel,
788 /* Make sure all windows disabled */ 778 /* Make sure all windows disabled */
789 winenable = lcd->winenable; 779 winenable = lcd->winenable;
790 lcd->winenable = 0; 780 lcd->winenable = 0;
791 au_sync(); 781 wmb(); /* drain writebuffer */
792 /* 782 /*
793 * Ensure everything is disabled before reconfiguring 783 * Ensure everything is disabled before reconfiguring
794 */ 784 */
795 if (lcd->screen & LCD_SCREEN_SEN) { 785 if (lcd->screen & LCD_SCREEN_SEN) {
796 /* Wait for vertical sync period */ 786 /* Wait for vertical sync period */
797 lcd->intstatus = LCD_INT_SS; 787 lcd->intstatus = LCD_INT_SS;
798 while ((lcd->intstatus & LCD_INT_SS) == 0) { 788 while ((lcd->intstatus & LCD_INT_SS) == 0)
799 au_sync(); 789 ;
800 }
801 790
802 lcd->screen &= ~LCD_SCREEN_SEN; /*disable the controller*/ 791 lcd->screen &= ~LCD_SCREEN_SEN; /*disable the controller*/
803 792
804 do { 793 do {
805 lcd->intstatus = lcd->intstatus; /*clear interrupts*/ 794 lcd->intstatus = lcd->intstatus; /*clear interrupts*/
806 au_sync(); 795 wmb(); /* drain writebuffer */
807 /*wait for controller to shut down*/ 796 /*wait for controller to shut down*/
808 } while ((lcd->intstatus & LCD_INT_SD) == 0); 797 } while ((lcd->intstatus & LCD_INT_SD) == 0);
809 798
@@ -829,11 +818,17 @@ static void au1200_setpanel(struct panel_settings *newpanel,
829 */ 818 */
830 if (!(panel->mode_clkcontrol & LCD_CLKCONTROL_EXT)) 819 if (!(panel->mode_clkcontrol & LCD_CLKCONTROL_EXT))
831 { 820 {
832 uint32 sys_clksrc; 821 struct clk *c = clk_get(NULL, "lcd_intclk");
833 au_writel(panel->mode_auxpll, SYS_AUXPLL); 822 long r, pc = panel->lcdclk * 1000000;
834 sys_clksrc = au_readl(SYS_CLKSRC) & ~0x0000001f; 823
835 sys_clksrc |= panel->mode_toyclksrc; 824 if (!IS_ERR(c)) {
836 au_writel(sys_clksrc, SYS_CLKSRC); 825 r = clk_round_rate(c, pc);
826 if ((pc - r) < (pc / 10)) { /* 10% slack */
827 clk_set_rate(c, r);
828 clk_prepare_enable(c);
829 }
830 clk_put(c);
831 }
837 } 832 }
838 833
839 /* 834 /*
@@ -847,7 +842,7 @@ static void au1200_setpanel(struct panel_settings *newpanel,
847 lcd->pwmhi = panel->mode_pwmhi; 842 lcd->pwmhi = panel->mode_pwmhi;
848 lcd->outmask = panel->mode_outmask; 843 lcd->outmask = panel->mode_outmask;
849 lcd->fifoctrl = panel->mode_fifoctrl; 844 lcd->fifoctrl = panel->mode_fifoctrl;
850 au_sync(); 845 wmb(); /* drain writebuffer */
851 846
852 /* fixme: Check window settings to make sure still valid 847 /* fixme: Check window settings to make sure still valid
853 * for new geometry */ 848 * for new geometry */
@@ -863,7 +858,7 @@ static void au1200_setpanel(struct panel_settings *newpanel,
863 * Re-enable screen now that it is configured 858 * Re-enable screen now that it is configured
864 */ 859 */
865 lcd->screen |= LCD_SCREEN_SEN; 860 lcd->screen |= LCD_SCREEN_SEN;
866 au_sync(); 861 wmb(); /* drain writebuffer */
867 862
868 /* Call init of panel */ 863 /* Call init of panel */
869 if (pd->panel_init) 864 if (pd->panel_init)
@@ -956,7 +951,7 @@ static void au1200_setmode(struct au1200fb_device *fbdev)
956 | LCD_WINCTRL2_SCY_1 951 | LCD_WINCTRL2_SCY_1
957 ) ; 952 ) ;
958 lcd->winenable |= win->w[plane].mode_winenable; 953 lcd->winenable |= win->w[plane].mode_winenable;
959 au_sync(); 954 wmb(); /* drain writebuffer */
960} 955}
961 956
962 957
@@ -1259,7 +1254,6 @@ static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)
1259 pdata->brightness = 30; 1254 pdata->brightness = 30;
1260 } 1255 }
1261 divider = (lcd->pwmdiv & 0x3FFFF) + 1; 1256 divider = (lcd->pwmdiv & 0x3FFFF) + 1;
1262 hi1 = (lcd->pwmhi >> 16) + 1;
1263 hi1 = (((pdata->brightness & 0xFF)+1) * divider >> 8); 1257 hi1 = (((pdata->brightness & 0xFF)+1) * divider >> 8);
1264 lcd->pwmhi &= 0xFFFF; 1258 lcd->pwmhi &= 0xFFFF;
1265 lcd->pwmhi |= (hi1 << 16); 1259 lcd->pwmhi |= (hi1 << 16);
@@ -1270,7 +1264,7 @@ static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)
1270 1264
1271 if (pdata->flags & SCREEN_MASK) 1265 if (pdata->flags & SCREEN_MASK)
1272 lcd->colorkeymsk = pdata->mask; 1266 lcd->colorkeymsk = pdata->mask;
1273 au_sync(); 1267 wmb(); /* drain writebuffer */
1274} 1268}
1275 1269
1276static void get_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) 1270static void get_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)
@@ -1288,7 +1282,7 @@ static void get_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)
1288 hi1 = (lcd->pwmhi >> 16) + 1; 1282 hi1 = (lcd->pwmhi >> 16) + 1;
1289 divider = (lcd->pwmdiv & 0x3FFFF) + 1; 1283 divider = (lcd->pwmdiv & 0x3FFFF) + 1;
1290 pdata->brightness = ((hi1 << 8) / divider) - 1; 1284 pdata->brightness = ((hi1 << 8) / divider) - 1;
1291 au_sync(); 1285 wmb(); /* drain writebuffer */
1292} 1286}
1293 1287
1294static void set_window(unsigned int plane, 1288static void set_window(unsigned int plane,
@@ -1387,7 +1381,7 @@ static void set_window(unsigned int plane,
1387 val |= (pdata->enable & 1) << plane; 1381 val |= (pdata->enable & 1) << plane;
1388 lcd->winenable = val; 1382 lcd->winenable = val;
1389 } 1383 }
1390 au_sync(); 1384 wmb(); /* drain writebuffer */
1391} 1385}
1392 1386
1393static void get_window(unsigned int plane, 1387static void get_window(unsigned int plane,
@@ -1414,7 +1408,7 @@ static void get_window(unsigned int plane,
1414 pdata->ram_array_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_RAM) >> 21; 1408 pdata->ram_array_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_RAM) >> 21;
1415 1409
1416 pdata->enable = (lcd->winenable >> plane) & 1; 1410 pdata->enable = (lcd->winenable >> plane) & 1;
1417 au_sync(); 1411 wmb(); /* drain writebuffer */
1418} 1412}
1419 1413
1420static int au1200fb_ioctl(struct fb_info *info, unsigned int cmd, 1414static int au1200fb_ioctl(struct fb_info *info, unsigned int cmd,
@@ -1511,7 +1505,7 @@ static irqreturn_t au1200fb_handle_irq(int irq, void* dev_id)
1511{ 1505{
1512 /* Nothing to do for now, just clear any pending interrupt */ 1506 /* Nothing to do for now, just clear any pending interrupt */
1513 lcd->intstatus = lcd->intstatus; 1507 lcd->intstatus = lcd->intstatus;
1514 au_sync(); 1508 wmb(); /* drain writebuffer */
1515 1509
1516 return IRQ_HANDLED; 1510 return IRQ_HANDLED;
1517} 1511}
@@ -1809,7 +1803,7 @@ static int au1200fb_drv_suspend(struct device *dev)
1809 au1200_setpanel(NULL, pd); 1803 au1200_setpanel(NULL, pd);
1810 1804
1811 lcd->outmask = 0; 1805 lcd->outmask = 0;
1812 au_sync(); 1806 wmb(); /* drain writebuffer */
1813 1807
1814 return 0; 1808 return 0;
1815} 1809}
diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c
index 206a66b61072..59abdc6a97f6 100644
--- a/drivers/video/fbdev/chipsfb.c
+++ b/drivers/video/fbdev/chipsfb.c
@@ -273,7 +273,7 @@ static struct chips_init_reg chips_init_xr[] = {
273 { 0xa8, 0x00 } 273 { 0xa8, 0x00 }
274}; 274};
275 275
276static void __init chips_hw_init(void) 276static void chips_hw_init(void)
277{ 277{
278 int i; 278 int i;
279 279
diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c
new file mode 100644
index 000000000000..49a7bb4ef02f
--- /dev/null
+++ b/drivers/video/fbdev/clps711x-fb.c
@@ -0,0 +1,397 @@
1/*
2 * Cirrus Logic CLPS711X FB driver
3 *
4 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
5 * Based on driver by Russell King <rmk@arm.linux.org.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/clk.h>
14#include <linux/fb.h>
15#include <linux/io.h>
16#include <linux/lcd.h>
17#include <linux/module.h>
18#include <linux/of.h>
19#include <linux/platform_device.h>
20#include <linux/regmap.h>
21#include <linux/mfd/syscon.h>
22#include <linux/mfd/syscon/clps711x.h>
23#include <linux/regulator/consumer.h>
24#include <video/of_display_timing.h>
25
26#define CLPS711X_FB_NAME "clps711x-fb"
27#define CLPS711X_FB_BPP_MAX (4)
28
29/* Registers relative to LCDCON */
30#define CLPS711X_LCDCON (0x0000)
31# define LCDCON_GSEN BIT(30)
32# define LCDCON_GSMD BIT(31)
33#define CLPS711X_PALLSW (0x0280)
34#define CLPS711X_PALMSW (0x02c0)
35#define CLPS711X_FBADDR (0x0d40)
36
37struct clps711x_fb_info {
38 struct clk *clk;
39 void __iomem *base;
40 struct regmap *syscon;
41 resource_size_t buffsize;
42 struct fb_videomode mode;
43 struct regulator *lcd_pwr;
44 u32 ac_prescale;
45 bool cmap_invert;
46};
47
48static int clps711x_fb_setcolreg(u_int regno, u_int red, u_int green,
49 u_int blue, u_int transp, struct fb_info *info)
50{
51 struct clps711x_fb_info *cfb = info->par;
52 u32 level, mask, shift;
53
54 if (regno >= BIT(info->var.bits_per_pixel))
55 return -EINVAL;
56
57 shift = 4 * (regno & 7);
58 mask = 0xf << shift;
59 /* gray = 0.30*R + 0.58*G + 0.11*B */
60 level = (((red * 77 + green * 151 + blue * 28) >> 20) << shift) & mask;
61 if (cfb->cmap_invert)
62 level = 0xf - level;
63
64 regno = (regno < 8) ? CLPS711X_PALLSW : CLPS711X_PALMSW;
65
66 writel((readl(cfb->base + regno) & ~mask) | level, cfb->base + regno);
67
68 return 0;
69}
70
71static int clps711x_fb_check_var(struct fb_var_screeninfo *var,
72 struct fb_info *info)
73{
74 u32 val;
75
76 if (var->bits_per_pixel < 1 ||
77 var->bits_per_pixel > CLPS711X_FB_BPP_MAX)
78 return -EINVAL;
79
80 if (!var->pixclock)
81 return -EINVAL;
82
83 val = DIV_ROUND_UP(var->xres, 16) - 1;
84 if (val < 0x01 || val > 0x3f)
85 return -EINVAL;
86
87 val = DIV_ROUND_UP(var->yres * var->xres * var->bits_per_pixel, 128);
88 val--;
89 if (val < 0x001 || val > 0x1fff)
90 return -EINVAL;
91
92 var->transp.msb_right = 0;
93 var->transp.offset = 0;
94 var->transp.length = 0;
95 var->red.msb_right = 0;
96 var->red.offset = 0;
97 var->red.length = var->bits_per_pixel;
98 var->green = var->red;
99 var->blue = var->red;
100 var->grayscale = var->bits_per_pixel > 1;
101
102 return 0;
103}
104
105static int clps711x_fb_set_par(struct fb_info *info)
106{
107 struct clps711x_fb_info *cfb = info->par;
108 resource_size_t size;
109 u32 lcdcon, pps;
110
111 size = (info->var.xres * info->var.yres * info->var.bits_per_pixel) / 8;
112 if (size > cfb->buffsize)
113 return -EINVAL;
114
115 switch (info->var.bits_per_pixel) {
116 case 1:
117 info->fix.visual = FB_VISUAL_MONO01;
118 break;
119 case 2:
120 case 4:
121 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
122 break;
123 default:
124 return -EINVAL;
125 }
126
127 info->fix.line_length = info->var.xres * info->var.bits_per_pixel / 8;
128 info->fix.smem_len = size;
129
130 lcdcon = (info->var.xres * info->var.yres *
131 info->var.bits_per_pixel) / 128 - 1;
132 lcdcon |= ((info->var.xres / 16) - 1) << 13;
133 lcdcon |= (cfb->ac_prescale & 0x1f) << 25;
134
135 pps = clk_get_rate(cfb->clk) / (PICOS2KHZ(info->var.pixclock) * 1000);
136 if (pps)
137 pps--;
138 lcdcon |= (pps & 0x3f) << 19;
139
140 if (info->var.bits_per_pixel == 4)
141 lcdcon |= LCDCON_GSMD;
142 if (info->var.bits_per_pixel >= 2)
143 lcdcon |= LCDCON_GSEN;
144
145 /* LCDCON must only be changed while the LCD is disabled */
146 regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
147 writel(lcdcon, cfb->base + CLPS711X_LCDCON);
148 regmap_update_bits(cfb->syscon, SYSCON_OFFSET,
149 SYSCON1_LCDEN, SYSCON1_LCDEN);
150
151 return 0;
152}
153
154static int clps711x_fb_blank(int blank, struct fb_info *info)
155{
156 /* Return happy */
157 return 0;
158}
159
160static struct fb_ops clps711x_fb_ops = {
161 .owner = THIS_MODULE,
162 .fb_setcolreg = clps711x_fb_setcolreg,
163 .fb_check_var = clps711x_fb_check_var,
164 .fb_set_par = clps711x_fb_set_par,
165 .fb_blank = clps711x_fb_blank,
166 .fb_fillrect = sys_fillrect,
167 .fb_copyarea = sys_copyarea,
168 .fb_imageblit = sys_imageblit,
169};
170
171static int clps711x_lcd_check_fb(struct lcd_device *lcddev, struct fb_info *fi)
172{
173 struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
174
175 return (!fi || fi->par == cfb) ? 1 : 0;
176}
177
178static int clps711x_lcd_get_power(struct lcd_device *lcddev)
179{
180 struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
181
182 if (!IS_ERR_OR_NULL(cfb->lcd_pwr))
183 if (!regulator_is_enabled(cfb->lcd_pwr))
184 return FB_BLANK_NORMAL;
185
186 return FB_BLANK_UNBLANK;
187}
188
189static int clps711x_lcd_set_power(struct lcd_device *lcddev, int blank)
190{
191 struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
192
193 if (!IS_ERR_OR_NULL(cfb->lcd_pwr)) {
194 if (blank == FB_BLANK_UNBLANK) {
195 if (!regulator_is_enabled(cfb->lcd_pwr))
196 return regulator_enable(cfb->lcd_pwr);
197 } else {
198 if (regulator_is_enabled(cfb->lcd_pwr))
199 return regulator_disable(cfb->lcd_pwr);
200 }
201 }
202
203 return 0;
204}
205
206static struct lcd_ops clps711x_lcd_ops = {
207 .check_fb = clps711x_lcd_check_fb,
208 .get_power = clps711x_lcd_get_power,
209 .set_power = clps711x_lcd_set_power,
210};
211
212static int clps711x_fb_probe(struct platform_device *pdev)
213{
214 struct device *dev = &pdev->dev;
215 struct device_node *disp, *np = dev->of_node;
216 struct clps711x_fb_info *cfb;
217 struct lcd_device *lcd;
218 struct fb_info *info;
219 struct resource *res;
220 int ret = -ENOENT;
221 u32 val;
222
223 if (fb_get_options(CLPS711X_FB_NAME, NULL))
224 return -ENODEV;
225
226 info = framebuffer_alloc(sizeof(*cfb), dev);
227 if (!info)
228 return -ENOMEM;
229
230 cfb = info->par;
231 platform_set_drvdata(pdev, info);
232
233 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
234 if (!res)
235 goto out_fb_release;
236 cfb->base = devm_ioremap(dev, res->start, resource_size(res));
237 if (!cfb->base) {
238 ret = -ENOMEM;
239 goto out_fb_release;
240 }
241
242 info->fix.mmio_start = res->start;
243 info->fix.mmio_len = resource_size(res);
244
245 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
246 info->screen_base = devm_ioremap_resource(dev, res);
247 if (IS_ERR(info->screen_base)) {
248 ret = PTR_ERR(info->screen_base);
249 goto out_fb_release;
250 }
251
252 /* Physical address should be aligned to 256 MiB */
253 if (res->start & 0x0fffffff) {
254 ret = -EINVAL;
255 goto out_fb_release;
256 }
257
258 info->apertures = alloc_apertures(1);
259 if (!info->apertures) {
260 ret = -ENOMEM;
261 goto out_fb_release;
262 }
263
264 cfb->buffsize = resource_size(res);
265 info->fix.smem_start = res->start;
266 info->apertures->ranges[0].base = info->fix.smem_start;
267 info->apertures->ranges[0].size = cfb->buffsize;
268
269 cfb->clk = devm_clk_get(dev, NULL);
270 if (IS_ERR(cfb->clk)) {
271 ret = PTR_ERR(cfb->clk);
272 goto out_fb_release;
273 }
274
275 cfb->syscon =
276 syscon_regmap_lookup_by_compatible("cirrus,clps711x-syscon1");
277 if (IS_ERR(cfb->syscon)) {
278 ret = PTR_ERR(cfb->syscon);
279 goto out_fb_release;
280 }
281
282 disp = of_parse_phandle(np, "display", 0);
283 if (!disp) {
284 dev_err(&pdev->dev, "No display defined\n");
285 ret = -ENODATA;
286 goto out_fb_release;
287 }
288
289 ret = of_get_fb_videomode(disp, &cfb->mode, OF_USE_NATIVE_MODE);
290 if (ret)
291 goto out_fb_release;
292
293 of_property_read_u32(disp, "ac-prescale", &cfb->ac_prescale);
294 cfb->cmap_invert = of_property_read_bool(disp, "cmap-invert");
295
296 ret = of_property_read_u32(disp, "bits-per-pixel",
297 &info->var.bits_per_pixel);
298 if (ret)
299 goto out_fb_release;
300
301 /* Force disable LCD on any mismatch */
302 if (info->fix.smem_start != (readb(cfb->base + CLPS711X_FBADDR) << 28))
303 regmap_update_bits(cfb->syscon, SYSCON_OFFSET,
304 SYSCON1_LCDEN, 0);
305
306 ret = regmap_read(cfb->syscon, SYSCON_OFFSET, &val);
307 if (ret)
308 goto out_fb_release;
309
310 if (!(val & SYSCON1_LCDEN)) {
311 /* Setup start FB address */
312 writeb(info->fix.smem_start >> 28, cfb->base + CLPS711X_FBADDR);
313 /* Clean FB memory */
314 memset_io(info->screen_base, 0, cfb->buffsize);
315 }
316
317 cfb->lcd_pwr = devm_regulator_get(dev, "lcd");
318 if (PTR_ERR(cfb->lcd_pwr) == -EPROBE_DEFER) {
319 ret = -EPROBE_DEFER;
320 goto out_fb_release;
321 }
322
323 info->fbops = &clps711x_fb_ops;
324 info->flags = FBINFO_DEFAULT;
325 info->var.activate = FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW;
326 info->var.height = -1;
327 info->var.width = -1;
328 info->var.vmode = FB_VMODE_NONINTERLACED;
329 info->fix.type = FB_TYPE_PACKED_PIXELS;
330 info->fix.accel = FB_ACCEL_NONE;
331 strlcpy(info->fix.id, CLPS711X_FB_NAME, sizeof(info->fix.id));
332 fb_videomode_to_var(&info->var, &cfb->mode);
333
334 ret = fb_alloc_cmap(&info->cmap, BIT(CLPS711X_FB_BPP_MAX), 0);
335 if (ret)
336 goto out_fb_release;
337
338 ret = fb_set_var(info, &info->var);
339 if (ret)
340 goto out_fb_dealloc_cmap;
341
342 ret = register_framebuffer(info);
343 if (ret)
344 goto out_fb_dealloc_cmap;
345
346 lcd = devm_lcd_device_register(dev, "clps711x-lcd", dev, cfb,
347 &clps711x_lcd_ops);
348 if (!IS_ERR(lcd))
349 return 0;
350
351 ret = PTR_ERR(lcd);
352 unregister_framebuffer(info);
353
354out_fb_dealloc_cmap:
355 regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
356 fb_dealloc_cmap(&info->cmap);
357
358out_fb_release:
359 framebuffer_release(info);
360
361 return ret;
362}
363
364static int clps711x_fb_remove(struct platform_device *pdev)
365{
366 struct fb_info *info = platform_get_drvdata(pdev);
367 struct clps711x_fb_info *cfb = info->par;
368
369 regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
370
371 unregister_framebuffer(info);
372 fb_dealloc_cmap(&info->cmap);
373 framebuffer_release(info);
374
375 return 0;
376}
377
378static const struct of_device_id clps711x_fb_dt_ids[] = {
379 { .compatible = "cirrus,clps711x-fb", },
380 { }
381};
382MODULE_DEVICE_TABLE(of, clps711x_fb_dt_ids);
383
384static struct platform_driver clps711x_fb_driver = {
385 .driver = {
386 .name = CLPS711X_FB_NAME,
387 .owner = THIS_MODULE,
388 .of_match_table = clps711x_fb_dt_ids,
389 },
390 .probe = clps711x_fb_probe,
391 .remove = clps711x_fb_remove,
392};
393module_platform_driver(clps711x_fb_driver);
394
395MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
396MODULE_DESCRIPTION("Cirrus Logic CLPS711X FB driver");
397MODULE_LICENSE("GPL");
diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index fdadef979238..080fdd2a70f3 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -218,7 +218,8 @@ static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *i
218 */ 218 */
219static int controlfb_set_par (struct fb_info *info) 219static int controlfb_set_par (struct fb_info *info)
220{ 220{
221 struct fb_info_control *p = (struct fb_info_control *) info; 221 struct fb_info_control *p =
222 container_of(info, struct fb_info_control, info);
222 struct fb_par_control par; 223 struct fb_par_control par;
223 int err; 224 int err;
224 225
@@ -258,7 +259,8 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var,
258 struct fb_info *info) 259 struct fb_info *info)
259{ 260{
260 unsigned int xoffset, hstep; 261 unsigned int xoffset, hstep;
261 struct fb_info_control *p = (struct fb_info_control *)info; 262 struct fb_info_control *p =
263 container_of(info, struct fb_info_control, info);
262 struct fb_par_control *par = &p->par; 264 struct fb_par_control *par = &p->par;
263 265
264 /* 266 /*
@@ -309,7 +311,8 @@ static int controlfb_mmap(struct fb_info *info,
309 311
310static int controlfb_blank(int blank_mode, struct fb_info *info) 312static int controlfb_blank(int blank_mode, struct fb_info *info)
311{ 313{
312 struct fb_info_control *p = (struct fb_info_control *) info; 314 struct fb_info_control *p =
315 container_of(info, struct fb_info_control, info);
313 unsigned ctrl; 316 unsigned ctrl;
314 317
315 ctrl = ld_le32(CNTRL_REG(p,ctrl)); 318 ctrl = ld_le32(CNTRL_REG(p,ctrl));
@@ -342,7 +345,8 @@ static int controlfb_blank(int blank_mode, struct fb_info *info)
342static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 345static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
343 u_int transp, struct fb_info *info) 346 u_int transp, struct fb_info *info)
344{ 347{
345 struct fb_info_control *p = (struct fb_info_control *) info; 348 struct fb_info_control *p =
349 container_of(info, struct fb_info_control, info);
346 __u8 r, g, b; 350 __u8 r, g, b;
347 351
348 if (regno > 255) 352 if (regno > 255)
@@ -833,7 +837,8 @@ static int control_var_to_par(struct fb_var_screeninfo *var,
833 unsigned hperiod, hssync, hsblank, hesync, heblank, piped, heq, hlfln, 837 unsigned hperiod, hssync, hsblank, hesync, heblank, piped, heq, hlfln,
834 hserr, vperiod, vssync, vesync, veblank, vsblank, vswin, vewin; 838 hserr, vperiod, vssync, vesync, veblank, vsblank, vswin, vewin;
835 unsigned long pixclock; 839 unsigned long pixclock;
836 struct fb_info_control *p = (struct fb_info_control *) fb_info; 840 struct fb_info_control *p =
841 container_of(fb_info, struct fb_info_control, info);
837 struct control_regvals *r = &par->regvals; 842 struct control_regvals *r = &par->regvals;
838 843
839 switch (var->bits_per_pixel) { 844 switch (var->bits_per_pixel) {
diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile
index fa306538dac2..67f28e20a892 100644
--- a/drivers/video/fbdev/core/Makefile
+++ b/drivers/video/fbdev/core/Makefile
@@ -1,4 +1,5 @@
1obj-y += fb_notify.o 1obj-y += fb_notify.o
2obj-$(CONFIG_FB_CMDLINE) += fb_cmdline.o
2obj-$(CONFIG_FB) += fb.o 3obj-$(CONFIG_FB) += fb.o
3fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ 4fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
4 modedb.o fbcvt.o 5 modedb.o fbcvt.o
diff --git a/drivers/video/fbdev/core/cfbcopyarea.c b/drivers/video/fbdev/core/cfbcopyarea.c
index bcb57235fcc7..6d4bfeecee35 100644
--- a/drivers/video/fbdev/core/cfbcopyarea.c
+++ b/drivers/video/fbdev/core/cfbcopyarea.c
@@ -55,8 +55,8 @@ bitcpy(struct fb_info *p, unsigned long __iomem *dst, unsigned dst_idx,
55 * If you suspect bug in this function, compare it with this simple 55 * If you suspect bug in this function, compare it with this simple
56 * memmove implementation. 56 * memmove implementation.
57 */ 57 */
58 fb_memmove((char *)dst + ((dst_idx & (bits - 1))) / 8, 58 memmove((char *)dst + ((dst_idx & (bits - 1))) / 8,
59 (char *)src + ((src_idx & (bits - 1))) / 8, n / 8); 59 (char *)src + ((src_idx & (bits - 1))) / 8, n / 8);
60 return; 60 return;
61#endif 61#endif
62 62
@@ -221,8 +221,8 @@ bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, unsigned dst_idx,
221 * If you suspect bug in this function, compare it with this simple 221 * If you suspect bug in this function, compare it with this simple
222 * memmove implementation. 222 * memmove implementation.
223 */ 223 */
224 fb_memmove((char *)dst + ((dst_idx & (bits - 1))) / 8, 224 memmove((char *)dst + ((dst_idx & (bits - 1))) / 8,
225 (char *)src + ((src_idx & (bits - 1))) / 8, n / 8); 225 (char *)src + ((src_idx & (bits - 1))) / 8, n / 8);
226 return; 226 return;
227#endif 227#endif
228 228
@@ -324,7 +324,10 @@ bitcpy_rev(struct fb_info *p, unsigned long __iomem *dst, unsigned dst_idx,
324 d0 = d0 << left | d1 >> right; 324 d0 = d0 << left | d1 >> right;
325 } 325 }
326 d0 = fb_rev_pixels_in_long(d0, bswapmask); 326 d0 = fb_rev_pixels_in_long(d0, bswapmask);
327 FB_WRITEL(comp(d0, FB_READL(dst), first), dst); 327 if (!first)
328 FB_WRITEL(d0, dst);
329 else
330 FB_WRITEL(comp(d0, FB_READL(dst), first), dst);
328 d0 = d1; 331 d0 = d1;
329 dst--; 332 dst--;
330 n -= dst_idx+1; 333 n -= dst_idx+1;
diff --git a/drivers/video/fbdev/core/fb_cmdline.c b/drivers/video/fbdev/core/fb_cmdline.c
new file mode 100644
index 000000000000..39509ccd92f1
--- /dev/null
+++ b/drivers/video/fbdev/core/fb_cmdline.c
@@ -0,0 +1,110 @@
1/*
2 * linux/drivers/video/fb_cmdline.c
3 *
4 * Copyright (C) 2014 Intel Corp
5 * Copyright (C) 1994 Martin Schaller
6 *
7 * 2001 - Documented with DocBook
8 * - Brad Douglas <brad@neruo.com>
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive
12 * for more details.
13 *
14 * Authors:
15 * Vetter <danie.vetter@ffwll.ch>
16 */
17#include <linux/init.h>
18#include <linux/fb.h>
19
20static char *video_options[FB_MAX] __read_mostly;
21static int ofonly __read_mostly;
22
23const char *fb_mode_option;
24EXPORT_SYMBOL_GPL(fb_mode_option);
25
26/**
27 * fb_get_options - get kernel boot parameters
28 * @name: framebuffer name as it would appear in
29 * the boot parameter line
30 * (video=<name>:<options>)
31 * @option: the option will be stored here
32 *
33 * NOTE: Needed to maintain backwards compatibility
34 */
35int fb_get_options(const char *name, char **option)
36{
37 char *opt, *options = NULL;
38 int retval = 0;
39 int name_len = strlen(name), i;
40
41 if (name_len && ofonly && strncmp(name, "offb", 4))
42 retval = 1;
43
44 if (name_len && !retval) {
45 for (i = 0; i < FB_MAX; i++) {
46 if (video_options[i] == NULL)
47 continue;
48 if (!video_options[i][0])
49 continue;
50 opt = video_options[i];
51 if (!strncmp(name, opt, name_len) &&
52 opt[name_len] == ':')
53 options = opt + name_len + 1;
54 }
55 }
56 /* No match, pass global option */
57 if (!options && option && fb_mode_option)
58 options = kstrdup(fb_mode_option, GFP_KERNEL);
59 if (options && !strncmp(options, "off", 3))
60 retval = 1;
61
62 if (option)
63 *option = options;
64
65 return retval;
66}
67EXPORT_SYMBOL(fb_get_options);
68
69/**
70 * video_setup - process command line options
71 * @options: string of options
72 *
73 * Process command line options for frame buffer subsystem.
74 *
75 * NOTE: This function is a __setup and __init function.
76 * It only stores the options. Drivers have to call
77 * fb_get_options() as necessary.
78 *
79 * Returns zero.
80 *
81 */
82static int __init video_setup(char *options)
83{
84 int i, global = 0;
85
86 if (!options || !*options)
87 global = 1;
88
89 if (!global && !strncmp(options, "ofonly", 6)) {
90 ofonly = 1;
91 global = 1;
92 }
93
94 if (!global && !strchr(options, ':')) {
95 fb_mode_option = options;
96 global = 1;
97 }
98
99 if (!global) {
100 for (i = 0; i < FB_MAX; i++) {
101 if (video_options[i] == NULL) {
102 video_options[i] = options;
103 break;
104 }
105 }
106 }
107
108 return 1;
109}
110__setup("video=", video_setup);
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index b5e85f6c1c26..0705d8883ede 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1908,96 +1908,4 @@ int fb_new_modelist(struct fb_info *info)
1908 return err; 1908 return err;
1909} 1909}
1910 1910
1911static char *video_options[FB_MAX] __read_mostly;
1912static int ofonly __read_mostly;
1913
1914/**
1915 * fb_get_options - get kernel boot parameters
1916 * @name: framebuffer name as it would appear in
1917 * the boot parameter line
1918 * (video=<name>:<options>)
1919 * @option: the option will be stored here
1920 *
1921 * NOTE: Needed to maintain backwards compatibility
1922 */
1923int fb_get_options(const char *name, char **option)
1924{
1925 char *opt, *options = NULL;
1926 int retval = 0;
1927 int name_len = strlen(name), i;
1928
1929 if (name_len && ofonly && strncmp(name, "offb", 4))
1930 retval = 1;
1931
1932 if (name_len && !retval) {
1933 for (i = 0; i < FB_MAX; i++) {
1934 if (video_options[i] == NULL)
1935 continue;
1936 if (!video_options[i][0])
1937 continue;
1938 opt = video_options[i];
1939 if (!strncmp(name, opt, name_len) &&
1940 opt[name_len] == ':')
1941 options = opt + name_len + 1;
1942 }
1943 }
1944 /* No match, pass global option */
1945 if (!options && option && fb_mode_option)
1946 options = kstrdup(fb_mode_option, GFP_KERNEL);
1947 if (options && !strncmp(options, "off", 3))
1948 retval = 1;
1949
1950 if (option)
1951 *option = options;
1952
1953 return retval;
1954}
1955EXPORT_SYMBOL(fb_get_options);
1956
1957#ifndef MODULE
1958/**
1959 * video_setup - process command line options
1960 * @options: string of options
1961 *
1962 * Process command line options for frame buffer subsystem.
1963 *
1964 * NOTE: This function is a __setup and __init function.
1965 * It only stores the options. Drivers have to call
1966 * fb_get_options() as necessary.
1967 *
1968 * Returns zero.
1969 *
1970 */
1971static int __init video_setup(char *options)
1972{
1973 int i, global = 0;
1974
1975 if (!options || !*options)
1976 global = 1;
1977
1978 if (!global && !strncmp(options, "ofonly", 6)) {
1979 ofonly = 1;
1980 global = 1;
1981 }
1982
1983 if (!global && !strchr(options, ':')) {
1984 fb_mode_option = options;
1985 global = 1;
1986 }
1987
1988 if (!global) {
1989 for (i = 0; i < FB_MAX; i++) {
1990 if (video_options[i] == NULL) {
1991 video_options[i] = options;
1992 break;
1993 }
1994
1995 }
1996 }
1997
1998 return 1;
1999}
2000__setup("video=", video_setup);
2001#endif
2002
2003MODULE_LICENSE("GPL"); 1911MODULE_LICENSE("GPL");
diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c
index 53444ac19fe0..60c3f0a16341 100644
--- a/drivers/video/fbdev/core/fbsysfs.c
+++ b/drivers/video/fbdev/core/fbsysfs.c
@@ -485,16 +485,8 @@ static ssize_t show_bl_curve(struct device *device,
485 485
486 mutex_lock(&fb_info->bl_curve_mutex); 486 mutex_lock(&fb_info->bl_curve_mutex);
487 for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8) 487 for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8)
488 len += snprintf(&buf[len], PAGE_SIZE, 488 len += snprintf(&buf[len], PAGE_SIZE, "%8ph\n",
489 "%02x %02x %02x %02x %02x %02x %02x %02x\n", 489 fb_info->bl_curve + i);
490 fb_info->bl_curve[i + 0],
491 fb_info->bl_curve[i + 1],
492 fb_info->bl_curve[i + 2],
493 fb_info->bl_curve[i + 3],
494 fb_info->bl_curve[i + 4],
495 fb_info->bl_curve[i + 5],
496 fb_info->bl_curve[i + 6],
497 fb_info->bl_curve[i + 7]);
498 mutex_unlock(&fb_info->bl_curve_mutex); 490 mutex_unlock(&fb_info->bl_curve_mutex);
499 491
500 return len; 492 return len;
diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c
index a9a907c440d7..388f7971494b 100644
--- a/drivers/video/fbdev/core/modedb.c
+++ b/drivers/video/fbdev/core/modedb.c
@@ -29,9 +29,6 @@
29#define DPRINTK(fmt, args...) 29#define DPRINTK(fmt, args...)
30#endif 30#endif
31 31
32const char *fb_mode_option;
33EXPORT_SYMBOL_GPL(fb_mode_option);
34
35/* 32/*
36 * Standard video mode definitions (taken from XFree86) 33 * Standard video mode definitions (taken from XFree86)
37 */ 34 */
diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c
index b0a950f36970..99acf538a8b8 100644
--- a/drivers/video/fbdev/cyber2000fb.c
+++ b/drivers/video/fbdev/cyber2000fb.c
@@ -159,7 +159,7 @@ cyber2000_seqw(unsigned int reg, unsigned int val, struct cfb_info *cfb)
159static void 159static void
160cyber2000fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 160cyber2000fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
161{ 161{
162 struct cfb_info *cfb = (struct cfb_info *)info; 162 struct cfb_info *cfb = container_of(info, struct cfb_info, fb);
163 unsigned long dst, col; 163 unsigned long dst, col;
164 164
165 if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) { 165 if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) {
@@ -191,7 +191,7 @@ cyber2000fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
191static void 191static void
192cyber2000fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) 192cyber2000fb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
193{ 193{
194 struct cfb_info *cfb = (struct cfb_info *)info; 194 struct cfb_info *cfb = container_of(info, struct cfb_info, fb);
195 unsigned int cmd = CO_CMD_L_PATTERN_FGCOL; 195 unsigned int cmd = CO_CMD_L_PATTERN_FGCOL;
196 unsigned long src, dst; 196 unsigned long src, dst;
197 197
@@ -241,7 +241,7 @@ cyber2000fb_imageblit(struct fb_info *info, const struct fb_image *image)
241 241
242static int cyber2000fb_sync(struct fb_info *info) 242static int cyber2000fb_sync(struct fb_info *info)
243{ 243{
244 struct cfb_info *cfb = (struct cfb_info *)info; 244 struct cfb_info *cfb = container_of(info, struct cfb_info, fb);
245 int count = 100000; 245 int count = 100000;
246 246
247 if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) 247 if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT))
@@ -276,7 +276,7 @@ static int
276cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 276cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
277 u_int transp, struct fb_info *info) 277 u_int transp, struct fb_info *info)
278{ 278{
279 struct cfb_info *cfb = (struct cfb_info *)info; 279 struct cfb_info *cfb = container_of(info, struct cfb_info, fb);
280 struct fb_var_screeninfo *var = &cfb->fb.var; 280 struct fb_var_screeninfo *var = &cfb->fb.var;
281 u32 pseudo_val; 281 u32 pseudo_val;
282 int ret = 1; 282 int ret = 1;
@@ -758,7 +758,7 @@ cyber2000fb_decode_clock(struct par_info *hw, struct cfb_info *cfb,
758static int 758static int
759cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 759cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
760{ 760{
761 struct cfb_info *cfb = (struct cfb_info *)info; 761 struct cfb_info *cfb = container_of(info, struct cfb_info, fb);
762 struct par_info hw; 762 struct par_info hw;
763 unsigned int mem; 763 unsigned int mem;
764 int err; 764 int err;
@@ -861,7 +861,7 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
861 861
862static int cyber2000fb_set_par(struct fb_info *info) 862static int cyber2000fb_set_par(struct fb_info *info)
863{ 863{
864 struct cfb_info *cfb = (struct cfb_info *)info; 864 struct cfb_info *cfb = container_of(info, struct cfb_info, fb);
865 struct fb_var_screeninfo *var = &cfb->fb.var; 865 struct fb_var_screeninfo *var = &cfb->fb.var;
866 struct par_info hw; 866 struct par_info hw;
867 unsigned int mem; 867 unsigned int mem;
@@ -971,7 +971,7 @@ static int cyber2000fb_set_par(struct fb_info *info)
971static int 971static int
972cyber2000fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) 972cyber2000fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
973{ 973{
974 struct cfb_info *cfb = (struct cfb_info *)info; 974 struct cfb_info *cfb = container_of(info, struct cfb_info, fb);
975 975
976 if (cyber2000fb_update_start(cfb, var)) 976 if (cyber2000fb_update_start(cfb, var))
977 return -EINVAL; 977 return -EINVAL;
@@ -1007,7 +1007,7 @@ cyber2000fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
1007 */ 1007 */
1008static int cyber2000fb_blank(int blank, struct fb_info *info) 1008static int cyber2000fb_blank(int blank, struct fb_info *info)
1009{ 1009{
1010 struct cfb_info *cfb = (struct cfb_info *)info; 1010 struct cfb_info *cfb = container_of(info, struct cfb_info, fb);
1011 unsigned int sync = 0; 1011 unsigned int sync = 0;
1012 int i; 1012 int i;
1013 1013
diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index a8484f768d04..10c876c95772 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -419,7 +419,7 @@ static void lcd_cfg_horizontal_sync(int back_porch, int pulse_width,
419{ 419{
420 u32 reg; 420 u32 reg;
421 421
422 reg = lcdc_read(LCD_RASTER_TIMING_0_REG) & 0xf; 422 reg = lcdc_read(LCD_RASTER_TIMING_0_REG) & 0x3ff;
423 reg |= (((back_porch-1) & 0xff) << 24) 423 reg |= (((back_porch-1) & 0xff) << 24)
424 | (((front_porch-1) & 0xff) << 16) 424 | (((front_porch-1) & 0xff) << 16)
425 | (((pulse_width-1) & 0x3f) << 10); 425 | (((pulse_width-1) & 0x3f) << 10);
@@ -1447,18 +1447,15 @@ static int fb_probe(struct platform_device *device)
1447 da8xx_fb_fix.line_length - 1; 1447 da8xx_fb_fix.line_length - 1;
1448 1448
1449 /* allocate palette buffer */ 1449 /* allocate palette buffer */
1450 par->v_palette_base = dma_alloc_coherent(NULL, 1450 par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE,
1451 PALETTE_SIZE, 1451 (resource_size_t *)&par->p_palette_base,
1452 (resource_size_t *) 1452 GFP_KERNEL | GFP_DMA);
1453 &par->p_palette_base,
1454 GFP_KERNEL | GFP_DMA);
1455 if (!par->v_palette_base) { 1453 if (!par->v_palette_base) {
1456 dev_err(&device->dev, 1454 dev_err(&device->dev,
1457 "GLCD: kmalloc for palette buffer failed\n"); 1455 "GLCD: kmalloc for palette buffer failed\n");
1458 ret = -EINVAL; 1456 ret = -EINVAL;
1459 goto err_release_fb_mem; 1457 goto err_release_fb_mem;
1460 } 1458 }
1461 memset(par->v_palette_base, 0, PALETTE_SIZE);
1462 1459
1463 par->irq = platform_get_irq(device, 0); 1460 par->irq = platform_get_irq(device, 0);
1464 if (par->irq < 0) { 1461 if (par->irq < 0) {
diff --git a/drivers/video/fbdev/exynos/s6e8ax0.c b/drivers/video/fbdev/exynos/s6e8ax0.c
index 29e70ed3f154..95873f26e39c 100644
--- a/drivers/video/fbdev/exynos/s6e8ax0.c
+++ b/drivers/video/fbdev/exynos/s6e8ax0.c
@@ -704,11 +704,6 @@ static int s6e8ax0_get_power(struct lcd_device *ld)
704 return lcd->power; 704 return lcd->power;
705} 705}
706 706
707static int s6e8ax0_get_brightness(struct backlight_device *bd)
708{
709 return bd->props.brightness;
710}
711
712static int s6e8ax0_set_brightness(struct backlight_device *bd) 707static int s6e8ax0_set_brightness(struct backlight_device *bd)
713{ 708{
714 int ret = 0, brightness = bd->props.brightness; 709 int ret = 0, brightness = bd->props.brightness;
@@ -736,7 +731,6 @@ static struct lcd_ops s6e8ax0_lcd_ops = {
736}; 731};
737 732
738static const struct backlight_ops s6e8ax0_backlight_ops = { 733static const struct backlight_ops s6e8ax0_backlight_ops = {
739 .get_brightness = s6e8ax0_get_brightness,
740 .update_status = s6e8ax0_set_brightness, 734 .update_status = s6e8ax0_set_brightness,
741}; 735};
742 736
diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index e23392ec5af3..42543362f163 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -224,6 +224,11 @@ struct hvfb_par {
224 u32 pseudo_palette[16]; 224 u32 pseudo_palette[16];
225 u8 init_buf[MAX_VMBUS_PKT_SIZE]; 225 u8 init_buf[MAX_VMBUS_PKT_SIZE];
226 u8 recv_buf[MAX_VMBUS_PKT_SIZE]; 226 u8 recv_buf[MAX_VMBUS_PKT_SIZE];
227
228 /* If true, the VSC notifies the VSP on every framebuffer change */
229 bool synchronous_fb;
230
231 struct notifier_block hvfb_panic_nb;
227}; 232};
228 233
229static uint screen_width = HVFB_WIDTH; 234static uint screen_width = HVFB_WIDTH;
@@ -532,6 +537,19 @@ static void hvfb_update_work(struct work_struct *w)
532 schedule_delayed_work(&par->dwork, HVFB_UPDATE_DELAY); 537 schedule_delayed_work(&par->dwork, HVFB_UPDATE_DELAY);
533} 538}
534 539
540static int hvfb_on_panic(struct notifier_block *nb,
541 unsigned long e, void *p)
542{
543 struct hvfb_par *par;
544 struct fb_info *info;
545
546 par = container_of(nb, struct hvfb_par, hvfb_panic_nb);
547 par->synchronous_fb = true;
548 info = par->info;
549 synthvid_update(info);
550
551 return NOTIFY_DONE;
552}
535 553
536/* Framebuffer operation handlers */ 554/* Framebuffer operation handlers */
537 555
@@ -582,14 +600,44 @@ static int hvfb_blank(int blank, struct fb_info *info)
582 return 1; /* get fb_blank to set the colormap to all black */ 600 return 1; /* get fb_blank to set the colormap to all black */
583} 601}
584 602
603static void hvfb_cfb_fillrect(struct fb_info *p,
604 const struct fb_fillrect *rect)
605{
606 struct hvfb_par *par = p->par;
607
608 cfb_fillrect(p, rect);
609 if (par->synchronous_fb)
610 synthvid_update(p);
611}
612
613static void hvfb_cfb_copyarea(struct fb_info *p,
614 const struct fb_copyarea *area)
615{
616 struct hvfb_par *par = p->par;
617
618 cfb_copyarea(p, area);
619 if (par->synchronous_fb)
620 synthvid_update(p);
621}
622
623static void hvfb_cfb_imageblit(struct fb_info *p,
624 const struct fb_image *image)
625{
626 struct hvfb_par *par = p->par;
627
628 cfb_imageblit(p, image);
629 if (par->synchronous_fb)
630 synthvid_update(p);
631}
632
585static struct fb_ops hvfb_ops = { 633static struct fb_ops hvfb_ops = {
586 .owner = THIS_MODULE, 634 .owner = THIS_MODULE,
587 .fb_check_var = hvfb_check_var, 635 .fb_check_var = hvfb_check_var,
588 .fb_set_par = hvfb_set_par, 636 .fb_set_par = hvfb_set_par,
589 .fb_setcolreg = hvfb_setcolreg, 637 .fb_setcolreg = hvfb_setcolreg,
590 .fb_fillrect = cfb_fillrect, 638 .fb_fillrect = hvfb_cfb_fillrect,
591 .fb_copyarea = cfb_copyarea, 639 .fb_copyarea = hvfb_cfb_copyarea,
592 .fb_imageblit = cfb_imageblit, 640 .fb_imageblit = hvfb_cfb_imageblit,
593 .fb_blank = hvfb_blank, 641 .fb_blank = hvfb_blank,
594}; 642};
595 643
@@ -801,6 +849,11 @@ static int hvfb_probe(struct hv_device *hdev,
801 849
802 par->fb_ready = true; 850 par->fb_ready = true;
803 851
852 par->synchronous_fb = false;
853 par->hvfb_panic_nb.notifier_call = hvfb_on_panic;
854 atomic_notifier_chain_register(&panic_notifier_list,
855 &par->hvfb_panic_nb);
856
804 return 0; 857 return 0;
805 858
806error: 859error:
@@ -820,6 +873,9 @@ static int hvfb_remove(struct hv_device *hdev)
820 struct fb_info *info = hv_get_drvdata(hdev); 873 struct fb_info *info = hv_get_drvdata(hdev);
821 struct hvfb_par *par = info->par; 874 struct hvfb_par *par = info->par;
822 875
876 atomic_notifier_chain_unregister(&panic_notifier_list,
877 &par->hvfb_panic_nb);
878
823 par->update = false; 879 par->update = false;
824 par->fb_ready = false; 880 par->fb_ready = false;
825 881
@@ -836,7 +892,7 @@ static int hvfb_remove(struct hv_device *hdev)
836} 892}
837 893
838 894
839static DEFINE_PCI_DEVICE_TABLE(pci_stub_id_table) = { 895static const struct pci_device_id pci_stub_id_table[] = {
840 { 896 {
841 .vendor = PCI_VENDOR_ID_MICROSOFT, 897 .vendor = PCI_VENDOR_ID_MICROSOFT,
842 .device = PCI_DEVICE_ID_HYPERV_VIDEO, 898 .device = PCI_DEVICE_ID_HYPERV_VIDEO,
diff --git a/drivers/video/fbdev/i740fb.c b/drivers/video/fbdev/i740fb.c
index ca7c9df193b0..a2b4204b42bb 100644
--- a/drivers/video/fbdev/i740fb.c
+++ b/drivers/video/fbdev/i740fb.c
@@ -1260,7 +1260,7 @@ fail:
1260#define I740_ID_PCI 0x00d1 1260#define I740_ID_PCI 0x00d1
1261#define I740_ID_AGP 0x7800 1261#define I740_ID_AGP 0x7800
1262 1262
1263static DEFINE_PCI_DEVICE_TABLE(i740fb_id_table) = { 1263static const struct pci_device_id i740fb_id_table[] = {
1264 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, I740_ID_PCI) }, 1264 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, I740_ID_PCI) },
1265 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, I740_ID_AGP) }, 1265 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, I740_ID_AGP) },
1266 { 0 } 1266 { 0 }
diff --git a/drivers/video/fbdev/intelfb/intelfbhw.c b/drivers/video/fbdev/intelfb/intelfbhw.c
index fbad61da359f..d31ed4e2c46f 100644
--- a/drivers/video/fbdev/intelfb/intelfbhw.c
+++ b/drivers/video/fbdev/intelfb/intelfbhw.c
@@ -1191,7 +1191,6 @@ int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
1191 vsync_end = vsync_start + var->vsync_len; 1191 vsync_end = vsync_start + var->vsync_len;
1192 vtotal = vsync_end + var->upper_margin; 1192 vtotal = vsync_end + var->upper_margin;
1193 vblank_start = vactive; 1193 vblank_start = vactive;
1194 vblank_end = vtotal;
1195 vblank_end = vsync_end + 1; 1194 vblank_end = vsync_end + 1;
1196 1195
1197 DBG_MSG("V: act %d, ss %d, se %d, tot %d bs %d, be %d\n", 1196 DBG_MSG("V: act %d, ss %d, se %d, tot %d bs %d, be %d\n",
@@ -1859,7 +1858,7 @@ void intelfbhw_cursor_init(struct intelfb_info *dinfo)
1859 tmp = INREG(CURSOR_CONTROL); 1858 tmp = INREG(CURSOR_CONTROL);
1860 tmp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE | 1859 tmp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE |
1861 CURSOR_ENABLE | CURSOR_STRIDE_MASK); 1860 CURSOR_ENABLE | CURSOR_STRIDE_MASK);
1862 tmp = CURSOR_FORMAT_3C; 1861 tmp |= CURSOR_FORMAT_3C;
1863 OUTREG(CURSOR_CONTROL, tmp); 1862 OUTREG(CURSOR_CONTROL, tmp);
1864 OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.offset << 12); 1863 OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.offset << 12);
1865 tmp = (64 << CURSOR_SIZE_H_SHIFT) | 1864 tmp = (64 << CURSOR_SIZE_H_SHIFT) |
diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c
index 7116c5309c7d..62539ca1cfa9 100644
--- a/drivers/video/fbdev/matrox/matroxfb_base.c
+++ b/drivers/video/fbdev/matrox/matroxfb_base.c
@@ -1341,19 +1341,57 @@ struct video_board {
1341 struct matrox_switch* lowlevel; 1341 struct matrox_switch* lowlevel;
1342 }; 1342 };
1343#ifdef CONFIG_FB_MATROX_MILLENIUM 1343#ifdef CONFIG_FB_MATROX_MILLENIUM
1344static struct video_board vbMillennium = {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGA2064W, &matrox_millennium}; 1344static struct video_board vbMillennium = {
1345static struct video_board vbMillennium2 = {0x1000000, 0x0800000, FB_ACCEL_MATROX_MGA2164W, &matrox_millennium}; 1345 .maxvram = 0x0800000,
1346static struct video_board vbMillennium2A = {0x1000000, 0x0800000, FB_ACCEL_MATROX_MGA2164W_AGP, &matrox_millennium}; 1346 .maxdisplayable = 0x0800000,
1347 .accelID = FB_ACCEL_MATROX_MGA2064W,
1348 .lowlevel = &matrox_millennium
1349};
1350
1351static struct video_board vbMillennium2 = {
1352 .maxvram = 0x1000000,
1353 .maxdisplayable = 0x0800000,
1354 .accelID = FB_ACCEL_MATROX_MGA2164W,
1355 .lowlevel = &matrox_millennium
1356};
1357
1358static struct video_board vbMillennium2A = {
1359 .maxvram = 0x1000000,
1360 .maxdisplayable = 0x0800000,
1361 .accelID = FB_ACCEL_MATROX_MGA2164W_AGP,
1362 .lowlevel = &matrox_millennium
1363};
1347#endif /* CONFIG_FB_MATROX_MILLENIUM */ 1364#endif /* CONFIG_FB_MATROX_MILLENIUM */
1348#ifdef CONFIG_FB_MATROX_MYSTIQUE 1365#ifdef CONFIG_FB_MATROX_MYSTIQUE
1349static struct video_board vbMystique = {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGA1064SG, &matrox_mystique}; 1366static struct video_board vbMystique = {
1367 .maxvram = 0x0800000,
1368 .maxdisplayable = 0x0800000,
1369 .accelID = FB_ACCEL_MATROX_MGA1064SG,
1370 .lowlevel = &matrox_mystique
1371};
1350#endif /* CONFIG_FB_MATROX_MYSTIQUE */ 1372#endif /* CONFIG_FB_MATROX_MYSTIQUE */
1351#ifdef CONFIG_FB_MATROX_G 1373#ifdef CONFIG_FB_MATROX_G
1352static struct video_board vbG100 = {0x0800000, 0x0800000, FB_ACCEL_MATROX_MGAG100, &matrox_G100}; 1374static struct video_board vbG100 = {
1353static struct video_board vbG200 = {0x1000000, 0x1000000, FB_ACCEL_MATROX_MGAG200, &matrox_G100}; 1375 .maxvram = 0x0800000,
1376 .maxdisplayable = 0x0800000,
1377 .accelID = FB_ACCEL_MATROX_MGAG100,
1378 .lowlevel = &matrox_G100
1379};
1380
1381static struct video_board vbG200 = {
1382 .maxvram = 0x1000000,
1383 .maxdisplayable = 0x1000000,
1384 .accelID = FB_ACCEL_MATROX_MGAG200,
1385 .lowlevel = &matrox_G100
1386};
1354/* from doc it looks like that accelerator can draw only to low 16MB :-( Direct accesses & displaying are OK for 1387/* from doc it looks like that accelerator can draw only to low 16MB :-( Direct accesses & displaying are OK for
1355 whole 32MB */ 1388 whole 32MB */
1356static struct video_board vbG400 = {0x2000000, 0x1000000, FB_ACCEL_MATROX_MGAG400, &matrox_G100}; 1389static struct video_board vbG400 = {
1390 .maxvram = 0x2000000,
1391 .maxdisplayable = 0x1000000,
1392 .accelID = FB_ACCEL_MATROX_MGAG400,
1393 .lowlevel = &matrox_G100
1394};
1357#endif 1395#endif
1358 1396
1359#define DEVF_VIDEO64BIT 0x0001 1397#define DEVF_VIDEO64BIT 0x0001
diff --git a/drivers/video/fbdev/matrox/matroxfb_maven.c b/drivers/video/fbdev/matrox/matroxfb_maven.c
index ee41a0f276b2..bf5ce04f9aea 100644
--- a/drivers/video/fbdev/matrox/matroxfb_maven.c
+++ b/drivers/video/fbdev/matrox/matroxfb_maven.c
@@ -201,21 +201,23 @@ struct matrox_pll_ctl {
201}; 201};
202 202
203static const struct matrox_pll_features2 maven1000_pll = { 203static const struct matrox_pll_features2 maven1000_pll = {
204 50000000, 204 .vco_freq_min = 50000000,
205 300000000, 205 .vco_freq_max = 300000000,
206 5, 128, 206 .feed_div_min = 5,
207 3, 32, 207 .feed_div_max = 128,
208 3 208 .in_div_min = 3,
209 .in_div_max = 32,
210 .post_shift_max = 3
209}; 211};
210 212
211static const struct matrox_pll_ctl maven_PAL = { 213static const struct matrox_pll_ctl maven_PAL = {
212 540000, 214 .ref_freq = 540000,
213 50 215 .den = 50
214}; 216};
215 217
216static const struct matrox_pll_ctl maven_NTSC = { 218static const struct matrox_pll_ctl maven_NTSC = {
217 450450, /* 27027000/60 == 27000000/59.94005994 */ 219 .ref_freq = 450450, /* 27027000/60 == 27000000/59.94005994 */
218 60 220 .den = 60
219}; 221};
220 222
221static int matroxfb_PLL_mavenclock(const struct matrox_pll_features2* pll, 223static int matroxfb_PLL_mavenclock(const struct matrox_pll_features2* pll,
diff --git a/drivers/video/fbdev/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c
index 2bd52ed8832c..698df9543e30 100644
--- a/drivers/video/fbdev/mbx/mbxfb.c
+++ b/drivers/video/fbdev/mbx/mbxfb.c
@@ -628,14 +628,14 @@ static int mbxfb_ioctl(struct fb_info *info, unsigned int cmd,
628 case MBXFB_IOCS_PLANEORDER: 628 case MBXFB_IOCS_PLANEORDER:
629 if (copy_from_user(&porder, (void __user*)arg, 629 if (copy_from_user(&porder, (void __user*)arg,
630 sizeof(struct mbxfb_planeorder))) 630 sizeof(struct mbxfb_planeorder)))
631 return -EFAULT; 631 return -EFAULT;
632 632
633 return mbxfb_ioctl_planeorder(&porder); 633 return mbxfb_ioctl_planeorder(&porder);
634 634
635 case MBXFB_IOCS_ALPHA: 635 case MBXFB_IOCS_ALPHA:
636 if (copy_from_user(&alpha, (void __user*)arg, 636 if (copy_from_user(&alpha, (void __user*)arg,
637 sizeof(struct mbxfb_alphaCtl))) 637 sizeof(struct mbxfb_alphaCtl)))
638 return -EFAULT; 638 return -EFAULT;
639 639
640 return mbxfb_ioctl_alphactl(&alpha); 640 return mbxfb_ioctl_alphactl(&alpha);
641 641
diff --git a/drivers/video/fbdev/msm/mddi_client_dummy.c b/drivers/video/fbdev/msm/mddi_client_dummy.c
index f1b0dfcc9717..cdb8f69a5d88 100644
--- a/drivers/video/fbdev/msm/mddi_client_dummy.c
+++ b/drivers/video/fbdev/msm/mddi_client_dummy.c
@@ -15,6 +15,7 @@
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 */ 16 */
17 17
18#include <linux/device.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
@@ -51,8 +52,7 @@ static int mddi_dummy_probe(struct platform_device *pdev)
51{ 52{
52 struct msm_mddi_client_data *client_data = pdev->dev.platform_data; 53 struct msm_mddi_client_data *client_data = pdev->dev.platform_data;
53 struct panel_info *panel = 54 struct panel_info *panel =
54 kzalloc(sizeof(struct panel_info), GFP_KERNEL); 55 devm_kzalloc(&pdev->dev, sizeof(struct panel_info), GFP_KERNEL);
55 int ret;
56 if (!panel) 56 if (!panel)
57 return -ENOMEM; 57 return -ENOMEM;
58 platform_set_drvdata(pdev, panel); 58 platform_set_drvdata(pdev, panel);
@@ -67,24 +67,11 @@ static int mddi_dummy_probe(struct platform_device *pdev)
67 client_data->fb_resource, 1); 67 client_data->fb_resource, 1);
68 panel->panel_data.fb_data = client_data->private_client_data; 68 panel->panel_data.fb_data = client_data->private_client_data;
69 panel->pdev.dev.platform_data = &panel->panel_data; 69 panel->pdev.dev.platform_data = &panel->panel_data;
70 ret = platform_device_register(&panel->pdev); 70 return platform_device_register(&panel->pdev);
71 if (ret) {
72 kfree(panel);
73 return ret;
74 }
75 return 0;
76}
77
78static int mddi_dummy_remove(struct platform_device *pdev)
79{
80 struct panel_info *panel = platform_get_drvdata(pdev);
81 kfree(panel);
82 return 0;
83} 71}
84 72
85static struct platform_driver mddi_client_dummy = { 73static struct platform_driver mddi_client_dummy = {
86 .probe = mddi_dummy_probe, 74 .probe = mddi_dummy_probe,
87 .remove = mddi_dummy_remove,
88 .driver = { .name = "mddi_c_dummy" }, 75 .driver = { .name = "mddi_c_dummy" },
89}; 76};
90 77
diff --git a/drivers/video/fbdev/msm/msm_fb.c b/drivers/video/fbdev/msm/msm_fb.c
index 1374803fbcd9..2979d7e72126 100644
--- a/drivers/video/fbdev/msm/msm_fb.c
+++ b/drivers/video/fbdev/msm/msm_fb.c
@@ -569,8 +569,13 @@ static int msmfb_probe(struct platform_device *pdev)
569 mutex_init(&msmfb->panel_init_lock); 569 mutex_init(&msmfb->panel_init_lock);
570 init_waitqueue_head(&msmfb->frame_wq); 570 init_waitqueue_head(&msmfb->frame_wq);
571 INIT_WORK(&msmfb->resume_work, power_on_panel); 571 INIT_WORK(&msmfb->resume_work, power_on_panel);
572 msmfb->black = kzalloc(msmfb->fb->var.bits_per_pixel*msmfb->xres, 572 msmfb->black = devm_kzalloc(&pdev->dev,
573 GFP_KERNEL); 573 msmfb->fb->var.bits_per_pixel*msmfb->xres,
574 GFP_KERNEL);
575 if (!msmfb->black) {
576 ret = -ENOMEM;
577 goto error_register_framebuffer;
578 }
574 579
575 printk(KERN_INFO "msmfb_probe() installing %d x %d panel\n", 580 printk(KERN_INFO "msmfb_probe() installing %d x %d panel\n",
576 msmfb->xres, msmfb->yres); 581 msmfb->xres, msmfb->yres);
@@ -589,6 +594,8 @@ static int msmfb_probe(struct platform_device *pdev)
589 594
590 msmfb->sleeping = WAKING; 595 msmfb->sleeping = WAKING;
591 596
597 platform_set_drvdata(pdev, msmfb);
598
592 return 0; 599 return 0;
593 600
594error_register_framebuffer: 601error_register_framebuffer:
@@ -598,9 +605,23 @@ error_setup_fbmem:
598 return ret; 605 return ret;
599} 606}
600 607
608static int msmfb_remove(struct platform_device *pdev)
609{
610 struct msmfb_info *msmfb;
611
612 msmfb = platform_get_drvdata(pdev);
613
614 unregister_framebuffer(msmfb->fb);
615 iounmap(msmfb->fb->screen_base);
616 framebuffer_release(msmfb->fb);
617
618 return 0;
619}
620
601static struct platform_driver msm_panel_driver = { 621static struct platform_driver msm_panel_driver = {
602 /* need to write remove */ 622 /* need to write remove */
603 .probe = msmfb_probe, 623 .probe = msmfb_probe,
624 .remove = msmfb_remove,
604 .driver = {.name = "msm_panel"}, 625 .driver = {.name = "msm_panel"},
605}; 626};
606 627
diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index c645a0a0c341..23ec781e9a61 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -461,8 +461,7 @@ static void sdc_disable_channel(struct mx3fb_info *mx3_fbi)
461 461
462 spin_unlock_irqrestore(&mx3fb->lock, flags); 462 spin_unlock_irqrestore(&mx3fb->lock, flags);
463 463
464 mx3_fbi->txd->chan->device->device_control(mx3_fbi->txd->chan, 464 dmaengine_terminate_all(mx3_fbi->txd->chan);
465 DMA_TERMINATE_ALL, 0);
466 mx3_fbi->txd = NULL; 465 mx3_fbi->txd = NULL;
467 mx3_fbi->cookie = -EINVAL; 466 mx3_fbi->cookie = -EINVAL;
468} 467}
@@ -1179,7 +1178,7 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var,
1179 1178
1180 /* 1179 /*
1181 * We enable the End of Frame interrupt, which will free a tx-descriptor, 1180 * We enable the End of Frame interrupt, which will free a tx-descriptor,
1182 * which we will need for the next device_prep_slave_sg(). The 1181 * which we will need for the next dmaengine_prep_slave_sg(). The
1183 * IRQ-handler will disable the IRQ again. 1182 * IRQ-handler will disable the IRQ again.
1184 */ 1183 */
1185 init_completion(&mx3_fbi->flip_cmpl); 1184 init_completion(&mx3_fbi->flip_cmpl);
diff --git a/drivers/video/fbdev/nvidia/nv_backlight.c b/drivers/video/fbdev/nvidia/nv_backlight.c
index 8471008aa6ff..5c151b2ea683 100644
--- a/drivers/video/fbdev/nvidia/nv_backlight.c
+++ b/drivers/video/fbdev/nvidia/nv_backlight.c
@@ -82,13 +82,7 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
82 return 0; 82 return 0;
83} 83}
84 84
85static int nvidia_bl_get_brightness(struct backlight_device *bd)
86{
87 return bd->props.brightness;
88}
89
90static const struct backlight_ops nvidia_bl_ops = { 85static const struct backlight_ops nvidia_bl_ops = {
91 .get_brightness = nvidia_bl_get_brightness,
92 .update_status = nvidia_bl_update_status, 86 .update_status = nvidia_bl_update_status,
93}; 87};
94 88
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c b/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c
index 5ee3b5505f7f..91921665b98b 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c
@@ -301,6 +301,8 @@ static const struct of_device_id tvc_of_match[] = {
301 {}, 301 {},
302}; 302};
303 303
304MODULE_DEVICE_TABLE(of, tvc_of_match);
305
304static struct platform_driver tvc_connector_driver = { 306static struct platform_driver tvc_connector_driver = {
305 .probe = tvc_probe, 307 .probe = tvc_probe,
306 .remove = __exit_p(tvc_remove), 308 .remove = __exit_p(tvc_remove),
@@ -308,6 +310,7 @@ static struct platform_driver tvc_connector_driver = {
308 .name = "connector-analog-tv", 310 .name = "connector-analog-tv",
309 .owner = THIS_MODULE, 311 .owner = THIS_MODULE,
310 .of_match_table = tvc_of_match, 312 .of_match_table = tvc_of_match,
313 .suppress_bind_attrs = true,
311 }, 314 },
312}; 315};
313 316
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
index 74de2bc50c4f..2dfb6e5ff0cc 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
@@ -391,6 +391,7 @@ static struct platform_driver dvi_connector_driver = {
391 .name = "connector-dvi", 391 .name = "connector-dvi",
392 .owner = THIS_MODULE, 392 .owner = THIS_MODULE,
393 .of_match_table = dvic_of_match, 393 .of_match_table = dvic_of_match,
394 .suppress_bind_attrs = true,
394 }, 395 },
395}; 396};
396 397
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
index 4420ccb69aa9..7b25967a91eb 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
@@ -262,6 +262,23 @@ static int hdmic_audio_config(struct omap_dss_device *dssdev,
262 return 0; 262 return 0;
263} 263}
264 264
265static int hdmic_set_hdmi_mode(struct omap_dss_device *dssdev, bool hdmi_mode)
266{
267 struct panel_drv_data *ddata = to_panel_data(dssdev);
268 struct omap_dss_device *in = ddata->in;
269
270 return in->ops.hdmi->set_hdmi_mode(in, hdmi_mode);
271}
272
273static int hdmic_set_infoframe(struct omap_dss_device *dssdev,
274 const struct hdmi_avi_infoframe *avi)
275{
276 struct panel_drv_data *ddata = to_panel_data(dssdev);
277 struct omap_dss_device *in = ddata->in;
278
279 return in->ops.hdmi->set_infoframe(in, avi);
280}
281
265static struct omap_dss_driver hdmic_driver = { 282static struct omap_dss_driver hdmic_driver = {
266 .connect = hdmic_connect, 283 .connect = hdmic_connect,
267 .disconnect = hdmic_disconnect, 284 .disconnect = hdmic_disconnect,
@@ -277,6 +294,8 @@ static struct omap_dss_driver hdmic_driver = {
277 294
278 .read_edid = hdmic_read_edid, 295 .read_edid = hdmic_read_edid,
279 .detect = hdmic_detect, 296 .detect = hdmic_detect,
297 .set_hdmi_mode = hdmic_set_hdmi_mode,
298 .set_hdmi_infoframe = hdmic_set_infoframe,
280 299
281 .audio_enable = hdmic_audio_enable, 300 .audio_enable = hdmic_audio_enable,
282 .audio_disable = hdmic_audio_disable, 301 .audio_disable = hdmic_audio_disable,
@@ -418,6 +437,7 @@ static struct platform_driver hdmi_connector_driver = {
418 .name = "connector-hdmi", 437 .name = "connector-hdmi",
419 .owner = THIS_MODULE, 438 .owner = THIS_MODULE,
420 .of_match_table = hdmic_of_match, 439 .of_match_table = hdmic_of_match,
440 .suppress_bind_attrs = true,
421 }, 441 },
422}; 442};
423 443
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c
index b4e9a42a79e6..47ee7cdee1c5 100644
--- a/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c
+++ b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c
@@ -298,6 +298,7 @@ static struct platform_driver tfp410_driver = {
298 .name = "tfp410", 298 .name = "tfp410",
299 .owner = THIS_MODULE, 299 .owner = THIS_MODULE,
300 .of_match_table = tfp410_of_match, 300 .of_match_table = tfp410_of_match,
301 .suppress_bind_attrs = true,
301 }, 302 },
302}; 303};
303 304
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
index 7e33686171e3..c4abd56dd846 100644
--- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
@@ -242,6 +242,24 @@ static int tpd_audio_config(struct omap_dss_device *dssdev,
242 return in->ops.hdmi->audio_config(in, audio); 242 return in->ops.hdmi->audio_config(in, audio);
243} 243}
244 244
245static int tpd_set_infoframe(struct omap_dss_device *dssdev,
246 const struct hdmi_avi_infoframe *avi)
247{
248 struct panel_drv_data *ddata = to_panel_data(dssdev);
249 struct omap_dss_device *in = ddata->in;
250
251 return in->ops.hdmi->set_infoframe(in, avi);
252}
253
254static int tpd_set_hdmi_mode(struct omap_dss_device *dssdev,
255 bool hdmi_mode)
256{
257 struct panel_drv_data *ddata = to_panel_data(dssdev);
258 struct omap_dss_device *in = ddata->in;
259
260 return in->ops.hdmi->set_hdmi_mode(in, hdmi_mode);
261}
262
245static const struct omapdss_hdmi_ops tpd_hdmi_ops = { 263static const struct omapdss_hdmi_ops tpd_hdmi_ops = {
246 .connect = tpd_connect, 264 .connect = tpd_connect,
247 .disconnect = tpd_disconnect, 265 .disconnect = tpd_disconnect,
@@ -255,6 +273,8 @@ static const struct omapdss_hdmi_ops tpd_hdmi_ops = {
255 273
256 .read_edid = tpd_read_edid, 274 .read_edid = tpd_read_edid,
257 .detect = tpd_detect, 275 .detect = tpd_detect,
276 .set_infoframe = tpd_set_infoframe,
277 .set_hdmi_mode = tpd_set_hdmi_mode,
258 278
259 .audio_enable = tpd_audio_enable, 279 .audio_enable = tpd_audio_enable,
260 .audio_disable = tpd_audio_disable, 280 .audio_disable = tpd_audio_disable,
@@ -441,6 +461,7 @@ static struct platform_driver tpd_driver = {
441 .name = "tpd12s015", 461 .name = "tpd12s015",
442 .owner = THIS_MODULE, 462 .owner = THIS_MODULE,
443 .of_match_table = tpd_of_match, 463 .of_match_table = tpd_of_match,
464 .suppress_bind_attrs = true,
444 }, 465 },
445}; 466};
446 467
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
index 3636b61dc9b4..a9c3dcf0f6b5 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
@@ -327,6 +327,7 @@ static struct platform_driver panel_dpi_driver = {
327 .name = "panel-dpi", 327 .name = "panel-dpi",
328 .owner = THIS_MODULE, 328 .owner = THIS_MODULE,
329 .of_match_table = panel_dpi_of_match, 329 .of_match_table = panel_dpi_of_match,
330 .suppress_bind_attrs = true,
330 }, 331 },
331}; 332};
332 333
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c
index d6f14e8717e8..899cb1ab523d 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c
@@ -1378,6 +1378,7 @@ static struct platform_driver dsicm_driver = {
1378 .name = "panel-dsi-cm", 1378 .name = "panel-dsi-cm",
1379 .owner = THIS_MODULE, 1379 .owner = THIS_MODULE,
1380 .of_match_table = dsicm_of_match, 1380 .of_match_table = dsicm_of_match,
1381 .suppress_bind_attrs = true,
1381 }, 1382 },
1382}; 1383};
1383 1384
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
index cc5b5124e0b4..27d4fcfa1824 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
@@ -394,6 +394,7 @@ static struct spi_driver lb035q02_spi_driver = {
394 .name = "panel_lgphilips_lb035q02", 394 .name = "panel_lgphilips_lb035q02",
395 .owner = THIS_MODULE, 395 .owner = THIS_MODULE,
396 .of_match_table = lb035q02_of_match, 396 .of_match_table = lb035q02_of_match,
397 .suppress_bind_attrs = true,
397 }, 398 },
398}; 399};
399 400
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c
index 3595f111aa35..ccf3f4f3c703 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c
@@ -424,6 +424,7 @@ static struct spi_driver nec_8048_driver = {
424 .owner = THIS_MODULE, 424 .owner = THIS_MODULE,
425 .pm = NEC_8048_PM_OPS, 425 .pm = NEC_8048_PM_OPS,
426 .of_match_table = nec_8048_of_match, 426 .of_match_table = nec_8048_of_match,
427 .suppress_bind_attrs = true,
427 }, 428 },
428 .probe = nec_8048_probe, 429 .probe = nec_8048_probe,
429 .remove = nec_8048_remove, 430 .remove = nec_8048_remove,
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c
index f1f72ce50a17..234142cc3764 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c
@@ -410,6 +410,7 @@ static struct platform_driver sharp_ls_driver = {
410 .name = "panel-sharp-ls037v7dw01", 410 .name = "panel-sharp-ls037v7dw01",
411 .owner = THIS_MODULE, 411 .owner = THIS_MODULE,
412 .of_match_table = sharp_ls_of_match, 412 .of_match_table = sharp_ls_of_match,
413 .suppress_bind_attrs = true,
413 }, 414 },
414}; 415};
415 416
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
index c7ba4d8b928a..337ccc5c0f5e 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
@@ -817,6 +817,10 @@ static int acx565akm_probe(struct spi_device *spi)
817 817
818 bldev = backlight_device_register("acx565akm", &ddata->spi->dev, 818 bldev = backlight_device_register("acx565akm", &ddata->spi->dev,
819 ddata, &acx565akm_bl_ops, &props); 819 ddata, &acx565akm_bl_ops, &props);
820 if (IS_ERR(bldev)) {
821 r = PTR_ERR(bldev);
822 goto err_reg_bl;
823 }
820 ddata->bl_dev = bldev; 824 ddata->bl_dev = bldev;
821 if (ddata->has_cabc) { 825 if (ddata->has_cabc) {
822 r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); 826 r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group);
@@ -862,6 +866,7 @@ err_reg:
862 sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group); 866 sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group);
863err_sysfs: 867err_sysfs:
864 backlight_device_unregister(bldev); 868 backlight_device_unregister(bldev);
869err_reg_bl:
865err_detect: 870err_detect:
866err_gpio: 871err_gpio:
867 omap_dss_put_device(ddata->in); 872 omap_dss_put_device(ddata->in);
@@ -899,6 +904,7 @@ static struct spi_driver acx565akm_driver = {
899 .name = "acx565akm", 904 .name = "acx565akm",
900 .owner = THIS_MODULE, 905 .owner = THIS_MODULE,
901 .of_match_table = acx565akm_of_match, 906 .of_match_table = acx565akm_of_match,
907 .suppress_bind_attrs = true,
902 }, 908 },
903 .probe = acx565akm_probe, 909 .probe = acx565akm_probe,
904 .remove = acx565akm_remove, 910 .remove = acx565akm_remove,
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c
index 728808bcceeb..fbba0b8ca871 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c
@@ -500,6 +500,7 @@ static struct spi_driver td028ttec1_spi_driver = {
500 .name = "panel-tpo-td028ttec1", 500 .name = "panel-tpo-td028ttec1",
501 .owner = THIS_MODULE, 501 .owner = THIS_MODULE,
502 .of_match_table = td028ttec1_of_match, 502 .of_match_table = td028ttec1_of_match,
503 .suppress_bind_attrs = true,
503 }, 504 },
504}; 505};
505 506
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
index de78ab0caaa8..5aba76bca25a 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
@@ -673,6 +673,7 @@ static struct spi_driver tpo_td043_spi_driver = {
673 .owner = THIS_MODULE, 673 .owner = THIS_MODULE,
674 .pm = &tpo_td043_spi_pm, 674 .pm = &tpo_td043_spi_pm,
675 .of_match_table = tpo_td043_of_match, 675 .of_match_table = tpo_td043_of_match,
676 .suppress_bind_attrs = true,
676 }, 677 },
677 .probe = tpo_td043_probe, 678 .probe = tpo_td043_probe,
678 .remove = tpo_td043_remove, 679 .remove = tpo_td043_remove,
diff --git a/drivers/video/fbdev/omap2/dss/Kconfig b/drivers/video/fbdev/omap2/dss/Kconfig
index 285bcd103dce..3d5eb6c36c22 100644
--- a/drivers/video/fbdev/omap2/dss/Kconfig
+++ b/drivers/video/fbdev/omap2/dss/Kconfig
@@ -5,6 +5,7 @@ menuconfig OMAP2_DSS
5 tristate "OMAP2+ Display Subsystem support" 5 tristate "OMAP2+ Display Subsystem support"
6 select VIDEOMODE_HELPERS 6 select VIDEOMODE_HELPERS
7 select OMAP2_DSS_INIT 7 select OMAP2_DSS_INIT
8 select HDMI
8 help 9 help
9 OMAP2+ Display Subsystem support. 10 OMAP2+ Display Subsystem support.
10 11
diff --git a/drivers/video/fbdev/omap2/dss/apply.c b/drivers/video/fbdev/omap2/dss/apply.c
index 0a0b084ce65d..663ccc3bf4e5 100644
--- a/drivers/video/fbdev/omap2/dss/apply.c
+++ b/drivers/video/fbdev/omap2/dss/apply.c
@@ -1132,6 +1132,8 @@ static void dss_mgr_disable_compat(struct omap_overlay_manager *mgr)
1132 if (!mp->enabled) 1132 if (!mp->enabled)
1133 goto out; 1133 goto out;
1134 1134
1135 wait_pending_extra_info_updates();
1136
1135 if (!mgr_manual_update(mgr)) 1137 if (!mgr_manual_update(mgr))
1136 dispc_mgr_disable_sync(mgr->id); 1138 dispc_mgr_disable_sync(mgr->id);
1137 1139
diff --git a/drivers/video/fbdev/omap2/dss/dispc-compat.c b/drivers/video/fbdev/omap2/dss/dispc-compat.c
index 83779c2b292a..633c461fbc6e 100644
--- a/drivers/video/fbdev/omap2/dss/dispc-compat.c
+++ b/drivers/video/fbdev/omap2/dss/dispc-compat.c
@@ -634,13 +634,14 @@ void dispc_mgr_disable_sync(enum omap_channel channel)
634 WARN_ON(1); 634 WARN_ON(1);
635} 635}
636 636
637static inline void dispc_irq_wait_handler(void *data, u32 mask)
638{
639 complete((struct completion *)data);
640}
641
637int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask, 642int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
638 unsigned long timeout) 643 unsigned long timeout)
639{ 644{
640 void dispc_irq_wait_handler(void *data, u32 mask)
641 {
642 complete((struct completion *)data);
643 }
644 645
645 int r; 646 int r;
646 DECLARE_COMPLETION_ONSTACK(completion); 647 DECLARE_COMPLETION_ONSTACK(completion);
diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c
index 7aa33b0f4a1f..0e9a74bb9fc2 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/dss/dispc.c
@@ -2879,19 +2879,24 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel,
2879bool dispc_mgr_timings_ok(enum omap_channel channel, 2879bool dispc_mgr_timings_ok(enum omap_channel channel,
2880 const struct omap_video_timings *timings) 2880 const struct omap_video_timings *timings)
2881{ 2881{
2882 bool timings_ok; 2882 if (!_dispc_mgr_size_ok(timings->x_res, timings->y_res))
2883 2883 return false;
2884 timings_ok = _dispc_mgr_size_ok(timings->x_res, timings->y_res);
2885 2884
2886 timings_ok &= _dispc_mgr_pclk_ok(channel, timings->pixelclock); 2885 if (!_dispc_mgr_pclk_ok(channel, timings->pixelclock))
2886 return false;
2887 2887
2888 if (dss_mgr_is_lcd(channel)) { 2888 if (dss_mgr_is_lcd(channel)) {
2889 timings_ok &= _dispc_lcd_timings_ok(timings->hsw, timings->hfp, 2889 /* TODO: OMAP4+ supports interlace for LCD outputs */
2890 if (timings->interlace)
2891 return false;
2892
2893 if (!_dispc_lcd_timings_ok(timings->hsw, timings->hfp,
2890 timings->hbp, timings->vsw, timings->vfp, 2894 timings->hbp, timings->vsw, timings->vfp,
2891 timings->vbp); 2895 timings->vbp))
2896 return false;
2892 } 2897 }
2893 2898
2894 return timings_ok; 2899 return true;
2895} 2900}
2896 2901
2897static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw, 2902static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw,
@@ -3257,13 +3262,10 @@ static void dispc_dump_regs(struct seq_file *s)
3257 if (i == OMAP_DSS_CHANNEL_DIGIT) 3262 if (i == OMAP_DSS_CHANNEL_DIGIT)
3258 continue; 3263 continue;
3259 3264
3260 DUMPREG(i, DISPC_DEFAULT_COLOR);
3261 DUMPREG(i, DISPC_TRANS_COLOR);
3262 DUMPREG(i, DISPC_TIMING_H); 3265 DUMPREG(i, DISPC_TIMING_H);
3263 DUMPREG(i, DISPC_TIMING_V); 3266 DUMPREG(i, DISPC_TIMING_V);
3264 DUMPREG(i, DISPC_POL_FREQ); 3267 DUMPREG(i, DISPC_POL_FREQ);
3265 DUMPREG(i, DISPC_DIVISORo); 3268 DUMPREG(i, DISPC_DIVISORo);
3266 DUMPREG(i, DISPC_SIZE_MGR);
3267 3269
3268 DUMPREG(i, DISPC_DATA_CYCLE1); 3270 DUMPREG(i, DISPC_DATA_CYCLE1);
3269 DUMPREG(i, DISPC_DATA_CYCLE2); 3271 DUMPREG(i, DISPC_DATA_CYCLE2);
@@ -3288,8 +3290,11 @@ static void dispc_dump_regs(struct seq_file *s)
3288 DUMPREG(i, DISPC_OVL_FIFO_SIZE_STATUS); 3290 DUMPREG(i, DISPC_OVL_FIFO_SIZE_STATUS);
3289 DUMPREG(i, DISPC_OVL_ROW_INC); 3291 DUMPREG(i, DISPC_OVL_ROW_INC);
3290 DUMPREG(i, DISPC_OVL_PIXEL_INC); 3292 DUMPREG(i, DISPC_OVL_PIXEL_INC);
3293
3291 if (dss_has_feature(FEAT_PRELOAD)) 3294 if (dss_has_feature(FEAT_PRELOAD))
3292 DUMPREG(i, DISPC_OVL_PRELOAD); 3295 DUMPREG(i, DISPC_OVL_PRELOAD);
3296 if (dss_has_feature(FEAT_MFLAG))
3297 DUMPREG(i, DISPC_OVL_MFLAG_THRESHOLD);
3293 3298
3294 if (i == OMAP_DSS_GFX) { 3299 if (i == OMAP_DSS_GFX) {
3295 DUMPREG(i, DISPC_OVL_WINDOW_SKIP); 3300 DUMPREG(i, DISPC_OVL_WINDOW_SKIP);
@@ -3310,10 +3315,6 @@ static void dispc_dump_regs(struct seq_file *s)
3310 } 3315 }
3311 if (dss_has_feature(FEAT_ATTR2)) 3316 if (dss_has_feature(FEAT_ATTR2))
3312 DUMPREG(i, DISPC_OVL_ATTRIBUTES2); 3317 DUMPREG(i, DISPC_OVL_ATTRIBUTES2);
3313 if (dss_has_feature(FEAT_PRELOAD))
3314 DUMPREG(i, DISPC_OVL_PRELOAD);
3315 if (dss_has_feature(FEAT_MFLAG))
3316 DUMPREG(i, DISPC_OVL_MFLAG_THRESHOLD);
3317 } 3318 }
3318 3319
3319#undef DISPC_REG 3320#undef DISPC_REG
@@ -3841,6 +3842,7 @@ static struct platform_driver omap_dispchw_driver = {
3841 .owner = THIS_MODULE, 3842 .owner = THIS_MODULE,
3842 .pm = &dispc_pm_ops, 3843 .pm = &dispc_pm_ops,
3843 .of_match_table = dispc_of_match, 3844 .of_match_table = dispc_of_match,
3845 .suppress_bind_attrs = true,
3844 }, 3846 },
3845}; 3847};
3846 3848
diff --git a/drivers/video/fbdev/omap2/dss/dispc.h b/drivers/video/fbdev/omap2/dss/dispc.h
index 78edb449c763..3043d6e0a5f9 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.h
+++ b/drivers/video/fbdev/omap2/dss/dispc.h
@@ -101,8 +101,7 @@
101 DISPC_FIR_COEF_V2_OFFSET(n, i)) 101 DISPC_FIR_COEF_V2_OFFSET(n, i))
102#define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \ 102#define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \
103 DISPC_PRELOAD_OFFSET(n)) 103 DISPC_PRELOAD_OFFSET(n))
104#define DISPC_OVL_MFLAG_THRESHOLD(n) (DISPC_OVL_BASE(n) + \ 104#define DISPC_OVL_MFLAG_THRESHOLD(n) DISPC_MFLAG_THRESHOLD_OFFSET(n)
105 DISPC_MFLAG_THRESHOLD_OFFSET(n))
106 105
107/* DISPC up/downsampling FIR filter coefficient structure */ 106/* DISPC up/downsampling FIR filter coefficient structure */
108struct dispc_coef { 107struct dispc_coef {
diff --git a/drivers/video/fbdev/omap2/dss/dpi.c b/drivers/video/fbdev/omap2/dss/dpi.c
index 9368972d6962..4a3363dae74a 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -720,6 +720,7 @@ static struct platform_driver omap_dpi_driver = {
720 .driver = { 720 .driver = {
721 .name = "omapdss_dpi", 721 .name = "omapdss_dpi",
722 .owner = THIS_MODULE, 722 .owner = THIS_MODULE,
723 .suppress_bind_attrs = true,
723 }, 724 },
724}; 725};
725 726
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c
index 4755a34a5422..0793bc67a275 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -1603,7 +1603,7 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev,
1603 } else if (dss_has_feature(FEAT_DSI_PLL_SELFREQDCO)) { 1603 } else if (dss_has_feature(FEAT_DSI_PLL_SELFREQDCO)) {
1604 f = cinfo->clkin4ddr < 1000000000 ? 0x2 : 0x4; 1604 f = cinfo->clkin4ddr < 1000000000 ? 0x2 : 0x4;
1605 1605
1606 l = FLD_MOD(l, f, 4, 1); /* PLL_SELFREQDCO */ 1606 l = FLD_MOD(l, f, 3, 1); /* PLL_SELFREQDCO */
1607 } 1607 }
1608 1608
1609 l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */ 1609 l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */
@@ -2571,7 +2571,10 @@ static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel)
2571{ 2571{
2572 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 2572 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
2573 DECLARE_COMPLETION_ONSTACK(completion); 2573 DECLARE_COMPLETION_ONSTACK(completion);
2574 struct dsi_packet_sent_handler_data vp_data = { dsidev, &completion }; 2574 struct dsi_packet_sent_handler_data vp_data = {
2575 .dsidev = dsidev,
2576 .completion = &completion
2577 };
2575 int r = 0; 2578 int r = 0;
2576 u8 bit; 2579 u8 bit;
2577 2580
@@ -2617,7 +2620,10 @@ static void dsi_packet_sent_handler_l4(void *data, u32 mask)
2617static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel) 2620static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel)
2618{ 2621{
2619 DECLARE_COMPLETION_ONSTACK(completion); 2622 DECLARE_COMPLETION_ONSTACK(completion);
2620 struct dsi_packet_sent_handler_data l4_data = { dsidev, &completion }; 2623 struct dsi_packet_sent_handler_data l4_data = {
2624 .dsidev = dsidev,
2625 .completion = &completion
2626 };
2621 int r = 0; 2627 int r = 0;
2622 2628
2623 r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4, 2629 r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4,
@@ -5658,18 +5664,11 @@ err_runtime_get:
5658 return r; 5664 return r;
5659} 5665}
5660 5666
5661static int dsi_unregister_child(struct device *dev, void *data)
5662{
5663 struct platform_device *pdev = to_platform_device(dev);
5664 platform_device_unregister(pdev);
5665 return 0;
5666}
5667
5668static int __exit omap_dsihw_remove(struct platform_device *dsidev) 5667static int __exit omap_dsihw_remove(struct platform_device *dsidev)
5669{ 5668{
5670 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 5669 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
5671 5670
5672 device_for_each_child(&dsidev->dev, NULL, dsi_unregister_child); 5671 of_platform_depopulate(&dsidev->dev);
5673 5672
5674 WARN_ON(dsi->scp_clk_refcount > 0); 5673 WARN_ON(dsi->scp_clk_refcount > 0);
5675 5674
@@ -5755,6 +5754,7 @@ static struct platform_driver omap_dsihw_driver = {
5755 .owner = THIS_MODULE, 5754 .owner = THIS_MODULE,
5756 .pm = &dsi_pm_ops, 5755 .pm = &dsi_pm_ops,
5757 .of_match_table = dsi_of_match, 5756 .of_match_table = dsi_of_match,
5757 .suppress_bind_attrs = true,
5758 }, 5758 },
5759}; 5759};
5760 5760
diff --git a/drivers/video/fbdev/omap2/dss/dss.c b/drivers/video/fbdev/omap2/dss/dss.c
index 6daeb7ed44c6..14bcd6c43f72 100644
--- a/drivers/video/fbdev/omap2/dss/dss.c
+++ b/drivers/video/fbdev/omap2/dss/dss.c
@@ -966,6 +966,7 @@ static struct platform_driver omap_dsshw_driver = {
966 .owner = THIS_MODULE, 966 .owner = THIS_MODULE,
967 .pm = &dss_pm_ops, 967 .pm = &dss_pm_ops,
968 .of_match_table = dss_of_match, 968 .of_match_table = dss_of_match,
969 .suppress_bind_attrs = true,
969 }, 970 },
970}; 971};
971 972
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index fbee07816337..262771b9b76b 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -22,6 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/hdmi.h>
25#include <video/omapdss.h> 26#include <video/omapdss.h>
26 27
27#include "dss.h" 28#include "dss.h"
@@ -142,7 +143,7 @@ enum hdmi_audio_samples_perword {
142 HDMI_AUDIO_ONEWORD_TWOSAMPLES = 1 143 HDMI_AUDIO_ONEWORD_TWOSAMPLES = 1
143}; 144};
144 145
145enum hdmi_audio_sample_size { 146enum hdmi_audio_sample_size_omap {
146 HDMI_AUDIO_SAMPLE_16BITS = 0, 147 HDMI_AUDIO_SAMPLE_16BITS = 0,
147 HDMI_AUDIO_SAMPLE_24BITS = 1 148 HDMI_AUDIO_SAMPLE_24BITS = 1
148}; 149};
@@ -178,59 +179,6 @@ enum hdmi_audio_mclk_mode {
178 HDMI_AUDIO_MCLK_192FS = 7 179 HDMI_AUDIO_MCLK_192FS = 7
179}; 180};
180 181
181/* INFOFRAME_AVI_ and INFOFRAME_AUDIO_ definitions */
182enum hdmi_core_infoframe {
183 HDMI_INFOFRAME_AVI_DB1Y_RGB = 0,
184 HDMI_INFOFRAME_AVI_DB1Y_YUV422 = 1,
185 HDMI_INFOFRAME_AVI_DB1Y_YUV444 = 2,
186 HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF = 0,
187 HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_ON = 1,
188 HDMI_INFOFRAME_AVI_DB1B_NO = 0,
189 HDMI_INFOFRAME_AVI_DB1B_VERT = 1,
190 HDMI_INFOFRAME_AVI_DB1B_HORI = 2,
191 HDMI_INFOFRAME_AVI_DB1B_VERTHORI = 3,
192 HDMI_INFOFRAME_AVI_DB1S_0 = 0,
193 HDMI_INFOFRAME_AVI_DB1S_1 = 1,
194 HDMI_INFOFRAME_AVI_DB1S_2 = 2,
195 HDMI_INFOFRAME_AVI_DB2C_NO = 0,
196 HDMI_INFOFRAME_AVI_DB2C_ITU601 = 1,
197 HDMI_INFOFRAME_AVI_DB2C_ITU709 = 2,
198 HDMI_INFOFRAME_AVI_DB2C_EC_EXTENDED = 3,
199 HDMI_INFOFRAME_AVI_DB2M_NO = 0,
200 HDMI_INFOFRAME_AVI_DB2M_43 = 1,
201 HDMI_INFOFRAME_AVI_DB2M_169 = 2,
202 HDMI_INFOFRAME_AVI_DB2R_SAME = 8,
203 HDMI_INFOFRAME_AVI_DB2R_43 = 9,
204 HDMI_INFOFRAME_AVI_DB2R_169 = 10,
205 HDMI_INFOFRAME_AVI_DB2R_149 = 11,
206 HDMI_INFOFRAME_AVI_DB3ITC_NO = 0,
207 HDMI_INFOFRAME_AVI_DB3ITC_YES = 1,
208 HDMI_INFOFRAME_AVI_DB3EC_XVYUV601 = 0,
209 HDMI_INFOFRAME_AVI_DB3EC_XVYUV709 = 1,
210 HDMI_INFOFRAME_AVI_DB3Q_DEFAULT = 0,
211 HDMI_INFOFRAME_AVI_DB3Q_LR = 1,
212 HDMI_INFOFRAME_AVI_DB3Q_FR = 2,
213 HDMI_INFOFRAME_AVI_DB3SC_NO = 0,
214 HDMI_INFOFRAME_AVI_DB3SC_HORI = 1,
215 HDMI_INFOFRAME_AVI_DB3SC_VERT = 2,
216 HDMI_INFOFRAME_AVI_DB3SC_HORIVERT = 3,
217 HDMI_INFOFRAME_AVI_DB5PR_NO = 0,
218 HDMI_INFOFRAME_AVI_DB5PR_2 = 1,
219 HDMI_INFOFRAME_AVI_DB5PR_3 = 2,
220 HDMI_INFOFRAME_AVI_DB5PR_4 = 3,
221 HDMI_INFOFRAME_AVI_DB5PR_5 = 4,
222 HDMI_INFOFRAME_AVI_DB5PR_6 = 5,
223 HDMI_INFOFRAME_AVI_DB5PR_7 = 6,
224 HDMI_INFOFRAME_AVI_DB5PR_8 = 7,
225 HDMI_INFOFRAME_AVI_DB5PR_9 = 8,
226 HDMI_INFOFRAME_AVI_DB5PR_10 = 9,
227};
228
229struct hdmi_cm {
230 int code;
231 int mode;
232};
233
234struct hdmi_video_format { 182struct hdmi_video_format {
235 enum hdmi_packing_mode packing_mode; 183 enum hdmi_packing_mode packing_mode;
236 u32 y_res; /* Line per panel */ 184 u32 y_res; /* Line per panel */
@@ -239,7 +187,8 @@ struct hdmi_video_format {
239 187
240struct hdmi_config { 188struct hdmi_config {
241 struct omap_video_timings timings; 189 struct omap_video_timings timings;
242 struct hdmi_cm cm; 190 struct hdmi_avi_infoframe infoframe;
191 enum hdmi_core_hdmi_dvi hdmi_dvi_mode;
243}; 192};
244 193
245/* HDMI PLL structure */ 194/* HDMI PLL structure */
@@ -260,7 +209,7 @@ struct hdmi_audio_format {
260 enum hdmi_audio_justify justification; 209 enum hdmi_audio_justify justification;
261 enum hdmi_audio_sample_order sample_order; 210 enum hdmi_audio_sample_order sample_order;
262 enum hdmi_audio_samples_perword samples_per_word; 211 enum hdmi_audio_samples_perword samples_per_word;
263 enum hdmi_audio_sample_size sample_size; 212 enum hdmi_audio_sample_size_omap sample_size;
264 enum hdmi_audio_blk_strt_end_sig en_sig_blk_strt_end; 213 enum hdmi_audio_blk_strt_end_sig en_sig_blk_strt_end;
265}; 214};
266 215
@@ -298,47 +247,6 @@ struct hdmi_core_audio_config {
298 bool en_spdif; 247 bool en_spdif;
299}; 248};
300 249
301/*
302 * Refer to section 8.2 in HDMI 1.3 specification for
303 * details about infoframe databytes
304 */
305struct hdmi_core_infoframe_avi {
306 /* Y0, Y1 rgb,yCbCr */
307 u8 db1_format;
308 /* A0 Active information Present */
309 u8 db1_active_info;
310 /* B0, B1 Bar info data valid */
311 u8 db1_bar_info_dv;
312 /* S0, S1 scan information */
313 u8 db1_scan_info;
314 /* C0, C1 colorimetry */
315 u8 db2_colorimetry;
316 /* M0, M1 Aspect ratio (4:3, 16:9) */
317 u8 db2_aspect_ratio;
318 /* R0...R3 Active format aspect ratio */
319 u8 db2_active_fmt_ar;
320 /* ITC IT content. */
321 u8 db3_itc;
322 /* EC0, EC1, EC2 Extended colorimetry */
323 u8 db3_ec;
324 /* Q1, Q0 Quantization range */
325 u8 db3_q_range;
326 /* SC1, SC0 Non-uniform picture scaling */
327 u8 db3_nup_scaling;
328 /* VIC0..6 Video format identification */
329 u8 db4_videocode;
330 /* PR0..PR3 Pixel repetition factor */
331 u8 db5_pixel_repeat;
332 /* Line number end of top bar */
333 u16 db6_7_line_eoftop;
334 /* Line number start of bottom bar */
335 u16 db8_9_line_sofbottom;
336 /* Pixel number end of left bar */
337 u16 db10_11_pixel_eofleft;
338 /* Pixel number start of right bar */
339 u16 db12_13_pixel_sofright;
340};
341
342struct hdmi_wp_data { 250struct hdmi_wp_data {
343 void __iomem *base; 251 void __iomem *base;
344}; 252};
@@ -358,8 +266,6 @@ struct hdmi_phy_data {
358 266
359struct hdmi_core_data { 267struct hdmi_core_data {
360 void __iomem *base; 268 void __iomem *base;
361
362 struct hdmi_core_infoframe_avi avi_cfg;
363}; 269};
364 270
365static inline void hdmi_write_reg(void __iomem *base_addr, const u32 idx, 271static inline void hdmi_write_reg(void __iomem *base_addr, const u32 idx,
@@ -425,9 +331,6 @@ int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy);
425int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const u32 *lanes); 331int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const u32 *lanes);
426 332
427/* HDMI common funcs */ 333/* HDMI common funcs */
428const struct hdmi_config *hdmi_default_timing(void);
429const struct hdmi_config *hdmi_get_timings(int mode, int code);
430struct hdmi_cm hdmi_get_code(struct omap_video_timings *timing);
431int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep, 334int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
432 struct hdmi_phy_data *phy); 335 struct hdmi_phy_data *phy);
433 336
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 626aad2bef46..9a8713ca090c 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -281,29 +281,11 @@ static int hdmi_display_check_timing(struct omap_dss_device *dssdev,
281static void hdmi_display_set_timing(struct omap_dss_device *dssdev, 281static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
282 struct omap_video_timings *timings) 282 struct omap_video_timings *timings)
283{ 283{
284 struct hdmi_cm cm;
285 const struct hdmi_config *t;
286
287 mutex_lock(&hdmi.lock); 284 mutex_lock(&hdmi.lock);
288 285
289 cm = hdmi_get_code(timings); 286 hdmi.cfg.timings = *timings;
290 hdmi.cfg.cm = cm;
291
292 t = hdmi_get_timings(cm.mode, cm.code);
293 if (t != NULL) {
294 hdmi.cfg = *t;
295
296 dispc_set_tv_pclk(t->timings.pixelclock);
297 } else {
298 hdmi.cfg.timings = *timings;
299 hdmi.cfg.cm.code = 0;
300 hdmi.cfg.cm.mode = HDMI_DVI;
301
302 dispc_set_tv_pclk(timings->pixelclock);
303 }
304 287
305 DSSDBG("using mode: %s, code %d\n", hdmi.cfg.cm.mode == HDMI_DVI ? 288 dispc_set_tv_pclk(timings->pixelclock);
306 "DVI" : "HDMI", hdmi.cfg.cm.code);
307 289
308 mutex_unlock(&hdmi.lock); 290 mutex_unlock(&hdmi.lock);
309} 291}
@@ -311,14 +293,7 @@ static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
311static void hdmi_display_get_timings(struct omap_dss_device *dssdev, 293static void hdmi_display_get_timings(struct omap_dss_device *dssdev,
312 struct omap_video_timings *timings) 294 struct omap_video_timings *timings)
313{ 295{
314 const struct hdmi_config *cfg; 296 *timings = hdmi.cfg.timings;
315 struct hdmi_cm cm = hdmi.cfg.cm;
316
317 cfg = hdmi_get_timings(cm.mode, cm.code);
318 if (cfg == NULL)
319 cfg = hdmi_default_timing();
320
321 memcpy(timings, &cfg->timings, sizeof(cfg->timings));
322} 297}
323 298
324static void hdmi_dump_regs(struct seq_file *s) 299static void hdmi_dump_regs(struct seq_file *s)
@@ -516,7 +491,7 @@ static int hdmi_audio_enable(struct omap_dss_device *dssdev)
516 491
517 mutex_lock(&hdmi.lock); 492 mutex_lock(&hdmi.lock);
518 493
519 if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 494 if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
520 r = -EPERM; 495 r = -EPERM;
521 goto err; 496 goto err;
522 } 497 }
@@ -554,7 +529,7 @@ static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
554 529
555 mutex_lock(&hdmi.lock); 530 mutex_lock(&hdmi.lock);
556 531
557 r = hdmi_mode_has_audio(hdmi.cfg.cm.mode); 532 r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
558 533
559 mutex_unlock(&hdmi.lock); 534 mutex_unlock(&hdmi.lock);
560 return r; 535 return r;
@@ -568,7 +543,7 @@ static int hdmi_audio_config(struct omap_dss_device *dssdev,
568 543
569 mutex_lock(&hdmi.lock); 544 mutex_lock(&hdmi.lock);
570 545
571 if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 546 if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
572 r = -EPERM; 547 r = -EPERM;
573 goto err; 548 goto err;
574 } 549 }
@@ -615,6 +590,20 @@ static int hdmi_audio_config(struct omap_dss_device *dssdev,
615} 590}
616#endif 591#endif
617 592
593static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
594 const struct hdmi_avi_infoframe *avi)
595{
596 hdmi.cfg.infoframe = *avi;
597 return 0;
598}
599
600static int hdmi_set_hdmi_mode(struct omap_dss_device *dssdev,
601 bool hdmi_mode)
602{
603 hdmi.cfg.hdmi_dvi_mode = hdmi_mode ? HDMI_HDMI : HDMI_DVI;
604 return 0;
605}
606
618static const struct omapdss_hdmi_ops hdmi_ops = { 607static const struct omapdss_hdmi_ops hdmi_ops = {
619 .connect = hdmi_connect, 608 .connect = hdmi_connect,
620 .disconnect = hdmi_disconnect, 609 .disconnect = hdmi_disconnect,
@@ -627,6 +616,8 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
627 .get_timings = hdmi_display_get_timings, 616 .get_timings = hdmi_display_get_timings,
628 617
629 .read_edid = hdmi_read_edid, 618 .read_edid = hdmi_read_edid,
619 .set_infoframe = hdmi_set_infoframe,
620 .set_hdmi_mode = hdmi_set_hdmi_mode,
630 621
631 .audio_enable = hdmi_audio_enable, 622 .audio_enable = hdmi_audio_enable,
632 .audio_disable = hdmi_audio_disable, 623 .audio_disable = hdmi_audio_disable,
@@ -790,6 +781,7 @@ static struct platform_driver omapdss_hdmihw_driver = {
790 .owner = THIS_MODULE, 781 .owner = THIS_MODULE,
791 .pm = &hdmi_pm_ops, 782 .pm = &hdmi_pm_ops,
792 .of_match_table = hdmi_of_match, 783 .of_match_table = hdmi_of_match,
784 .suppress_bind_attrs = true,
793 }, 785 },
794}; 786};
795 787
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.c b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
index 8bde7b7e95ff..4ad39cfce254 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
@@ -197,9 +197,7 @@ int hdmi4_read_edid(struct hdmi_core_data *core, u8 *edid, int len)
197 return l; 197 return l;
198} 198}
199 199
200static void hdmi_core_init(struct hdmi_core_video_config *video_cfg, 200static void hdmi_core_init(struct hdmi_core_video_config *video_cfg)
201 struct hdmi_core_infoframe_avi *avi_cfg,
202 struct hdmi_core_packet_enable_repeat *repeat_cfg)
203{ 201{
204 DSSDBG("Enter hdmi_core_init\n"); 202 DSSDBG("Enter hdmi_core_init\n");
205 203
@@ -210,35 +208,6 @@ static void hdmi_core_init(struct hdmi_core_video_config *video_cfg,
210 video_cfg->pkt_mode = HDMI_PACKETMODERESERVEDVALUE; 208 video_cfg->pkt_mode = HDMI_PACKETMODERESERVEDVALUE;
211 video_cfg->hdmi_dvi = HDMI_DVI; 209 video_cfg->hdmi_dvi = HDMI_DVI;
212 video_cfg->tclk_sel_clkmult = HDMI_FPLL10IDCK; 210 video_cfg->tclk_sel_clkmult = HDMI_FPLL10IDCK;
213
214 /* info frame */
215 avi_cfg->db1_format = 0;
216 avi_cfg->db1_active_info = 0;
217 avi_cfg->db1_bar_info_dv = 0;
218 avi_cfg->db1_scan_info = 0;
219 avi_cfg->db2_colorimetry = 0;
220 avi_cfg->db2_aspect_ratio = 0;
221 avi_cfg->db2_active_fmt_ar = 0;
222 avi_cfg->db3_itc = 0;
223 avi_cfg->db3_ec = 0;
224 avi_cfg->db3_q_range = 0;
225 avi_cfg->db3_nup_scaling = 0;
226 avi_cfg->db4_videocode = 0;
227 avi_cfg->db5_pixel_repeat = 0;
228 avi_cfg->db6_7_line_eoftop = 0;
229 avi_cfg->db8_9_line_sofbottom = 0;
230 avi_cfg->db10_11_pixel_eofleft = 0;
231 avi_cfg->db12_13_pixel_sofright = 0;
232
233 /* packet enable and repeat */
234 repeat_cfg->audio_pkt = 0;
235 repeat_cfg->audio_pkt_repeat = 0;
236 repeat_cfg->avi_infoframe = 0;
237 repeat_cfg->avi_infoframe_repeat = 0;
238 repeat_cfg->gen_cntrl_pkt = 0;
239 repeat_cfg->gen_cntrl_pkt_repeat = 0;
240 repeat_cfg->generic_pkt = 0;
241 repeat_cfg->generic_pkt_repeat = 0;
242} 211}
243 212
244static void hdmi_core_powerdown_disable(struct hdmi_core_data *core) 213static void hdmi_core_powerdown_disable(struct hdmi_core_data *core)
@@ -303,80 +272,22 @@ static void hdmi_core_video_config(struct hdmi_core_data *core,
303 HDMI_CORE_SYS_TMDS_CTRL, cfg->tclk_sel_clkmult, 6, 5); 272 HDMI_CORE_SYS_TMDS_CTRL, cfg->tclk_sel_clkmult, 6, 5);
304} 273}
305 274
306static void hdmi_core_aux_infoframe_avi_config(struct hdmi_core_data *core) 275static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
276 struct hdmi_avi_infoframe *frame)
307{ 277{
308 u32 val;
309 char sum = 0, checksum = 0;
310 void __iomem *av_base = hdmi_av_base(core); 278 void __iomem *av_base = hdmi_av_base(core);
311 struct hdmi_core_infoframe_avi info_avi = core->avi_cfg; 279 u8 data[HDMI_INFOFRAME_SIZE(AVI)];
312 280 int i;
313 sum += 0x82 + 0x002 + 0x00D;
314 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
315 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_VERS, 0x002);
316 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_LEN, 0x00D);
317
318 val = (info_avi.db1_format << 5) |
319 (info_avi.db1_active_info << 4) |
320 (info_avi.db1_bar_info_dv << 2) |
321 (info_avi.db1_scan_info);
322 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(0), val);
323 sum += val;
324
325 val = (info_avi.db2_colorimetry << 6) |
326 (info_avi.db2_aspect_ratio << 4) |
327 (info_avi.db2_active_fmt_ar);
328 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(1), val);
329 sum += val;
330
331 val = (info_avi.db3_itc << 7) |
332 (info_avi.db3_ec << 4) |
333 (info_avi.db3_q_range << 2) |
334 (info_avi.db3_nup_scaling);
335 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(2), val);
336 sum += val;
337
338 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(3),
339 info_avi.db4_videocode);
340 sum += info_avi.db4_videocode;
341
342 val = info_avi.db5_pixel_repeat;
343 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(4), val);
344 sum += val;
345
346 val = info_avi.db6_7_line_eoftop & 0x00FF;
347 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(5), val);
348 sum += val;
349
350 val = ((info_avi.db6_7_line_eoftop >> 8) & 0x00FF);
351 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(6), val);
352 sum += val;
353
354 val = info_avi.db8_9_line_sofbottom & 0x00FF;
355 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(7), val);
356 sum += val;
357
358 val = ((info_avi.db8_9_line_sofbottom >> 8) & 0x00FF);
359 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(8), val);
360 sum += val;
361
362 val = info_avi.db10_11_pixel_eofleft & 0x00FF;
363 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(9), val);
364 sum += val;
365
366 val = ((info_avi.db10_11_pixel_eofleft >> 8) & 0x00FF);
367 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(10), val);
368 sum += val;
369
370 val = info_avi.db12_13_pixel_sofright & 0x00FF;
371 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(11), val);
372 sum += val;
373
374 val = ((info_avi.db12_13_pixel_sofright >> 8) & 0x00FF);
375 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(12), val);
376 sum += val;
377 281
378 checksum = 0x100 - sum; 282 hdmi_avi_infoframe_pack(frame, data, sizeof(data));
379 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum); 283
284 print_hex_dump_debug("AVI: ", DUMP_PREFIX_NONE, 16, 1, data,
285 HDMI_INFOFRAME_SIZE(AVI), false);
286
287 for (i = 0; i < sizeof(data); ++i) {
288 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_BASE + i * 4,
289 data[i]);
290 }
380} 291}
381 292
382static void hdmi_core_av_packet_config(struct hdmi_core_data *core, 293static void hdmi_core_av_packet_config(struct hdmi_core_data *core,
@@ -404,11 +315,10 @@ void hdmi4_configure(struct hdmi_core_data *core,
404 struct omap_video_timings video_timing; 315 struct omap_video_timings video_timing;
405 struct hdmi_video_format video_format; 316 struct hdmi_video_format video_format;
406 /* HDMI core */ 317 /* HDMI core */
407 struct hdmi_core_infoframe_avi *avi_cfg = &core->avi_cfg;
408 struct hdmi_core_video_config v_core_cfg; 318 struct hdmi_core_video_config v_core_cfg;
409 struct hdmi_core_packet_enable_repeat repeat_cfg; 319 struct hdmi_core_packet_enable_repeat repeat_cfg = { 0 };
410 320
411 hdmi_core_init(&v_core_cfg, avi_cfg, &repeat_cfg); 321 hdmi_core_init(&v_core_cfg);
412 322
413 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg); 323 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg);
414 324
@@ -431,44 +341,24 @@ void hdmi4_configure(struct hdmi_core_data *core,
431 hdmi_core_powerdown_disable(core); 341 hdmi_core_powerdown_disable(core);
432 342
433 v_core_cfg.pkt_mode = HDMI_PACKETMODE24BITPERPIXEL; 343 v_core_cfg.pkt_mode = HDMI_PACKETMODE24BITPERPIXEL;
434 v_core_cfg.hdmi_dvi = cfg->cm.mode; 344 v_core_cfg.hdmi_dvi = cfg->hdmi_dvi_mode;
435 345
436 hdmi_core_video_config(core, &v_core_cfg); 346 hdmi_core_video_config(core, &v_core_cfg);
437 347
438 /* release software reset in the core */ 348 /* release software reset in the core */
439 hdmi_core_swreset_release(core); 349 hdmi_core_swreset_release(core);
440 350
441 /* 351 if (cfg->hdmi_dvi_mode == HDMI_HDMI) {
442 * configure packet 352 hdmi_core_write_avi_infoframe(core, &cfg->infoframe);
443 * info frame video see doc CEA861-D page 65 353
444 */ 354 /* enable/repeat the infoframe */
445 avi_cfg->db1_format = HDMI_INFOFRAME_AVI_DB1Y_RGB; 355 repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
446 avi_cfg->db1_active_info = 356 repeat_cfg.avi_infoframe_repeat = HDMI_PACKETREPEATON;
447 HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF; 357 /* wakeup */
448 avi_cfg->db1_bar_info_dv = HDMI_INFOFRAME_AVI_DB1B_NO; 358 repeat_cfg.audio_pkt = HDMI_PACKETENABLE;
449 avi_cfg->db1_scan_info = HDMI_INFOFRAME_AVI_DB1S_0; 359 repeat_cfg.audio_pkt_repeat = HDMI_PACKETREPEATON;
450 avi_cfg->db2_colorimetry = HDMI_INFOFRAME_AVI_DB2C_NO; 360 }
451 avi_cfg->db2_aspect_ratio = HDMI_INFOFRAME_AVI_DB2M_NO;
452 avi_cfg->db2_active_fmt_ar = HDMI_INFOFRAME_AVI_DB2R_SAME;
453 avi_cfg->db3_itc = HDMI_INFOFRAME_AVI_DB3ITC_NO;
454 avi_cfg->db3_ec = HDMI_INFOFRAME_AVI_DB3EC_XVYUV601;
455 avi_cfg->db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_DEFAULT;
456 avi_cfg->db3_nup_scaling = HDMI_INFOFRAME_AVI_DB3SC_NO;
457 avi_cfg->db4_videocode = cfg->cm.code;
458 avi_cfg->db5_pixel_repeat = HDMI_INFOFRAME_AVI_DB5PR_NO;
459 avi_cfg->db6_7_line_eoftop = 0;
460 avi_cfg->db8_9_line_sofbottom = 0;
461 avi_cfg->db10_11_pixel_eofleft = 0;
462 avi_cfg->db12_13_pixel_sofright = 0;
463
464 hdmi_core_aux_infoframe_avi_config(core);
465 361
466 /* enable/repeat the infoframe */
467 repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
468 repeat_cfg.avi_infoframe_repeat = HDMI_PACKETREPEATON;
469 /* wakeup */
470 repeat_cfg.audio_pkt = HDMI_PACKETENABLE;
471 repeat_cfg.audio_pkt_repeat = HDMI_PACKETREPEATON;
472 hdmi_core_av_packet_config(core, repeat_cfg); 362 hdmi_core_av_packet_config(core, repeat_cfg);
473} 363}
474 364
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.h b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
index bb646896fa82..827909eb6c50 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
@@ -145,6 +145,7 @@
145#define HDMI_CORE_AV_DPD 0xF4 145#define HDMI_CORE_AV_DPD 0xF4
146#define HDMI_CORE_AV_PB_CTRL1 0xF8 146#define HDMI_CORE_AV_PB_CTRL1 0xF8
147#define HDMI_CORE_AV_PB_CTRL2 0xFC 147#define HDMI_CORE_AV_PB_CTRL2 0xFC
148#define HDMI_CORE_AV_AVI_BASE 0x100
148#define HDMI_CORE_AV_AVI_TYPE 0x100 149#define HDMI_CORE_AV_AVI_TYPE 0x100
149#define HDMI_CORE_AV_AVI_VERS 0x104 150#define HDMI_CORE_AV_AVI_VERS 0x104
150#define HDMI_CORE_AV_AVI_LEN 0x108 151#define HDMI_CORE_AV_AVI_LEN 0x108
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c
index c468b9e1f295..169b764bb9d4 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -299,29 +299,11 @@ static int hdmi_display_check_timing(struct omap_dss_device *dssdev,
299static void hdmi_display_set_timing(struct omap_dss_device *dssdev, 299static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
300 struct omap_video_timings *timings) 300 struct omap_video_timings *timings)
301{ 301{
302 struct hdmi_cm cm;
303 const struct hdmi_config *t;
304
305 mutex_lock(&hdmi.lock); 302 mutex_lock(&hdmi.lock);
306 303
307 cm = hdmi_get_code(timings); 304 hdmi.cfg.timings = *timings;
308 hdmi.cfg.cm = cm;
309
310 t = hdmi_get_timings(cm.mode, cm.code);
311 if (t != NULL) {
312 hdmi.cfg = *t;
313
314 dispc_set_tv_pclk(t->timings.pixelclock);
315 } else {
316 hdmi.cfg.timings = *timings;
317 hdmi.cfg.cm.code = 0;
318 hdmi.cfg.cm.mode = HDMI_DVI;
319
320 dispc_set_tv_pclk(timings->pixelclock);
321 }
322 305
323 DSSDBG("using mode: %s, code %d\n", hdmi.cfg.cm.mode == HDMI_DVI ? 306 dispc_set_tv_pclk(timings->pixelclock);
324 "DVI" : "HDMI", hdmi.cfg.cm.code);
325 307
326 mutex_unlock(&hdmi.lock); 308 mutex_unlock(&hdmi.lock);
327} 309}
@@ -329,14 +311,7 @@ static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
329static void hdmi_display_get_timings(struct omap_dss_device *dssdev, 311static void hdmi_display_get_timings(struct omap_dss_device *dssdev,
330 struct omap_video_timings *timings) 312 struct omap_video_timings *timings)
331{ 313{
332 const struct hdmi_config *cfg; 314 *timings = hdmi.cfg.timings;
333 struct hdmi_cm cm = hdmi.cfg.cm;
334
335 cfg = hdmi_get_timings(cm.mode, cm.code);
336 if (cfg == NULL)
337 cfg = hdmi_default_timing();
338
339 memcpy(timings, &cfg->timings, sizeof(cfg->timings));
340} 315}
341 316
342static void hdmi_dump_regs(struct seq_file *s) 317static void hdmi_dump_regs(struct seq_file *s)
@@ -541,7 +516,7 @@ static int hdmi_audio_enable(struct omap_dss_device *dssdev)
541 516
542 mutex_lock(&hdmi.lock); 517 mutex_lock(&hdmi.lock);
543 518
544 if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 519 if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
545 r = -EPERM; 520 r = -EPERM;
546 goto err; 521 goto err;
547 } 522 }
@@ -579,7 +554,7 @@ static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
579 554
580 mutex_lock(&hdmi.lock); 555 mutex_lock(&hdmi.lock);
581 556
582 r = hdmi_mode_has_audio(hdmi.cfg.cm.mode); 557 r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
583 558
584 mutex_unlock(&hdmi.lock); 559 mutex_unlock(&hdmi.lock);
585 return r; 560 return r;
@@ -593,7 +568,7 @@ static int hdmi_audio_config(struct omap_dss_device *dssdev,
593 568
594 mutex_lock(&hdmi.lock); 569 mutex_lock(&hdmi.lock);
595 570
596 if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 571 if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
597 r = -EPERM; 572 r = -EPERM;
598 goto err; 573 goto err;
599 } 574 }
@@ -640,6 +615,20 @@ static int hdmi_audio_config(struct omap_dss_device *dssdev,
640} 615}
641#endif 616#endif
642 617
618static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
619 const struct hdmi_avi_infoframe *avi)
620{
621 hdmi.cfg.infoframe = *avi;
622 return 0;
623}
624
625static int hdmi_set_hdmi_mode(struct omap_dss_device *dssdev,
626 bool hdmi_mode)
627{
628 hdmi.cfg.hdmi_dvi_mode = hdmi_mode ? HDMI_HDMI : HDMI_DVI;
629 return 0;
630}
631
643static const struct omapdss_hdmi_ops hdmi_ops = { 632static const struct omapdss_hdmi_ops hdmi_ops = {
644 .connect = hdmi_connect, 633 .connect = hdmi_connect,
645 .disconnect = hdmi_disconnect, 634 .disconnect = hdmi_disconnect,
@@ -652,6 +641,8 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
652 .get_timings = hdmi_display_get_timings, 641 .get_timings = hdmi_display_get_timings,
653 642
654 .read_edid = hdmi_read_edid, 643 .read_edid = hdmi_read_edid,
644 .set_infoframe = hdmi_set_infoframe,
645 .set_hdmi_mode = hdmi_set_hdmi_mode,
655 646
656 .audio_enable = hdmi_audio_enable, 647 .audio_enable = hdmi_audio_enable,
657 .audio_disable = hdmi_audio_disable, 648 .audio_disable = hdmi_audio_disable,
@@ -815,6 +806,7 @@ static struct platform_driver omapdss_hdmihw_driver = {
815 .owner = THIS_MODULE, 806 .owner = THIS_MODULE,
816 .pm = &hdmi_pm_ops, 807 .pm = &hdmi_pm_ops,
817 .of_match_table = hdmi_of_match, 808 .of_match_table = hdmi_of_match,
809 .suppress_bind_attrs = true,
818 }, 810 },
819}; 811};
820 812
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
index 7528c7a42aa5..83acbf7a8c89 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -290,7 +290,6 @@ void hdmi5_core_dump(struct hdmi_core_data *core, struct seq_file *s)
290} 290}
291 291
292static void hdmi_core_init(struct hdmi_core_vid_config *video_cfg, 292static void hdmi_core_init(struct hdmi_core_vid_config *video_cfg,
293 struct hdmi_core_infoframe_avi *avi_cfg,
294 struct hdmi_config *cfg) 293 struct hdmi_config *cfg)
295{ 294{
296 DSSDBG("hdmi_core_init\n"); 295 DSSDBG("hdmi_core_init\n");
@@ -312,27 +311,8 @@ static void hdmi_core_init(struct hdmi_core_vid_config *video_cfg,
312 video_cfg->vblank_osc = 0; /* Always 0 - need to confirm */ 311 video_cfg->vblank_osc = 0; /* Always 0 - need to confirm */
313 video_cfg->vblank = cfg->timings.vsw + 312 video_cfg->vblank = cfg->timings.vsw +
314 cfg->timings.vfp + cfg->timings.vbp; 313 cfg->timings.vfp + cfg->timings.vbp;
315 video_cfg->v_fc_config.cm.mode = cfg->cm.mode; 314 video_cfg->v_fc_config.hdmi_dvi_mode = cfg->hdmi_dvi_mode;
316 video_cfg->v_fc_config.timings.interlace = cfg->timings.interlace; 315 video_cfg->v_fc_config.timings.interlace = cfg->timings.interlace;
317
318 /* info frame */
319 avi_cfg->db1_format = 0;
320 avi_cfg->db1_active_info = 0;
321 avi_cfg->db1_bar_info_dv = 0;
322 avi_cfg->db1_scan_info = 0;
323 avi_cfg->db2_colorimetry = 0;
324 avi_cfg->db2_aspect_ratio = 0;
325 avi_cfg->db2_active_fmt_ar = 0;
326 avi_cfg->db3_itc = 0;
327 avi_cfg->db3_ec = 0;
328 avi_cfg->db3_q_range = 0;
329 avi_cfg->db3_nup_scaling = 0;
330 avi_cfg->db4_videocode = 0;
331 avi_cfg->db5_pixel_repeat = 0;
332 avi_cfg->db6_7_line_eoftop = 0;
333 avi_cfg->db8_9_line_sofbottom = 0;
334 avi_cfg->db10_11_pixel_eofleft = 0;
335 avi_cfg->db12_13_pixel_sofright = 0;
336} 316}
337 317
338/* DSS_HDMI_CORE_VIDEO_CONFIG */ 318/* DSS_HDMI_CORE_VIDEO_CONFIG */
@@ -398,7 +378,7 @@ static void hdmi_core_video_config(struct hdmi_core_data *core,
398 378
399 /* select DVI mode */ 379 /* select DVI mode */
400 REG_FLD_MOD(base, HDMI_CORE_FC_INVIDCONF, 380 REG_FLD_MOD(base, HDMI_CORE_FC_INVIDCONF,
401 cfg->v_fc_config.cm.mode, 3, 3); 381 cfg->v_fc_config.hdmi_dvi_mode, 3, 3);
402} 382}
403 383
404static void hdmi_core_config_video_packetizer(struct hdmi_core_data *core) 384static void hdmi_core_config_video_packetizer(struct hdmi_core_data *core)
@@ -438,24 +418,60 @@ static void hdmi_core_config_video_sampler(struct hdmi_core_data *core)
438 REG_FLD_MOD(core->base, HDMI_CORE_TX_INVID0, video_mapping, 4, 0); 418 REG_FLD_MOD(core->base, HDMI_CORE_TX_INVID0, video_mapping, 4, 0);
439} 419}
440 420
441static void hdmi_core_aux_infoframe_avi_config(struct hdmi_core_data *core) 421static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
422 struct hdmi_avi_infoframe *frame)
442{ 423{
443 void __iomem *base = core->base; 424 void __iomem *base = core->base;
444 struct hdmi_core_infoframe_avi avi = core->avi_cfg; 425 u8 data[HDMI_INFOFRAME_SIZE(AVI)];
445 426 u8 *ptr;
446 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF0, avi.db1_format, 1, 0); 427 unsigned y, a, b, s;
447 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF0, avi.db1_active_info, 6, 6); 428 unsigned c, m, r;
448 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF0, avi.db1_bar_info_dv, 3, 2); 429 unsigned itc, ec, q, sc;
449 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF0, avi.db1_scan_info, 5, 4); 430 unsigned vic;
450 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF1, avi.db2_colorimetry, 7, 6); 431 unsigned yq, cn, pr;
451 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF1, avi.db2_aspect_ratio, 5, 4); 432
452 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF1, avi.db2_active_fmt_ar, 3, 0); 433 hdmi_avi_infoframe_pack(frame, data, sizeof(data));
453 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF2, avi.db3_itc, 7, 7); 434
454 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF2, avi.db3_ec, 6, 4); 435 print_hex_dump_debug("AVI: ", DUMP_PREFIX_NONE, 16, 1, data,
455 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF2, avi.db3_q_range, 3, 2); 436 HDMI_INFOFRAME_SIZE(AVI), false);
456 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF2, avi.db3_nup_scaling, 1, 0); 437
457 REG_FLD_MOD(base, HDMI_CORE_FC_AVIVID, avi.db4_videocode, 6, 0); 438 ptr = data + HDMI_INFOFRAME_HEADER_SIZE;
458 REG_FLD_MOD(base, HDMI_CORE_FC_PRCONF, avi.db5_pixel_repeat, 3, 0); 439
440 y = (ptr[0] >> 5) & 0x3;
441 a = (ptr[0] >> 4) & 0x1;
442 b = (ptr[0] >> 2) & 0x3;
443 s = (ptr[0] >> 0) & 0x3;
444
445 c = (ptr[1] >> 6) & 0x3;
446 m = (ptr[1] >> 4) & 0x3;
447 r = (ptr[1] >> 0) & 0x3;
448
449 itc = (ptr[2] >> 7) & 0x1;
450 ec = (ptr[2] >> 4) & 0x7;
451 q = (ptr[2] >> 2) & 0x3;
452 sc = (ptr[2] >> 0) & 0x3;
453
454 vic = ptr[3];
455
456 yq = (ptr[4] >> 6) & 0x3;
457 cn = (ptr[4] >> 4) & 0x3;
458 pr = (ptr[4] >> 0) & 0xf;
459
460 hdmi_write_reg(base, HDMI_CORE_FC_AVICONF0,
461 (a << 6) | (s << 4) | (b << 2) | (y << 0));
462
463 hdmi_write_reg(base, HDMI_CORE_FC_AVICONF1,
464 (c << 6) | (m << 4) | (r << 0));
465
466 hdmi_write_reg(base, HDMI_CORE_FC_AVICONF2,
467 (itc << 7) | (ec << 4) | (q << 2) | (sc << 0));
468
469 hdmi_write_reg(base, HDMI_CORE_FC_AVIVID, vic);
470
471 hdmi_write_reg(base, HDMI_CORE_FC_AVICONF3,
472 (yq << 2) | (cn << 0));
473
474 REG_FLD_MOD(base, HDMI_CORE_FC_PRCONF, pr, 3, 0);
459} 475}
460 476
461static void hdmi_core_csc_config(struct hdmi_core_data *core, 477static void hdmi_core_csc_config(struct hdmi_core_data *core,
@@ -497,10 +513,8 @@ static void hdmi_core_configure_range(struct hdmi_core_data *core)
497 513
498 /* support limited range with 24 bit color depth for now */ 514 /* support limited range with 24 bit color depth for now */
499 csc_coeff = csc_table_deepcolor[0]; 515 csc_coeff = csc_table_deepcolor[0];
500 core->avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
501 516
502 hdmi_core_csc_config(core, csc_coeff); 517 hdmi_core_csc_config(core, csc_coeff);
503 hdmi_core_aux_infoframe_avi_config(core);
504} 518}
505 519
506static void hdmi_core_enable_video_path(struct hdmi_core_data *core) 520static void hdmi_core_enable_video_path(struct hdmi_core_data *core)
@@ -591,11 +605,10 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
591 struct omap_video_timings video_timing; 605 struct omap_video_timings video_timing;
592 struct hdmi_video_format video_format; 606 struct hdmi_video_format video_format;
593 struct hdmi_core_vid_config v_core_cfg; 607 struct hdmi_core_vid_config v_core_cfg;
594 struct hdmi_core_infoframe_avi *avi_cfg = &core->avi_cfg;
595 608
596 hdmi_core_mask_interrupts(core); 609 hdmi_core_mask_interrupts(core);
597 610
598 hdmi_core_init(&v_core_cfg, avi_cfg, cfg); 611 hdmi_core_init(&v_core_cfg, cfg);
599 612
600 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg); 613 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg);
601 614
@@ -608,7 +621,9 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
608 621
609 hdmi_wp_video_config_interface(wp, &video_timing); 622 hdmi_wp_video_config_interface(wp, &video_timing);
610 623
624 /* support limited range with 24 bit color depth for now */
611 hdmi_core_configure_range(core); 625 hdmi_core_configure_range(core);
626 cfg->infoframe.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED;
612 627
613 /* 628 /*
614 * configure core video part, set software reset in the core 629 * configure core video part, set software reset in the core
@@ -621,29 +636,8 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
621 hdmi_core_config_csc(core); 636 hdmi_core_config_csc(core);
622 hdmi_core_config_video_sampler(core); 637 hdmi_core_config_video_sampler(core);
623 638
624 /* 639 if (cfg->hdmi_dvi_mode == HDMI_HDMI)
625 * configure packet info frame video see doc CEA861-D page 65 640 hdmi_core_write_avi_infoframe(core, &cfg->infoframe);
626 */
627 avi_cfg->db1_format = HDMI_INFOFRAME_AVI_DB1Y_RGB;
628 avi_cfg->db1_active_info =
629 HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF;
630 avi_cfg->db1_bar_info_dv = HDMI_INFOFRAME_AVI_DB1B_NO;
631 avi_cfg->db1_scan_info = HDMI_INFOFRAME_AVI_DB1S_0;
632 avi_cfg->db2_colorimetry = HDMI_INFOFRAME_AVI_DB2C_NO;
633 avi_cfg->db2_aspect_ratio = HDMI_INFOFRAME_AVI_DB2M_NO;
634 avi_cfg->db2_active_fmt_ar = HDMI_INFOFRAME_AVI_DB2R_SAME;
635 avi_cfg->db3_itc = HDMI_INFOFRAME_AVI_DB3ITC_NO;
636 avi_cfg->db3_ec = HDMI_INFOFRAME_AVI_DB3EC_XVYUV601;
637 avi_cfg->db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_DEFAULT;
638 avi_cfg->db3_nup_scaling = HDMI_INFOFRAME_AVI_DB3SC_NO;
639 avi_cfg->db4_videocode = cfg->cm.code;
640 avi_cfg->db5_pixel_repeat = HDMI_INFOFRAME_AVI_DB5PR_NO;
641 avi_cfg->db6_7_line_eoftop = 0;
642 avi_cfg->db8_9_line_sofbottom = 0;
643 avi_cfg->db10_11_pixel_eofleft = 0;
644 avi_cfg->db12_13_pixel_sofright = 0;
645
646 hdmi_core_aux_infoframe_avi_config(core);
647 641
648 hdmi_core_enable_video_path(core); 642 hdmi_core_enable_video_path(core);
649 643
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_common.c b/drivers/video/fbdev/omap2/dss/hdmi_common.c
index 9a2c39cf297f..7d5f1039de9f 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_common.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_common.c
@@ -1,18 +1,4 @@
1 1
2/*
3 * Logic for the below structure :
4 * user enters the CEA or VESA timings by specifying the HDMI/DVI code.
5 * There is a correspondence between CEA/VESA timing and code, please
6 * refer to section 6.3 in HDMI 1.3 specification for timing code.
7 *
8 * In the below structure, cea_vesa_timings corresponds to all OMAP4
9 * supported CEA and VESA timing values.code_cea corresponds to the CEA
10 * code, It is used to get the timing from cea_vesa_timing array.Similarly
11 * with code_vesa. Code_index is used for back mapping, that is once EDID
12 * is read from the TV, EDID is parsed to find the timing values and then
13 * map it to corresponding CEA or VESA index.
14 */
15
16#define DSS_SUBSYS_NAME "HDMI" 2#define DSS_SUBSYS_NAME "HDMI"
17 3
18#include <linux/kernel.h> 4#include <linux/kernel.h>
@@ -22,308 +8,6 @@
22 8
23#include "hdmi.h" 9#include "hdmi.h"
24 10
25static const struct hdmi_config cea_timings[] = {
26 {
27 { 640, 480, 25200000, 96, 16, 48, 2, 10, 33,
28 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
29 false, },
30 { 1, HDMI_HDMI },
31 },
32 {
33 { 720, 480, 27027000, 62, 16, 60, 6, 9, 30,
34 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
35 false, },
36 { 2, HDMI_HDMI },
37 },
38 {
39 { 1280, 720, 74250000, 40, 110, 220, 5, 5, 20,
40 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
41 false, },
42 { 4, HDMI_HDMI },
43 },
44 {
45 { 1920, 540, 74250000, 44, 88, 148, 5, 2, 15,
46 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
47 true, },
48 { 5, HDMI_HDMI },
49 },
50 {
51 { 1440, 240, 27027000, 124, 38, 114, 3, 4, 15,
52 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
53 true, },
54 { 6, HDMI_HDMI },
55 },
56 {
57 { 1920, 1080, 148500000, 44, 88, 148, 5, 4, 36,
58 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
59 false, },
60 { 16, HDMI_HDMI },
61 },
62 {
63 { 720, 576, 27000000, 64, 12, 68, 5, 5, 39,
64 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
65 false, },
66 { 17, HDMI_HDMI },
67 },
68 {
69 { 1280, 720, 74250000, 40, 440, 220, 5, 5, 20,
70 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
71 false, },
72 { 19, HDMI_HDMI },
73 },
74 {
75 { 1920, 540, 74250000, 44, 528, 148, 5, 2, 15,
76 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
77 true, },
78 { 20, HDMI_HDMI },
79 },
80 {
81 { 1440, 288, 27000000, 126, 24, 138, 3, 2, 19,
82 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
83 true, },
84 { 21, HDMI_HDMI },
85 },
86 {
87 { 1440, 576, 54000000, 128, 24, 136, 5, 5, 39,
88 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
89 false, },
90 { 29, HDMI_HDMI },
91 },
92 {
93 { 1920, 1080, 148500000, 44, 528, 148, 5, 4, 36,
94 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
95 false, },
96 { 31, HDMI_HDMI },
97 },
98 {
99 { 1920, 1080, 74250000, 44, 638, 148, 5, 4, 36,
100 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
101 false, },
102 { 32, HDMI_HDMI },
103 },
104 {
105 { 2880, 480, 108108000, 248, 64, 240, 6, 9, 30,
106 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
107 false, },
108 { 35, HDMI_HDMI },
109 },
110 {
111 { 2880, 576, 108000000, 256, 48, 272, 5, 5, 39,
112 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
113 false, },
114 { 37, HDMI_HDMI },
115 },
116};
117
118static const struct hdmi_config vesa_timings[] = {
119/* VESA From Here */
120 {
121 { 640, 480, 25175000, 96, 16, 48, 2, 11, 31,
122 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
123 false, },
124 { 4, HDMI_DVI },
125 },
126 {
127 { 800, 600, 40000000, 128, 40, 88, 4, 1, 23,
128 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
129 false, },
130 { 9, HDMI_DVI },
131 },
132 {
133 { 848, 480, 33750000, 112, 16, 112, 8, 6, 23,
134 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
135 false, },
136 { 0xE, HDMI_DVI },
137 },
138 {
139 { 1280, 768, 79500000, 128, 64, 192, 7, 3, 20,
140 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
141 false, },
142 { 0x17, HDMI_DVI },
143 },
144 {
145 { 1280, 800, 83500000, 128, 72, 200, 6, 3, 22,
146 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
147 false, },
148 { 0x1C, HDMI_DVI },
149 },
150 {
151 { 1360, 768, 85500000, 112, 64, 256, 6, 3, 18,
152 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
153 false, },
154 { 0x27, HDMI_DVI },
155 },
156 {
157 { 1280, 960, 108000000, 112, 96, 312, 3, 1, 36,
158 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
159 false, },
160 { 0x20, HDMI_DVI },
161 },
162 {
163 { 1280, 1024, 108000000, 112, 48, 248, 3, 1, 38,
164 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
165 false, },
166 { 0x23, HDMI_DVI },
167 },
168 {
169 { 1024, 768, 65000000, 136, 24, 160, 6, 3, 29,
170 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
171 false, },
172 { 0x10, HDMI_DVI },
173 },
174 {
175 { 1400, 1050, 121750000, 144, 88, 232, 4, 3, 32,
176 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
177 false, },
178 { 0x2A, HDMI_DVI },
179 },
180 {
181 { 1440, 900, 106500000, 152, 80, 232, 6, 3, 25,
182 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
183 false, },
184 { 0x2F, HDMI_DVI },
185 },
186 {
187 { 1680, 1050, 146250000, 176 , 104, 280, 6, 3, 30,
188 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
189 false, },
190 { 0x3A, HDMI_DVI },
191 },
192 {
193 { 1366, 768, 85500000, 143, 70, 213, 3, 3, 24,
194 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
195 false, },
196 { 0x51, HDMI_DVI },
197 },
198 {
199 { 1920, 1080, 148500000, 44, 148, 80, 5, 4, 36,
200 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
201 false, },
202 { 0x52, HDMI_DVI },
203 },
204 {
205 { 1280, 768, 68250000, 32, 48, 80, 7, 3, 12,
206 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
207 false, },
208 { 0x16, HDMI_DVI },
209 },
210 {
211 { 1400, 1050, 101000000, 32, 48, 80, 4, 3, 23,
212 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
213 false, },
214 { 0x29, HDMI_DVI },
215 },
216 {
217 { 1680, 1050, 119000000, 32, 48, 80, 6, 3, 21,
218 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
219 false, },
220 { 0x39, HDMI_DVI },
221 },
222 {
223 { 1280, 800, 79500000, 32, 48, 80, 6, 3, 14,
224 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
225 false, },
226 { 0x1B, HDMI_DVI },
227 },
228 {
229 { 1280, 720, 74250000, 40, 110, 220, 5, 5, 20,
230 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
231 false, },
232 { 0x55, HDMI_DVI },
233 },
234 {
235 { 1920, 1200, 154000000, 32, 48, 80, 6, 3, 26,
236 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
237 false, },
238 { 0x44, HDMI_DVI },
239 },
240};
241
242const struct hdmi_config *hdmi_default_timing(void)
243{
244 return &vesa_timings[0];
245}
246
247static const struct hdmi_config *hdmi_find_timing(int code,
248 const struct hdmi_config *timings_arr, int len)
249{
250 int i;
251
252 for (i = 0; i < len; i++) {
253 if (timings_arr[i].cm.code == code)
254 return &timings_arr[i];
255 }
256
257 return NULL;
258}
259
260const struct hdmi_config *hdmi_get_timings(int mode, int code)
261{
262 const struct hdmi_config *arr;
263 int len;
264
265 if (mode == HDMI_DVI) {
266 arr = vesa_timings;
267 len = ARRAY_SIZE(vesa_timings);
268 } else {
269 arr = cea_timings;
270 len = ARRAY_SIZE(cea_timings);
271 }
272
273 return hdmi_find_timing(code, arr, len);
274}
275
276static bool hdmi_timings_compare(struct omap_video_timings *timing1,
277 const struct omap_video_timings *timing2)
278{
279 int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync;
280
281 if ((DIV_ROUND_CLOSEST(timing2->pixelclock, 1000000) ==
282 DIV_ROUND_CLOSEST(timing1->pixelclock, 1000000)) &&
283 (timing2->x_res == timing1->x_res) &&
284 (timing2->y_res == timing1->y_res)) {
285
286 timing2_hsync = timing2->hfp + timing2->hsw + timing2->hbp;
287 timing1_hsync = timing1->hfp + timing1->hsw + timing1->hbp;
288 timing2_vsync = timing2->vfp + timing2->vsw + timing2->vbp;
289 timing1_vsync = timing1->vfp + timing1->vsw + timing1->vbp;
290
291 DSSDBG("timing1_hsync = %d timing1_vsync = %d"\
292 "timing2_hsync = %d timing2_vsync = %d\n",
293 timing1_hsync, timing1_vsync,
294 timing2_hsync, timing2_vsync);
295
296 if ((timing1_hsync == timing2_hsync) &&
297 (timing1_vsync == timing2_vsync)) {
298 return true;
299 }
300 }
301 return false;
302}
303
304struct hdmi_cm hdmi_get_code(struct omap_video_timings *timing)
305{
306 int i;
307 struct hdmi_cm cm = {-1};
308 DSSDBG("hdmi_get_code\n");
309
310 for (i = 0; i < ARRAY_SIZE(cea_timings); i++) {
311 if (hdmi_timings_compare(timing, &cea_timings[i].timings)) {
312 cm = cea_timings[i].cm;
313 goto end;
314 }
315 }
316 for (i = 0; i < ARRAY_SIZE(vesa_timings); i++) {
317 if (hdmi_timings_compare(timing, &vesa_timings[i].timings)) {
318 cm = vesa_timings[i].cm;
319 goto end;
320 }
321 }
322
323end:
324 return cm;
325}
326
327int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep, 11int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
328 struct hdmi_phy_data *phy) 12 struct hdmi_phy_data *phy)
329{ 13{
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index 54df12a8d744..6d92bb32fe51 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -124,16 +124,15 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll)
124 r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */ 124 r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */
125 r = FLD_MOD(r, fmt->refsel, 22, 21); /* REFSEL */ 125 r = FLD_MOD(r, fmt->refsel, 22, 21); /* REFSEL */
126 126
127 if (fmt->dcofreq) { 127 if (fmt->dcofreq)
128 /* divider programming for frequency beyond 1000Mhz */
129 REG_FLD_MOD(pll->base, PLLCTRL_CFG3, fmt->regsd, 17, 10);
130 r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */ 128 r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */
131 } else { 129 else
132 r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */ 130 r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */
133 }
134 131
135 hdmi_write_reg(pll->base, PLLCTRL_CFG2, r); 132 hdmi_write_reg(pll->base, PLLCTRL_CFG2, r);
136 133
134 REG_FLD_MOD(pll->base, PLLCTRL_CFG3, fmt->regsd, 17, 10);
135
137 r = hdmi_read_reg(pll->base, PLLCTRL_CFG4); 136 r = hdmi_read_reg(pll->base, PLLCTRL_CFG4);
138 r = FLD_MOD(r, fmt->regm2, 24, 18); 137 r = FLD_MOD(r, fmt->regm2, 24, 18);
139 r = FLD_MOD(r, fmt->regmf, 17, 0); 138 r = FLD_MOD(r, fmt->regmf, 17, 0);
@@ -144,8 +143,8 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll)
144 143
145 /* wait for bit change */ 144 /* wait for bit change */
146 if (hdmi_wait_for_bit_change(pll->base, PLLCTRL_PLL_GO, 145 if (hdmi_wait_for_bit_change(pll->base, PLLCTRL_PLL_GO,
147 0, 0, 1) != 1) { 146 0, 0, 0) != 0) {
148 DSSERR("PLL GO bit not set\n"); 147 DSSERR("PLL GO bit not clearing\n");
149 return -ETIMEDOUT; 148 return -ETIMEDOUT;
150 } 149 }
151 150
diff --git a/drivers/video/fbdev/omap2/dss/manager-sysfs.c b/drivers/video/fbdev/omap2/dss/manager-sysfs.c
index 37b59fe28dc8..a7414fb12830 100644
--- a/drivers/video/fbdev/omap2/dss/manager-sysfs.c
+++ b/drivers/video/fbdev/omap2/dss/manager-sysfs.c
@@ -44,6 +44,13 @@ static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf)
44 dssdev->name : "<none>"); 44 dssdev->name : "<none>");
45} 45}
46 46
47static int manager_display_match(struct omap_dss_device *dssdev, void *data)
48{
49 const char *str = data;
50
51 return sysfs_streq(dssdev->name, str);
52}
53
47static ssize_t manager_display_store(struct omap_overlay_manager *mgr, 54static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
48 const char *buf, size_t size) 55 const char *buf, size_t size)
49{ 56{
@@ -52,17 +59,12 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
52 struct omap_dss_device *dssdev = NULL; 59 struct omap_dss_device *dssdev = NULL;
53 struct omap_dss_device *old_dssdev; 60 struct omap_dss_device *old_dssdev;
54 61
55 int match(struct omap_dss_device *dssdev, void *data)
56 {
57 const char *str = data;
58 return sysfs_streq(dssdev->name, str);
59 }
60
61 if (buf[size-1] == '\n') 62 if (buf[size-1] == '\n')
62 --len; 63 --len;
63 64
64 if (len > 0) 65 if (len > 0)
65 dssdev = omap_dss_find_device((void *)buf, match); 66 dssdev = omap_dss_find_device((void *)buf,
67 manager_display_match);
66 68
67 if (len > 0 && dssdev == NULL) 69 if (len > 0 && dssdev == NULL)
68 return -EINVAL; 70 return -EINVAL;
diff --git a/drivers/video/fbdev/omap2/dss/rfbi.c b/drivers/video/fbdev/omap2/dss/rfbi.c
index c8a81a2b879c..878273f58839 100644
--- a/drivers/video/fbdev/omap2/dss/rfbi.c
+++ b/drivers/video/fbdev/omap2/dss/rfbi.c
@@ -1044,6 +1044,7 @@ static struct platform_driver omap_rfbihw_driver = {
1044 .name = "omapdss_rfbi", 1044 .name = "omapdss_rfbi",
1045 .owner = THIS_MODULE, 1045 .owner = THIS_MODULE,
1046 .pm = &rfbi_pm_ops, 1046 .pm = &rfbi_pm_ops,
1047 .suppress_bind_attrs = true,
1047 }, 1048 },
1048}; 1049};
1049 1050
diff --git a/drivers/video/fbdev/omap2/dss/sdi.c b/drivers/video/fbdev/omap2/dss/sdi.c
index 911dcc9173a6..4c9c46d4ea60 100644
--- a/drivers/video/fbdev/omap2/dss/sdi.c
+++ b/drivers/video/fbdev/omap2/dss/sdi.c
@@ -377,6 +377,7 @@ static struct platform_driver omap_sdi_driver = {
377 .driver = { 377 .driver = {
378 .name = "omapdss_sdi", 378 .name = "omapdss_sdi",
379 .owner = THIS_MODULE, 379 .owner = THIS_MODULE,
380 .suppress_bind_attrs = true,
380 }, 381 },
381}; 382};
382 383
diff --git a/drivers/video/fbdev/omap2/dss/venc.c b/drivers/video/fbdev/omap2/dss/venc.c
index 21d81113962b..d077d8a75ddc 100644
--- a/drivers/video/fbdev/omap2/dss/venc.c
+++ b/drivers/video/fbdev/omap2/dss/venc.c
@@ -966,6 +966,7 @@ static struct platform_driver omap_venchw_driver = {
966 .owner = THIS_MODULE, 966 .owner = THIS_MODULE,
967 .pm = &venc_pm_ops, 967 .pm = &venc_pm_ops,
968 .of_match_table = venc_of_match, 968 .of_match_table = venc_of_match,
969 .suppress_bind_attrs = true,
969 }, 970 },
970}; 971};
971 972
diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
index ec2d132c782d..ce8a70570756 100644
--- a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
@@ -273,16 +273,16 @@ static struct omapfb_colormode omapfb_colormodes[] = {
273 }, 273 },
274}; 274};
275 275
276static bool cmp_component(struct fb_bitfield *f1, struct fb_bitfield *f2)
277{
278 return f1->length == f2->length &&
279 f1->offset == f2->offset &&
280 f1->msb_right == f2->msb_right;
281}
282
276static bool cmp_var_to_colormode(struct fb_var_screeninfo *var, 283static bool cmp_var_to_colormode(struct fb_var_screeninfo *var,
277 struct omapfb_colormode *color) 284 struct omapfb_colormode *color)
278{ 285{
279 bool cmp_component(struct fb_bitfield *f1, struct fb_bitfield *f2)
280 {
281 return f1->length == f2->length &&
282 f1->offset == f2->offset &&
283 f1->msb_right == f2->msb_right;
284 }
285
286 if (var->bits_per_pixel == 0 || 286 if (var->bits_per_pixel == 0 ||
287 var->red.length == 0 || 287 var->red.length == 0 ||
288 var->blue.length == 0 || 288 var->blue.length == 0 ||
@@ -1833,14 +1833,13 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev)
1833 if (fbdev == NULL) 1833 if (fbdev == NULL)
1834 return; 1834 return;
1835 1835
1836 for (i = 0; i < fbdev->num_fbs; i++) { 1836 for (i = 0; i < fbdev->num_overlays; i++) {
1837 struct omapfb_info *ofbi = FB2OFB(fbdev->fbs[i]); 1837 struct omap_overlay *ovl = fbdev->overlays[i];
1838 int j;
1839 1838
1840 for (j = 0; j < ofbi->num_overlays; j++) { 1839 ovl->disable(ovl);
1841 struct omap_overlay *ovl = ofbi->overlays[j]; 1840
1842 ovl->disable(ovl); 1841 if (ovl->manager)
1843 } 1842 ovl->unset_manager(ovl);
1844 } 1843 }
1845 1844
1846 for (i = 0; i < fbdev->num_fbs; i++) 1845 for (i = 0; i < fbdev->num_fbs; i++)
@@ -2619,7 +2618,7 @@ err0:
2619 return r; 2618 return r;
2620} 2619}
2621 2620
2622static int __exit omapfb_remove(struct platform_device *pdev) 2621static int omapfb_remove(struct platform_device *pdev)
2623{ 2622{
2624 struct omapfb2_device *fbdev = platform_get_drvdata(pdev); 2623 struct omapfb2_device *fbdev = platform_get_drvdata(pdev);
2625 2624
@@ -2636,7 +2635,7 @@ static int __exit omapfb_remove(struct platform_device *pdev)
2636 2635
2637static struct platform_driver omapfb_driver = { 2636static struct platform_driver omapfb_driver = {
2638 .probe = omapfb_probe, 2637 .probe = omapfb_probe,
2639 .remove = __exit_p(omapfb_remove), 2638 .remove = omapfb_remove,
2640 .driver = { 2639 .driver = {
2641 .name = "omapfb", 2640 .name = "omapfb",
2642 .owner = THIS_MODULE, 2641 .owner = THIS_MODULE,
@@ -2651,6 +2650,7 @@ module_param_named(mirror, def_mirror, bool, 0);
2651 2650
2652module_platform_driver(omapfb_driver); 2651module_platform_driver(omapfb_driver);
2653 2652
2653MODULE_ALIAS("platform:omapfb");
2654MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>"); 2654MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>");
2655MODULE_DESCRIPTION("OMAP2/3 Framebuffer"); 2655MODULE_DESCRIPTION("OMAP2/3 Framebuffer");
2656MODULE_LICENSE("GPL v2"); 2656MODULE_LICENSE("GPL v2");
diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c
index 167cffff3d4e..7c74f58fc101 100644
--- a/drivers/video/fbdev/pvr2fb.c
+++ b/drivers/video/fbdev/pvr2fb.c
@@ -1001,7 +1001,7 @@ static int pvr2_get_param(const struct pvr2_params *p, const char *s, int val,
1001 1001
1002 for (i = 0 ; i < size ; i++ ) { 1002 for (i = 0 ; i < size ; i++ ) {
1003 if (s != NULL) { 1003 if (s != NULL) {
1004 if (!strnicmp(p[i].name, s, strlen(s))) 1004 if (!strncasecmp(p[i].name, s, strlen(s)))
1005 return p[i].val; 1005 return p[i].val;
1006 } else { 1006 } else {
1007 if (p[i].val == val) 1007 if (p[i].val == val)
diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 1ecd9cec2921..a5acca88fa63 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -138,7 +138,7 @@ static int
138pxafb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue, 138pxafb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
139 u_int trans, struct fb_info *info) 139 u_int trans, struct fb_info *info)
140{ 140{
141 struct pxafb_info *fbi = (struct pxafb_info *)info; 141 struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb);
142 u_int val; 142 u_int val;
143 143
144 if (regno >= fbi->palette_size) 144 if (regno >= fbi->palette_size)
@@ -183,7 +183,7 @@ static int
183pxafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 183pxafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
184 u_int trans, struct fb_info *info) 184 u_int trans, struct fb_info *info)
185{ 185{
186 struct pxafb_info *fbi = (struct pxafb_info *)info; 186 struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb);
187 unsigned int val; 187 unsigned int val;
188 int ret = 1; 188 int ret = 1;
189 189
@@ -456,7 +456,7 @@ static int pxafb_adjust_timing(struct pxafb_info *fbi,
456 */ 456 */
457static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 457static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
458{ 458{
459 struct pxafb_info *fbi = (struct pxafb_info *)info; 459 struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb);
460 struct pxafb_mach_info *inf = dev_get_platdata(fbi->dev); 460 struct pxafb_mach_info *inf = dev_get_platdata(fbi->dev);
461 int err; 461 int err;
462 462
@@ -494,7 +494,7 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
494 */ 494 */
495static int pxafb_set_par(struct fb_info *info) 495static int pxafb_set_par(struct fb_info *info)
496{ 496{
497 struct pxafb_info *fbi = (struct pxafb_info *)info; 497 struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb);
498 struct fb_var_screeninfo *var = &info->var; 498 struct fb_var_screeninfo *var = &info->var;
499 499
500 if (var->bits_per_pixel >= 16) 500 if (var->bits_per_pixel >= 16)
@@ -533,7 +533,7 @@ static int pxafb_set_par(struct fb_info *info)
533static int pxafb_pan_display(struct fb_var_screeninfo *var, 533static int pxafb_pan_display(struct fb_var_screeninfo *var,
534 struct fb_info *info) 534 struct fb_info *info)
535{ 535{
536 struct pxafb_info *fbi = (struct pxafb_info *)info; 536 struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb);
537 struct fb_var_screeninfo newvar; 537 struct fb_var_screeninfo newvar;
538 int dma = DMA_MAX + DMA_BASE; 538 int dma = DMA_MAX + DMA_BASE;
539 539
@@ -566,7 +566,7 @@ static int pxafb_pan_display(struct fb_var_screeninfo *var,
566 */ 566 */
567static int pxafb_blank(int blank, struct fb_info *info) 567static int pxafb_blank(int blank, struct fb_info *info)
568{ 568{
569 struct pxafb_info *fbi = (struct pxafb_info *)info; 569 struct pxafb_info *fbi = container_of(info, struct pxafb_info, fb);
570 int i; 570 int i;
571 571
572 switch (blank) { 572 switch (blank) {
@@ -725,7 +725,7 @@ static struct pxafb_layer_ops ofb_ops[] = {
725 725
726static int overlayfb_open(struct fb_info *info, int user) 726static int overlayfb_open(struct fb_info *info, int user)
727{ 727{
728 struct pxafb_layer *ofb = (struct pxafb_layer *)info; 728 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
729 729
730 /* no support for framebuffer console on overlay */ 730 /* no support for framebuffer console on overlay */
731 if (user == 0) 731 if (user == 0)
@@ -743,7 +743,7 @@ static int overlayfb_open(struct fb_info *info, int user)
743 743
744static int overlayfb_release(struct fb_info *info, int user) 744static int overlayfb_release(struct fb_info *info, int user)
745{ 745{
746 struct pxafb_layer *ofb = (struct pxafb_layer*) info; 746 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
747 747
748 if (ofb->usage == 1) { 748 if (ofb->usage == 1) {
749 ofb->ops->disable(ofb); 749 ofb->ops->disable(ofb);
@@ -760,7 +760,7 @@ static int overlayfb_release(struct fb_info *info, int user)
760static int overlayfb_check_var(struct fb_var_screeninfo *var, 760static int overlayfb_check_var(struct fb_var_screeninfo *var,
761 struct fb_info *info) 761 struct fb_info *info)
762{ 762{
763 struct pxafb_layer *ofb = (struct pxafb_layer *)info; 763 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
764 struct fb_var_screeninfo *base_var = &ofb->fbi->fb.var; 764 struct fb_var_screeninfo *base_var = &ofb->fbi->fb.var;
765 int xpos, ypos, pfor, bpp; 765 int xpos, ypos, pfor, bpp;
766 766
@@ -836,7 +836,7 @@ static int overlayfb_check_video_memory(struct pxafb_layer *ofb)
836 836
837static int overlayfb_set_par(struct fb_info *info) 837static int overlayfb_set_par(struct fb_info *info)
838{ 838{
839 struct pxafb_layer *ofb = (struct pxafb_layer *)info; 839 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
840 struct fb_var_screeninfo *var = &info->var; 840 struct fb_var_screeninfo *var = &info->var;
841 int xpos, ypos, pfor, bpp, ret; 841 int xpos, ypos, pfor, bpp, ret;
842 842
diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c
index 8a8d7f060784..be73727c7227 100644
--- a/drivers/video/fbdev/riva/fbdev.c
+++ b/drivers/video/fbdev/riva/fbdev.c
@@ -326,13 +326,7 @@ static int riva_bl_update_status(struct backlight_device *bd)
326 return 0; 326 return 0;
327} 327}
328 328
329static int riva_bl_get_brightness(struct backlight_device *bd)
330{
331 return bd->props.brightness;
332}
333
334static const struct backlight_ops riva_bl_ops = { 329static const struct backlight_ops riva_bl_ops = {
335 .get_brightness = riva_bl_get_brightness,
336 .update_status = riva_bl_update_status, 330 .update_status = riva_bl_update_status,
337}; 331};
338 332
diff --git a/drivers/video/fbdev/riva/riva_hw.c b/drivers/video/fbdev/riva/riva_hw.c
index 78fdbf5178d7..8bdf37f3013b 100644
--- a/drivers/video/fbdev/riva/riva_hw.c
+++ b/drivers/video/fbdev/riva/riva_hw.c
@@ -430,7 +430,6 @@ static char nv3_arb(nv3_fifo_info * res_info, nv3_sim_state * state, nv3_arb_in
430 int mmisses, gmisses, vmisses, eburst_size, mburst_size; 430 int mmisses, gmisses, vmisses, eburst_size, mburst_size;
431 int refresh_cycle; 431 int refresh_cycle;
432 432
433 refresh_cycle = 0;
434 refresh_cycle = 2*(state->mclk_khz/state->pclk_khz) + 5; 433 refresh_cycle = 2*(state->mclk_khz/state->pclk_khz) + 5;
435 mmisses = 2; 434 mmisses = 2;
436 if (state->mem_aligned) gmisses = 2; 435 if (state->mem_aligned) gmisses = 2;
diff --git a/drivers/video/fbdev/s3c-fb.c b/drivers/video/fbdev/s3c-fb.c
index 62acae2694a9..b33abb0a433d 100644
--- a/drivers/video/fbdev/s3c-fb.c
+++ b/drivers/video/fbdev/s3c-fb.c
@@ -1805,38 +1805,6 @@ static struct s3c_fb_driverdata s3c_fb_data_64xx = {
1805 .win[4] = &s3c_fb_data_64xx_wins[4], 1805 .win[4] = &s3c_fb_data_64xx_wins[4],
1806}; 1806};
1807 1807
1808static struct s3c_fb_driverdata s3c_fb_data_s5pc100 = {
1809 .variant = {
1810 .nr_windows = 5,
1811 .vidtcon = VIDTCON0,
1812 .wincon = WINCON(0),
1813 .winmap = WINxMAP(0),
1814 .keycon = WKEYCON,
1815 .osd = VIDOSD_BASE,
1816 .osd_stride = 16,
1817 .buf_start = VIDW_BUF_START(0),
1818 .buf_size = VIDW_BUF_SIZE(0),
1819 .buf_end = VIDW_BUF_END(0),
1820
1821 .palette = {
1822 [0] = 0x2400,
1823 [1] = 0x2800,
1824 [2] = 0x2c00,
1825 [3] = 0x3000,
1826 [4] = 0x3400,
1827 },
1828
1829 .has_prtcon = 1,
1830 .has_blendcon = 1,
1831 .has_clksel = 1,
1832 },
1833 .win[0] = &s3c_fb_data_s5p_wins[0],
1834 .win[1] = &s3c_fb_data_s5p_wins[1],
1835 .win[2] = &s3c_fb_data_s5p_wins[2],
1836 .win[3] = &s3c_fb_data_s5p_wins[3],
1837 .win[4] = &s3c_fb_data_s5p_wins[4],
1838};
1839
1840static struct s3c_fb_driverdata s3c_fb_data_s5pv210 = { 1808static struct s3c_fb_driverdata s3c_fb_data_s5pv210 = {
1841 .variant = { 1809 .variant = {
1842 .nr_windows = 5, 1810 .nr_windows = 5,
@@ -1970,41 +1938,11 @@ static struct s3c_fb_driverdata s3c_fb_data_s3c2443 = {
1970 }, 1938 },
1971}; 1939};
1972 1940
1973static struct s3c_fb_driverdata s3c_fb_data_s5p64x0 = {
1974 .variant = {
1975 .nr_windows = 3,
1976 .vidtcon = VIDTCON0,
1977 .wincon = WINCON(0),
1978 .winmap = WINxMAP(0),
1979 .keycon = WKEYCON,
1980 .osd = VIDOSD_BASE,
1981 .osd_stride = 16,
1982 .buf_start = VIDW_BUF_START(0),
1983 .buf_size = VIDW_BUF_SIZE(0),
1984 .buf_end = VIDW_BUF_END(0),
1985
1986 .palette = {
1987 [0] = 0x2400,
1988 [1] = 0x2800,
1989 [2] = 0x2c00,
1990 },
1991
1992 .has_blendcon = 1,
1993 .has_fixvclk = 1,
1994 },
1995 .win[0] = &s3c_fb_data_s5p_wins[0],
1996 .win[1] = &s3c_fb_data_s5p_wins[1],
1997 .win[2] = &s3c_fb_data_s5p_wins[2],
1998};
1999
2000static struct platform_device_id s3c_fb_driver_ids[] = { 1941static struct platform_device_id s3c_fb_driver_ids[] = {
2001 { 1942 {
2002 .name = "s3c-fb", 1943 .name = "s3c-fb",
2003 .driver_data = (unsigned long)&s3c_fb_data_64xx, 1944 .driver_data = (unsigned long)&s3c_fb_data_64xx,
2004 }, { 1945 }, {
2005 .name = "s5pc100-fb",
2006 .driver_data = (unsigned long)&s3c_fb_data_s5pc100,
2007 }, {
2008 .name = "s5pv210-fb", 1946 .name = "s5pv210-fb",
2009 .driver_data = (unsigned long)&s3c_fb_data_s5pv210, 1947 .driver_data = (unsigned long)&s3c_fb_data_s5pv210,
2010 }, { 1948 }, {
@@ -2016,9 +1954,6 @@ static struct platform_device_id s3c_fb_driver_ids[] = {
2016 }, { 1954 }, {
2017 .name = "s3c2443-fb", 1955 .name = "s3c2443-fb",
2018 .driver_data = (unsigned long)&s3c_fb_data_s3c2443, 1956 .driver_data = (unsigned long)&s3c_fb_data_s3c2443,
2019 }, {
2020 .name = "s5p64x0-fb",
2021 .driver_data = (unsigned long)&s3c_fb_data_s5p64x0,
2022 }, 1957 },
2023 {}, 1958 {},
2024}; 1959};
diff --git a/drivers/video/fbdev/s3c2410fb.c b/drivers/video/fbdev/s3c2410fb.c
index 81af5a63e9e1..e350eb57f11d 100644
--- a/drivers/video/fbdev/s3c2410fb.c
+++ b/drivers/video/fbdev/s3c2410fb.c
@@ -601,12 +601,12 @@ static int s3c2410fb_debug_store(struct device *dev,
601 if (len < 1) 601 if (len < 1)
602 return -EINVAL; 602 return -EINVAL;
603 603
604 if (strnicmp(buf, "on", 2) == 0 || 604 if (strncasecmp(buf, "on", 2) == 0 ||
605 strnicmp(buf, "1", 1) == 0) { 605 strncasecmp(buf, "1", 1) == 0) {
606 debug = 1; 606 debug = 1;
607 dev_dbg(dev, "s3c2410fb: Debug On"); 607 dev_dbg(dev, "s3c2410fb: Debug On");
608 } else if (strnicmp(buf, "off", 3) == 0 || 608 } else if (strncasecmp(buf, "off", 3) == 0 ||
609 strnicmp(buf, "0", 1) == 0) { 609 strncasecmp(buf, "0", 1) == 0) {
610 debug = 0; 610 debug = 0;
611 dev_dbg(dev, "s3c2410fb: Debug Off"); 611 dev_dbg(dev, "s3c2410fb: Debug Off");
612 } else { 612 } else {
@@ -616,7 +616,7 @@ static int s3c2410fb_debug_store(struct device *dev,
616 return len; 616 return len;
617} 617}
618 618
619static DEVICE_ATTR(debug, 0666, s3c2410fb_debug_show, s3c2410fb_debug_store); 619static DEVICE_ATTR(debug, 0664, s3c2410fb_debug_show, s3c2410fb_debug_store);
620 620
621static struct fb_ops s3c2410fb_ops = { 621static struct fb_ops s3c2410fb_ops = {
622 .owner = THIS_MODULE, 622 .owner = THIS_MODULE,
@@ -932,7 +932,7 @@ static int s3c24xxfb_probe(struct platform_device *pdev,
932 goto release_irq; 932 goto release_irq;
933 } 933 }
934 934
935 clk_enable(info->clk); 935 clk_prepare_enable(info->clk);
936 dprintk("got and enabled clock\n"); 936 dprintk("got and enabled clock\n");
937 937
938 usleep_range(1000, 1100); 938 usleep_range(1000, 1100);
@@ -996,7 +996,7 @@ static int s3c24xxfb_probe(struct platform_device *pdev,
996free_video_memory: 996free_video_memory:
997 s3c2410fb_unmap_video_memory(fbinfo); 997 s3c2410fb_unmap_video_memory(fbinfo);
998release_clock: 998release_clock:
999 clk_disable(info->clk); 999 clk_disable_unprepare(info->clk);
1000 clk_put(info->clk); 1000 clk_put(info->clk);
1001release_irq: 1001release_irq:
1002 free_irq(irq, info); 1002 free_irq(irq, info);
@@ -1038,7 +1038,7 @@ static int s3c2410fb_remove(struct platform_device *pdev)
1038 s3c2410fb_unmap_video_memory(fbinfo); 1038 s3c2410fb_unmap_video_memory(fbinfo);
1039 1039
1040 if (info->clk) { 1040 if (info->clk) {
1041 clk_disable(info->clk); 1041 clk_disable_unprepare(info->clk);
1042 clk_put(info->clk); 1042 clk_put(info->clk);
1043 info->clk = NULL; 1043 info->clk = NULL;
1044 } 1044 }
@@ -1070,7 +1070,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state)
1070 * before the clock goes off again (bjd) */ 1070 * before the clock goes off again (bjd) */
1071 1071
1072 usleep_range(1000, 1100); 1072 usleep_range(1000, 1100);
1073 clk_disable(info->clk); 1073 clk_disable_unprepare(info->clk);
1074 1074
1075 return 0; 1075 return 0;
1076} 1076}
@@ -1080,7 +1080,7 @@ static int s3c2410fb_resume(struct platform_device *dev)
1080 struct fb_info *fbinfo = platform_get_drvdata(dev); 1080 struct fb_info *fbinfo = platform_get_drvdata(dev);
1081 struct s3c2410fb_info *info = fbinfo->par; 1081 struct s3c2410fb_info *info = fbinfo->par;
1082 1082
1083 clk_enable(info->clk); 1083 clk_prepare_enable(info->clk);
1084 usleep_range(1000, 1100); 1084 usleep_range(1000, 1100);
1085 1085
1086 s3c2410fb_init_registers(fbinfo); 1086 s3c2410fb_init_registers(fbinfo);
diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c
index 580c444ec301..9690216d38ff 100644
--- a/drivers/video/fbdev/sa1100fb.c
+++ b/drivers/video/fbdev/sa1100fb.c
@@ -268,7 +268,8 @@ static int
268sa1100fb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue, 268sa1100fb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
269 u_int trans, struct fb_info *info) 269 u_int trans, struct fb_info *info)
270{ 270{
271 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; 271 struct sa1100fb_info *fbi =
272 container_of(info, struct sa1100fb_info, fb);
272 u_int val, ret = 1; 273 u_int val, ret = 1;
273 274
274 if (regno < fbi->palette_size) { 275 if (regno < fbi->palette_size) {
@@ -289,7 +290,8 @@ static int
289sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 290sa1100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
290 u_int trans, struct fb_info *info) 291 u_int trans, struct fb_info *info)
291{ 292{
292 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; 293 struct sa1100fb_info *fbi =
294 container_of(info, struct sa1100fb_info, fb);
293 unsigned int val; 295 unsigned int val;
294 int ret = 1; 296 int ret = 1;
295 297
@@ -366,7 +368,8 @@ static inline unsigned int sa1100fb_display_dma_period(struct fb_var_screeninfo
366static int 368static int
367sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 369sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
368{ 370{
369 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; 371 struct sa1100fb_info *fbi =
372 container_of(info, struct sa1100fb_info, fb);
370 int rgbidx; 373 int rgbidx;
371 374
372 if (var->xres < MIN_XRES) 375 if (var->xres < MIN_XRES)
@@ -433,7 +436,8 @@ static void sa1100fb_set_visual(struct sa1100fb_info *fbi, u32 visual)
433 */ 436 */
434static int sa1100fb_set_par(struct fb_info *info) 437static int sa1100fb_set_par(struct fb_info *info)
435{ 438{
436 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; 439 struct sa1100fb_info *fbi =
440 container_of(info, struct sa1100fb_info, fb);
437 struct fb_var_screeninfo *var = &info->var; 441 struct fb_var_screeninfo *var = &info->var;
438 unsigned long palette_mem_size; 442 unsigned long palette_mem_size;
439 443
@@ -526,7 +530,8 @@ sa1100fb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
526 */ 530 */
527static int sa1100fb_blank(int blank, struct fb_info *info) 531static int sa1100fb_blank(int blank, struct fb_info *info)
528{ 532{
529 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; 533 struct sa1100fb_info *fbi =
534 container_of(info, struct sa1100fb_info, fb);
530 int i; 535 int i;
531 536
532 dev_dbg(fbi->dev, "sa1100fb_blank: blank=%d\n", blank); 537 dev_dbg(fbi->dev, "sa1100fb_blank: blank=%d\n", blank);
@@ -555,7 +560,8 @@ static int sa1100fb_blank(int blank, struct fb_info *info)
555static int sa1100fb_mmap(struct fb_info *info, 560static int sa1100fb_mmap(struct fb_info *info,
556 struct vm_area_struct *vma) 561 struct vm_area_struct *vma)
557{ 562{
558 struct sa1100fb_info *fbi = (struct sa1100fb_info *)info; 563 struct sa1100fb_info *fbi =
564 container_of(info, struct sa1100fb_info, fb);
559 unsigned long off = vma->vm_pgoff << PAGE_SHIFT; 565 unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
560 566
561 if (off < info->fix.smem_len) { 567 if (off < info->fix.smem_len) {
diff --git a/drivers/video/fbdev/sh_mobile_hdmi.c b/drivers/video/fbdev/sh_mobile_hdmi.c
index 9a33ee0413fb..7c72a3f02056 100644
--- a/drivers/video/fbdev/sh_mobile_hdmi.c
+++ b/drivers/video/fbdev/sh_mobile_hdmi.c
@@ -281,6 +281,7 @@ struct sh_hdmi {
281 u8 edid_block_addr; 281 u8 edid_block_addr;
282 u8 edid_segment_nr; 282 u8 edid_segment_nr;
283 u8 edid_blocks; 283 u8 edid_blocks;
284 int irq;
284 struct clk *hdmi_clk; 285 struct clk *hdmi_clk;
285 struct device *dev; 286 struct device *dev;
286 struct delayed_work edid_work; 287 struct delayed_work edid_work;
@@ -1299,6 +1300,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
1299 hdmi->dev = &pdev->dev; 1300 hdmi->dev = &pdev->dev;
1300 hdmi->entity.owner = THIS_MODULE; 1301 hdmi->entity.owner = THIS_MODULE;
1301 hdmi->entity.ops = &sh_hdmi_ops; 1302 hdmi->entity.ops = &sh_hdmi_ops;
1303 hdmi->irq = irq;
1302 1304
1303 hdmi->hdmi_clk = clk_get(&pdev->dev, "ick"); 1305 hdmi->hdmi_clk = clk_get(&pdev->dev, "ick");
1304 if (IS_ERR(hdmi->hdmi_clk)) { 1306 if (IS_ERR(hdmi->hdmi_clk)) {
@@ -1415,12 +1417,11 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev)
1415{ 1417{
1416 struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev)); 1418 struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev));
1417 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1419 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1418 int irq = platform_get_irq(pdev, 0);
1419 1420
1420 snd_soc_unregister_codec(&pdev->dev); 1421 snd_soc_unregister_codec(&pdev->dev);
1421 1422
1422 /* No new work will be scheduled, wait for running ISR */ 1423 /* No new work will be scheduled, wait for running ISR */
1423 free_irq(irq, hdmi); 1424 free_irq(hdmi->irq, hdmi);
1424 /* Wait for already scheduled work */ 1425 /* Wait for already scheduled work */
1425 cancel_delayed_work_sync(&hdmi->edid_work); 1426 cancel_delayed_work_sync(&hdmi->edid_work);
1426 pm_runtime_put(&pdev->dev); 1427 pm_runtime_put(&pdev->dev);
@@ -1435,10 +1436,49 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev)
1435 return 0; 1436 return 0;
1436} 1437}
1437 1438
1439static int sh_hdmi_suspend(struct device *dev)
1440{
1441 struct platform_device *pdev = to_platform_device(dev);
1442 struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev));
1443
1444 disable_irq(hdmi->irq);
1445 /* Wait for already scheduled work */
1446 cancel_delayed_work_sync(&hdmi->edid_work);
1447 return 0;
1448}
1449
1450static int sh_hdmi_resume(struct device *dev)
1451{
1452 struct platform_device *pdev = to_platform_device(dev);
1453 struct sh_mobile_hdmi_info *pdata = dev_get_platdata(dev);
1454 struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev));
1455
1456 /* Re-init interrupt polarity */
1457 if (pdata->flags & HDMI_OUTPUT_PUSH_PULL)
1458 hdmi_bit_set(hdmi, 0x02, 0x02, HDMI_SYSTEM_CTRL);
1459
1460 if (pdata->flags & HDMI_OUTPUT_POLARITY_HI)
1461 hdmi_bit_set(hdmi, 0x01, 0x01, HDMI_SYSTEM_CTRL);
1462
1463 /* Re-init htop1 */
1464 if (hdmi->htop1)
1465 sh_hdmi_htop1_init(hdmi);
1466
1467 /* Now it's safe to enable interrupts again */
1468 enable_irq(hdmi->irq);
1469 return 0;
1470}
1471
1472static const struct dev_pm_ops sh_hdmi_pm_ops = {
1473 .suspend = sh_hdmi_suspend,
1474 .resume = sh_hdmi_resume,
1475};
1476
1438static struct platform_driver sh_hdmi_driver = { 1477static struct platform_driver sh_hdmi_driver = {
1439 .remove = __exit_p(sh_hdmi_remove), 1478 .remove = __exit_p(sh_hdmi_remove),
1440 .driver = { 1479 .driver = {
1441 .name = "sh-mobile-hdmi", 1480 .name = "sh-mobile-hdmi",
1481 .pm = &sh_hdmi_pm_ops,
1442 }, 1482 },
1443}; 1483};
1444 1484
diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c
index bd40f5ecd901..dfe3eb769638 100644
--- a/drivers/video/fbdev/sis/init.c
+++ b/drivers/video/fbdev/sis/init.c
@@ -1511,7 +1511,7 @@ SiS_Get310DRAMType(struct SiS_Private *SiS_Pr)
1511 } else if(SiS_Pr->ChipType >= SIS_340) { 1511 } else if(SiS_Pr->ChipType >= SIS_340) {
1512 /* TODO */ 1512 /* TODO */
1513 data = 0; 1513 data = 0;
1514 } if(SiS_Pr->ChipType >= SIS_661) { 1514 } else if(SiS_Pr->ChipType >= SIS_661) {
1515 if(SiS_Pr->SiS_ROMNew) { 1515 if(SiS_Pr->SiS_ROMNew) {
1516 data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6); 1516 data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6);
1517 } else { 1517 } else {
diff --git a/drivers/video/fbdev/sis/init301.c b/drivers/video/fbdev/sis/init301.c
index a89e3cafd5ad..295e0dedaf1f 100644
--- a/drivers/video/fbdev/sis/init301.c
+++ b/drivers/video/fbdev/sis/init301.c
@@ -1714,7 +1714,7 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh
1714 SiS_Pr->PanelVCLKIdx315 = VCLK81_315; /* ? */ 1714 SiS_Pr->PanelVCLKIdx315 = VCLK81_315; /* ? */
1715 } else { 1715 } else {
1716 SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 802; 1716 SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 802;
1717 SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRS = 112; 1717 SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112;
1718 SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6; 1718 SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6;
1719 SiS_Pr->PanelVCLKIdx300 = VCLK81_300; 1719 SiS_Pr->PanelVCLKIdx300 = VCLK81_300;
1720 SiS_Pr->PanelVCLKIdx315 = VCLK81_315; 1720 SiS_Pr->PanelVCLKIdx315 = VCLK81_315;
diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c
index 22ad028bf123..e5d11b1892e8 100644
--- a/drivers/video/fbdev/sis/sis_main.c
+++ b/drivers/video/fbdev/sis/sis_main.c
@@ -162,7 +162,7 @@ static void sisfb_search_mode(char *name, bool quiet)
162 return; 162 return;
163 } 163 }
164 164
165 if(!strnicmp(name, sisbios_mode[MODE_INDEX_NONE].name, strlen(name))) { 165 if(!strncasecmp(name, sisbios_mode[MODE_INDEX_NONE].name, strlen(name))) {
166 if(!quiet) 166 if(!quiet)
167 printk(KERN_ERR "sisfb: Mode 'none' not supported anymore. Using default.\n"); 167 printk(KERN_ERR "sisfb: Mode 'none' not supported anymore. Using default.\n");
168 168
@@ -201,7 +201,7 @@ static void sisfb_search_mode(char *name, bool quiet)
201 201
202 i = 0; j = 0; 202 i = 0; j = 0;
203 while(sisbios_mode[i].mode_no[0] != 0) { 203 while(sisbios_mode[i].mode_no[0] != 0) {
204 if(!strnicmp(nameptr, sisbios_mode[i++].name, strlen(nameptr))) { 204 if(!strncasecmp(nameptr, sisbios_mode[i++].name, strlen(nameptr))) {
205 if(sisfb_fstn) { 205 if(sisfb_fstn) {
206 if(sisbios_mode[i-1].mode_no[1] == 0x50 || 206 if(sisbios_mode[i-1].mode_no[1] == 0x50 ||
207 sisbios_mode[i-1].mode_no[1] == 0x56 || 207 sisbios_mode[i-1].mode_no[1] == 0x56 ||
@@ -262,7 +262,7 @@ sisfb_search_crt2type(const char *name)
262 if(name == NULL) return; 262 if(name == NULL) return;
263 263
264 while(sis_crt2type[i].type_no != -1) { 264 while(sis_crt2type[i].type_no != -1) {
265 if(!strnicmp(name, sis_crt2type[i].name, strlen(sis_crt2type[i].name))) { 265 if(!strncasecmp(name, sis_crt2type[i].name, strlen(sis_crt2type[i].name))) {
266 sisfb_crt2type = sis_crt2type[i].type_no; 266 sisfb_crt2type = sis_crt2type[i].type_no;
267 sisfb_tvplug = sis_crt2type[i].tvplug_no; 267 sisfb_tvplug = sis_crt2type[i].tvplug_no;
268 sisfb_crt2flags = sis_crt2type[i].flags; 268 sisfb_crt2flags = sis_crt2type[i].flags;
@@ -289,7 +289,7 @@ sisfb_search_tvstd(const char *name)
289 return; 289 return;
290 290
291 while(sis_tvtype[i].type_no != -1) { 291 while(sis_tvtype[i].type_no != -1) {
292 if(!strnicmp(name, sis_tvtype[i].name, strlen(sis_tvtype[i].name))) { 292 if(!strncasecmp(name, sis_tvtype[i].name, strlen(sis_tvtype[i].name))) {
293 sisfb_tvstd = sis_tvtype[i].type_no; 293 sisfb_tvstd = sis_tvtype[i].type_no;
294 break; 294 break;
295 } 295 }
@@ -308,12 +308,12 @@ sisfb_search_specialtiming(const char *name)
308 if(name == NULL) 308 if(name == NULL)
309 return; 309 return;
310 310
311 if(!strnicmp(name, "none", 4)) { 311 if(!strncasecmp(name, "none", 4)) {
312 sisfb_specialtiming = CUT_FORCENONE; 312 sisfb_specialtiming = CUT_FORCENONE;
313 printk(KERN_DEBUG "sisfb: Special timing disabled\n"); 313 printk(KERN_DEBUG "sisfb: Special timing disabled\n");
314 } else { 314 } else {
315 while(mycustomttable[i].chipID != 0) { 315 while(mycustomttable[i].chipID != 0) {
316 if(!strnicmp(name,mycustomttable[i].optionName, 316 if(!strncasecmp(name,mycustomttable[i].optionName,
317 strlen(mycustomttable[i].optionName))) { 317 strlen(mycustomttable[i].optionName))) {
318 sisfb_specialtiming = mycustomttable[i].SpecialID; 318 sisfb_specialtiming = mycustomttable[i].SpecialID;
319 found = true; 319 found = true;
@@ -1572,10 +1572,6 @@ sisfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1572 /* Adapt RGB settings */ 1572 /* Adapt RGB settings */
1573 sisfb_bpp_to_var(ivideo, var); 1573 sisfb_bpp_to_var(ivideo, var);
1574 1574
1575 /* Sanity check for offsets */
1576 if(var->xoffset < 0) var->xoffset = 0;
1577 if(var->yoffset < 0) var->yoffset = 0;
1578
1579 if(var->xres > var->xres_virtual) 1575 if(var->xres > var->xres_virtual)
1580 var->xres_virtual = var->xres; 1576 var->xres_virtual = var->xres;
1581 1577
@@ -3956,68 +3952,68 @@ static int __init sisfb_setup(char *options)
3956 3952
3957 if(!(*this_opt)) continue; 3953 if(!(*this_opt)) continue;
3958 3954
3959 if(!strnicmp(this_opt, "off", 3)) { 3955 if(!strncasecmp(this_opt, "off", 3)) {
3960 sisfb_off = 1; 3956 sisfb_off = 1;
3961 } else if(!strnicmp(this_opt, "forcecrt2type:", 14)) { 3957 } else if(!strncasecmp(this_opt, "forcecrt2type:", 14)) {
3962 /* Need to check crt2 type first for fstn/dstn */ 3958 /* Need to check crt2 type first for fstn/dstn */
3963 sisfb_search_crt2type(this_opt + 14); 3959 sisfb_search_crt2type(this_opt + 14);
3964 } else if(!strnicmp(this_opt, "tvmode:",7)) { 3960 } else if(!strncasecmp(this_opt, "tvmode:",7)) {
3965 sisfb_search_tvstd(this_opt + 7); 3961 sisfb_search_tvstd(this_opt + 7);
3966 } else if(!strnicmp(this_opt, "tvstandard:",11)) { 3962 } else if(!strncasecmp(this_opt, "tvstandard:",11)) {
3967 sisfb_search_tvstd(this_opt + 11); 3963 sisfb_search_tvstd(this_opt + 11);
3968 } else if(!strnicmp(this_opt, "mode:", 5)) { 3964 } else if(!strncasecmp(this_opt, "mode:", 5)) {
3969 sisfb_search_mode(this_opt + 5, false); 3965 sisfb_search_mode(this_opt + 5, false);
3970 } else if(!strnicmp(this_opt, "vesa:", 5)) { 3966 } else if(!strncasecmp(this_opt, "vesa:", 5)) {
3971 sisfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0), false); 3967 sisfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0), false);
3972 } else if(!strnicmp(this_opt, "rate:", 5)) { 3968 } else if(!strncasecmp(this_opt, "rate:", 5)) {
3973 sisfb_parm_rate = simple_strtoul(this_opt + 5, NULL, 0); 3969 sisfb_parm_rate = simple_strtoul(this_opt + 5, NULL, 0);
3974 } else if(!strnicmp(this_opt, "forcecrt1:", 10)) { 3970 } else if(!strncasecmp(this_opt, "forcecrt1:", 10)) {
3975 sisfb_forcecrt1 = (int)simple_strtoul(this_opt + 10, NULL, 0); 3971 sisfb_forcecrt1 = (int)simple_strtoul(this_opt + 10, NULL, 0);
3976 } else if(!strnicmp(this_opt, "mem:",4)) { 3972 } else if(!strncasecmp(this_opt, "mem:",4)) {
3977 sisfb_parm_mem = simple_strtoul(this_opt + 4, NULL, 0); 3973 sisfb_parm_mem = simple_strtoul(this_opt + 4, NULL, 0);
3978 } else if(!strnicmp(this_opt, "pdc:", 4)) { 3974 } else if(!strncasecmp(this_opt, "pdc:", 4)) {
3979 sisfb_pdc = simple_strtoul(this_opt + 4, NULL, 0); 3975 sisfb_pdc = simple_strtoul(this_opt + 4, NULL, 0);
3980 } else if(!strnicmp(this_opt, "pdc1:", 5)) { 3976 } else if(!strncasecmp(this_opt, "pdc1:", 5)) {
3981 sisfb_pdca = simple_strtoul(this_opt + 5, NULL, 0); 3977 sisfb_pdca = simple_strtoul(this_opt + 5, NULL, 0);
3982 } else if(!strnicmp(this_opt, "noaccel", 7)) { 3978 } else if(!strncasecmp(this_opt, "noaccel", 7)) {
3983 sisfb_accel = 0; 3979 sisfb_accel = 0;
3984 } else if(!strnicmp(this_opt, "accel", 5)) { 3980 } else if(!strncasecmp(this_opt, "accel", 5)) {
3985 sisfb_accel = -1; 3981 sisfb_accel = -1;
3986 } else if(!strnicmp(this_opt, "noypan", 6)) { 3982 } else if(!strncasecmp(this_opt, "noypan", 6)) {
3987 sisfb_ypan = 0; 3983 sisfb_ypan = 0;
3988 } else if(!strnicmp(this_opt, "ypan", 4)) { 3984 } else if(!strncasecmp(this_opt, "ypan", 4)) {
3989 sisfb_ypan = -1; 3985 sisfb_ypan = -1;
3990 } else if(!strnicmp(this_opt, "nomax", 5)) { 3986 } else if(!strncasecmp(this_opt, "nomax", 5)) {
3991 sisfb_max = 0; 3987 sisfb_max = 0;
3992 } else if(!strnicmp(this_opt, "max", 3)) { 3988 } else if(!strncasecmp(this_opt, "max", 3)) {
3993 sisfb_max = -1; 3989 sisfb_max = -1;
3994 } else if(!strnicmp(this_opt, "userom:", 7)) { 3990 } else if(!strncasecmp(this_opt, "userom:", 7)) {
3995 sisfb_userom = (int)simple_strtoul(this_opt + 7, NULL, 0); 3991 sisfb_userom = (int)simple_strtoul(this_opt + 7, NULL, 0);
3996 } else if(!strnicmp(this_opt, "useoem:", 7)) { 3992 } else if(!strncasecmp(this_opt, "useoem:", 7)) {
3997 sisfb_useoem = (int)simple_strtoul(this_opt + 7, NULL, 0); 3993 sisfb_useoem = (int)simple_strtoul(this_opt + 7, NULL, 0);
3998 } else if(!strnicmp(this_opt, "nocrt2rate", 10)) { 3994 } else if(!strncasecmp(this_opt, "nocrt2rate", 10)) {
3999 sisfb_nocrt2rate = 1; 3995 sisfb_nocrt2rate = 1;
4000 } else if(!strnicmp(this_opt, "scalelcd:", 9)) { 3996 } else if(!strncasecmp(this_opt, "scalelcd:", 9)) {
4001 unsigned long temp = 2; 3997 unsigned long temp = 2;
4002 temp = simple_strtoul(this_opt + 9, NULL, 0); 3998 temp = simple_strtoul(this_opt + 9, NULL, 0);
4003 if((temp == 0) || (temp == 1)) { 3999 if((temp == 0) || (temp == 1)) {
4004 sisfb_scalelcd = temp ^ 1; 4000 sisfb_scalelcd = temp ^ 1;
4005 } 4001 }
4006 } else if(!strnicmp(this_opt, "tvxposoffset:", 13)) { 4002 } else if(!strncasecmp(this_opt, "tvxposoffset:", 13)) {
4007 int temp = 0; 4003 int temp = 0;
4008 temp = (int)simple_strtol(this_opt + 13, NULL, 0); 4004 temp = (int)simple_strtol(this_opt + 13, NULL, 0);
4009 if((temp >= -32) && (temp <= 32)) { 4005 if((temp >= -32) && (temp <= 32)) {
4010 sisfb_tvxposoffset = temp; 4006 sisfb_tvxposoffset = temp;
4011 } 4007 }
4012 } else if(!strnicmp(this_opt, "tvyposoffset:", 13)) { 4008 } else if(!strncasecmp(this_opt, "tvyposoffset:", 13)) {
4013 int temp = 0; 4009 int temp = 0;
4014 temp = (int)simple_strtol(this_opt + 13, NULL, 0); 4010 temp = (int)simple_strtol(this_opt + 13, NULL, 0);
4015 if((temp >= -32) && (temp <= 32)) { 4011 if((temp >= -32) && (temp <= 32)) {
4016 sisfb_tvyposoffset = temp; 4012 sisfb_tvyposoffset = temp;
4017 } 4013 }
4018 } else if(!strnicmp(this_opt, "specialtiming:", 14)) { 4014 } else if(!strncasecmp(this_opt, "specialtiming:", 14)) {
4019 sisfb_search_specialtiming(this_opt + 14); 4015 sisfb_search_specialtiming(this_opt + 14);
4020 } else if(!strnicmp(this_opt, "lvdshl:", 7)) { 4016 } else if(!strncasecmp(this_opt, "lvdshl:", 7)) {
4021 int temp = 4; 4017 int temp = 4;
4022 temp = simple_strtoul(this_opt + 7, NULL, 0); 4018 temp = simple_strtoul(this_opt + 7, NULL, 0);
4023 if((temp >= 0) && (temp <= 3)) { 4019 if((temp >= 0) && (temp <= 3)) {
@@ -4026,9 +4022,9 @@ static int __init sisfb_setup(char *options)
4026 } else if(this_opt[0] >= '0' && this_opt[0] <= '9') { 4022 } else if(this_opt[0] >= '0' && this_opt[0] <= '9') {
4027 sisfb_search_mode(this_opt, true); 4023 sisfb_search_mode(this_opt, true);
4028#if !defined(__i386__) && !defined(__x86_64__) 4024#if !defined(__i386__) && !defined(__x86_64__)
4029 } else if(!strnicmp(this_opt, "resetcard", 9)) { 4025 } else if(!strncasecmp(this_opt, "resetcard", 9)) {
4030 sisfb_resetcard = 1; 4026 sisfb_resetcard = 1;
4031 } else if(!strnicmp(this_opt, "videoram:", 9)) { 4027 } else if(!strncasecmp(this_opt, "videoram:", 9)) {
4032 sisfb_videoram = simple_strtoul(this_opt + 9, NULL, 0); 4028 sisfb_videoram = simple_strtoul(this_opt + 9, NULL, 0);
4033#endif 4029#endif
4034 } else { 4030 } else {
@@ -5834,7 +5830,7 @@ static int sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5834 ivideo->cardnumber++; 5830 ivideo->cardnumber++;
5835 } 5831 }
5836 5832
5837 strncpy(ivideo->myid, chipinfo->chip_name, 30); 5833 strlcpy(ivideo->myid, chipinfo->chip_name, sizeof(ivideo->myid));
5838 5834
5839 ivideo->warncount = 0; 5835 ivideo->warncount = 0;
5840 ivideo->chip_id = pdev->device; 5836 ivideo->chip_id = pdev->device;
diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index c2c8eb668784..9e74e8fbe074 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1187,9 +1187,9 @@ static ssize_t sm501fb_crtsrc_store(struct device *dev,
1187 if (len < 1) 1187 if (len < 1)
1188 return -EINVAL; 1188 return -EINVAL;
1189 1189
1190 if (strnicmp(buf, "crt", 3) == 0) 1190 if (strncasecmp(buf, "crt", 3) == 0)
1191 head = HEAD_CRT; 1191 head = HEAD_CRT;
1192 else if (strnicmp(buf, "panel", 5) == 0) 1192 else if (strncasecmp(buf, "panel", 5) == 0)
1193 head = HEAD_PANEL; 1193 head = HEAD_PANEL;
1194 else 1194 else
1195 return -EINVAL; 1195 return -EINVAL;
diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c
index cfe8a2f905c5..86621fabbb8b 100644
--- a/drivers/video/fbdev/stifb.c
+++ b/drivers/video/fbdev/stifb.c
@@ -918,7 +918,7 @@ static int
918stifb_setcolreg(u_int regno, u_int red, u_int green, 918stifb_setcolreg(u_int regno, u_int red, u_int green,
919 u_int blue, u_int transp, struct fb_info *info) 919 u_int blue, u_int transp, struct fb_info *info)
920{ 920{
921 struct stifb_info *fb = (struct stifb_info *) info; 921 struct stifb_info *fb = container_of(info, struct stifb_info, info);
922 u32 color; 922 u32 color;
923 923
924 if (regno >= NR_PALETTE) 924 if (regno >= NR_PALETTE)
@@ -978,7 +978,7 @@ stifb_setcolreg(u_int regno, u_int red, u_int green,
978static int 978static int
979stifb_blank(int blank_mode, struct fb_info *info) 979stifb_blank(int blank_mode, struct fb_info *info)
980{ 980{
981 struct stifb_info *fb = (struct stifb_info *) info; 981 struct stifb_info *fb = container_of(info, struct stifb_info, info);
982 int enable = (blank_mode == 0) ? ENABLE : DISABLE; 982 int enable = (blank_mode == 0) ? ENABLE : DISABLE;
983 983
984 switch (fb->id) { 984 switch (fb->id) {
diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c
index 77b890e4d296..046d51d83d74 100644
--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -1528,11 +1528,8 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dev,
1528 } 1528 }
1529 1529
1530 if (total_len > 5) { 1530 if (total_len > 5) {
1531 pr_info("vendor descriptor length:%x data:%02x %02x %02x %02x" \ 1531 pr_info("vendor descriptor length:%x data:%11ph\n", total_len,
1532 "%02x %02x %02x %02x %02x %02x %02x\n", 1532 desc);
1533 total_len, desc[0],
1534 desc[1], desc[2], desc[3], desc[4], desc[5], desc[6],
1535 desc[7], desc[8], desc[9], desc[10]);
1536 1533
1537 if ((desc[0] != total_len) || /* descriptor length */ 1534 if ((desc[0] != total_len) || /* descriptor length */
1538 (desc[1] != 0x5f) || /* vendor descriptor type */ 1535 (desc[1] != 0x5f) || /* vendor descriptor type */
diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c
index 97cb9bd1d1dd..275fb98236d3 100644
--- a/drivers/video/fbdev/valkyriefb.c
+++ b/drivers/video/fbdev/valkyriefb.c
@@ -136,7 +136,8 @@ static struct fb_ops valkyriefb_ops = {
136/* Sets the video mode according to info->var */ 136/* Sets the video mode according to info->var */
137static int valkyriefb_set_par(struct fb_info *info) 137static int valkyriefb_set_par(struct fb_info *info)
138{ 138{
139 struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) info; 139 struct fb_info_valkyrie *p =
140 container_of(info, struct fb_info_valkyrie, info);
140 volatile struct valkyrie_regs __iomem *valkyrie_regs = p->valkyrie_regs; 141 volatile struct valkyrie_regs __iomem *valkyrie_regs = p->valkyrie_regs;
141 struct fb_par_valkyrie *par = info->par; 142 struct fb_par_valkyrie *par = info->par;
142 struct valkyrie_regvals *init; 143 struct valkyrie_regvals *init;
@@ -194,7 +195,8 @@ valkyriefb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
194 */ 195 */
195static int valkyriefb_blank(int blank_mode, struct fb_info *info) 196static int valkyriefb_blank(int blank_mode, struct fb_info *info)
196{ 197{
197 struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) info; 198 struct fb_info_valkyrie *p =
199 container_of(info, struct fb_info_valkyrie, info);
198 struct fb_par_valkyrie *par = info->par; 200 struct fb_par_valkyrie *par = info->par;
199 struct valkyrie_regvals *init = par->init; 201 struct valkyrie_regvals *init = par->init;
200 202
@@ -226,7 +228,8 @@ static int valkyriefb_blank(int blank_mode, struct fb_info *info)
226static int valkyriefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 228static int valkyriefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
227 u_int transp, struct fb_info *info) 229 u_int transp, struct fb_info *info)
228{ 230{
229 struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) info; 231 struct fb_info_valkyrie *p =
232 container_of(info, struct fb_info_valkyrie, info);
230 volatile struct cmap_regs __iomem *cmap_regs = p->cmap_regs; 233 volatile struct cmap_regs __iomem *cmap_regs = p->cmap_regs;
231 struct fb_par_valkyrie *par = info->par; 234 struct fb_par_valkyrie *par = info->par;
232 235
@@ -263,10 +266,10 @@ static inline int valkyrie_vram_reqd(int video_mode, int color_mode)
263 266
264static void set_valkyrie_clock(unsigned char *params) 267static void set_valkyrie_clock(unsigned char *params)
265{ 268{
269#ifdef CONFIG_ADB_CUDA
266 struct adb_request req; 270 struct adb_request req;
267 int i; 271 int i;
268 272
269#ifdef CONFIG_ADB_CUDA
270 for (i = 0; i < 3; ++i) { 273 for (i = 0; i < 3; ++i) {
271 cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC, 274 cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC,
272 0x50, i + 1, params[i]); 275 0x50, i + 1, params[i]);
@@ -465,7 +468,8 @@ static int valkyrie_var_to_par(struct fb_var_screeninfo *var,
465{ 468{
466 int vmode, cmode; 469 int vmode, cmode;
467 struct valkyrie_regvals *init; 470 struct valkyrie_regvals *init;
468 struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) fb_info; 471 struct fb_info_valkyrie *p =
472 container_of(fb_info, struct fb_info_valkyrie, info);
469 473
470 if (mac_var_to_vmode(var, &vmode, &cmode) != 0) { 474 if (mac_var_to_vmode(var, &vmode, &cmode) != 0) {
471 printk(KERN_ERR "valkyriefb: can't do %dx%dx%d.\n", 475 printk(KERN_ERR "valkyriefb: can't do %dx%dx%d.\n",
diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c
index 048a66640b03..5f930aeccf1f 100644
--- a/drivers/video/fbdev/vermilion/vermilion.c
+++ b/drivers/video/fbdev/vermilion/vermilion.c
@@ -481,7 +481,6 @@ static int vml_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
481 default: 481 default:
482 err = -ENODEV; 482 err = -ENODEV;
483 goto out_err_1; 483 goto out_err_1;
484 break;
485 } 484 }
486 485
487 info = &vinfo->info; 486 info = &vinfo->info;
diff --git a/drivers/video/fbdev/via/via-gpio.c b/drivers/video/fbdev/via/via-gpio.c
index e408679081ab..6f433b8cee12 100644
--- a/drivers/video/fbdev/via/via-gpio.c
+++ b/drivers/video/fbdev/via/via-gpio.c
@@ -270,7 +270,7 @@ static int viafb_gpio_probe(struct platform_device *platdev)
270static int viafb_gpio_remove(struct platform_device *platdev) 270static int viafb_gpio_remove(struct platform_device *platdev)
271{ 271{
272 unsigned long flags; 272 unsigned long flags;
273 int ret = 0, i; 273 int i;
274 274
275#ifdef CONFIG_PM 275#ifdef CONFIG_PM
276 viafb_pm_unregister(&viafb_gpio_pm_hooks); 276 viafb_pm_unregister(&viafb_gpio_pm_hooks);
@@ -280,11 +280,7 @@ static int viafb_gpio_remove(struct platform_device *platdev)
280 * Get unregistered. 280 * Get unregistered.
281 */ 281 */
282 if (viafb_gpio_config.gpio_chip.ngpio > 0) { 282 if (viafb_gpio_config.gpio_chip.ngpio > 0) {
283 ret = gpiochip_remove(&viafb_gpio_config.gpio_chip); 283 gpiochip_remove(&viafb_gpio_config.gpio_chip);
284 if (ret) { /* Somebody still using it? */
285 printk(KERN_ERR "Viafb: GPIO remove failed\n");
286 return ret;
287 }
288 } 284 }
289 /* 285 /*
290 * Disable the ports. 286 * Disable the ports.
@@ -294,7 +290,7 @@ static int viafb_gpio_remove(struct platform_device *platdev)
294 viafb_gpio_disable(viafb_gpio_config.active_gpios[i]); 290 viafb_gpio_disable(viafb_gpio_config.active_gpios[i]);
295 viafb_gpio_config.gpio_chip.ngpio = 0; 291 viafb_gpio_config.gpio_chip.ngpio = 0;
296 spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags); 292 spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags);
297 return ret; 293 return 0;
298} 294}
299 295
300static struct platform_driver via_gpio_driver = { 296static struct platform_driver via_gpio_driver = {
diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c
index 901014bbc821..09dc44736c1a 100644
--- a/drivers/video/fbdev/xen-fbfront.c
+++ b/drivers/video/fbdev/xen-fbfront.c
@@ -684,12 +684,13 @@ static const struct xenbus_device_id xenfb_ids[] = {
684 { "" } 684 { "" }
685}; 685};
686 686
687static DEFINE_XENBUS_DRIVER(xenfb, , 687static struct xenbus_driver xenfb_driver = {
688 .ids = xenfb_ids,
688 .probe = xenfb_probe, 689 .probe = xenfb_probe,
689 .remove = xenfb_remove, 690 .remove = xenfb_remove,
690 .resume = xenfb_resume, 691 .resume = xenfb_resume,
691 .otherend_changed = xenfb_backend_changed, 692 .otherend_changed = xenfb_backend_changed,
692); 693};
693 694
694static int __init xenfb_init(void) 695static int __init xenfb_init(void)
695{ 696{
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index 987edf110038..32d8275e4c88 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -233,9 +233,9 @@ struct display_timings *of_get_display_timings(struct device_node *np)
233 return disp; 233 return disp;
234 234
235timingfail: 235timingfail:
236 if (native_mode) 236 of_node_put(native_mode);
237 of_node_put(native_mode);
238 display_timings_release(disp); 237 display_timings_release(disp);
238 disp = NULL;
239entryfail: 239entryfail:
240 kfree(disp); 240 kfree(disp);
241dispfail: 241dispfail: