mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	drm/panel/synaptics-r63353: Use _multi variants
Move away from using deprecated API and use _multi
variants if available. Use mipi_dsi_msleep()
and mipi_dsi_usleep_range() instead of msleep()
and usleep_range() respectively.
Used Coccinelle to find the _multi variant APIs,
replacing mpi_dsi_msleep() where necessary and for returning
dsi_ctx.accum_err in these functions. Manually handled the
reset step before returning from r63353_panel_activate()
v2: Do not skip the reset in case of error during
panel activate (Dmitry)
- Convert all usleep_range()
v3: mipi_dsi_usleep_range() is to be used only when in
between _multi commands(Doug)
- Check for error once in the end while using _multi
variants (Doug)
v4: Change return type of r63353_panel_deactivate() to void (Doug)
@rule_1@
identifier dsi_var;
identifier r;
identifier func;
type t;
position p;
expression dsi_device;
expression list es;
@@
t func(...) {
...
struct mipi_dsi_device *dsi_var = dsi_device;
+struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi_var };
<+...
(
-r = mipi_dsi_dcs_nop(dsi_var)@p;
+mipi_dsi_dcs_nop_multi(&dsi_ctx);
|
-r = mipi_dsi_dcs_exit_sleep_mode(dsi_var)@p;
+mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
|
-r = mipi_dsi_dcs_enter_sleep_mode(dsi_var)@p;
+mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
|
-r = mipi_dsi_dcs_write_buffer(dsi_var,es)@p;
+mipi_dsi_dcs_write_buffer_multi(&dsi_ctx,es);
|
-r = mipi_dsi_dcs_set_display_off(dsi_var,es)@p;
+mipi_dsi_dcs_set_display_off_multi(&dsi_ctx,es);
|
-r = mipi_dsi_compression_mode_ext(dsi_var,es)@p;
+mipi_dsi_compression_mode_ext_multi(&dsi_ctx,es);
|
-r = mipi_dsi_compression_mode(dsi_var,es)@p;
+mipi_dsi_compression_mode_multi(&dsi_ctx,es);
|
-r = mipi_dsi_picture_parameter_set(dsi_var,es)@p;
+mipi_dsi_picture_parameter_set_multi(&dsi_ctx,es);
|
-r = mipi_dsi_dcs_set_display_on(dsi_var,es)@p;
+mipi_dsi_dcs_set_display_on_multi(&dsi_ctx,es);
|
-r = mipi_dsi_dcs_set_tear_on(dsi_var)@p;
+mipi_dsi_dcs_set_tear_on_multi(&dsi_ctx);
|
-r = mipi_dsi_turn_on_peripheral(dsi_var)@p;
+mipi_dsi_turn_on_peripheral_multi(&dsi_ctx);
|
-r = mipi_dsi_dcs_soft_reset(dsi_var)@p;
+mipi_dsi_dcs_soft_reset_multi(&dsi_ctx);
|
-r = mipi_dsi_dcs_set_display_brightness(dsi_var,es)@p;
+mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx,es);
|
-r = mipi_dsi_dcs_set_pixel_format(dsi_var,es)@p;
+mipi_dsi_dcs_set_pixel_format_multi(&dsi_ctx,es);
|
-r = mipi_dsi_dcs_set_column_address(dsi_var,es)@p;
+mipi_dsi_dcs_set_column_address_multi(&dsi_ctx,es);
|
-r = mipi_dsi_dcs_set_page_address(dsi_var,es)@p;
+mipi_dsi_dcs_set_page_address_multi(&dsi_ctx,es);
|
-r = mipi_dsi_dcs_set_tear_scanline(dsi_var,es)@p;
+mipi_dsi_dcs_set_tear_scanline_multi(&dsi_ctx,es);
)
-if(r < 0) {
-...
-}
...+>
}
@rule_2@
identifier dsi_var;
identifier r;
identifier func;
type t;
position p;
expression dsi_device;
expression list es;
@@
t func(...) {
...
struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi_var };
<+...
(
-r = msleep(es)@p;
+r = mipi_dsi_msleep(&dsi_ctx,es);
|
-msleep(es)@p;
+mipi_dsi_msleep(&dsi_ctx,es);
|
-r = usleep_range(es)@p;
+r = mipi_dsi_usleep_range(&dsi_ctx,es);
|
-usleep_range(es)@p;
+mipi_dsi_usleep_range(&dsi_ctx,es);
)
...+>
}
@rule_3@
identifier dsi_var;
identifier func;
type t;
position p;
expression list es;
@@
t func(...) {
...
struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi_var };
...
-return 0;
+return dsi_ctx.accum_err;
}
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Tejas Vipin <tejasvipin76@gmail.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250318-synaptic-expt-v1-1-fa3831a7d883@redhat.com
			
			
This commit is contained in:
		
							parent
							
								
									15a226179c
								
							
						
					
					
						commit
						c8ba07caae
					
				
					 1 changed files with 19 additions and 49 deletions
				
			
		|  | @ -106,53 +106,34 @@ static int r63353_panel_power_off(struct r63353_panel *rpanel) | |||
