From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
"Marijn Suijten" <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Stephen Boyd <swboyd@chromium.org>,
"Kuogee Hsieh" <quic_khsieh@quicinc.com>,
<linux-arm-msm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>,
<freedreno@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
Jessica Zhang <quic_jesszhan@quicinc.com>
Subject: Re: [PATCH 3/3] drm/msm/dp: add a debugfs node for using tpg
Date: Tue, 3 Dec 2024 19:57:25 -0800 [thread overview]
Message-ID: <2193c915-cdda-416d-8e24-209e808c6d10@quicinc.com> (raw)
In-Reply-To: <uv2phgi72mmw5c462ijsqlqedeiv4gahrwi26i2luqkhgwmfxc@ycj7jrujdj6w>
On 12/3/2024 3:38 PM, Dmitry Baryshkov wrote:
> On Mon, Dec 02, 2024 at 12:42:00PM -0800, Abhinav Kumar wrote:
>> DP test pattern generator is a very useful tool to debug issues
>> where monitor is showing incorrect output as it helps to isolate
>> whether the issue is due to rest of DPU pipeline or in the DP
>> controller itself. Expose a debugfs to use the TPG configuration
>> to help debug DP issues.
>>
>> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>> ---
>> drivers/gpu/drm/msm/dp/dp_debug.c | 61 +++++++++++++++++++++++++++++++++++++++
>> drivers/gpu/drm/msm/dp/dp_panel.h | 2 ++
>> 2 files changed, 63 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/msm/dp/dp_debug.c b/drivers/gpu/drm/msm/dp/dp_debug.c
>> index 22fd946ee201..843fe77268f8 100644
>> --- a/drivers/gpu/drm/msm/dp/dp_debug.c
>> +++ b/drivers/gpu/drm/msm/dp/dp_debug.c
>> @@ -197,6 +197,65 @@ static const struct file_operations test_active_fops = {
>> .write = msm_dp_test_active_write
>> };
>>
>> +static ssize_t msm_dp_tpg_write(struct file *file, const char __user *ubuf,
>> + size_t len, loff_t *offp)
>> +{
>> + const struct msm_dp_debug_private *debug;
>> + char *input_buffer;
>> + int val;
>> + int status = 0;
>> + struct msm_dp_panel *dp_panel;
>> +
>> + debug = ((struct seq_file *)file->private_data)->private;
>> + dp_panel = debug->panel;
>> +
>> + input_buffer = memdup_user_nul(ubuf, len);
>> + if (IS_ERR(input_buffer))
>> + return PTR_ERR(input_buffer);
>> +
>> + status = kstrtoint(input_buffer, 10, &val);
>> + if (status < 0) {
>> + kfree(input_buffer);
>> + return status;
>> + }
>> +
>> + msm_dp_panel_tpg_config(dp_panel, val);
>> +
>> + dp_panel->tpg_enabled = val;
>
> Does this need any kind of locking? The driver performs some actions,
> then we write the global state. What if the user in parallel writes
> different values to the file?
>
Sure, I can add a lock to struct msm_dp_debug_private and use it to
protect the tpg_write and tpg_reads.
>> +
>> + kfree(input_buffer);
>> +
>> + *offp += len;
>> + return len;
>> +}
>> +
>> +static int msm_dp_tpg_show(struct seq_file *f, void *data)
>> +{
>> + struct msm_dp_debug_private *debug = f->private;
>> + struct msm_dp_panel *dp_panel = debug->panel;
>> +
>> + if (dp_panel->tpg_enabled)
>> + seq_puts(f, "1");
>> + else
>> + seq_puts(f, "0");
>> +
>> + return 0;
>> +}
>> +
>> +static int msm_dp_tpg_open(struct inode *inode, struct file *file)
>> +{
>> + return single_open(file, msm_dp_tpg_show, inode->i_private);
>> +}
>> +
>> +static const struct file_operations msm_dp_tpg_fops = {
>> + .owner = THIS_MODULE,
>> + .open = msm_dp_tpg_open,
>> + .read = seq_read,
>> + .llseek = seq_lseek,
>> + .release = single_release,
>> + .write = msm_dp_tpg_write
>> +};
>> +
>> int msm_dp_debug_init(struct device *dev, struct msm_dp_panel *panel,
>> struct msm_dp_link *link,
>> struct drm_connector *connector,
>> @@ -231,6 +290,8 @@ int msm_dp_debug_init(struct device *dev, struct msm_dp_panel *panel,
>> debugfs_create_file("dp_test_type", 0444,
>> root,
>> debug, &msm_dp_test_type_fops);
>> +
>> + debugfs_create_file("dp_tpg", 0444, root, debug, &msm_dp_tpg_fops);
>
> I'd say, skip the dp_ part of the name, everything in that dir is
> DP-related.
>
Ack.
next prev parent reply other threads:[~2024-12-04 3:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 20:41 [PATCH 0/3] drm/msm/dp: Fix and utilize TPG with a debugfs Abhinav Kumar
2024-12-02 20:41 ` [PATCH 1/3] drm/msm/dp: account for widebus in msm_dp_catalog_panel_tpg_enable() Abhinav Kumar
2024-12-03 14:34 ` Dmitry Baryshkov
2024-12-03 19:48 ` Abhinav Kumar
2024-12-02 20:41 ` [PATCH 2/3] drm/msm/dp: do not touch the MMSS_DP_INTF_CONFIG for tpg Abhinav Kumar
2024-12-03 15:09 ` Dmitry Baryshkov
2024-12-02 20:42 ` [PATCH 3/3] drm/msm/dp: add a debugfs node for using tpg Abhinav Kumar
2024-12-03 23:38 ` Dmitry Baryshkov
2024-12-04 3:57 ` Abhinav Kumar [this message]
2024-12-04 10:33 ` Dmitry Baryshkov
2024-12-03 14:31 ` [PATCH 0/3] drm/msm/dp: Fix and utilize TPG with a debugfs Dmitry Baryshkov
2024-12-03 19:42 ` Abhinav Kumar
2024-12-03 20:46 ` Dmitry Baryshkov
2024-12-10 22:33 ` Marijn Suijten
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=2193c915-cdda-416d-8e24-209e808c6d10@quicinc.com \
--to=quic_abhinavk@quicinc.com \
--cc=airlied@gmail.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_jesszhan@quicinc.com \
--cc=quic_khsieh@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=swboyd@chromium.org \
/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
all inboxes | Powered by JetHome®