mipi_dsi_dcs_set_tear_off can heavily benefit from being converted
to a multi style function as it is often called in the context of
similar functions.
Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 42 +++++++++++++++++++---------------
include/drm/drm_mipi_dsi.h | 2 +-
2 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 5e5c5f84daac..2e148753ea97 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -1265,25 +1265,6 @@ int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start,
}
EXPORT_SYMBOL(mipi_dsi_dcs_set_page_address);
-/**
- * mipi_dsi_dcs_set_tear_off() - turn off the display module's Tearing Effect
- * output signal on the TE signal line
- * @dsi: DSI peripheral device
- *
- * Return: 0 on success or a negative error code on failure
- */
-int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi)
-{
- ssize_t err;
-
- err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_OFF, NULL, 0);
- if (err < 0)
- return err;
-
- return 0;
-}
-EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_off);
-
/**
* mipi_dsi_dcs_set_tear_on() - turn on the display module's Tearing Effect
* output signal on the TE signal line.
@@ -1713,6 +1694,29 @@ void mipi_dsi_turn_on_peripheral_multi(struct mipi_dsi_multi_context *ctx)
}
EXPORT_SYMBOL(mipi_dsi_turn_on_peripheral_multi);
+/**
+ * mipi_dsi_dcs_set_tear_off_multi() - turn off the display module's Tearing Effect
+ * output signal on the TE signal line
+ * @ctx: Context for multiple DSI transactions
+ */
+void mipi_dsi_dcs_set_tear_off_multi(struct mipi_dsi_multi_context *ctx)
+{
+ struct mipi_dsi_device *dsi = ctx->dsi;
+ struct device *dev = &dsi->dev;
+ ssize_t err;
+
+ if (ctx->accum_err)
+ return;
+
+ err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_OFF, NULL, 0);
+ if (err < 0) {
+ ctx->accum_err = err;
+ dev_err(dev, "Failed to set tear off: %d\n",
+ ctx->accum_err);
+ }
+}
+EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_off_multi);
+
/**
* mipi_dsi_dcs_soft_reset_multi() - perform a software reset of the display module
* @ctx: Context for multiple DSI transactions
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 94400a78031f..bd40a443385c 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -346,7 +346,6 @@ int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start,
u16 end);
int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start,
u16 end);
-int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
enum mipi_dsi_dcs_tear_mode mode);
int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
@@ -379,6 +378,7 @@ void mipi_dsi_dcs_set_page_address_multi(struct mipi_dsi_multi_context *ctx,
u16 start, u16 end);
void mipi_dsi_dcs_set_tear_scanline_multi(struct mipi_dsi_multi_context *ctx,
u16 scanline);
+void mipi_dsi_dcs_set_tear_off_multi(struct mipi_dsi_multi_context *ctx);
/**
* mipi_dsi_generic_write_seq - transmit data using a generic write packet
--
2.48.1
Hi, On Fri, Feb 14, 2025 at 9:30 AM Tejas Vipin <tejasvipin76@gmail.com> wrote: > > mipi_dsi_dcs_set_tear_off can heavily benefit from being converted > to a multi style function as it is often called in the context of > similar functions. Given that it has one caller, the wording "heavily benefit" and "often called" is a bit of a stretch. > --- a/include/drm/drm_mipi_dsi.h > +++ b/include/drm/drm_mipi_dsi.h > @@ -346,7 +346,6 @@ int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start, > u16 end); > int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start, > u16 end); > -int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi); > int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi, > enum mipi_dsi_dcs_tear_mode mode); > int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format); > @@ -379,6 +378,7 @@ void mipi_dsi_dcs_set_page_address_multi(struct mipi_dsi_multi_context *ctx, > u16 start, u16 end); > void mipi_dsi_dcs_set_tear_scanline_multi(struct mipi_dsi_multi_context *ctx, > u16 scanline); > +void mipi_dsi_dcs_set_tear_off_multi(struct mipi_dsi_multi_context *ctx); This patch can't land as-is since it breaks bisection. In other words, if someone has the first patch but not the second then it won't compile because there will still be a user of mipi_dsi_dcs_set_tear_off() but you've removed it. If they have the second patch but not the first then it won't compile because mipi_dsi_dcs_set_tear_off_multi() hasn't been introduced yet. You have two options: 1. Turn your 2 patches into 3 patches. The first patch would need to still provide the old function, the second patch would stay as-is, and the third patch would remove the wrapper. 2. Just squash the two patches together. If I were picking, I'd pick #2. While it's nice to separate out patches, this is not a very complex case and adding code just to delete it two patches later is a bit silly. That being said, it's a tradeoff so if someone else has strong opinions I wouldn't object to taking path #1. -Doug
© 2016 - 2025 Red Hat, Inc.