fbdev: ssd1307fb: Make reset-gpios optional property
Subsystems (4)
cover fbdev: ssd1307fb: Make reset-gpios optional property
Use gpiod for reset-gpios property and make it optional. Also removes the nerver implemented reset-active-low property from the devicetree binding document. The default gpio binding should be enough.
Jyri Sarha (3):
fbdev: ssd1307fb: Start to use gpiod API for reset gpio
fbdev: ssd1307fb: Remove reset-active-low from the DT binding document
fbdev: ssd1307fb: Make reset gpio devicetree property optional
.../devicetree/bindings/display/ssd1307fb.txt | 4 +-- drivers/video/fbdev/ssd1307fb.c | 38 ++++++++++------------ 2 files changed, 20 insertions(+), 22 deletions(-)
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 fbdev: ssd1307fb: Start to use gpiod API for reset gpio
Start to use gpiod API for reset gpio.
--- drivers/video/fbdev/ssd1307fb.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)
drivers/video/fbdev/ssd1307fb.c +8 -17
@@ -73,7 +73,7 @@ struct ssd1307fb_par {u32 prechargep2;struct pwm_device *pwm;u32 pwm_period; -int reset; +struct gpio_desc *reset;u32 seg_remap;u32 vcomh;u32 width;
@@ -562,10 +562,11 @@ static int ssd1307fb_probe(struct i2c_client *client, par->device_info = (struct ssd1307fb_deviceinfo *)of_match_device ( ssd1307fb_of_match, &client->dev)->data; - par->reset =of_get_named_gpio (client->dev.of_node, -"reset-gpios" ,0 ); -if (!gpio_is_valid (par->reset)) { - ret = -EINVAL ; + par->reset =devm_gpiod_get (&client->dev,"reset" ,GPIOD_OUT_LOW ); +if (IS_ERR (par->reset)) { +dev_err (&client->dev,"failed to get reset gpio: %ld\n" , +PTR_ERR (par->reset)); + ret =PTR_ERR (par->reset); goto fb_alloc_error; }
@@ -643,22 +644,12 @@ static int ssd1307fb_probe(struct i2c_client *client,fb_deferred_io_init (info); - ret =devm_gpio_request_one (&client->dev, par->reset, -GPIOF_OUT_INIT_HIGH , -"oled-reset" ); -if (ret) { -dev_err (&client->dev, -"failed to request gpio %d: %d\n" , - par->reset, ret); - goto reset_oled_error; - } -i2c_set_clientdata (client, info);/* Reset the screen */ -gpio_set_value (par->reset,0 ); +gpiod_set_value (par->reset,0 );udelay (4 ); -gpio_set_value (par->reset,1 ); +gpiod_set_value (par->reset,1 );udelay (4 ); ret =ssd1307fb_init (par);
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 fbdev: ssd1307fb: Remove reset-active-low from the DT binding document
In reply to a message not in the archiveRemove reset-active-low from the devicetree binding document. The actual implementation has never been there in the driver code and there is no reason to add it because the gpiod API supports gpio flags, including GPIO_ACTIVE_LOW, directly trough its own devicetree binding.
--- Documentation/devicetree/bindings/display/ssd1307fb.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/ssd1307fb.txt +2 -2
@@ -8,14 +8,14 @@ Required properties: 0x3c or 0x3d - pwm: Should contain the pwm to use according to the OF device tree PWM specification [0]. Only required for the ssd1307. - - reset-gpios: Should contain the GPIO used to reset the OLED display + - reset-gpios: Should contain the GPIO used to reset the OLED display. See + Documentation/devicetree/bindings/gpio/gpio.txt for details. - solomon,height: Height in pixel of the screen driven by the controller - solomon,width: Width in pixel of the screen driven by the controller - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is mapped to. Optional properties: - - reset-active-low: Is the reset gpio is active on physical low? - solomon,segment-no-remap: Display needs normal (non-inverted) data column to segment mapping - solomon,com-seq: Display uses sequential COM pin configuration
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): fc99babab77bbf9fcbe34fc82d7e2a18f9a1e464.1465303439.git.jsarha-l0cyMroinI0@public.gmane.org
Re: [PATCH 2/3] fbdev: ssd1307fb: Remove reset-active-low from the DT binding document
Quoted 15 lines · Jyri Sarha
Remove reset-active-low from the devicetree binding document. The actual implementation has never been there in the driver code and there is no reason to add it because the gpiod API supports gpio flags, including
GPIO_ACTIVE_LOW, directly trough its own devicetree binding.Signed-off-by Jyri Sarha <[email protected]>--- Documentation/devicetree/bindings/display/ssd1307fb.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/display/ssd1307fb.txt +0
-0
Documentation/devicetree/bindings/display/ssd1307fb.txt Required properties: · line 12
Quoted 6 lines
Documentation/devicetree/bindings/display/ssd1307fb.txt +2
-1@@ -8,14 +8,14 @@ Required properties: 0x3c or 0x3d - pwm: Should contain the pwm to use according to the OF device tree PWM specification [0]. Only required for the ssd1307. - - reset-gpios: Should contain the GPIO used to reset the OLED display + - reset-gpios: Should contain the GPIO used to reset the OLED display. See + Documentation/devicetree/bindings/gpio/gpio.txt for details.
You should state here it is active low.
Quoted 17 lines
Documentation/devicetree/bindings/display/ssd1307fb.txt +0
-1- solomon,height: Height in pixel of the screen driven by the controller - solomon,width: Width in pixel of the screen driven by the controller - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is mapped to. Optional properties: - - reset-active-low: Is the reset gpio is active on physical low? - solomon,segment-no-remap: Display needs normal (non-inverted) data column to segment mapping - solomon,com-seq: Display uses sequential COM pin configurationSignature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 fbdev: ssd1307fb: Make reset gpio devicetree property optional
In reply to a message not in the archiveMake reset gpio devicetree property optional. Depending on the board designing there may not be a dedicated gpio for resetting the display. Without a proper reset there may be some junk in the display memory at probe time, so in such a case the display memory is cleared before turning it on. The devicetree binding document is also updated.
--- .../devicetree/bindings/display/ssd1307fb.txt | 4 ++-- drivers/video/fbdev/ssd1307fb.c | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/display/ssd1307fb.txt +2 -2
@@ -8,14 +8,14 @@ Required properties: 0x3c or 0x3d - pwm: Should contain the pwm to use according to the OF device tree PWM specification [0]. Only required for the ssd1307. - - reset-gpios: Should contain the GPIO used to reset the OLED display. See - Documentation/devicetree/bindings/gpio/gpio.txt for details. - solomon,height: Height in pixel of the screen driven by the controller - solomon,width: Width in pixel of the screen driven by the controller - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is mapped to. Optional properties: + - reset-gpios: The GPIO used to reset the OLED display, if available. See + Documentation/devicetree/bindings/gpio/gpio.txt for details. - solomon,segment-no-remap: Display needs normal (non-inverted) data column to segment mapping - solomon,com-seq: Display uses sequential COM pin configuration
drivers/video/fbdev/ssd1307fb.c +13 -6
@@ -439,6 +439,10 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)if (ret <0 )return ret; +/* Clear the screen if we could not give reset at probe time */ +if (!par->reset) +ssd1307fb_update_display (par); +/* Turn on the display */ ret =ssd1307fb_write_cmd (par->client,SSD1307FB_DISPLAY_ON );if (ret <0 )
@@ -562,7 +566,8 @@ static int ssd1307fb_probe(struct i2c_client *client, par->device_info = (struct ssd1307fb_deviceinfo *)of_match_device ( ssd1307fb_of_match, &client->dev)->data; - par->reset =devm_gpiod_get (&client->dev,"reset" ,GPIOD_OUT_LOW ); + par->reset =devm_gpiod_get_optional (&client->dev,"reset" , +GPIOD_OUT_LOW );if (IS_ERR (par->reset)) {dev_err (&client->dev,"failed to get reset gpio: %ld\n" ,PTR_ERR (par->reset));
@@ -646,11 +651,13 @@ static int ssd1307fb_probe(struct i2c_client *client,i2c_set_clientdata (client, info); -/* Reset the screen */ -gpiod_set_value (par->reset,0 ); -udelay (4 ); -gpiod_set_value (par->reset,1 ); -udelay (4 ); +if (par->reset) { +/* Reset the screen */ +gpiod_set_value (par->reset,0 ); +udelay (4 ); +gpiod_set_value (par->reset,1 ); +udelay (4 ); + } ret =ssd1307fb_init (par);if (ret)
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html