dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format
@ 2023-01-02 20:25 Javier Martinez Canillas
  2023-01-02 20:25 ` [PATCH v2 2/2] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro Javier Martinez Canillas
  2023-01-02 20:30 ` [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format Sam Ravnborg
  0 siblings, 2 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2023-01-02 20:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Nick Desaulniers, Thomas Zimmermann, Sam Ravnborg, llvm,
	Javier Martinez Canillas, Nathan Chancellor, dri-devel, Tom Rix

Change made using a `clang-format -i include/drm/drm_mipi_dsi.h` command.

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

Changes in v2:
- New patch in v2.

 include/drm/drm_mipi_dsi.h | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 20b21b577dea..e9d1e8a7fc7e 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -303,15 +303,18 @@ int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
  * @cmd: Command
  * @seq: buffer containing data to be transmitted
  */
-#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) do {				\
-		static const u8 d[] = { cmd, seq };				\
-		struct device *dev = &dsi->dev;	\
-		int ret;						\
-		ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));	\
-		if (ret < 0) {						\
-			dev_err_ratelimited(dev, "sending command %#02x failed: %d\n", cmd, ret); \
-			return ret;						\
-		}						\
+#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...)                           \
+	do {                                                               \
+		static const u8 d[] = { cmd, seq };                        \
+		struct device *dev = &dsi->dev;                            \
+		int ret;                                                   \
+		ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));    \
+		if (ret < 0) {                                             \
+			dev_err_ratelimited(                               \
+				dev, "sending command %#02x failed: %d\n", \
+				cmd, ret);                                 \
+			return ret;                                        \
+		}                                                          \
 	} while (0)
 
 /**
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro
  2023-01-02 20:25 [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format Javier Martinez Canillas
@ 2023-01-02 20:25 ` Javier Martinez Canillas
  2023-01-07 17:37   ` Javier Martinez Canillas
  2023-01-02 20:30 ` [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format Sam Ravnborg
  1 sibling, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2023-01-02 20:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Zimmermann, Sam Ravnborg, Javier Martinez Canillas,
	dri-devel

Many panel drivers define dsi_dcs_write_seq() and dsi_generic_write_seq()
macros to send DCS commands and generic write packets respectively, with
the payload specified as a list of parameters instead of using arrays.

There's already a macro for the former, introduced by commit 2a9e9daf75231
("drm/mipi-dsi: Introduce mipi_dsi_dcs_write_seq macro") so drivers can be
changed to use that. But there isn't one yet for the latter, let's add it.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
---

Changes in v2:
- Fix kernel-doc macro name (kernel test robot, Sam Ravnborg)
- Add Sam Ravnborg's Reviewed-by tag.

 include/drm/drm_mipi_dsi.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index e9d1e8a7fc7e..4f503d99f668 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -297,6 +297,24 @@ int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
 int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
 					u16 *brightness);
 
+/**
+ * mipi_dsi_generic_write_seq - transmit data using a generic write packet
+ * @dsi: DSI peripheral device
+ * @seq: buffer containing the payload
+ */
+#define mipi_dsi_generic_write_seq(dsi, seq...)                                \
+	do {                                                                   \
+		static const u8 d[] = { seq };                                 \
+		struct device *dev = &dsi->dev;                                \
+		int ret;                                                       \
+		ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));           \
+		if (ret < 0) {                                                 \
+			dev_err_ratelimited(dev, "transmit data failed: %d\n", \
+					    ret);                              \
+			return ret;                                            \
+		}                                                              \
+	} while (0)
+
 /**
  * mipi_dsi_dcs_write_seq - transmit a DCS command with payload
  * @dsi: DSI peripheral device
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format
  2023-01-02 20:25 [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format Javier Martinez Canillas
  2023-01-02 20:25 ` [PATCH v2 2/2] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro Javier Martinez Canillas
@ 2023-01-02 20:30 ` Sam Ravnborg
  2023-01-07 17:36   ` Javier Martinez Canillas
  1 sibling, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2023-01-02 20:30 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Thomas Zimmermann, Nick Desaulniers, llvm, linux-kernel,
	Nathan Chancellor, dri-devel, Tom Rix

On Mon, Jan 02, 2023 at 09:25:41PM +0100, Javier Martinez Canillas wrote:
> Change made using a `clang-format -i include/drm/drm_mipi_dsi.h` command.
> 
> Suggested-by: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

Thanks,

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
> 
> Changes in v2:
> - New patch in v2.
> 
>  include/drm/drm_mipi_dsi.h | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 20b21b577dea..e9d1e8a7fc7e 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -303,15 +303,18 @@ int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
>   * @cmd: Command
>   * @seq: buffer containing data to be transmitted
>   */
> -#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) do {				\
> -		static const u8 d[] = { cmd, seq };				\
> -		struct device *dev = &dsi->dev;	\
> -		int ret;						\
> -		ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));	\
> -		if (ret < 0) {						\
> -			dev_err_ratelimited(dev, "sending command %#02x failed: %d\n", cmd, ret); \
> -			return ret;						\
> -		}						\
> +#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...)                           \
> +	do {                                                               \
> +		static const u8 d[] = { cmd, seq };                        \
> +		struct device *dev = &dsi->dev;                            \
> +		int ret;                                                   \
> +		ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));    \
> +		if (ret < 0) {                                             \
> +			dev_err_ratelimited(                               \
> +				dev, "sending command %#02x failed: %d\n", \
> +				cmd, ret);                                 \
> +			return ret;                                        \
> +		}                                                          \
>  	} while (0)
>  
>  /**
> -- 
> 2.38.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format
  2023-01-02 20:30 ` [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format Sam Ravnborg
@ 2023-01-07 17:36   ` Javier Martinez Canillas
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2023-01-07 17:36 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Thomas Zimmermann, Nick Desaulniers, llvm, linux-kernel,
	Nathan Chancellor, dri-devel, Tom Rix

On 1/2/23 21:30, Sam Ravnborg wrote:
> On Mon, Jan 02, 2023 at 09:25:41PM +0100, Javier Martinez Canillas wrote:
>> Change made using a `clang-format -i include/drm/drm_mipi_dsi.h` command.
>>
>> Suggested-by: Sam Ravnborg <sam@ravnborg.org>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> 
> Thanks,
> 
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>> ---

Pushed to drm-misc (drm-misc-next). Thanks!

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro
  2023-01-02 20:25 ` [PATCH v2 2/2] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro Javier Martinez Canillas
@ 2023-01-07 17:37   ` Javier Martinez Canillas
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2023-01-07 17:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Zimmermann, Sam Ravnborg, dri-devel

On 1/2/23 21:25, Javier Martinez Canillas wrote:
> Many panel drivers define dsi_dcs_write_seq() and dsi_generic_write_seq()
> macros to send DCS commands and generic write packets respectively, with
> the payload specified as a list of parameters instead of using arrays.
> 
> There's already a macro for the former, introduced by commit 2a9e9daf75231
> ("drm/mipi-dsi: Introduce mipi_dsi_dcs_write_seq macro") so drivers can be
> changed to use that. But there isn't one yet for the latter, let's add it.
> 
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---

Pushed to drm-misc (drm-misc-next). Thanks!

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-07 17:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-02 20:25 [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format Javier Martinez Canillas
2023-01-02 20:25 ` [PATCH v2 2/2] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro Javier Martinez Canillas
2023-01-07 17:37   ` Javier Martinez Canillas
2023-01-02 20:30 ` [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format Sam Ravnborg
2023-01-07 17:36   ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox