From nobody Mon Oct 6 15:15:52 2025 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8FEE235BE1 for ; Sat, 19 Jul 2025 08:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752913626; cv=none; b=O0UR5M1KQQapTw4qgGbVF8lM6lc0KYFLCktrNlGjN2aP4iGLvzfzWJsqi9vQb0fIMiL8D6Xk3qjj+w6TMSnmtEWF4/TIwwTZnkvfANEPLOLG0wDb7597K4OtXmugwxhpA6Yahs7qUtCK/CQmjvoP6v3NpUNSPrcansJ7eD+ShWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752913626; c=relaxed/simple; bh=pmTES+4CkX/QOuHNX+Rkrb431Re78drHxNxUfxOx9dc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nqimf9ftVPU0S0P3tAG+b8afC14IEwtE1YajfFD6i4V8+vQ5O4VlXJ1WOKu9BqGczm7KmFiX0mf5Bk3dZ5Z6eVOlTn/CWPcnjyAsCpbwpQK0axlrKRLJFKytrfU+jQmy/ybcl9sCY7++02swRlOKuXOLYOP1WixUlfs6BfqRhVg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=brighamcampbell.com; spf=pass smtp.mailfrom=brighamcampbell.com; dkim=pass (2048-bit key) header.d=brighamcampbell.com header.i=@brighamcampbell.com header.b=ZGyXMDzt; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=brighamcampbell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=brighamcampbell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=brighamcampbell.com header.i=@brighamcampbell.com header.b="ZGyXMDzt" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-747c2cc3419so2330974b3a.2 for ; Sat, 19 Jul 2025 01:27:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brighamcampbell.com; s=google; t=1752913624; x=1753518424; darn=vger.kernel.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=2MI/yokjCP1HwI/RReXqohEWfCg7UzwzYJvm86YPBHo=; b=ZGyXMDztpMJQZ9vK3VwvhNqftnpmQViKc21f/KSgoLwWMJrI9n7Bnhd9lN0Ysqb1Dv Eq4muB4fSG7pT8s+Vgk1j2TcUksLmLtPv/VtVy6w/f7zqnhnWFkPJ3pW6vgzKU/GF2XF rRiBuoUT16JbvK/9SS6Lwf2izyhtuhytwJg+XS1Jt3nnIhkoMcagqxnd7rAMWXjX+FSq puDIdWxWvI60XkD6OPyjgvUzN2vDfOa64TEc7THTHAptINlQOcvhsDJjGCIoqzcq/hd9 bTFdfbK2jL03Cnx80jvOHsLNWvzMrWLHVMp6yxM+RoMkXiYaZmZWAULDuRpLtl40+OBf gVhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752913624; x=1753518424; 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=2MI/yokjCP1HwI/RReXqohEWfCg7UzwzYJvm86YPBHo=; b=gFxtS5L7ixr9sRDU9vCLrsnhzQZFF+S9jFK20y1aQu/rtesj8JUpUtcGghTYcSbD3F ShwmIhyRzdrUidFMB8QalgPHxn6xkJMaL6qGDrEhOcg94Psnpih841IDY5BC1eeJ4g1T 50p5To+jkxl2AEf081ASsJf34pSpLQvK0zGDfV6C+cVVaokGhF3Xe22ZIrvK4ucl/Gw0 iraOk0xoRjK6+r1mUjuyKyc1/FBkYfLwnlqfIx5x1Bq7y8kEhGN+89nvwQvRiDC60Jr5 Z4IlNk08KEcrBZXWQMA50ruOeJsXK2tuURirjxGm+tGbN2PG4y18tO5bHY9MiMJhfnM2 SWOg== X-Forwarded-Encrypted: i=1; AJvYcCUfQSV2k0nPuuA/W2thNzsmNxo/G2qxBm1qLj9W8M1P/ysPh2q9uevicIbrkveajhlQckhJ/e8KCcNXZJU=@vger.kernel.org X-Gm-Message-State: AOJu0YzPGVjDgzW42hPCJG3KaeHxn8xAvcUNwUfm8ZqcfAPfrtR/Vf18 aW9horpO8FMoY+FBNn3/+YiXIMyWqHqxEnwZmlMk7zEMf/jiGwkScF6NmH3Pr7/ZuPw= X-Gm-Gg: ASbGncuM0OPJeCDbepFHZ0W56AmN+khiYHSwTehakmSF31y1WIDYrQzHLptLr6x0Vs8 F1yVDNw/r5jy5Uxg7qc/mImrdVgmjNd5rnZpdPaYtDmWQ0dFQwp2ckga20nZEWazUkeKaIk56Im zcLTccIeR1HOdzdXZfSYg6X9FQLprHDroa2Dz0CFvoQmbAOsZWYmr9yjweGk112QpJpAZ01nnk6 9772DQ71xtU503gIllzOkRyrCJAOHj6DRzZ8KjVnPTU6WYwbRRr8ons71IDWPMdQgRbMpHUuJK9 luOBfJ9DUbHXtmerhXaHfBXw19SuH/YJ1PCazdQ8ZQmbgxXZXt02SZbwqk6sCvJL1LSg+R7Ov9z JxmdKDAt0dYtUeRXvWEwlOAu5LvQmD2jSMC7cL8kldTLi4dZyyg== X-Google-Smtp-Source: AGHT+IEookr+a3eTQEBmol8DGigr1hM4wxeOxAzpxnN5vNTt7ozZfZj7qFtqjv6WzZYiLjYmaNRGvg== X-Received: by 2002:a05:6a21:62c9:b0:238:3f54:78ea with SMTP id adf61e73a8af0-2391ca917fcmr7914227637.44.1752913624038; Sat, 19 Jul 2025 01:27:04 -0700 (PDT) Received: from mystery-machine.tail542cf.ts.net ([64.71.154.6]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-759cb157635sm2475260b3a.83.2025.07.19.01.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jul 2025 01:27:03 -0700 (PDT) From: Brigham Campbell To: dianders@chromium.org, tejasvipin76@gmail.com, diogo.ivo@tecnico.ulisboa.pt, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Brigham Campbell Subject: [PATCH v5 1/4] drm: Create mipi_dsi_dual* macros Date: Sat, 19 Jul 2025 02:26:35 -0600 Message-ID: <20250719082639.307545-2-me@brighamcampbell.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250719082639.307545-1-me@brighamcampbell.com> References: <20250719082639.307545-1-me@brighamcampbell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Create mipi_dsi_dual, mipi_dsi_dual_dcs_write_seq_multi, and mipi_dsi_dual_generic_write_seq_multi macros for panels which are driven by two parallel serial interfaces. This allows for the reduction of code duplication in drivers for these panels. Signed-off-by: Brigham Campbell Reviewed-by: Dmitry Baryshkov --- mipi_dsi_dual_dcs_write_seq_multi goes unused by jdi-lpm102a188a. It's included in this patch for completeness and in anticipation of its use in other drivers in the future. drivers/gpu/drm/drm_mipi_dsi.c | 48 ++++++++++++++++++ include/drm/drm_mipi_dsi.h | 89 ++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index a00d76443128..4a7ca1261105 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -827,6 +827,30 @@ void mipi_dsi_generic_write_multi(struct mipi_dsi_mult= i_context *ctx, } EXPORT_SYMBOL(mipi_dsi_generic_write_multi); =20 +/** + * mipi_dsi_dual_generic_write_multi() - mipi_dsi_generic_write_multi() for + * two dsi channels, one after the other + * @dsi1: First dsi channel to write buffer to + * @dsi2: Second dsi channel to write buffer to + * @ctx: Context for multiple DSI transactions + * @payload: Buffer containing the payload + * @size: Size of payload buffer + * + * A wrapper around mipi_dsi_generic_write_multi() that allows the user to + * conveniently write to two dsi channels, one after the other. + */ +void mpi_dsi_dual_generic_write_multi(struct mipi_dsi_device *dsi1, + struct mipi_dsi_device *dsi2, + struct mipi_dsi_multi_context *ctx, + const void *payload, size_t size) +{ + ctx->dsi =3D dsi1; + mipi_dsi_generic_write_multi(ctx, data, len); + ctx->dsi =3D dsi2; + mipi_dsi_generic_write_multi(ctx, data, len); +} +EXPORT_SYMBOL(mipi_dsi_dual_generic_write_multi); + /** * mipi_dsi_generic_read() - receive data using a generic read packet * @dsi: DSI peripheral device @@ -1006,6 +1030,30 @@ void mipi_dsi_dcs_write_buffer_multi(struct mipi_dsi= _multi_context *ctx, } EXPORT_SYMBOL(mipi_dsi_dcs_write_buffer_multi); =20 +/** + * mipi_dsi_dual_dcs_write_buffer_multi - mipi_dsi_dcs_write_buffer_multi(= ) for + * two dsi channels, one after the other + * @dsi1: First dsi channel to write buffer to + * @dsi2: Second dsi channel to write buffer to + * @ctx: Context for multiple DSI transactions + * @data: Buffer containing data to be transmitted + * @len: Size of transmission buffer + * + * A wrapper around mipi_dsi_dcs_write_buffer_multi() that allows the user= to + * conveniently write to two dsi channels, one after the other. + */ +void mipi_dsi_dual_dcs_write_buffer_multi(struct mipi_dsi_device *dsi1, + struct mipi_dsi_device *dsi2, + struct mipi_dsi_multi_context *ctx, + const void *data, size_t len) +{ + ctx->dsi =3D dsi1; + mipi_dsi_dcs_write_buffer_multi(ctx, data, len); + ctx->dsi =3D dsi2; + mipi_dsi_dcs_write_buffer_multi(ctx, data, len); +} +EXPORT_SYMBOL(mipi_dsi_dual_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 369b0d8830c3..ffdfcb57cbd4 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -289,6 +289,10 @@ int mipi_dsi_generic_write_chatty(struct mipi_dsi_devi= ce *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); +void mipi_dsi_dual_generic_write_multi(struct mipi_dsi_device *dsi1, + struct mipi_dsi_device *dsi2, + 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 *par= ams, size_t num_params, void *data, size_t size); u32 drm_mipi_dsi_get_input_bus_fmt(enum mipi_dsi_pixel_format dsi_format); @@ -329,6 +333,10 @@ int mipi_dsi_dcs_write_buffer_chatty(struct mipi_dsi_d= evice *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); +void mipi_dsi_dual_dcs_write_buffer_multi(struct mipi_dsi_device *dsi1, + struct mipi_dsi_device *dsi2, + 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, @@ -431,6 +439,87 @@ void mipi_dsi_dcs_set_tear_off_multi(struct mipi_dsi_m= ulti_context *ctx); mipi_dsi_dcs_write_buffer_multi(ctx, d, ARRAY_SIZE(d)); \ } while (0) =20 +/** + * mipi_dsi_dual - send the same MIPI DSI command to two interfaces + * + * This macro will send the specified MIPI DSI command twice, once per eac= h of + * the two interfaces supplied. This is useful for reducing duplication of= code + * in panel drivers which use two parallel serial interfaces. + * + * WARNING: This macro reuses the _func argument and the optional trailing + * arguments twice each, which may cause unintended side effects. For exam= ple, + * adding the postfix increment ++ operator to one of the arguments to be + * passed to _func will cause the variable to be incremented twice instead= of + * once and the variable will be its original value + 1 when sent to _dsi2. + * + * @_func: MIPI DSI function or macro to pass context and arguments into + * @_dsi1: First DSI interface to act as recipient of the MIPI DSI command + * @_dsi2: Second DSI interface to act as recipient of the MIPI DSI command + * @_ctx: Context for multiple DSI transactions + * @...: Arguments to pass to MIPI DSI function or macro + */ +#define mipi_dsi_dual(_func, _dsi1, _dsi2, _ctx, ...) \ + do { \ + struct mipi_dsi_multi_context *_ctxcpy =3D (_ctx); \ + (_ctxcpy)->dsi =3D (_dsi1); \ + (_func)((_ctxcpy), ##__VA_ARGS__); \ + (_ctxcpy)->dsi =3D (_dsi2); \ + (_func)((_ctxcpy), ##__VA_ARGS__); \ + } while (0) + +/** + * mipi_dsi_dual_generic_write_seq_multi - transmit data using a generic w= rite + * packet to two dsi interfaces, one after the other + * + * This macro will send the specified generic packet twice, once per each = of + * the two interfaces supplied. This is useful for reducing duplication of= code + * in panel drivers which use two parallel serial interfaces. + * + * Note that if an error occurs while transmitting the packet to the first= DSI + * interface, the packet will not be sent to the second DSI interface. + * + * This macro will print errors for you and error handling is optimized for + * callers that call this multiple times in a row. + * + * @_dsi1: First DSI interface to act as recipient of packet + * @_dsi2: Second DSI interface to act as recipient of packet + * @_ctx: Context for multiple DSI transactions + * @_seq: buffer containing the payload + */ +#define mipi_dsi_dual_generic_write_seq_multi(_dsi1, _dsi2, _ctx, _seq...)= \ + do { \ + static const u8 d[] =3D { _seq }; \ + mipi_dsi_dual_generic_write_multi(_dsi1, _dsi2, _ctx, d, \ + ARRAY_SIZE(d)); \ + } while (0) + +/** + * mipi_dsi_dual_dcs_write_seq_multi - transmit a DCS command with payload= to + * two dsi interfaces, one after the other + * + * This macro will send the specified DCS command with payload twice, once= per + * each of the two interfaces supplied. This is useful for reducing duplic= ation + * of code in panel drivers which use two parallel serial interfaces. + * + * Note that if an error occurs while transmitting the payload to the firs= t DSI + * interface, the payload will not be sent to the second DSI interface. + * + * This macro will print errors for you and error handling is optimized for + * callers that call this multiple times in a row. + * + * @_dsi1: First DSI interface to act as recipient of packet + * @_dsi2: Second DSI interface to act as recipient of packet + * @_ctx: Context for multiple DSI transactions + * @_cmd: Command + * @_seq: buffer containing the payload + */ +#define mipi_dsi_dual_dcs_write_seq_multi(_dsi1, _dsi2, _ctx, _cmd, _seq) = \ + do { \ + static const u8 d[] =3D { _cmd, _seq }; \ + mipi_dsi_dual_dcs_write_buffer_multi(_dsi1, _dsi2, _ctx, d, \ + ARRAY_SIZE(d)); \ + } while (0) + /** * struct mipi_dsi_driver - DSI driver * @driver: device driver model driver --=20 2.50.1 From nobody Mon Oct 6 15:15:52 2025 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E81192367D9 for ; Sat, 19 Jul 2025 08:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752913628; cv=none; b=JNezeXTQK7DcAWe8Pu4ipdKsj0DrAN/FvosNIHz57qfV7z7281/4Eg32kW6y61CLigFdJpZeWDMTMLt3gW9/9mFQYYEXDysUKmjwvEyumNvqHcHxLhJBFsv1MPClJ8MujZ5YYTGlrhb9Fli46nWmpsBCtAkbGJhMIG8HBQkS8yw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752913628; c=relaxed/simple; bh=hEUxj2idb7hiXYnoLISUQ6LiygwEV/cIZLteWEue9pg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nVTV4pA/gen0hKej6AcZZBp3JNh6K8GWfuK3cGkgN0Jvtv9h4j9JgyLU1At+7WucT5pJTSL2YtvteRdoWve7O0MztEC6LLP5hoiTgjGzgxzidP2rMTxeY7C+u7m1+eg86ukK9ZRodKqeufvThgIeteFvW7QJQhPUhg62WhU31xY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=brighamcampbell.com; spf=pass smtp.mailfrom=brighamcampbell.com; dkim=pass (2048-bit key) header.d=brighamcampbell.com header.i=@brighamcampbell.com header.b=Ih1cdxrr; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=brighamcampbell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=brighamcampbell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=brighamcampbell.com header.i=@brighamcampbell.com header.b="Ih1cdxrr" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-b2c4e46a89fso2119365a12.2 for ; Sat, 19 Jul 2025 01:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brighamcampbell.com; s=google; t=1752913626; x=1753518426; darn=vger.kernel.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=kUcB18wkzXWaipSAyhcb0vwOoxhZL3UK8zpTQMvqMYk=; b=Ih1cdxrrZIHKIc+Tbg79ICX/JALmpp6KJusu5ME0TSJHm1y0xK/A8ccteRI9K7Arn2 DjoH4jAeshw95EtTJpsSgjvSWB63Ae10CeiJYOTk84GViYJYsUVLcDiIA5jW3fAMYJgN HGR/eZdwjV7Mp2ePKyRoltC6AheD6Z8YfP0Y4VHBZVBUm6HgXf+1fGXcaI9xc+TBx2nI h353/4xNJl2EXpfH+AchaUucF9CB7axwAxDQfhGN78z8wabGA7z6DDzDoMLRJc5dGHBy NLsW2rg3I+hqOQimOwle/rHJzD+kLHV4JCh3r7tBfcjFTZBWpBVAXwa3lbjZSr1+nBxQ 1gbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752913626; x=1753518426; 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=kUcB18wkzXWaipSAyhcb0vwOoxhZL3UK8zpTQMvqMYk=; b=l9Z3WuYLSPJdzx9LW152T4rtdjAkiNNss8VBUlhNw4BxQGtjonCNEI89TGgagWukNC PrAPAUNKWT8ww1LPo/eTaGZTQtsJ/NlLae1OHL23jM8olrnBIC1VHfw3g0Gp0U2qTVgP zxUKK7iQflJA/Aa+0bsZFecsSim1mfifvTUWw3SmvSIpNog1D2j1Xu1RoX8WPsO5nF2a jGnJxM8bMdNyBFrnMReB1dZRrwpPRWYmy/Sd/Ppbd15RYjaaqbVIc6B3sUeDHVji8Qqf Pj8MfSaHPbYW3DhDxSpcva4z2tA5ZOcPMLv0KeYf4uf+jrij+IxjvbmR7qUZ5mMbT6SA hQxA== X-Forwarded-Encrypted: i=1; AJvYcCVVmyYgHk7qfc/Buiu3KqMtTnB2hPSSZCW+2dIFfS3AaHqfYLH1e4S/a5wHE+R0nnkZF+AL2R9ybiBwipE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxq1Ak44z9TWxJCWLDLMvDaxhFMxpzoP7cAoFzEGZ35Syv7HixG iuY2FmZEyfhRZ27yjxiIN98We5d9FUxizY+eGOdpHBElRhZiw8RQjB+JxXn8nUvtki8= X-Gm-Gg: ASbGnct+w5ar7emiKqUS2IHlDMciEYT6oWTABnoEdLU0HoxiBwndhEpIfo1j+UnyAC8 szJFcsb54EHRh5XHKMl6BKYPPNXXp+hsskjH7/EpXHl5aR0XTJPP7+xrWtJyk/oEbs8BuozhfuU tPXEUgjdGXJpmHvNm8zNf47HBON2N7YEoZ2Iaxs37jxvpr/5AKhUW9qsXhwHtLW/SU8j01nX5F6 3U/EX8vuIXS2OA3GuV/A2H3ZUVmALlE4YmFZzHUHO0AUt4+KM2hyVDS/kzq1fGRRPLR2zvfkIsa ZWVKmBY1mVTIt/Y8KmiEvv//MIFf2CbHAK9S3LDmjNYbOyvZzJu820okZ1EvsEM8dpsmMxZXa02 wj/Nf9B/KBw41Rw2Gck1JToCUUCpMh9vuxrTmP4qTVn0x49RHll2kHsjewg1c X-Google-Smtp-Source: AGHT+IFPkdczjlK6LPkmOOuAv9fB6yl68RLosEVxYgGWeJCmhuywE1ktO67Cl/QDs6XE7vA8gZzPUw== X-Received: by 2002:a05:6a21:6daa:b0:234:98ee:daae with SMTP id adf61e73a8af0-23812457aa5mr20792945637.21.1752913626173; Sat, 19 Jul 2025 01:27:06 -0700 (PDT) Received: from mystery-machine.tail542cf.ts.net ([64.71.154.6]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-759cb157635sm2475260b3a.83.2025.07.19.01.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jul 2025 01:27:05 -0700 (PDT) From: Brigham Campbell To: dianders@chromium.org, tejasvipin76@gmail.com, diogo.ivo@tecnico.ulisboa.pt, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong , Jessica Zhang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Brigham Campbell Subject: [PATCH v5 2/4] drm/panel: jdi-lpm102a188a: Fix bug and clean up driver Date: Sat, 19 Jul 2025 02:26:36 -0600 Message-ID: <20250719082639.307545-3-me@brighamcampbell.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250719082639.307545-1-me@brighamcampbell.com> References: <20250719082639.307545-1-me@brighamcampbell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fix bug in unprepare() which causes the function's return value to be that of the last mipi "enter sleep mode" command. Update driver to use the "multi" variant of MIPI functions in order to facilitate improved error handling and remove the panel's dependency on deprecated MIPI functions. Use the new mipi_dsi_dual macro to reduce code duplication. Reviewed-by: Douglas Anderson Reviewed-by: Diogo Ivo Tested-by: Diogo Ivo Signed-off-by: Brigham Campbell --- drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c | 196 ++++++------------ 1 file changed, 59 insertions(+), 137 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c b/drivers/gpu/dr= m/panel/panel-jdi-lpm102a188a.c index 5f897e143758..243483a58c45 100644 --- a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c +++ b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c @@ -81,25 +81,25 @@ static int jdi_panel_disable(struct drm_panel *panel) static int jdi_panel_unprepare(struct drm_panel *panel) { struct jdi_panel *jdi =3D to_panel_jdi(panel); - int ret; =20 - ret =3D mipi_dsi_dcs_set_display_off(jdi->link1); - if (ret < 0) - dev_err(panel->dev, "failed to set display off: %d\n", ret); + /* + * One context per panel since we'll continue trying to shut down the + * other panel even if one isn't responding. + */ + struct mipi_dsi_multi_context dsi_ctx1 =3D { .dsi =3D jdi->link1 }; + struct mipi_dsi_multi_context dsi_ctx2 =3D { .dsi =3D jdi->link2 }; =20 - ret =3D mipi_dsi_dcs_set_display_off(jdi->link2); - if (ret < 0) - dev_err(panel->dev, "failed to set display off: %d\n", ret); + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx1); + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx2); =20 /* Specified by JDI @ 50ms, subject to change */ msleep(50); =20 - ret =3D mipi_dsi_dcs_enter_sleep_mode(jdi->link1); - if (ret < 0) - dev_err(panel->dev, "failed to enter sleep mode: %d\n", ret); - ret =3D mipi_dsi_dcs_enter_sleep_mode(jdi->link2); - if (ret < 0) - dev_err(panel->dev, "failed to enter sleep mode: %d\n", ret); + /* Doesn't hurt to try sleep mode even if display off fails */ + dsi_ctx1.accum_err =3D 0; + dsi_ctx2.accum_err =3D 0; + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx1); + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx2); =20 /* Specified by JDI @ 150ms, subject to change */ msleep(150); @@ -123,72 +123,46 @@ static int jdi_panel_unprepare(struct drm_panel *pane= l) /* Specified by JDI @ 20ms, subject to change */ msleep(20); =20 - return ret; -} - -static int jdi_setup_symmetrical_split(struct mipi_dsi_device *left, - struct mipi_dsi_device *right, - const struct drm_display_mode *mode) -{ - int err; - - err =3D mipi_dsi_dcs_set_column_address(left, 0, mode->hdisplay / 2 - 1); - if (err < 0) { - dev_err(&left->dev, "failed to set column address: %d\n", err); - return err; - } - - err =3D mipi_dsi_dcs_set_column_address(right, 0, mode->hdisplay / 2 - 1); - if (err < 0) { - dev_err(&right->dev, "failed to set column address: %d\n", err); - return err; - } - - err =3D mipi_dsi_dcs_set_page_address(left, 0, mode->vdisplay - 1); - if (err < 0) { - dev_err(&left->dev, "failed to set page address: %d\n", err); - return err; - } - - err =3D mipi_dsi_dcs_set_page_address(right, 0, mode->vdisplay - 1); - if (err < 0) { - dev_err(&right->dev, "failed to set page address: %d\n", err); - return err; - } - return 0; } =20 -static int jdi_write_dcdc_registers(struct jdi_panel *jdi) +static void jdi_setup_symmetrical_split(struct mipi_dsi_multi_context *dsi= _ctx, + struct mipi_dsi_device *left, + struct mipi_dsi_device *right, + const struct drm_display_mode *mode) +{ + mipi_dsi_dual(mipi_dsi_dcs_set_column_address_multi, + left, right, dsi_ctx, + 0, mode->hdisplay / 2 - 1); + mipi_dsi_dual(mipi_dsi_dcs_set_page_address_multi, + left, right, dsi_ctx, + 0, mode->vdisplay - 1); +} + +static void jdi_write_dcdc_registers(struct mipi_dsi_multi_context *dsi_ct= x, + struct jdi_panel *jdi) { /* Clear the manufacturer command access protection */ - mipi_dsi_generic_write_seq(jdi->link1, MCS_CMD_ACS_PROT, - MCS_CMD_ACS_PROT_OFF); - mipi_dsi_generic_write_seq(jdi->link2, MCS_CMD_ACS_PROT, - MCS_CMD_ACS_PROT_OFF); + mipi_dsi_dual_generic_write_seq_multi(jdi->link1, jdi->link2, dsi_ctx, + MCS_CMD_ACS_PROT, + MCS_CMD_ACS_PROT_OFF); /* - * Change the VGH/VGL divide rations to move the noise generated by the + * Change the VGH/VGL divide ratios to move the noise generated by the * TCONN. This should hopefully avoid interaction with the backlight * controller. */ - mipi_dsi_generic_write_seq(jdi->link1, MCS_PWR_CTRL_FUNC, - MCS_PWR_CTRL_PARAM1_VGH_330_DIV | - MCS_PWR_CTRL_PARAM1_DEFAULT, - MCS_PWR_CTRL_PARAM2_VGL_410_DIV | - MCS_PWR_CTRL_PARAM2_DEFAULT); - - mipi_dsi_generic_write_seq(jdi->link2, MCS_PWR_CTRL_FUNC, - MCS_PWR_CTRL_PARAM1_VGH_330_DIV | - MCS_PWR_CTRL_PARAM1_DEFAULT, - MCS_PWR_CTRL_PARAM2_VGL_410_DIV | - MCS_PWR_CTRL_PARAM2_DEFAULT); - - return 0; + mipi_dsi_dual_generic_write_seq_multi(jdi->link1, jdi->link2, dsi_ctx, + MCS_PWR_CTRL_FUNC, + MCS_PWR_CTRL_PARAM1_VGH_330_DIV | + MCS_PWR_CTRL_PARAM1_DEFAULT, + MCS_PWR_CTRL_PARAM2_VGL_410_DIV | + MCS_PWR_CTRL_PARAM2_DEFAULT); } =20 static int jdi_panel_prepare(struct drm_panel *panel) { struct jdi_panel *jdi =3D to_panel_jdi(panel); + struct mipi_dsi_multi_context dsi_ctx =3D {}; int err; =20 /* Disable backlight to avoid showing random pixels @@ -231,88 +205,36 @@ static int jdi_panel_prepare(struct drm_panel *panel) * put in place to communicate the configuration back to the DSI host * controller. */ - err =3D jdi_setup_symmetrical_split(jdi->link1, jdi->link2, - jdi->mode); - if (err < 0) { - dev_err(panel->dev, "failed to set up symmetrical split: %d\n", - err); - goto poweroff; - } + jdi_setup_symmetrical_split(&dsi_ctx, jdi->link1, jdi->link2, + jdi->mode); =20 - err =3D mipi_dsi_dcs_set_tear_scanline(jdi->link1, - jdi->mode->vdisplay - 16); - if (err < 0) { - dev_err(panel->dev, "failed to set tear scanline: %d\n", err); - goto poweroff; - } + mipi_dsi_dual(mipi_dsi_dcs_set_tear_scanline_multi, + jdi->link1, jdi->link2, &dsi_ctx, + jdi->mode->vdisplay - 16); =20 - err =3D mipi_dsi_dcs_set_tear_scanline(jdi->link2, - jdi->mode->vdisplay - 16); - if (err < 0) { - dev_err(panel->dev, "failed to set tear scanline: %d\n", err); - goto poweroff; - } + mipi_dsi_dual(mipi_dsi_dcs_set_tear_on_multi, + jdi->link1, jdi->link2, &dsi_ctx, + MIPI_DSI_DCS_TEAR_MODE_VBLANK); =20 - err =3D mipi_dsi_dcs_set_tear_on(jdi->link1, - MIPI_DSI_DCS_TEAR_MODE_VBLANK); - if (err < 0) { - dev_err(panel->dev, "failed to set tear on: %d\n", err); - goto poweroff; - } + mipi_dsi_dual(mipi_dsi_dcs_set_pixel_format_multi, + jdi->link1, jdi->link2, &dsi_ctx, + MIPI_DCS_PIXEL_FMT_24BIT); =20 - err =3D mipi_dsi_dcs_set_tear_on(jdi->link2, - MIPI_DSI_DCS_TEAR_MODE_VBLANK); - if (err < 0) { - dev_err(panel->dev, "failed to set tear on: %d\n", err); - goto poweroff; - } + mipi_dsi_dual(mipi_dsi_dcs_exit_sleep_mode_multi, + jdi->link1, jdi->link2, &dsi_ctx); =20 - err =3D mipi_dsi_dcs_set_pixel_format(jdi->link1, MIPI_DCS_PIXEL_FMT_24BI= T); - if (err < 0) { - dev_err(panel->dev, "failed to set pixel format: %d\n", err); - goto poweroff; - } - - err =3D mipi_dsi_dcs_set_pixel_format(jdi->link2, MIPI_DCS_PIXEL_FMT_24BI= T); - if (err < 0) { - dev_err(panel->dev, "failed to set pixel format: %d\n", err); - goto poweroff; - } - - err =3D mipi_dsi_dcs_exit_sleep_mode(jdi->link1); - if (err < 0) { - dev_err(panel->dev, "failed to exit sleep mode: %d\n", err); - goto poweroff; - } - - err =3D mipi_dsi_dcs_exit_sleep_mode(jdi->link2); - if (err < 0) { - dev_err(panel->dev, "failed to exit sleep mode: %d\n", err); - goto poweroff; - } - - err =3D jdi_write_dcdc_registers(jdi); - if (err < 0) { - dev_err(panel->dev, "failed to write dcdc registers: %d\n", err); - goto poweroff; - } + jdi_write_dcdc_registers(&dsi_ctx, jdi); /* - * We need to wait 150ms between mipi_dsi_dcs_exit_sleep_mode() and - * mipi_dsi_dcs_set_display_on(). + * We need to wait 150ms between mipi_dsi_dcs_exit_sleep_mode_multi() + * and mipi_dsi_dcs_set_display_on_multi(). */ - msleep(150); + mipi_dsi_msleep(&dsi_ctx, 150); =20 - err =3D mipi_dsi_dcs_set_display_on(jdi->link1); - if (err < 0) { - dev_err(panel->dev, "failed to set display on: %d\n", err); - goto poweroff; - } + mipi_dsi_dual(mipi_dsi_dcs_set_display_on_multi, + jdi->link1, jdi->link2, &dsi_ctx); =20 - err =3D mipi_dsi_dcs_set_display_on(jdi->link2); - if (err < 0) { - dev_err(panel->dev, "failed to set display on: %d\n", err); + if (dsi_ctx.accum_err < 0) goto poweroff; - } =20 jdi->link1->mode_flags &=3D ~MIPI_DSI_MODE_LPM; jdi->link2->mode_flags &=3D ~MIPI_DSI_MODE_LPM; --=20 2.50.1 From nobody Mon Oct 6 15:15:52 2025 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB3A4237A4F for ; Sat, 19 Jul 2025 08:27:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752913630; cv=none; b=UsHItEJzxKPXbU9GIAxL5W+AfB43fLSn+0kENCDoZ1KG1LsnMu9IUqfC+5uJSvMj5ejlAe1iI8KX3ZegSIpP0wPyXt1cc5pGsQnkMXhyhboJIyZsmVcHgGha05qfS3fo+Xik4H92Em+HvhR1xAiBdgfy1uDnJvGqtMQ6foE8QV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752913630; c=relaxed/simple; bh=bd+E0gQII7XeyGUMZUuFdsAUXKc9B1flbUYFWuIacjQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=taSoW91gCXWcPSvB1TuS4PvyuQzLOOU+EEaQRVwGkz1J1Hq3CDgV7eiquTW9RxYmL3uBddPy7V9PtUKxYX9qM68hHvmvv8GfApNhXnqaRvauTPyZQItw3+viKR5b5YLzSHogfYIRUH4wEbkK5sYGxuRzllUxEwxFkWyndd8iRgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=brighamcampbell.com; spf=pass smtp.mailfrom=brighamcampbell.com; dkim=pass (2048-bit key) header.d=brighamcampbell.com header.i=@brighamcampbell.com header.b=kQrcP5Pz; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=brighamcampbell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=brighamcampbell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=brighamcampbell.com header.i=@brighamcampbell.com header.b="kQrcP5Pz" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-b31c84b8052so3066271a12.1 for ; Sat, 19 Jul 2025 01:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brighamcampbell.com; s=google; t=1752913628; x=1753518428; darn=vger.kernel.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=sJeA0ZOH8c7XggE0U2uw5Qes21v9D2XQPKfKpRuKve4=; b=kQrcP5PzF9yNRxyA50oYb8ITE4TRgWb3mxoimeatCjz4djJevLOsQ2jpG4S6RVJfC6 2p+RYhiLKjFHke7wcYK8fHR13d2oasOrQky/z/bCx6fRr4II/6KnvUn+8Zoc6muVQKwk xZqt2RpEOgtUvS4f6L9MdnpURvjt5Ie4ocJvG3BInfvOt25tVp3Dv72WbXtHWye9geNp 7nVecNACOdNB2BohhM0cXnRZh06uAO0aSolVxdQMtEOjV7R7La9hAAziUH70jTBzVmY7 HYqt2j+hBD5bHWyPTtZqz7AoZ4fpIxz8A4OrKXNzRazSUWsMxRuGSg71wjpOYLdRW5fu GuLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752913628; x=1753518428; 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=sJeA0ZOH8c7XggE0U2uw5Qes21v9D2XQPKfKpRuKve4=; b=uLbHm2UkXNIriD1OuCpbSZYdiHBDyAVptrRZnqXZ7GLIkFgCXXSgFlvTQgCvj604HA 8yt19QCiT60NTyQylaCY1DTc7qeZEYizRSez4JMrNPrS+o7JIJhKRO3wF2a2zCzD+gE6 oSeEoLbP96QoD/ApWX1nJMGBL/tC8elkFpzmjPca4wRnwjonqJErF72la/h7WW/BuzrO q27CiDvCTaccA7LpsXtq7ozoqc4OvLCSPRGTt/hFefFUlwesXsc5KNbDa3MJRIXA5UNQ D+E0N3cMPXWv/+XOm98N1Qe1m9XZvPpeYcSYFDARAFgxHIpmsTCNBZzdk+ozY0U+46ce +OlA== X-Forwarded-Encrypted: i=1; AJvYcCUDY2P5lcEiH6CMrNivQ2SLCbYJSsoV7Lyl5uLpCqgTWOmImEtqEuFH4nJoEBWylkeISVQKzwagPEif24o=@vger.kernel.org X-Gm-Message-State: AOJu0YwH4cJz0sbzkeE7HErmqXk5z6KCX48fzLugWBPvIgpo5PgRJYav ZXHg6k+9PoB6CpbZA8I1NJpgj6DDUtUuFUkejxvCSBfh2B2d7g+Wf6gQwBf3B2k0jDs= X-Gm-Gg: ASbGncscgMn0o7d2QMA4ACdnHefNgDbYdfDH2qWc+MKzSFl5emKeY+CRx3if+fCoECR byF0/RgictR1vHXyZqje2fXSw9FDKTGFJubBFb/mzpkiH9XcwV+MMa3HXWRU84W9RTemRo2964x g+Rx7ZGnyRjiRSzVIY+mcSXVmYX7eijK8gOHTCbbxqXR3BkbNOU7haf2kVsVfkI99GC8F/7ezu7 RFlYrvBEvrwzt5UzlO3kHoepsY9+fIGQjzB6GmkehkHyFCc+CaZaRjRGcl1R0qjFDhYmt51iAjU /vORpY12qwcEEBEzlyd3b+OftcRU+BfJeAK0j+chtuiGalq2Xp2VW8hCzstUZ7QsZWaqE0Bq3Hq Y4UxvjFsl9L9h4mDSW+LQ1oVUOVyIN6Wck0+rWjXs8HDwD5PpVg== X-Google-Smtp-Source: AGHT+IEtGHThs3c5zaWTIBYa9eDjBCvzdPq04CWI3MnLdXSZNpbYivBg67p870OLCeNcYRQCUXTizw== X-Received: by 2002:a05:6a20:729b:b0:235:d4a:1318 with SMTP id adf61e73a8af0-2390dc6512emr16725964637.38.1752913628137; Sat, 19 Jul 2025 01:27:08 -0700 (PDT) Received: from mystery-machine.tail542cf.ts.net ([64.71.154.6]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-759cb157635sm2475260b3a.83.2025.07.19.01.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jul 2025 01:27:07 -0700 (PDT) From: Brigham Campbell To: dianders@chromium.org, tejasvipin76@gmail.com, diogo.ivo@tecnico.ulisboa.pt, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Brigham Campbell Subject: [PATCH v5 3/4] drm: Remove unused MIPI write seq and chatty functions Date: Sat, 19 Jul 2025 02:26:37 -0600 Message-ID: <20250719082639.307545-4-me@brighamcampbell.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250719082639.307545-1-me@brighamcampbell.com> References: <20250719082639.307545-1-me@brighamcampbell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove the deprecated mipi_dsi_generic_write_seq() and mipi_dsi_generic_write_chatty() functions now that they are no longer used. Reviewed-by: Douglas Anderson Signed-off-by: Brigham Campbell --- drivers/gpu/drm/drm_mipi_dsi.c | 34 +++------------------------------- include/drm/drm_mipi_dsi.h | 23 ----------------------- 2 files changed, 3 insertions(+), 54 deletions(-) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 4a7ca1261105..dff00d725236 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -772,41 +772,13 @@ ssize_t mipi_dsi_generic_write(struct mipi_dsi_device= *dsi, const void *payload, EXPORT_SYMBOL(mipi_dsi_generic_write); =20 /** - * 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() - * 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 =3D &dsi->dev; - ssize_t ret; - - ret =3D 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_write_multi() - mipi_dsi_generic_write_chatty() w/ acc= um_err + * mipi_dsi_generic_write_multi() - mipi_dsi_generic_write() 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. + * A wrapper around mipi_dsi_generic_write() that deals with errors in a w= ay + * 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) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index ffdfcb57cbd4..528b5979ab8b 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -285,8 +285,6 @@ void mipi_dsi_picture_parameter_set_multi(struct mipi_d= si_multi_context *ctx, =20 ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *pa= yload, 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); void mipi_dsi_dual_generic_write_multi(struct mipi_dsi_device *dsi1, @@ -387,27 +385,6 @@ void mipi_dsi_dcs_set_tear_scanline_multi(struct mipi_= dsi_multi_context *ctx, u16 scanline); void mipi_dsi_dcs_set_tear_off_multi(struct mipi_dsi_multi_context *ctx); =20 -/** - * 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. - * - * 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 - */ -#define mipi_dsi_generic_write_seq(dsi, seq...) = \ - do { \ - static const u8 d[] =3D { seq }; \ - int ret; \ - ret =3D mipi_dsi_generic_write_chatty(dsi, d, ARRAY_SIZE(d)); \ - if (ret < 0) \ - return ret; \ - } while (0) - /** * mipi_dsi_generic_write_seq_multi - transmit data using a generic write = packet * --=20 2.50.1 From nobody Mon Oct 6 15:15:52 2025 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDDB5238C20 for ; Sat, 19 Jul 2025 08:27:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752913632; cv=none; b=fi08zUs/w1lEV+MHWkf0vhfh1XKujgIOFK6M1FXZZaWhS0odOETEnrqaBdDHKrrZW3EqoLlqnnphHWUlUF3xXTYsNHboG8Z0gyBAikAcptBc61P9c/DZz6H+ZsAxNuAxOabVILMkD/ioqAyS6bne0u6IL1/2J/zpel/t8/LKIR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752913632; c=relaxed/simple; bh=7Eifg3KSSA5Jt2qx/3hzXf0HaiUdAumge8P2aIN3a9M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K5P15bDlLCtEDWWUsk5iN1/+XKBMP1gr2HMtv/KYl5rUb8wTk0Y1jahAmBbW1M7nwzROo+rXwSijhGVrHhgV+LHLxyr+7DSDwfymkVdPJ0Xk7znsJzt+9BqOFHuWwqieq7Q1uzY/KBSPt/lQhooXp6qOwKze1vVdkPiRyUa957c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=brighamcampbell.com; spf=pass smtp.mailfrom=brighamcampbell.com; dkim=pass (2048-bit key) header.d=brighamcampbell.com header.i=@brighamcampbell.com header.b=QqYcssTO; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=brighamcampbell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=brighamcampbell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=brighamcampbell.com header.i=@brighamcampbell.com header.b="QqYcssTO" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-74af4af04fdso2727781b3a.1 for ; Sat, 19 Jul 2025 01:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brighamcampbell.com; s=google; t=1752913630; x=1753518430; darn=vger.kernel.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=4rHylqCjx1w2oDPs7/xM2Riq8NSJ9PhhkdUN4+cutX8=; b=QqYcssTOGTktErvJ1iII+3Xa0ApEqjSKHnVa1BMh8jyGayEfWB17pwBjzz4+b9ktmi p2/+dkz3iqXtXgcLexSQabtSzvsYh2jGYFjrSF+8/IGIySbm8LSPECdLZL1FE8Gr3SXK ne3aiwRXEC3zlKBNTvJuHHkZkZM9WZmhrKK3IdPuFBsPDng48zRH9TMy7OdknXuZNugr Uf6CYXeMOq8kv2zJfy5N7mHVAAiscTb2Z3qErB9pxkujscI2eJV8muwFo9M78IYiWDcy usS2ehcveAypd4mcSLnv1Yymw9VeiVwgWkOPu4ld7Yixxt8cQ/mfKHpeQJryR7mgUAbi C9wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752913630; x=1753518430; 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=4rHylqCjx1w2oDPs7/xM2Riq8NSJ9PhhkdUN4+cutX8=; b=TDXW2kDOr8B4SbTOYVxOeT7XaZ7wZX3rLLmvISd77zW6ITdFaZffO3uKdb+KfghHg4 /6Wrbqqf2zuju91LorI1zUsAJmmG1a3wlAXQCpyq4A4SQy6Ih1s7gYGYcjZZpX225yri FV1EaC1JsfHHI+iQkZhAZUeXKIkJ+R38NfCCHEI9KXPMvFLKaLl3yqrT4TV6va3rSL+A cHnQXgV4+e2/0fzze3DPFDkOsZtUukewJRajePxTjWD6xeqkA/USDMcIcyE5S0448jh2 TCPu5fmqstMYYFEZRodkZA2RFyktwjnYIvi8pqdEDfdhQ4bZsljQEL3arqxsFjpVYiUZ SBTw== X-Forwarded-Encrypted: i=1; AJvYcCWl0o/Pq251Dc8Cb2FEv9p2sk/6A+xrXSkZgeaqU+SaA2kJZDQtaxupQ0OO/vu0jkS45wueANSay4hhER0=@vger.kernel.org X-Gm-Message-State: AOJu0YxwB1pz2mFvmgDTsi7eRD40kndoNwA3X0I6UJuzLB8dmExp//23 BlHv0i/svwMipjP66XsqLuu+7piOkIJ5NhTJQ19OfNzz7BbYzYbpPdCxnyPvmGE9NuI= X-Gm-Gg: ASbGncsN3yFGoG2CBJZW9OlLtF7rCcI+92qp8F932XSpENXy8NzwlpBbhfuny1pfNpO KUFAEDbDNzJmwu5datK83lPAWrQIxybSi/Wgy4RFTns0D7teCaxwNGobPumvxAg6QU3s3Axt6b5 /YjjASdtVc0U7OlMp+kbFT1xlSSWJQAylJWSS/XhER+MjyWrancklV3y9Bh3Fn1vkTymUTdk0iH XnXLeyedWMuCKFPLmhqS4ZVKBt4WZ2tRUH75ztC48AkF1geJDLMvY2ihpR18+pHBLXpWDjLR3gl 2KxGLz4nz9nziEW1ThYQfNxi/Jl4IBKfGqToG+0oFQH99Xx/AslOfrc8UnQlQbNxHPqikZh/LRe 12h7nfXTiZnosPMUV1HJM12fkaYPeAwdSKdYYxmiefa/8HJUOMg== X-Google-Smtp-Source: AGHT+IGatphEHSAKw7z/xW0LGtlPVyO0W6ZIkOclORHs8NjYT1LzsjnDPk9buZ2iABOLqZ0brWLSNw== X-Received: by 2002:a05:6a00:4c93:b0:736:5969:2b6f with SMTP id d2e1a72fcca58-75837586b17mr13305132b3a.6.1752913630098; Sat, 19 Jul 2025 01:27:10 -0700 (PDT) Received: from mystery-machine.tail542cf.ts.net ([64.71.154.6]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-759cb157635sm2475260b3a.83.2025.07.19.01.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jul 2025 01:27:09 -0700 (PDT) From: Brigham Campbell To: dianders@chromium.org, tejasvipin76@gmail.com, diogo.ivo@tecnico.ulisboa.pt, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jonathan Corbet Cc: Brigham Campbell Subject: [PATCH v5 4/4] drm: docs: Update task from drm TODO list Date: Sat, 19 Jul 2025 02:26:38 -0600 Message-ID: <20250719082639.307545-5-me@brighamcampbell.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250719082639.307545-1-me@brighamcampbell.com> References: <20250719082639.307545-1-me@brighamcampbell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update TODO item from drm documentation to contain more applicable information regarding the removal of deprecated MIPI DSI functions and no longer reference functions which have already been removed from the kernel. Reviewed-by: Douglas Anderson Signed-off-by: Brigham Campbell --- Documentation/gpu/todo.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index be8637da3fe9..92db80793bba 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -497,19 +497,19 @@ Contact: Douglas Anderson =20 Level: Intermediate =20 -Transition away from using mipi_dsi_*_write_seq() -------------------------------------------------- +Transition away from using deprecated MIPI DSI functions +-------------------------------------------------------- =20 -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_mul= ti() -and mipi_dsi_dcs_write_seq_multi() macros instead. +There are many functions defined in ``drm_mipi_dsi.c`` which have been +deprecated. Each deprecated function was deprecated in favor of its `multi` +variant (e.g. `mipi_dsi_generic_write()` and `mipi_dsi_generic_write_multi= ()`). +The `multi` variant of a function includes improved error handling and log= ic +which makes it more convenient to make several calls in a row, as most MIPI +drivers do. =20 -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() varia= nts -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. +Drivers should be updated to use undeprecated functions. Once all usages o= f the +deprecated MIPI DSI functions have been removed, their definitions may be +removed from ``drm_mipi_dsi.c``. =20 Contact: Douglas Anderson =20 --=20 2.50.1