From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dhinakaran.pandiyan@intel.com
Subject: Re: [PATCH v2 13/13] drm/i915/dp: use readb and writeb calls for single byte DPCD access
Date: Fri, 3 Feb 2017 19:25:09 +0200 [thread overview]
Message-ID: <20170203172509.GM31595@intel.com> (raw)
In-Reply-To: <9119e131d4c03190b6686b6ceeb0495933cd7355.1486131408.git.jani.nikula@intel.com>
On Fri, Feb 03, 2017 at 04:19:36PM +0200, Jani Nikula wrote:
> This is what we have the readb and writeb variants for. Do some minor
> return value and variable cleanup while at it.
>
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/intel_dp.c | 37 +++++++++++++++++--------------------
> 1 file changed, 17 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 90ae95f2ecb2..fdd4abfc2380 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3677,9 +3677,9 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
> uint8_t frame_sync_cap;
>
> dev_priv->psr.sink_support = true;
> - drm_dp_dpcd_read(&intel_dp->aux,
> - DP_SINK_DEVICE_AUX_FRAME_SYNC_CAP,
> - &frame_sync_cap, 1);
> + drm_dp_dpcd_readb(&intel_dp->aux,
> + DP_SINK_DEVICE_AUX_FRAME_SYNC_CAP,
> + &frame_sync_cap);
> dev_priv->psr.aux_frame_sync = frame_sync_cap ? true : false;
> /* PSR2 needs frame sync as well */
> dev_priv->psr.psr2_support = dev_priv->psr.aux_frame_sync;
> @@ -3749,8 +3749,8 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
> intel_dp_set_sink_rates(intel_dp);
> intel_dp_set_common_rates(intel_dp);
>
> - if (drm_dp_dpcd_read(&intel_dp->aux, DP_SINK_COUNT,
> - &intel_dp->sink_count, 1) < 0)
> + if (drm_dp_dpcd_readb(&intel_dp->aux, DP_SINK_COUNT,
> + &intel_dp->sink_count) <= 0)
As an additional change it would be nice to have a local variable
for this since we'll do '->sink_count = ->sink_count & SOMETHING'
further down. IMO it's somewhat confusing to first read the unmasked
valuedirectly into the final location and then mask in place.
> return false;
>
> /*
> @@ -3787,7 +3787,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
> static bool
> intel_dp_can_mst(struct intel_dp *intel_dp)
> {
> - u8 buf[1];
> + u8 mstm_cap;
>
> if (!i915.enable_dp_mst)
> return false;
> @@ -3798,10 +3798,10 @@ intel_dp_can_mst(struct intel_dp *intel_dp)
> if (intel_dp->dpcd[DP_DPCD_REV] < 0x12)
> return false;
>
> - if (drm_dp_dpcd_read(&intel_dp->aux, DP_MSTM_CAP, buf, 1) != 1)
> + if (drm_dp_dpcd_readb(&intel_dp->aux, DP_MSTM_CAP, &mstm_cap) != 1)
> return false;
>
> - return buf[0] & DP_MST_CAP;
> + return mstm_cap & DP_MST_CAP;
> }
>
> static void
> @@ -3947,9 +3947,8 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
> static bool
> intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
> {
> - return drm_dp_dpcd_read(&intel_dp->aux,
> - DP_DEVICE_SERVICE_IRQ_VECTOR,
> - sink_irq_vector, 1) == 1;
> + return drm_dp_dpcd_readb(&intel_dp->aux, DP_DEVICE_SERVICE_IRQ_VECTOR,
> + sink_irq_vector) == 1;
> }
>
> static bool
> @@ -4012,13 +4011,13 @@ static uint8_t intel_dp_autotest_link_training(struct intel_dp *intel_dp)
> static uint8_t intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
> {
> uint8_t test_pattern;
> - uint16_t test_misc;
> + uint8_t test_misc;
> __be16 h_width, v_height;
> int status = 0;
>
> /* Read the TEST_PATTERN (DP CTS 3.1.5) */
> - status = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_PATTERN,
> - &test_pattern, 1);
> + status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_PATTERN,
> + &test_pattern);
> if (status <= 0) {
> DRM_DEBUG_KMS("Test pattern read failed\n");
> return DP_TEST_NAK;
> @@ -4040,8 +4039,8 @@ static uint8_t intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
> return DP_TEST_NAK;
> }
>
> - status = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_MISC0,
> - &test_misc, 1);
> + status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_MISC0,
> + &test_misc);
> if (status <= 0) {
> DRM_DEBUG_KMS("TEST MISC read failed\n");
> return DP_TEST_NAK;
> @@ -4100,10 +4099,8 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp)
> */
> block += intel_connector->detect_edid->extensions;
>
> - if (!drm_dp_dpcd_write(&intel_dp->aux,
> - DP_TEST_EDID_CHECKSUM,
> - &block->checksum,
> - 1))
> + if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_EDID_CHECKSUM,
> + block->checksum) <= 0)
> DRM_DEBUG_KMS("Failed to write EDID checksum\n");
>
> test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE;
> --
> 2.1.4
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-02-03 17:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 14:19 [PATCH v2 00/13] drm/i915/dp: link rate and lane count refactoring Jani Nikula
2017-02-03 14:19 ` [PATCH v2 01/13] drm/i915/dp: use known correct array size in rate_to_index Jani Nikula
2017-02-03 14:19 ` [PATCH v2 02/13] drm/i915/dp: return errors from rate_to_index() Jani Nikula
2017-02-03 14:19 ` [PATCH v2 03/13] drm/i915/dp: rename rate_to_index() to intel_dp_rate_index() and reuse Jani Nikula
2017-02-03 14:19 ` [PATCH v2 04/13] drm/i915/dp: cache source rates at init Jani Nikula
2017-02-03 14:19 ` [PATCH v2 05/13] drm/i915/dp: generate and cache sink rate array for all DP, not just eDP 1.4 Jani Nikula
2017-02-03 17:16 ` Ville Syrjälä
2017-02-04 9:10 ` Jani Nikula
2017-02-03 14:19 ` [PATCH v2 06/13] drm/i915/dp: use the sink rates array for max sink rates Jani Nikula
2017-02-03 14:19 ` [PATCH v2 07/13] drm/i915/dp: cache common rates with " Jani Nikula
2017-02-03 14:19 ` [PATCH v2 08/13] drm/i915/dp: do not limit rate seek when not needed Jani Nikula
2017-02-03 14:19 ` [PATCH v2 09/13] drm/i915/dp: don't call the link parameters sink parameters Jani Nikula
2017-02-03 14:19 ` [PATCH v2 10/13] drm/i915/dp: add functions for max common link rate and lane count Jani Nikula
2017-02-03 14:19 ` [PATCH v2 11/13] drm/i915/mst: use max link not sink " Jani Nikula
2017-02-03 14:19 ` [PATCH v2 12/13] drm/i915/dp: localize link rate index variable more Jani Nikula
2017-02-07 20:17 ` Manasi Navare
2017-02-03 14:19 ` [PATCH v2 13/13] drm/i915/dp: use readb and writeb calls for single byte DPCD access Jani Nikula
2017-02-03 17:25 ` Ville Syrjälä [this message]
2017-02-03 16:56 ` ✗ Fi.CI.BAT: failure for drm/i915/dp: link rate and lane count refactoring (rev2) Patchwork
2017-02-07 20:15 ` [PATCH v2 00/13] drm/i915/dp: link rate and lane count refactoring Manasi Navare
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=20170203172509.GM31595@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dhinakaran.pandiyan@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.