Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH v1] fbdev: Use named initializers for struct i2c_device_id
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-18 16:08 UTC (permalink / raw)
  To: Helge Deller
  Cc: Kees Cook, Abdun Nihaal, linux-fbdev, dri-devel, linux-kernel

While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

While touching all these arrays, unify usage of whitespace in the list
terminator.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
Hello,

this patch is part of a bigger quest to use named initializers for
mainly struct i2c_device_id::driver_data to be able to modify
i2c_device_id. See e.g.
https://lore.kernel.org/all/20260518111203.639603-2-u.kleine-koenig@baylibre.com/
for the details.

This patch here isn't critical for this quest, as no driver makes use of
.driver_data, so apart from the better readability this is only about
consistency with other subsystems.

Best regards
Uwe

 drivers/video/fbdev/matrox/matroxfb_maven.c | 2 +-
 drivers/video/fbdev/ssd1307fb.c             | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/matrox/matroxfb_maven.c b/drivers/video/fbdev/matrox/matroxfb_maven.c
index 2ea65da6075c..fe057a0b57ec 100644
--- a/drivers/video/fbdev/matrox/matroxfb_maven.c
+++ b/drivers/video/fbdev/matrox/matroxfb_maven.c
@@ -1282,7 +1282,7 @@ static void maven_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id maven_id[] = {
-	{ "maven" },
+	{ .name = "maven" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, maven_id);
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 83dd31fa1fab..644b8d97b381 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -784,10 +784,10 @@ static void ssd1307fb_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id ssd1307fb_i2c_id[] = {
-	{ "ssd1305fb" },
-	{ "ssd1306fb" },
-	{ "ssd1307fb" },
-	{ "ssd1309fb" },
+	{ .name = "ssd1305fb" },
+	{ .name = "ssd1306fb" },
+	{ .name = "ssd1307fb" },
+	{ .name = "ssd1309fb" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, ssd1307fb_i2c_id);

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3


^ permalink raw reply related

* Re: [PATCH] fbdev: chipsfb: add missing MODULE_DESCRIPTION() macro
From: Rahman Mahmutović @ 2026-05-18 16:14 UTC (permalink / raw)
  To: linux-fbdev; +Cc: deller, dri-devel, linux-kernel
In-Reply-To: <20260509131831.1073-1-mahmutovicrahman5@gmail.com>

Hi Helge,

Can you check my patches and let me know if any changes are needed?

Thanks,
Rahman Mahmutović

^ permalink raw reply

* Re: [PATCH] fbdev: sunxvr2500: replace printk with device-aware logging functions
From: Rahman Mahmutović @ 2026-05-18 16:15 UTC (permalink / raw)
  To: linux-fbdev; +Cc: deller, dri-devel, linux-kernel
In-Reply-To: <20260509135759.1391-1-mahmutovicrahman5@gmail.com>

Hi Helge,

Can you check my patches and let me know if any changes are needed?

Thanks,
Rahman Mahmutović

^ permalink raw reply

* fbdev: iterator used after loop end in fb_deferred_io_pageref_get?
From: Maoyi Xie @ 2026-05-18 19:04 UTC (permalink / raw)
  To: jayalk, simona, deller; +Cc: linux-fbdev, dri-devel, linux-kernel

Hi all,

While reading drivers/video/fbdev/core/fb_defio.c I noticed
something that looks like a past the end iterator pattern.
I would appreciate it if you could take a look and let me
know whether this is a real issue, and whether it is worth
fixing.

The site is fb_deferred_io_pageref_get() (linux-7.1-rc1,
around line 203):

    list_for_each_entry(cur, &fbdefio_state->pagereflist, list) {
            if (cur->offset > pageref->offset)
                    break;
    }
    pos = &cur->list;

When the loop walks all entries without break, cur has gone
one step past the last entry. &cur->list then aliases
&fbdefio_state->pagereflist (the list head) via container_of
offset cancellation, so pos equals the head and the
subsequent list_add_tail(&pageref->list, pos) lands at the
list tail. That is the intended behaviour, but the access
is undefined per C11.

Jakob Koschel cleaned up many such sites in 2022, for example
commits 99d8ae4ec8a (tracing: Remove usage of list iterator
variable after the loop), 2966a9918df (clockevents: Use dedicated
list iterator variable) and dc1acd5c946 (dlm: replace usage of
found with dedicated list iterator variable). This site in
fb_defio was not covered.

A candidate fix would move the pos = &cur->list assignment
inside the break arm, so pos is only overwritten when the
loop actually finds a position. The default value of pos
(set earlier in the function to &fbdefio_state->pagereflist)
already covers the loop fall through case. The observable
behaviour is unchanged.

If this is intentional or already known, please disregard.
Otherwise, I am happy to send a [PATCH] or to leave the fix
to you. Thank you for your time, and sorry for the noise if
this is not actually worth fixing or has already been spotted.

Thanks,
Maoyi Xie
https://maoyixie.com/

^ permalink raw reply

* [PATCH] fbdev: imxfb: Use of_device_get_match_data()
From: Rosen Penev @ 2026-05-18 21:13 UTC (permalink / raw)
  To: linux-fbdev
  Cc: Sascha Hauer, Pengutronix Kernel Team, Helge Deller, Frank Li,
	Fabio Estevam,
	moderated list:FREESCALE IMX / MXC FRAMEBUFFER DRIVER,
	open list:FRAMEBUFFER LAYER,
	open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE, open list

Use of_device_get_match_data() to fetch the platform ID entry directly
instead of open-coding an of_match_device() lookup. No NULL check is
needed as every compatible string has a corresponding data section.

This also lets the driver drop the of_device.h include.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/video/fbdev/imxfb.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index a077bf346bdf..7a021da0a32a 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -30,7 +30,6 @@
 #include <linux/lcd.h>
 #include <linux/math64.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/bitfield.h>

 #include <linux/regulator/consumer.h>
@@ -880,7 +879,6 @@ static int imxfb_probe(struct platform_device *pdev)
 	struct lcd_device *lcd;
 	struct fb_info *info;
 	struct imx_fb_videomode *m;
-	const struct of_device_id *of_id;
 	struct device_node *display_np;
 	int ret, i;
 	int bytes_per_pixel;
@@ -891,9 +889,7 @@ static int imxfb_probe(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;

-	of_id = of_match_device(imxfb_of_dev_id, &pdev->dev);
-	if (of_id)
-		pdev->id_entry = of_id->data;
+	pdev->id_entry = of_device_get_match_data(&pdev->dev);

 	info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev);
 	if (!info)
--
2.54.0


^ permalink raw reply related

* [PATCH] fbdev: atmel_lcdfb: Use of_device_get_match_data()
From: Rosen Penev @ 2026-05-19  0:36 UTC (permalink / raw)
  To: linux-fbdev
  Cc: Nicolas Ferre, Helge Deller, Alexandre Belloni, Claudiu Beznea,
	open list:FRAMEBUFFER LAYER,
	moderated list:ARM/Microchip (AT91) SoC support, open list

Use of_device_get_match_data() to retrieve the driver match data instead
of open-coding the OF match lookup and dereferencing match->data.

This also removes the deprecated of_device.h include from the driver.

No need for NULL check as every compatible has a corresponding data
component.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/video/fbdev/atmel_lcdfb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index 9dfbc5310210..87406a5a2dcf 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -21,7 +21,6 @@
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <video/of_videomode.h>
 #include <video/of_display_timing.h>
 #include <linux/regulator/consumer.h>
@@ -56,7 +55,7 @@ struct atmel_lcdfb_info {

 	struct atmel_lcdfb_pdata pdata;

-	struct atmel_lcdfb_config *config;
+	const struct atmel_lcdfb_config *config;
 	struct regulator	*reg_lcd;
 };

@@ -930,8 +929,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
 	int ret;
 	int i;

-	sinfo->config = (struct atmel_lcdfb_config*)
-		of_match_device(atmel_lcdfb_dt_ids, dev)->data;
+	sinfo->config = of_device_get_match_data(dev);

 	display_np = of_parse_phandle(np, "display", 0);
 	if (!display_np) {
--
2.54.0


^ permalink raw reply related

* Re: [PATCH] ARM: move Risc PC-specific <asm/hardware/iomd.h> header into mach-rpc
From: Helge Deller @ 2026-05-19  6:51 UTC (permalink / raw)
  To: Ethan Nelson-Moore, linux-arm-kernel, linux-i2c, linux-input,
	linux-fbdev
  Cc: Russell King, Andi Shyti, Dmitry Torokhov, Kees Cook
In-Reply-To: <20260510031100.255248-1-enelsonmoore@gmail.com>

On 5/10/26 05:10, Ethan Nelson-Moore wrote:
> The <asm/hardware/iomd.h> header is specific to the IOMD chip used on
> the Risc PC. Move it into mach-rpc to avoid polluting asm/hardware/
> with machine-specific headers.
> 
> Also take the opportunity to remove a comment with the file path from
> the header, which is bad style.
> 
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
> ---
>   MAINTAINERS                                                     | 1 -
>   arch/arm/mach-rpc/dma.c                                         | 2 +-
>   arch/arm/{include/asm/hardware => mach-rpc/include/mach}/iomd.h | 2 --
>   arch/arm/mach-rpc/irq.c                                         | 2 +-
>   arch/arm/mach-rpc/riscpc.c                                      | 2 +-
>   arch/arm/mach-rpc/time.c                                        | 2 +-
>   drivers/i2c/busses/i2c-acorn.c                                  | 2 +-
>   drivers/input/mouse/rpcmouse.c                                  | 2 +-
>   drivers/input/serio/rpckbd.c                                    | 2 +-

>   drivers/video/fbdev/acornfb.h                                   | 2 +-

Regarding the fbdev change:
Acked-by: Helge Deller <deller@gmx.de>

I assume this patch is pushed via the arm tree?

Helge

^ permalink raw reply

* Re: [PATCH] ARM: mach-rpc: fix zImage build after recent font-related changes
From: Helge Deller @ 2026-05-19  6:56 UTC (permalink / raw)
  To: Ethan Nelson-Moore, linux-arm-kernel, linux-fbdev
  Cc: Russell King, Thomas Zimmermann, Kees Cook
In-Reply-To: <20260510023941.190396-1-enelsonmoore@gmail.com>

On 5/10/26 04:39, Ethan Nelson-Moore wrote:
> The text display code used in the Risc PC kernel image decompression
> code uses arch/arm/boot/compressed/font.c, which includes
> lib/fonts/font_acorn_8x8.c, which further includes <linux/font.h>.
> 
> Since commit 97df8960240a ("lib/fonts: Provide helpers for calculating
> glyph pitch and size") <linux/font.h> contains inline functions that
> require __do_div64, which is not linked into the ARM kernel
> decompressor. This makes Risc PC zImages fail to build.
> 
> Resolve this issue in the least intrusive way possible by preventing
> the inclusion of <linux/font.h> (and the definition of a struct that
> relies on it) when the decompressor is being built.

I don't think we really require 64-bit integer support/division in the
font code, as 32-bit should be sufficient.
Can't you try to find out where this 64-bit division is done, and fix
this instead?

Helge


> Fixes: 97df8960240a ("lib/fonts: Provide helpers for calculating glyph pitch and size")
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
> ---
>   arch/arm/boot/compressed/Makefile | 6 +++++-
>   lib/fonts/font_acorn_8x8.c        | 2 ++
>   2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
> index a159120d1e42..0e198a6ce447 100644
> --- a/arch/arm/boot/compressed/Makefile
> +++ b/arch/arm/boot/compressed/Makefile
> @@ -157,4 +157,8 @@ $(obj)/piggy_data: $(obj)/../Image FORCE
>   
>   $(obj)/piggy.o: $(obj)/piggy_data
>   
> -CFLAGS_font.o := -Dstatic=
> +# Defining _VIDEO_FONT_H prevents including <linux/font.h>, which contains
> +# inline functions that require __do_div64, which is not linked into the
> +# decompressor. OMIT_FONT_DESC is used in lib/fonts/font_acorn_8x8.c to omit the
> +# definition of the font's font_desc structure, which requires <linux/font.h>.
> +CFLAGS_font.o := -Dstatic= -D_VIDEO_FONT_H -DOMIT_FONT_DESC
> diff --git a/lib/fonts/font_acorn_8x8.c b/lib/fonts/font_acorn_8x8.c
> index 36c51016769d..6b5291c23fc8 100644
> --- a/lib/fonts/font_acorn_8x8.c
> +++ b/lib/fonts/font_acorn_8x8.c
> @@ -265,6 +265,7 @@ static const struct font_data acorndata_8x8 = {
>   /* FF */  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
>   } };
>   
> +#ifndef OMIT_FONT_DESC /* Used by arch/arm/boot/compressed/Makefile */
>   const struct font_desc font_acorn_8x8 = {
>   	.idx	= ACORN8x8_IDX,
>   	.name	= "Acorn8x8",
> @@ -278,3 +279,4 @@ const struct font_desc font_acorn_8x8 = {
>   	.pref	= 0,
>   #endif
>   };
> +#endif /* OMIT_FONT_DESC */


^ permalink raw reply

* Re: [PATCH 00/14] fbdev: fix various memory leaks
From: Helge Deller @ 2026-05-19  7:11 UTC (permalink / raw)
  To: Abdun Nihaal, Javier Martinez Canillas, Thomas Zimmermann,
	Benjamin Herrenschmidt, Andrew Morton, Sebastian Siewior,
	Florian Tobias Schandinat, Ondrej Zary, Antonino Daplas,
	Paul Mundt, Krzysztof Helt, Tomi Valkeinen, Michal Januszewski,
	Heiko Schocher, Peter Jones
  Cc: linux-fbdev, dri-devel, linux-kernel, stable
In-Reply-To: <20260514-fbdev-v1-0-b3a2474fa720@cse.iitm.ac.in>

On 5/14/26 10:24, Abdun Nihaal wrote:
> This patchset fixes some memory leak issues present in fbdev drivers.
> 
> Since commit 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
> fb_deferred_io_init() allocated memory for pagerefs and returned an
> error code, but the existing drivers which call fb_deferred_io_init()
> were not updated to do cleanup. The first three commits address this.
> - fbdev: hecubafb: fix potential memory leak in hecubafb_probe()
> - fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe()
> - fbdev: metronomefb: fix potential memory leak in metronomefb_probe()
> 
> Probe functions that call fb_add_videomode() or fb_videomode_to_modelist()
> sometimes did not call fb_destry_modelist() to free the allocated
> memory. The following patches address this issue.
> - fbdev: radeon: fix potential memory leak in radeonfb_pci_register()
> - fbdev: carminefb: fix potential memory leak in alloc_carmine_fb()
> - fbdev: i740fb: fix potential memory leak in i740fb_probe()
> - fbdev: nvidia: fix potential memory leak in nvidiafb_probe()
> - fbdev: s3fb: fix potential memory leak in s3_pci_probe()
> - fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe()
> - fbdev: tridentfb: fix potential memory leak in trident_pci_probe()
> - fbdev: uvesafb: fix potential memory leak in uvesafb_probe()
> 
> Since commit 73ce73c30ba9 ("fbdev: Transfer video= option strings to caller; clarify ownership")
> the fb_get_options() function transfers ownership of the memory
> allocated for options, and so the caller is expected to free it. The
> following two patches address this issue.
> - fbdev: efifb: fix memory leak in efifb_probe()
> - fbdev: vesafb: fix memory leak in vesafb_probe()
> 
> The following commit fixes a simple memory leak.
> - fbdev: sm501fb: fix potential memory leak in sm501fb_probe()
> 
> All the patches were only compile tested.
> The issues were found using static analysis.
> 
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
> ---
> Abdun Nihaal (14):
>        fbdev: hecubafb: fix potential memory leak in hecubafb_probe()
>        fbdev: broadsheetfb: fix potential memory leak in broadsheetfb_probe()
>        fbdev: metronomefb: fix potential memory leak in metronomefb_probe()
>        fbdev: radeon: fix potential memory leak in radeonfb_pci_register()
>        fbdev: carminefb: fix potential memory leak in alloc_carmine_fb()
>        fbdev: i740fb: fix potential memory leak in i740fb_probe()
>        fbdev: nvidia: fix potential memory leak in nvidiafb_probe()
>        fbdev: s3fb: fix potential memory leak in s3_pci_probe()
>        fbdev: tdfxfb: fix potential memory leak in tdfxfb_probe()
>        fbdev: tridentfb: fix potential memory leak in trident_pci_probe()
>        fbdev: uvesafb: fix potential memory leak in uvesafb_probe()
>        fbdev: efifb: fix memory leak in efifb_probe()
>        fbdev: vesafb: fix memory leak in vesafb_probe()
>        fbdev: sm501fb: fix potential memory leak in sm501fb_probe()
> 
>   drivers/video/fbdev/aty/radeon_base.c | 1 +
>   drivers/video/fbdev/broadsheetfb.c    | 8 ++++++--
>   drivers/video/fbdev/carminefb.c       | 1 +
>   drivers/video/fbdev/efifb.c           | 1 +
>   drivers/video/fbdev/hecubafb.c        | 6 +++++-
>   drivers/video/fbdev/i740fb.c          | 1 +
>   drivers/video/fbdev/metronomefb.c     | 8 ++++++--
>   drivers/video/fbdev/nvidia/nvidia.c   | 1 +
>   drivers/video/fbdev/s3fb.c            | 1 +
>   drivers/video/fbdev/sm501fb.c         | 3 +++
>   drivers/video/fbdev/tdfxfb.c          | 1 +
>   drivers/video/fbdev/tridentfb.c       | 1 +
>   drivers/video/fbdev/uvesafb.c         | 4 ++--
>   drivers/video/fbdev/vesafb.c          | 1 +
>   14 files changed, 31 insertions(+), 7 deletions(-)
I applied the whole series to the fbdev git tree.
Thanks a lot !

Helge

^ permalink raw reply

* Re: [PATCH] fbcon: Use correct type for vc_resize() return value
From: Helge Deller @ 2026-05-19  7:18 UTC (permalink / raw)
  To: Jiacheng Yu; +Cc: dri-devel, linux-fbdev, linux-kernel
In-Reply-To: <40ec54e6-78fb-400f-bb10-c277287162fb@suse.de>

On 5/15/26 09:12, Thomas Zimmermann wrote:
> 
> 
> Am 14.05.26 um 11:19 schrieb Jiacheng Yu:
>> The return value of vc_resize() is int, but fbcon_set_disp() stores it
>> in an unsigned long variable. While the !ret check happens to work
>> correctly by coincidence (negative values become large positive values),
>> the types should match. Use int instead.
>>
>> Eliminates the following W=3 warning:
>>
>>    drivers/video/fbdev/core/fbcon.c: In function 'fbcon_set_disp':
>>    drivers/video/fbdev/core/fbcon.c:1494:14: warning: implicit conversion from 'int' to 'unsigned long' [-Wconversion]
>>
>> Fixes: af0db3c1f898 ("fbdev: Fix vmalloc out-of-bounds write in fast_imageblit")
>> Signed-off-by: Jiacheng Yu <yujiacheng3@huawei.com>
> 
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

applied to fbdev git tree.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbdev: chipsfb: add missing MODULE_DESCRIPTION() macro
From: Helge Deller @ 2026-05-19  7:34 UTC (permalink / raw)
  To: Rahman Mahmutović, linux-fbdev; +Cc: dri-devel, linux-kernel
In-Reply-To: <20260509131831.1073-1-mahmutovicrahman5@gmail.com>

On 5/9/26 15:18, Rahman Mahmutović wrote:
> The chipsfb driver is missing the MODULE_DESCRIPTION macro which
> is required for all kernel modules.
> 
> Assisted-by: Claude:claude-sonnet-4-6
> Signed-off-by: Rahman Mahmutović <mahmutovicrahman5@gmail.com>
> ---
>   drivers/video/fbdev/chipsfb.c | 1 +
>   1 file changed, 1 insertion(+)

applied.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH v1] fbdev: Use named initializers for struct i2c_device_id
From: Helge Deller @ 2026-05-19  7:28 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: linux-fbdev, dri-devel, linux-kernel
In-Reply-To: <20260518160808.802423-2-u.kleine-koenig@baylibre.com>

On 5/18/26 18:08, Uwe Kleine-König (The Capable Hub) wrote:
> While being less compact, using named initializers allows to more easily
> see which members of the structs are assigned which value without having
> to lookup the declaration of the struct. And it's also more robust
> against changes to the struct definition.
>
..
>   drivers/video/fbdev/matrox/matroxfb_maven.c | 2 +-
>   drivers/video/fbdev/ssd1307fb.c             | 8 ++++----
>   2 files changed, 5 insertions(+), 5 deletions(-)

applied to fbdev git tree.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbdev: sunxvr2500: replace printk with device-aware logging functions
From: Helge Deller @ 2026-05-19  7:40 UTC (permalink / raw)
  To: Rahman Mahmutović, linux-fbdev; +Cc: dri-devel, linux-kernel
In-Reply-To: <20260509135759.1391-1-mahmutovicrahman5@gmail.com>

On 5/9/26 15:57, Rahman Mahmutović wrote:
> Replace all printk() calls with appropriate device-aware logging
> functions to properly associate log messages with the PCI device.
> 
> - Use pci_err() for errors where struct pci_dev is available
> - Use pci_info() for info messages where struct pci_dev is available
> - Use dev_err() for errors where only struct fb_info is available
> 
> Remove redundant 's3d:' prefix and pci_name() calls as device-aware
> functions include device identification automatically.
> 
> Assisted-by: Claude:claude-sonnet-4-6
> Signed-off-by: Rahman Mahmutović <mahmutovicrahman5@gmail.com>
> ---
>   drivers/video/fbdev/sunxvr2500.c | 19 +++++++------------
>   1 file changed, 7 insertions(+), 12 deletions(-)

applied.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] video: fbdev: remove Hercules monochrome ISA graphics adapter driver
From: Helge Deller @ 2026-05-19  7:49 UTC (permalink / raw)
  To: Thomas Zimmermann, Ethan Nelson-Moore, linux-fbdev
In-Reply-To: <00b7e7f2-98e2-45af-b3c6-43140443cbe9@suse.de>

On 5/8/26 14:08, Thomas Zimmermann wrote:
> Am 03.05.26 um 06:56 schrieb Ethan Nelson-Moore:
>> The hgafb supports graphics adapters compatible with the Hercules
>> adapter from 1984. These were ISA cards or onboard devices that
>> supported monochrome 720x348 graphics. This driver was created in 1999
>> by Ferenc Bakonyi. In the entire Git history (since Linux 2.6.12-rc2),
>> there has only been one commit in 2010 which indicated that the driver
>> was in use, commit 529ed806d454 ("video: Fix the HGA framebuffer
>> driver"). The commit message states:
>>      Only tested with fbcon, since most fbdev-based software appears
>>      to only support 12bpp and up. It does not appear that this driver has
>>      worked for at least the entire 2.6.x series, perhaps since 2002.
>> Given the age and limited capabilities of the hardware and the lack of
>> users, remove this driver and move the former maintainer to CREDITS.
>>
>> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
applied to fbdev git tree.

This driver is now 27 years old, the card was developed 44 years ago,
and since we don't support i386 or i486 CPUs any longer, it's
really unlikely someone still uses this card.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbdev: imxfb: Use of_device_get_match_data()
From: Helge Deller @ 2026-05-19  7:52 UTC (permalink / raw)
  To: Rosen Penev, linux-fbdev
  Cc: Sascha Hauer, Pengutronix Kernel Team, Frank Li, Fabio Estevam,
	moderated list:FREESCALE IMX / MXC FRAMEBUFFER DRIVER,
	open list:FRAMEBUFFER LAYER,
	open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE, open list
In-Reply-To: <20260518211303.10777-1-rosenp@gmail.com>

On 5/18/26 23:13, Rosen Penev wrote:
> Use of_device_get_match_data() to fetch the platform ID entry directly
> instead of open-coding an of_match_device() lookup. No NULL check is
> needed as every compatible string has a corresponding data section.
> 
> This also lets the driver drop the of_device.h include.
> 
> Assisted-by: Codex:GPT-5.5
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>   drivers/video/fbdev/imxfb.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)

applied.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbcon: don't suspend/resume when vc is graphics mode
From: Helge Deller @ 2026-05-19  8:10 UTC (permalink / raw)
  To: yaolu, tzimmermann, simona; +Cc: dri-devel, linux-fbdev, linux-kernel
In-Reply-To: <20260430060137.131107-1-yaolu@kylinos.cn>

Hello Lu,

On 4/30/26 08:01, yaolu@kylinos.cn wrote:
> From: Lu Yao <yaolu@kylinos.cn>
> 
> Don't need to do suspend/resume for fbcon in graphic mode.
> 
> Doing this may cause error, eg:
>    At the beginning, starting the Xorg with single screen and then an
>    external screen was plugged in. After logging out in Xorg, fbdev
>    info may using screen which is connected later on for info always
>    using first connected connector in list in func 'drm_setup_crtcs_fb'.
>    Then, S3 executed, fbcon found that the information did not match
>    and do atomic to switch fb. However, Xorg will not re-bind the crtc
>    fb but continues doing ioctl. At this time, the fb is incorrect.


Do you still have the possibility to test this issue?

  
> Signed-off-by: Lu Yao <yaolu@kylinos.cn>
> ---
>   drivers/video/fbdev/core/fbcon.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index b0e3e765360d..450e690d0bd2 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2602,8 +2602,9 @@ void fbcon_suspended(struct fb_info *info)
>   		return;
>   	vc = vc_cons[par->currcon].d;
>   
> -	/* Clear cursor, restore saved data */
> -	fbcon_cursor(vc, false);
> +	/* Don't need to clear cursor and restore saved data in graphic mode */
> +	if (vc->vc_mode != KD_GRAPHICS)
> +		fbcon_cursor(vc, false);

I think checking for "== KD_TEXT" is probably better.
And, maybe using con_is_visible(vc).
So:

+	if (con_is_visible(vc) && (vc->vc_mode == KD_TEXT))
+		fbcon_cursor(vc, false);


>   void fbcon_resumed(struct fb_info *info)
> @@ -2615,7 +2616,9 @@ void fbcon_resumed(struct fb_info *info)
>   		return;
>   	vc = vc_cons[par->currcon].d;
>   
> -	update_screen(vc);
> +	/* Graphics mode is managed by userspace */
> +	if (vc->vc_mode != KD_GRAPHICS)

here the same check as above... ?

Helge

^ permalink raw reply

* Re: [PATCH v2 2/2] backlight: Add SY7758 6-channel High Efficiency LED Driver support
From: Neil Armstrong @ 2026-05-19  8:14 UTC (permalink / raw)
  To: Daniel Thompson
  Cc: Lee Jones, Jingoo Han, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Helge Deller, dri-devel,
	linux-leds, devicetree, linux-kernel, linux-fbdev, KancyJoe
In-Reply-To: <agdJnpz9O00lywRm@aspen.lan>

Hi,

On 5/15/26 18:28, Daniel Thompson wrote:
> On Thu, Apr 30, 2026 at 11:47:16AM +0200, Neil Armstrong wrote:
>> From: KancyJoe <kancy2333@outlook.com>
>>
>> Implement support for the Silergy SY7758 6-channel High Efficiency LED
>> Driver used for backlight brightness control in the Ayaneo Pocket S2
>> dual-DSI panel.
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> Signed-off-by: KancyJoe <kancy2333@outlook.com>
>> ---
>>   drivers/video/backlight/Kconfig  |   8 +
>>   drivers/video/backlight/Makefile |   1 +
>>   drivers/video/backlight/sy7758.c | 311 +++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 320 insertions(+)
>> <snip>
>> diff --git a/drivers/video/backlight/sy7758.c b/drivers/video/backlight/sy7758.c
>> new file mode 100644
>> index 000000000000..9b2d3bbb4ded
>> --- /dev/null
>> +++ b/drivers/video/backlight/sy7758.c
>> @@ -0,0 +1,311 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * Silergy SY7758 6-channel High Efficiency LED Driver
>> + *
>> + * Copyright (C) 2025 Kancy Joe <kancy2333@outlook.com>
>> + * Copyright (C) 2026 Linaro Limited
>> + * Author: Neil Armstrong <neil.armstrong@linaro.org>
> 
> I'm a bit confused by this comment. The git author and the
> MODULE_AUTHOR() is Kancy Joe. What does this comment signify?

I'll fix this in v3

> 
> 
>> + */
>> <snip>
>> +/* OTP memory */
>> +#define REG_OTP_CFG98 0x98
>> +#define REG_OTP_CFG9E 0x9E
>> +#define REG_OTP_CFG0 0xA0
>> +#define REG_OTP_CFG1 0xA1
>> +#define REG_OTP_CFG2 0xA2
>> +#define REG_OTP_CFG3 0xA3
>> +#define REG_OTP_CFG4 0xA4
>> +#define REG_OTP_CFG5 0xA5
>> +#define REG_OTP_CFG6 0xA6
>> +#define REG_OTP_CFG7 0xA7
>> +#define REG_OTP_CFG9 0xA9
>> +#define REG_OTP_CFGA 0xAA
>> +#define REG_OTP_CFGE 0xAE
> 
> There seems to be a lot of unused macros here, especially
> combined with the unused bitfields that tell us how to interpret
> the values.
> 
> Do we need them?

I'll drop those

> 
> 
>> <snip>
>> +static int sy7758_probe(struct i2c_client *client)
>> +{
>> +	struct backlight_properties props = { };
>> +	struct device *dev = &client->dev;
>> +	struct sy7758 *sydev;
>> +	unsigned int dev_id;
>> +	int ret;
>> +
>> +	sydev = devm_kzalloc(dev, sizeof(*sydev), GFP_KERNEL);
>> +	if (!sydev)
>> +		return -ENOMEM;
>> +
>> +	i2c_set_clientdata(client, sydev);
>> +
>> +	/* Initialize regmap */
>> +	sydev->client = client;
>> +	sydev->regmap = devm_regmap_init_i2c(client, &sy7758_regmap_config);
>> +	if (IS_ERR(sydev->regmap))
>> +		return dev_err_probe(dev, PTR_ERR(sydev->regmap),
>> +				     "failed to init regmap\n");
>> +
>> +	/* Get and enable regulators */
>> +	ret = devm_regulator_get_enable(dev, "vddio");
>> +	if (ret)
>> +		return dev_err_probe(dev, ret, "failed to get regulator\n");
>> +
>> +	usleep_range(100, 200);
> 
> Any reason not to use fsleep() here?

Thanks, I'll switch to fsleep

> 
> 
>> +	/* Get enable GPIO and set to high */
>> +	sydev->gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
>> +	if (IS_ERR(sydev->gpio))
>> +		return dev_err_probe(dev, PTR_ERR(sydev->gpio),
>> +				     "failed to get enable GPIO\n");
>> +
>> +	/* Let some time for HW to settle */
>> +	usleep_range(10000, 11000);
> 
> And here?
> 
> 
>> +
>> +	/* try read and check device id */
>> +	ret = regmap_read(sydev->regmap, REG_DEV_ID, &dev_id);
>> +	if (ret < 0)
>> +		return dev_err_probe(dev, ret, "failed to read device id\n");
>> +	if (dev_id != 0x63) {
>> +		dev_err(dev, "unexpected device id: 0x%02x\n", dev_id);
>> +		return -ENODEV;
>> +	}
>> +
>> +	/* Initialize and set default brightness */
>> +	ret = sy7758_init(sydev);
>> +	if (ret)
>> +		return ret;
>> +
>> +	props.type = BACKLIGHT_RAW;
>> +	props.max_brightness = MAX_BRIGHTNESS;
>> +	props.brightness = DEFAULT_BRIGHTNESS;
>> +	props.scale = BACKLIGHT_SCALE_LINEAR;
>> +
>> +	sydev->bl = devm_backlight_device_register(dev, "sy7758-backlight",
>> +						   dev, sydev, &sy7758_backlight_ops,
>> +						   &props);
>> +	if (IS_ERR(sydev->bl))
>> +		return dev_err_probe(dev, PTR_ERR(sydev->bl),
>> +				     "failed to register backlight device\n");
>> +
>> +	return backlight_update_status(sydev->bl);
>> +}
> 
> 
> Daniel.

Thanks,
Neil


^ permalink raw reply

* [PATCH v3 0/2] backlight: Add SY7758 6-channel High Efficiency LED Driver support
From: Neil Armstrong @ 2026-05-19  8:43 UTC (permalink / raw)
  To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Helge Deller
  Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev,
	KancyJoe, Neil Armstrong, Krzysztof Kozlowski

Implement support for the Silergy SY7758 6-channel High Efficiency LED Driver
used for backlight brightness control in the Ayaneo Pocket S2 dual-DSI panel.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Changes in v3:
- Dropped unused macros
- Added second autho entry to match header and commit message
- Move my signof at the end
- Switched to flseep()
- Link to v2: https://patch.msgid.link/20260430-topic-sm8650-ayaneo-pocket-s2-sy7758-v2-0-308140640de9@linaro.org

Changes in v2:
- Fixed bindings subject and removed "|"
- Added review tag
- Added higher delay before reading ID from HW (100us was too short)
- Removed probe defer if i2c read fails
- Link to v1: https://patch.msgid.link/20260428-topic-sm8650-ayaneo-pocket-s2-sy7758-v1-0-0caade5fdb32@linaro.org

---
KancyJoe (1):
      backlight: Add SY7758 6-channel High Efficiency LED Driver support

Neil Armstrong (1):
      dt-bindings: leds: backlight: document the SY7758 6-channel High Efficiency LED Driver

 .../bindings/leds/backlight/silergy,sy7758.yaml    |  53 +++++
 drivers/video/backlight/Kconfig                    |   8 +
 drivers/video/backlight/Makefile                   |   1 +
 drivers/video/backlight/sy7758.c                   | 259 +++++++++++++++++++++
 4 files changed, 321 insertions(+)
---
base-commit: 39704f00f747aba3144289870b5fd8ac230a9aaf
change-id: 20260428-topic-sm8650-ayaneo-pocket-s2-sy7758-3081ee7f1e25

Best regards,
--  
Neil Armstrong <neil.armstrong@linaro.org>


^ permalink raw reply

* [PATCH v3 1/2] dt-bindings: leds: backlight: document the SY7758 6-channel High Efficiency LED Driver
From: Neil Armstrong @ 2026-05-19  8:43 UTC (permalink / raw)
  To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Helge Deller
  Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev,
	KancyJoe, Neil Armstrong, Krzysztof Kozlowski
In-Reply-To: <20260519-topic-sm8650-ayaneo-pocket-s2-sy7758-v3-0-ec8194bbc885@linaro.org>

Document the Silergy SY7758 6-channel High Efficiency LED Driver
used for backlight brightness control.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 .../bindings/leds/backlight/silergy,sy7758.yaml    | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/backlight/silergy,sy7758.yaml b/Documentation/devicetree/bindings/leds/backlight/silergy,sy7758.yaml
new file mode 100644
index 000000000000..80e978d691c2
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/backlight/silergy,sy7758.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/backlight/silergy,sy7758.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Silergy SY7758 6-channel High Efficiency LED Driver
+
+maintainers:
+  - Neil Armstrong <neil.armstrong@linaro.org>
+
+description:
+  Silergy SY7758 is a high efficiency 6-channels LED backlight
+  driver with I2C brightness control.
+
+allOf:
+  - $ref: common.yaml#
+
+properties:
+  compatible:
+    const: silergy,sy7758
+
+  reg:
+    maxItems: 1
+
+  vddio-supply: true
+
+  enable-gpios:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - vddio-supply
+  - enable-gpios
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        backlight@11 {
+            compatible = "silergy,sy7758";
+            reg = <0x11>;
+            vddio-supply = <&bl_vddio>;
+            enable-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+        };
+    };

-- 
2.34.1


^ permalink raw reply related

* [PATCH v3 2/2] backlight: Add SY7758 6-channel High Efficiency LED Driver support
From: Neil Armstrong @ 2026-05-19  8:43 UTC (permalink / raw)
  To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Helge Deller
  Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev,
	KancyJoe, Neil Armstrong
In-Reply-To: <20260519-topic-sm8650-ayaneo-pocket-s2-sy7758-v3-0-ec8194bbc885@linaro.org>

From: KancyJoe <kancy2333@outlook.com>

Implement support for the Silergy SY7758 6-channel High Efficiency LED
Driver used for backlight brightness control in the Ayaneo Pocket S2
dual-DSI panel.

Signed-off-by: KancyJoe <kancy2333@outlook.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 drivers/video/backlight/Kconfig  |   8 ++
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sy7758.c | 259 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 268 insertions(+)

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index a7a3fbaf7c29..052ac80c8213 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -207,6 +207,14 @@ config BACKLIGHT_KTZ8866
 		Say Y to enable the backlight driver for the Kinetic KTZ8866
 		found in Xiaomi Mi Pad 5 series.
 
+config BACKLIGHT_SY7758
+	tristate "Backlight Driver for Silergy SY7758"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  Say Y to enable the backlight driver for the Silergy SY7758
+	  backlight controller found in Ayaneo Socket S2.
+
 config BACKLIGHT_LM3533
 	tristate "Backlight Driver for LM3533"
 	depends on MFD_LM3533
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 794820a98ed4..39ef588b1cf2 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_BACKLIGHT_PWM)		+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_QCOM_WLED)	+= qcom-wled.o
 obj-$(CONFIG_BACKLIGHT_RT4831)		+= rt4831-backlight.o
 obj-$(CONFIG_BACKLIGHT_SAHARA)		+= kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SY7758)		+= sy7758.o
 obj-$(CONFIG_BACKLIGHT_SKY81452)	+= sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)	+= tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X)		+= wm831x_bl.o
