From: Jessica Zhang <quic_jesszhan@quicinc.com>
To: Caleb Connolly <caleb@postmarketos.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Henrik Rydberg <rydberg@bitmath.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
<dri-devel@lists.freedesktop.org>, <devicetree@vger.kernel.org>,
<linux-input@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
<~postmarketos/upstreaming@lists.sr.ht>
Subject: Re: [PATCH v2 4/8] drm: mipi: add mipi_dsi_generic_write_multi_type()
Date: Fri, 12 Jul 2024 14:39:15 -0700 [thread overview]
Message-ID: <606ddebb-c98c-47da-93d7-a387dbb6df22@quicinc.com> (raw)
In-Reply-To: <20240630-oneplus8-v2-4-c4a1f8da74f1@postmarketos.org>
On 6/30/2024 11:36 AM, Caleb Connolly wrote:
> Some panels like the Samsung AMB655X use long write commands for all
> non-standard messages and do not work when trying to use the appropriate
> command type.
>
> Support these panels by introducing a new helper to send commands of a
> specific type, overriding the normal rules.
>
> Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
> ---
> drivers/gpu/drm/drm_mipi_dsi.c | 40 ++++++++++++++++++++++++++++++++++++++++
> include/drm/drm_mipi_dsi.h | 16 ++++++++++++++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index a471c46f5ca6..f2c7f3f23a6e 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -819,8 +819,48 @@ void mipi_dsi_generic_write_multi(struct mipi_dsi_multi_context *ctx,
> }
> }
> EXPORT_SYMBOL(mipi_dsi_generic_write_multi);
>
> +/**
> + * mipi_dsi_generic_write_raw_multi() - transmit data using a generic write packet of
> + * a specific type
> + * @ctx: Context for multiple DSI transactions
> + * @type: data type of the packet
> + * @payload: buffer containing the payload
> + * @size: size of payload buffer
> + *
> + * This function will automatically choose the right data type depending on
> + * the payload length.
Hi Caleb,
I'm a bit confused by the wording here. By "automatically", do you mean
the chosen by the macro calling this function?
Thanks,
Jessica Zhang
> + *
> + * Return: The number of bytes transmitted on success or a negative error code
> + * on failure.
> + */
> +ssize_t mipi_dsi_generic_write_raw_multi(struct mipi_dsi_multi_context *ctx,
> + u8 type, const void *payload, size_t size)
> +{
> + struct mipi_dsi_device *dsi = ctx->dsi;
> + struct mipi_dsi_msg msg = {
> + .channel = dsi->channel,
> + .tx_buf = payload,
> + .tx_len = size,
> + .type = type,
> + };
> + ssize_t ret;
> +
> + if (ctx->accum_err)
> + return 0;
> +
> + ret = mipi_dsi_device_transfer(dsi, &msg);
> + if (ret < 0) {
> + ctx->accum_err = ret;
> + dev_err(&dsi->dev, "sending generic data %*ph failed: %zd\n",
> + (int)size, payload, ret);
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(mipi_dsi_generic_write_raw_multi);
> +
> /**
> * mipi_dsi_generic_read() - receive data using a generic read packet
> * @dsi: DSI peripheral device
> * @params: buffer containing the request parameters
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 71d121aeef24..fb23f4e3b94e 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -287,8 +287,10 @@ ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,
> 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_write_raw_multi(struct mipi_dsi_multi_context *ctx, u8 type,
> + 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);
>
> #define mipi_dsi_msleep(ctx, delay) \
> @@ -432,8 +434,22 @@ void mipi_dsi_dcs_set_tear_on_multi(struct mipi_dsi_multi_context *ctx,
> static const u8 d[] = { cmd, seq }; \
> mipi_dsi_dcs_write_buffer_multi(ctx, d, ARRAY_SIZE(d)); \
> } while (0)
>
> +/**
> + * mipi_dsi_dcs_write_long_multi - transmit a DCS long command with payload
> + * @ctx: Context for multiple DSI transactions
> + * @cmd: Commands
> + * @seq: buffer containing data to be transmitted
> + */
> +#define mipi_dsi_dcs_write_long_multi(ctx, cmd, seq...) \
> + do { \
> + static const u8 d[] = { cmd, seq }; \
> + mipi_dsi_generic_write_raw_multi(ctx, \
> + MIPI_DSI_DCS_LONG_WRITE, \
> + d, ARRAY_SIZE(d)); \
> + } while (0)
> +
> /**
> * struct mipi_dsi_driver - DSI driver
> * @driver: device driver model driver
> * @probe: callback for device binding
>
> --
> 2.45.0
>
next prev parent reply other threads:[~2024-07-12 21:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-30 18:36 [PATCH v2 0/8] qcom: initial support for the OnePlus 8T Caleb Connolly
2024-06-30 18:36 ` [PATCH v2 1/8] dt-bindings: panel: document Samsung AMB655X Caleb Connolly
2024-06-30 19:55 ` Rob Herring (Arm)
2024-06-30 18:36 ` [PATCH v2 2/8] dt-bindings: input: touchscreen: document synaptics TCM oncell Caleb Connolly
2024-07-01 6:52 ` Krzysztof Kozlowski
2024-06-30 18:36 ` [PATCH v2 3/8] dt-bindings: arm: qcom: add OnePlus 8 series Caleb Connolly
2024-06-30 18:36 ` [PATCH v2 4/8] drm: mipi: add mipi_dsi_generic_write_multi_type() Caleb Connolly
2024-07-01 20:15 ` Dmitry Baryshkov
2024-07-12 21:39 ` Jessica Zhang [this message]
2024-07-16 23:37 ` Caleb Connolly
2024-06-30 18:36 ` [PATCH v2 5/8] drm/mipi-dsi: add set column/page multi helpers Caleb Connolly
2024-07-01 20:02 ` Dmitry Baryshkov
2024-06-30 18:36 ` [PATCH v2 6/8] drm/panel: add driver for samsung amb655x Caleb Connolly
2024-07-01 20:32 ` Dmitry Baryshkov
2024-07-02 9:42 ` Caleb Connolly
2024-07-02 11:13 ` Dmitry Baryshkov
2024-06-30 18:36 ` [PATCH v2 7/8] Input: touchscreen: add Synaptics TCM oncell S3908 Caleb Connolly
2024-07-03 2:09 ` kernel test robot
2024-06-30 18:36 ` [PATCH v2 8/8] arm64: dts: qcom: add OnePlus 8T (kebab) Caleb Connolly
2024-07-11 8:52 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=606ddebb-c98c-47da-93d7-a387dbb6df22@quicinc.com \
--to=quic_jesszhan@quicinc.com \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=caleb@postmarketos.org \
--cc=conor+dt@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=rydberg@bitmath.org \
--cc=tzimmermann@suse.de \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).