diff mbox series

gpu: drm/panel: Optimize the workflow of s6d7aa0_lock

Message ID 20230531110717.36896-1-luhongfei@vivo.com (mailing list archive)
State New, archived
Headers show
Series gpu: drm/panel: Optimize the workflow of s6d7aa0_lock | expand

Commit Message

Lu Hongfei May 31, 2023, 11:07 a.m. UTC
This patch optimized s6d7aa0_lock's workflow.
Once mipi_dsi_dcs_write_seq failed, s6d7aa0_lock return immediately
and no further actions will be taken.

Fixes: 6810bb390282 ("drm/panel: Add Samsung S6D7AA0 panel controller driver")

Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
---
 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c | 30 ++++++++++++++-----
 1 file changed, 22 insertions(+), 8 deletions(-)

Comments

Neil Armstrong May 31, 2023, 11:55 a.m. UTC | #1
Hi,

On 31/05/2023 13:07, Lu Hongfei wrote:
> This patch optimized s6d7aa0_lock's workflow.
> Once mipi_dsi_dcs_write_seq failed, s6d7aa0_lock return immediately
> and no further actions will be taken.
> 
> Fixes: 6810bb390282 ("drm/panel: Add Samsung S6D7AA0 panel controller driver")
> 
> Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
> ---
>   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c | 30 ++++++++++++++-----
>   1 file changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
> index 102e1fc7ee38..f98df32d1c55
> --- a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
> @@ -69,15 +69,29 @@ static int s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
>   	int ret = 0;
>   
>   	if (lock) {
> -		mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
> -		mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0xa5, 0xa5);
> -		if (ctx->desc->use_passwd3)
> -			mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0x5a, 0x5a);
> +		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
> +		if (ret < 0)
> +			return ret;

mipi_dsi_dcs_write_seq() is a macro that already calls "return ret" on error,
so this is wrong, and there's nothing wrong with the currently upstream driver.

Neil

> +		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0xa5, 0xa5);
> +		if (ret < 0)
> +			return ret;
> +		if (ctx->desc->use_passwd3) {
> +			ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0x5a, 0x5a);
> +			if (ret < 0)
> +				return ret;
> +		}
>   	} else {
> -		mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0x5a, 0x5a);
> -		mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0x5a, 0x5a);
> -		if (ctx->desc->use_passwd3)
> -			mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
> +		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0x5a, 0x5a);
> +		if (ret < 0)
> +			return ret;
> +		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0x5a, 0x5a);
> +		if (ret < 0)
> +			return ret;
> +		if (ctx->desc->use_passwd3) {
> +			ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
> +			if (ret < 0)
> +				return ret;
> +		}
>   	}
>   
>   	return ret;
kernel test robot June 1, 2023, 2:37 p.m. UTC | #2
Hi Lu,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on next-20230601]
[cannot apply to linus/master v6.4-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lu-Hongfei/gpu-drm-panel-Optimize-the-workflow-of-s6d7aa0_lock/20230531-190848
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230531110717.36896-1-luhongfei%40vivo.com
patch subject: [PATCH] gpu: drm/panel: Optimize the workflow of s6d7aa0_lock
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20230601/202306012249.Sm2dlQLk-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.3.0
reproduce (this is a W=1 build):
        mkdir -p ~/bin
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/e1ade7d20fb0efb9aa0b332d5ac5da2863f8e68e
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lu-Hongfei/gpu-drm-panel-Optimize-the-workflow-of-s6d7aa0_lock/20230531-190848
        git checkout e1ade7d20fb0efb9aa0b332d5ac5da2863f8e68e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/gpu/drm/panel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306012249.Sm2dlQLk-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:17:
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c: In function 's6d7aa0_lock':
>> include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:72:23: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      72 |                 ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
         |                       ^~~~~~~~~~~~~~~~~~~~~~
>> include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:75:23: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      75 |                 ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0xa5, 0xa5);
         |                       ^~~~~~~~~~~~~~~~~~~~~~
>> include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:79:31: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      79 |                         ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0x5a, 0x5a);
         |                               ^~~~~~~~~~~~~~~~~~~~~~
>> include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:84:23: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      84 |                 ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0x5a, 0x5a);
         |                       ^~~~~~~~~~~~~~~~~~~~~~
>> include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:87:23: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      87 |                 ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0x5a, 0x5a);
         |                       ^~~~~~~~~~~~~~~~~~~~~~
