From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: [PATCH v2 4/5] usb: typec: ucsi: add update_connector callback
Date: Thu, 11 Apr 2024 07:49:56 +0300 [thread overview]
Message-ID: <20240411-ucsi-orient-aware-v2-4-d4b1cb22a33f@linaro.org> (raw)
In-Reply-To: <20240411-ucsi-orient-aware-v2-0-d4b1cb22a33f@linaro.org>
Add a callback to allow glue drivers to update the connector before
registering corresponding power supply and Type-C port. In particular
this is useful if glue drivers want to touch the connector's Type-C
capabilities structure.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/usb/typec/ucsi/ucsi.c | 3 +++
drivers/usb/typec/ucsi/ucsi.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 7ad544c968e4..57e73b823a4c 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1559,6 +1559,9 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
cap->driver_data = con;
cap->ops = &ucsi_ops;
+ if (ucsi->ops->update_connector)
+ ucsi->ops->update_connector(con);
+
ret = ucsi_register_port_psy(con);
if (ret)
goto out;
diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 3e1241e38f3c..c4d103db9d0f 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -60,6 +60,7 @@ struct dentry;
* @sync_write: Blocking write operation
* @async_write: Non-blocking write operation
* @update_altmodes: Squashes duplicate DP altmodes
+ * @update_connector: Update connector capabilities before registering
* @connector_status: Updates connector status, called holding connector lock
*
* Read and write routines for UCSI interface. @sync_write must wait for the
@@ -75,6 +76,7 @@ struct ucsi_operations {
const void *val, size_t val_len);
bool (*update_altmodes)(struct ucsi *ucsi, struct ucsi_altmode *orig,
struct ucsi_altmode *updated);
+ void (*update_connector)(struct ucsi_connector *con);
void (*connector_status)(struct ucsi_connector *con);
};
--
2.39.2
next prev parent reply other threads:[~2024-04-11 4:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 4:49 [PATCH v2 0/5] usb: typec: ucsi: glink: rework orientation handling Dmitry Baryshkov
2024-04-11 4:49 ` [PATCH v2 1/5] usb: typec: ucsi: add callback for connector status updates Dmitry Baryshkov
2024-04-15 6:57 ` Heikki Krogerus
2024-04-11 4:49 ` [PATCH v2 2/5] usb: typec: ucsi: glink: move GPIO reading into connector_status callback Dmitry Baryshkov
2024-04-15 6:58 ` Heikki Krogerus
2024-04-11 4:49 ` [PATCH v2 3/5] usb: typec: ucsi: glink: use typec_set_orientation Dmitry Baryshkov
2024-04-15 6:59 ` Heikki Krogerus
2024-04-11 4:49 ` Dmitry Baryshkov [this message]
2024-04-15 7:03 ` [PATCH v2 4/5] usb: typec: ucsi: add update_connector callback Heikki Krogerus
2024-04-11 4:49 ` [PATCH v2 5/5] usb: typec: ucsi: glink: set orientation aware if supported Dmitry Baryshkov
2024-04-15 7:08 ` Heikki Krogerus
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=20240411-ucsi-orient-aware-v2-4-d4b1cb22a33f@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=neil.armstrong@linaro.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
all inboxes | Powered by JetHome®