drm/panel: jh057n0090: Add regulators and drop magic value in init
Subsystems (4)
v2 cover drm/panel: jh057n0090: Add regulators and drop magic value in init
Fix the omission of a regulators for the recently added panel and make sure all dsi commands start with a command instead of one having a magic constant (which already caused confusion).
Also adds a mail alias to the panel's MAINTAINER entry to reduce the bus factor.
Changes from v1:
* As per review comments from Sam Ravnborg:
- Print error on devm_regulator_get() failres
- Fix typos in commit messages
* Print an error on regulator_enable()
* Disable vcc if iovcc fails to enable
Guido Günther (4):
MAINTAINERS: Add Purism mail alias as reviewer for their devkit's
panel
drm/panel: jh057n00900: Don't use magic constant
dt-bindings: display/panel: jh057n00900: Document power supply
properties
drm/panel: jh057n00900: Add regulator support
.../display/panel/rocktech,jh057n00900.txt | 5 +++ MAINTAINERS | 1 + .../drm/panel/panel-rocktech-jh057n00900.c | 44 ++++++++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-)
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/4 MAINTAINERS: Add Purism mail alias as reviewer for their devkit's panel
Add a mail alias as reviewer for the rocktech jh057n00900 panel driver.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -5133,6 +5133,7 @@ F: include/uapi/drm/r128_drm.h DRM DRIVER FOR ROCKTECH JH057N00900 PANELS M: Guido Günther <[email protected]> +R: Purism Kernel Team <[email protected]> S: Maintained F: drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c F: Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
Signature · 1 line
2.20.1
PATCH v2 2/4 drm/panel: jh057n00900: Don't use magic constant
In reply to Guido Günther0xBF isn't in any ST7703 data sheet so mark it as unknown. This avoids confusion on whether there is a missing command in that dsi_generic_write_seq() call.
--- drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +2 -1
@@ -33,6 +33,7 @@#define ST7703_CMD_SETEXTC 0xB9#define ST7703_CMD_SETMIPI 0xBA#define ST7703_CMD_SETVDC 0xBC +#define ST7703_CMD_UNKNOWN0 0xBF#define ST7703_CMD_SETSCR 0xC0#define ST7703_CMD_SETPOWER 0xC1#define ST7703_CMD_SETPANEL 0xCC
@@ -94,7 +95,7 @@ static int jh057n_init_sequence(struct jh057n *ctx)msleep (20 );dsi_generic_write_seq (dsi,ST7703_CMD_SETVCOM ,0x3F ,0x3F ); -dsi_generic_write_seq (dsi,0xBF ,0x02 ,0x11 ,0x00 ); +dsi_generic_write_seq (dsi,ST7703_CMD_UNKNOWN0 ,0x02 ,0x11 ,0x00 ); dsi_generic_write_seq(dsi, ST7703_CMD_SETGIP1, 0x82, 0x10, 0x06, 0x05, 0x9E, 0x0A, 0xA5, 0x12, 0x31, 0x23, 0x37, 0x83, 0x04, 0xBC, 0x27, 0x38,
Signature · 1 line
2.20.1
PATCH v2 3/4 dt-bindings: display/panel: jh057n00900: Document power supply properties
In reply to Guido GüntherDocument the vcc-supply and iovcc-supply properties of the Rocktech jh057n00900 panel.
--- .../bindings/display/panel/rocktech,jh057n00900.txt | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt +5 -0
@@ -5,6 +5,9 @@ Required properties: - reg: DSI virtual channel of the peripheral - reset-gpios: panel reset gpio - backlight: phandle of the backlight device attached to the panel +- vcc-supply: phandle of the regulator that provides the vcc supply voltage. +- iovcc-supply: phandle of the regulator that provides the iovcc supply + voltage. Example:
@@ -14,5 +17,7 @@ Example: reg = <0>; backlight = <&backlight>; reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; + vcc-supply = <®_2v8_p>; + iovcc-supply = <®_1v8_p>; }; };
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 4/4 drm/panel: jh057n00900: Add regulator support
In reply to Guido GüntherAllow to specify regulators for vcc and iovcc. According to the data sheet the panel wants vcc (2.8V) and iovcc (1.8V) and there's no startup dependency between the two.
--- .../drm/panel/panel-rocktech-jh057n00900.c | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+)
drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +41 -0
@@ -15,6 +15,7 @@#include <linux/gpio/consumer.h> #include <linux/media-bus-format.h> #include <linux/module.h> +#include <linux/regulator/consumer.h> #include <video/display_timing.h> #include <video/mipi_display.h>
@@ -47,6 +48,8 @@ struct jh057n {struct drm_panel panel;struct gpio_desc *reset_gpio;struct backlight_device *backlight; +struct regulator *vcc; +struct regulator *iovcc;bool prepared;struct dentry *debugfs;
@@ -160,6 +163,8 @@ static int jh057n_unprepare(struct drm_panel *panel)return 0 ;mipi_dsi_dcs_set_display_off (dsi); +regulator_disable (ctx->iovcc); +regulator_disable (ctx->vcc); ctx->prepared = false;return 0 ;
@@ -174,6 +179,19 @@ static int jh057n_prepare(struct drm_panel *panel)return 0 ;DRM_DEV_DEBUG_DRIVER (ctx->dev,"Resetting the panel\n" ); + ret =regulator_enable (ctx->vcc); +if (ret <0 ) { +DRM_DEV_ERROR (ctx->dev, +"Failed to enable vcc supply: %d\n" , ret); +return ret; + } + ret =regulator_enable (ctx->iovcc); +if (ret <0 ) { +DRM_DEV_ERROR (ctx->dev, +"Failed to enable iovcc supply: %d\n" , ret); + goto disable_vcc; + } +gpiod_set_value_cansleep (ctx->reset_gpio,1 );usleep_range (20 ,40 );gpiod_set_value_cansleep (ctx->reset_gpio,0 );
@@ -189,6 +207,10 @@ static int jh057n_prepare(struct drm_panel *panel) ctx->prepared = true;return 0 ; + +disable_vcc: +regulator_disable (ctx->vcc); +return ret; }static const struct drm_display_mode default_mode = {
@@ -301,6 +323,25 @@ static int jh057n_probe(struct mipi_dsi_device *dsi)if (IS_ERR (ctx->backlight))return PTR_ERR (ctx->backlight); + ctx->vcc =devm_regulator_get (dev,"vcc" ); +if (IS_ERR (ctx->vcc)) { + ret =PTR_ERR (ctx->vcc); +if (ret != -EPROBE_DEFER ) +DRM_DEV_ERROR (dev, +"Failed to request vcc regulator: %d\n" , + ret); +return ret; + } + ctx->iovcc =devm_regulator_get (dev,"iovcc" ); +if (IS_ERR (ctx->iovcc)) { + ret =PTR_ERR (ctx->iovcc); +if (ret != -EPROBE_DEFER ) +DRM_DEV_ERROR (dev, +"Failed to request iovcc regulator: %d\n" , + ret); +return ret; + } +drm_panel_init (&ctx->panel); ctx->panel.dev = dev; ctx->panel.funcs = &jh057n_drm_funcs;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Guido.
Quoted 14 lines · Guido Günther
Fix the omission of a regulators for the recently added panel and make sure all dsi commands start with a command instead of one having a magic constant (which already caused confusion).
Also adds a mail alias to the panel's MAINTAINER entry to reduce the bus factor.
Changes from v1:
* As per review comments from Sam Ravnborg:
- Print error ondevm_regulator_get()failres
- Fix typos in commit messages
* Print an error onregulator_enable()
* Disable vcc if iovcc fails to enable
Quoted 7 lines
Guido Günther (4):
MAINTAINERS: Add Purism mail alias as reviewer for their devkit's
panel
drm/panel: jh057n00900: Don't use magic constant
dt-bindings: display/panel: jh057n00900: Document power supply
properties
drm/panel: jh057n00900: Add regulator support
Patches applied to drm-misc-next and pushed out
Sam
Hi,
Quoted 25 lines · Sam Ravnborg
Hi Guido.
Quoted 14 lines · Guido Günther
Fix the omission of a regulators for the recently added panel and make sure all dsi commands start with a command instead of one having a magic constant (which already caused confusion).
Also adds a mail alias to the panel's MAINTAINER entry to reduce the bus factor.
Changes from v1:
* As per review comments from Sam Ravnborg:
- Print error ondevm_regulator_get()failres
- Fix typos in commit messages
* Print an error onregulator_enable()
* Disable vcc if iovcc fails to enableQuoted 7 lines
Guido Günther (4):
MAINTAINERS: Add Purism mail alias as reviewer for their devkit's
panel
drm/panel: jh057n00900: Don't use magic constant
dt-bindings: display/panel: jh057n00900: Document power supply
properties
drm/panel: jh057n00900: Add regulator support
Quoted 1 line
Patches applied to drm-misc-next and pushed out
Thank you!
-- Guido
Quoted 3 lines
Sam