Message ID | 20221228014757.3170486-2-javierm@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1671826wrt; Tue, 27 Dec 2022 17:50:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXupvdlV5Z9RfD+h+DGqvkzN/JXZySKk8vlwtQNibGrO61JoCTmJW+JSOrgGf8p7bC9UmCuV X-Received: by 2002:a17:902:c643:b0:192:4d6a:2ac8 with SMTP id s3-20020a170902c64300b001924d6a2ac8mr19307659pls.56.1672192205995; Tue, 27 Dec 2022 17:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672192205; cv=none; d=google.com; s=arc-20160816; b=CmDF6SfCq35zg/fOGYNDNWxpeobR9B18zFQ7tZIX9UFKHwpA1KLPru9GXykA2NGm6U ZT7jm/VIrX/mQmorwcAanQyIN5EIaAibF2/Nz/Ystut+1V7lkHnTaJXFN+Ut8xsKcqbY zgKrjiQw4uEsa8rSb9WTRaZzT8GZ3E/T+aZLbflmU7YeB3zyvHd3H5y9rHHGqwJ26G/5 fCpld9cw62LcGloJ6sv0NGMMQtPeom3MJdsVZs6Tx4ick7Nmrl6l4B6s3Hg4NnFPpHNf TZZrNygrQQwDHVWMmTCFUKOLvj2x9JOiuTW2TgV5yx45gs24ODBXTuxzaS5OqY3gYP6e e/1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Sg6FOfZxQPsgBuL2lCxZX6+6aSPYMIBPuFtBP5Cei48=; b=AiIWqGIvVVLEx5gNGPKiKj+FBs5qkSe28tzSXb0yNPnNIjGu7ZhpCffbVbtI+sR+Ex m3iFUsb5fa8zst3F4O8H80SBDl7MHh85QNR+kNSSA/N/m4TYg9OTbCc9zQrNcyUL3mX6 9derSbq+ClQRn1Iw2j2pzoEhCHFU9m65OG+Pd6xITA2IqF/DaRl+wUVblfZ+eaN/VnD4 wx+6Ks/lnBevFE53arDo7L4AkheU4qDPNzfSlcfgjpd+789uNj4YAWkrb6zyTYKUFYkj kQ4bsiMALJb11dgjfrseQvU1e8R/RQbQXgF9DfJKmTrKgojAr3++wXsdxhIUYd7J2TGy UVzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ldaz6UQR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a63e346000000b00478d39fcb3dsi15908652pgj.519.2022.12.27.17.49.51; Tue, 27 Dec 2022 17:50:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ldaz6UQR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232210AbiL1BtK (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Tue, 27 Dec 2022 20:49:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230410AbiL1Bs7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 27 Dec 2022 20:48:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D82B25FB for <linux-kernel@vger.kernel.org>; Tue, 27 Dec 2022 17:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672192089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sg6FOfZxQPsgBuL2lCxZX6+6aSPYMIBPuFtBP5Cei48=; b=Ldaz6UQRRA6gafF0iERuSFZpwveHTLH11VI3lUoFBIBGl/chBnpiITbqCGqWlcRW6hoH4S HRvNBzKjf1aTr25UIcBq4d3D03xZ5b2Uh8bSTEqbMtBizixIR+ykmi4DbIqDsCXQNUsshF CUpOOP34snKkrwKniRXwnc06Ui9Hp+U= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-632-fYW1-vMyN_O7Ws76Pc0ihw-1; Tue, 27 Dec 2022 20:48:07 -0500 X-MC-Unique: fYW1-vMyN_O7Ws76Pc0ihw-1 Received: by mail-wr1-f71.google.com with SMTP id c21-20020adfa315000000b002425bf67a87so1897588wrb.19 for <linux-kernel@vger.kernel.org>; Tue, 27 Dec 2022 17:48:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sg6FOfZxQPsgBuL2lCxZX6+6aSPYMIBPuFtBP5Cei48=; b=1cb6X6lb6RFUpFNQhOzAUReVt3J0fr39QOZFs0n2J0HTeq8xcBHh1/iCYd5006vhkt AzGUFpbV34leANoNDpjaobzR7KVb343omD1oKY5OVAIus/HmGsl86UQD0A2PwRxkYRnz Nw/wknDfqcbmYtaSp66aeLJUuZIgbdTS0K01aG+B/7WXoA2jDOVkGhViHYaRRkl1/fZV Y89R1nqQv567H8JBTN20/iBpkJpPsGHOqRCtXu+0Qk65EgW++bSkGnyTQiyn01v8SGUb uxR064sz91llFIOaMG5fqhlPYQjHhzhxIfwRmcEkKJ0MJfb9TlrsiFzLG1Z/ja99wQzT zAKw== X-Gm-Message-State: AFqh2kpr8McJGk2GAzKs7tJax89ioFTF/ztcdO1AoDJpska4PZ8i5m+1 9kztJMzQEq9qV5pOkiDaL5ZNX8qfYo+0MW52eJToydRYK7bDkb0r4rhqIJbArrlvCRZ/55gxPd1 IDCcXPlE++8bHlpZpy03YBXlYw0OncS39ZysCdI1Slo7V5wGfavwaaYl6sT4UNHVq1gYcUEXGbC I= X-Received: by 2002:a5d:4e83:0:b0:242:5a9e:4568 with SMTP id e3-20020a5d4e83000000b002425a9e4568mr12991624wru.45.1672192086107; Tue, 27 Dec 2022 17:48:06 -0800 (PST) X-Received: by 2002:a5d:4e83:0:b0:242:5a9e:4568 with SMTP id e3-20020a5d4e83000000b002425a9e4568mr12991610wru.45.1672192085901; Tue, 27 Dec 2022 17:48:05 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id k16-20020a056000005000b002258235bda3sm14158873wrx.61.2022.12.27.17.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Dec 2022 17:48:05 -0800 (PST) From: Javier Martinez Canillas <javierm@redhat.com> To: linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas <javierm@redhat.com>, Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@gmail.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org Subject: [PATCH 01/14] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro Date: Wed, 28 Dec 2022 02:47:44 +0100 Message-Id: <20221228014757.3170486-2-javierm@redhat.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221228014757.3170486-1-javierm@redhat.com> References: <20221228014757.3170486-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753420614795507611?= X-GMAIL-MSGID: =?utf-8?q?1753420614795507611?= |
Series |
drm/panel: Make panel drivers use existing DSI write macros
|
|
Commit Message
Javier Martinez Canillas
Dec. 28, 2022, 1:47 a.m. UTC
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>
---
include/drm/drm_mipi_dsi.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
Comments
Hi Javier, I love your patch! Perhaps something to improve: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on linus/master v6.2-rc1 next-20221226] [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/Javier-Martinez-Canillas/drm-mipi-dsi-Add-a-mipi_dsi_dcs_write_seq-macro/20221228-100040 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20221228014757.3170486-2-javierm%40redhat.com patch subject: [PATCH 01/14] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro reproduce: # https://github.com/intel-lab-lkp/linux/commit/6dbe3eb57c38eaa1be1271fe9563406472377dc7 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Javier-Martinez-Canillas/drm-mipi-dsi-Add-a-mipi_dsi_dcs_write_seq-macro/20221228-100040 git checkout 6dbe3eb57c38eaa1be1271fe9563406472377dc7 make menuconfig # enable CONFIG_COMPILE_TEST, CONFIG_WARN_MISSING_DOCUMENTS, CONFIG_WARN_ABI_ERRORS make htmldocs If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> ./include/drm/drm_mipi_dsi.h:314: warning: expecting prototype for mipi_dsi_generic_write(). Prototype was for mipi_dsi_generic_write_seq() instead vim +314 ./include/drm/drm_mipi_dsi.h 271 272 ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi, 273 const void *data, size_t len); 274 ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd, 275 const void *data, size_t len); 276 ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, 277 size_t len); 278 int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi); 279 int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi); 280 int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode); 281 int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format); 282 int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi); 283 int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi); 284 int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi); 285 int mipi_dsi_dcs_set_display_on(struct mipi_dsi_device *dsi); 286 int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start, 287 u16 end); 288 int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start, 289 u16 end); 290 int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi); 291 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi, 292 enum mipi_dsi_dcs_tear_mode mode); 293 int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format); 294 int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline); 295 int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi, 296 u16 brightness); 297 int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi, 298 u16 *brightness); 299 300 /** 301 * mipi_dsi_generic_write - transmit data using a generic write packet 302 * @dsi: DSI peripheral device 303 * @seq: buffer containing the payload 304 */ 305 #define mipi_dsi_generic_write_seq(dsi, seq...) do { \ 306 static const u8 d[] = { seq }; \ 307 struct device *dev = &dsi->dev; \ 308 int ret; \ 309 ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ 310 if (ret < 0) { \ 311 dev_err_ratelimited(dev, "transmit data failed: %d\n", ret); \ 312 return ret; \ 313 } \ > 314 } while (0) 315
Hi Javier. On Wed, Dec 28, 2022 at 02:47:44AM +0100, 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> > --- > > include/drm/drm_mipi_dsi.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h > index 20b21b577dea..c7c458131ba1 100644 > --- a/include/drm/drm_mipi_dsi.h > +++ b/include/drm/drm_mipi_dsi.h > @@ -297,6 +297,22 @@ 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 - transmit data using a generic write packet s/mipi_dsi_generic_write/mipi_dsi_generic_write_seq (As the bot also reported) with this fixed: Reviewed-by: Sam Ravnborg <sam@ravnborg.org> > + * @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) > + (If you align '\' under each other it would be nicer, but I could see that mipi_dsi_dcs_write_seq() do not do so). > /** > * mipi_dsi_dcs_write_seq - transmit a DCS command with payload > * @dsi: DSI peripheral device > -- > 2.38.1
Hello Sam, Thanks a lot for your feedback. On 1/2/23 19:39, Sam Ravnborg wrote: > Hi Javier. > > On Wed, Dec 28, 2022 at 02:47:44AM +0100, 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> >> --- >> >> include/drm/drm_mipi_dsi.h | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h >> index 20b21b577dea..c7c458131ba1 100644 >> --- a/include/drm/drm_mipi_dsi.h >> +++ b/include/drm/drm_mipi_dsi.h >> @@ -297,6 +297,22 @@ 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 - transmit data using a generic write packet > s/mipi_dsi_generic_write/mipi_dsi_generic_write_seq > (As the bot also reported) > Ups, sorry for missing that. > with this fixed: > Reviewed-by: Sam Ravnborg <sam@ravnborg.org> > Thanks! >> + * @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) >> + > (If you align '\' under each other it would be nicer, but I could see > that mipi_dsi_dcs_write_seq() do not do so). Yeah, I was actually thinking about doing like you suggested for this macro but preferred to keep it consistent with the existing mipi_dsi_dcs_write_seq() macro definition... Maybe I can add a preparatory patch that just fixes the backslash characters indent for mipi_dsi_dcs_write_seq() to be all aligned?
Hi Javier, > > (If you align '\' under each other it would be nicer, but I could see > > that mipi_dsi_dcs_write_seq() do not do so). > > Yeah, I was actually thinking about doing like you suggested for this macro > but preferred to keep it consistent with the existing mipi_dsi_dcs_write_seq() > macro definition... > > Maybe I can add a preparatory patch that just fixes the backslash characters > indent for mipi_dsi_dcs_write_seq() to be all aligned? Yep, that would be nice. Sam
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 20b21b577dea..c7c458131ba1 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -297,6 +297,22 @@ 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 - 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