From patchwork Mon Jan 2 20:25:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 13086988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFE25C3DA7A for ; Mon, 2 Jan 2023 20:25:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B86E510E1B7; Mon, 2 Jan 2023 20:25:52 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 301D110E1B7 for ; Mon, 2 Jan 2023 20:25:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672691150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xCNMgkWa09fEzea1HqZoR7Nx7p6LXc3d3hq975HBBf8=; b=c2M3eULR4SrHEtadMH4w/oKeDoXpeGqfj8oQlSa03jFY7D95X1+aY1KEvQg7LwT8PUHrMt Ol44dyYQDgwhswErbn7izCNmqSg3OhD8ZtxbXS/gscBVDefX8P3VglApc90+MvrVnUkS8d 6eBnY2VDXJlCw19yaTZixy94QcSAHno= 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-495-9L93zUMuNBeB21iFykTg_Q-1; Mon, 02 Jan 2023 15:25:49 -0500 X-MC-Unique: 9L93zUMuNBeB21iFykTg_Q-1 Received: by mail-wr1-f71.google.com with SMTP id n13-20020adfc60d000000b0029bdfcf52eeso311884wrg.8 for ; Mon, 02 Jan 2023 12:25:48 -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:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xCNMgkWa09fEzea1HqZoR7Nx7p6LXc3d3hq975HBBf8=; b=bjjiiGKUEuMiWxZfKT/ASeNW+jBAtVTb7ibuYeoi2kE/oa9aWjhRWk2ysI+l4uWLVJ 3Dzp7tYE/nc6iQUccUa67kTO+neVqEwt3FW+dny83KQo5pp/keLiuEiDrsZfgFYGA9dA EL7txz15zJmW0cOoBRxtRo3BzzyUSYyEqO2EyP9WxD75BNPr/LShfBwWm+HN6QTtgWev 3TvnvEcWU3PqDCCzC6RX/BBctlPSN/5rD726IIWDjZ0I6L+Rhlx6LTmLxfq8B8WVnMXv oFujapDVijTYf8Zn1m5l9ckMs7ZgRcfYQ6bJWapdsJeks57+cxb1cDARodiA80s6IMv/ wkOQ== X-Gm-Message-State: AFqh2kpwzfpQXZ/54XkENOCTu5PvDomt1deZyu+3mZC5FGGDJ3gzUY8y qySTdMT0aqUlGPMxzXde/vs+pPFeeS+boydqe2yrMzMXRHiwBea4vpk49chEo8CseAimPPjjfkU JWZKv0iwP294OP5VSkkpzbxh+83Oi X-Received: by 2002:a05:600c:1c85:b0:3d3:4b18:27c6 with SMTP id k5-20020a05600c1c8500b003d34b1827c6mr29159456wms.11.1672691148001; Mon, 02 Jan 2023 12:25:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXucLyQjV1JdUh/Oxhsrc63ax4d9VZwsRvpyJNghr8LaaYhJT1s03Mg1ltldjdSwypzvI/Jtqw== X-Received: by 2002:a05:600c:1c85:b0:3d3:4b18:27c6 with SMTP id k5-20020a05600c1c8500b003d34b1827c6mr29159442wms.11.1672691147819; Mon, 02 Jan 2023 12:25:47 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id f18-20020a05600c4e9200b003d35c845cbbsm50061135wmq.21.2023.01.02.12.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 12:25:47 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] drm/mipi-dsi: Fix mipi_dsi_dcs_write_seq() macro definition format Date: Mon, 2 Jan 2023 21:25:41 +0100 Message-Id: <20230102202542.3494677-1-javierm@redhat.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Thomas Zimmermann , Sam Ravnborg , llvm@lists.linux.dev, Javier Martinez Canillas , Nathan Chancellor , dri-devel@lists.freedesktop.org, Tom Rix Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Change made using a `clang-format -i include/drm/drm_mipi_dsi.h` command. Suggested-by: Sam Ravnborg Signed-off-by: Javier Martinez Canillas Reviewed-by: Sam Ravnborg --- Changes in v2: - New patch in v2. include/drm/drm_mipi_dsi.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 20b21b577dea..e9d1e8a7fc7e 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -303,15 +303,18 @@ int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi, * @cmd: Command * @seq: buffer containing data to be transmitted */ -#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) do { \ - static const u8 d[] = { cmd, seq }; \ - struct device *dev = &dsi->dev; \ - int ret; \ - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ - if (ret < 0) { \ - dev_err_ratelimited(dev, "sending command %#02x failed: %d\n", cmd, ret); \ - return ret; \ - } \ +#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) \ + do { \ + static const u8 d[] = { cmd, seq }; \ + struct device *dev = &dsi->dev; \ + int ret; \ + ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) { \ + dev_err_ratelimited( \ + dev, "sending command %#02x failed: %d\n", \ + cmd, ret); \ + return ret; \ + } \ } while (0) /** From patchwork Mon Jan 2 20:25:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 13086989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96561C3DA7A for ; Mon, 2 Jan 2023 20:26:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 70A8510E1C4; Mon, 2 Jan 2023 20:25:53 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4BBA010E1B7 for ; Mon, 2 Jan 2023 20:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672691151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CBlDHKovYJnwPgpmS84u28pOqrwSgYnv9FJm79/ywfo=; b=H0A53CHDKiSJ0P7aq0ubCSpHTOu8Db2SQPP23AtQ5iOC0Jvfo7CsMqVnwmCJR01gHEc2Mm DzZ+CC/brGm+G1qVc+Hu+qpPXK7sIlmjkTDHR50m3MliO6A3m/1ZiGcURioJXVMa3Qjg91 ZM68PmrQWwrzK8ViUsomxhF4XwfXORY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-93-qlwl5PwGOS2IKSYTFWCe0w-1; Mon, 02 Jan 2023 15:25:50 -0500 X-MC-Unique: qlwl5PwGOS2IKSYTFWCe0w-1 Received: by mail-wm1-f71.google.com with SMTP id k20-20020a05600c1c9400b003d9717c8b11so13505115wms.7 for ; Mon, 02 Jan 2023 12:25:50 -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=CBlDHKovYJnwPgpmS84u28pOqrwSgYnv9FJm79/ywfo=; b=R4/oSDTyaYZw21hjjZh//whnHkKL9WCnrCWox7p9deFTBi6f9KC+ZR825mwV4J3H7/ DgebsMzZniKn3c9KjQaulr06i6tmPlXOQWu4PWOIL/y5srMQU+3KRmjzWSVlC0J1hYW8 5R0wIfLuxacnqIzP7+xTGBTZjQfuIY96mb+VrTMogKOYfnneFY5Jr6eilrtQtUeCKnWg g0yCk807cHfWCvXL9y/AKVvbRLslqZfGMjUziWlMZ421EjFOj3YVuQ9duecdPM8UqZou zagD/AysKOfZ0ywT0sw/BVaUuqD0c0IpeGyrc9YqWl8Upg/zl1HdsWT0YqR+dUfa6vWN z5+w== X-Gm-Message-State: AFqh2ko7JDQYJDLXobRUNEYku1+vFhARzNLhLaN8Adauvc2QA3OfGxnu lIMSou+UOHsgAAeY/Lg2CCFlONlVcRnZuom7jpkctM1LvoXGFVpnQRDN/ow0gD7G7REsFy3zLC3 RbNhQ2dvxRNNH4OS37n0vg9Dyj35D X-Received: by 2002:a05:600c:5c8:b0:3d1:4145:b3b with SMTP id p8-20020a05600c05c800b003d141450b3bmr30492711wmd.9.1672691149109; Mon, 02 Jan 2023 12:25:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXuFSBAgfXtOm8IhviyEQci+lDT3iLsXP7qbucv5WVdjLUibBjrcSUUYhWY1PDUAyK235lJ0ew== X-Received: by 2002:a05:600c:5c8:b0:3d1:4145:b3b with SMTP id p8-20020a05600c05c800b003d141450b3bmr30492703wmd.9.1672691148924; Mon, 02 Jan 2023 12:25:48 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id f18-20020a05600c4e9200b003d35c845cbbsm50061135wmq.21.2023.01.02.12.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 12:25:48 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro Date: Mon, 2 Jan 2023 21:25:42 +0100 Message-Id: <20230102202542.3494677-2-javierm@redhat.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230102202542.3494677-1-javierm@redhat.com> References: <20230102202542.3494677-1-javierm@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Zimmermann , Sam Ravnborg , Javier Martinez Canillas , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Sam Ravnborg --- Changes in v2: - Fix kernel-doc macro name (kernel test robot, Sam Ravnborg) - Add Sam Ravnborg's Reviewed-by tag. include/drm/drm_mipi_dsi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index e9d1e8a7fc7e..4f503d99f668 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -297,6 +297,24 @@ 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_seq - 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