public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Prashant Malani <pmalani@chromium.org>
To: "Patel, Utkarsh H" <utkarsh.h.patel@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"heikki.krogerus@linux.intel.com"
	<heikki.krogerus@linux.intel.com>,
	"chrome-platform@lists.linux.dev"
	<chrome-platform@lists.linux.dev>,
	"andriy.shevchenko@linux.intel.com" 
	<andriy.shevchenko@linux.intel.com>,
	"bleung@chromium.org" <bleung@chromium.org>
Subject: Re: [PATCH v2 4/5] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support
Date: Fri, 8 Sep 2023 17:03:10 +0000	[thread overview]
Message-ID: <ZPtTzovOMJ2gmPdy@chromium.org> (raw)
In-Reply-To: <MWHPR11MB0048D87555CACAC4DC7DF1DFA9E5A@MWHPR11MB0048.namprd11.prod.outlook.com>

Hi Utkarsh,

Just a minor thing you can fix for the next version (since it looks
like there will be one).

On Aug 31 15:24, Patel, Utkarsh H wrote:
> Hello,
> 
> >  drivers/platform/chrome/cros_ec_typec.c | 31
> > +++++++++++++++++++++++++
> >  1 file changed, 31 insertions(+)
> > 
> > diff --git a/drivers/platform/chrome/cros_ec_typec.c
> > b/drivers/platform/chrome/cros_ec_typec.c
> > index d0b4d3fc40ed..8372f13052a8 100644
> > --- a/drivers/platform/chrome/cros_ec_typec.c
> > +++ b/drivers/platform/chrome/cros_ec_typec.c
> > @@ -492,6 +492,8 @@ static int cros_typec_enable_dp(struct
> > cros_typec_data *typec,  {
> >  	struct cros_typec_port *port = typec->ports[port_num];
> >  	struct typec_displayport_data dp_data;
> > +	u32 cable_tbt_vdo;
> > +	u32 cable_dp_vdo;
> >  	int ret;
> > 
> >  	if (typec->pd_ctrl_ver < 2) {
> > @@ -524,6 +526,35 @@ static int cros_typec_enable_dp(struct
> > cros_typec_data *typec,
> >  	port->state.data = &dp_data;
> >  	port->state.mode = TYPEC_MODAL_STATE(ffs(pd_ctrl->dp_mode));
> > 
> > +	/* Get cable VDO for cables with DPSID to check DPAM2.1 is
> > supported */
> > +	cable_dp_vdo = cros_typec_get_cable_vdo(port,
> > USB_TYPEC_DP_SID);
> > +
> > +	/**
> > +	 * Get cable VDO for thunderbolt cables and cables with DPSID but
> > does not
> > +	 * support DPAM2.1.
> > +	 */
> > +	cable_tbt_vdo = cros_typec_get_cable_vdo(port,
> > USB_TYPEC_TBT_SID);
> > +
> > +	if (cable_dp_vdo & DP_CAP_DPAM_VERSION) {
> > +		dp_data.conf |= cable_dp_vdo;
> > +	} else if (cable_tbt_vdo) {
> > +		u8 cable_speed = TBT_CABLE_SPEED(cable_tbt_vdo);
Can we declare this variable at the top? That is the style in this
file and quite commonly seen elsewhere.

Or better yet, just inline this and get rid of the extra variable altogether:

	dp_data.conf |= TBT_CABLE_SPEED(...) << DP_CONF_SIGNALLING_SHIFT;

> > +
> > +		dp_data.conf |= cable_speed <<
> > DP_CONF_SIGNALLING_SHIFT;
> > +
> > +		/* Cable Type */
> > +		if (cable_tbt_vdo & TBT_CABLE_OPTICAL)
> > +			dp_data.conf |= DP_CONF_CABLE_TYPE_OPTICAL <<
> > DP_CONF_CABLE_TYPE_SHIFT;
> > +		else if (cable_tbt_vdo & TBT_CABLE_RETIMER)
> > +			dp_data.conf |= DP_CONF_CABLE_TYPE_RE_TIMER <<
> > DP_CONF_CABLE_TYPE_SHIFT;
> > +		else if (cable_tbt_vdo & TBT_CABLE_ACTIVE_PASSIVE)
> > +			dp_data.conf |= DP_CONF_CABLE_TYPE_RE_DRIVER
> > << DP_CONF_CABLE_TYPE_SHIFT;
> > +	} else if (PD_IDH_PTYPE(port->c_identity.id_header) ==
> > IDH_PTYPE_PCABLE) {
> > +		u8 cable_speed = VDO_CABLE_SPEED(port-
> > >c_identity.vdo[0]);
Same here, you can inline this without affecting readability too much.


BR,

-Prashant

  reply	other threads:[~2023-09-08 17:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 22:39 [PATCH v2 0/5] Displayport Alternate Mode 2.1 Support Utkarsh Patel
2023-08-30 22:39 ` [PATCH v2 1/5] usb: typec: Add " Utkarsh Patel
2023-08-30 22:39 ` [PATCH v2 2/5] usb: typec: Add Active or Passive cable defination to cable discover mode VDO Utkarsh Patel
2023-09-04  7:07   ` Heikki Krogerus
2023-08-30 22:39 ` [PATCH v2 3/5] usb: pd: Add helper macro to get Type C cable speed Utkarsh Patel
2023-09-04  7:08   ` Heikki Krogerus
2023-09-04  7:11     ` Heikki Krogerus
2023-09-05 23:47       ` Patel, Utkarsh H
2023-08-30 22:39 ` [PATCH v2 4/5] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support Utkarsh Patel
2023-08-31 15:24   ` Patel, Utkarsh H
2023-09-08 17:03     ` Prashant Malani [this message]
2023-09-08 20:11       ` Patel, Utkarsh H
2023-08-30 22:39 ` [PATCH v2 5/5] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1 Utkarsh Patel

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=ZPtTzovOMJ2gmPdy@chromium.org \
    --to=pmalani@chromium.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=utkarsh.h.patel@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