[PATCH] drm/ssd130x: Set the address window in ssd132x_clear_screen()

Fabio Piparo posted 1 patch 1 month, 1 week ago
There is a newer version of this series
drivers/gpu/drm/solomon/ssd130x.c | 11 +++++++++++
1 file changed, 11 insertions(+)
[PATCH] drm/ssd130x: Set the address window in ssd132x_clear_screen()
Posted by Fabio Piparo 1 month, 1 week ago
ssd132x_clear_screen() sends its zeroes without setting the column and
row ranges first, so they land in whatever window the last
ssd132x_update_rect() left programmed. A partial final update then
leaves the rest of the screen uncleared, with fbcon the last damage is
typically the cursor cell, so blanking keeps the console content on
the panel.

Set the full-screen window first, as ssd130x_clear_screen() already
does.

Fixes: fdd591e00a9c ("drm/ssd130x: Add support for the SSD132x OLED controller family")
Assisted-by: LLM
Cc: stable@vger.kernel.org
Signed-off-by: Fabio Piparo <holofermes@gmail.com>
---
Exercised on an SPI SSD1322 under local enablement patches for that
chip; compile-tested only on the SSD1325/1327. ssd133x_clear_screen()
has the same problem, left alone here for lack of hardware.

 drivers/gpu/drm/solomon/ssd130x.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
index 0b0fc6fe3df..256d370e240 100644
--- a/drivers/gpu/drm/solomon/ssd130x.c
+++ b/drivers/gpu/drm/solomon/ssd130x.c
@@ -900,9 +900,20 @@ static void ssd132x_clear_screen(struct ssd130x_device *ssd130x, u8 *data_array)
 {
 	unsigned int columns = DIV_ROUND_UP(ssd130x->width, SSD132X_SEGMENT_WIDTH);
 	unsigned int height = ssd130x->height;
+	int ret;
 
 	memset(data_array, 0, columns * height);
 
+	/* Set column start and end */
+	ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_COL_RANGE, 0, columns - 1);
+	if (ret < 0)
+		return;
+
+	/* Set row start and end */
+	ret = ssd130x_write_cmd(ssd130x, 3, SSD132X_SET_ROW_RANGE, 0, height - 1);
+	if (ret < 0)
+		return;
+
 	/* Write out update in one go since horizontal addressing mode is used */
 	ssd130x_write_data(ssd130x, data_array, columns * height);
 }
-- 
2.43.0
Re: [PATCH] drm/ssd130x: Set the address window in ssd132x_clear_screen()
Posted by Javier Martinez Canillas 2 weeks, 6 days ago
Fabio Piparo <holofermes@gmail.com> writes:

Hello Fabio,

Sorry for the delay. I was on vacation for a few weeks and I'm just
catching up on email.

> ssd132x_clear_screen() sends its zeroes without setting the column and
> row ranges first, so they land in whatever window the last
> ssd132x_update_rect() left programmed. A partial final update then
> leaves the rest of the screen uncleared, with fbcon the last damage is
> typically the cursor cell, so blanking keeps the console content on
> the panel.
>
> Set the full-screen window first, as ssd130x_clear_screen() already
> does.
>

All this makes a lot of sense to me.

> Fixes: fdd591e00a9c ("drm/ssd130x: Add support for the SSD132x OLED controller family")
> Assisted-by: LLM

I was going to mention that this isn't the convention documented in
https://docs.kernel.org/process/coding-assistants.html#attribution,
but I just noticed that there is a recent commit 816d9992d9ed
("coding-assistants: simplify attribution").

So your tag is correct and I learned today that "AGENT_NAME:MODEL_VERSION"
got deprecated.

> Cc: stable@vger.kernel.org
> Signed-off-by: Fabio Piparo <holofermes@gmail.com>
> ---
> Exercised on an SPI SSD1322 under local enablement patches for that
> chip; compile-tested only on the SSD1325/1327. ssd133x_clear_screen()
> has the same problem, left alone here for lack of hardware.
>
>  drivers/gpu/drm/solomon/ssd130x.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

I'll push to drm-misc (drm-misc-fixes). Thanks for fixing this issue!

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat