public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kahola <mika.kahola@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 05/11] drm: Helper to read max bits per component
Date: Thu, 09 Jun 2016 13:08:04 +0300	[thread overview]
Message-ID: <1465466884.3390.35.camel@sorvi> (raw)
In-Reply-To: <20160609080223.GA4329@intel.com>

On Thu, 2016-06-09 at 11:02 +0300, Ville Syrjälä wrote:
> On Mon, Jun 06, 2016 at 04:29:07PM +0300, Mika Kahola wrote:
> > Helper routine to read out maximum supported bits per
> > component for DisplayPort legay converters.
> > 
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  drivers/gpu/drm/drm_dp_helper.c | 31 +++++++++++++++++++++++++++++++
> >  include/drm/drm_dp_helper.h     |  2 ++
> >  2 files changed, 33 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> > index 18b72eb..bac0ccc 100644
> > --- a/drivers/gpu/drm/drm_dp_helper.c
> > +++ b/drivers/gpu/drm/drm_dp_helper.c
> > @@ -507,6 +507,37 @@ int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
> >  }
> >  EXPORT_SYMBOL(drm_dp_downstream_max_clock);
> >  
> > +/**
> > + * drm_dp_downstream_max_bpc() - extract branch device max
> > + *                               bits per component
> > + * @dpcd: DisplayPort configuration data
> > + * @port_cap: port capabilities
> > + *
> > + * Returns max bpc on success or negative error code on failure
> > + */
> > +int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
> > +                              const u8 port_cap[4])
> > +{
> > +	int type = drm_dp_downstream_type(dpcd, port_cap);
> > +	bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] &
> > +		DP_DETAILED_CAP_INFO_AVAILABLE;
> > +
> > +	if (detailed_cap_info) {
> 
> Early return again.
> 
> > +		if (type != DP_DS_PORT_TYPE_WIRELESS) {
> 
> switch() again.
> 
> > +			int tmp;
> > +			tmp = port_cap[2] & DP_DS_VGA_MAX_BPC_MASK;
> 
> Should drop the "VGA" from that stuff since it applies to more than
> that.

Agreed. Maybe we could rename it as DP_DS_MAX_BPC_MASK instead.

> 
> > +
> > +			if (tmp == 0)
> > +				return 8;
> > +			else
> > +				return 8 + (1<<tmp);
> 
> switch() with each case would be less magicy.
> 
> > +		}
> > +	}
> > +
> > +	return -EINVAL;
> 
> Again I think I'd just use 0 here.
> 
> > +}
> > +EXPORT_SYMBOL(drm_dp_downstream_max_bpc);
> > +
> >  /*
> >   * I2C-over-AUX implementation
> >   */
> > diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> > index c3324d3..d4abc38 100644
> > --- a/include/drm/drm_dp_helper.h
> > +++ b/include/drm/drm_dp_helper.h
> > @@ -812,6 +812,8 @@ int drm_dp_downstream_port_cap(struct drm_dp_aux *aux,
> >  int drm_dp_downstream_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE], const u8 port_cap[4]);
> >  int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
> >                                  const u8 port_cap[4]);
> > +int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE],
> > +                              const u8 port_cap[4]);
> >  
> >  int drm_dp_aux_register(struct drm_dp_aux *aux);
> >  void drm_dp_aux_unregister(struct drm_dp_aux *aux);
> > -- 
> > 1.9.1
> 

-- 
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-06-09 10:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 13:29 [PATCH v4 00/11] drm/i915: DP branch devices Mika Kahola
2016-06-06 13:29 ` [PATCH v4 01/11] drm: Add missing DP downstream port types Mika Kahola
2016-06-06 13:29 ` [PATCH v4 02/11] drm: Read DP downstream port capabilities Mika Kahola
2016-06-06 16:00   ` kbuild test robot
2016-06-09  7:52   ` Ville Syrjälä
2016-06-06 13:29 ` [PATCH v4 03/11] drm: Helper to read DP branch device type Mika Kahola
2016-06-09  7:57   ` Ville Syrjälä
2016-06-06 13:29 ` [PATCH v4 04/11] drm: Helper to read max clock rate Mika Kahola
2016-06-09  7:59   ` Ville Syrjälä
2016-06-06 13:29 ` [PATCH v4 05/11] drm: Helper to read max bits per component Mika Kahola
2016-06-09  8:02   ` Ville Syrjälä
2016-06-09 10:08     ` Mika Kahola [this message]
2016-06-06 13:29 ` [PATCH v4 06/11] drm: Read DP branch device id Mika Kahola
2016-06-06 17:55   ` kbuild test robot
2016-06-06 13:29 ` [PATCH v4 07/11] drm: Read DP branch device HW revision Mika Kahola
2016-06-06 13:29 ` [PATCH v4 08/11] drm: Read DP branch device SW revision Mika Kahola
2016-06-06 13:29 ` [PATCH v4 09/11] drm/i915: Check pixel rate for DP to VGA dongle Mika Kahola
2016-06-09  8:14   ` Ville Syrjälä
2016-06-09  8:27     ` Kahola, Mika
2016-06-06 13:29 ` [PATCH v4 10/11] drm/i915: Update bits per component for display info Mika Kahola
2016-06-06 13:29 ` [PATCH v4 11/11] drm/i915: Add DP branch device info on debugfs Mika Kahola
2016-06-06 14:03 ` ✗ Ro.CI.BAT: warning for drm/i915: DP branch devices (rev4) 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=1465466884.3390.35.camel@sorvi \
    --to=mika.kahola@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox