video: fbdev: ssd1307fb: Added support to Column offset

Started by Rodrigo Rolim Mendes de Alencar on May 13, 2020 · 4 messages from 4 authors · Last reply May 13, 2020

Subsystems (5)

Show 2 more

Maintainers (10)

Show 6 more
STALE2376d

open the first message on its own page

Message details and related content
This patch provides support for displays like VGM128064B0W10,
which requires a column offset of 2, i.e., its segments starts
in SEG2 and ends in SEG129.

Signed-off-by: Rodrigo Alencar <redacted>
---
 Documentation/devicetree/bindings/display/ssd1307fb.txt | 1 +
 drivers/video/fbdev/ssd1307fb.c                         | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/ssd1307fb.txt b/Documentation/devicetree/bindings/display/ssd1307fb.txt
index 27333b9551b3..a9b51fd724a9 100644
--- a/Documentation/devicetree/bindings/display/ssd1307fb.txt
+++ b/Documentation/devicetree/bindings/display/ssd1307fb.txt
@@ -19,6 +19,7 @@ Optional properties:
   - vbat-supply: The supply for VBAT
   - solomon,segment-no-remap: Display needs normal (non-inverted) data column
                               to segment mapping
+  - solomon,col-offset: Offset of columns (SEG) that the screen is mapped to.
   - solomon,com-seq: Display uses sequential COM pin configuration
   - solomon,com-lrremap: Display uses left-right COM pin remap
   - solomon,com-invdir: Display uses inverted COM pin scan direction
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 8e06ba912d60..0241585bfbcc 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -74,6 +74,7 @@ struct ssd1307fb_par {
 	struct fb_info *info;
 	u8 lookup_table[4];
 	u32 page_offset;
+	u32 col_offset;
 	u32 prechargep1;
 	u32 prechargep2;
 	struct pwm_device *pwm;
@@ -458,11 +459,11 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
 	if (ret < 0)
 		return ret;
 
-	ret = ssd1307fb_write_cmd(par->client, 0x0);
+	ret = ssd1307fb_write_cmd(par->client, par->col_offset);
 	if (ret < 0)
 		return ret;
 
-	ret = ssd1307fb_write_cmd(par->client, par->width - 1);
+	ret = ssd1307fb_write_cmd(par->client, par->col_offset + par->width - 1);
 	if (ret < 0)
 		return ret;
 
@@ -626,6 +627,9 @@ static int ssd1307fb_probe(struct i2c_client *client)
 	if (device_property_read_u32(dev, "solomon,page-offset", &par->page_offset))
 		par->page_offset = 1;
 
+	if (of_property_read_u32(node, "solomon,col-offset", &par->col_offset))
+		par->col_offset = 0;
+
 	if (device_property_read_u32(dev, "solomon,com-offset", &par->com_offset))
 		par->com_offset = 0;
 
-- 
2.23.0.rc1
Message details and related content
CC dt

On Wed, May 13, 2020 at 1:52 PM Rodrigo Rolim Mendes de Alencar
[off-list ref] wrote:
quoted hunk
This patch provides support for displays like VGM128064B0W10,
which requires a column offset of 2, i.e., its segments starts
in SEG2 and ends in SEG129.

Signed-off-by: Rodrigo Alencar <redacted>
---
 Documentation/devicetree/bindings/display/ssd1307fb.txt | 1 +
 drivers/video/fbdev/ssd1307fb.c                         | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/ssd1307fb.txt b/Documentation/devicetree/bindings/display/ssd1307fb.txt
index 27333b9551b3..a9b51fd724a9 100644
--- a/Documentation/devicetree/bindings/display/ssd1307fb.txt
+++ b/Documentation/devicetree/bindings/display/ssd1307fb.txt
@@ -19,6 +19,7 @@ Optional properties:
   - vbat-supply: The supply for VBAT
   - solomon,segment-no-remap: Display needs normal (non-inverted) data column
                               to segment mapping
+  - solomon,col-offset: Offset of columns (SEG) that the screen is mapped to.
   - solomon,com-seq: Display uses sequential COM pin configuration
   - solomon,com-lrremap: Display uses left-right COM pin remap
   - solomon,com-invdir: Display uses inverted COM pin scan direction
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 8e06ba912d60..0241585bfbcc 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -74,6 +74,7 @@ struct ssd1307fb_par {
        struct fb_info *info;
        u8 lookup_table[4];
        u32 page_offset;
+       u32 col_offset;
        u32 prechargep1;
        u32 prechargep2;
        struct pwm_device *pwm;
@@ -458,11 +459,11 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
        if (ret < 0)
                return ret;

-       ret = ssd1307fb_write_cmd(par->client, 0x0);
+       ret = ssd1307fb_write_cmd(par->client, par->col_offset);

17 more quoted lines

Message details and related content
On Wed, May 13, 2020 at 2:51 PM Rodrigo Rolim Mendes de Alencar
[off-list ref] wrote:
This patch provides support for displays like VGM128064B0W10,
which requires a column offset of 2, i.e., its segments starts
in SEG2 and ends in SEG129.
You forgot
1) version of the patch (series) to be bumped
2) Cc to fbdev maintainer (I did here FYI)
quoted hunk
-       ret = ssd1307fb_write_cmd(par->client, 0x0);
+       ret = ssd1307fb_write_cmd(par->client, par->col_offset);
        if (ret < 0)
                return ret;

