From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33EFA405C4D for ; Fri, 12 Jun 2026 17:17:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781284656; cv=none; b=rQf4fo5RjPVsCLVC492WZqGhGk/+RAIQ1SZlegvDwEljq1zxLJGDQtG+fvOBlEwV5/L9RMAlETPNOuPkapZC1FhgZtdd6VB6oHvJZ4KLyen+rsJGMGFPpXXVV01aJWGi3FckqgmoCOs9/7NQzhe/VoGKjA3GsVXlMgd4PPm8iT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781284656; c=relaxed/simple; bh=lonMWUk3tdHkzE//oyRyvMIpUZlUAdavhA4XYi3iZ5A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KxsuPUUbhfVtqkE/mblEz0zGRz1D+RM+ZsOn5pGkU4egoCG2CeqPuJMgMDB0+ksvPnWp8QE1W4P0oZvP1+Q6zF4kcJSrWpsAFrlN4F3FZgAHTFBMnsFq+uvjqL4QJ1xH96KlYwog+evwbz4nut6vNGbyNGTBQEbDgQOcUKviJ+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I+zMYdUf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I+zMYdUf" Received: by smtp.kernel.org (Postfix) with ESMTPS id F327CC2BCB8; Fri, 12 Jun 2026 17:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1781284656; bh=lonMWUk3tdHkzE//oyRyvMIpUZlUAdavhA4XYi3iZ5A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=I+zMYdUfbcqk41yn78YQ7piKTwj5LbiK+zglOuN+Gw21xFv2qu0zIF9q3kHuCojuQ b4K1ZvcSl0fKYxuDnFs4qzVxuZJ3RGeHJY/eLQrwclOkYKOPXzTRWXJBKAc5eaWNlT wha2eXWLN4LvTWy01vjyO7VXTaDSHenIlBEnuSek5rKNbeeHdP3v31bTFNDB8jwHHw kIFomodhOwniVA6X0fBh+/rEl7IUj4EYgnSP6kkA8pCIeQnQmJBBsQqoH5nsfKiMfv YW62Bel5SSkZY/woRWbrna6BFfqp4rLqWheSOhWLBIhzB1bc05nh6v8CzH4P7K1UI1 uml3xqB05qIfQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6C7FCD98CE; Fri, 12 Jun 2026 17:17:35 +0000 (UTC) From: Alberto Ruiz via B4 Relay Date: Fri, 12 Jun 2026 18:17:16 +0100 Subject: [PATCH 1/4] drm/solomon: add ssd130x_run_cmd_seq() for batch command execution Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260612-ssd-batchcmd-v1-1-c61e5f7c24bc@redhat.com> References: <20260612-ssd-batchcmd-v1-0-c61e5f7c24bc@redhat.com> In-Reply-To: <20260612-ssd-batchcmd-v1-0-c61e5f7c24bc@redhat.com> To: Javier Martinez Canillas , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Alberto Ruiz X-Mailer: b4 0.15.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1781284654; l=2024; i=aruiz@redhat.com; s=20260612; h=from:subject:message-id; bh=7aY1PLlc9EJ6kLHma9AUr2Hy4BkrCZ+OPY9RYqNraa8=; b=lu5PX75vL6lQbkOsRQQAYv7YUE1Tn1Fv/pH2+a55vb6vriNela8AXX4bkuWcnPNH6hDqA6LPX CJagk3r8LwEArDW0Hm5Ro+cruvB2clp02mOo6F3mEZNHvRxpdB38+bq X-Developer-Key: i=aruiz@redhat.com; a=ed25519; pk=d1doFQwve1B/jU9nG5oPl1W5d+t+iFrjkkwk/hD97Ow= X-Endpoint-Received: by B4 Relay for aruiz@redhat.com/20260612 with auth_id=818 X-Original-From: Alberto Ruiz Reply-To: aruiz@redhat.com From: Alberto Ruiz Introduce ssd130x_run_cmd_seq() that interprets a flat byte array of length-prefixed command entries terminated by a zero byte, removing the need for per-command error checking at each call site. Signed-off-by: Alberto Ruiz --- drivers/gpu/drm/solomon/ssd130x.c | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c index c77455b1834d..46e2c277a9bf 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -276,6 +276,49 @@ static int ssd130x_write_cmd(struct ssd130x_device *ssd130x, int count, return ret; } +/* + * Write a command byte sequence from a buffer. + * + * Like ssd130x_write_cmd() but takes a pre-built byte array instead of + * variadic arguments, handy when the command is already in an array or + * when the caller wants to use sizeof() for the length. + */ +static int ssd130x_write_cmds(struct ssd130x_device *ssd130x, const u8 *cmd, + size_t len) +{ + unsigned int i; + int ret; + + for (i = 0; i < len; i++) { + ret = regmap_write(ssd130x->regmap, SSD13XX_COMMAND, cmd[i]); + if (ret) + return ret; + } + + return 0; +} + +/* + * Run a packed command sequence. The format is a flat byte array where each + * entry starts with a length byte followed by that many command bytes. A + * zero length byte terminates the sequence. + * + * Example: { 2, 0x81, 0x80, 1, 0xAF, 0 } + * sends command {0x81, 0x80}, then command {0xAF}, then stops. + */ +static int ssd130x_run_cmd_seq(struct ssd130x_device *ssd130x, const u8 *seq) +{ + while (*seq) { + u8 len = *seq++; + int ret = ssd130x_write_cmds(ssd130x, seq, len); + + if (ret) + return ret; + seq += len; + } + + return 0; +} /* Set address range for horizontal/vertical addressing modes */ static int ssd130x_set_col_range(struct ssd130x_device *ssd130x, u8 col_start, u8 cols) -- 2.53.0