>> include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:91:31: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      91 |                         ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
         |                               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:68:33: warning: unused variable 'dsi' [-Wunused-variable]
      68 |         struct mipi_dsi_device *dsi = ctx->dsi;
         |                                 ^~~


vim +/do +326 include/drm/drm_mipi_dsi.h

3d9a8fcf1c6a90 Thierry Reding           2014-08-05  268  
960dd616f61c84 Thierry Reding           2014-07-21  269  ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi,
960dd616f61c84 Thierry Reding           2014-07-21  270  				  const void *data, size_t len);
960dd616f61c84 Thierry Reding           2014-07-21  271  ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd,
960dd616f61c84 Thierry Reding           2014-07-21  272  			   const void *data, size_t len);
3c523d7d38a17b Thierry Reding           2014-07-21  273  ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
3c523d7d38a17b Thierry Reding           2014-07-21  274  			  size_t len);
083d573fd013c9 Thierry Reding           2014-08-05  275  int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi);
2f16b89737e24b Thierry Reding           2014-08-05  276  int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi);
3d9a8fcf1c6a90 Thierry Reding           2014-08-05  277  int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode);
5cc0af16fc08cf Thierry Reding           2014-08-05  278  int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format);
42fe1e755d08b8 YoungJun Cho             2014-08-05  279  int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi);
42fe1e755d08b8 YoungJun Cho             2014-08-05  280  int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi);
42fe1e755d08b8 YoungJun Cho             2014-08-05  281  int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi);
42fe1e755d08b8 YoungJun Cho             2014-08-05  282  int mipi_dsi_dcs_set_display_on(struct mipi_dsi_device *dsi);
3b46d4a0def157 Thierry Reding           2014-08-05  283  int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start,
3b46d4a0def157 Thierry Reding           2014-08-05  284  				    u16 end);
3b46d4a0def157 Thierry Reding           2014-08-05  285  int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start,
3b46d4a0def157 Thierry Reding           2014-08-05  286  				  u16 end);
42fe1e755d08b8 YoungJun Cho             2014-08-05  287  int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
42fe1e755d08b8 YoungJun Cho             2014-08-05  288  int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
42fe1e755d08b8 YoungJun Cho             2014-08-05  289  			     enum mipi_dsi_dcs_tear_mode mode);
5cc0af16fc08cf Thierry Reding           2014-08-05  290  int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
bbdcf516a6187d Thierry Reding           2016-08-24  291  int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline);
1a9d759331b832 Vinay Simha BN           2016-07-31  292  int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
1a9d759331b832 Vinay Simha BN           2016-07-31  293  					u16 brightness);
1a9d759331b832 Vinay Simha BN           2016-07-31  294  int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
1a9d759331b832 Vinay Simha BN           2016-07-31  295  					u16 *brightness);
c9d27c6be518b4 Daniel Mentz             2023-01-16  296  int mipi_dsi_dcs_set_display_brightness_large(struct mipi_dsi_device *dsi,
c9d27c6be518b4 Daniel Mentz             2023-01-16  297  					     u16 brightness);
c9d27c6be518b4 Daniel Mentz             2023-01-16  298  int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
c9d27c6be518b4 Daniel Mentz             2023-01-16  299  					     u16 *brightness);
068a0023396983 Andrzej Hajda            2013-12-04  300  
a9015ce593204f Javier Martinez Canillas 2023-01-02  301  /**
a9015ce593204f Javier Martinez Canillas 2023-01-02  302   * mipi_dsi_generic_write_seq - transmit data using a generic write packet
a9015ce593204f Javier Martinez Canillas 2023-01-02  303   * @dsi: DSI peripheral device
a9015ce593204f Javier Martinez Canillas 2023-01-02  304   * @seq: buffer containing the payload
a9015ce593204f Javier Martinez Canillas 2023-01-02  305   */
a9015ce593204f Javier Martinez Canillas 2023-01-02  306  #define mipi_dsi_generic_write_seq(dsi, seq...)                                \
a9015ce593204f Javier Martinez Canillas 2023-01-02  307  	do {                                                                   \
a9015ce593204f Javier Martinez Canillas 2023-01-02  308  		static const u8 d[] = { seq };                                 \
a9015ce593204f Javier Martinez Canillas 2023-01-02  309  		struct device *dev = &dsi->dev;                                \
a9015ce593204f Javier Martinez Canillas 2023-01-02  310  		int ret;                                                       \
a9015ce593204f Javier Martinez Canillas 2023-01-02  311  		ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));           \
a9015ce593204f Javier Martinez Canillas 2023-01-02  312  		if (ret < 0) {                                                 \
a9015ce593204f Javier Martinez Canillas 2023-01-02  313  			dev_err_ratelimited(dev, "transmit data failed: %d\n", \
a9015ce593204f Javier Martinez Canillas 2023-01-02  314  					    ret);                              \
a9015ce593204f Javier Martinez Canillas 2023-01-02  315  			return ret;                                            \
a9015ce593204f Javier Martinez Canillas 2023-01-02  316  		}                                                              \
a9015ce593204f Javier Martinez Canillas 2023-01-02  317  	} while (0)
a9015ce593204f Javier Martinez Canillas 2023-01-02  318  
2a9e9daf75231c Joel Selvaraj            2022-06-01  319  /**
2a9e9daf75231c Joel Selvaraj            2022-06-01  320   * mipi_dsi_dcs_write_seq - transmit a DCS command with payload
2a9e9daf75231c Joel Selvaraj            2022-06-01  321   * @dsi: DSI peripheral device
2a9e9daf75231c Joel Selvaraj            2022-06-01  322   * @cmd: Command
2a9e9daf75231c Joel Selvaraj            2022-06-01  323   * @seq: buffer containing data to be transmitted
2a9e9daf75231c Joel Selvaraj            2022-06-01  324   */
51d3c0e7dc3cf1 Javier Martinez Canillas 2023-01-02  325  #define mipi_dsi_dcs_write_seq(dsi, cmd, seq...)                           \
51d3c0e7dc3cf1 Javier Martinez Canillas 2023-01-02 @326  	do {                                                               \
2a9e9daf75231c Joel Selvaraj            2022-06-01  327  		static const u8 d[] = { cmd, seq };                        \
2a9e9daf75231c Joel Selvaraj            2022-06-01  328  		struct device *dev = &dsi->dev;                            \
2a9e9daf75231c Joel Selvaraj            2022-06-01  329  		int ret;                                                   \
2a9e9daf75231c Joel Selvaraj            2022-06-01  330  		ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));    \
2a9e9daf75231c Joel Selvaraj            2022-06-01  331  		if (ret < 0) {                                             \
51d3c0e7dc3cf1 Javier Martinez Canillas 2023-01-02  332  			dev_err_ratelimited(                               \
51d3c0e7dc3cf1 Javier Martinez Canillas 2023-01-02  333  				dev, "sending command %#02x failed: %d\n", \
51d3c0e7dc3cf1 Javier Martinez Canillas 2023-01-02  334  				cmd, ret);                                 \
2a9e9daf75231c Joel Selvaraj            2022-06-01  335  			return ret;                                        \
2a9e9daf75231c Joel Selvaraj            2022-06-01  336  		}                                                          \
2a9e9daf75231c Joel Selvaraj            2022-06-01  337  	} while (0)
2a9e9daf75231c Joel Selvaraj            2022-06-01  338
kernel test robot June 1, 2023, 4:03 p.m. UTC | #3
Hi Lu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on next-20230601]
[cannot apply to linus/master v6.4-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lu-Hongfei/gpu-drm-panel-Optimize-the-workflow-of-s6d7aa0_lock/20230531-190848
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230531110717.36896-1-luhongfei%40vivo.com
patch subject: [PATCH] gpu: drm/panel: Optimize the workflow of s6d7aa0_lock
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230601/202306012354.obLJxas6-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/e1ade7d20fb0efb9aa0b332d5ac5da2863f8e68e
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lu-Hongfei/gpu-drm-panel-Optimize-the-workflow-of-s6d7aa0_lock/20230531-190848
        git checkout e1ade7d20fb0efb9aa0b332d5ac5da2863f8e68e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/panel/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306012354.obLJxas6-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:17:
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c: In function 's6d7aa0_lock':
   include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:72:23: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      72 |                 ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
         |                       ^~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:75:23: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      75 |                 ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0xa5, 0xa5);
         |                       ^~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:79:31: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      79 |                         ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0x5a, 0x5a);
         |                               ^~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:84:23: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      84 |                 ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0x5a, 0x5a);
         |                       ^~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:87:23: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      87 |                 ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0x5a, 0x5a);
         |                       ^~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_mipi_dsi.h:326:9: error: expected expression before 'do'
     326 |         do {                                                               \
         |         ^~
   drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:91:31: note: in expansion of macro 'mipi_dsi_dcs_write_seq'
      91 |                         ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
         |                               ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c:68:33: warning: unused variable 'dsi' [-Wunused-variable]
      68 |         struct mipi_dsi_device *dsi = ctx->dsi;
         |                                 ^~~


vim +/dsi +68 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c

6810bb390282bb Artur Weber 2023-05-19  65  
6810bb390282bb Artur Weber 2023-05-19  66  static int s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
6810bb390282bb Artur Weber 2023-05-19  67  {
6810bb390282bb Artur Weber 2023-05-19 @68  	struct mipi_dsi_device *dsi = ctx->dsi;
6810bb390282bb Artur Weber 2023-05-19  69  	int ret = 0;
6810bb390282bb Artur Weber 2023-05-19  70  
6810bb390282bb Artur Weber 2023-05-19  71  	if (lock) {
e1ade7d20fb0ef Lu Hongfei  2023-05-31  72  		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
e1ade7d20fb0ef Lu Hongfei  2023-05-31  73  		if (ret < 0)
e1ade7d20fb0ef Lu Hongfei  2023-05-31  74  			return ret;
e1ade7d20fb0ef Lu Hongfei  2023-05-31  75  		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0xa5, 0xa5);
e1ade7d20fb0ef Lu Hongfei  2023-05-31  76  		if (ret < 0)
e1ade7d20fb0ef Lu Hongfei  2023-05-31  77  			return ret;
e1ade7d20fb0ef Lu Hongfei  2023-05-31  78  		if (ctx->desc->use_passwd3) {
e1ade7d20fb0ef Lu Hongfei  2023-05-31  79  			ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0x5a, 0x5a);
e1ade7d20fb0ef Lu Hongfei  2023-05-31  80  			if (ret < 0)
e1ade7d20fb0ef Lu Hongfei  2023-05-31  81  				return ret;
e1ade7d20fb0ef Lu Hongfei  2023-05-31  82  		}
6810bb390282bb Artur Weber 2023-05-19  83  	} else {
e1ade7d20fb0ef Lu Hongfei  2023-05-31  84  		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0x5a, 0x5a);
e1ade7d20fb0ef Lu Hongfei  2023-05-31  85  		if (ret < 0)
e1ade7d20fb0ef Lu Hongfei  2023-05-31  86  			return ret;
e1ade7d20fb0ef Lu Hongfei  2023-05-31  87  		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0x5a, 0x5a);
e1ade7d20fb0ef Lu Hongfei  2023-05-31  88  		if (ret < 0)
e1ade7d20fb0ef Lu Hongfei  2023-05-31  89  			return ret;
e1ade7d20fb0ef Lu Hongfei  2023-05-31  90  		if (ctx->desc->use_passwd3) {
e1ade7d20fb0ef Lu Hongfei  2023-05-31  91  			ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
e1ade7d20fb0ef Lu Hongfei  2023-05-31  92  			if (ret < 0)
e1ade7d20fb0ef Lu Hongfei  2023-05-31  93  				return ret;
e1ade7d20fb0ef Lu Hongfei  2023-05-31  94  		}
6810bb390282bb Artur Weber 2023-05-19  95  	}
6810bb390282bb Artur Weber 2023-05-19  96  
6810bb390282bb Artur Weber 2023-05-19  97  	return ret;
6810bb390282bb Artur Weber 2023-05-19  98  }
6810bb390282bb Artur Weber 2023-05-19  99
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
index 102e1fc7ee38..f98df32d1c55
--- a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
@@ -69,15 +69,29 @@  static int s6d7aa0_lock(struct s6d7aa0 *ctx, bool lock)
 	int ret = 0;
 
 	if (lock) {
-		mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
-		mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0xa5, 0xa5);
-		if (ctx->desc->use_passwd3)
-			mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0x5a, 0x5a);
+		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5);
+		if (ret < 0)
+			return ret;
+		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0xa5, 0xa5);
+		if (ret < 0)
+			return ret;
+		if (ctx->desc->use_passwd3) {
+			ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0x5a, 0x5a);
+			if (ret < 0)
+				return ret;
+		}
 	} else {
-		mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0x5a, 0x5a);
-		mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0x5a, 0x5a);
-		if (ctx->desc->use_passwd3)
-			mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
+		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0x5a, 0x5a);
+		if (ret < 0)
+			return ret;
+		ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0x5a, 0x5a);
+		if (ret < 0)
+			return ret;
+		if (ctx->desc->use_passwd3) {
+			ret = mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5);
+			if (ret < 0)
+				return ret;
+		}
 	}
 
 	return ret;