| static int r63353_panel_activate(struct r63353_panel *rpanel) | ||||
| { | ||||
| 	struct mipi_dsi_device *dsi = rpanel->dsi; | ||||
| 	struct device *dev = &dsi->dev; | ||||
| 	int i, ret; | ||||
| 	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; | ||||
| 	int i; | ||||
| 
 | ||||
| 	ret = mipi_dsi_dcs_soft_reset(dsi); | ||||
| 	if (ret < 0) { | ||||
| 		dev_err(dev, "Failed to do Software Reset (%d)\n", ret); | ||||
| 		goto fail; | ||||
| 	} | ||||
| 	mipi_dsi_dcs_soft_reset_multi(&dsi_ctx); | ||||
| 
 | ||||
| 	usleep_range(15000, 17000); | ||||
| 	mipi_dsi_usleep_range(&dsi_ctx, 15000, 17000); | ||||
| 
 | ||||
| 	ret = mipi_dsi_dcs_enter_sleep_mode(dsi); | ||||
| 	if (ret < 0) { | ||||
| 		dev_err(dev, "Failed to enter sleep mode (%d)\n", ret); | ||||
| 		goto fail; | ||||
| 	} | ||||
| 	mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); | ||||
| 
 | ||||
| 	for (i = 0; i < rpanel->pdata->init_length; i++) { | ||||
| 		const struct r63353_instr *instr = &rpanel->pdata->init[i]; | ||||
| 
 | ||||
| 		ret = mipi_dsi_dcs_write_buffer(dsi, instr->data, instr->len); | ||||
| 		if (ret < 0) | ||||
| 			goto fail; | ||||
| 		mipi_dsi_dcs_write_buffer_multi(&dsi_ctx, instr->data, | ||||
| 						instr->len); | ||||
| 	} | ||||
| 
 | ||||
| 	msleep(120); | ||||
| 	mipi_dsi_msleep(&dsi_ctx, 120); | ||||
| 
 | ||||
| 	ret = mipi_dsi_dcs_exit_sleep_mode(dsi); | ||||
| 	if (ret < 0) { | ||||
| 		dev_err(dev, "Failed to exit sleep mode (%d)\n", ret); | ||||
| 		goto fail; | ||||
| 	} | ||||
| 	mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); | ||||
| 
 | ||||
| 	usleep_range(5000, 10000); | ||||
| 	mipi_dsi_usleep_range(&dsi_ctx, 5000, 10000); | ||||
| 
 | ||||
| 	ret = mipi_dsi_dcs_set_display_on(dsi); | ||||
| 	if (ret < 0) { | ||||
| 		dev_err(dev, "Failed to set display ON (%d)\n", ret); | ||||
| 		goto fail; | ||||
| 	} | ||||
| 	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); | ||||
| 
 | ||||
| 	return 0; | ||||
| 	if (dsi_ctx.accum_err) | ||||
| 		gpiod_set_value(rpanel->reset_gpio, 0); | ||||
| 
 | ||||
| fail: | ||||
| 	gpiod_set_value(rpanel->reset_gpio, 0); | ||||
| 
 | ||||
| 	return ret; | ||||
| 	return dsi_ctx.accum_err; | ||||
| } | ||||
| 
 | ||||
| static int r63353_panel_prepare(struct drm_panel *panel) | ||||
|  | @ -178,27 +159,16 @@ static int r63353_panel_prepare(struct drm_panel *panel) | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| static int r63353_panel_deactivate(struct r63353_panel *rpanel) | ||||
| static void r63353_panel_deactivate(struct r63353_panel *rpanel) | ||||
| { | ||||
| 	struct mipi_dsi_device *dsi = rpanel->dsi; | ||||
| 	struct device *dev = &dsi->dev; | ||||
| 	int ret; | ||||
| 	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; | ||||
| 
 | ||||
| 	ret = mipi_dsi_dcs_set_display_off(dsi); | ||||
| 	if (ret < 0) { | ||||
| 		dev_err(dev, "Failed to set display OFF (%d)\n", ret); | ||||
| 		return ret; | ||||
| 	} | ||||
| 	mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); | ||||
| 
 | ||||
| 	usleep_range(5000, 10000); | ||||
| 	mipi_dsi_usleep_range(&dsi_ctx, 5000, 10000); | ||||
| 
 | ||||
| 	ret = mipi_dsi_dcs_enter_sleep_mode(dsi); | ||||
| 	if (ret < 0) { | ||||
| 		dev_err(dev, "Failed to enter sleep mode (%d)\n", ret); | ||||
| 		return ret; | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| 	mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); | ||||
| } | ||||
| 
 | ||||
| static int r63353_panel_unprepare(struct drm_panel *panel) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Anusha Srivatsa
						Anusha Srivatsa