2023-08-03 21:00:40

by Michael Riesch

[permalink] [raw]
Subject: [PATCH v2 0/3] drm/panel: sitronix-st7789v: add panel orientation support

Hi all,

This series adds support for orientation specification in the device
tree to the Sitronix ST7789V panel driver.

This is can be seen as reduced version of [0] (some things of [0] have
been implemented in more general fashion in the scope of [1], other
things have been rejected).

Looking forward to your comments!

[0] https://lore.kernel.org/lkml/[email protected]/
[1] https://lore.kernel.org/lkml/[email protected]/

---
Changes in v2:
- Move indentation fix to separate patch (as suggested by Neil)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Michael Riesch (3):
drm/panel: sitronix-st7789v: fix indentation in drm_panel_funcs
drm/panel: sitronix-st7789v: add panel orientation support
dt-bindings: display: add rotation property to sitronix,st7789v

.../bindings/display/panel/sitronix,st7789v.yaml | 2 ++
drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 28 ++++++++++++++++++----
2 files changed, 25 insertions(+), 5 deletions(-)
---
base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
change-id: 20230718-feature-st7789v-4d0c2c6e2429

Best regards,
--
Michael Riesch <[email protected]>



2023-08-03 21:01:17

by Michael Riesch

[permalink] [raw]
Subject: [PATCH v2 2/3] drm/panel: sitronix-st7789v: add panel orientation support

Determine the orientation of the display based on the device tree and
propagate it.

Reviewed-by: Neil Armstrong <[email protected]>
Signed-off-by: Michael Riesch <[email protected]>
---
drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index c7cbfe6ca82c..6575f07d49e3 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -116,6 +116,7 @@ struct st7789v {
struct spi_device *spi;
struct gpio_desc *reset;
struct regulator *power;
+ enum drm_panel_orientation orientation;
};

