From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v2 1/2] drm/dp: Factor out a function to probe a DPCD address
Date: Fri, 8 Apr 2022 20:21:53 +0300 [thread overview]
Message-ID: <20220408172154.807900-1-imre.deak@intel.com> (raw)
Factor out from drm_dp_dpcd_read() a function to probe a DPCD address
with a 1-byte read access. This will be needed by the next patch doing a
read from an LTTPR address, which must happen without the preceding
wake-up read in drm_dp_dpcd_read().
v2: Add a probe function instead of exporting drm_dp_dpcd_access(). (Jani)
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/dp/drm_dp.c | 28 +++++++++++++++++++++++++---
include/drm/dp/drm_dp_helper.h | 1 +
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/dp/drm_dp.c b/drivers/gpu/drm/dp/drm_dp.c
index 580016a1b9eb7..b58e30132768d 100644
--- a/drivers/gpu/drm/dp/drm_dp.c
+++ b/drivers/gpu/drm/dp/drm_dp.c
@@ -527,6 +527,29 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
return ret;
}
+/**
+ * drm_dp_dpcd_probe() - probe a given DPCD address with a 1-byte read access
+ * @aux: DisplayPort AUX channel (SST)
+ * @offset: address of the register to probe
+ *
+ * Probe the provided DPCD address by reading 1 byte from it. The function can
+ * be used to trigger some side-effect the read access has, like waking up the
+ * sink, without the need for the read-out value.
+ *
+ * Returns 0 if the read access suceeded, or a negative error code on failure.
+ */
+int drm_dp_dpcd_probe(struct drm_dp_aux *aux, unsigned int offset)
+{
+ u8 buffer;
+ int ret;
+
+ ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, &buffer, 1);
+ WARN_ON(ret == 0);
+
+ return ret < 0 ? ret : 0;
+}
+EXPORT_SYMBOL(drm_dp_dpcd_probe);
+
/**
* drm_dp_dpcd_read() - read a series of bytes from the DPCD
* @aux: DisplayPort AUX channel (SST or MST)
@@ -559,9 +582,8 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
* monitor doesn't power down exactly after the throw away read.
*/
if (!aux->is_remote) {
- ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV,
- buffer, 1);
- if (ret != 1)
+ ret = drm_dp_dpcd_probe(aux, DP_DPCD_REV);
+ if (ret < 0)
goto out;
}
diff --git a/include/drm/dp/drm_dp_helper.h b/include/drm/dp/drm_dp_helper.h
index 1eccd97419436..91af98e6617c6 100644
--- a/include/drm/dp/drm_dp_helper.h
+++ b/include/drm/dp/drm_dp_helper.h
@@ -2053,6 +2053,7 @@ struct drm_dp_aux {
bool is_remote;
};
+int drm_dp_dpcd_probe(struct drm_dp_aux *aux, unsigned int offset);
ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
void *buffer, size_t size);
ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
--
2.30.2
next reply other threads:[~2022-04-08 17:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 17:21 Imre Deak [this message]
2022-04-08 17:21 ` [Intel-gfx] [PATCH v2 2/2] drm/i915/dp: Add workaround for spurious AUX timeouts/hotplugs on LTTPR links Imre Deak
2022-04-08 22:46 ` [Intel-gfx] [PATCH v3 " Imre Deak
2022-04-14 10:49 ` Jani Nikula
2022-04-26 9:49 ` Imre Deak
2022-04-26 11:31 ` Jani Nikula
2022-04-26 11:59 ` Imre Deak
2022-04-26 14:23 ` Jani Nikula
2022-04-08 21:12 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v2,1/2] drm/dp: Factor out a function to probe a DPCD address Patchwork
2022-04-08 21:43 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-04-08 22:47 ` [Intel-gfx] [v2, 1/2] " Almahallawy, Khaled
2022-04-08 23:02 ` Imre Deak
2022-04-08 23:22 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v2,1/2] drm/dp: Factor out a function to probe a DPCD address (rev2) Patchwork
2022-04-08 23:24 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-04-08 23:50 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-04-09 1:17 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-04-11 13:25 ` [Intel-gfx] [PATCH v3 1/2] drm/dp: Factor out a function to probe a DPCD address Imre Deak
2022-04-14 10:30 ` Jani Nikula
2022-04-11 17:02 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/2] drm/dp: Factor out a function to probe a DPCD address (rev3) Patchwork
2022-04-11 17:02 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-04-11 17:22 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-04-11 20:18 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-04-14 18:32 ` Imre Deak
2022-04-14 21:18 ` Vudum, Lakshminarayana
2022-04-14 20:13 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork
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=20220408172154.807900-1-imre.deak@intel.com \
--to=imre.deak@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.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