[PATCH 2/3] drm/ssd130x: fix ssd132x encoding

John Keeping posted 3 patches 11 months, 1 week ago
There is a newer version of this series
[PATCH 2/3] drm/ssd130x: fix ssd132x encoding
Posted by John Keeping 11 months, 1 week ago
The ssd132x buffer is encoded one pixel per nibble, with two pixels in
each byte.  When encoding and 8-bit greyscale input, take the top 4-bits
as the value and ensure the two pixels are distinct and do not overwrite
each other.

Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
---
 drivers/gpu/drm/solomon/ssd130x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
index 2622172228361..64f1123080996 100644
--- a/drivers/gpu/drm/solomon/ssd130x.c
+++ b/drivers/gpu/drm/solomon/ssd130x.c
@@ -880,7 +880,7 @@ static int ssd132x_update_rect(struct ssd130x_device *ssd130x,
 			u8 n1 = buf[i * width + j];
 			u8 n2 = buf[i * width + j + 1];
 
-			data_array[array_idx++] = (n2 << 4) | n1;
+			data_array[array_idx++] = (n2 & 0xf0) | (n1 >> 4);
 		}
 	}
 
-- 
2.47.1
Re: [PATCH 2/3] drm/ssd130x: fix ssd132x encoding
Posted by Javier Martinez Canillas 11 months, 1 week ago
John Keeping <jkeeping@inmusicbrands.com> writes:

> The ssd132x buffer is encoded one pixel per nibble, with two pixels in
> each byte.  When encoding and 8-bit greyscale input, take the top 4-bits

I think the correct phrase is "encoding an 8-bit" ?

> as the value and ensure the two pixels are distinct and do not overwrite
> each other.
>

Fixes: fdd591e00a9c ("drm/ssd130x: Add support for the SSD132x OLED controller family")

> Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
> ---
>  drivers/gpu/drm/solomon/ssd130x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
> index 2622172228361..64f1123080996 100644
> --- a/drivers/gpu/drm/solomon/ssd130x.c
> +++ b/drivers/gpu/drm/solomon/ssd130x.c
> @@ -880,7 +880,7 @@ static int ssd132x_update_rect(struct ssd130x_device *ssd130x,
>  			u8 n1 = buf[i * width + j];
>  			u8 n2 = buf[i * width + j + 1];
>  
> -			data_array[array_idx++] = (n2 << 4) | n1;
> +			data_array[array_idx++] = (n2 & 0xf0) | (n1 >> 4);
>  		}
>  	}

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

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat