From: Kyle Tso <kyletso@google.com>
To: linux@roeck-us.net, heikki.krogerus@linux.intel.com,
gregkh@linuxfoundation.org, robh+dt@kernel.org,
hdegoede@redhat.com, badhri@google.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Kyle Tso <kyletso@google.com>
Subject: [PATCH 3/3] usb: typec: tcpm: Get Sink VDO from fwnode
Date: Tue, 26 Jan 2021 16:45:44 +0800 [thread overview]
Message-ID: <20210126084544.682641-4-kyletso@google.com> (raw)
In-Reply-To: <20210126084544.682641-1-kyletso@google.com>
Current design only allows TCPM to get the Sink VDO from TCPC configs.
Add an additional way from fwnode.
Signed-off-by: Kyle Tso <kyletso@google.com>
---
drivers/usb/typec/tcpm/tcpm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index c14cf7842520..7b797d14d9db 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -5673,6 +5673,18 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
port->new_source_frs_current = frs_current;
}
+ ret = fwnode_property_read_u32_array(fwnode, "sink-vdos", NULL, 0);
+ if (ret <= 0 && ret != -EINVAL) {
+ return -EINVAL;
+ } else if (ret > 0) {
+ port->nr_snk_vdo = min(ret, VDO_MAX_OBJECTS);
+ ret = fwnode_property_read_u32_array(fwnode, "sink-vdos",
+ port->snk_vdo,
+ port->nr_snk_vdo);
+ if (ret < 0)
+ return -EINVAL;
+ }
+
return 0;
}
--
2.30.0.280.ga3ce27912f-goog
prev parent reply other threads:[~2021-01-26 17:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 8:45 [PATCH 0/3] common SVDM version and VDO from dt Kyle Tso
2021-01-26 8:45 ` [PATCH 1/3] usb: typec: Determine common SVDM Versions Kyle Tso
2021-01-26 15:07 ` Guenter Roeck
2021-01-26 8:45 ` [PATCH 2/3] dt-bindings: connector: Add SVDM VDO properties Kyle Tso
2021-01-26 15:15 ` Guenter Roeck
2021-01-26 8:45 ` Kyle Tso [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=20210126084544.682641-4-kyletso@google.com \
--to=kyletso@google.com \
--cc=badhri@google.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).