-       ret = ssd1307fb_write_cmd(par->client, par->width - 1);
+       ret = ssd1307fb_write_cmd(par->client, par->col_offset + par->width - 1);
        if (ret < 0)
                return ret;
@@ -626,6 +627,9 @@ static int ssd1307fb_probe(struct i2c_client *client)
        if (device_property_read_u32(dev, "solomon,page-offset", &par->page_offset))
                par->page_offset = 1;

+       if (of_property_read_u32(node, "solomon,col-offset", &par->col_offset))
+               par->col_offset = 0;
This won't work on non-OF systems, but easy to fix: simple see around
and do in the same way.
        if (device_property_read_u32(dev, "solomon,com-offset", &par->com_offset))
                par->com_offset = 0;
-- 
With Best Regards,
Andy Shevchenko
Message details and related content
Hi Rodrigo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20200512]
[cannot apply to robh/for-next linus/master linux/master v5.7-rc5 v5.7-rc4 v5.7-rc3 v5.7-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Rodrigo-Rolim-Mendes-de-Alencar/video-fbdev-ssd1307fb-Added-support-to-Column-offset/20200513-195401
base:    e098d7762d602be640c53565ceca342f81e55ad2
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=alpha 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <redacted>

All errors (new ones prefixed by >>):

drivers/video/fbdev/ssd1307fb.c: In function 'ssd1307fb_probe':
quoted
drivers/video/fbdev/ssd1307fb.c:630:27: error: 'node' undeclared (first use in this function); did you mean 'inode'?
630 |  if (of_property_read_u32(node, "solomon,col-offset", &par->col_offset))
|                           ^~~~
|                           inode
drivers/video/fbdev/ssd1307fb.c:630:27: note: each undeclared identifier is reported only once for each function it appears in

vim +630 drivers/video/fbdev/ssd1307fb.c

   579	
   580	static int ssd1307fb_probe(struct i2c_client *client)
   581	{
   582		struct device *dev = &client->dev;
   583		struct backlight_device *bl;
   584		char bl_name[12];
   585		struct fb_info *info;
   586		struct fb_deferred_io *ssd1307fb_defio;
   587		u32 vmem_size;
   588		struct ssd1307fb_par *par;
   589		void *vmem;
   590		int ret;
   591	
   592		info = framebuffer_alloc(sizeof(struct ssd1307fb_par), dev);
   593		if (!info)
   594			return -ENOMEM;
   595	
   596		par = info->par;
   597		par->info = info;
   598		par->client = client;
   599	
   600		par->device_info = device_get_match_data(dev);
   601	
   602		par->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
   603		if (IS_ERR(par->reset)) {
   604			dev_err(dev, "failed to get reset gpio: %ld\n",
   605				PTR_ERR(par->reset));
   606			ret = PTR_ERR(par->reset);
   607			goto fb_alloc_error;
   608		}
   609	
   610		par->vbat_reg = devm_regulator_get_optional(dev, "vbat");
   611		if (IS_ERR(par->vbat_reg)) {

156 more lines

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help