enum st7789v_prefix {
@@ -170,6 +171,7 @@ static const struct drm_display_mode default_mode = {
static int st7789v_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
+ struct st7789v *ctx = panel_to_st7789v(panel);
struct drm_display_mode *mode;

mode = drm_mode_duplicate(connector->dev, &default_mode);
@@ -188,9 +190,22 @@ static int st7789v_get_modes(struct drm_panel *panel,
connector->display_info.width_mm = 61;
connector->display_info.height_mm = 103;

+ /*
+ * TODO: Remove once all drm drivers call
+ * drm_connector_set_orientation_from_panel()
+ */
+ drm_connector_set_panel_orientation(connector, ctx->orientation);
+
return 1;
}

+static enum drm_panel_orientation st7789v_get_orientation(struct drm_panel *p)
+{
+ struct st7789v *ctx = panel_to_st7789v(p);
+
+ return ctx->orientation;
+}
+
static int st7789v_prepare(struct drm_panel *panel)
{
struct st7789v *ctx = panel_to_st7789v(panel);
@@ -349,6 +364,7 @@ static const struct drm_panel_funcs st7789v_drm_funcs = {
.disable = st7789v_disable,
.enable = st7789v_enable,
.get_modes = st7789v_get_modes,
+ .get_orientation = st7789v_get_orientation,
.prepare = st7789v_prepare,
.unprepare = st7789v_unprepare,
};
@@ -382,6 +398,8 @@ static int st7789v_probe(struct spi_device *spi)
if (ret)
return ret;

+ of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
+
drm_panel_add(&ctx->panel);

return 0;

--
2.37.2


2023-08-03 21:06:59

by Michael Riesch

[permalink] [raw]
Subject: [PATCH v2 3/3] dt-bindings: display: add rotation property to sitronix,st7789v

The sitronix-st7789v driver now considers the rotation property.
Add the property to the documentation.

Acked-by: Conor Dooley <[email protected]>
Signed-off-by: Michael Riesch <[email protected]>
---
Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml b/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
index fa6556363cca..694d7f771d0c 100644
--- a/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
+++ b/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
@@ -22,6 +22,7 @@ properties:
power-supply: true
backlight: true
port: true
+ rotation: true

spi-cpha: true
spi-cpol: true
@@ -52,6 +53,7 @@ examples:
reset-gpios = <&pio 6 11 GPIO_ACTIVE_LOW>;
backlight = <&pwm_bl>;
power-supply = <&power>;
+ rotation = <180>;
spi-max-frequency = <100000>;
spi-cpol;
spi-cpha;

--
2.37.2


2023-08-03 21:11:28

by Michael Riesch

[permalink] [raw]
Subject: [PATCH v2 1/3] drm/panel: sitronix-st7789v: fix indentation in drm_panel_funcs

Fix indentation of the callbacks in struct drm_panel_funcs.
No functional changes.

Signed-off-by: Michael Riesch <[email protected]>
---
drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index bbc4569cbcdc..c7cbfe6ca82c 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -346,11 +346,11 @@ static int st7789v_unprepare(struct drm_panel *panel)
}

static const struct drm_panel_funcs st7789v_drm_funcs = {
- .disable = st7789v_disable,
- .enable = st7789v_enable,
- .get_modes = st7789v_get_modes,
- .prepare = st7789v_prepare,
- .unprepare = st7789v_unprepare,
+ .disable = st7789v_disable,
+ .enable = st7789v_enable,
+ .get_modes = st7789v_get_modes,
+ .prepare = st7789v_prepare,
+ .unprepare = st7789v_unprepare,
};

static int st7789v_probe(struct spi_device *spi)

--
2.37.2


2023-08-04 03:46:28

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] drm/panel: sitronix-st7789v: add panel orientation support

Hi,

On Thu, Aug 03, 2023 at 10:13:49PM +0200, Michael Riesch wrote:
> Determine the orientation of the display based on the device tree and
> propagate it.
>
> Reviewed-by: Neil Armstrong <[email protected]>
> Signed-off-by: Michael Riesch <[email protected]>
> ---

Reviewed-by: Sebastian Reichel <[email protected]>

-- Sebastian

> drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index c7cbfe6ca82c..6575f07d49e3 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -116,6 +116,7 @@ struct st7789v {
> struct spi_device *spi;
> struct gpio_desc *reset;
> struct regulator *power;
> + enum drm_panel_orientation orientation;
> };
>
> enum st7789v_prefix {
> @@ -170,6 +171,7 @@ static const struct drm_display_mode default_mode = {
> static int st7789v_get_modes(struct drm_panel *panel,
> struct drm_connector *connector)
> {
> + struct st7789v *ctx = panel_to_st7789v(panel);
> struct drm_display_mode *mode;
>
> mode = drm_mode_duplicate(connector->dev, &default_mode);
> @@ -188,9 +190,22 @@ static int st7789v_get_modes(struct drm_panel *panel,
> connector->display_info.width_mm = 61;
> connector->display_info.height_mm = 103;
>
> + /*
> + * TODO: Remove once all drm drivers call
> + * drm_connector_set_orientation_from_panel()
> + */
> + drm_connector_set_panel_orientation(connector, ctx->orientation);
> +
> return 1;
> }
>
> +static enum drm_panel_orientation st7789v_get_orientation(struct drm_panel *p)
> +{
> + struct st7789v *ctx = panel_to_st7789v(p);
> +
> + return ctx->orientation;
> +}
> +
> static int st7789v_prepare(struct drm_panel *panel)
> {
> struct st7789v *ctx = panel_to_st7789v(panel);
> @@ -349,6 +364,7 @@ static const struct drm_panel_funcs st7789v_drm_funcs = {
> .disable = st7789v_disable,
> .enable = st7789v_enable,
> .get_modes = st7789v_get_modes,
> + .get_orientation = st7789v_get_orientation,
> .prepare = st7789v_prepare,
> .unprepare = st7789v_unprepare,
> };
> @@ -382,6 +398,8 @@ static int st7789v_probe(struct spi_device *spi)
> if (ret)
> return ret;
>
> + of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
> +
> drm_panel_add(&ctx->panel);
>
> return 0;
>
> --
> 2.37.2
>


Attachments:
(No filename) (2.50 kB)
signature.asc (849.00 B)
Download all attachments

2023-08-04 03:56:52

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] dt-bindings: display: add rotation property to sitronix,st7789v

Hi,

On Thu, Aug 03, 2023 at 10:13:50PM +0200, Michael Riesch wrote:
> The sitronix-st7789v driver now considers the rotation property.
> Add the property to the documentation.
>
> Acked-by: Conor Dooley <[email protected]>
> Signed-off-by: Michael Riesch <[email protected]>
> ---

Reviewed-by: Sebastian Reichel <[email protected]>

-- Sebastian

> Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml b/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
> index fa6556363cca..694d7f771d0c 100644
> --- a/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml
> @@ -22,6 +22,7 @@ properties:
> power-supply: true
> backlight: true
> port: true
> + rotation: true
>
> spi-cpha: true
> spi-cpol: true
> @@ -52,6 +53,7 @@ examples:
> reset-gpios = <&pio 6 11 GPIO_ACTIVE_LOW>;
> backlight = <&pwm_bl>;
> power-supply = <&power>;
> + rotation = <180>;
> spi-max-frequency = <100000>;
> spi-cpol;
> spi-cpha;
>
> --
> 2.37.2
>


Attachments:
(No filename) (1.32 kB)
signature.asc (849.00 B)
Download all attachments

2023-08-04 04:19:18

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] drm/panel: sitronix-st7789v: fix indentation in drm_panel_funcs

Hi,

On Thu, Aug 03, 2023 at 10:13:48PM +0200, Michael Riesch wrote:
> Fix indentation of the callbacks in struct drm_panel_funcs.
> No functional changes.
>
> Signed-off-by: Michael Riesch <[email protected]>
> ---

Reviewed-by: Sebastian Reichel <[email protected]>

-- Sebastian

> drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index bbc4569cbcdc..c7cbfe6ca82c 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -346,11 +346,11 @@ static int st7789v_unprepare(struct drm_panel *panel)
> }
>
> static const struct drm_panel_funcs st7789v_drm_funcs = {
> - .disable = st7789v_disable,
> - .enable = st7789v_enable,
> - .get_modes = st7789v_get_modes,
> - .prepare = st7789v_prepare,
> - .unprepare = st7789v_unprepare,
> + .disable = st7789v_disable,
> + .enable = st7789v_enable,
> + .get_modes = st7789v_get_modes,
> + .prepare = st7789v_prepare,
> + .unprepare = st7789v_unprepare,
> };
>
> static int st7789v_probe(struct spi_device *spi)
>
> --
> 2.37.2
>


Attachments:
(No filename) (1.25 kB)
signature.asc (849.00 B)
Download all attachments

2023-08-04 09:25:39

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] drm/panel: sitronix-st7789v: add panel orientation support

Hi,

On 03/08/2023 22:13, Michael Riesch wrote:
> Determine the orientation of the display based on the device tree and
> propagate it.
>
> Reviewed-by: Neil Armstrong <[email protected]>
> Signed-off-by: Michael Riesch <[email protected]>
> ---
> drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index c7cbfe6ca82c..6575f07d49e3 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -116,6 +116,7 @@ struct st7789v {
> struct spi_device *spi;
> struct gpio_desc *reset;
> struct regulator *power;
> + enum drm_panel_orientation orientation;
> };
>
> enum st7789v_prefix {
> @@ -170,6 +171,7 @@ static const struct drm_display_mode default_mode = {
> static int st7789v_get_modes(struct drm_panel *panel,
> struct drm_connector *connector)
> {
> + struct st7789v *ctx = panel_to_st7789v(panel);
> struct drm_display_mode *mode;
>
> mode = drm_mode_duplicate(connector->dev, &default_mode);
> @@ -188,9 +190,22 @@ static int st7789v_get_modes(struct drm_panel *panel,
> connector->display_info.width_mm = 61;
> connector->display_info.height_mm = 103;
>
> + /*
> + * TODO: Remove once all drm drivers call
> + * drm_connector_set_orientation_from_panel()
> + */
> + drm_connector_set_panel_orientation(connector, ctx->orientation);
> +
> return 1;
> }
>
> +static enum drm_panel_orientation st7789v_get_orientation(struct drm_panel *p)
> +{
> + struct st7789v *ctx = panel_to_st7789v(p);
> +
> + return ctx->orientation;
> +}
> +
> static int st7789v_prepare(struct drm_panel *panel)
> {
> struct st7789v *ctx = panel_to_st7789v(panel);
> @@ -349,6 +364,7 @@ static const struct drm_panel_funcs st7789v_drm_funcs = {
> .disable = st7789v_disable,
> .enable = st7789v_enable,
> .get_modes = st7789v_get_modes,
> + .get_orientation = st7789v_get_orientation,
> .prepare = st7789v_prepare,
> .unprepare = st7789v_unprepare,
> };
> @@ -382,6 +398,8 @@ static int st7789v_probe(struct spi_device *spi)
> if (ret)
> return ret;
>
> + of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
> +
> drm_panel_add(&ctx->panel);
>
> return 0;
>

This patch doesn't apply clean on drm-misc-next, could you rebase and resend ?

Thanks,
Neil

2023-08-04 12:51:37

by Michael Riesch

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] drm/panel: sitronix-st7789v: add panel orientation support

Hi Neil,

On 8/4/23 10:40, Neil Armstrong wrote:
> Hi,
>
> On 03/08/2023 22:13, Michael Riesch wrote:
>> Determine the orientation of the display based on the device tree and
>> propagate it.
>>
>> Reviewed-by: Neil Armstrong <[email protected]>
>> Signed-off-by: Michael Riesch <[email protected]>
>> ---
>>   drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 18 ++++++++++++++++++
>>   1 file changed, 18 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
>> b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
>> index c7cbfe6ca82c..6575f07d49e3 100644
>> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
>> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
>> @@ -116,6 +116,7 @@ struct st7789v {
>>       struct spi_device *spi;
>>       struct gpio_desc *reset;
>>       struct regulator *power;
>> +    enum drm_panel_orientation orientation;
>>   };
>>     enum st7789v_prefix {
>> @@ -170,6 +171,7 @@ static const struct drm_display_mode default_mode = {
>>   static int st7789v_get_modes(struct drm_panel *panel,
>>                    struct drm_connector *connector)
>>   {
>> +    struct st7789v *ctx = panel_to_st7789v(panel);
>>       struct drm_display_mode *mode;
>>         mode = drm_mode_duplicate(connector->dev, &default_mode);
>> @@ -188,9 +190,22 @@ static int st7789v_get_modes(struct drm_panel
>> *panel,
>>       connector->display_info.width_mm = 61;
>>       connector->display_info.height_mm = 103;
>>   +    /*
>> +     * TODO: Remove once all drm drivers call
>> +     * drm_connector_set_orientation_from_panel()
>> +     */
>> +    drm_connector_set_panel_orientation(connector, ctx->orientation);
>> +
>>       return 1;
>>   }
>>   +static enum drm_panel_orientation st7789v_get_orientation(struct
>> drm_panel *p)
>> +{
>> +    struct st7789v *ctx = panel_to_st7789v(p);
>> +
>> +    return ctx->orientation;
>> +}
>> +
>>   static int st7789v_prepare(struct drm_panel *panel)
>>   {
>>       struct st7789v *ctx = panel_to_st7789v(panel);
>> @@ -349,6 +364,7 @@ static const struct drm_panel_funcs
>> st7789v_drm_funcs = {
>>       .disable = st7789v_disable,
>>       .enable    = st7789v_enable,
>>       .get_modes = st7789v_get_modes,
>> +    .get_orientation = st7789v_get_orientation,
>>       .prepare = st7789v_prepare,
>>       .unprepare = st7789v_unprepare,
>>   };
>> @@ -382,6 +398,8 @@ static int st7789v_probe(struct spi_device *spi)
>>       if (ret)
>>           return ret;
>>   +    of_drm_get_panel_orientation(spi->dev.of_node, &ctx->orientation);
>> +
>>       drm_panel_add(&ctx->panel);
>>         return 0;
>>
>
> This patch doesn't apply clean on drm-misc-next, could you rebase and
> resend ?

Sure! v3 is out.

Best regards,
Michael

>
> Thanks,
> Neil