diff --git a/drivers/video/backlight/sy7758.c b/drivers/video/backlight/sy7758.c
new file mode 100644
index 000000000000..a6087e687b64
--- /dev/null
+++ b/drivers/video/backlight/sy7758.c
@@ -0,0 +1,259 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Silergy SY7758 6-channel High Efficiency LED Driver
+ *
+ * Copyright (C) 2025 Kancy Joe <kancy2333@outlook.com>
+ * Copyright (C) 2026 Linaro Limited
+ * Author: Neil Armstrong <neil.armstrong@linaro.org>
+ */
+#include <linux/backlight.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/of.h>
+#include <linux/err.h>
+#include <linux/bits.h>
+#include <linux/regmap.h>
+#include <linux/bitfield.h>
+#include <linux/gpio/consumer.h>
+#include <linux/regulator/consumer.h>
+
+#define DEFAULT_BRIGHTNESS	1024
+#define MAX_BRIGHTNESS		4080
+#define REG_MAX			0xAE
+
+/* Registers */
+#define REG_DEV_CTL		0x01
+#define REG_DEV_ID		0x03
+#define REG_BRT_12BIT_L		0x10
+#define REG_BRT_12BIT_H		0x11
+
+/* OTP memory */
+#define REG_OTP_CFG0		0xA0
+#define REG_OTP_CFG1		0xA1
+#define REG_OTP_CFG2		0xA2
+#define REG_OTP_CFG5		0xA5
+#define REG_OTP_CFG9		0xA9
+
+/* Fields */
+#define BIT_DEV_CTL_FAST	BIT(7)
+#define MSK_DEV_CTL_BRT_MODE	GENMASK(2, 1)
+#define BIT_DEV_CTL_BL_CTLB	BIT(0)
+
+#define MSK_BRT_12BIT_L		GENMASK(7, 0)
+#define MSK_BRT_12BIT_H		GENMASK(3, 0)
+#define MSK_LED_ENABLE		GENMASK(5, 0)
+
+#define MSK_CFG0_CURRENT_LOW	GENMASK(7, 0)
+
+#define BIT_CFG1_PDET_STDBY	BIT(7)
+#define MSK_CFG1_CURRENT_MAX	GENMASK(6, 4)
+#define MSK_CFG1_CURRENT_HIGH	GENMASK(3, 0)
+
+#define BIT_CFG2_UVLO_EN	BIT(5)
+#define BIT_CFG2_UVLO_TH	BIT(4)
+#define BIT_CFG2_BL_ON		BIT(3)
+#define BIT_CFG2_ISET_EN	BIT(2)
+#define BIT_CFG2_BST_ESET_EN	BIT(1)
+
+#define BIT_CFG5_PWM_DIRECT	BIT(7)
+#define MSK_CFG5_PS_MODE	GENMASK(6, 4)
+#define MSK_CFG5_PWM_FREQ	GENMASK(3, 0)
+
+#define MSK_CFG9_VBST_MAX	GENMASK(7, 5)
+#define BIT_CFG9_JUMP_EN	BIT(4)
+#define MSK_CFG9_JUMP_TH	GENMASK(3, 2)
+#define MSK_CFG9_JUMP_VOLTAGE	GENMASK(1, 0)
+
+struct sy7758 {
+	struct i2c_client *client;
+	struct regmap *regmap;
+	struct gpio_desc *gpio;
+	struct backlight_device *bl;
+};
+
+static const struct regmap_config sy7758_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = REG_MAX,
+};
+
+static int sy7758_backlight_update_status(struct backlight_device *backlight_dev)
+{
+	struct sy7758 *sydev = bl_get_data(backlight_dev);
+	unsigned int brightness = backlight_get_brightness(backlight_dev);
+	int ret;
+
+	ret = regmap_write(sydev->regmap, REG_BRT_12BIT_L,
+			   FIELD_PREP(MSK_BRT_12BIT_L,
+				      brightness & 0xff));
+	if (ret)
+		return ret;
+
+	ret = regmap_write(sydev->regmap, REG_BRT_12BIT_H,
+			   FIELD_PREP(MSK_BRT_12BIT_H,
+				      (brightness >> 8) & 0xf));
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static const struct backlight_ops sy7758_backlight_ops = {
+	.options = BL_CORE_SUSPENDRESUME,
+	.update_status = sy7758_backlight_update_status,
+};
+
+static int sy7758_init(struct sy7758 *sydev)
+{
+	int ret = 0;
+
+	ret = regmap_write(sydev->regmap, REG_DEV_CTL,
+			   BIT_DEV_CTL_FAST | BIT_DEV_CTL_BL_CTLB |
+			   FIELD_PREP(MSK_DEV_CTL_BRT_MODE, 2));
+	if (ret)
+		return ret;
+
+	ret = regmap_write(sydev->regmap, REG_BRT_12BIT_L,
+			   FIELD_PREP(MSK_BRT_12BIT_L,
+				      DEFAULT_BRIGHTNESS & 0xff));
+	if (ret)
+		return ret;
+
+	ret = regmap_write(sydev->regmap, REG_BRT_12BIT_H,
+			   FIELD_PREP(MSK_BRT_12BIT_H,
+				      (DEFAULT_BRIGHTNESS >> 8)));
+	if (ret)
+		return ret;
+
+	ret = regmap_write(sydev->regmap, REG_OTP_CFG5,
+			   FIELD_PREP(MSK_CFG5_PS_MODE, 6) |
+			   FIELD_PREP(MSK_CFG5_PWM_FREQ, 4));
+	if (ret)
+		return ret;
+
+	ret = regmap_write(sydev->regmap, REG_OTP_CFG0,
+			   FIELD_PREP(MSK_CFG0_CURRENT_LOW, 85));
+	if (ret)
+		return ret;
+
+	ret = regmap_write(sydev->regmap, REG_OTP_CFG1,
+			   BIT_CFG1_PDET_STDBY |
+			   FIELD_PREP(MSK_CFG1_CURRENT_MAX, 1) |
+			   FIELD_PREP(MSK_CFG1_CURRENT_HIGH, 10));
+	if (ret)
+		return ret;
+
+	ret = regmap_write(sydev->regmap, REG_OTP_CFG9,
+			   FIELD_PREP(MSK_CFG9_VBST_MAX, 4));
+	if (ret)
+		return ret;
+
+	ret = regmap_write(sydev->regmap, REG_OTP_CFG2,
+			   BIT_CFG2_BL_ON | BIT_CFG2_UVLO_EN);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int sy7758_probe(struct i2c_client *client)
+{
+	struct backlight_properties props = { };
+	struct device *dev = &client->dev;
+	struct sy7758 *sydev;
+	unsigned int dev_id;
+	int ret;
+
+	sydev = devm_kzalloc(dev, sizeof(*sydev), GFP_KERNEL);
+	if (!sydev)
+		return -ENOMEM;
+
+	i2c_set_clientdata(client, sydev);
+
+	/* Initialize regmap */
+	sydev->client = client;
+	sydev->regmap = devm_regmap_init_i2c(client, &sy7758_regmap_config);
+	if (IS_ERR(sydev->regmap))
+		return dev_err_probe(dev, PTR_ERR(sydev->regmap),
+				     "failed to init regmap\n");
+
+	/* Get and enable regulators */
+	ret = devm_regulator_get_enable(dev, "vddio");
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to get regulator\n");
+
+	fsleep(100);
+
+	/* Get enable GPIO and set to high */
+	sydev->gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
+	if (IS_ERR(sydev->gpio))
+		return dev_err_probe(dev, PTR_ERR(sydev->gpio),
+				     "failed to get enable GPIO\n");
+
+	/* Let some time for HW to settle */
+	fsleep(10000);
+
+	/* try read and check device id */
+	ret = regmap_read(sydev->regmap, REG_DEV_ID, &dev_id);
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "failed to read device id\n");
+	if (dev_id != 0x63) {
+		dev_err(dev, "unexpected device id: 0x%02x\n", dev_id);
+		return -ENODEV;
+	}
+
+	/* Initialize and set default brightness */
+	ret = sy7758_init(sydev);
+	if (ret)
+		return ret;
+
+	props.type = BACKLIGHT_RAW;
+	props.max_brightness = MAX_BRIGHTNESS;
+	props.brightness = DEFAULT_BRIGHTNESS;
+	props.scale = BACKLIGHT_SCALE_LINEAR;
+
+	sydev->bl = devm_backlight_device_register(dev, "sy7758-backlight",
+						   dev, sydev, &sy7758_backlight_ops,
+						   &props);
+	if (IS_ERR(sydev->bl))
+		return dev_err_probe(dev, PTR_ERR(sydev->bl),
+				     "failed to register backlight device\n");
+
+	return backlight_update_status(sydev->bl);
+}
+
+static void sy7758_remove(struct i2c_client *client)
+{
+	struct sy7758 *sydev = i2c_get_clientdata(client);
+
+	backlight_disable(sydev->bl);
+}
+
+static const struct i2c_device_id sy7758_ids[] = {
+	{ "sy7758" },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, sy7758_ids);
+
+static const struct of_device_id sy7758_match_table[] = {
+	{ .compatible = "silergy,sy7758", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, sy7758_match_table);
+
+static struct i2c_driver sy7758_driver = {
+	.driver = {
+		.name = "sy7758",
+		.of_match_table = sy7758_match_table,
+	},
+	.probe = sy7758_probe,
+	.remove = sy7758_remove,
+	.id_table = sy7758_ids,
+};
+
+module_i2c_driver(sy7758_driver);
+
+MODULE_DESCRIPTION("Silergy SY7758 Backlight Driver");
+MODULE_AUTHOR("Kancy Joe <kancy2333@outlook.com>");
+MODULE_AUTHOR("Neil Armstrong <neil.armstrong@linaro.org>");
+MODULE_LICENSE("GPL");

-- 
2.34.1


^ permalink raw reply related

* Re: [PATCH] ARM: mach-rpc: fix zImage build after recent font-related changes
From: Helge Deller @ 2026-05-19  9:11 UTC (permalink / raw)
  To: Ethan Nelson-Moore; +Cc: linux-arm-kernel, linux-fbdev, Russell King
In-Reply-To: <d0bb399f-1285-495b-babe-8bae608729e8@gmx.de>

* Helge Deller <deller@gmx.de>:
> On 5/10/26 04:39, Ethan Nelson-Moore wrote:
> > The text display code used in the Risc PC kernel image decompression
> > code uses arch/arm/boot/compressed/font.c, which includes
> > lib/fonts/font_acorn_8x8.c, which further includes <linux/font.h>.
> > 
> > Since commit 97df8960240a ("lib/fonts: Provide helpers for calculating
> > glyph pitch and size") <linux/font.h> contains inline functions that
> > require __do_div64, which is not linked into the ARM kernel
> > decompressor. This makes Risc PC zImages fail to build.
> > 
> > Resolve this issue in the least intrusive way possible by preventing
> > the inclusion of <linux/font.h> (and the definition of a struct that
> > relies on it) when the decompressor is being built.
> 
> I don't think we really require 64-bit integer support/division in the
> font code, as 32-bit should be sufficient.
> Can't you try to find out where this 64-bit division is done, and fix
> this instead?

Ethan, does this compile-only-tested patch fix the issue?
Maybe only the first hunk is necessary.

Helge


diff --git a/include/linux/font.h b/include/linux/font.h
index 6845f02d739a..c8f3d6ef54c8 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -35,7 +35,7 @@ struct console_font;
  */
 static inline unsigned int font_glyph_pitch(unsigned int width)
 {
-	return DIV_ROUND_UP(width, 8);
+	return (width + 7) >> 3;
 }
 
 /**
diff --git a/lib/fonts/fonts.c b/lib/fonts/fonts.c
index f5d5333450a0..5bd7af5f2111 100644
--- a/lib/fonts/fonts.c
+++ b/lib/fonts/fonts.c
@@ -71,24 +71,24 @@ static void font_data_free(font_data_t *fd)
 font_data_t *font_data_import(const struct console_font *font, unsigned int vpitch,
 			      u32 (*calc_csum)(u32, const void *, size_t))
 {
-	unsigned int pitch = console_font_pitch(font);
-	unsigned int h = font->height;
-	unsigned int charcount = font->charcount;
+	uint8_t pitch = console_font_pitch(font);
+	uint8_t h = font->height;
+	uint16_t charcount = font->charcount;
 	const unsigned char *data = font->data;
 	u32 csum = 0;
 	struct font_data *font_data;
-	int size, alloc_size;
+	unsigned long size, alloc_size;
 	unsigned int i;
 	font_data_t *fd;
 
-	/* Check for integer overflow in font-size calculation */
-	if (check_mul_overflow(h, pitch, &size) ||
-	    check_mul_overflow(size, charcount, &size))
+	/* size-check user provided font values */
+	if ((pitch != console_font_pitch(font)) ||
+	    (h != font->height) ||
+	    (charcount != font->charcount))
 		return ERR_PTR(-EINVAL);
 
-	/* Check for overflow in allocation size calculation */
-	if (check_add_overflow(sizeof(*font_data), size, &alloc_size))
-		return ERR_PTR(-EINVAL);
+	size = h * pitch;
+	alloc_size = size + sizeof(*font_data);
 
 	font_data = kmalloc(alloc_size, GFP_USER);
 	if (!font_data)

^ permalink raw reply related

* Re: (subset) [PATCH v8 0/4] backlight: add new max25014 backlight driver
From: Frank.Li @ 2026-05-19 15:22 UTC (permalink / raw)
  To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Liam Girdwood, Mark Brown, Maud Spierings
  Cc: Frank Li, dri-devel, linux-leds, devicetree, linux-kernel,
	linux-fbdev, imx, linux-arm-kernel
In-Reply-To: <20260407-max25014-v8-0-14eac7ed673a@gocontroll.com>

From: Frank Li <Frank.Li@nxp.com>


On Tue, 07 Apr 2026 16:41:41 +0200, Maud Spierings wrote:
> The Maxim MAX25014 is an automotive grade backlight driver IC. Its
> datasheet can be found at [1].
> 
> With its integrated boost controller, it can power 4 channels (led
> strings) and has a number of different modes using pwm and or i2c.
> Currently implemented is only i2c control.
> 
> [...]

Applied, thanks!

[3/4] arm64: dts: freescale: moduline-display-av101hdt-a10: add backlight
      commit: 10fd5ba8fae66d60c65ec4bdb51fbbe5e34d9d83
[4/4] arm64: dts: freescale: moduline-display-av123z7m-n17: add backlight
      commit: 159746425710c94befb317132816f5eece4ea25d

Best regards,
-- 
Frank Li <Frank.Li@nxp.com>

^ permalink raw reply

* Re: (subset) [PATCH v8 1/4] dt-bindings: backlight: Add max25014 support
From: Frank Li @ 2026-05-19 18:51 UTC (permalink / raw)
  To: Lee Jones
  Cc: Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Liam Girdwood, Mark Brown, Maud Spierings, dri-devel, linux-leds,
	devicetree, linux-kernel, linux-fbdev, imx, linux-arm-kernel
In-Reply-To: <177755722019.2606736.10749503716773482329.b4-ty@b4>

On Thu, Apr 30, 2026 at 02:53:40PM +0100, Lee Jones wrote:
> On Tue, 07 Apr 2026 16:41:42 +0200, Maud Spierings wrote:
> > The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
> > with integrated boost controller.
>
> Applied, thanks!
>
> [1/4] dt-bindings: backlight: Add max25014 support
>       commit: 5fcbbedec9dfce78044eee922bf2030e1bd03faa

Lee Jones:

	I have not seen it in linux-next. Anything wrong?

Frank

>
> --
> Lee Jones [李琼斯]
>

^ permalink raw reply

* Re: [PATCH] fbcon: don't suspend/resume when vc is graphics mode
From: yaolu @ 2026-05-20  2:55 UTC (permalink / raw)
  To: deller; +Cc: dri-devel, linux-fbdev, linux-kernel, simona, tzimmermann, yaolu
In-Reply-To: <67a1f756-996c-404b-8eff-f705ff151ed3@gmx.de>

On 2026/5/19 16:10, Helge Deller wrote:
Hello Helge,
> Hello Lu,
>
> On 4/30/26 08:01, yaolu@kylinos.cn wrote:
>> From: Lu Yao <yaolu@kylinos.cn>
>>
>> Don't need to do suspend/resume for fbcon in graphic mode. 
>
> Do you still have the possibility to test this issue?
>
Yes, I  still can test this issue.Do you have any other items to test?
>  
>> Signed-off-by: Lu Yao <yaolu@kylinos.cn>
>> ---
>>   drivers/video/fbdev/core/fbcon.c | 9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
>> index b0e3e765360d..450e690d0bd2 100644
>> --- a/drivers/video/fbdev/core/fbcon.c
>> +++ b/drivers/video/fbdev/core/fbcon.c
>> @@ -2602,8 +2602,9 @@ void fbcon_suspended(struct fb_info *info)
>>           return;
>>       vc = vc_cons[par->currcon].d;
>>   -    /* Clear cursor, restore saved data */
>> -    fbcon_cursor(vc, false);
>> +    /* Don't need to clear cursor and restore saved data in graphic mode */
>> +    if (vc->vc_mode != KD_GRAPHICS)
>> +        fbcon_cursor(vc, false); 
>
> I think checking for "== KD_TEXT" is probably better.
> And, maybe using con_is_visible(vc).
> So:
>
> +    if (con_is_visible(vc) && (vc->vc_mode == KD_TEXT))
> +        fbcon_cursor(vc, false);
>
It seems more reasonable. I'll submit a new patch soon.
>
> Helge 
Lu Yao

^ permalink raw reply

* [PATCH] video: console: mdacon: remove this obsolete driver
From: Ethan Nelson-Moore @ 2026-05-20  3:31 UTC (permalink / raw)
  To: linux-doc, linux-alpha, linux-serial, linux-fbdev
  Cc: Ethan Nelson-Moore, Jonathan Corbet, Shuah Khan,
	Richard Henderson, Matt Turner, Magnus Lindholm,
	Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Greg Kroah-Hartman, Jiri Slaby,
	Helge Deller, Nicolas Pitre

The mdacon driver supports using ISA MDA or Hercules-compatible display
adapters as a secondary text console. This was commonly used in the
1990s and earlier for debugging software which took over the primary
display. It is highly unlikely anyone is doing so nowadays because
serial consoles and much better methods of debugging exist.

The driver is not enabled by any defconfig, nor any of the
dozens of distro configs collected at [1]. It has been relegated to VTs
13-16 since commit 0b9cf3aa6b1e ("mdacon messing up default vc's - set
default to vc13-16 again") in Linux 2.6.27 (and before Linux 2.5.53 -
see the link in the message of the above commit). The change in 2.6.27
was done because it was incorrectly detecting non-MDA adapters as MDA
and taking over all VTs, rendering them unusable.

Furthermore, vgacon supports using MDA/Hercules-compatible adapters as
the primary text console, so any systems with only one of these
adapters were already using vgacon and will not experience any loss in
functionality from the removal of this driver.

Given all of these factors, the mdacon driver is likely entirely
unused. Remove it.

[1] https://github.com/nyrahul/linux-kernel-configs/tree/f0bee86a135a0406ea427855f52702dd00d770f9

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
 .../admin-guide/kernel-parameters.txt         |   5 -
 arch/alpha/kernel/io.c                        |   2 +-
 arch/powerpc/include/asm/vga.h                |   4 +-
 drivers/tty/vt/vt.c                           |   3 -
 drivers/video/console/Kconfig                 |  15 -
 drivers/video/console/Makefile                |   1 -
 drivers/video/console/mdacon.c                | 566 ------------------
 include/linux/console.h                       |   2 -
 include/linux/vt_buffer.h                     |   2 +-
 9 files changed, 4 insertions(+), 596 deletions(-)
 delete mode 100644 drivers/video/console/mdacon.c

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 4d0f545fb3ec..e873b27cdd30 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -36,7 +36,6 @@
 	M68k	M68k architecture is enabled.
 			These options have more detailed description inside of
 			Documentation/arch/m68k/kernel-options.rst.
-	MDA	MDA console support is enabled.
 	MIPS	MIPS architecture is enabled.
 	MOUSE	Appropriate mouse support is enabled.
 	MSI	Message Signaled Interrupts (PCI).
@@ -3816,10 +3815,6 @@ Kernel parameters
 	md=		[HW] RAID subsystems devices and level
 			See Documentation/admin-guide/md.rst.
 
-	mdacon=		[MDA]
-			Format: <first>,<last>
-			Specifies range of consoles to be captured by the MDA.
-
 	mds=		[X86,INTEL,EARLY]
 			Control mitigation for the Micro-architectural Data
 			Sampling (MDS) vulnerability.
diff --git a/arch/alpha/kernel/io.c b/arch/alpha/kernel/io.c
index c28035d6d1e6..2bad1b4fb240 100644
--- a/arch/alpha/kernel/io.c
+++ b/arch/alpha/kernel/io.c
@@ -647,7 +647,7 @@ void _memset_c_io(volatile void __iomem *to, unsigned long c, long count)
 
 EXPORT_SYMBOL(_memset_c_io);
 
-#if IS_ENABLED(CONFIG_VGA_CONSOLE) || IS_ENABLED(CONFIG_MDA_CONSOLE)
+#if IS_ENABLED(CONFIG_VGA_CONSOLE)
 
 #include <asm/vga.h>
 
diff --git a/arch/powerpc/include/asm/vga.h b/arch/powerpc/include/asm/vga.h
index f2dc40e1c52a..e45063b02b45 100644
--- a/arch/powerpc/include/asm/vga.h
+++ b/arch/powerpc/include/asm/vga.h
@@ -14,7 +14,7 @@
 #include <asm/io.h>
 
 
-#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
+#ifdef CONFIG_VGA_CONSOLE
 
 #define VT_BUF_HAVE_RW
 /*
@@ -40,7 +40,7 @@ static inline void scr_memsetw(u16 *s, u16 v, unsigned int n)
 	memset16(s, cpu_to_le16(v), n / 2);
 }
 
-#endif /* !CONFIG_VGA_CONSOLE && !CONFIG_MDA_CONSOLE */
+#endif /* !CONFIG_VGA_CONSOLE */
 
 #ifdef __powerpc64__
 #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap((x), s))
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index e99636ab9db5..3ca5e3dc5ac0 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3978,9 +3978,6 @@ int __init vty_init(const struct file_operations *console_fops)
 		panic("Couldn't register console driver\n");
 	kbd_init();
 	console_map_init();
-#ifdef CONFIG_MDA_CONSOLE
-	mda_console_init();
-#endif
 	return 0;
 }
 
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 12f54480f57f..9f81af3506da 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -23,21 +23,6 @@ config VGA_CONSOLE
 
 	  Say Y.
 
-config MDA_CONSOLE
-	depends on VGA_CONSOLE && ISA
-	tristate "MDA text console (dual-headed)"
-	help
-	  Say Y here if you have an old MDA or monochrome Hercules graphics
-	  adapter in your system acting as a second head ( = video card). You
-	  will then be able to use two monitors with your Linux system. Do not
-	  say Y here if your MDA card is the primary card in your system; the
-	  normal VGA driver will handle it.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called mdacon.
-
-	  If unsure, say N.
-
 config SGI_NEWPORT_CONSOLE
 	tristate "SGI Newport Console support"
 	depends on SGI_IP22 && HAS_IOMEM
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index fd79016a0d95..f1000605210c 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -7,4 +7,3 @@ obj-$(CONFIG_DUMMY_CONSOLE)       += dummycon.o
 obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o
 obj-$(CONFIG_STI_CONSOLE)         += sticon.o
 obj-$(CONFIG_VGA_CONSOLE)         += vgacon.o
-obj-$(CONFIG_MDA_CONSOLE)         += mdacon.o
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
deleted file mode 100644
index d52cd99cd18b..000000000000
--- a/drivers/video/console/mdacon.c
+++ /dev/null
@@ -1,566 +0,0 @@
-/*
- *  linux/drivers/video/mdacon.c -- Low level MDA based console driver
- *
- *	(c) 1998 Andrew Apted <ajapted@netspace.net.au>
- *
- *      including portions (c) 1995-1998 Patrick Caulfield.
- *
- *      slight improvements (c) 2000 Edward Betts <edward@debian.org>
- *
- *  This file is based on the VGA console driver (vgacon.c):
- *	
- *	Created 28 Sep 1997 by Geert Uytterhoeven
- *
- *	Rewritten by Martin Mares <mj@ucw.cz>, July 1998
- *
- *  and on the old console.c, vga.c and vesa_blank.c drivers:
- *
- *	Copyright (C) 1991, 1992  Linus Torvalds
- *			    1995  Jay Estabrook
- *
- *  This file is subject to the terms and conditions of the GNU General Public
- *  License.  See the file COPYING in the main directory of this archive for
- *  more details.
- *
- *  Changelog:
- *  Paul G. (03/2001) Fix mdacon= boot prompt to use __setup().
- */
-
-#include <linux/types.h>
-#include <linux/fs.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/console.h>
-#include <linux/string.h>
-#include <linux/kd.h>
-#include <linux/vt_kern.h>
-#include <linux/vt_buffer.h>
-#include <linux/selection.h>
-#include <linux/spinlock.h>
-#include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/init.h>
-
-#include <asm/io.h>
-#include <asm/vga.h>
-
-static DEFINE_SPINLOCK(mda_lock);
-
-/* description of the hardware layout */
-
-static u16		*mda_vram_base;		/* Base of video memory */
-static unsigned long	mda_vram_len;		/* Size of video memory */
-static unsigned int	mda_num_columns;	/* Number of text columns */
-static unsigned int	mda_num_lines;		/* Number of text lines */
-
-static unsigned int	mda_index_port;		/* Register select port */
-static unsigned int	mda_value_port;		/* Register value port */
-static unsigned int	mda_mode_port;		/* Mode control port */
-static unsigned int	mda_status_port;	/* Status and Config port */
-static unsigned int	mda_gfx_port;		/* Graphics control port */
-
-/* current hardware state */
-
-static int	mda_cursor_loc=-1;
-static int	mda_cursor_size_from=-1;
-static int	mda_cursor_size_to=-1;
-
-static enum { TYPE_MDA, TYPE_HERC, TYPE_HERCPLUS, TYPE_HERCCOLOR } mda_type;
-static char *mda_type_name;
-
-/* console information */
-
-static int	mda_first_vc = 13;
-static int	mda_last_vc  = 16;
-
-static struct vc_data	*mda_display_fg = NULL;
-
-module_param(mda_first_vc, int, 0);
-MODULE_PARM_DESC(mda_first_vc, "First virtual console. Default: 13");
-module_param(mda_last_vc, int, 0);
-MODULE_PARM_DESC(mda_last_vc, "Last virtual console. Default: 16");
-
-/* MDA register values
- */
-
-#define MDA_CURSOR_BLINKING	0x00
-#define MDA_CURSOR_OFF		0x20
-#define MDA_CURSOR_SLOWBLINK	0x60
-
-#define MDA_MODE_GRAPHICS	0x02
-#define MDA_MODE_VIDEO_EN	0x08
-#define MDA_MODE_BLINK_EN	0x20
-#define MDA_MODE_GFX_PAGE1	0x80
-
-#define MDA_STATUS_HSYNC	0x01
-#define MDA_STATUS_VSYNC	0x80
-#define MDA_STATUS_VIDEO	0x08
-
-#define MDA_CONFIG_COL132	0x08
-#define MDA_GFX_MODE_EN		0x01
-#define MDA_GFX_PAGE_EN		0x02
-
-
-/*
- * MDA could easily be classified as "pre-dinosaur hardware".
- */
-
-static void write_mda_b(unsigned int val, unsigned char reg)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&mda_lock, flags);	
-
-	outb_p(reg, mda_index_port); 
-	outb_p(val, mda_value_port);
-
-	spin_unlock_irqrestore(&mda_lock, flags);
-}
-
-static void write_mda_w(unsigned int val, unsigned char reg)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&mda_lock, flags);
-
-	outb_p(reg,   mda_index_port); outb_p(val >> 8,   mda_value_port);
-	outb_p(reg+1, mda_index_port); outb_p(val & 0xff, mda_value_port);
-
-	spin_unlock_irqrestore(&mda_lock, flags);
-}
-
-#ifdef TEST_MDA_B
-static int test_mda_b(unsigned char val, unsigned char reg)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&mda_lock, flags);
-
-	outb_p(reg, mda_index_port); 
-	outb  (val, mda_value_port);
-
-	udelay(20); val = (inb_p(mda_value_port) == val);
-
-	spin_unlock_irqrestore(&mda_lock, flags);
-	return val;
-}
-#endif
-
-static inline void mda_set_cursor(unsigned int location) 
-{
-	if (mda_cursor_loc == location)
-		return;
-
-	write_mda_w(location >> 1, 0x0e);
-
-	mda_cursor_loc = location;
-}
-
-static inline void mda_set_cursor_size(int from, int to)
-{
-	if (mda_cursor_size_from==from && mda_cursor_size_to==to)
-		return;
-	
-	if (from > to) {
-		write_mda_b(MDA_CURSOR_OFF, 0x0a);	/* disable cursor */
-	} else {
-		write_mda_b(from, 0x0a);	/* cursor start */
-		write_mda_b(to,   0x0b);	/* cursor end */
-	}
-
-	mda_cursor_size_from = from;
-	mda_cursor_size_to   = to;
-}
-
-
-#ifndef MODULE
-static int __init mdacon_setup(char *str)
-{
-	/* command line format: mdacon=<first>,<last> */
-
-	int ints[3];
-
-	str = get_options(str, ARRAY_SIZE(ints), ints);
-
-	if (ints[0] < 2)
-		return 0;
-
-	if (ints[1] < 1 || ints[1] > MAX_NR_CONSOLES || 
-	    ints[2] < 1 || ints[2] > MAX_NR_CONSOLES)
-		return 0;
-
-	mda_first_vc = ints[1];
-	mda_last_vc  = ints[2];
-	return 1;
-}
-
-__setup("mdacon=", mdacon_setup);
-#endif
-
-static int mda_detect(void)
-{
-	int count=0;
-	u16 *p, p_save;
-	u16 *q, q_save;
-
-	/* do a memory check */
-
-	p = mda_vram_base;
-	q = mda_vram_base + 0x01000 / 2;
-
-	p_save = scr_readw(p);
-	q_save = scr_readw(q);
-
-	scr_writew(0xAA55, p);
-	if (scr_readw(p) == 0xAA55)
-		count++;
-
-	scr_writew(0x55AA, p);
-	if (scr_readw(p) == 0x55AA)
-		count++;
-
-	scr_writew(p_save, p);
-
-	if (count != 2) {
-		return 0;
-	}
-
-	/* check if we have 4K or 8K */
-
-	scr_writew(0xA55A, q);
-	scr_writew(0x0000, p);
-	if (scr_readw(q) == 0xA55A)
-		count++;
-	
-	scr_writew(0x5AA5, q);
-	scr_writew(0x0000, p);
-	if (scr_readw(q) == 0x5AA5)
-		count++;
-
-	scr_writew(p_save, p);
-	scr_writew(q_save, q);
-	
-	if (count == 4) {
-		mda_vram_len = 0x02000;
-	}
-	
-	/* Ok, there is definitely a card registering at the correct
-	 * memory location, so now we do an I/O port test.
-	 */
-
-#ifdef TEST_MDA_B
-	/* Edward: These two mess `tests' mess up my cursor on bootup */
-
-	/* cursor low register */
-	if (!test_mda_b(0x66, 0x0f))
-		return 0;
-
-	/* cursor low register */
-	if (!test_mda_b(0x99, 0x0f))
-		return 0;
-#endif
-
-	/* See if the card is a Hercules, by checking whether the vsync
-	 * bit of the status register is changing.  This test lasts for
-	 * approximately 1/10th of a second.
-	 */
-	
-	p_save = q_save = inb_p(mda_status_port) & MDA_STATUS_VSYNC;
-
-	for (count = 0; count < 50000 && p_save == q_save; count++) {
-		q_save = inb(mda_status_port) & MDA_STATUS_VSYNC;
-		udelay(2);
-	}
-
-	if (p_save != q_save) {
-		switch (inb_p(mda_status_port) & 0x70) {
-		case 0x10:
-			mda_type = TYPE_HERCPLUS;
-			mda_type_name = "HerculesPlus";
-			break;
-		case 0x50:
-			mda_type = TYPE_HERCCOLOR;
-			mda_type_name = "HerculesColor";
-			break;
-		default:
-			mda_type = TYPE_HERC;
-			mda_type_name = "Hercules";
-			break;
-		}
-	}
-
-	return 1;
-}
-
-static void mda_initialize(void)
-{
-	write_mda_b(97, 0x00);		/* horizontal total */
-	write_mda_b(80, 0x01);		/* horizontal displayed */
-	write_mda_b(82, 0x02);		/* horizontal sync pos */
-	write_mda_b(15, 0x03);		/* horizontal sync width */
-
-	write_mda_b(25, 0x04);		/* vertical total */
-	write_mda_b(6,  0x05);		/* vertical total adjust */
-	write_mda_b(25, 0x06);		/* vertical displayed */
-	write_mda_b(25, 0x07);		/* vertical sync pos */
-
-	write_mda_b(2,  0x08);		/* interlace mode */
-	write_mda_b(13, 0x09);		/* maximum scanline */
-	write_mda_b(12, 0x0a);		/* cursor start */
-	write_mda_b(13, 0x0b);		/* cursor end */
-
-	write_mda_w(0x0000, 0x0c);	/* start address */
-	write_mda_w(0x0000, 0x0e);	/* cursor location */
-
-	outb_p(MDA_MODE_VIDEO_EN | MDA_MODE_BLINK_EN, mda_mode_port);
-	outb_p(0x00, mda_status_port);
-	outb_p(0x00, mda_gfx_port);
-}
-
-static const char *mdacon_startup(void)
-{
-	mda_num_columns = 80;
-	mda_num_lines   = 25;
-
-	mda_vram_len  = 0x01000;
-	mda_vram_base = (u16 *)VGA_MAP_MEM(0xb0000, mda_vram_len);
-
-	mda_index_port  = 0x3b4;
-	mda_value_port  = 0x3b5;
-	mda_mode_port   = 0x3b8;
-	mda_status_port = 0x3ba;
-	mda_gfx_port    = 0x3bf;
-
-	mda_type = TYPE_MDA;
-	mda_type_name = "MDA";
-
-	if (! mda_detect()) {
-		printk("mdacon: MDA card not detected.\n");
-		return NULL;
-	}
-
-	if (mda_type != TYPE_MDA) {
-		mda_initialize();
-	}
-
-	/* cursor looks ugly during boot-up, so turn it off */
-	mda_set_cursor(mda_vram_len - 1);
-
-	printk("mdacon: %s with %ldK of memory detected.\n",
-		mda_type_name, mda_vram_len/1024);
-
-	return "MDA-2";
-}
-
-static void mdacon_init(struct vc_data *c, bool init)
-{
-	c->vc_complement_mask = 0x0800;	 /* reverse video */
-	c->vc_display_fg = &mda_display_fg;
-
-	if (init) {
-		c->vc_cols = mda_num_columns;
-		c->vc_rows = mda_num_lines;
-	} else
-		vc_resize(c, mda_num_columns, mda_num_lines);
-
-	/* make the first MDA console visible */
-
-	if (mda_display_fg == NULL)
-		mda_display_fg = c;
-}
-
-static void mdacon_deinit(struct vc_data *c)
-{
-	/* con_set_default_unimap(c->vc_num); */
-
-	if (mda_display_fg == c)
-		mda_display_fg = NULL;
-}
-
-static inline u16 mda_convert_attr(u16 ch)
-{
-	u16 attr = 0x0700;
-
-	/* Underline and reverse-video are mutually exclusive on MDA.
-	 * Since reverse-video is used for cursors and selected areas,
-	 * it takes precedence. 
-	 */
-
-	if (ch & 0x0800)	attr = 0x7000;	/* reverse */
-	else if (ch & 0x0400)	attr = 0x0100;	/* underline */
-
-	return ((ch & 0x0200) << 2) | 		/* intensity */ 
-		(ch & 0x8000) |			/* blink */ 
-		(ch & 0x00ff) | attr;
-}
-
-static u8 mdacon_build_attr(struct vc_data *c, u8 color,
-			    enum vc_intensity intensity,
-			    bool blink, bool underline, bool reverse,
-			    bool italic)
-{
-	/* The attribute is just a bit vector:
-	 *
-	 *	Bit 0..1 : intensity (0..2)
-	 *	Bit 2    : underline
-	 *	Bit 3    : reverse
-	 *	Bit 7    : blink
-	 */
-
-	return (intensity & VCI_MASK) |
-		(underline << 2) |
-		(reverse << 3) |
-		(italic << 4) |
-		(blink << 7);
-}
-
-static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
-{
-	for (; count > 0; count--) {
-		scr_writew(scr_readw(p) ^ 0x0800, p);
-		p++;
-	}
-}
-
-static inline u16 *mda_addr(unsigned int x, unsigned int y)
-{
-	return mda_vram_base + y * mda_num_columns + x;
-}
-
-static void mdacon_putcs(struct vc_data *c, const u16 *s, unsigned int count,
-			 unsigned int y, unsigned int x)
-{
-	u16 *dest = mda_addr(x, y);
-
-	for (; count > 0; count--) {
-		scr_writew(mda_convert_attr(scr_readw(s++)), dest++);
-	}
-}
-
-static void mdacon_clear(struct vc_data *c, unsigned int y, unsigned int x,
-			 unsigned int width)
-{
-	u16 *dest = mda_addr(x, y);
-	u16 eattr = mda_convert_attr(c->vc_video_erase_char);
-
-	scr_memsetw(dest, eattr, width * 2);
-}
-
-static bool mdacon_switch(struct vc_data *c)
-{
-	return true;	/* redrawing needed */
-}
-
-static bool mdacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
-			 bool mode_switch)
-{
-	if (mda_type == TYPE_MDA) {
-		if (blank) 
-			scr_memsetw(mda_vram_base,
-				mda_convert_attr(c->vc_video_erase_char),
-				c->vc_screenbuf_size);
-		/* Tell console.c that it has to restore the screen itself */
-		return true;
-	} else {
-		if (blank)
-			outb_p(0x00, mda_mode_port);	/* disable video */
-		else
-			outb_p(MDA_MODE_VIDEO_EN | MDA_MODE_BLINK_EN, 
-				mda_mode_port);
-		return false;
-	}
-}
-
-static void mdacon_cursor(struct vc_data *c, bool enable)
-{
-	if (!enable) {
-		mda_set_cursor(mda_vram_len - 1);
-		return;
-	}
-
-	mda_set_cursor(c->state.y * mda_num_columns * 2 + c->state.x * 2);
-
-	switch (CUR_SIZE(c->vc_cursor_type)) {
-
-		case CUR_LOWER_THIRD:	mda_set_cursor_size(10, 13); break;
-		case CUR_LOWER_HALF:	mda_set_cursor_size(7,  13); break;
-		case CUR_TWO_THIRDS:	mda_set_cursor_size(4,  13); break;
-		case CUR_BLOCK:		mda_set_cursor_size(1,  13); break;
-		case CUR_NONE:		mda_set_cursor_size(14, 13); break;
-		default:		mda_set_cursor_size(12, 13); break;
-	}
-}
-
-static bool mdacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
-		enum con_scroll dir, unsigned int lines)
-{
-	u16 eattr = mda_convert_attr(c->vc_video_erase_char);
-
-	if (!lines)
-		return false;
-
-	if (lines > c->vc_rows)   /* maximum realistic size */
-		lines = c->vc_rows;
-
-	switch (dir) {
-
-	case SM_UP:
-		scr_memmovew(mda_addr(0, t), mda_addr(0, t + lines),
-				(b-t-lines)*mda_num_columns*2);
-		scr_memsetw(mda_addr(0, b - lines), eattr,
-				lines*mda_num_columns*2);
-		break;
-
-	case SM_DOWN:
-		scr_memmovew(mda_addr(0, t + lines), mda_addr(0, t),
-				(b-t-lines)*mda_num_columns*2);
-		scr_memsetw(mda_addr(0, t), eattr, lines*mda_num_columns*2);
-		break;
-	}
-
-	return false;
-}
-
-
-/*
- *  The console `switch' structure for the MDA based console
- */
-
-static const struct consw mda_con = {
-	.owner =		THIS_MODULE,
-	.con_startup =		mdacon_startup,
-	.con_init =		mdacon_init,
-	.con_deinit =		mdacon_deinit,
-	.con_clear =		mdacon_clear,
-	.con_putcs =		mdacon_putcs,
-	.con_cursor =		mdacon_cursor,
-	.con_scroll =		mdacon_scroll,
-	.con_switch =		mdacon_switch,
-	.con_blank =		mdacon_blank,
-	.con_build_attr =	mdacon_build_attr,
-	.con_invert_region =	mdacon_invert_region,
-};
-
-int __init mda_console_init(void)
-{
-	int err;
-
-	if (mda_first_vc > mda_last_vc)
-		return 1;
-	console_lock();
-	err = do_take_over_console(&mda_con, mda_first_vc-1, mda_last_vc-1, 0);
-	console_unlock();
-	return err;
-}
-
-static void __exit mda_console_exit(void)
-{
-	give_up_console(&mda_con);
-}
-
-module_init(mda_console_init);
-module_exit(mda_console_exit);
-
-MODULE_DESCRIPTION("MDA based console driver");
-MODULE_LICENSE("GPL");
-
diff --git a/include/linux/console.h b/include/linux/console.h
index 5520e4477ad7..d624200cfc17 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -718,8 +718,6 @@ extern bool console_suspend_enabled;
 extern void console_suspend_all(void);
 extern void console_resume_all(void);
 
-int mda_console_init(void);
-
 void vcs_make_sysfs(int index);
 void vcs_remove_sysfs(int index);
 
diff --git a/include/linux/vt_buffer.h b/include/linux/vt_buffer.h
index b6eeb8cb6070..6c15c6a15f74 100644
--- a/include/linux/vt_buffer.h
+++ b/include/linux/vt_buffer.h
@@ -16,7 +16,7 @@
 
 #include <linux/string.h>
 
-#if IS_ENABLED(CONFIG_VGA_CONSOLE) || IS_ENABLED(CONFIG_MDA_CONSOLE)
+#if IS_ENABLED(CONFIG_VGA_CONSOLE)
 #include <asm/vga.h>
 #endif
 
-- 
2.43.0


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox