diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-06-29 10:20:38 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-06-29 10:20:38 -0700 |
commit | 675285ad819293844018aa8096ba9a6d7c77b90b (patch) | |
tree | 9cfbd3e4ca5457b041fcc99b9ad5c2f3d5d400e9 | |
parent | e5476f57b32621eb8eab892a908df4d0b4808835 (diff) | |
parent | c2d22806aecb24e2de55c30a06e5d6eb297d161d (diff) |
Merge tag 'fbdev-for-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev
Pull fbdev updates from Helge Deller:
"Some fbdev fixes & cleanups.
Includes is a fix for a potential out-of-bound memory access
in fast_imageblit() and the switch of the VIA fbdev driver to
use GPIO descriptors.
Summary:
- fix potential OOB read in fast_imageblit()
- fbdev/media: Use GPIO descriptors for VIA GPIO
- broadsheetfb & metronomefb: Add MODULE_FIRMWARE macro
- omapfb: error handling fix in mipid_spi_probe()
- sh_mobile_lcdcfb, sh7760fb: Typo and warning fixes
- hitfb: code cleanups"
* tag 'fbdev-for-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
fbdev: fix potential OOB read in fast_imageblit()
MAINTAINERS: adjust entry in VIA UNICHROME(PRO)/CHROME9 FRAMEBUFFER DRIVER
fbdev: sh7760fb: Fix -Wimplicit-fallthrough warnings
fbdev: sh_mobile_lcdcfb: Fix ARGB32 overlay format typo
fbdev: hitfb: Use NULL for pointers
fbdev: hitfb: Fix integer-to-pointer cast
fbdev/media: Use GPIO descriptors for VIA GPIO
video/hdmi: Reorder fields in 'struct hdmi_avi_infoframe'
fbdev: broadsheetfb: Add MODULE_FIRMWARE macro
fbdev: metronomefb: Add MODULE_FIRMWARE macro
fbdev: hitfb: Declare hitfb_blank() as static
fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe()
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | drivers/media/platform/via/via-camera.c | 51 | ||||
-rw-r--r-- | drivers/video/fbdev/broadsheetfb.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/core/sysimgblt.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/hitfb.c | 8 | ||||
-rw-r--r-- | drivers/video/fbdev/metronomefb.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/omap/lcd_mipid.c | 6 | ||||
-rw-r--r-- | drivers/video/fbdev/sh7760fb.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via-core.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via-gpio.c | 28 | ||||
-rw-r--r-- | drivers/video/fbdev/via/via-gpio.h (renamed from include/linux/via-gpio.h) | 1 | ||||
-rw-r--r-- | include/linux/hdmi.h | 4 |
13 files changed, 54 insertions, 57 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 11ed2b8aec2a..5e793e8f9157 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22277,7 +22277,6 @@ L: linux-fbdev@vger.kernel.org S: Maintained F: drivers/video/fbdev/via/ F: include/linux/via-core.h -F: include/linux/via-gpio.h F: include/linux/via_i2c.h VIA VELOCITY NETWORK DRIVER diff --git a/drivers/media/platform/via/via-camera.c b/drivers/media/platform/via/via-camera.c index 450254403fa8..4cb8f29e2f14 100644 --- a/drivers/media/platform/via/via-camera.c +++ b/drivers/media/platform/via/via-camera.c @@ -11,7 +11,7 @@ #include <linux/device.h> #include <linux/list.h> #include <linux/pci.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/videodev2.h> @@ -26,7 +26,6 @@ #include <linux/dma-mapping.h> #include <linux/pm_qos.h> #include <linux/via-core.h> -#include <linux/via-gpio.h> #include <linux/via_i2c.h> #ifdef CONFIG_X86 @@ -71,8 +70,8 @@ struct via_camera { /* * GPIO info for power/reset management */ - int power_gpio; - int reset_gpio; + struct gpio_desc *power_gpio; + struct gpio_desc *reset_gpio; /* * I/O memory stuff. */ @@ -180,27 +179,19 @@ static struct via_format *via_find_format(u32 pixelformat) */ static int via_sensor_power_setup(struct via_camera *cam) { - int ret; + struct device *dev = &cam->platdev->dev; + + cam->power_gpio = devm_gpiod_get(dev, "VGPIO3", GPIOD_OUT_LOW); + if (IS_ERR(cam->power_gpio)) + return dev_err_probe(dev, PTR_ERR(cam->power_gpio), + "failed to get power GPIO"); + + /* Request the reset line asserted */ + cam->reset_gpio = devm_gpiod_get(dev, "VGPIO2", GPIOD_OUT_HIGH); + if (IS_ERR(cam->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(cam->reset_gpio), + "failed to get reset GPIO"); - cam->power_gpio = viafb_gpio_lookup("VGPIO3"); - cam->reset_gpio = viafb_gpio_lookup("VGPIO2"); - if (!gpio_is_valid(cam->power_gpio) || !gpio_is_valid(cam->reset_gpio)) { - dev_err(&cam->platdev->dev, "Unable to find GPIO lines\n"); - return -EINVAL; - } - ret = gpio_request(cam->power_gpio, "viafb-camera"); - if (ret) { - dev_err(&cam->platdev->dev, "Unable to request power GPIO\n"); - return ret; - } - ret = gpio_request(cam->reset_gpio, "viafb-camera"); - if (ret) { - dev_err(&cam->platdev->dev, "Unable to request reset GPIO\n"); - gpio_free(cam->power_gpio); - return ret; - } - gpio_direction_output(cam->power_gpio, 0); - gpio_direction_output(cam->reset_gpio, 0); return 0; } @@ -209,25 +200,23 @@ static int via_sensor_power_setup(struct via_camera *cam) */ static void via_sensor_power_up(struct via_camera *cam) { - gpio_set_value(cam->power_gpio, 1); - gpio_set_value(cam->reset_gpio, 0); + gpiod_set_value(cam->power_gpio, 1); + gpiod_set_value(cam->reset_gpio, 1); msleep(20); /* Probably excessive */ - gpio_set_value(cam->reset_gpio, 1); + gpiod_set_value(cam->reset_gpio, 0); msleep(20); } static void via_sensor_power_down(struct via_camera *cam) { - gpio_set_value(cam->power_gpio, 0); - gpio_set_value(cam->reset_gpio, 0); + gpiod_set_value(cam->power_gpio, 0); + gpiod_set_value(cam->reset_gpio, 1); } static void via_sensor_power_release(struct via_camera *cam) { via_sensor_power_down(cam); - gpio_free(cam->power_gpio); - gpio_free(cam->reset_gpio); } /* --------------------------------------------------------------------------*/ diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c index b518cacbf7cd..678d182d187d 100644 --- a/drivers/video/fbdev/broadsheetfb.c +++ b/drivers/video/fbdev/broadsheetfb.c @@ -1223,3 +1223,5 @@ module_platform_driver(broadsheetfb_driver); MODULE_DESCRIPTION("fbdev driver for Broadsheet controller"); MODULE_AUTHOR("Jaya Kumar"); MODULE_LICENSE("GPL"); + +MODULE_FIRMWARE("broadsheet.wbf"); diff --git a/drivers/video/fbdev/core/sysimgblt.c b/drivers/video/fbdev/core/sysimgblt.c index 335e92b813fc..665ef7a0a249 100644 --- a/drivers/video/fbdev/core/sysimgblt.c +++ b/drivers/video/fbdev/core/sysimgblt.c @@ -189,7 +189,7 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p, u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel; u32 ppw = 32/bpp, spitch = (image->width + 7)/8; u32 bit_mask, eorx, shift; - const char *s = image->data, *src; + const u8 *s = image->data, *src; u32 *dst; const u32 *tab; size_t tablen; diff --git a/drivers/video/fbdev/hitfb.c b/drivers/video/fbdev/hitfb.c index 3033f5056976..5f544a177033 100644 --- a/drivers/video/fbdev/hitfb.c +++ b/drivers/video/fbdev/hitfb.c @@ -167,7 +167,7 @@ static int hitfb_pan_display(struct fb_var_screeninfo *var, return 0; } -int hitfb_blank(int blank_mode, struct fb_info *info) +static int hitfb_blank(int blank_mode, struct fb_info *info) { unsigned short v; @@ -392,7 +392,7 @@ static int hitfb_probe(struct platform_device *dev) info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA; - info->screen_base = (void *)hitfb_fix.smem_start; + info->screen_base = (char __iomem *)(uintptr_t)hitfb_fix.smem_start; ret = fb_alloc_cmap(&info->cmap, 256, 0); if (unlikely(ret < 0)) @@ -428,7 +428,7 @@ static int hitfb_suspend(struct device *dev) { u16 v; - hitfb_blank(1,0); + hitfb_blank(1, NULL); v = fb_readw(HD64461_STBCR); v |= HD64461_STBCR_SLCKE_IST; fb_writew(v, HD64461_STBCR); @@ -446,7 +446,7 @@ static int hitfb_resume(struct device *dev) v = fb_readw(HD64461_STBCR); v &= ~HD64461_STBCR_SLCKE_IST; fb_writew(v, HD64461_STBCR); - hitfb_blank(0,0); + hitfb_blank(0, NULL); return 0; } diff --git a/drivers/video/fbdev/metronomefb.c b/drivers/video/fbdev/metronomefb.c index bbdbf463f0c8..4e50882d080c 100644 --- a/drivers/video/fbdev/metronomefb.c +++ b/drivers/video/fbdev/metronomefb.c @@ -778,3 +778,5 @@ MODULE_PARM_DESC(user_wfm_size, "Set custom waveform size"); MODULE_DESCRIPTION("fbdev driver for Metronome controller"); MODULE_AUTHOR("Jaya Kumar"); MODULE_LICENSE("GPL"); + +MODULE_FIRMWARE("metronome.wbf"); diff --git a/drivers/video/fbdev/omap/lcd_mipid.c b/drivers/video/fbdev/omap/lcd_mipid.c index e4a7f0b824ff..a0fc4570403b 100644 --- a/drivers/video/fbdev/omap/lcd_mipid.c +++ b/drivers/video/fbdev/omap/lcd_mipid.c @@ -571,11 +571,15 @@ static int mipid_spi_probe(struct spi_device *spi) r = mipid_detect(md); if (r < 0) - return r; + goto free_md; omapfb_register_panel(&md->panel); return 0; + +free_md: + kfree(md); + return r; } static void mipid_spi_remove(struct spi_device *spi) diff --git a/drivers/video/fbdev/sh7760fb.c b/drivers/video/fbdev/sh7760fb.c index 768011bdb430..98c5227098a8 100644 --- a/drivers/video/fbdev/sh7760fb.c +++ b/drivers/video/fbdev/sh7760fb.c @@ -136,11 +136,13 @@ static int sh7760fb_get_color_info(struct device *dev, break; case LDDFR_4BPP_MONO: lgray = 1; + fallthrough; case LDDFR_4BPP: lbpp = 4; break; case LDDFR_6BPP_MONO: lgray = 1; + fallthrough; case LDDFR_8BPP: lbpp = 8; break; diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 093f035d1246..0adb2ba965e7 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -824,7 +824,7 @@ static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl) format |= LDBBSIFR_AL_1 | LDBBSIFR_RY | LDBBSIFR_RPKF_RGB24; break; case V4L2_PIX_FMT_BGR32: - format |= LDBBSIFR_AL_PK | LDBBSIFR_RY | LDDFR_PKF_ARGB32; + format |= LDBBSIFR_AL_PK | LDBBSIFR_RY | LDBBSIFR_RPKF_ARGB32; break; case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV21: diff --git a/drivers/video/fbdev/via/via-core.c b/drivers/video/fbdev/via/via-core.c index 2c1803eb196f..908524a74a38 100644 --- a/drivers/video/fbdev/via/via-core.c +++ b/drivers/video/fbdev/via/via-core.c @@ -11,7 +11,7 @@ #include <linux/aperture.h> #include <linux/via-core.h> #include <linux/via_i2c.h> -#include <linux/via-gpio.h> +#include "via-gpio.h" #include "global.h" #include <linux/module.h> diff --git a/drivers/video/fbdev/via/via-gpio.c b/drivers/video/fbdev/via/via-gpio.c index f1b670397c02..2719943c06f4 100644 --- a/drivers/video/fbdev/via/via-gpio.c +++ b/drivers/video/fbdev/via/via-gpio.c @@ -7,10 +7,11 @@ #include <linux/spinlock.h> #include <linux/gpio/driver.h> +#include <linux/gpio/machine.h> #include <linux/platform_device.h> #include <linux/via-core.h> -#include <linux/via-gpio.h> #include <linux/export.h> +#include "via-gpio.h" /* * The ports we know about. Note that the port-25 gpios are not @@ -189,19 +190,14 @@ static struct viafb_pm_hooks viafb_gpio_pm_hooks = { }; #endif /* CONFIG_PM */ -/* - * Look up a specific gpio and return the number it was assigned. - */ -int viafb_gpio_lookup(const char *name) -{ - int i; - - for (i = 0; i < viafb_gpio_config.gpio_chip.ngpio; i++) - if (!strcmp(name, viafb_gpio_config.active_gpios[i]->vg_name)) - return viafb_gpio_config.gpio_chip.base + i; - return -1; -} -EXPORT_SYMBOL_GPL(viafb_gpio_lookup); +static struct gpiod_lookup_table viafb_gpio_table = { + .dev_id = "viafb-camera", + .table = { + GPIO_LOOKUP("via-gpio", 2, "VGPIO2", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("via-gpio", 3, "VGPIO3", GPIO_ACTIVE_HIGH), + { } + }, +}; /* * Platform device stuff. @@ -249,12 +245,16 @@ static int viafb_gpio_probe(struct platform_device *platdev) * Get registered. */ viafb_gpio_config.gpio_chip.base = -1; /* Dynamic */ + viafb_gpio_config.gpio_chip.label = "via-gpio"; ret = gpiochip_add_data(&viafb_gpio_config.gpio_chip, &viafb_gpio_config); if (ret) { printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); viafb_gpio_config.gpio_chip.ngpio = 0; } + + gpiod_add_lookup_table(&viafb_gpio_table); + #ifdef CONFIG_PM viafb_pm_register(&viafb_gpio_pm_hooks); #endif diff --git a/include/linux/via-gpio.h b/drivers/video/fbdev/via/via-gpio.h index ac34668fd442..2ffedf282f7e 100644 --- a/include/linux/via-gpio.h +++ b/drivers/video/fbdev/via/via-gpio.h @@ -8,7 +8,6 @@ #ifndef __VIA_GPIO_H__ #define __VIA_GPIO_H__ -extern int viafb_gpio_lookup(const char *name); extern int viafb_gpio_init(void); extern void viafb_gpio_exit(void); #endif diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index 2f4dcc8d060e..3bb87bf6bc65 100644 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h @@ -170,19 +170,19 @@ struct hdmi_avi_infoframe { enum hdmi_infoframe_type type; unsigned char version; unsigned char length; + bool itc; + unsigned char pixel_repeat; enum hdmi_colorspace colorspace; enum hdmi_scan_mode scan_mode; enum hdmi_colorimetry colorimetry; enum hdmi_picture_aspect picture_aspect; enum hdmi_active_aspect active_aspect; - bool itc; enum hdmi_extended_colorimetry extended_colorimetry; enum hdmi_quantization_range quantization_range; enum hdmi_nups nups; unsigned char video_code; enum hdmi_ycc_quantization_range ycc_quantization_range; enum hdmi_content_type content_type; - unsigned char pixel_repeat; unsigned short top_bar; unsigned short bottom_bar; unsigned short left_bar; |