diff options
Diffstat (limited to 'drivers/video')
83 files changed, 592 insertions, 590 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 0587e21abad9..6d2fde6c5d11 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -11,6 +11,10 @@ config APERTURE_HELPERS Support tracking and hand-over of aperture ownership. Required by graphics drivers for firmware-provided framebuffers. +config VIDEO_NOMODESET + bool + default n + if HAS_IOMEM config HAVE_FB_ATMEL diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 5bb6b452cc83..a50eb528ed3c 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_APERTURE_HELPERS) += aperture.o obj-$(CONFIG_VGASTATE) += vgastate.o +obj-$(CONFIG_VIDEO_NOMODESET) += nomodeset.o obj-$(CONFIG_HDMI) += hdmi.o obj-$(CONFIG_VT) += console/ diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index b0fe02273e87..a479aab90f78 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c @@ -648,9 +648,9 @@ static const struct attribute_group adp8860_bl_attr_group = { .attrs = adp8860_bl_attributes, }; -static int adp8860_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int adp8860_probe(struct i2c_client *client) { + const struct i2c_device_id *id = i2c_client_get_device_id(client); struct backlight_device *bl; struct adp8860_bl *data; struct adp8860_backlight_platform_data *pdata = @@ -803,7 +803,7 @@ static struct i2c_driver adp8860_driver = { .name = KBUILD_MODNAME, .pm = &adp8860_i2c_pm_ops, }, - .probe = adp8860_probe, + .probe_new = adp8860_probe, .remove = adp8860_remove, .id_table = adp8860_id, }; diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 5becace3fd0f..d6b0007db649 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c @@ -836,9 +836,9 @@ static const struct attribute_group adp8870_bl_attr_group = { .attrs = adp8870_bl_attributes, }; -static int adp8870_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int adp8870_probe(struct i2c_client *client) { + const struct i2c_device_id *id = i2c_client_get_device_id(client); struct backlight_properties props; struct backlight_device *bl; struct adp8870_bl *data; @@ -973,7 +973,7 @@ static struct i2c_driver adp8870_driver = { .name = KBUILD_MODNAME, .pm = &adp8870_i2c_pm_ops, }, - .probe = adp8870_probe, + .probe_new = adp8870_probe, .remove = adp8870_remove, .id_table = adp8870_id, }; diff --git a/drivers/video/backlight/apple_bl.c b/drivers/video/backlight/apple_bl.c index c0d9339cff87..e9e7acb577bf 100644 --- a/drivers/video/backlight/apple_bl.c +++ b/drivers/video/backlight/apple_bl.c @@ -193,13 +193,12 @@ static int apple_bl_add(struct acpi_device *dev) return 0; } -static int apple_bl_remove(struct acpi_device *dev) +static void apple_bl_remove(struct acpi_device *dev) { backlight_device_unregister(apple_backlight_device); release_region(hw_data->iostart, hw_data->iolen); hw_data = NULL; - return 0; } static const struct acpi_device_id apple_bl_ids[] = { diff --git a/drivers/video/backlight/arcxcnn_bl.c b/drivers/video/backlight/arcxcnn_bl.c index 060c0eef6a52..555b036643fb 100644 --- a/drivers/video/backlight/arcxcnn_bl.c +++ b/drivers/video/backlight/arcxcnn_bl.c @@ -241,7 +241,7 @@ static void arcxcnn_parse_dt(struct arcxcnn *lp) } } -static int arcxcnn_probe(struct i2c_client *cl, const struct i2c_device_id *id) +static int arcxcnn_probe(struct i2c_client *cl) { struct arcxcnn *lp; int ret; @@ -395,7 +395,7 @@ static struct i2c_driver arcxcnn_driver = { .name = "arcxcnn_bl", .of_match_table = of_match_ptr(arcxcnn_dt_ids), }, - .probe = arcxcnn_probe, + .probe_new = arcxcnn_probe, .remove = arcxcnn_remove, .id_table = arcxcnn_ids, }; diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index a506872d4396..f4db6c064635 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -113,8 +113,7 @@ static const struct backlight_ops bd6107_backlight_ops = { .check_fb = bd6107_backlight_check_fb, }; -static int bd6107_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int bd6107_probe(struct i2c_client *client) { struct bd6107_platform_data *pdata = dev_get_platdata(&client->dev); struct backlight_device *backlight; @@ -193,7 +192,7 @@ static struct i2c_driver bd6107_driver = { .driver = { .name = "bd6107", }, - .probe = bd6107_probe, + .probe_new = bd6107_probe, .remove = bd6107_remove, .id_table = bd6107_ids, }; diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index 475f35635bf6..d8c42acecb5d 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -491,8 +491,7 @@ static int lm3630a_parse_node(struct lm3630a_chip *pchip, return ret; } -static int lm3630a_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int lm3630a_probe(struct i2c_client *client) { struct lm3630a_platform_data *pdata = dev_get_platdata(&client->dev); struct lm3630a_chip *pchip; @@ -617,7 +616,7 @@ static struct i2c_driver lm3630a_i2c_driver = { .name = LM3630A_NAME, .of_match_table = lm3630a_match_table, }, - .probe = lm3630a_probe, + .probe_new = lm3630a_probe, .remove = lm3630a_remove, .id_table = lm3630a_id, }; diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c index 6580911671a3..a836628ce06e 100644 --- a/drivers/video/backlight/lm3639_bl.c +++ b/drivers/video/backlight/lm3639_bl.c @@ -296,8 +296,7 @@ static const struct regmap_config lm3639_regmap = { .max_register = REG_MAX, }; -static int lm3639_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int lm3639_probe(struct i2c_client *client) { int ret; struct lm3639_chip_data *pchip; @@ -412,7 +411,7 @@ static struct i2c_driver lm3639_i2c_driver = { .driver = { .name = LM3639_NAME, }, - .probe = lm3639_probe, + .probe_new = lm3639_probe, .remove = lm3639_remove, .id_table = lm3639_id, }; diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index bd0bdeae23a4..81012bf29baf 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -394,8 +394,9 @@ static int lp855x_parse_acpi(struct lp855x *lp) return 0; } -static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) +static int lp855x_probe(struct i2c_client *cl) { + const struct i2c_device_id *id = i2c_client_get_device_id(cl); const struct acpi_device_id *acpi_id = NULL; struct device *dev = &cl->dev; struct lp855x *lp; @@ -586,7 +587,7 @@ static struct i2c_driver lp855x_driver = { .of_match_table = of_match_ptr(lp855x_dt_ids), .acpi_match_table = ACPI_PTR(lp855x_acpi_match), }, - .probe = lp855x_probe, + .probe_new = lp855x_probe, .remove = lp855x_remove, .id_table = lp855x_ids, }; diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c index 767b800d79fa..00673c8b66ac 100644 --- a/drivers/video/backlight/lv5207lp.c +++ b/drivers/video/backlight/lv5207lp.c @@ -76,8 +76,7 @@ static const struct backlight_ops lv5207lp_backlight_ops = { .check_fb = lv5207lp_backlight_check_fb, }; -static int lv5207lp_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int lv5207lp_probe(struct i2c_client *client) { struct lv5207lp_platform_data *pdata = dev_get_platdata(&client->dev); struct backlight_device *backlight; @@ -142,7 +141,7 @@ static struct i2c_driver lv5207lp_driver = { .driver = { .name = "lv5207lp", }, - .probe = lv5207lp_probe, + .probe_new = lv5207lp_probe, .remove = lv5207lp_remove, .id_table = lv5207lp_ids, }; diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index f55b3d616a87..77b71f6c19b5 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c @@ -75,8 +75,7 @@ static const struct backlight_ops bl_ops = { .update_status = tosa_bl_update_status, }; -static int tosa_bl_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int tosa_bl_probe(struct i2c_client *client) { struct backlight_properties props; struct tosa_bl_data *data; @@ -160,7 +159,7 @@ static struct i2c_driver tosa_bl_driver = { .name = "tosa-bl", .pm = &tosa_bl_pm_ops, }, - .probe = tosa_bl_probe, + .probe_new = tosa_bl_probe, .remove = tosa_bl_remove, .id_table = tosa_bl_id, }; diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index cfc55273dc5d..b2bed599e6c6 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -227,6 +227,7 @@ config FB_CIRRUS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This enables support for Cirrus Logic GD542x/543x based boards on Amiga: SD64, Piccolo, Picasso II/II+, Picasso IV, or EGS Spectrum. @@ -245,6 +246,7 @@ config FB_PM2 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This is the frame buffer device driver for cards based on the 3D Labs Permedia, Permedia 2 and Permedia 2V chips. @@ -340,6 +342,7 @@ config FB_CYBER2000 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This enables support for the Integraphics CyberPro 20x0 and 5000 VGA chips used in the Rebel.com Netwinder and other machines. @@ -453,8 +456,9 @@ config FB_ATARI chipset found in Ataris. config FB_OF - bool "Open Firmware frame buffer device support" - depends on (FB = y) && PPC && (!PPC_PSERIES || PCI) + tristate "Open Firmware frame buffer device support" + depends on FB && PPC && (!PPC_PSERIES || PCI) + depends on !DRM_OFDRM select APERTURE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA @@ -503,6 +507,7 @@ config FB_CT65550 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This is the frame buffer device driver for the Chips & Technologies 65550 graphics chip in PowerBooks. @@ -513,6 +518,7 @@ config FB_ASILIANT select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This is the frame buffer device driver for the Asiliant 69030 chipset @@ -521,6 +527,7 @@ config FB_IMSTT depends on (FB = y) && PCI select FB_CFB_IMAGEBLIT select FB_MACMODES if PPC_PMAC + select VIDEO_NOMODESET help The IMS Twin Turbo is a PCI-based frame buffer card bundled with many Macintosh and compatible computers. @@ -584,6 +591,7 @@ config FB_TGA select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select BITREVERSE + select VIDEO_NOMODESET help This is the frame buffer device driver for generic TGA and SFB+ graphic cards. These include DEC ZLXp-E1, -E2 and -E3 PCI cards, @@ -601,6 +609,7 @@ config FB_TGA config FB_UVESA tristate "Userspace VESA VGA graphics support" depends on FB && CONNECTOR + depends on !UML select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT @@ -776,6 +785,7 @@ config FB_XVR500 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This is the framebuffer device for the Sun XVR-500 and similar graphics cards based upon the 3DLABS Wildcat chipset. The driver @@ -789,6 +799,7 @@ config FB_XVR2500 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This is the framebuffer device for the Sun XVR-2500 and similar graphics cards based upon the 3DLABS Wildcat chipset. The driver @@ -815,6 +826,7 @@ config FB_PVR2 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Say Y here if you have a PowerVR 2 card in your box. If you plan to run linux on your Dreamcast, you will have to say Y here. @@ -880,6 +892,7 @@ config FB_NVIDIA select FB_CFB_IMAGEBLIT select BITREVERSE select VGASTATE + select VIDEO_NOMODESET help This driver supports graphics boards with the nVidia chips, TNT and newer. For very old chipsets, such as the RIVA128, then use @@ -927,6 +940,7 @@ config FB_RIVA select FB_CFB_IMAGEBLIT select BITREVERSE select VGASTATE + select VIDEO_NOMODESET help This driver supports graphics boards with the nVidia Riva/Geforce chips. @@ -971,6 +985,7 @@ config FB_I740 select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select VGASTATE + select VIDEO_NOMODESET select FB_DDC help This driver supports graphics cards based on Intel740 chip. @@ -983,6 +998,7 @@ config FB_I810 select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select VGASTATE + select VIDEO_NOMODESET help This driver supports the on-board graphics built in to the Intel 810 and 815 chipsets. Say Y if you have and plan to use such a board. @@ -1033,6 +1049,7 @@ config FB_LE80578 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This driver supports the LE80578 (Vermilion Range) chipset @@ -1050,6 +1067,7 @@ config FB_INTEL select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select BOOT_VESA_SUPPORT if FB_INTEL = y + select VIDEO_NOMODESET depends on !DRM_I915 help This driver supports the on-board graphics built in to the Intel @@ -1087,6 +1105,7 @@ config FB_MATROX select FB_CFB_IMAGEBLIT select FB_TILEBLITTING select FB_MACMODES if PPC_PMAC + select VIDEO_NOMODESET help Say Y here if you have a Matrox Millennium, Matrox Millennium II, Matrox Mystique, Matrox Mystique 220, Matrox Productiva G100, Matrox @@ -1207,6 +1226,7 @@ config FB_RADEON select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select FB_MACMODES if PPC + select VIDEO_NOMODESET help Choose this option if you want to use an ATI Radeon graphics card as a framebuffer device. There are both PCI and AGP versions. You @@ -1246,6 +1266,7 @@ config FB_ATY128 select FB_CFB_IMAGEBLIT select FB_BACKLIGHT if FB_ATY128_BACKLIGHT select FB_MACMODES if PPC_PMAC + select VIDEO_NOMODESET help This driver supports graphics boards with the ATI Rage128 chips. Say Y if you have such a graphics board and read @@ -1270,6 +1291,7 @@ config FB_ATY select FB_BACKLIGHT if FB_ATY_BACKLIGHT select FB_MACMODES if PPC select FB_ATY_CT if SPARC64 && PCI + select VIDEO_NOMODESET help This driver supports graphics boards with the ATI Mach64 chips. Say Y if you have such a graphics board. @@ -1320,6 +1342,7 @@ config FB_S3 select FB_TILEBLITTING select FB_SVGALIB select VGASTATE + select VIDEO_NOMODESET select FONT_8x16 if FRAMEBUFFER_CONSOLE help Driver for graphics boards with S3 Trio / S3 Virge chip. @@ -1340,6 +1363,7 @@ config FB_SAVAGE select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select VGASTATE + select VIDEO_NOMODESET help This driver supports notebooks and computers with S3 Savage PCI/AGP chips. @@ -1378,6 +1402,7 @@ config FB_SIS select FB_CFB_IMAGEBLIT select BOOT_VESA_SUPPORT if FB_SIS = y select FB_SIS_300 if !FB_SIS_315 + select VIDEO_NOMODESET help This is the frame buffer device driver for the SiS 300, 315, 330 and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets. @@ -1407,6 +1432,7 @@ config FB_VIA select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select I2C_ALGOBIT + select VIDEO_NOMODESET help This is the frame buffer device driver for Graphics chips of VIA UniChrome (Pro) Family (CLE266,PM800/CN400,P4M800CE/P4M800Pro/ @@ -1446,6 +1472,7 @@ config FB_NEOMAGIC select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select VGASTATE + select VIDEO_NOMODESET help This driver supports notebooks with NeoMagic PCI chips. Say Y if you have such a graphics card. @@ -1459,6 +1486,7 @@ config FB_KYRO select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Say Y here if you have a STG4000 / Kyro / PowerVR 3 based graphics board. @@ -1473,6 +1501,7 @@ config FB_3DFX select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_MODE_HELPERS + select VIDEO_NOMODESET help This driver supports graphics boards with the 3Dfx Banshee, Voodoo3 or VSA-100 (aka Voodoo4/5) chips. Say Y if you have @@ -1502,6 +1531,7 @@ config FB_VOODOO1 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Say Y here if you have a 3Dfx Voodoo Graphics (Voodoo1/sst1) or Voodoo2 (cvg) based graphics card. @@ -1523,6 +1553,7 @@ config FB_VT8623 select FB_TILEBLITTING select FB_SVGALIB select VGASTATE + select VIDEO_NOMODESET select FONT_8x16 if FRAMEBUFFER_CONSOLE help Driver for CastleRock integrated graphics core in the @@ -1536,6 +1567,7 @@ config FB_TRIDENT select FB_CFB_IMAGEBLIT select FB_DDC select FB_MODE_HELPERS + select VIDEO_NOMODESET help This is the frame buffer device driver for Trident PCI/AGP chipsets. Supported chipset families are TGUI 9440/96XX, 3DImage, Blade3D @@ -1559,6 +1591,7 @@ config FB_ARK select FB_TILEBLITTING select FB_SVGALIB select VGASTATE + select VIDEO_NOMODESET select FONT_8x16 if FRAMEBUFFER_CONSOLE help Driver for PCI graphics boards with ARK 2000PV chip @@ -1570,6 +1603,7 @@ config FB_PM3 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This is the frame buffer device driver for the 3DLabs Permedia3 chipset, used in Formac ProFormance III, 3DLabs Oxygen VX1 & @@ -1582,6 +1616,7 @@ config FB_CARMINE select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help This is the frame buffer device driver for the Fujitsu Carmine chip. The driver provides two independent frame buffer devices. @@ -1960,6 +1995,7 @@ config FB_IBM_GXT4500 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Say Y here to enable support for the IBM GXT4000P/6000P and GXT4500P/6500P display adaptor based on Raster Engine RC1000, @@ -2100,6 +2136,7 @@ config FB_MB862XX select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Frame buffer driver for Fujitsu Carmine/Coral-P(A)/Lime controllers. @@ -2187,6 +2224,7 @@ config FB_HYPERV select FB_CFB_IMAGEBLIT select FB_DEFERRED_IO select DMA_CMA if HAVE_DMA_CONTIGUOUS && CMA + select VIDEO_NOMODESET help This framebuffer driver supports Microsoft Hyper-V Synthetic Video. @@ -2217,7 +2255,6 @@ config FB_SSD1307 select FB_SYS_COPYAREA select FB_SYS_IMAGEBLIT select FB_DEFERRED_IO - select PWM select FB_BACKLIGHT help This driver implements support for the Solomon SSD1307 @@ -2229,6 +2266,7 @@ config FB_SM712 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Frame buffer driver for the Silicon Motion SM710, SM712, SM721 and SM722 chips. diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index 5f8fec9e5fd4..60a96fdb5dd8 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -1187,7 +1187,12 @@ static int __init arkfb_init(void) #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("arkfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("arkfb", &option)) return -ENODEV; diff --git a/drivers/video/fbdev/asiliantfb.c b/drivers/video/fbdev/asiliantfb.c index 3818437a8f69..8383468f5577 100644 --- a/drivers/video/fbdev/asiliantfb.c +++ b/drivers/video/fbdev/asiliantfb.c @@ -616,6 +616,9 @@ static struct pci_driver asiliantfb_driver = { static int __init asiliantfb_init(void) { + if (fb_modesetting_disabled("asiliantfb")) + return -ENODEV; + if (fb_get_options("asiliantfb", NULL)) return -ENODEV; diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 57e398fe7a81..dd31b9d7d337 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -2503,7 +2503,12 @@ static int aty128fb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("aty128fb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("aty128fb", &option)) return -ENODEV; aty128fb_setup(option); diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index b3463d137152..d59215a4992e 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -3192,8 +3192,7 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base) * which we print to the screen. */ id = *(u8 *)par->lcd_table; - strncpy(model, (char *)par->lcd_table+1, 24); - model[23] = 0; + strscpy(model, (char *)par->lcd_table+1, sizeof(model)); width = par->lcd_width = *(u16 *)(par->lcd_table+25); height = par->lcd_height = *(u16 *)(par->lcd_table+27); @@ -3965,7 +3964,12 @@ static int __init atyfb_init(void) int err1 = 1, err2 = 1; #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("atyfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("atyfb", &option)) return -ENODEV; atyfb_setup(option); diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c index 8b28c9bddd97..657064227de8 100644 --- a/drivers/video/fbdev/aty/radeon_base.c +++ b/drivers/video/fbdev/aty/radeon_base.c @@ -2607,7 +2607,12 @@ static int __init radeonfb_init (void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("radeonfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("radeonfb", &option)) return -ENODEV; radeonfb_setup(option); diff --git a/drivers/video/fbdev/carminefb.c b/drivers/video/fbdev/carminefb.c index 4651b48a87f9..4ae21dbdb8ca 100644 --- a/drivers/video/fbdev/carminefb.c +++ b/drivers/video/fbdev/carminefb.c @@ -773,6 +773,9 @@ static struct pci_driver carmine_pci_driver = { static int __init carminefb_init(void) { + if (fb_modesetting_disabled("carminefb")) + return -ENODEV; + if (!(fb_displays & (CARMINE_USE_DISPLAY0 | CARMINE_USE_DISPLAY1))) { printk(KERN_ERR "If you disable both displays than you don't " diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c index f1c1c95c1fdf..cc37ec3f8fc1 100644 --- a/drivers/video/fbdev/chipsfb.c +++ b/drivers/video/fbdev/chipsfb.c @@ -506,6 +506,9 @@ static struct pci_driver chipsfb_driver = { int __init chips_init(void) { + if (fb_modesetting_disabled("chipsfb")) + return -ENODEV; + if (fb_get_options("chipsfb", NULL)) return -ENODEV; diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c index b08bee43779a..ba45e2147c52 100644 --- a/drivers/video/fbdev/cirrusfb.c +++ b/drivers/video/fbdev/cirrusfb.c @@ -2359,7 +2359,12 @@ static int __init cirrusfb_init(void) #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("cirrusfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("cirrusfb", &option)) return -ENODEV; cirrusfb_setup(option); diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index 6bbcd9fc864e..77dbf94aae5f 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -376,7 +376,7 @@ static int read_control_sense(struct fb_info_control *p) #define CONTROL_PIXCLOCK_MIN 5000 /* ~ 200 MHz dot clock */ /* - * calculate the clock paramaters to be sent to CUDA according to given + * calculate the clock parameters to be sent to CUDA according to given * pixclock in pico second. */ static int calc_clock_params(unsigned long clk, unsigned char *param) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index c0143d38df83..14a7d404062c 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2450,7 +2450,8 @@ err_out: if (userfont) { p->userfont = old_userfont; - REFCOUNT(data)--; + if (--REFCOUNT(data) == 0) + kfree(data - FONT_EXTRA_WORDS * sizeof(int)); } vc->vc_font.width = old_width; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 1e70d8c67653..3a6c8458eb8d 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -40,6 +40,7 @@ #include <asm/fb.h> +#include <video/nomodeset.h> #include <video/vga.h> /* @@ -1844,4 +1845,18 @@ int fb_new_modelist(struct fb_info *info) return 0; } +#if defined(CONFIG_VIDEO_NOMODESET) +bool fb_modesetting_disabled(const char *drvname) +{ + bool fwonly = video_firmware_drivers_only(); + + if (fwonly) + pr_warn("Driver %s not loading because of nomodeset parameter\n", + drvname); + + return fwonly; +} +EXPORT_SYMBOL(fb_modesetting_disabled); +#endif + MODULE_LICENSE("GPL"); diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c index 31ff1da82c05..38c0a6866d76 100644 --- a/drivers/video/fbdev/cyber2000fb.c +++ b/drivers/video/fbdev/cyber2000fb.c @@ -48,7 +48,6 @@ #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> - #ifdef __arm__ #include <asm/mach-types.h> #endif @@ -1878,7 +1877,12 @@ static int __init cyber2000fb_init(void) #ifndef MODULE char *option = NULL; +#endif + if (fb_modesetting_disabled("CyberPro")) + return -ENODEV; + +#ifndef MODULE if (fb_get_options("cyber2000fb", &option)) return -ENODEV; cyber2000fb_setup(option); diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 11922b009ed7..cd07e401b326 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -1431,7 +1431,7 @@ static int fb_probe(struct platform_device *device) dev_err(&device->dev, "GLCD: kmalloc for frame buffer failed\n"); ret = -EINVAL; - goto err_release_fb; + goto err_disable_reg; } da8xx_fb_info->screen_base = (char __iomem *) par->vram_virt; @@ -1475,7 +1475,7 @@ static int fb_probe(struct platform_device *device) ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0); if (ret) - goto err_release_fb; + goto err_disable_reg; da8xx_fb_info->cmap.len = par->palette_sz; /* initialize var_screeninfo */ @@ -1529,6 +1529,9 @@ err_cpu_freq: err_dealloc_cmap: fb_dealloc_cmap(&da8xx_fb_info->cmap); +err_disable_reg: + if (par->lcd_supply) + regulator_disable(par->lcd_supply); err_release_fb: framebuffer_release(da8xx_fb_info); diff --git a/drivers/video/fbdev/ep93xx-fb.c b/drivers/video/fbdev/ep93xx-fb.c index 2398b3d48fed..305f1587bd89 100644 --- a/drivers/video/fbdev/ep93xx-fb.c +++ b/drivers/video/fbdev/ep93xx-fb.c @@ -552,12 +552,14 @@ static int ep93xxfb_probe(struct platform_device *pdev) err = register_framebuffer(info); if (err) - goto failed_check; + goto failed_framebuffer; dev_info(info->dev, "registered. Mode = %dx%d-%d\n", info->var.xres, info->var.yres, info->var.bits_per_pixel); return 0; +failed_framebuffer: + clk_disable_unprepare(fbi->clk); failed_check: if (fbi->mach_info->teardown) fbi->mach_info->teardown(pdev); diff --git a/drivers/video/fbdev/geode/Kconfig b/drivers/video/fbdev/geode/Kconfig index ac9c860592aa..b184085a78c2 100644 --- a/drivers/video/fbdev/geode/Kconfig +++ b/drivers/video/fbdev/geode/Kconfig @@ -5,6 +5,7 @@ config FB_GEODE bool "AMD Geode family framebuffer support" depends on FB && PCI && (X86_32 || (X86 && COMPILE_TEST)) + depends on !UML help Say 'Y' here to allow you to select framebuffer drivers for the AMD Geode family of processors. @@ -15,6 +16,7 @@ config FB_GEODE_LX select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Framebuffer driver for the display controller integrated into the AMD Geode LX processors. @@ -30,6 +32,7 @@ config FB_GEODE_GX select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Framebuffer driver for the display controller integrated into the AMD Geode GX processors. @@ -45,6 +48,7 @@ config FB_GEODE_GX1 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEO_NOMODESET help Framebuffer driver for the display controller integrated into the AMD Geode GX1 processor. diff --git a/drivers/video/fbdev/geode/gx1fb_core.c b/drivers/video/fbdev/geode/gx1fb_core.c index 1514c653a84f..9c942001ac10 100644 --- a/drivers/video/fbdev/geode/gx1fb_core.c +++ b/drivers/video/fbdev/geode/gx1fb_core.c @@ -446,7 +446,12 @@ static int __init gx1fb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("gx1fb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("gx1fb", &option)) return -ENODEV; gx1fb_setup(option); diff --git a/drivers/video/fbdev/geode/gxfb_core.c b/drivers/video/fbdev/geode/gxfb_core.c index 2527bd80ec5f..8e05e76de075 100644 --- a/drivers/video/fbdev/geode/gxfb_core.c +++ b/drivers/video/fbdev/geode/gxfb_core.c @@ -511,7 +511,12 @@ static int __init gxfb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("gxfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("gxfb", &option)) return -ENODEV; diff --git a/drivers/video/fbdev/geode/lxfb_core.c b/drivers/video/fbdev/geode/lxfb_core.c index 9d26592dbfce..8130e9eee2b4 100644 --- a/drivers/video/fbdev/geode/lxfb_core.c +++ b/drivers/video/fbdev/geode/lxfb_core.c @@ -647,7 +647,12 @@ static int __init lxfb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("lxfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("lxfb", &option)) return -ENODEV; diff --git a/drivers/video/fbdev/gxt4500.c b/drivers/video/fbdev/gxt4500.c index 0dcef4bec8d7..5f42d3d9d6ce 100644 --- a/drivers/video/fbdev/gxt4500.c +++ b/drivers/video/fbdev/gxt4500.c @@ -779,6 +779,9 @@ static struct pci_driver gxt4500_driver = { static int gxt4500_init(void) { + if (fb_modesetting_disabled("gxt4500")) + return -ENODEV; + #ifndef MODULE if (fb_get_options("gxt4500", &mode_option)) return -ENODEV; diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index 072ce07ba9e0..fdbf02b42723 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -59,7 +59,6 @@ #include <linux/hyperv.h> - /* Hyper-V Synthetic Video Protocol definitions and structures */ #define MAX_VMBUS_PKT_SIZE 0x4000 @@ -780,12 +779,18 @@ static void hvfb_ondemand_refresh_throttle(struct hvfb_par *par, static int hvfb_on_panic(struct notifier_block *nb, unsigned long e, void *p) { + struct hv_device *hdev; struct hvfb_par *par; struct fb_info *info; par = container_of(nb, struct hvfb_par, hvfb_panic_nb); - par->synchronous_fb = true; info = par->info; + hdev = device_to_hv_device(info->device); + + if (hv_ringbuffer_spinlock_busy(hdev->channel)) + return NOTIFY_DONE; + + par->synchronous_fb = true; if (par->need_docopy) hvfb_docopy(par, 0, dio_fb_size); synthvid_update(info, 0, 0, INT_MAX, INT_MAX); @@ -1208,7 +1213,15 @@ static int hvfb_probe(struct hv_device *hdev, par->fb_ready = true; par->synchronous_fb = false; + + /* + * We need to be sure this panic notifier runs _before_ the + * vmbus disconnect, so order it by priority. It must execute + * before the function hv_panic_vmbus_unload() [drivers/hv/vmbus_drv.c], + * which is almost at the end of list, with priority = INT_MIN + 1. + */ par->hvfb_panic_nb.notifier_call = hvfb_on_panic; + par->hvfb_panic_nb.priority = INT_MIN + 10, atomic_notifier_chain_register(&panic_notifier_list, &par->hvfb_panic_nb); @@ -1363,6 +1376,9 @@ static int __init hvfb_drv_init(void) { int ret; + if (fb_modesetting_disabled("hyper_fb")) + return -ENODEV; + ret = vmbus_driver_register(&hvfb_drv); if (ret != 0) return ret; diff --git a/drivers/video/fbdev/i740fb.c b/drivers/video/fbdev/i740fb.c index b795f6503cb6..3860b137b86a 100644 --- a/drivers/video/fbdev/i740fb.c +++ b/drivers/video/fbdev/i740fb.c @@ -1285,7 +1285,12 @@ static int __init i740fb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("i740fb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("i740fb", &option)) return -ENODEV; i740fb_setup(option); diff --git a/drivers/video/fbdev/i810/i810_main.c b/drivers/video/fbdev/i810/i810_main.c index ff09f8c20bfc..85abb65f07d7 100644 --- a/drivers/video/fbdev/i810/i810_main.c +++ b/drivers/video/fbdev/i810/i810_main.c @@ -2143,6 +2143,9 @@ static int i810fb_init(void) { char *option = NULL; + if (fb_modesetting_disabled("i810fb")) + return -ENODEV; + if (fb_get_options("i810fb", &option)) return -ENODEV; i810fb_setup(option); @@ -2159,6 +2162,9 @@ static int i810fb_init(void) static int i810fb_init(void) { + if (fb_modesetting_disabled("i810fb")) + return -ENODEV; + hsync1 *= 1000; hsync2 *= 1000; diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c index d7edb9c5d3a3..bea45647184e 100644 --- a/drivers/video/fbdev/imsttfb.c +++ b/drivers/video/fbdev/imsttfb.c @@ -1617,7 +1617,12 @@ static int __init imsttfb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("imsttfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("imsttfb", &option)) return -ENODEV; diff --git a/drivers/video/fbdev/intelfb/intelfbdrv.c b/drivers/video/fbdev/intelfb/intelfbdrv.c index d4a2891a9a7a..0a9e5067b201 100644 --- a/drivers/video/fbdev/intelfb/intelfbdrv.c +++ b/drivers/video/fbdev/intelfb/intelfbdrv.c @@ -389,6 +389,9 @@ static int __init intelfb_init(void) if (idonly) return -ENODEV; + if (fb_modesetting_disabled("intelfb")) + return -ENODEV; + #ifndef MODULE if (fb_get_options("intelfb", &option)) return -ENODEV; diff --git a/drivers/video/fbdev/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c index b4b93054c520..0596573ef140 100644 --- a/drivers/video/fbdev/kyro/fbdev.c +++ b/drivers/video/fbdev/kyro/fbdev.c @@ -789,7 +789,12 @@ static int __init kyrofb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("kyrofb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("kyrofb", &option)) return -ENODEV; kyrofb_setup(option); diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c index 775d34115e2d..a043a737ea9f 100644 --- a/drivers/video/fbdev/matrox/matroxfb_base.c +++ b/drivers/video/fbdev/matrox/matroxfb_base.c @@ -1378,8 +1378,8 @@ static struct video_board vbG200 = { .lowlevel = &matrox_G100 }; static struct video_board vbG200eW = { - .maxvram = 0x100000, - .maxdisplayable = 0x800000, + .maxvram = 0x1000000, + .maxdisplayable = 0x0800000, .accelID = FB_ACCEL_MATROX_MGAG200, .lowlevel = &matrox_G100 }; @@ -2314,6 +2314,9 @@ static void __init matroxfb_init_params(void) { static int __init matrox_init(void) { int err; + if (fb_modesetting_disabled("matroxfb")) + return -ENODEV; + matroxfb_init_params(); err = pci_register_driver(&matroxfb_driver); dev = -1; /* accept all new devices... */ diff --git a/drivers/video/fbdev/matrox/matroxfb_maven.c b/drivers/video/fbdev/matrox/matroxfb_maven.c index f2e02958673d..727a10a59811 100644 --- a/drivers/video/fbdev/matrox/matroxfb_maven.c +++ b/drivers/video/fbdev/matrox/matroxfb_maven.c @@ -1249,8 +1249,7 @@ static int maven_shutdown_client(struct i2c_client* clnt) { return 0; } -static int maven_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int maven_probe(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int err = -ENODEV; @@ -1292,7 +1291,7 @@ static struct i2c_driver maven_driver={ .driver = { .name = "maven", }, - .probe = maven_probe, + .probe_new = maven_probe, .remove = maven_remove, .id_table = maven_id, }; diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c index 90c79e8c1157..a236fc910148 100644 --- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c +++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c @@ -1181,6 +1181,9 @@ static int mb862xxfb_init(void) { int ret = -ENODEV; + if (fb_modesetting_disabled(DRV_NAME)) + return -ENODEV; + #if defined(CONFIG_FB_MB862XX_LIME) ret = platform_driver_register(&of_platform_mb862xxfb_driver); #endif diff --git a/drivers/video/fbdev/neofb.c b/drivers/video/fbdev/neofb.c index 93a2d2d1abe8..39d8cdef5c97 100644 --- a/drivers/video/fbdev/neofb.c +++ b/drivers/video/fbdev/neofb.c @@ -2209,7 +2209,12 @@ static int __init neofb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("neofb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("neofb", &option)) return -ENODEV; neofb_setup(option); diff --git a/drivers/video/fbdev/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c index 329e2e8133c6..1960916098d4 100644 --- a/drivers/video/fbdev/nvidia/nvidia.c +++ b/drivers/video/fbdev/nvidia/nvidia.c @@ -1521,7 +1521,12 @@ static int nvidiafb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("nvidiafb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("nvidiafb", &option)) return -ENODEV; nvidiafb_setup(option); diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c index 17cda5765683..1f3df2055ff0 100644 --- a/drivers/video/fbdev/omap/omapfb_main.c +++ b/drivers/video/fbdev/omap/omapfb_main.c @@ -1447,7 +1447,7 @@ static int fbinfo_init(struct omapfb_device *fbdev, struct fb_info *info) info->fbops = &omapfb_ops; info->flags = FBINFO_FLAG_DEFAULT; - strncpy(fix->id, MODULE_NAME, sizeof(fix->id)); + strscpy(fix->id, MODULE_NAME, sizeof(fix->id)); info->pseudo_palette = fbdev->pseudo_palette; @@ -1573,8 +1573,7 @@ static int omapfb_find_ctrl(struct omapfb_device *fbdev) fbdev->ctrl = NULL; - strncpy(name, conf->lcd.ctrl_name, sizeof(name) - 1); - name[sizeof(name) - 1] = '\0'; + strscpy(name, conf->lcd.ctrl_name, sizeof(name)); if (strcmp(name, "internal") == 0) { fbdev->ctrl = fbdev->int_ctrl; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c index a9fd732f8103..0daaf9f89bab 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c @@ -12,7 +12,6 @@ #include <linux/of.h> #include <video/omapfb_dss.h> -#include <video/omap-panel-data.h> struct panel_drv_data { struct omap_dss_device dssdev; @@ -178,53 +177,15 @@ static struct omap_dss_driver tvc_driver = { .set_wss = tvc_set_wss, }; -static int tvc_probe_pdata(struct platform_device *pdev) -{ - struct panel_drv_data *ddata = platform_get_drvdata(pdev); - struct connector_atv_platform_data *pdata; - struct omap_dss_device *in, *dssdev; - - pdata = dev_get_platdata(&pdev->dev); - - in = omap_dss_find_output(pdata->source); - if (in == NULL) { - dev_err(&pdev->dev, "Failed to find video source\n"); - return -EPROBE_DEFER; - } - - ddata->in = in; - - ddata->invert_polarity = pdata->invert_polarity; - - dssdev = &ddata->dssdev; - dssdev->name = pdata->name; - - return 0; -} - -static int tvc_probe_of(struct platform_device *pdev) -{ - struct panel_drv_data *ddata = platform_get_drvdata(pdev); - struct device_node *node = pdev->dev.of_node; - struct omap_dss_device *in; - - in = omapdss_of_find_source_for_first_ep(node); - if (IS_ERR(in)) { - dev_err(&pdev->dev, "failed to find video source\n"); - return PTR_ERR(in); - } - - ddata->in = in; - - return 0; -} - static int tvc_probe(struct platform_device *pdev) { struct panel_drv_data *ddata; struct omap_dss_device *dssdev; int r; + if (!pdev->dev.of_node) + return -ENODEV; + ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) return -ENOMEM; @@ -232,16 +193,11 @@ static int tvc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ddata); ddata->dev = &pdev->dev; - if (dev_get_platdata(&pdev->dev)) { - r = tvc_probe_pdata(pdev); - if (r) - return r; - } else if (pdev->dev.of_node) { - r = tvc_probe_of(pdev); - if (r) - return r; - } else { - return -ENODEV; + ddata->in = omapdss_of_find_source_for_first_ep(pdev->dev.of_node); + r = PTR_ERR_OR_ZERO(ddata->in); + if (r) { + dev_err(&pdev->dev, "failed to find video source\n"); + return r; } ddata->timings = tvc_pal_timings; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c index 670b9c6eb5a9..8f9ff9fb4ca4 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-hdmi.c @@ -6,11 +6,12 @@ * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> */ +#include <linux/err.h> +#include <linux/gpio/consumer.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/of.h> -#include <linux/of_gpio.h> #include <drm/drm_edid.h> @@ -41,7 +42,7 @@ struct panel_drv_data { struct omap_video_timings timings; - int hpd_gpio; + struct gpio_desc *hpd_gpio; }; #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) @@ -155,8 +156,8 @@ static bool hdmic_detect(struct omap_dss_device *dssdev) struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; - if (gpio_is_valid(ddata->hpd_gpio)) - return gpio_get_value_cansleep(ddata->hpd_gpio); + if (ddata->hpd_gpio) + return gpiod_get_value_cansleep(ddata->hpd_gpio); else return in->ops.hdmi->detect(in); } @@ -197,31 +198,6 @@ static struct omap_dss_driver hdmic_driver = { .set_hdmi_infoframe = hdmic_set_infoframe, }; -static int hdmic_probe_of(struct platform_device *pdev) -{ - struct panel_drv_data *ddata = platform_get_drvdata(pdev); - struct device_node *node = pdev->dev.of_node; - struct omap_dss_device *in; - int gpio; - - /* HPD GPIO */ - gpio = of_get_named_gpio(node, "hpd-gpios", 0); - if (gpio_is_valid(gpio)) - ddata->hpd_gpio = gpio; - else - ddata->hpd_gpio = -ENODEV; - - in = omapdss_of_find_source_for_first_ep(node); - if (IS_ERR(in)) { - dev_err(&pdev->dev, "failed to find video source\n"); - return PTR_ERR(in); - } - - ddata->in = in; - - return 0; -} - static int hdmic_probe(struct platform_device *pdev) { struct panel_drv_data *ddata; @@ -238,15 +214,18 @@ static int hdmic_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ddata); ddata->dev = &pdev->dev; - r = hdmic_probe_of(pdev); + ddata->hpd_gpio = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN); + r = PTR_ERR_OR_ZERO(ddata->hpd_gpio); if (r) return r; - if (gpio_is_valid(ddata->hpd_gpio)) { - r = devm_gpio_request_one(&pdev->dev, ddata->hpd_gpio, - GPIOF_DIR_IN, "hdmi_hpd"); - if (r) - goto err_reg; + gpiod_set_consumer_name(ddata->hpd_gpio, "hdmi_hpd"); + + ddata->in = omapdss_of_find_source_for_first_ep(pdev->dev.of_node); + r = PTR_ERR_OR_ZERO(ddata->in); + if (r) { + dev_err(&pdev->dev, "failed to find video source\n"); + return r; } ddata->timings = hdmic_default_timings; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c b/drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c index ba7ed4039f8a..dd29dc5c77ec 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/encoder-opa362.c @@ -11,11 +11,11 @@ * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> */ -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/slab.h> -#include <linux/of_gpio.h> #include <video/omapfb_dss.h> diff --git a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410.c b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410.c index 09a59bd93d61..7bac420169a6 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tfp410.c @@ -6,11 +6,12 @@ * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> */ -#include <linux/gpio.h> +#include <linux/err.h> +#include <linux/gpio/consumer.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/slab.h> -#include <linux/of_gpio.h> #include <video/omapfb_dss.h> @@ -18,7 +19,8 @@ struct panel_drv_data { struct omap_dss_device dssdev; struct omap_dss_device *in; - int pd_gpio; + struct gpio_desc *pd_gpio; + int data_lines; struct omap_video_timings timings; @@ -86,8 +88,8 @@ static int tfp410_enable(struct omap_dss_device *dssdev) if (r) return r; - if (gpio_is_valid(ddata->pd_gpio)) - gpio_set_value_cansleep(ddata->pd_gpio, 1); + if (ddata->pd_gpio) + gpiod_set_value_cansleep(ddata->pd_gpio, 0); dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; @@ -102,8 +104,8 @@ static void tfp410_disable(struct omap_dss_device *dssdev) if (!omapdss_device_is_enabled(dssdev)) return; - if (gpio_is_valid(ddata->pd_gpio)) - gpio_set_value_cansleep(ddata->pd_gpio, 0); + if (ddata->pd_gpio) + gpiod_set_value_cansleep(ddata->pd_gpio, 1); in->ops.dpi->disable(in); @@ -162,33 +164,6 @@ static const struct omapdss_dvi_ops tfp410_dvi_ops = { .get_timings = tfp410_get_timings, }; -static int tfp410_probe_of(struct platform_device *pdev) -{ - struct panel_drv_data *ddata = platform_get_drvdata(pdev); - struct device_node *node = pdev->dev.of_node; - struct omap_dss_device *in; - int gpio; - - gpio = of_get_named_gpio(node, "powerdown-gpios", 0); - - if (gpio_is_valid(gpio) || gpio == -ENOENT) { - ddata->pd_gpio = gpio; - } else { - dev_err(&pdev->dev, "failed to parse PD gpio\n"); - return gpio; - } - - in = omapdss_of_find_source_for_first_ep(node); - if (IS_ERR(in)) { - dev_err(&pdev->dev, "failed to find video source\n"); - return PTR_ERR(in); - } - - ddata->in = in; - - return 0; -} - static int tfp410_probe(struct platform_device *pdev) { struct panel_drv_data *ddata; @@ -204,18 +179,21 @@ static int tfp410_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ddata); - r = tfp410_probe_of(pdev); - if (r) + ddata->pd_gpio = devm_gpiod_get_optional(&pdev->dev, "powerdown", + GPIOD_OUT_HIGH); + r = PTR_ERR_OR_ZERO(ddata->pd_gpio); + if (r) { + dev_err(&pdev->dev, "Failed to request PD GPIO: %d\n", r); return r; + } + + gpiod_set_consumer_name(ddata->pd_gpio, "tfp410 PD"); - if (gpio_is_valid(ddata->pd_gpio)) { - r = devm_gpio_request_one(&pdev->dev, ddata->pd_gpio, - GPIOF_OUT_INIT_LOW, "tfp410 PD"); - if (r) { - dev_err(&pdev->dev, "Failed to request PD GPIO %d\n", - ddata->pd_gpio); - goto err_gpio; - } + ddata->in = omapdss_of_find_source_for_first_ep(pdev->dev.of_node); + r = PTR_ERR_OR_ZERO(ddata->in); + if (r) { + dev_err(&pdev->dev, "failed to find video source: %d\n", r); + return r; } dssdev = &ddata->dssdev; @@ -235,7 +213,6 @@ static int tfp410_probe(struct platform_device *pdev) return 0; err_reg: -err_gpio: omap_dss_put_device(ddata->in); return r; } diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dpi.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dpi.c index ff3d1e8e1e7b..9790053c5877 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dpi.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dpi.c @@ -6,15 +6,13 @@ * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> */ -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/of.h> -#include <linux/of_gpio.h> #include <video/omapfb_dss.h> -#include <video/omap-panel-data.h> #include <video/of_display_timing.h> struct panel_drv_data { @@ -25,9 +23,6 @@ struct panel_drv_data { struct omap_video_timings videomode; - /* used for non-DT boot, to be removed */ - int backlight_gpio; - struct gpio_desc *enable_gpio; }; @@ -77,9 +72,6 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev) gpiod_set_value_cansleep(ddata->enable_gpio, 1); - if (gpio_is_valid(ddata->backlight_gpio)) - gpio_set_value_cansleep(ddata->backlight_gpio, 1); - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; return 0; @@ -93,9 +85,6 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev) if (!omapdss_device_is_enabled(dssdev)) return; - if (gpio_is_valid(ddata->backlight_gpio)) - gpio_set_value_cansleep(ddata->backlight_gpio, 0); - gpiod_set_value_cansleep(ddata->enable_gpio, 0); in->ops.dpi->disable(in); @@ -146,49 +135,6 @@ static struct omap_dss_driver panel_dpi_ops = { .get_resolution = omapdss_default_get_resolution, }; -static int panel_dpi_probe_pdata(struct platform_device *pdev) -{ - const struct panel_dpi_platform_data *pdata; - struct panel_drv_data *ddata = platform_get_drvdata(pdev); - struct omap_dss_device *dssdev, *in; - struct videomode vm; - int r; - - pdata = dev_get_platdata(&pdev->dev); - - in = omap_dss_find_output(pdata->source); - if (in == NULL) { - dev_err(&pdev->dev, "failed to find video source '%s'\n", - pdata->source); - return -EPROBE_DEFER; - } - - ddata->in = in; - - ddata->data_lines = pdata->data_lines; - - videomode_from_timing(pdata->display_timing, &vm); - videomode_to_omap_video_timings(&vm, &ddata->videomode); - - dssdev = &ddata->dssdev; - dssdev->name = pdata->name; - - r = devm_gpio_request_one(&pdev->dev, pdata->enable_gpio, - GPIOF_OUT_INIT_LOW, "panel enable"); - if (r) - goto err_gpio; - - ddata->enable_gpio = gpio_to_desc(pdata->enable_gpio); - - ddata->backlight_gpio = pdata->backlight_gpio; - - return 0; - -err_gpio: - omap_dss_put_device(ddata->in); - return r; -} - static int panel_dpi_probe_of(struct platform_device *pdev) { struct panel_drv_data *ddata = platform_get_drvdata(pdev); @@ -205,8 +151,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev) ddata->enable_gpio = gpio; - ddata->backlight_gpio = -ENOENT; - r = of_get_display_timing(node, "panel-timing", &timing); if (r) { dev_err(&pdev->dev, "failed to get video timing\n"); @@ -233,30 +177,18 @@ static int panel_dpi_probe(struct platform_device *pdev) struct omap_dss_device *dssdev; int r; + if (!pdev->dev.of_node) + return -ENODEV; + ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); if (ddata == NULL) return -ENOMEM; platform_set_drvdata(pdev, ddata); - if (dev_get_platdata(&pdev->dev)) { - r = panel_dpi_probe_pdata(pdev); - if (r) - return r; - } else if (pdev->dev.of_node) { - r = panel_dpi_probe_of(pdev); - if (r) - return r; - } else { - return -ENODEV; - } - - if (gpio_is_valid(ddata->backlight_gpio)) { - r = devm_gpio_request_one(&pdev->dev, ddata->backlight_gpio, - GPIOF_OUT_INIT_LOW, "panel backlight"); - if (r) - goto err_gpio; - } + r = panel_dpi_probe_of(pdev); + if (r) + return r; dssdev = &ddata->dssdev; dssdev->dev = &pdev->dev; @@ -275,7 +207,6 @@ static int panel_dpi_probe(struct platform_device *pdev) return 0; err_reg: -err_gpio: omap_dss_put_device(ddata->in); return r; } diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c index a2c7c5cb1523..4fc4b26a8d30 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c @@ -10,8 +10,9 @@ #include <linux/backlight.h> #include <linux/delay.h> +#include <linux/err.h> #include <linux/fb.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/jiffies.h> #include <linux/module.h> @@ -20,7 +21,6 @@ #include <linux/slab.h> #include <linux/workqueue.h> #include <linux/of_device.h> -#include <linux/of_gpio.h> #include <video/omapfb_dss.h> #include <video/mipi_display.h> @@ -53,8 +53,8 @@ struct panel_drv_data { unsigned long hw_guard_wait; /* max guard time in jiffies */ /* panel HW configuration from DT or platform data */ - int reset_gpio; - int ext_te_gpio; + struct gpio_desc *reset_gpio; + struct gpio_desc *ext_te_gpio; bool use_dsi_backlight; @@ -250,8 +250,8 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata) if (r) goto err; - if (gpio_is_valid(ddata->ext_te_gpio)) - disable_irq(gpio_to_irq(ddata->ext_te_gpio)); + if (ddata->ext_te_gpio) + disable_irq(gpiod_to_irq(ddata->ext_te_gpio)); in->ops.dsi->disable(in, false, true); @@ -292,8 +292,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata) goto err2; } - if (gpio_is_valid(ddata->ext_te_gpio)) - enable_irq(gpio_to_irq(ddata->ext_te_gpio)); + if (ddata->ext_te_gpio) + enable_irq(gpiod_to_irq(ddata->ext_te_gpio)); dsicm_queue_ulps_work(ddata); @@ -306,8 +306,8 @@ err2: r = dsicm_panel_reset(ddata); if (!r) { - if (gpio_is_valid(ddata->ext_te_gpio)) - enable_irq(gpio_to_irq(ddata->ext_te_gpio)); + if (ddata->ext_te_gpio) + enable_irq(gpiod_to_irq(ddata->ext_te_gpio)); ddata->ulps_enabled = false; } err1: @@ -556,16 +556,19 @@ static const struct attribute_group dsicm_attr_group = { static void dsicm_hw_reset(struct panel_drv_data *ddata) { - if (!gpio_is_valid(ddata->reset_gpio)) - return; - - gpio_set_value(ddata->reset_gpio, 1); + /* + * Note that we appear to activate the reset line here. However + * existing DTSes specified incorrect polarity for it (active high), + * so in fact this deasserts the reset line. + */ + gpiod_set_value_cansleep(ddata->reset_gpio, 1); udelay(10); /* reset the panel */ - gpio_set_value(ddata->reset_gpio, 0); - /* assert reset */ + gpiod_set_value_cansleep(ddata->reset_gpio, 0); + /* keep reset asserted */ udelay(10); - gpio_set_value(ddata->reset_gpio, 1); + /* release reset line */ + gpiod_set_value_cansleep(ddata->reset_gpio, 1); /* wait after releasing reset */ usleep_range(5000, 10000); } @@ -886,7 +889,7 @@ static int dsicm_update(struct omap_dss_device *dssdev, if (r) goto err; - if (ddata->te_enabled && gpio_is_valid(ddata->ext_te_gpio)) { + if (ddata->te_enabled && ddata->ext_te_gpio) { schedule_delayed_work(&ddata->te_timeout_work, msecs_to_jiffies(250)); atomic_set(&ddata->do_update, 1); @@ -933,7 +936,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable) else r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_TEAR_OFF); - if (!gpio_is_valid(ddata->ext_te_gpio)) + if (!ddata->ext_te_gpio) in->ops.dsi->enable_te(in, enable); /* possible panel bug */ @@ -1115,41 +1118,6 @@ static struct omap_dss_driver dsicm_ops = { .memory_read = dsicm_memory_read, }; -static int dsicm_probe_of(struct platform_device *pdev) -{ - struct device_node *node = pdev->dev.of_node; - struct panel_drv_data *ddata = platform_get_drvdata(pdev); - struct omap_dss_device *in; - int gpio; - - gpio = of_get_named_gpio(node, "reset-gpios", 0); - if (!gpio_is_valid(gpio)) { - dev_err(&pdev->dev, "failed to parse reset gpio\n"); - return gpio; - } - ddata->reset_gpio = gpio; - - gpio = of_get_named_gpio(node, "te-gpios", 0); - if (gpio_is_valid(gpio) || gpio == -ENOENT) { - ddata->ext_te_gpio = gpio; - } else { - dev_err(&pdev->dev, "failed to parse TE gpio\n"); - return gpio; - } - - in = omapdss_of_find_source_for_first_ep(node); - if (IS_ERR(in)) { - dev_err(&pdev->dev, "failed to find video source\n"); - return PTR_ERR(in); - } - - ddata->in = in; - - /* TODO: ulps, backlight */ - - return 0; -} - static int dsicm_probe(struct platform_device *pdev) { struct backlight_properties props; @@ -1171,9 +1139,12 @@ static int dsicm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ddata); ddata->pdev = pdev; - r = dsicm_probe_of(pdev); - if (r) + ddata->in = omapdss_of_find_source_for_first_ep(pdev->dev.of_node); + r = PTR_ERR_OR_ZERO(ddata->in); + if (r) { + dev_err(&pdev->dev, "failed to find video source: %d\n", r); return r; + } ddata->timings.x_res = 864; ddata->timings.y_res = 480; @@ -1200,24 +1171,27 @@ static int dsicm_probe(struct platform_device *pdev) atomic_set(&ddata->do_update, 0); - if (gpio_is_valid(ddata->reset_gpio)) { - r = devm_gpio_request_one(dev, ddata->reset_gpio, - GPIOF_OUT_INIT_LOW, "taal rst"); - if (r) { - dev_err(dev, "failed to request reset gpio\n"); - return r; - } + ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW); + r = PTR_ERR_OR_ZERO(ddata->reset_gpio); + if (r) { + dev_err(&pdev->dev, "Failed to request reset gpio: %d\n", r); + return r; } - if (gpio_is_valid(ddata->ext_te_gpio)) { - r = devm_gpio_request_one(dev, ddata->ext_te_gpio, - GPIOF_IN, "taal irq"); - if (r) { - dev_err(dev, "GPIO request failed\n"); - return r; - } + gpiod_set_consumer_name(ddata->reset_gpio, "taal rst"); + + ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te", + GPIOD_IN); + r = PTR_ERR_OR_ZERO(ddata->ext_te_gpio); + if (r) { + dev_err(&pdev->dev, "Failed to request TE gpio: %d\n", r); + return r; + } + + if (ddata->ext_te_gpio) { + gpiod_set_consumer_name(ddata->ext_te_gpio, "taal irq"); - r = devm_request_irq(dev, gpio_to_irq(ddata->ext_te_gpio), + r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio), dsicm_te_isr, IRQF_TRIGGER_RISING, "taal vsync", ddata); diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c index 3ce1f9d2e7c4..e69856cb62d5 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c @@ -11,7 +11,7 @@ #include <linux/delay.h> #include <linux/spi/spi.h> #include <linux/mutex.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <video/omapfb_dss.h> @@ -46,9 +46,6 @@ struct panel_drv_data { struct omap_video_timings videomode; - /* used for non-DT boot, to be removed */ - int backlight_gpio; - struct gpio_desc *enable_gpio; }; @@ -166,9 +163,6 @@ static int lb035q02_enable(struct omap_dss_device *dssdev) if (ddata->enable_gpio) gpiod_set_value_cansleep(ddata->enable_gpio, 1); - if (gpio_is_valid(ddata->backlight_gpio)) - gpio_set_value_cansleep(ddata->backlight_gpio, 1); - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; return 0; @@ -185,9 +179,6 @@ static void lb035q02_disable(struct omap_dss_device *dssdev) if (ddata->enable_gpio) gpiod_set_value_cansleep(ddata->enable_gpio, 0); - if (gpio_is_valid(ddata->backlight_gpio)) - gpio_set_value_cansleep(ddata->backlight_gpio, 0); - in->ops.dpi->disable(in); dssdev->state = OMAP_DSS_DISPLAY_DISABLED; @@ -250,8 +241,6 @@ static int lb035q02_probe_of(struct spi_device *spi) ddata->enable_gpio = gpio; - ddata->backlight_gpio = -ENOENT; - in = omapdss_of_find_source_for_first_ep(node); if (IS_ERR(in)) { dev_err(&spi->dev, "failed to find video source\n"); @@ -284,13 +273,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) if (r) return r; - if (gpio_is_valid(ddata->backlight_gpio)) { - r = devm_gpio_request_one(&spi->dev, ddata->backlight_gpio, - GPIOF_OUT_INIT_LOW, "panel backlight"); - if (r) - goto err_gpio; - } - ddata->videomode = lb035q02_timings; dssdev = &ddata->dssdev; @@ -310,7 +292,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) return 0; err_reg: -err_gpio: omap_dss_put_device(ddata->in); return r; } diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-nec-nl8048hl11.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-nec-nl8048hl11.c index b407173e27b1..33563953b2ff 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-nec-nl8048hl11.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-nec-nl8048hl11.c @@ -7,12 +7,12 @@ * Converted to new DSS device model: Tomi Valkeinen <tomi.valkeinen@ti.com> */ -#include <linux/module.h> #include <linux/delay.h> -#include <linux/spi/spi.h> +#include <linux/err.h> #include <linux/fb.h> -#include <linux/gpio.h> -#include <linux/of_gpio.h> +#include <linux/gpio/consumer.h> +#include <linux/module.h> +#include <linux/spi/spi.h> #include <video/omapfb_dss.h> @@ -24,8 +24,7 @@ struct panel_drv_data { int data_lines; - int res_gpio; - int qvga_gpio; + struct gpio_desc *res_gpio; struct spi_device *spi; }; @@ -155,8 +154,8 @@ static int nec_8048_enable(struct omap_dss_device *dssdev) if (r) return r; - if (gpio_is_valid(ddata->res_gpio)) - gpio_set_value_cansleep(ddata->res_gpio, 1); + /* Apparently existing DTSes use incorrect polarity (active high) */ + gpiod_set_value_cansleep(ddata->res_gpio, 1); dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; @@ -171,8 +170,8 @@ static void nec_8048_disable(struct omap_dss_device *dssdev) if (!omapdss_device_is_enabled(dssdev)) return; - if (gpio_is_valid(ddata->res_gpio)) - gpio_set_value_cansleep(ddata->res_gpio, 0); + /* Apparently existing DTSes use incorrect polarity (active high) */ + gpiod_set_value_cansleep(ddata->res_gpio, 0); in->ops.dpi->disable(in); @@ -222,35 +221,6 @@ static struct omap_dss_driver nec_8048_ops = { .get_resolution = omapdss_default_get_resolution, }; - -static int nec_8048_probe_of(struct spi_device *spi) -{ - struct device_node *node = spi->dev.of_node; - struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); - struct omap_dss_device *in; - int gpio; - - gpio = of_get_named_gpio(node, "reset-gpios", 0); - if (!gpio_is_valid(gpio)) { - dev_err(&spi->dev, "failed to parse enable gpio\n"); - return gpio; - } - ddata->res_gpio = gpio; - - /* XXX the panel spec doesn't mention any QVGA pin?? */ - ddata->qvga_gpio = -ENOENT; - - in = omapdss_of_find_source_for_first_ep(node); - if (IS_ERR(in)) { - dev_err(&spi->dev, "failed to find video source\n"); - return PTR_ERR(in); - } - - ddata->in = in; - - return 0; -} - static int nec_8048_probe(struct spi_device *spi) { struct panel_drv_data *ddata; @@ -281,24 +251,22 @@ static int nec_8048_probe(struct spi_device *spi) ddata->spi = spi; - r = nec_8048_probe_of(spi); - if (r) + ddata->in = omapdss_of_find_source_for_first_ep(spi->dev.of_node); + r = PTR_ERR_OR_ZERO(ddata->in); + if (r) { + dev_err(&spi->dev, "failed to find video source: %d\n", r); return r; - - if (gpio_is_valid(ddata->qvga_gpio)) { - r = devm_gpio_request_one(&spi->dev, ddata->qvga_gpio, - GPIOF_OUT_INIT_HIGH, "lcd QVGA"); - if (r) - goto err_gpio; } - if (gpio_is_valid(ddata->res_gpio)) { - r = devm_gpio_request_one(&spi->dev, ddata->res_gpio, - GPIOF_OUT_INIT_LOW, "lcd RES"); - if (r) - goto err_gpio; + ddata->res_gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW); + r = PTR_ERR_OR_ZERO(ddata->res_gpio); + if (r) { + dev_err(&spi->dev, "failed to request reset gpio: %d\n", r); + goto err_gpio; } + gpiod_set_consumer_name(ddata->res_gpio, "lcd RES"); + ddata->videomode = nec_8048_panel_timings; dssdev = &ddata->dssdev; diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c index f1072c319de8..cc30758300e2 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c @@ -7,10 +7,9 @@ */ #include <linux/delay.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_gpio.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/regulator/consumer.h> diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c index c0965bee12c5..685c63aa4e03 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c @@ -18,12 +18,10 @@ #include <linux/sched.h> #include <linux/backlight.h> #include <linux/fb.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/of.h> -#include <linux/of_gpio.h> #include <video/omapfb_dss.h> -#include <video/omap-panel-data.h> #define MIPID_CMD_READ_DISP_ID 0x04 #define MIPID_CMD_READ_RED 0x06 @@ -57,7 +55,8 @@ struct panel_drv_data { struct omap_dss_device dssdev; struct omap_dss_device *in; - int reset_gpio; + struct gpio_desc *reset_gpio; + int datapairs; struct omap_video_timings videomode; @@ -546,8 +545,13 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) /*FIXME tweak me */ msleep(50); - if (gpio_is_valid(ddata->reset_gpio)) - gpio_set_value(ddata->reset_gpio, 1); + /* + * Note that we appear to activate the reset line here. However + * existing DTSes specified incorrect polarity for it (active high), + * so in fact this deasserts the reset line. + */ + if (ddata->reset_gpio) + gpiod_set_value_cansleep(ddata->reset_gpio, 1); if (ddata->enabled) { dev_dbg(&ddata->spi->dev, "panel already enabled\n"); @@ -596,8 +600,9 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev) */ msleep(50); - if (gpio_is_valid(ddata->reset_gpio)) - gpio_set_value(ddata->reset_gpio, 0); + /* see comment in acx565akm_panel_power_on() */ + if (ddata->reset_gpio) + gpiod_set_value_cansleep(ddata->reset_gpio, 0); /* FIXME need to tweak this delay */ msleep(100); @@ -688,48 +693,6 @@ static struct omap_dss_driver acx565akm_ops = { .get_resolution = omapdss_default_get_resolution, }; -static int acx565akm_probe_pdata(struct spi_device *spi) -{ - const struct panel_acx565akm_platform_data *pdata; - struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); - struct omap_dss_device *dssdev, *in; - - pdata = dev_get_platdata(&spi->dev); - - ddata->reset_gpio = pdata->reset_gpio; - - in = omap_dss_find_output(pdata->source); - if (in == NULL) { - dev_err(&spi->dev, "failed to find video source '%s'\n", - pdata->source); - return -EPROBE_DEFER; - } - ddata->in = in; - - ddata->datapairs = pdata->datapairs; - - dssdev = &ddata->dssdev; - dssdev->name = pdata->name; - - return 0; -} - -static int acx565akm_probe_of(struct spi_device *spi) -{ - struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); - struct device_node *np = spi->dev.of_node; - - ddata->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); - - ddata->in = omapdss_of_find_source_for_first_ep(np); - if (IS_ERR(ddata->in)) { - dev_err(&spi->dev, "failed to find video source\n"); - return PTR_ERR(ddata->in); - } - - return 0; -} - static int acx565akm_probe(struct spi_device *spi) { struct panel_drv_data *ddata; @@ -741,6 +704,9 @@ static int acx565akm_probe(struct spi_device *spi) dev_dbg(&spi->dev, "%s\n", __func__); + if (!spi->dev.of_node) + return -ENODEV; + spi->mode = SPI_MODE_3; ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); @@ -753,28 +719,25 @@ static int acx565akm_probe(struct spi_device *spi) mutex_init(&ddata->mutex); - if (dev_get_platdata(&spi->dev)) { - r = acx565akm_probe_pdata(spi); - if (r) - return r; - } else if (spi->dev.of_node) { - r = acx565akm_probe_of(spi); - if (r) - return r; - } else { - dev_err(&spi->dev, "platform data missing!\n"); - return -ENODEV; + ddata->in = omapdss_of_find_source_for_first_ep(spi->dev.of_node); + r = PTR_ERR_OR_ZERO(ddata->in); + if (r) { + dev_err(&spi->dev, "failed to find video source\n"); + return r; } - if (gpio_is_valid(ddata->reset_gpio)) { - r = devm_gpio_request_one(&spi->dev, ddata->reset_gpio, - GPIOF_OUT_INIT_LOW, "lcd reset"); - if (r) - goto err_gpio; - } + ddata->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", + GPIOD_OUT_LOW); + r = PTR_ERR_OR_ZERO(ddata->reset_gpio); + if (r) + goto err_gpio; - if (gpio_is_valid(ddata->reset_gpio)) - gpio_set_value(ddata->reset_gpio, 1); + if (ddata->reset_gpio) { + gpiod_set_consumer_name(ddata->reset_gpio, "lcd reset"); + + /* release the reset line */ + gpiod_set_value_cansleep(ddata->reset_gpio, 1); + } /* * After reset we have to wait 5 msec before the first @@ -786,8 +749,8 @@ static int acx565akm_probe(struct spi_device *spi) r = panel_detect(ddata); - if (!ddata->enabled && gpio_is_valid(ddata->reset_gpio)) - gpio_set_value(ddata->reset_gpio, 0); + if (!ddata->enabled && ddata->reset_gpio) + gpiod_set_value_cansleep(ddata->reset_gpio, 0); if (r) { dev_err(&spi->dev, "%s panel detect error\n", __func__); diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c index 3c0f887d3092..c18d290693c1 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c @@ -16,7 +16,6 @@ #include <linux/module.h> #include <linux/delay.h> #include <linux/spi/spi.h> -#include <linux/gpio.h> #include <video/omapfb_dss.h> struct panel_drv_data { diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c index c0e4e0315b6b..1eaa35c27835 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c @@ -10,10 +10,9 @@ #include <linux/delay.h> #include <linux/spi/spi.h> #include <linux/regulator/consumer.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/err.h> #include <linux/slab.h> -#include <linux/of_gpio.h> #include <video/omapfb_dss.h> @@ -58,7 +57,7 @@ struct panel_drv_data { struct spi_device *spi; struct regulator *vcc_reg; - int nreset_gpio; + struct gpio_desc *reset_gpio; u16 gamma[12]; u32 mode; u32 hmirror:1; @@ -296,8 +295,7 @@ static int tpo_td043_power_on(struct panel_drv_data *ddata) /* wait for panel to stabilize */ msleep(160); - if (gpio_is_valid(ddata->nreset_gpio)) - gpio_set_value(ddata->nreset_gpio, 1); + gpiod_set_value_cansleep(ddata->reset_gpio, 0); tpo_td043_write(ddata->spi, 2, TPO_R02_MODE(ddata->mode) | TPO_R02_NCLK_RISING); @@ -320,8 +318,7 @@ static void tpo_td043_power_off(struct panel_drv_data *ddata) tpo_td043_write(ddata->spi, 3, TPO_R03_VAL_STANDBY | TPO_R03_EN_PWM); - if (gpio_is_valid(ddata->nreset_gpio)) - gpio_set_value(ddata->nreset_gpio, 0); + gpiod_set_value_cansleep(ddata->reset_gpio, 1); /* wait for at least 2 vsyncs before cutting off power */ msleep(50); @@ -454,32 +451,6 @@ static struct omap_dss_driver tpo_td043_ops = { .get_resolution = omapdss_default_get_resolution, }; - -static int tpo_td043_probe_of(struct spi_device *spi) -{ - struct device_node *node = spi->dev.of_node; - struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); - struct omap_dss_device *in; - int gpio; - - gpio = of_get_named_gpio(node, "reset-gpios", 0); - if (!gpio_is_valid(gpio)) { - dev_err(&spi->dev, "failed to parse enable gpio\n"); - return gpio; - } - ddata->nreset_gpio = gpio; - - in = omapdss_of_find_source_for_first_ep(node); - if (IS_ERR(in)) { - dev_err(&spi->dev, "failed to find video source\n"); - return PTR_ERR(in); - } - - ddata->in = in; - - return 0; -} - static int tpo_td043_probe(struct spi_device *spi) { struct panel_drv_data *ddata; @@ -508,9 +479,12 @@ static int tpo_td043_probe(struct spi_device *spi) ddata->spi = spi; - r = tpo_td043_probe_of(spi); - if (r) + ddata->in = omapdss_of_find_source_for_first_ep(spi->dev.of_node); + r = PTR_ERR_OR_ZERO(ddata->in); + if (r) { + dev_err(&spi->dev, "failed to find video source: %d\n", r); return r; + } ddata->mode = TPO_R02_MODE_800x480; memcpy(ddata->gamma, tpo_td043_def_gamma, sizeof(ddata->gamma)); @@ -521,16 +495,15 @@ static int tpo_td043_probe(struct spi_device *spi) goto err_regulator; } - if (gpio_is_valid(ddata->nreset_gpio)) { - r = devm_gpio_request_one(&spi->dev, - ddata->nreset_gpio, GPIOF_OUT_INIT_LOW, - "lcd reset"); - if (r < 0) { - dev_err(&spi->dev, "couldn't request reset GPIO\n"); - goto err_gpio_req; - } + ddata->reset_gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_HIGH); + r = PTR_ERR_OR_ZERO(ddata->reset_gpio); + if (r) { + dev_err(&spi->dev, "couldn't request reset GPIO\n"); + goto err_gpio_req; } + gpiod_set_consumer_name(ddata->reset_gpio, "lcd reset"); + r = sysfs_create_group(&spi->dev.kobj, &tpo_td043_attr_group); if (r) { dev_err(&spi->dev, "failed to create sysfs files\n"); diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c index 54b0f034c2ed..7cddb7b8ae34 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c @@ -1536,22 +1536,28 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, { struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); unsigned long flags; - struct dsi_irq_stats stats; + struct dsi_irq_stats *stats; + + stats = kzalloc(sizeof(*stats), GFP_KERNEL); + if (!stats) { + seq_printf(s, "out of memory\n"); + return; + } spin_lock_irqsave(&dsi->irq_stats_lock, flags); - stats = dsi->irq_stats; + *stats = dsi->irq_stats; memset(&dsi->irq_stats, 0, sizeof(dsi->irq_stats)); dsi->irq_stats.last_reset = jiffies; spin_unlock_irqrestore(&dsi->irq_stats_lock, flags); seq_printf(s, "period %u ms\n", - jiffies_to_msecs(jiffies - stats.last_reset)); + jiffies_to_msecs(jiffies - stats->last_reset)); - seq_printf(s, "irqs %d\n", stats.irq_count); + seq_printf(s, "irqs %d\n", stats->irq_count); #define PIS(x) \ - seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]) + seq_printf(s, "%-20s %10d\n", #x, stats->dsi_irqs[ffs(DSI_IRQ_##x)-1]) seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1); PIS(VC0); @@ -1575,10 +1581,10 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, #define PIS(x) \ seq_printf(s, "%-20s %10d %10d %10d %10d\n", #x, \ - stats.vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \ - stats.vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \ - stats.vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \ - stats.vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]); + stats->vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \ + stats->vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \ + stats->vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \ + stats->vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]); seq_printf(s, "-- VC interrupts --\n"); PIS(CS); @@ -1594,7 +1600,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, #define PIS(x) \ seq_printf(s, "%-20s %10d\n", #x, \ - stats.cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]); + stats->cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]); seq_printf(s, "-- CIO interrupts --\n"); PIS(ERRSYNCESC1); @@ -1618,6 +1624,8 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, PIS(ULPSACTIVENOT_ALL0); PIS(ULPSACTIVENOT_ALL1); #undef PIS + + kfree(stats); } static void dsi1_dump_irqs(struct seq_file *s) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c index cb63bc0e92ca..b33f62c5cb22 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c @@ -129,7 +129,6 @@ static int hdmi_core_ddc_edid(struct hdmi_core_data *core, u8 *pedid, u8 ext) { void __iomem *base = core->base; u8 cur_addr; - char checksum = 0; const int retries = 1000; u8 seg_ptr = ext / 2; u8 edidbase = ((ext % 2) * 0x80); @@ -178,7 +177,6 @@ static int hdmi_core_ddc_edid(struct hdmi_core_data *core, u8 *pedid, u8 ext) } pedid[cur_addr] = REG_GET(base, HDMI_CORE_I2CM_DATAI, 7, 0); - checksum += pedid[cur_addr]; } return 0; diff --git a/drivers/video/fbdev/pm2fb.c b/drivers/video/fbdev/pm2fb.c index 7da715d31a93..47d212944f30 100644 --- a/drivers/video/fbdev/pm2fb.c +++ b/drivers/video/fbdev/pm2fb.c @@ -1533,8 +1533,10 @@ static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id) } info = framebuffer_alloc(sizeof(struct pm2fb_par), &pdev->dev); - if (!info) - return -ENOMEM; + if (!info) { + err = -ENOMEM; + goto err_exit_disable; + } default_par = info->par; switch (pdev->device) { @@ -1715,6 +1717,8 @@ static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id) release_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len); err_exit_neither: framebuffer_release(info); + err_exit_disable: + pci_disable_device(pdev); return retval; } @@ -1739,6 +1743,7 @@ static void pm2fb_remove(struct pci_dev *pdev) fb_dealloc_cmap(&info->cmap); kfree(info->pixmap.addr); framebuffer_release(info); + pci_disable_device(pdev); } static const struct pci_device_id pm2fb_id_table[] = { @@ -1799,7 +1804,12 @@ static int __init pm2fb_init(void) { #ifndef MODULE char *option = NULL; +#endif + if (fb_modesetting_disabled("pm2fb")) + return -ENODEV; + +#ifndef MODULE if (fb_get_options("pm2fb", &option)) return -ENODEV; pm2fb_setup(option); diff --git a/drivers/video/fbdev/pm3fb.c b/drivers/video/fbdev/pm3fb.c index ba69846d444f..b46a471df9ae 100644 --- a/drivers/video/fbdev/pm3fb.c +++ b/drivers/video/fbdev/pm3fb.c @@ -1540,7 +1540,12 @@ static int __init pm3fb_init(void) */ #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("pm3fb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("pm3fb", &option)) return -ENODEV; pm3fb_setup(option); diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c index b73ad14efa20..6888127a5eb8 100644 --- a/drivers/video/fbdev/pvr2fb.c +++ b/drivers/video/fbdev/pvr2fb.c @@ -1082,7 +1082,12 @@ static int __init pvr2fb_init(void) #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("pvr2fb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("pvr2fb", &option)) return -ENODEV; pvr2fb_setup(option); diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index 696ac5431180..c46ed78298ae 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2327,7 +2327,6 @@ static int pxafb_probe(struct platform_device *dev) irq = platform_get_irq(dev, 0); if (irq < 0) { - dev_err(&dev->dev, "no IRQ defined\n"); ret = -ENODEV; goto failed_free_mem; } diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c index 0ea74e28f915..644278146d3b 100644 --- a/drivers/video/fbdev/riva/fbdev.c +++ b/drivers/video/fbdev/riva/fbdev.c @@ -2165,7 +2165,12 @@ static int rivafb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("rivafb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("rivafb", &option)) return -ENODEV; rivafb_setup(option); diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c index 7713274bd04c..7d257489edcc 100644 --- a/drivers/video/fbdev/s3fb.c +++ b/drivers/video/fbdev/s3fb.c @@ -1558,7 +1558,12 @@ static int __init s3fb_init(void) #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("s3fb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("s3fb", &option)) return -ENODEV; s3fb_setup(option); diff --git a/drivers/video/fbdev/savage/savagefb_driver.c b/drivers/video/fbdev/savage/savagefb_driver.c index b7818b652698..4a27b68798bf 100644 --- a/drivers/video/fbdev/savage/savagefb_driver.c +++ b/drivers/video/fbdev/savage/savagefb_driver.c @@ -2556,6 +2556,9 @@ static int __init savagefb_init(void) DBG("savagefb_init"); + if (fb_modesetting_disabled("savagefb")) + return -ENODEV; + if (fb_get_options("savagefb", &option)) return -ENODEV; diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 6d00893d41f4..ad9323ed8e2e 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -1188,7 +1188,7 @@ overlay_alpha_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->alpha); + return sysfs_emit(buf, "%u\n", ovl->alpha); } static ssize_t @@ -1226,7 +1226,7 @@ overlay_mode_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->mode); + return sysfs_emit(buf, "%u\n", ovl->mode); } static ssize_t @@ -1265,7 +1265,7 @@ overlay_position_show(struct device *dev, struct device_attribute *attr, struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%d,%d\n", ovl->pos_x, ovl->pos_y); + return sysfs_emit(buf, "%d,%d\n", ovl->pos_x, ovl->pos_y); } static ssize_t @@ -1306,7 +1306,7 @@ overlay_rop3_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->rop3); + return sysfs_emit(buf, "%u\n", ovl->rop3); } static ssize_t diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index 1c197c3f9538..cfba776afcea 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -6588,7 +6588,12 @@ static int __init sisfb_init(void) { #ifndef MODULE char *options = NULL; +#endif + + if (fb_modesetting_disabled("sisfb")) + return -ENODEV; +#ifndef MODULE if(fb_get_options("sisfb", &options)) return -ENODEV; diff --git a/drivers/video/fbdev/skeletonfb.c b/drivers/video/fbdev/skeletonfb.c index a10f1057293b..40c130ab6b38 100644 --- a/drivers/video/fbdev/skeletonfb.c +++ b/drivers/video/fbdev/skeletonfb.c @@ -987,7 +987,12 @@ static int __init xxxfb_init(void) */ #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("xxxfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("xxxfb", &option)) return -ENODEV; xxxfb_setup(option); diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c index 3baf33635e65..b528776c7612 100644 --- a/drivers/video/fbdev/sm712fb.c +++ b/drivers/video/fbdev/sm712fb.c @@ -1756,6 +1756,9 @@ static int __init sm712fb_init(void) { char *option = NULL; + if (fb_modesetting_disabled("sm712fb")) + return -ENODEV; + if (fb_get_options("sm712fb", &option)) return -ENODEV; if (option && *option) diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c index 9343b7a4ac89..2ad6e98ce10d 100644 --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -1622,7 +1622,7 @@ static int ufx_usb_probe(struct usb_interface *interface, struct usb_device *usbdev; struct ufx_data *dev; struct fb_info *info; - int retval; + int retval = -ENOMEM; u32 id_rev, fpga_rev; /* usb initialization */ @@ -1654,15 +1654,17 @@ static int ufx_usb_probe(struct usb_interface *interface, if (!ufx_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) { dev_err(dev->gdev, "ufx_alloc_urb_list failed\n"); - goto e_nomem; + goto put_ref; } /* We don't register a new USB class. Our client interface is fbdev */ /* allocates framebuffer driver structure, not framebuffer memory */ info = framebuffer_alloc(0, &usbdev->dev); - if (!info) - goto e_nomem; + if (!info) { + dev_err(dev->gdev, "framebuffer_alloc failed\n"); + goto free_urb_list; + } dev->info = info; info->par = dev; @@ -1705,22 +1707,34 @@ static int ufx_usb_probe(struct usb_interface *interface, check_warn_goto_error(retval, "unable to find common mode for display and adapter"); retval = ufx_reg_set_bits(dev, 0x4000, 0x00000001); - check_warn_goto_error(retval, "error %d enabling graphics engine", retval); + if (retval < 0) { + dev_err(dev->gdev, "error %d enabling graphics engine", retval); + goto setup_modes; + } /* ready to begin using device */ atomic_set(&dev->usb_active, 1); dev_dbg(dev->gdev, "checking var"); retval = ufx_ops_check_var(&info->var, info); - check_warn_goto_error(retval, "error %d ufx_ops_check_var", retval); + if (retval < 0) { + dev_err(dev->gdev, "error %d ufx_ops_check_var", retval); + goto reset_active; + } dev_dbg(dev->gdev, "setting par"); retval = ufx_ops_set_par(info); - check_warn_goto_error(retval, "error %d ufx_ops_set_par", retval); + if (retval < 0) { + dev_err(dev->gdev, "error %d ufx_ops_set_par", retval); + goto reset_active; + } dev_dbg(dev->gdev, "registering framebuffer"); retval = register_framebuffer(info); - check_warn_goto_error(retval, "error %d register_framebuffer", retval); + if (retval < 0) { + dev_err(dev->gdev, "error %d register_framebuffer", retval); + goto reset_active; + } dev_info(dev->gdev, "SMSC UDX USB device /dev/fb%d attached. %dx%d resolution." " Using %dK framebuffer memory\n", info->node, @@ -1728,21 +1742,23 @@ static int ufx_usb_probe(struct usb_interface *interface, return 0; -error: - fb_dealloc_cmap(&info->cmap); -destroy_modedb: +reset_active: + atomic_set(&dev->usb_active, 0); +setup_modes: fb_destroy_modedb(info->monspecs.modedb); vfree(info->screen_base); fb_destroy_modelist(&info->modelist); +error: + fb_dealloc_cmap(&info->cmap); +destroy_modedb: framebuffer_release(info); +free_urb_list: + if (dev->urbs.count > 0) + ufx_free_urb_list(dev); put_ref: kref_put(&dev->kref, ufx_free); /* ref for framebuffer */ kref_put(&dev->kref, ufx_free); /* last ref from kref_init */ return retval; - -e_nomem: - retval = -ENOMEM; - goto put_ref; } static void ufx_usb_disconnect(struct usb_interface *interface) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 5c891aa00d59..046b9990d27c 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -803,10 +803,8 @@ static int ssd1307fb_probe(struct i2c_client *client) bl_init_error: unregister_framebuffer(info); panel_init_error: - if (par->device_info->need_pwm) { - pwm_disable(par->pwm); - pwm_put(par->pwm); - } + pwm_disable(par->pwm); + pwm_put(par->pwm); regulator_enable_error: if (par->vbat_reg) regulator_disable(par->vbat_reg); @@ -827,10 +825,8 @@ static void ssd1307fb_remove(struct i2c_client *client) backlight_device_unregister(info->bl_dev); unregister_framebuffer(info); - if (par->device_info->need_pwm) { - pwm_disable(par->pwm); - pwm_put(par->pwm); - } + pwm_disable(par->pwm); + pwm_put(par->pwm); if (par->vbat_reg) regulator_disable(par->vbat_reg); fb_deferred_io_cleanup(info); diff --git a/drivers/video/fbdev/sstfb.c b/drivers/video/fbdev/sstfb.c index a56b24288566..da296b2ab54a 100644 --- a/drivers/video/fbdev/sstfb.c +++ b/drivers/video/fbdev/sstfb.c @@ -1503,6 +1503,9 @@ static int sstfb_init(void) { char *option = NULL; + if (fb_modesetting_disabled("sstfb")) + return -ENODEV; + if (fb_get_options("sstfb", &option)) return -ENODEV; sstfb_setup(option); diff --git a/drivers/video/fbdev/sunxvr2500.c b/drivers/video/fbdev/sunxvr2500.c index f4059529c602..2cab4b9be68a 100644 --- a/drivers/video/fbdev/sunxvr2500.c +++ b/drivers/video/fbdev/sunxvr2500.c @@ -247,6 +247,9 @@ static struct pci_driver s3d_driver = { static int __init s3d_init(void) { + if (fb_modesetting_disabled("s3d")) + return -ENODEV; + if (fb_get_options("s3d", NULL)) return -ENODEV; diff --git a/drivers/video/fbdev/sunxvr500.c b/drivers/video/fbdev/sunxvr500.c index b0c8cf0c535a..6ec358af1256 100644 --- a/drivers/video/fbdev/sunxvr500.c +++ b/drivers/video/fbdev/sunxvr500.c @@ -430,6 +430,9 @@ static struct pci_driver e3d_driver = { static int __init e3d_init(void) { + if (fb_modesetting_disabled("e3d")) + return -ENODEV; + if (fb_get_options("e3d", NULL)) return -ENODEV; diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c index 592a913d0718..d17e5e1472aa 100644 --- a/drivers/video/fbdev/tdfxfb.c +++ b/drivers/video/fbdev/tdfxfb.c @@ -1632,7 +1632,12 @@ static int __init tdfxfb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("tdfxfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("tdfxfb", &option)) return -ENODEV; diff --git a/drivers/video/fbdev/tgafb.c b/drivers/video/fbdev/tgafb.c index 251dbd282f5e..14d37c49633c 100644 --- a/drivers/video/fbdev/tgafb.c +++ b/drivers/video/fbdev/tgafb.c @@ -1597,7 +1597,12 @@ static int tgafb_init(void) int status; #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("tgafb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("tgafb", &option)) return -ENODEV; tgafb_setup(option); diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c index 219ce7292337..6099b9768ba1 100644 --- a/drivers/video/fbdev/tridentfb.c +++ b/drivers/video/fbdev/tridentfb.c @@ -1811,7 +1811,12 @@ static int __init tridentfb_init(void) { #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("tridentfb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("tridentfb", &option)) return -ENODEV; tridentfb_setup(option); diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c index 00d789b6c0fa..f09f483c219b 100644 --- a/drivers/video/fbdev/uvesafb.c +++ b/drivers/video/fbdev/uvesafb.c @@ -1580,7 +1580,7 @@ static ssize_t uvesafb_show_vendor(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_vendor_name_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (&par->vbe_ib) + par->vbe_ib.oem_vendor_name_ptr); else return 0; @@ -1595,7 +1595,7 @@ static ssize_t uvesafb_show_product_name(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_product_name_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (&par->vbe_ib) + par->vbe_ib.oem_product_name_ptr); else return 0; @@ -1610,7 +1610,7 @@ static ssize_t uvesafb_show_product_rev(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_product_rev_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (&par->vbe_ib) + par->vbe_ib.oem_product_rev_ptr); else return 0; @@ -1625,7 +1625,7 @@ static ssize_t uvesafb_show_oem_string(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_string_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", + return sysfs_emit(buf, "%s\n", (char *)(&par->vbe_ib) + par->vbe_ib.oem_string_ptr); else return 0; @@ -1639,7 +1639,7 @@ static ssize_t uvesafb_show_nocrtc(struct device *dev, struct fb_info *info = dev_get_drvdata(dev); struct uvesafb_par *par = info->par; - return scnprintf(buf, PAGE_SIZE, "%d\n", par->nocrtc); + return sysfs_emit(buf, "%d\n", par->nocrtc); } static ssize_t uvesafb_store_nocrtc(struct device *dev, @@ -1758,6 +1758,7 @@ static int uvesafb_probe(struct platform_device *dev) out_unmap: iounmap(info->screen_base); out_mem: + arch_phys_wc_del(par->mtrr_handle); release_mem_region(info->fix.smem_start, info->fix.smem_len); out_reg: release_region(0x3c0, 32); @@ -1776,25 +1777,23 @@ out: static int uvesafb_remove(struct platform_device *dev) { struct fb_info *info = platform_get_drvdata(dev); + struct uvesafb_par *par = info->par; - if (info) { - struct uvesafb_par *par = info->par; + sysfs_remove_group(&dev->dev.kobj, &uvesafb_dev_attgrp); + unregister_framebuffer(info); + release_region(0x3c0, 32); + iounmap(info->screen_base); + arch_phys_wc_del(par->mtrr_handle); + release_mem_region(info->fix.smem_start, info->fix.smem_len); + fb_destroy_modedb(info->monspecs.modedb); + fb_dealloc_cmap(&info->cmap); - sysfs_remove_group(&dev->dev.kobj, &uvesafb_dev_attgrp); - unregister_framebuffer(info); - release_region(0x3c0, 32); - iounmap(info->screen_base); - arch_phys_wc_del(par->mtrr_handle); - release_mem_region(info->fix.smem_start, info->fix.smem_len); - fb_destroy_modedb(info->monspecs.modedb); - fb_dealloc_cmap(&info->cmap); + kfree(par->vbe_modes); + kfree(par->vbe_state_orig); + kfree(par->vbe_state_saved); - kfree(par->vbe_modes); - kfree(par->vbe_state_orig); - kfree(par->vbe_state_saved); + framebuffer_release(info); - framebuffer_release(info); - } return 0; } diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c index 82b36dbb5b1a..0374ee6b6d03 100644 --- a/drivers/video/fbdev/vermilion/vermilion.c +++ b/drivers/video/fbdev/vermilion/vermilion.c @@ -278,8 +278,10 @@ static int vmlfb_get_gpu(struct vml_par *par) mutex_unlock(&vml_mutex); - if (pci_enable_device(par->gpu) < 0) + if (pci_enable_device(par->gpu) < 0) { + pci_dev_put(par->gpu); return -ENODEV; + } return 0; } @@ -1057,7 +1059,12 @@ static int __init vmlfb_init(void) #ifndef MODULE char *option = NULL; +#endif + if (fb_modesetting_disabled("vmlfb")) + return -ENODEV; + +#ifndef MODULE if (fb_get_options(MODULE_NAME, &option)) return -ENODEV; #endif diff --git a/drivers/video/fbdev/via/via-core.c b/drivers/video/fbdev/via/via-core.c index 2ee8fcae08df..2c1803eb196f 100644 --- a/drivers/video/fbdev/via/via-core.c +++ b/drivers/video/fbdev/via/via-core.c @@ -725,12 +725,22 @@ static int __init via_core_init(void) { int ret; + if (fb_modesetting_disabled("viafb")) + return -ENODEV; + ret = viafb_init(); if (ret) return ret; viafb_i2c_init(); viafb_gpio_init(); - return pci_register_driver(&via_driver); + ret = pci_register_driver(&via_driver); + if (ret) { + viafb_gpio_exit(); + viafb_i2c_exit(); + return ret; + } + + return 0; } static void __exit via_core_exit(void) diff --git a/drivers/video/fbdev/vt8623fb.c b/drivers/video/fbdev/vt8623fb.c index 49b9f148d3a1..034333ee6e45 100644 --- a/drivers/video/fbdev/vt8623fb.c +++ b/drivers/video/fbdev/vt8623fb.c @@ -920,7 +920,12 @@ static int __init vt8623fb_init(void) #ifndef MODULE char *option = NULL; +#endif + + if (fb_modesetting_disabled("vt8623fb")) + return -ENODEV; +#ifndef MODULE if (fb_get_options("vt8623fb", &option)) return -ENODEV; diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c index ae8a50ecdbd3..d7f3e6281ce4 100644 --- a/drivers/video/fbdev/xen-fbfront.c +++ b/drivers/video/fbdev/xen-fbfront.c @@ -504,18 +504,14 @@ static void xenfb_make_preferred_console(void) if (console_set_on_cmdline) return; - console_lock(); + console_list_lock(); for_each_console(c) { if (!strcmp(c->name, "tty") && c->index == 0) break; } - console_unlock(); - if (c) { - unregister_console(c); - c->flags |= CON_CONSDEV; - c->flags &= ~CON_PRINTBUFFER; /* don't print again */ - register_console(c); - } + if (c) + console_force_preferred_locked(c); + console_list_unlock(); } static int xenfb_resume(struct xenbus_device *dev) diff --git a/drivers/video/nomodeset.c b/drivers/video/nomodeset.c new file mode 100644 index 000000000000..13cc8b719697 --- /dev/null +++ b/drivers/video/nomodeset.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <linux/module.h> +#include <linux/types.h> + +#include <video/nomodeset.h> + +static bool video_nomodeset; + +bool video_firmware_drivers_only(void) +{ + return video_nomodeset; +} +EXPORT_SYMBOL(video_firmware_drivers_only); + +static int __init disable_modeset(char *str) +{ + video_nomodeset = true; + + pr_warn("Booted with the nomodeset parameter. Only the system framebuffer will be available\n"); + + return 1; +} + +/* Disable kernel modesetting */ +__setup("nomodeset", disable_modeset); |