extend "multi" functions and use them in sony-td4353-jdi
Subsystems (3)
cover extend "multi" functions and use them in sony-td4353-jdi
This patch removes mipi_dsi_dcs_set_tear_off and replaces it with a multi version as after replacing it in sony-td4353-jdi, it doesn't appear anywhere else. sony-td4353-jdi is converted to use multi style functions, including mipi_dsi_dcs_set_tear_off_multi.
Tejas Vipin (2):
drm/mipi-dsi: Replace mipi_dsi_dcs_set_tear_off with its multi version drm/panel: sony-td4353-jdi: transition to mipi_dsi wrapped functions
drivers/gpu/drm/drm_mipi_dsi.c | 42 +++---- drivers/gpu/drm/panel/panel-sony-td4353-jdi.c | 107 ++++-------------- include/drm/drm_mipi_dsi.h | 2 +- 3 files changed, 47 insertions(+), 104 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/2 drm/mipi-dsi: Replace mipi_dsi_dcs_set_tear_off with its multi version
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.
--- drivers/gpu/drm/drm_mipi_dsi.c | 42 +++++++++++++++++++--------------- include/drm/drm_mipi_dsi.h | 2 +- 2 files changed, 24 insertions(+), 20 deletions(-)
drivers/gpu/drm/drm_mipi_dsi.c +23 -19
@@ -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
include/drm/drm_mipi_dsi.h +1 -1
@@ -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
Signature · 1 line
2.48.1
Re: [PATCH 1/2] drm/mipi-dsi: Replace mipi_dsi_dcs_set_tear_off with its multi version
Hi,
Quoted 4 lines · Tejas Vipin
mipi_dsi_dcs_set_tear_offcan 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.
Quoted 11 lines
include/drm/drm_mipi_dsi.h +0
-1@@ -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);
include/drm/drm_mipi_dsi.h void mipi_dsi_dcs_set_page_address_multi(struct mipi_dsi_multi_context *ctx, · line 381
Quoted 4 lines
include/drm/drm_mipi_dsi.h +1
-0@@ -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
PATCH 2/2 drm/panel: sony-td4353-jdi: transition to mipi_dsi wrapped functions
In reply to Tejas VipinChange the sony-td4353-jdi panel to use multi style functions for improved error handling.
--- drivers/gpu/drm/panel/panel-sony-td4353-jdi.c | 107 ++++-------------- 1 file changed, 23 insertions(+), 84 deletions(-)
drivers/gpu/drm/panel/panel-sony-td4353-jdi.c +23 -84
@@ -47,93 +47,40 @@ static inline struct sony_td4353_jdi *to_sony_td4353_jdi(struct drm_panel *panelstatic int sony_td4353_jdi_on (struct sony_td4353_jdi *ctx) {struct mipi_dsi_device *dsi = ctx->dsi; -struct device *dev = &dsi->dev; -int ret; +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; dsi->mode_flags |=MIPI_DSI_MODE_LPM ; - ret =mipi_dsi_dcs_set_column_address (dsi,0x0000 ,1080 -1 ); -if (ret <0 ) { -dev_err (dev,"Failed to set column address: %d\n" , ret); -return ret; - } - - ret =mipi_dsi_dcs_set_page_address (dsi,0x0000 ,2160 -1 ); -if (ret <0 ) { -dev_err (dev,"Failed to set page address: %d\n" , ret); -return ret; - } - - ret =mipi_dsi_dcs_set_tear_scanline (dsi,0 ); -if (ret <0 ) { -dev_err (dev,"Failed to set tear scanline: %d\n" , ret); -return ret; - } - - ret =mipi_dsi_dcs_set_tear_on (dsi,MIPI_DSI_DCS_TEAR_MODE_VBLANK ); -if (ret <0 ) { -dev_err (dev,"Failed to set tear on: %d\n" , ret); -return ret; - } +mipi_dsi_dcs_set_column_address_multi (&dsi_ctx,0x0000 ,1080 -1 ); +mipi_dsi_dcs_set_page_address_multi (&dsi_ctx,0x0000 ,2160 -1 ); +mipi_dsi_dcs_set_tear_scanline_multi (&dsi_ctx,0 ); +mipi_dsi_dcs_set_tear_on_multi (&dsi_ctx,MIPI_DSI_DCS_TEAR_MODE_VBLANK ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_SET_ADDRESS_MODE ,0x00 ); -mipi_dsi_dcs_write_seq (dsi,MIPI_DCS_SET_ADDRESS_MODE ,0x00 ); - - ret =mipi_dsi_dcs_set_pixel_format (dsi,0x77 ); -if (ret <0 ) { -dev_err (dev,"Failed to set pixel format: %d\n" , ret); -return ret; - } - -mipi_dsi_dcs_write_seq (dsi,MIPI_DCS_SET_PARTIAL_ROWS , -0x00 ,0x00 ,0x08 ,0x6f ); - - ret =mipi_dsi_dcs_exit_sleep_mode (dsi); -if (ret <0 ) { -dev_err (dev,"Failed to exit sleep mode: %d\n" , ret); -return ret; - } -msleep (70 ); +mipi_dsi_dcs_set_pixel_format_multi (&dsi_ctx,0x77 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_SET_PARTIAL_ROWS , +0x00 ,0x00 ,0x08 ,0x6f ); -mipi_dsi_dcs_write_seq (dsi,MIPI_DCS_WRITE_MEMORY_START ); +mipi_dsi_dcs_exit_sleep_mode_multi (&dsi_ctx); +mipi_dsi_msleep (&dsi_ctx,70 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_WRITE_MEMORY_START ); +mipi_dsi_dcs_set_display_on_multi (&dsi_ctx); - ret =mipi_dsi_dcs_set_display_on (dsi); -if (ret <0 ) { -dev_err (dev,"Failed to turn display on: %d\n" , ret); -return ret; - } - -return 0 ; +return dsi_ctx.accum_err; } -static int sony_td4353_jdi_off (struct sony_td4353_jdi *ctx) +static void sony_td4353_jdi_off (struct sony_td4353_jdi *ctx) {struct mipi_dsi_device *dsi = ctx->dsi; -struct device *dev = &dsi->dev; -int ret; +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; - ret =mipi_dsi_dcs_set_display_off (dsi); -if (ret <0 ) { -dev_err (dev,"Failed to set display off: %d\n" , ret); -return ret; - } -msleep (22 ); - - ret =mipi_dsi_dcs_set_tear_off (dsi); -if (ret <0 ) { -dev_err (dev,"Failed to set tear off: %d\n" , ret); -return ret; - } - - ret =mipi_dsi_dcs_enter_sleep_mode (dsi); -if (ret <0 ) { -dev_err (dev,"Failed to enter sleep mode: %d\n" , ret); -return ret; - } -msleep (80 ); - -return 0 ; +mipi_dsi_dcs_set_display_off_multi (&dsi_ctx); +mipi_dsi_msleep (&dsi_ctx,22 ); +mipi_dsi_dcs_set_tear_off_multi (&dsi_ctx); +mipi_dsi_dcs_enter_sleep_mode_multi (&dsi_ctx); +mipi_dsi_msleep (&dsi_ctx,80 ); }static void sony_td4353_assert_reset_gpios (struct sony_td4353_jdi *ctx,int mode)
@@ -146,14 +93,11 @@ static void sony_td4353_assert_reset_gpios(struct sony_td4353_jdi *ctx, int modestatic int sony_td4353_jdi_prepare (struct drm_panel *panel) {struct sony_td4353_jdi *ctx =to_sony_td4353_jdi (panel); -struct device *dev = &ctx->dsi->dev;int ret; ret =regulator_bulk_enable (ARRAY_SIZE (ctx->supplies), ctx->supplies); -if (ret <0 ) { -dev_err (dev,"Failed to enable regulators: %d\n" , ret); +if (ret <0 )return ret; - }msleep (100 );
@@ -161,7 +105,6 @@ static int sony_td4353_jdi_prepare(struct drm_panel *panel) ret =sony_td4353_jdi_on (ctx);if (ret <0 ) { -dev_err (dev,"Failed to power on panel: %d\n" , ret);sony_td4353_assert_reset_gpios (ctx,0 );regulator_bulk_disable (ARRAY_SIZE (ctx->supplies), ctx->supplies);return ret;
@@ -173,12 +116,8 @@ static int sony_td4353_jdi_prepare(struct drm_panel *panel)static int sony_td4353_jdi_unprepare (struct drm_panel *panel) {struct sony_td4353_jdi *ctx =to_sony_td4353_jdi (panel); -struct device *dev = &ctx->dsi->dev; -int ret; - ret =sony_td4353_jdi_off (ctx); -if (ret <0 ) -dev_err (dev,"Failed to power off panel: %d\n" , ret); +sony_td4353_jdi_off (ctx);sony_td4353_assert_reset_gpios (ctx,0 );regulator_bulk_disable (ARRAY_SIZE (ctx->supplies), ctx->supplies);
Signature · 1 line
2.48.1
Re: [PATCH 2/2] drm/panel: sony-td4353-jdi: transition to mipi_dsi wrapped functions
Hi,
Quoted 8 lines · Tejas Vipin
Change the sony-td4353-jdi panel to use multi style functions for improved error handling.
Signed-off-by Tejas Vipin <[email protected]>--- drivers/gpu/drm/panel/panel-sony-td4353-jdi.c | 107 ++++-------------- 1 file changed, 23 insertions(+), 84 deletions(-)
Nice diffstat and so much boilerplate error code removed. :-)
Note that I'm on vacation next week and it might take me a while to dig out of email when I get back. More than happy if someone else wants to land if the bisectability problems I talk about in patch #1 are resolved. Otherwise I'll get back to this eventually.
-Doug
Re: [PATCH 2/2] drm/panel: sony-td4353-jdi: transition to mipi_dsi wrapped functions
Quoted 7 lines · Doug Anderson
Hi,
Quoted 4 lines · Tejas Vipin
Change the sony-td4353-jdi panel to use multi style functions for improved error handling.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Tejas Vipin <[email protected]>--- drivers/gpu/drm/panel/panel-sony-td4353-jdi.c | 107 ++++-------------- 1 file changed, 23 insertions(+), 84 deletions(-)Nice diffstat and so much boilerplate error code removed. :-)
Reviewed-by Douglas Anderson <[email protected]>
If I rebase both the patches into 1, should I still add the Reviewed-by tag?
Quoted 8 lines
Note that I'm on vacation next week and it might take me a while to dig out of email when I get back. More than happy if someone else wants to land if the bisectability problems I talk about in patch #1 are resolved. Otherwise I'll get back to this eventually.
-Doug
Signature · 1 line
Tejas Vipin
Re: [PATCH 2/2] drm/panel: sony-td4353-jdi: transition to mipi_dsi wrapped functions
Hi,
Quoted 16 lines · Tejas Vipin
Quoted 12 lines · Doug Anderson
Hi,
Quoted 8 lines · Tejas Vipin
Change the sony-td4353-jdi panel to use multi style functions for improved error handling.
Signed-off-by Tejas Vipin <[email protected]>--- drivers/gpu/drm/panel/panel-sony-td4353-jdi.c | 107 ++++-------------- 1 file changed, 23 insertions(+), 84 deletions(-)
Quoted 6 lines
Quoted 3 lines
Nice diffstat and so much boilerplate error code removed. :-)
Reviewed-by Douglas Anderson <[email protected]>If I rebase both the patches into 1, should I still add the Reviewed-by tag?
Sorry, I was away, but it looks like you've sent v2 anyway and what you did there is fine. In this case my "Reviewed-by" for the second patch was more me helping myself keep track of the fact that I'd already looked at all the contents on this patch and I was happy with it.
For the record, most of the time it seems like you're expected to just "guess" a bit what a reviewer would want. The absolute safest thing you can do is to remove the "Reviewed-by" (like you did) but then also "after the cut" in your new patch (like where you put version history) indicate why you didn't carry the Reviewed-by. Like you could say:
NOTE: removed Doug's review tag in v2 because it was only provided for one of the two patches that were squashed together.
Then if I wondered why you didn't carry my tag I'd have my answer. Some reviewers get upset if you don't carry their tag forward and you don't explain why you didn't. ;-)
-Doug