From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Akash Kumar <akash.kumar@oss.qualcomm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Wayne Chang <waynec@nvidia.com>,
linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] usb: typec: ucsi_ccg: Add CC orientation sensing via GPIO
Date: Fri, 20 Nov 2026 15:51:57 +0100 [thread overview]
Message-ID: <awBejZc8L1z7lcgi@black.igk.intel.com> (raw)
In-Reply-To: <20261117-ucsi-ccg-cc-orientation-v2-2-2e3576a11eb7@qti.qualcomm.com>
Hi,
> +static void ucsi_ccg_connector_status(struct ucsi_connector *con)
> +{
> + struct ucsi_ccg *uc = ucsi_get_drvdata(con->ucsi);
> + int orientation;
> +
> + if (!UCSI_CONSTAT(con, CONNECTED)) {
> + typec_set_orientation(con->port, TYPEC_ORIENTATION_NONE);
> + return;
> + }
> +
> + if (con->num > CCG_MAX_PORTS || !uc->orientation_gpio[con->num - 1])
> + return;
> +
> + orientation = gpiod_get_value_cansleep(uc->orientation_gpio[con->num - 1]);
> + if (orientation >= 0)
> + typec_set_orientation(con->port,
> + orientation ? TYPEC_ORIENTATION_REVERSE :
> + TYPEC_ORIENTATION_NORMAL);
> +}
Looks like you have a small allignment issue here.
Maybe it would be more clear to return if the orientation is < 0.
orientation = gpiod_get_value_cansleep(uc->orientation_gpio[con->num - 1]);
if (orientation < 0)
return;
typec_set_orientation(con->port, orientation ? TYPEC_ORIENTATION_REVERSE :
TYPEC_ORIENTATION_NORMAL);
Thanks,
--
heikki
prev parent reply other threads:[~2026-11-20 14:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 14:09 [PATCH v2 0/2] usb: typec: ucsi_ccg: Add CC orientation-gpios support Akash Kumar
2026-11-17 14:09 ` [PATCH v2 1/2] dt-bindings: usb: cypress,cypd4226: Add orientation-gpios property Akash Kumar
2026-11-20 14:50 ` Heikki Krogerus
2026-11-17 14:09 ` [PATCH v2 2/2] usb: typec: ucsi_ccg: Add CC orientation sensing via GPIO Akash Kumar
2026-11-20 14:51 ` Heikki Krogerus [this message]
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=awBejZc8L1z7lcgi@black.igk.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=akash.kumar@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=robh@kernel.org \
--cc=waynec@nvidia.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