From patchwork Wed May 1 15:41:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13650960 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 4CD6DC4345F for ; Wed, 1 May 2024 15:43:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4571210F6FB; Wed, 1 May 2024 15:43:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OTk6T7Xo"; dkim-atps=neutral Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id ED97610F157 for ; Wed, 1 May 2024 15:43:21 +0000 (UTC) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6edb76d83d0so5978460b3a.0 for ; Wed, 01 May 2024 08:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714578200; x=1715183000; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IqSRaJ+I/NgAMp1CRzQlMWp8eVTN4Fv5wLPbhbxPoyI=; b=OTk6T7XoqBocFosoR1dUNJ2RAaesv93u8u19owPSKR9WVG1iVb1FA4uBBjyIeFyEpW /kHuThZU13hPXd0PKK6TXoCu4tlwOjzoeLXBQ49DO1D+INbaSo95yhNi+RBth5dFRBWB pPt7flWdcGbo5Chkip8ZMFlDmNrFp1V1ZAoPU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714578200; x=1715183000; 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=IqSRaJ+I/NgAMp1CRzQlMWp8eVTN4Fv5wLPbhbxPoyI=; b=pWCnewYQtuXdr/+nfe70S35IhK1sITGg7y60ik1dtdAj+3ekqHzpWiOHSAc2FsUT1r BXWEWIiNZq1B3FOgIA9yvQ8EtOU0/SZrB6/veHx4XV4PyTALdCyTFFXJw1PfihOk+dok OYepq9/Xj0WC/ZiQ4dyKX9xBTqM86U/+bA3anvxx1V0IqZf/0LzCr1vSUhrkCDwbDfMN hRPbDHOtW2C1hGpQWrMG/DPyysPE/ZC0JoRddItRdr/4qzElOD6JJ/zFWLtIW3SQArHP A9f+LMdzDOiidjt8px07OQ2GKJJfqk/nusSxN2tmVC+JWcEttzR+Z8AYdkYfovl4R6In 9SyQ== X-Gm-Message-State: AOJu0YzDVah6CEO368Pe+QkL3knSjhF3iN3KmZyJVI+WF4FdcXw1mzi0 Ac4qUj4g53amWHFLu8b1eomENjRLx4U0fs3BaIP72UviuDrgSQzai9j1uqCfeHDR3Nl/IT4QvuI = X-Google-Smtp-Source: AGHT+IFI0XRKl4xlF9oA6mVlSbPDXsPwloqxxCaCX7TyGbZ6xYS649sCJKaSQ+96XKkEBKOMHdGtmg== X-Received: by 2002:a05:6a20:2593:b0:1a9:8251:41ba with SMTP id k19-20020a056a20259300b001a9825141bamr3504545pzd.51.1714578200409; Wed, 01 May 2024 08:43:20 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:e886:8de:19a2:55b0]) by smtp.gmail.com with ESMTPSA id fb12-20020a056a002d8c00b006f3ec69bc09sm7717924pfb.75.2024.05.01.08.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:43:19 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Linus Walleij , Jani Nikula , Dmitry Baryshkov , Cong Yang , Hsin-Yi Wang , Brian Norris , Sam Ravnborg , Neil Armstrong , Javier Martinez Canillas , Joel Selvaraj , lvzhaoxiong@huaqin.corp-partner.google.com, Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/9] drm/mipi-dsi: Fix theoretical int overflow in mipi_dsi_dcs_write_seq() Date: Wed, 1 May 2024 08:41:04 -0700 Message-ID: <20240501084109.v3.1.I30fa4c8348ea316c886ef8a522a52fed617f930d@changeid> X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog In-Reply-To: <20240501154251.3302887-1-dianders@chromium.org> References: <20240501154251.3302887-1-dianders@chromium.org> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The mipi_dsi_dcs_write_seq() macro makes a call to mipi_dsi_dcs_write_buffer() which returns a type ssize_t. The macro then stores it in an int and checks to see if it's negative. This could theoretically be a problem if "ssize_t" is larger than "int". To see the issue, imagine that "ssize_t" is 32-bits and "int" is 16-bits, you could see a problem if there was some code out there that looked like: mipi_dsi_dcs_write_seq(dsi, cmd, <32767 bytes as arguments>); ...since we'd get back that 32768 bytes were transferred and 32768 stored in a 16-bit int would look negative. Though there are no callsites where we'd actually hit this (even if "int" was only 16-bit), it's cleaner to make the types match so let's fix it. Fixes: 2a9e9daf7523 ("drm/mipi-dsi: Introduce mipi_dsi_dcs_write_seq macro") Signed-off-by: Douglas Anderson Reviewed-by: Neil Armstrong Reviewed-by: Linus Walleij --- Changes in v3: - Use %zd in print instead of casting errors to int. Changes in v2: - New include/drm/drm_mipi_dsi.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 82b1cc434ea3..70ce0b8cbc68 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -333,18 +333,18 @@ int mipi_dsi_dcs_get_display_brightness_large(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; \ + ssize_t ret; \ + ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) { \ + dev_err_ratelimited( \ + dev, "sending command %#02x failed: %zd\n", \ + cmd, ret); \ + return ret; \ + } \ } while (0) /** From patchwork Wed May 1 15:41:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13650961 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 D4C1CC4345F for ; Wed, 1 May 2024 15:43:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 41C9410F1D2; Wed, 1 May 2024 15:43:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="E0/7edeA"; dkim-atps=neutral Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2DCCE10F157 for ; Wed, 1 May 2024 15:43:24 +0000 (UTC) Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6ed32341906so6374474b3a.1 for ; Wed, 01 May 2024 08:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714578203; x=1715183003; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VAsbnoEFJrVyDtHtft3iEaFOAYRSD9aeoc8eSw4uTv0=; b=E0/7edeAo7IJoaVHdQyq3dq88GuBHvbYvVaHUOTeIXBWIbeqmd9qe4/gvAB7MCGLrE 7LknsnkatKxrEnogV+sFklgwUQ21ZN+hxnTdi7cxVxntokgIHUm2036qIt0CGe2LslW3 n5HSQm7lWlMhWX7dPUbOH3Jx4hpOEgLibbQI4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714578203; x=1715183003; 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=VAsbnoEFJrVyDtHtft3iEaFOAYRSD9aeoc8eSw4uTv0=; b=bL+QlYyB7xh/X3JDyCcMQ/QatApPmONhxxNu9mU2WQBn/OHtuVqZb/2RTYsAHbQ3pq CvRJJDjuHZdjDF3soWPIoMNqWfHHVB7mh/5l1KtLb1Rwef4K6cgTXALit50x2hTrcu7c WBjV9Vt7IpaMGyml1e+ALGQ5xJQUgu5QpugkuHyh5vQQq6kt/xocnQ6YQChnOoUx6Q50 wlnlDFcJr73uY4CX4FDldJo8Y3KyFp+IwiVLqs0PCKHzVsdy9JNhwOK1hzjqMjUbDuOF OZZD3ZvSuC7PZU8F37RHAxybpXXyFKZAp8d4DfbfZlF4Y8xZGjfXf4Co6t/iwtYYgakj FHBQ== X-Gm-Message-State: AOJu0YybWg2JE5/z8dPH/4TgQb7RWCx4k1yhBN1uIdyj2os0tQHAYZvj KOE3yJ5F8IbWJMrEmdteof3neXZXBmylfmYGU0xs66qoeXn6hZaaHYhI5IX8/c1NZcywxql68u4 = X-Google-Smtp-Source: AGHT+IGSKEwdMoXg4YQC0tdFdeDZpeNvFEZH6s4FpOFcIZ1h0R2eymsxfQdRAtcIk9RK1dzbsMyh1g== X-Received: by 2002:a05:6a20:5512:b0:1af:6911:ddf3 with SMTP id ko18-20020a056a20551200b001af6911ddf3mr2223520pzb.7.1714578202897; Wed, 01 May 2024 08:43:22 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:e886:8de:19a2:55b0]) by smtp.gmail.com with ESMTPSA id fb12-20020a056a002d8c00b006f3ec69bc09sm7717924pfb.75.2024.05.01.08.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:43:22 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Linus Walleij , Jani Nikula , Dmitry Baryshkov , Cong Yang , Hsin-Yi Wang , Brian Norris , Sam Ravnborg , Neil Armstrong , Javier Martinez Canillas , Joel Selvaraj , lvzhaoxiong@huaqin.corp-partner.google.com, Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 2/9] drm/mipi-dsi: Fix theoretical int overflow in mipi_dsi_generic_write_seq() Date: Wed, 1 May 2024 08:41:05 -0700 Message-ID: <20240501084109.v3.2.Iadb65b8add19ed3ae3ed6425011beb97e380a912@changeid> X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog In-Reply-To: <20240501154251.3302887-1-dianders@chromium.org> References: <20240501154251.3302887-1-dianders@chromium.org> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The mipi_dsi_generic_write_seq() macro makes a call to mipi_dsi_generic_write() which returns a type ssize_t. The macro then stores it in an int and checks to see if it's negative. This could theoretically be a problem if "ssize_t" is larger than "int". To see the issue, imagine that "ssize_t" is 32-bits and "int" is 16-bits, you could see a problem if there was some code out there that looked like: mipi_dsi_generic_write_seq(dsi, <32768 bytes as arguments>); ...since we'd get back that 32768 bytes were transferred and 32768 stored in a 16-bit int would look negative. Though there are no callsites where we'd actually hit this (even if "int" was only 16-bit), it's cleaner to make the types match so let's fix it. Fixes: a9015ce59320 ("drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro") Signed-off-by: Douglas Anderson Reviewed-by: Neil Armstrong Reviewed-by: Linus Walleij --- Changes in v3: - Use %zd in print instead of casting errors to int. Changes in v2: - New include/drm/drm_mipi_dsi.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 70ce0b8cbc68..e0f56564bf97 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -314,17 +314,17 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, * @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; \ - } \ +#define mipi_dsi_generic_write_seq(dsi, seq...) \ + do { \ + static const u8 d[] = { seq }; \ + struct device *dev = &dsi->dev; \ + ssize_t ret; \ + ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) { \ + dev_err_ratelimited(dev, "transmit data failed: %zd\n", \ + ret); \ + return ret; \ + } \ } while (0) /** From patchwork Wed May 1 15:41:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13650962 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 B5095C10F1A for ; Wed, 1 May 2024 15:43:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D58710FA3A; Wed, 1 May 2024 15:43:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="at+uXZy2"; dkim-atps=neutral Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id F1FE210F1D2 for ; Wed, 1 May 2024 15:43:25 +0000 (UTC) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6edc61d0ff6so6915813b3a.2 for ; Wed, 01 May 2024 08:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714578205; x=1715183005; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wAD627IJLyAwq2+Pm443W8wYZzFiM9UM6KaJFA24npw=; b=at+uXZy2RvuyenhyYm5L3cEyahgT1paDWGV+afmnvn0wL2mjXWIdzSz49/OuBk26v6 EDGnNAnvMocFkc8ushcNLiVNQ9SsGn0u2VxAtjNyXrCUHjH1bNdX442F5H+bStIgjwbp 4Dnvfz+++3+OXPlAs0UI03XePxZKjkGRFPpsk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714578205; x=1715183005; 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=wAD627IJLyAwq2+Pm443W8wYZzFiM9UM6KaJFA24npw=; b=hV67U7FtIkohc/tPxQAEa9XGFobvt1D3gjVAF/nw3aL57OrmqS+zQdTP2tSjhwP5vJ Shz8xXWpDkwCxSF20WC/YWK39POzzfGtXELisdw34cmQMfnTNdeLixVgvCq7teDDCMF1 iri/+vSDAGpUJd3PG+0gmv2I/Put5DVDRgKOkPUfUJtMmlMtCjftH13XYp+NMyl+7nxl sHqOtYQiJTSgwOr9y3APoXBfg0dhuCa4u+ZubcWAqMF+pqu1FiQqazQz690qp7nJ9gN4 aa8n0VQ259rhOggPDccIvnn0iK2vGRFjYvZQO+mvqvDv4nv55XzAhegEpGI7iOKnW4M4 Eirg== X-Gm-Message-State: AOJu0YwzVnhzrRqbX4ZQuZx9m04rd4Tj/a6VcFUKbzfB9K7XdTD2E55K R870Y3kor1keep3/p3xbNaMVcdTrFJVDN7Wl+A13Gsesi8ZHqmJ0uL+rMrV0DAk8g94Z4OquvZk = X-Google-Smtp-Source: AGHT+IHnQJcwW7iSgBS1Mn2cIHPMUqWwr0A7IK4cUZyXisTKMjjwtDQdihxzWoNTTqOFDzU5XwnMpQ== X-Received: by 2002:a05:6a00:a02:b0:6ea:86f2:24fb with SMTP id p2-20020a056a000a0200b006ea86f224fbmr3949203pfh.25.1714578204875; Wed, 01 May 2024 08:43:24 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:e886:8de:19a2:55b0]) by smtp.gmail.com with ESMTPSA id fb12-20020a056a002d8c00b006f3ec69bc09sm7717924pfb.75.2024.05.01.08.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:43:24 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Linus Walleij , Jani Nikula , Dmitry Baryshkov , Cong Yang , Hsin-Yi Wang , Brian Norris , Sam Ravnborg , Neil Armstrong , Javier Martinez Canillas , Joel Selvaraj , lvzhaoxiong@huaqin.corp-partner.google.com, Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 3/9] drm/mipi-dsi: mipi_dsi_*_write functions don't need to ratelimit prints Date: Wed, 1 May 2024 08:41:06 -0700 Message-ID: <20240501084109.v3.3.I9982cd5d8014de7a4513f5619f66f88da49ce4ec@changeid> X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog In-Reply-To: <20240501154251.3302887-1-dianders@chromium.org> References: <20240501154251.3302887-1-dianders@chromium.org> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We really don't expect these errors to be printed over and over again. When a driver hits the error it should bail out. Just use a normal error print. This gives a nice space savings for users of these functions: $ scripts/bloat-o-meter \ .../before/panel-novatek-nt36672e.ko \ .../after/panel-novatek-nt36672e.ko add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-16760 (-16760) Function old new delta nt36672e_1080x2408_60hz_init 17080 10640 -6440 nt36672e_1080x2408_60hz_init._rs 10320 - -10320 Total: Before=31815, After=15055, chg -52.68% Signed-off-by: Douglas Anderson Reviewed-by: Neil Armstrong Reviewed-by: Linus Walleij --- Changes in v3: - ("mipi_dsi_*_write functions don't need to ratelimit...") moved earlier. Changes in v2: - New include/drm/drm_mipi_dsi.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index e0f56564bf97..67967be48dbd 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -314,17 +314,16 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, * @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; \ - ssize_t ret; \ - ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ - if (ret < 0) { \ - dev_err_ratelimited(dev, "transmit data failed: %zd\n", \ - ret); \ - return ret; \ - } \ +#define mipi_dsi_generic_write_seq(dsi, seq...) \ + do { \ + static const u8 d[] = { seq }; \ + struct device *dev = &dsi->dev; \ + ssize_t ret; \ + ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) { \ + dev_err(dev, "transmit data failed: %zd\n", ret); \ + return ret; \ + } \ } while (0) /** @@ -340,8 +339,7 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, ssize_t ret; \ ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ if (ret < 0) { \ - dev_err_ratelimited( \ - dev, "sending command %#02x failed: %zd\n", \ + dev_err(dev, "sending command %#02x failed: %zd\n", \ cmd, ret); \ return ret; \ } \ From patchwork Wed May 1 15:41:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13650963 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 638CEC4345F for ; Wed, 1 May 2024 15:43:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B3FE10F157; Wed, 1 May 2024 15:43:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="arMrgA8x"; dkim-atps=neutral Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC72610F157 for ; Wed, 1 May 2024 15:43:28 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6f3f6aa1437so3391318b3a.3 for ; Wed, 01 May 2024 08:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714578207; x=1715183007; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PdqLCsG6yH2ylvUtBdK7xRsLXNRPF4P26ZlbxzbdCAs=; b=arMrgA8x/09/nGlcsJGVsFFT/5YkfipU3jOu4NoKDHf6YlhvyA0loWZWVkSZl1MnEu Edid0Xm7wrD44sF3CUOD3YIGdbxk5Sh/RMumOhHB/gDGRCe24q+/7P4wZ4AwVkzCQHo6 grgR9WkC2ulpkxCRIiTx7Gss/ho8/7wA4fcVw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714578207; x=1715183007; 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=PdqLCsG6yH2ylvUtBdK7xRsLXNRPF4P26ZlbxzbdCAs=; b=cuGTMoc5oHlACJohp8bvggc5DKLScgR+7MqdJpcQ4eH4cE6gAy93klzbyI4KRWD37h XKt90iIGDB4EdVBfKQMCcKaEswRGpYYB7ikkC1Tpv9XH9UBw40WRovL/I752K1UmrfsF CFMhnNAqOza/zd2/j6vGmymUKpQ+9Ac4eXeB5Sj/HQYXe1EZ7MPXHhNvAki0tOX2DmPa HV3HtxUp4kMM5mM0246LaihkMe7m6eGbZyrYDx6YvXcKi0LgQI4Dytenud4yOHEJ3b+k 7JiC01Kx6/dWF3qGxGeLDHDqN7g8mY+BWzzyk23AXL9Rn/0HbkBgNwuIYPhi8+VK1leH wRsA== X-Gm-Message-State: AOJu0YxBBJJJe3R0YrH1R/J/yX/3GUKrip6LKDZ7ysVk1pJDrMjwWl9p vTQ6jAA3CanAhDUPbm7Fx8iQEa+dtqlmex6IitnBEaIsXx5kC1zJ6CCMbbUMZeNoenewoBC4Gh4 = X-Google-Smtp-Source: AGHT+IEpb9hu/+w6lC896xSQLLAgZ0Frgtjrm4c/ukurMA4cbUXqvrXhDqtlA1gpxRSC8kZpsrSbVg== X-Received: by 2002:a05:6a20:9187:b0:1a9:4055:6dce with SMTP id v7-20020a056a20918700b001a940556dcemr2831466pzd.58.1714578206857; Wed, 01 May 2024 08:43:26 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:e886:8de:19a2:55b0]) by smtp.gmail.com with ESMTPSA id fb12-20020a056a002d8c00b006f3ec69bc09sm7717924pfb.75.2024.05.01.08.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:43:26 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Linus Walleij , Jani Nikula , Dmitry Baryshkov , Cong Yang , Hsin-Yi Wang , Brian Norris , Sam Ravnborg , Neil Armstrong , Javier Martinez Canillas , Joel Selvaraj , lvzhaoxiong@huaqin.corp-partner.google.com, Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 4/9] drm/mipi-dsi: Reduce driver bloat of mipi_dsi_*_write_seq() Date: Wed, 1 May 2024 08:41:07 -0700 Message-ID: <20240501084109.v3.4.Id15fae80582bc74a0d4f1338987fa375738f45b9@changeid> X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog In-Reply-To: <20240501154251.3302887-1-dianders@chromium.org> References: <20240501154251.3302887-1-dianders@chromium.org> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Through a cooperative effort between Hsin-Yi Wang and Dmitry Baryshkov, we have realized the dev_err() in the mipi_dsi_*_write_seq() macros was causing quite a bit of bloat to the kernel. Let's hoist this call into drm_mipi_dsi.c by adding a "chatty" version of the functions that includes the print. While doing this, add a bit more comments to these macros making it clear that they print errors and also that they return out of _the caller's_ function. Without any changes to clients this gives a nice savings. Building with my build system shows one example: $ scripts/bloat-o-meter \ .../before/panel-novatek-nt36672e.ko \ .../after/panel-novatek-nt36672e.ko add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-4404 (-4404) Function old new delta nt36672e_1080x2408_60hz_init 10640 6236 -4404 Total: Before=15055, After=10651, chg -29.25% Note that given the change in location of the print it's harder to include the "cmd" in the printout for mipi_dsi_dcs_write_seq() since, theoretically, someone could call the new chatty function with a zero-size array and it would be illegal to dereference data[0]. There's a printk format to print the whole buffer and this is probably more useful for debugging anyway. Given that we're doing this for mipi_dsi_dcs_write_seq(), let's also print the buffer for mipi_dsi_generic_write_seq() in the error case. It should be noted that the current consensus of DRM folks is that the mipi_dsi_*_write_seq() should be deprecated due to the non-intuitive return behavior. A future patch will formally mark them as deprecated and provide an alternative. Reviewed-by: Dmitry Baryshkov Signed-off-by: Douglas Anderson Reviewed-by: Neil Armstrong Reviewed-by: Linus Walleij --- Changes in v3: - Rebased upon patch to remove ratelimit of prints. Changes in v2: - Add some comments to the macros about printing and returning. - Change the way err value is handled in prep for next patch. - Modify commit message now that this is part of a series. - Rebased upon patches to avoid theoretical int overflow. drivers/gpu/drm/drm_mipi_dsi.c | 56 ++++++++++++++++++++++++++++++++++ include/drm/drm_mipi_dsi.h | 47 +++++++++++++++------------- 2 files changed, 82 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 795001bb7ff1..8593d9ed5891 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -764,6 +764,34 @@ ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload, } EXPORT_SYMBOL(mipi_dsi_generic_write); +/** + * mipi_dsi_generic_write_chatty() - mipi_dsi_generic_write() w/ an error log + * @dsi: DSI peripheral device + * @payload: buffer containing the payload + * @size: size of payload buffer + * + * Like mipi_dsi_generic_write() but includes a dev_err_ratelimited() + * call for you and returns 0 upon success, not the number of bytes sent. + * + * Return: 0 on success or a negative error code on failure. + */ +int mipi_dsi_generic_write_chatty(struct mipi_dsi_device *dsi, + const void *payload, size_t size) +{ + struct device *dev = &dsi->dev; + ssize_t ret; + + ret = mipi_dsi_generic_write(dsi, payload, size); + if (ret < 0) { + dev_err(dev, "sending generic data %*ph failed: %zd\n", + (int)size, payload, ret); + return ret; + } + + return 0; +} +EXPORT_SYMBOL(mipi_dsi_generic_write_chatty); + /** * mipi_dsi_generic_read() - receive data using a generic read packet * @dsi: DSI peripheral device @@ -852,6 +880,34 @@ ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi, } EXPORT_SYMBOL(mipi_dsi_dcs_write_buffer); +/** + * mipi_dsi_dcs_write_buffer_chatty - mipi_dsi_dcs_write_buffer() w/ an error log + * @dsi: DSI peripheral device + * @data: buffer containing data to be transmitted + * @len: size of transmission buffer + * + * Like mipi_dsi_dcs_write_buffer() but includes a dev_err_ratelimited() + * call for you and returns 0 upon success, not the number of bytes sent. + * + * Return: 0 on success or a negative error code on failure. + */ +int mipi_dsi_dcs_write_buffer_chatty(struct mipi_dsi_device *dsi, + const void *data, size_t len) +{ + struct device *dev = &dsi->dev; + ssize_t ret; + + ret = mipi_dsi_dcs_write_buffer(dsi, data, len); + if (ret < 0) { + dev_err(dev, "sending dcs data %*ph failed: %zd\n", + (int)len, data, ret); + return ret; + } + + return 0; +} +EXPORT_SYMBOL(mipi_dsi_dcs_write_buffer_chatty); + /** * mipi_dsi_dcs_write() - send DCS write command * @dsi: DSI peripheral device diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 67967be48dbd..6d68d9927f46 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -256,6 +256,8 @@ int mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi, ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload, size_t size); +int mipi_dsi_generic_write_chatty(struct mipi_dsi_device *dsi, + const void *payload, size_t size); ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, size_t num_params, void *data, size_t size); @@ -279,6 +281,8 @@ enum mipi_dsi_dcs_tear_mode { ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi, const void *data, size_t len); +int mipi_dsi_dcs_write_buffer_chatty(struct mipi_dsi_device *dsi, + const void *data, size_t len); ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd, const void *data, size_t len); ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, @@ -311,38 +315,39 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, /** * mipi_dsi_generic_write_seq - transmit data using a generic write packet + * + * This macro will print errors for you and will RETURN FROM THE CALLING + * FUNCTION (yes this is non-intuitive) upon error. + * * @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; \ - ssize_t ret; \ - ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \ - if (ret < 0) { \ - dev_err(dev, "transmit data failed: %zd\n", ret); \ - return ret; \ - } \ +#define mipi_dsi_generic_write_seq(dsi, seq...) \ + do { \ + static const u8 d[] = { seq }; \ + int ret; \ + ret = mipi_dsi_generic_write_chatty(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) \ + return ret; \ } while (0) /** * mipi_dsi_dcs_write_seq - transmit a DCS command with payload + * + * This macro will print errors for you and will RETURN FROM THE CALLING + * FUNCTION (yes this is non-intuitive) upon error. + * * @dsi: DSI peripheral device * @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; \ - ssize_t ret; \ - ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ - if (ret < 0) { \ - dev_err(dev, "sending command %#02x failed: %zd\n", \ - cmd, ret); \ - return ret; \ - } \ +#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) \ + do { \ + static const u8 d[] = { cmd, seq }; \ + int ret; \ + ret = mipi_dsi_dcs_write_buffer_chatty(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) \ + return ret; \ } while (0) /** From patchwork Wed May 1 15:41:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13650964 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 92C3BC10F1A for ; Wed, 1 May 2024 15:43:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 602A711232D; Wed, 1 May 2024 15:43:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ewE3xFwn"; dkim-atps=neutral Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id A47E611232D for ; Wed, 1 May 2024 15:43:31 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6ecec796323so6616558b3a.3 for ; Wed, 01 May 2024 08:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714578210; x=1715183010; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O8K2bD3VSCdKM5fxY8ne7lxaMKISymJY6P8xiQj5Fs0=; b=ewE3xFwnFT/LH0QOdgz5mXYbDz144iRFK5XNTRElaKXj82SZEeO2ckNgAHBf/XnJPv 4tMj8KYGWUwt5tlfBmjlRLNSPvpLcbHdWJgETu1mkbrrF2W1bIBxueHNQ0NIqVOQ7Ft1 b75ahGTOv6vX/VCgbz8e6RWZ+a+MJjkgnhJiQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714578210; x=1715183010; 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=O8K2bD3VSCdKM5fxY8ne7lxaMKISymJY6P8xiQj5Fs0=; b=ooSYxYQ3Kj1lty4Ln/tfOF99cTS8Uxafl/9Q5ohhx/bxkassKQYJUW6hTCp+/O37EK 9YvOlkTpbrBPF1+22jAAtbZJmMnuhS2gzrMQk77BFSH4VPa3mINqk28UFfWNnqZGpfjj ngLAnTq6tkw7laijhmWMWRETrJszMq3ozFzuGZB+J/0ulXNlOzWMW/+cgCJ2QbjqGUtq UrleP+d6irxpGrZDZFTJGsns+z+kWd5WvUuW6jliCX45Iu8nTzDjewgIGwME83iM4s0a eccXvcNYgrSjiN+3FvypJWGNc4mRAanHdIUMRGLOi1LEnUuPj5PwuagKY/CE8Zog6J1d 7W/g== X-Gm-Message-State: AOJu0YzG3bjRfuZTET3SMI1bb+/ab5JLRjWdEsrnQTWEAjYRWuq+5NQD Cmjsbd/oShrIxUs0vaM4NSNBPZ2edjC4ckt21dYloCRfLa0Zmz3NZXYcxAhzKkoNR0v8wJwrTXI = X-Google-Smtp-Source: AGHT+IG8Kd2PCiOfCuYcQSZZv4vbMZ11cB15Vz0uNMp7sIiPbstNdmqih9l8A3cISPQr6ZXTK0Z3tg== X-Received: by 2002:a05:6a20:1581:b0:1a7:4b3f:a66c with SMTP id h1-20020a056a20158100b001a74b3fa66cmr3384371pzj.49.1714578209974; Wed, 01 May 2024 08:43:29 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:e886:8de:19a2:55b0]) by smtp.gmail.com with ESMTPSA id fb12-20020a056a002d8c00b006f3ec69bc09sm7717924pfb.75.2024.05.01.08.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:43:29 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Linus Walleij , Jani Nikula , Dmitry Baryshkov , Cong Yang , Hsin-Yi Wang , Brian Norris , Sam Ravnborg , Neil Armstrong , Javier Martinez Canillas , Joel Selvaraj , lvzhaoxiong@huaqin.corp-partner.google.com, Douglas Anderson , Daniel Vetter , David Airlie , Jonathan Corbet , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/9] drm/mipi-dsi: Introduce mipi_dsi_*_write_seq_multi() Date: Wed, 1 May 2024 08:41:08 -0700 Message-ID: <20240501084109.v3.5.Ie94246c30fe95101e0e26dd5f96e976dbeb8f242@changeid> X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog In-Reply-To: <20240501154251.3302887-1-dianders@chromium.org> References: <20240501154251.3302887-1-dianders@chromium.org> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current mipi_dsi_*_write_seq() macros are non-intutitive because they contain a hidden "return" statement that will return out of the _caller_ of the macro. Let's mark them as deprecated and instead introduce some new macros that are more intuitive. These new macros are less optimal when an error occurs but should behave more optimally when there is no error. Specifically these new macros cause smaller code to get generated and the code size savings (less to fetch from RAM, less cache space used, less RAM used) are important. Since the error case isn't something we need to optimize for and these new macros are easier to understand and more flexible, they should be used. After converting to use these new functions, one example shows some nice savings while also being easier to understand. $ scripts/bloat-o-meter \ ...after/panel-novatek-nt36672e.ko \ ...ctx/panel-novatek-nt36672e.ko add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-988 (-988) Function old new delta nt36672e_1080x2408_60hz_init 6236 5248 -988 Total: Before=10651, After=9663, chg -9.28% Signed-off-by: Douglas Anderson Reviewed-by: Neil Armstrong Reviewed-by: Linus Walleij --- Right now this patch introduces two new functions in drm_mipi_dsi.c. Alternatively we could have changed the prototype of the "chatty" functions and made the deprecated macros adapt to the new prototype. While this sounds nice, it bloated callers of the deprecated functioin a bit because it caused the compiler to emit less optimal code. It doesn't seem terrible to add two more functions, so I went that way. There may be cases where callers who aren't writing many sequences prefer to use the "chatty" versions anyway. Changes in v3: - Add a TODO item for cleaning up the deprecated macros/functions. - Inline kerneldoc comments for struct mipi_dsi_multi_context. Changes in v2: - New Documentation/gpu/todo.rst | 18 ++++++++++ drivers/gpu/drm/drm_mipi_dsi.c | 56 ++++++++++++++++++++++++++++++ include/drm/drm_mipi_dsi.h | 62 ++++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index fb9ad120b141..45a59c176b06 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -507,6 +507,24 @@ Contact: Douglas Anderson Level: Starter/Intermediate +Transition away from using mipi_dsi_*_write_seq() +------------------------------------------------- + +The macros mipi_dsi_generic_write_seq() and mipi_dsi_dcs_write_seq() are +non-intuitive because, if there are errors, they return out of the *caller's* +function. We should move all callers to use mipi_dsi_generic_write_seq_multi() +and mipi_dsi_dcs_write_seq_multi() macros instead. + +Once all callers are transitioned, the macros and the functions that they call, +mipi_dsi_generic_write_chatty() and mipi_dsi_dcs_write_buffer_chatty(), can +probably be removed. Alternatively, if people feel like the _multi() variants +are overkill for some use cases, we could keep the mipi_dsi_*_write_seq() +variants but change them not to return out of the caller. + +Contact: Douglas Anderson + +Level: Starter + Core refactorings ================= diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 8593d9ed5891..d2957cb692d3 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -792,6 +792,34 @@ int mipi_dsi_generic_write_chatty(struct mipi_dsi_device *dsi, } EXPORT_SYMBOL(mipi_dsi_generic_write_chatty); +/** + * mipi_dsi_generic_write_multi() - mipi_dsi_generic_write_chatty() w/ accum_err + * @ctx: Context for multiple DSI transactions + * @payload: buffer containing the payload + * @size: size of payload buffer + * + * Like mipi_dsi_generic_write_chatty() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_generic_write_multi(struct mipi_dsi_multi_context *ctx, + const void *payload, size_t size) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_generic_write(dsi, payload, size); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending generic data %*ph failed: %d\n", + (int)size, payload, ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_generic_write_multi); + /** * mipi_dsi_generic_read() - receive data using a generic read packet * @dsi: DSI peripheral device @@ -908,6 +936,34 @@ int mipi_dsi_dcs_write_buffer_chatty(struct mipi_dsi_device *dsi, } EXPORT_SYMBOL(mipi_dsi_dcs_write_buffer_chatty); +/** + * mipi_dsi_dcs_write_buffer_multi - mipi_dsi_dcs_write_buffer_chatty() w/ accum_err + * @ctx: Context for multiple DSI transactions + * @data: buffer containing data to be transmitted + * @len: size of transmission buffer + * + * Like mipi_dsi_dcs_write_buffer_chatty() but deals with errors in a way that + * makes it convenient to make several calls in a row. + */ +void mipi_dsi_dcs_write_buffer_multi(struct mipi_dsi_multi_context *ctx, + const void *data, size_t len) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + ssize_t ret; + + if (ctx->accum_err) + return; + + ret = mipi_dsi_dcs_write_buffer(dsi, data, len); + if (ret < 0) { + ctx->accum_err = ret; + dev_err(dev, "sending dcs data %*ph failed: %d\n", + (int)len, data, ctx->accum_err); + } +} +EXPORT_SYMBOL(mipi_dsi_dcs_write_buffer_multi); + /** * mipi_dsi_dcs_write() - send DCS write command * @dsi: DSI peripheral device diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 6d68d9927f46..5e9cad541bd6 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -197,6 +197,27 @@ struct mipi_dsi_device { struct drm_dsc_config *dsc; }; +/** + * struct mipi_dsi_multi_context - Context to call multiple MIPI DSI funcs in a row + */ +struct mipi_dsi_multi_context { + /** + * @dsi: Pointer to the MIPI DSI device + */ + struct mipi_dsi_device *dsi; + + /** + * @accum_err: Storage for the accumulated error over the multiple calls + * + * Init to 0. If a function encounters an error then the error code + * will be stored here. If you call a function and this points to a + * non-zero value then the function will be a noop. This allows calling + * a function many times in a row and just checking the error at the + * end to see if any of them failed. + */ + int accum_err; +}; + #define MIPI_DSI_MODULE_PREFIX "mipi-dsi:" #define to_mipi_dsi_device(__dev) container_of_const(__dev, struct mipi_dsi_device, dev) @@ -258,6 +279,8 @@ ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload, size_t size); int mipi_dsi_generic_write_chatty(struct mipi_dsi_device *dsi, const void *payload, size_t size); +void mipi_dsi_generic_write_multi(struct mipi_dsi_multi_context *ctx, + const void *payload, size_t size); ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, size_t num_params, void *data, size_t size); @@ -283,6 +306,8 @@ ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi, const void *data, size_t len); int mipi_dsi_dcs_write_buffer_chatty(struct mipi_dsi_device *dsi, const void *data, size_t len); +void mipi_dsi_dcs_write_buffer_multi(struct mipi_dsi_multi_context *ctx, + const void *data, size_t len); ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd, const void *data, size_t len); ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, @@ -319,6 +344,9 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, * This macro will print errors for you and will RETURN FROM THE CALLING * FUNCTION (yes this is non-intuitive) upon error. * + * Because of the non-intuitive return behavior, THIS MACRO IS DEPRECATED. + * Please replace calls of it with mipi_dsi_generic_write_seq_multi(). + * * @dsi: DSI peripheral device * @seq: buffer containing the payload */ @@ -331,12 +359,30 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, return ret; \ } while (0) +/** + * mipi_dsi_generic_write_seq_multi - transmit data using a generic write packet + * + * This macro will print errors for you and error handling is optimized for + * callers that call this multiple times in a row. + * + * @ctx: Context for multiple DSI transactions + * @seq: buffer containing the payload + */ +#define mipi_dsi_generic_write_seq_multi(ctx, seq...) \ + do { \ + static const u8 d[] = { seq }; \ + mipi_dsi_generic_write_multi(ctx, d, ARRAY_SIZE(d)); \ + } while (0) + /** * mipi_dsi_dcs_write_seq - transmit a DCS command with payload * * This macro will print errors for you and will RETURN FROM THE CALLING * FUNCTION (yes this is non-intuitive) upon error. * + * Because of the non-intuitive return behavior, THIS MACRO IS DEPRECATED. + * Please replace calls of it with mipi_dsi_dcs_write_seq_multi(). + * * @dsi: DSI peripheral device * @cmd: Command * @seq: buffer containing data to be transmitted @@ -350,6 +396,22 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi, return ret; \ } while (0) +/** + * mipi_dsi_dcs_write_seq_multi - transmit a DCS command with payload + * + * This macro will print errors for you and error handling is optimized for + * callers that call this multiple times in a row. + * + * @ctx: Context for multiple DSI transactions + * @cmd: Command + * @seq: buffer containing data to be transmitted + */ +#define mipi_dsi_dcs_write_seq_multi(ctx, cmd, seq...) \ + do { \ + static const u8 d[] = { cmd, seq }; \ + mipi_dsi_dcs_write_buffer_multi(ctx, d, ARRAY_SIZE(d)); \ + } while (0) + /** * struct mipi_dsi_driver - DSI driver * @driver: device driver model driver From patchwork Wed May 1 15:41:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13650965 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 0226EC4345F for ; Wed, 1 May 2024 15:43:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2949111232F; Wed, 1 May 2024 15:43:36 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Ig0wENJR"; dkim-atps=neutral Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4986611232F for ; Wed, 1 May 2024 15:43:34 +0000 (UTC) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6eff2be3b33so6353823b3a.2 for ; Wed, 01 May 2024 08:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714578213; x=1715183013; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HNTOcUEwWeSo/t1Vf3i4ZlvXOdvImzkf0C+r8rb9unM=; b=Ig0wENJRMCfmPpPAbyCwhEo48B3ysPO5BScHVd1wD6Zd8FDpjpZXEQplPcWV7prf2t gvcfyF1ZmhSqtSh+U9QW731A3pGv9m2F4+oijYSCJDOmJiM1Cwq5tduqB8vkatyrJl/I 4QkZcAplrbFzZ4bQ6h7pmSE0w9MIG2PUia/aM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714578213; x=1715183013; 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=HNTOcUEwWeSo/t1Vf3i4ZlvXOdvImzkf0C+r8rb9unM=; b=W6FDsDR2MKIA8yu2AYEAHMoo9+V0pLLrJ1Lcw8NzCdNSiQ4l4p7101hFQyug0dbeon /8sHSoNPZnG+Ff3XmWwLz6auSZd3OAtSnbPCNFsLgi5stRyKD5Y5rr6SXhfZGNhkR8zq tn5PPsgSXGnKHwQwheUibGsfDsBJH6fyRXS5+qY2EPEtGWZLicFa+Y5aTpp2aLZ4T5Ng h3+YNUUvevu1SKdJAFKIHsdYLxUKfWcKa1zbyiKOQuclf9ZfiE/nEJq4VhF7OVKcMQsA KuvCEhOdssHFCFXe0ZXDH7e+l5ldi1bSvOuFbdeCT8nolzRchGLO6ddw4q8kGX4jDMCo xgsQ== X-Gm-Message-State: AOJu0YyHqjbJwWXKJq/q7bhaUAzLCxR4ptJCtHcDAVwnWChm6MsS4E72 NF9jm/SXGXc4WUveLEue4D+lInBLlpkTyX4AgQ8LDL/TLp0LUp1ajxexCB9JUy0aHzj+4/PpUP0 = X-Google-Smtp-Source: AGHT+IEMWtYqzHW0IpxQIoacwb+/9u8nBpNOONz4dbRi3k16mh+dAjyFbRCl/ETBhxytGh8fI8hxfw== X-Received: by 2002:a05:6a20:4caa:b0:1a3:c3a9:53b7 with SMTP id fq42-20020a056a204caa00b001a3c3a953b7mr2648875pzb.55.1714578212735; Wed, 01 May 2024 08:43:32 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:e886:8de:19a2:55b0]) by smtp.gmail.com with ESMTPSA id fb12-20020a056a002d8c00b006f3ec69bc09sm7717924pfb.75.2024.05.01.08.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:43:32 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Linus Walleij , Jani Nikula , Dmitry Baryshkov , Cong Yang , Hsin-Yi Wang , Brian Norris , Sam Ravnborg , Neil Armstrong , Javier Martinez Canillas , Joel Selvaraj , lvzhaoxiong@huaqin.corp-partner.google.com, Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 6/9] drm/panel: novatek-nt36672e: Switch to mipi_dsi_dcs_write_seq_multi() Date: Wed, 1 May 2024 08:41:09 -0700 Message-ID: <20240501084109.v3.6.I3c08a7d02c467d2bc88da14e513ea4c8649fce45@changeid> X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog In-Reply-To: <20240501154251.3302887-1-dianders@chromium.org> References: <20240501154251.3302887-1-dianders@chromium.org> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This is a mechanical conversion of the novatek-nt36672e driver to use the new mipi_dsi_dcs_write_seq_multi(). The new function is easier for clients to understand and using it also causes smaller code to be generated. Specifically: $ scripts/bloat-o-meter \ ...after/panel-novatek-nt36672e.ko \ ...ctx/panel-novatek-nt36672e.ko add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-988 (-988) Function old new delta nt36672e_1080x2408_60hz_init 6236 5248 -988 Total: Before=10651, After=9663, chg -9.28% Signed-off-by: Douglas Anderson --- This change is only compile tested. I don't use this panel myself but arbitrarily picked it as an example to look at when working on the MIPI DSI macros. Changes in v3: - Fix spacing of init function. Changes in v2: - New .../gpu/drm/panel/panel-novatek-nt36672e.c | 576 +++++++++--------- 1 file changed, 289 insertions(+), 287 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c index 20b7bfe4aa12..9ce8df455232 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c @@ -51,293 +51,295 @@ static inline struct nt36672e_panel *to_nt36672e_panel(struct drm_panel *panel) static int nt36672e_1080x2408_60hz_init(struct mipi_dsi_device *dsi) { - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x10); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xc0, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x89, 0x28, 0x00, 0x08, 0x00, 0xaa, 0x02, - 0x0e, 0x00, 0x2b, 0x00, 0x07, 0x0d, 0xb7, 0x0c, 0xb7); - - mipi_dsi_dcs_write_seq(dsi, 0xc2, 0x1b, 0xa0); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x20); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x01, 0x66); - mipi_dsi_dcs_write_seq(dsi, 0x06, 0x40); - mipi_dsi_dcs_write_seq(dsi, 0x07, 0x38); - mipi_dsi_dcs_write_seq(dsi, 0x2f, 0x83); - mipi_dsi_dcs_write_seq(dsi, 0x69, 0x91); - mipi_dsi_dcs_write_seq(dsi, 0x95, 0xd1); - mipi_dsi_dcs_write_seq(dsi, 0x96, 0xd1); - mipi_dsi_dcs_write_seq(dsi, 0xf2, 0x64); - mipi_dsi_dcs_write_seq(dsi, 0xf3, 0x54); - mipi_dsi_dcs_write_seq(dsi, 0xf4, 0x64); - mipi_dsi_dcs_write_seq(dsi, 0xf5, 0x54); - mipi_dsi_dcs_write_seq(dsi, 0xf6, 0x64); - mipi_dsi_dcs_write_seq(dsi, 0xf7, 0x54); - mipi_dsi_dcs_write_seq(dsi, 0xf8, 0x64); - mipi_dsi_dcs_write_seq(dsi, 0xf9, 0x54); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x24); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x01, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0x03, 0x0c); - mipi_dsi_dcs_write_seq(dsi, 0x05, 0x1d); - mipi_dsi_dcs_write_seq(dsi, 0x08, 0x2f); - mipi_dsi_dcs_write_seq(dsi, 0x09, 0x2e); - mipi_dsi_dcs_write_seq(dsi, 0x0a, 0x2d); - mipi_dsi_dcs_write_seq(dsi, 0x0b, 0x2c); - mipi_dsi_dcs_write_seq(dsi, 0x11, 0x17); - mipi_dsi_dcs_write_seq(dsi, 0x12, 0x13); - mipi_dsi_dcs_write_seq(dsi, 0x13, 0x15); - mipi_dsi_dcs_write_seq(dsi, 0x15, 0x14); - mipi_dsi_dcs_write_seq(dsi, 0x16, 0x16); - mipi_dsi_dcs_write_seq(dsi, 0x17, 0x18); - mipi_dsi_dcs_write_seq(dsi, 0x1b, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x1d, 0x1d); - mipi_dsi_dcs_write_seq(dsi, 0x20, 0x2f); - mipi_dsi_dcs_write_seq(dsi, 0x21, 0x2e); - mipi_dsi_dcs_write_seq(dsi, 0x22, 0x2d); - mipi_dsi_dcs_write_seq(dsi, 0x23, 0x2c); - mipi_dsi_dcs_write_seq(dsi, 0x29, 0x17); - mipi_dsi_dcs_write_seq(dsi, 0x2a, 0x13); - mipi_dsi_dcs_write_seq(dsi, 0x2b, 0x15); - mipi_dsi_dcs_write_seq(dsi, 0x2f, 0x14); - mipi_dsi_dcs_write_seq(dsi, 0x30, 0x16); - mipi_dsi_dcs_write_seq(dsi, 0x31, 0x18); - mipi_dsi_dcs_write_seq(dsi, 0x32, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x34, 0x10); - mipi_dsi_dcs_write_seq(dsi, 0x35, 0x1f); - mipi_dsi_dcs_write_seq(dsi, 0x36, 0x1f); - mipi_dsi_dcs_write_seq(dsi, 0x4d, 0x14); - mipi_dsi_dcs_write_seq(dsi, 0x4e, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0x4f, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0x53, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0x71, 0x30); - mipi_dsi_dcs_write_seq(dsi, 0x79, 0x11); - mipi_dsi_dcs_write_seq(dsi, 0x7a, 0x82); - mipi_dsi_dcs_write_seq(dsi, 0x7b, 0x8f); - mipi_dsi_dcs_write_seq(dsi, 0x7d, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x80, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x81, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x82, 0x13); - mipi_dsi_dcs_write_seq(dsi, 0x84, 0x31); - mipi_dsi_dcs_write_seq(dsi, 0x85, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x86, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x87, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x90, 0x13); - mipi_dsi_dcs_write_seq(dsi, 0x92, 0x31); - mipi_dsi_dcs_write_seq(dsi, 0x93, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x94, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x95, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x9c, 0xf4); - mipi_dsi_dcs_write_seq(dsi, 0x9d, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0xa0, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0xa2, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0xa3, 0x02); - mipi_dsi_dcs_write_seq(dsi, 0xa4, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0xa5, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0xc6, 0xc0); - mipi_dsi_dcs_write_seq(dsi, 0xc9, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xd9, 0x80); - mipi_dsi_dcs_write_seq(dsi, 0xe9, 0x02); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x25); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x18, 0x22); - mipi_dsi_dcs_write_seq(dsi, 0x19, 0xe4); - mipi_dsi_dcs_write_seq(dsi, 0x21, 0x40); - mipi_dsi_dcs_write_seq(dsi, 0x66, 0xd8); - mipi_dsi_dcs_write_seq(dsi, 0x68, 0x50); - mipi_dsi_dcs_write_seq(dsi, 0x69, 0x10); - mipi_dsi_dcs_write_seq(dsi, 0x6b, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x6d, 0x0d); - mipi_dsi_dcs_write_seq(dsi, 0x6e, 0x48); - mipi_dsi_dcs_write_seq(dsi, 0x72, 0x41); - mipi_dsi_dcs_write_seq(dsi, 0x73, 0x4a); - mipi_dsi_dcs_write_seq(dsi, 0x74, 0xd0); - mipi_dsi_dcs_write_seq(dsi, 0x77, 0x62); - mipi_dsi_dcs_write_seq(dsi, 0x79, 0x7e); - mipi_dsi_dcs_write_seq(dsi, 0x7d, 0x03); - mipi_dsi_dcs_write_seq(dsi, 0x7e, 0x15); - mipi_dsi_dcs_write_seq(dsi, 0x7f, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x84, 0x4d); - mipi_dsi_dcs_write_seq(dsi, 0xcf, 0x80); - mipi_dsi_dcs_write_seq(dsi, 0xd6, 0x80); - mipi_dsi_dcs_write_seq(dsi, 0xd7, 0x80); - mipi_dsi_dcs_write_seq(dsi, 0xef, 0x20); - mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x84); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x26); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x81, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0x83, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x84, 0x03); - mipi_dsi_dcs_write_seq(dsi, 0x85, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x86, 0x03); - mipi_dsi_dcs_write_seq(dsi, 0x87, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x88, 0x05); - mipi_dsi_dcs_write_seq(dsi, 0x8a, 0x1a); - mipi_dsi_dcs_write_seq(dsi, 0x8b, 0x11); - mipi_dsi_dcs_write_seq(dsi, 0x8c, 0x24); - mipi_dsi_dcs_write_seq(dsi, 0x8e, 0x42); - mipi_dsi_dcs_write_seq(dsi, 0x8f, 0x11); - mipi_dsi_dcs_write_seq(dsi, 0x90, 0x11); - mipi_dsi_dcs_write_seq(dsi, 0x91, 0x11); - mipi_dsi_dcs_write_seq(dsi, 0x9a, 0x80); - mipi_dsi_dcs_write_seq(dsi, 0x9b, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x9c, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x9d, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x9e, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x27); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x01, 0x68); - mipi_dsi_dcs_write_seq(dsi, 0x20, 0x81); - mipi_dsi_dcs_write_seq(dsi, 0x21, 0x6a); - mipi_dsi_dcs_write_seq(dsi, 0x25, 0x81); - mipi_dsi_dcs_write_seq(dsi, 0x26, 0x94); - mipi_dsi_dcs_write_seq(dsi, 0x6e, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x6f, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x70, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x71, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x72, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x75, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x76, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x77, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x7d, 0x09); - mipi_dsi_dcs_write_seq(dsi, 0x7e, 0x67); - mipi_dsi_dcs_write_seq(dsi, 0x80, 0x23); - mipi_dsi_dcs_write_seq(dsi, 0x82, 0x09); - mipi_dsi_dcs_write_seq(dsi, 0x83, 0x67); - mipi_dsi_dcs_write_seq(dsi, 0x88, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x89, 0x10); - mipi_dsi_dcs_write_seq(dsi, 0xa5, 0x10); - mipi_dsi_dcs_write_seq(dsi, 0xa6, 0x23); - mipi_dsi_dcs_write_seq(dsi, 0xa7, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x40); - mipi_dsi_dcs_write_seq(dsi, 0xe5, 0x02); - mipi_dsi_dcs_write_seq(dsi, 0xe6, 0xd3); - mipi_dsi_dcs_write_seq(dsi, 0xeb, 0x03); - mipi_dsi_dcs_write_seq(dsi, 0xec, 0x28); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x2a); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x00, 0x91); - mipi_dsi_dcs_write_seq(dsi, 0x03, 0x20); - mipi_dsi_dcs_write_seq(dsi, 0x07, 0x50); - mipi_dsi_dcs_write_seq(dsi, 0x0a, 0x70); - mipi_dsi_dcs_write_seq(dsi, 0x0c, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x0d, 0x40); - mipi_dsi_dcs_write_seq(dsi, 0x0f, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x11, 0xe0); - mipi_dsi_dcs_write_seq(dsi, 0x15, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0x16, 0xa4); - mipi_dsi_dcs_write_seq(dsi, 0x19, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0x1a, 0x78); - mipi_dsi_dcs_write_seq(dsi, 0x1b, 0x23); - mipi_dsi_dcs_write_seq(dsi, 0x1d, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0x1e, 0x3e); - mipi_dsi_dcs_write_seq(dsi, 0x1f, 0x3e); - mipi_dsi_dcs_write_seq(dsi, 0x20, 0x3e); - mipi_dsi_dcs_write_seq(dsi, 0x28, 0xfd); - mipi_dsi_dcs_write_seq(dsi, 0x29, 0x12); - mipi_dsi_dcs_write_seq(dsi, 0x2a, 0xe1); - mipi_dsi_dcs_write_seq(dsi, 0x2d, 0x0a); - mipi_dsi_dcs_write_seq(dsi, 0x30, 0x49); - mipi_dsi_dcs_write_seq(dsi, 0x33, 0x96); - mipi_dsi_dcs_write_seq(dsi, 0x34, 0xff); - mipi_dsi_dcs_write_seq(dsi, 0x35, 0x40); - mipi_dsi_dcs_write_seq(dsi, 0x36, 0xde); - mipi_dsi_dcs_write_seq(dsi, 0x37, 0xf9); - mipi_dsi_dcs_write_seq(dsi, 0x38, 0x45); - mipi_dsi_dcs_write_seq(dsi, 0x39, 0xd9); - mipi_dsi_dcs_write_seq(dsi, 0x3a, 0x49); - mipi_dsi_dcs_write_seq(dsi, 0x4a, 0xf0); - mipi_dsi_dcs_write_seq(dsi, 0x7a, 0x09); - mipi_dsi_dcs_write_seq(dsi, 0x7b, 0x40); - mipi_dsi_dcs_write_seq(dsi, 0x7f, 0xf0); - mipi_dsi_dcs_write_seq(dsi, 0x83, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0x84, 0xa4); - mipi_dsi_dcs_write_seq(dsi, 0x87, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0x88, 0x78); - mipi_dsi_dcs_write_seq(dsi, 0x89, 0x23); - mipi_dsi_dcs_write_seq(dsi, 0x8b, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0x8c, 0x7d); - mipi_dsi_dcs_write_seq(dsi, 0x8d, 0x7d); - mipi_dsi_dcs_write_seq(dsi, 0x8e, 0x7d); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x20); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x00, 0x00, 0x00, 0x17, 0x00, 0x49, 0x00, - 0x6a, 0x00, 0x89, 0x00, 0x9f, 0x00, 0xb6, 0x00, 0xc8); - mipi_dsi_dcs_write_seq(dsi, 0xb1, 0x00, 0xd9, 0x01, 0x10, 0x01, 0x3a, 0x01, - 0x7a, 0x01, 0xa9, 0x01, 0xf2, 0x02, 0x2d, 0x02, 0x2e); - mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x02, 0x64, 0x02, 0xa3, 0x02, 0xca, 0x03, - 0x00, 0x03, 0x1e, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); - mipi_dsi_dcs_write_seq(dsi, 0xb3, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, - 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xb4, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, - 0x71, 0x00, 0x90, 0x00, 0xa7, 0x00, 0xbf, 0x00, 0xd1); - mipi_dsi_dcs_write_seq(dsi, 0xb5, 0x00, 0xe2, 0x01, 0x1a, 0x01, 0x43, 0x01, - 0x83, 0x01, 0xb2, 0x01, 0xfa, 0x02, 0x34, 0x02, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x02, 0x6b, 0x02, 0xa8, 0x02, 0xd0, 0x03, - 0x03, 0x03, 0x21, 0x03, 0x4d, 0x03, 0x5b, 0x03, 0x6b); - mipi_dsi_dcs_write_seq(dsi, 0xb7, 0x03, 0x7e, 0x03, 0x94, 0x03, 0xac, 0x03, - 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, - 0x72, 0x00, 0x92, 0x00, 0xa8, 0x00, 0xbf, 0x00, 0xd1); - mipi_dsi_dcs_write_seq(dsi, 0xb9, 0x00, 0xe2, 0x01, 0x18, 0x01, 0x42, 0x01, - 0x81, 0x01, 0xaf, 0x01, 0xf5, 0x02, 0x2f, 0x02, 0x31); - mipi_dsi_dcs_write_seq(dsi, 0xba, 0x02, 0x68, 0x02, 0xa6, 0x02, 0xcd, 0x03, - 0x01, 0x03, 0x1f, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); - mipi_dsi_dcs_write_seq(dsi, 0xbb, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, - 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x21); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x00, 0x00, 0x00, 0x17, 0x00, 0x49, 0x00, - 0x6a, 0x00, 0x89, 0x00, 0x9f, 0x00, 0xb6, 0x00, 0xc8); - mipi_dsi_dcs_write_seq(dsi, 0xb1, 0x00, 0xd9, 0x01, 0x10, 0x01, 0x3a, 0x01, - 0x7a, 0x01, 0xa9, 0x01, 0xf2, 0x02, 0x2d, 0x02, 0x2e); - mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x02, 0x64, 0x02, 0xa3, 0x02, 0xca, 0x03, - 0x00, 0x03, 0x1e, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); - mipi_dsi_dcs_write_seq(dsi, 0xb3, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, - 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xb4, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, - 0x71, 0x00, 0x90, 0x00, 0xa7, 0x00, 0xbf, 0x00, 0xd1); - mipi_dsi_dcs_write_seq(dsi, 0xb5, 0x00, 0xe2, 0x01, 0x1a, 0x01, 0x43, 0x01, - 0x83, 0x01, 0xb2, 0x01, 0xfa, 0x02, 0x34, 0x02, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x02, 0x6b, 0x02, 0xa8, 0x02, 0xd0, 0x03, - 0x03, 0x03, 0x21, 0x03, 0x4d, 0x03, 0x5b, 0x03, 0x6b); - mipi_dsi_dcs_write_seq(dsi, 0xb7, 0x03, 0x7e, 0x03, 0x94, 0x03, 0xac, 0x03, - 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, - 0x72, 0x00, 0x92, 0x00, 0xa8, 0x00, 0xbf, 0x00, 0xd1); - mipi_dsi_dcs_write_seq(dsi, 0xb9, 0x00, 0xe2, 0x01, 0x18, 0x01, 0x42, 0x01, - 0x81, 0x01, 0xaf, 0x01, 0xf5, 0x02, 0x2f, 0x02, 0x31); - mipi_dsi_dcs_write_seq(dsi, 0xba, 0x02, 0x68, 0x02, 0xa6, 0x02, 0xcd, 0x03, - 0x01, 0x03, 0x1f, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); - mipi_dsi_dcs_write_seq(dsi, 0xbb, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, - 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x2c); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x61, 0x1f); - mipi_dsi_dcs_write_seq(dsi, 0x62, 0x1f); - mipi_dsi_dcs_write_seq(dsi, 0x7e, 0x03); - mipi_dsi_dcs_write_seq(dsi, 0x6a, 0x14); - mipi_dsi_dcs_write_seq(dsi, 0x6b, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0x6c, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0x6d, 0x36); - mipi_dsi_dcs_write_seq(dsi, 0x53, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x54, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x55, 0x04); - mipi_dsi_dcs_write_seq(dsi, 0x56, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0x58, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0x59, 0x0f); - mipi_dsi_dcs_write_seq(dsi, 0xff, 0xf0); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x5a, 0x00); - - mipi_dsi_dcs_write_seq(dsi, 0xff, 0x10); - mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01); - mipi_dsi_dcs_write_seq(dsi, 0x51, 0xff); - mipi_dsi_dcs_write_seq(dsi, 0x53, 0x24); - mipi_dsi_dcs_write_seq(dsi, 0x55, 0x01); - - return 0; + struct mipi_dsi_multi_context ctx = { .dsi = dsi }; + + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc1, 0x89, 0x28, 0x00, 0x08, 0x00, 0xaa, 0x02, + 0x0e, 0x00, 0x2b, 0x00, 0x07, 0x0d, 0xb7, 0x0c, 0xb7); + + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc2, 0x1b, 0xa0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x01, 0x66); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x06, 0x40); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x38); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2f, 0x83); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x69, 0x91); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x95, 0xd1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x96, 0xd1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf2, 0x64); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf3, 0x54); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf4, 0x64); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf5, 0x54); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf6, 0x64); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf7, 0x54); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf8, 0x64); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf9, 0x54); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x24); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x01, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x03, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x05, 0x1d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x08, 0x2f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x09, 0x2e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0a, 0x2d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0b, 0x2c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x11, 0x17); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x12, 0x13); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x13, 0x15); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x15, 0x14); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x16, 0x16); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x17, 0x18); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1b, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1d, 0x1d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x2f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x2e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x22, 0x2d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x23, 0x2c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x29, 0x17); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2a, 0x13); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2b, 0x15); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2f, 0x14); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x30, 0x16); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x31, 0x18); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x32, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x34, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x35, 0x1f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x36, 0x1f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x4d, 0x14); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x4e, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x4f, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x71, 0x30); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x79, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7a, 0x82); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7b, 0x8f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7d, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x80, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x81, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x82, 0x13); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x84, 0x31); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x85, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x86, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x87, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x90, 0x13); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x92, 0x31); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x93, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x94, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x95, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x9c, 0xf4); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x9d, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xa0, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xa2, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xa3, 0x02); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xa4, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xa5, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc6, 0xc0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc9, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd9, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xe9, 0x02); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x25); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x18, 0x22); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x19, 0xe4); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x40); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x66, 0xd8); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x68, 0x50); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x69, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6b, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6d, 0x0d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6e, 0x48); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x72, 0x41); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x73, 0x4a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x74, 0xd0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x77, 0x62); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x79, 0x7e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7d, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7e, 0x15); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7f, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x84, 0x4d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xcf, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd6, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd7, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xef, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf0, 0x84); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x26); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x81, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x83, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x84, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x85, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x86, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x87, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x88, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8a, 0x1a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8b, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8c, 0x24); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8e, 0x42); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8f, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x90, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x91, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x9a, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x9b, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x9c, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x9d, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x9e, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x27); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x01, 0x68); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x81); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x6a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x25, 0x81); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x26, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6e, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6f, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x70, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x71, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x72, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x75, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x76, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x77, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7d, 0x09); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7e, 0x67); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x80, 0x23); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x82, 0x09); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x83, 0x67); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x88, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x89, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xa5, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xa6, 0x23); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xa7, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x40); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xe5, 0x02); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xe6, 0xd3); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xeb, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xec, 0x28); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x2a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x00, 0x91); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x03, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x50); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0a, 0x70); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0c, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0d, 0x40); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0f, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x11, 0xe0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x15, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x16, 0xa4); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x19, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1a, 0x78); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1b, 0x23); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1d, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1e, 0x3e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1f, 0x3e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x3e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x28, 0xfd); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x29, 0x12); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2a, 0xe1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2d, 0x0a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x30, 0x49); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x33, 0x96); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x34, 0xff); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x35, 0x40); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x36, 0xde); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x37, 0xf9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x38, 0x45); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x39, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3a, 0x49); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x4a, 0xf0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7a, 0x09); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7b, 0x40); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7f, 0xf0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x83, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x84, 0xa4); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x87, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x88, 0x78); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x89, 0x23); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8b, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8c, 0x7d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8d, 0x7d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x8e, 0x7d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00, 0x00, 0x00, 0x17, 0x00, 0x49, 0x00, + 0x6a, 0x00, 0x89, 0x00, 0x9f, 0x00, 0xb6, 0x00, 0xc8); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0xd9, 0x01, 0x10, 0x01, 0x3a, 0x01, + 0x7a, 0x01, 0xa9, 0x01, 0xf2, 0x02, 0x2d, 0x02, 0x2e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x02, 0x64, 0x02, 0xa3, 0x02, 0xca, 0x03, + 0x00, 0x03, 0x1e, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, + 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, + 0x71, 0x00, 0x90, 0x00, 0xa7, 0x00, 0xbf, 0x00, 0xd1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x00, 0xe2, 0x01, 0x1a, 0x01, 0x43, 0x01, + 0x83, 0x01, 0xb2, 0x01, 0xfa, 0x02, 0x34, 0x02, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x02, 0x6b, 0x02, 0xa8, 0x02, 0xd0, 0x03, + 0x03, 0x03, 0x21, 0x03, 0x4d, 0x03, 0x5b, 0x03, 0x6b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb7, 0x03, 0x7e, 0x03, 0x94, 0x03, 0xac, 0x03, + 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, + 0x72, 0x00, 0x92, 0x00, 0xa8, 0x00, 0xbf, 0x00, 0xd1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0x00, 0xe2, 0x01, 0x18, 0x01, 0x42, 0x01, + 0x81, 0x01, 0xaf, 0x01, 0xf5, 0x02, 0x2f, 0x02, 0x31); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02, 0x68, 0x02, 0xa6, 0x02, 0xcd, 0x03, + 0x01, 0x03, 0x1f, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, + 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x21); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00, 0x00, 0x00, 0x17, 0x00, 0x49, 0x00, + 0x6a, 0x00, 0x89, 0x00, 0x9f, 0x00, 0xb6, 0x00, 0xc8); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0xd9, 0x01, 0x10, 0x01, 0x3a, 0x01, + 0x7a, 0x01, 0xa9, 0x01, 0xf2, 0x02, 0x2d, 0x02, 0x2e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x02, 0x64, 0x02, 0xa3, 0x02, 0xca, 0x03, + 0x00, 0x03, 0x1e, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, + 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, + 0x71, 0x00, 0x90, 0x00, 0xa7, 0x00, 0xbf, 0x00, 0xd1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x00, 0xe2, 0x01, 0x1a, 0x01, 0x43, 0x01, + 0x83, 0x01, 0xb2, 0x01, 0xfa, 0x02, 0x34, 0x02, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x02, 0x6b, 0x02, 0xa8, 0x02, 0xd0, 0x03, + 0x03, 0x03, 0x21, 0x03, 0x4d, 0x03, 0x5b, 0x03, 0x6b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb7, 0x03, 0x7e, 0x03, 0x94, 0x03, 0xac, 0x03, + 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x51, 0x00, + 0x72, 0x00, 0x92, 0x00, 0xa8, 0x00, 0xbf, 0x00, 0xd1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0x00, 0xe2, 0x01, 0x18, 0x01, 0x42, 0x01, + 0x81, 0x01, 0xaf, 0x01, 0xf5, 0x02, 0x2f, 0x02, 0x31); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02, 0x68, 0x02, 0xa6, 0x02, 0xcd, 0x03, + 0x01, 0x03, 0x1f, 0x03, 0x4a, 0x03, 0x59, 0x03, 0x6a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x03, 0x7d, 0x03, 0x93, 0x03, 0xab, 0x03, + 0xc8, 0x03, 0xec, 0x03, 0xfe, 0x00, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x2c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x61, 0x1f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x62, 0x1f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x7e, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6a, 0x14); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6b, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6c, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x6d, 0x36); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x54, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x56, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x58, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x59, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0xf0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5a, 0x00); + + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x51, 0xff); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x24); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x01); + + return ctx.accum_err; } static int nt36672e_power_on(struct nt36672e_panel *ctx) From patchwork Wed May 1 15:41:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13650968 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 AB658C4345F for ; Wed, 1 May 2024 15:43:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A884D10F439; Wed, 1 May 2024 15:43:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Cs31/MSl"; dkim-atps=neutral Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 872B1112333 for ; Wed, 1 May 2024 15:43:38 +0000 (UTC) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6f26588dd5eso5846560b3a.0 for ; Wed, 01 May 2024 08:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714578217; x=1715183017; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pkwrBbfCjOsJ2BvUtkk0pGwMNhz7eA01MHph4bkgbvM=; b=Cs31/MSl3xagGBmlvYIP3nRivFY/tG5AZuSTwDsnYBntgnek0fR4Koq/5V4GWbh/Da DK7ch5CfmcOdmp3UhiRDqkz6/582JGiyySQHuOQGYBc3oYI7vkWzmU1lE4/KPkhAkXCR b9vc6o0bQwUWxLsieiYgwl2TYNgttcF7OgcUU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714578217; x=1715183017; 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=pkwrBbfCjOsJ2BvUtkk0pGwMNhz7eA01MHph4bkgbvM=; b=XPqDf0rkr28gfZCULIdv7prxLKz2My62s26ALlVWmxniCYOyyQaja8caOschsL+dKi J0vHoLx0CChf31GKOM79vtmL3LU1sfrOacXpThQz2fh/o3L5IO2JwPnJ3Mwup7CVqgCE qmclcZrLk9FI18gnngp+YH9HXt4O3jAnoJo2fr1x0QnGieHIMKbR/j+qh7BHYVFM8Oau ctGfu2MqPdXZqlYQamaKmKVJqth0Hi3/gB4NVcpdin0KbrgsvIEugHq7JKnkaIaC4ILj KBKPHO9AgI/z+U0WZceHXbAipPIHWFGBw5vWT2W9lRjX0EAJ8ifuQFuEt4ZcWxlWflMR Xo0A== X-Gm-Message-State: AOJu0YzkvZ0DrsYlaDw6IREIq12xK87GuE9Sx5+jYZwe/4aY1GmCVulL 3WmkZWf2QzE0NthtqMF2Ttky7WM6SopC0/2IluAriHZFBSe10wsOHWcItZih3sH7dyMHjx4SOUc = X-Google-Smtp-Source: AGHT+IE+cPAgO0n7Exj+VvhBDEtKKsPMuNMW75JMbnx9vpKOFii6L+/WmqUjuhC+NPnJKxrXWBYwCQ== X-Received: by 2002:a05:6a21:6d94:b0:1a7:7b92:e0ed with SMTP id wl20-20020a056a216d9400b001a77b92e0edmr2967637pzb.51.1714578215641; Wed, 01 May 2024 08:43:35 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:e886:8de:19a2:55b0]) by smtp.gmail.com with ESMTPSA id fb12-20020a056a002d8c00b006f3ec69bc09sm7717924pfb.75.2024.05.01.08.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:43:34 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Linus Walleij , Jani Nikula , Dmitry Baryshkov , Cong Yang , Hsin-Yi Wang , Brian Norris , Sam Ravnborg , Neil Armstrong , Javier Martinez Canillas , Joel Selvaraj , lvzhaoxiong@huaqin.corp-partner.google.com, Douglas Anderson , Daniel Vetter , David Airlie , Jessica Zhang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 7/9] drm/panel: boe-tv101wum-nl6: Don't use a table for initting panels Date: Wed, 1 May 2024 08:41:10 -0700 Message-ID: <20240501084109.v3.7.Ib5030ab5cd41b4e08b1958bd7e51571725723008@changeid> X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog In-Reply-To: <20240501154251.3302887-1-dianders@chromium.org> References: <20240501154251.3302887-1-dianders@chromium.org> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Consensus on the mailing lists is that panels shouldn't use a table of init commands but should instead use init functions. With the recently introduced mipi_dsi_dcs_write_seq_multi() this is not only clean/easy but also saves space. Measuring before/after this change: $ scripts/bloat-o-meter \ .../before/panel-boe-tv101wum-nl6.ko \ .../after/panel-boe-tv101wum-nl6.ko add/remove: 14/8 grow/shrink: 0/1 up/down: 27062/-31433 (-4371) Function old new delta inx_hj110iz_init - 7040 +7040 boe_tv110c9m_init - 6440 +6440 boe_init - 5916 +5916 starry_qfh032011_53g_init - 1944 +1944 starry_himax83102_j02_init - 1228 +1228 inx_hj110iz_init.d - 1040 +1040 boe_tv110c9m_init.d - 982 +982 auo_b101uan08_3_init - 944 +944 boe_init.d - 580 +580 starry_himax83102_j02_init.d - 512 +512 starry_qfh032011_53g_init.d - 180 +180 auo_kd101n80_45na_init - 172 +172 auo_b101uan08_3_init.d - 82 +82 auo_kd101n80_45na_init.d - 2 +2 auo_kd101n80_45na_init_cmd 144 - -144 boe_panel_prepare 592 440 -152 auo_b101uan08_3_init_cmd 1056 - -1056 starry_himax83102_j02_init_cmd 1392 - -1392 starry_qfh032011_53g_init_cmd 2256 - -2256 .compoundliteral 3393 - -3393 boe_init_cmd 7008 - -7008 boe_tv110c9m_init_cmd 7656 - -7656 inx_hj110iz_init_cmd 8376 - -8376 Total: Before=37297, After=32926, chg -11.72% Let's do the conversion. Since we're touching all the tables, let's also convert hex numbers to lower case as per kernel conventions. Signed-off-by: Douglas Anderson Reviewed-by: Linus Walleij --- Changes in v3: - Fix spacing of init function. - Remove an unneeded error print. - Squash boe-tv101wum-nl6 lowercase patch into main patch Changes in v2: - New .../gpu/drm/panel/panel-boe-tv101wum-nl6.c | 2792 +++++++++-------- 1 file changed, 1442 insertions(+), 1350 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index 0ffe8f8c01de..aab60cec0603 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -17,6 +17,8 @@ #include