* [PATCH v6 1/8] platform/chrome: Update ChromeOS EC header for UCSI
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
@ 2024-09-10 10:15 ` Łukasz Bartosik
2024-09-18 6:32 ` Tzung-Bi Shih
2024-09-10 10:15 ` [PATCH v6 2/8] platform/chrome: Update EC feature flags Łukasz Bartosik
` (8 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-10 10:15 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
From: Pavan Holla <pholla@chromium.org>
Add EC host commands for reading and writing UCSI structures
in the EC. The corresponding kernel driver is cros-ec-ucsi.
Also update PD events supported by the EC.
Signed-off-by: Pavan Holla <pholla@chromium.org>
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
.../linux/platform_data/cros_ec_commands.h | 28 ++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
index e574b790be6f..8dbb6a769e4f 100644
--- a/include/linux/platform_data/cros_ec_commands.h
+++ b/include/linux/platform_data/cros_ec_commands.h
@@ -5012,8 +5012,11 @@ struct ec_response_pd_status {
#define PD_EVENT_POWER_CHANGE BIT(1)
#define PD_EVENT_IDENTITY_RECEIVED BIT(2)
#define PD_EVENT_DATA_SWAP BIT(3)
+#define PD_EVENT_TYPEC BIT(4)
+#define PD_EVENT_PPM BIT(5)
+
struct ec_response_host_event_status {
- uint32_t status; /* PD MCU host event status */
+ uint32_t status; /* PD MCU host event status */
} __ec_align4;
/* Set USB type-C port role and muxes */
@@ -6073,6 +6076,29 @@ struct ec_response_typec_vdm_response {
#undef VDO_MAX_SIZE
+/*
+ * UCSI OPM-PPM commands
+ *
+ * These commands are used for communication between OPM and PPM.
+ * Only UCSI3.0 is tested.
+ */
+
+#define EC_CMD_UCSI_PPM_SET 0x0140
+
+/* The data size is stored in the host command protocol header. */
+struct ec_params_ucsi_ppm_set {
+ uint16_t offset;
+ uint8_t data[];
+} __ec_align2;
+
+#define EC_CMD_UCSI_PPM_GET 0x0141
+
+/* For 'GET' sub-commands, data will be returned as a raw payload. */
+struct ec_params_ucsi_ppm_get {
+ uint16_t offset;
+ uint8_t size;
+} __ec_align2;
+
/*****************************************************************************/
/* The command range 0x200-0x2FF is reserved for Rotor. */
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 35+ messages in thread* Re: [PATCH v6 1/8] platform/chrome: Update ChromeOS EC header for UCSI
2024-09-10 10:15 ` [PATCH v6 1/8] platform/chrome: Update ChromeOS EC header for UCSI Łukasz Bartosik
@ 2024-09-18 6:32 ` Tzung-Bi Shih
0 siblings, 0 replies; 35+ messages in thread
From: Tzung-Bi Shih @ 2024-09-18 6:32 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Abhishek Pandit-Subedi, Pavan Holla, linux-usb,
chrome-platform
On Tue, Sep 10, 2024 at 10:15:20AM +0000, Łukasz Bartosik wrote:
> From: Pavan Holla <pholla@chromium.org>
>
> Add EC host commands for reading and writing UCSI structures
> in the EC. The corresponding kernel driver is cros-ec-ucsi.
>
> Also update PD events supported by the EC.
>
> Signed-off-by: Pavan Holla <pholla@chromium.org>
> Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v6 2/8] platform/chrome: Update EC feature flags
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
2024-09-10 10:15 ` [PATCH v6 1/8] platform/chrome: Update ChromeOS EC header for UCSI Łukasz Bartosik
@ 2024-09-10 10:15 ` Łukasz Bartosik
2024-09-18 6:32 ` Tzung-Bi Shih
` (2 more replies)
2024-09-10 10:15 ` [PATCH v6 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver Łukasz Bartosik
` (7 subsequent siblings)
9 siblings, 3 replies; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-10 10:15 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
From: Pavan Holla <pholla@chromium.org>
Define EC_FEATURE_UCSI_PPM to enable usage of the cros_ec_ucsi
driver. Also, add any feature flags that are implemented by the EC
but are missing in the kernel header.
Signed-off-by: Pavan Holla <pholla@chromium.org>
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
.../linux/platform_data/cros_ec_commands.h | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
index 8dbb6a769e4f..ecf290a0c98f 100644
--- a/include/linux/platform_data/cros_ec_commands.h
+++ b/include/linux/platform_data/cros_ec_commands.h
@@ -1312,6 +1312,38 @@ enum ec_feature_code {
* The EC supports the AP composing VDMs for us to send.
*/
EC_FEATURE_TYPEC_AP_VDM_SEND = 46,
+ /*
+ * The EC supports system safe mode panic recovery.
+ */
+ EC_FEATURE_SYSTEM_SAFE_MODE = 47,
+ /*
+ * The EC will reboot on runtime assertion failures.
+ */
+ EC_FEATURE_ASSERT_REBOOTS = 48,
+ /*
+ * The EC image is built with tokenized logging enabled.
+ */
+ EC_FEATURE_TOKENIZED_LOGGING = 49,
+ /*
+ * The EC supports triggering an STB dump.
+ */
+ EC_FEATURE_AMD_STB_DUMP = 50,
+ /*
+ * The EC supports memory dump commands.
+ */
+ EC_FEATURE_MEMORY_DUMP = 51,
+ /*
+ * The EC supports DP2.1 capability
+ */
+ EC_FEATURE_TYPEC_DP2_1 = 52,
+ /*
+ * The MCU is System Companion Processor Core 1
+ */
+ EC_FEATURE_SCP_C1 = 53,
+ /*
+ * The EC supports UCSI PPM.
+ */
+ EC_FEATURE_UCSI_PPM = 54,
};
#define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32)
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 35+ messages in thread* Re: [PATCH v6 2/8] platform/chrome: Update EC feature flags
2024-09-10 10:15 ` [PATCH v6 2/8] platform/chrome: Update EC feature flags Łukasz Bartosik
@ 2024-09-18 6:32 ` Tzung-Bi Shih
2024-10-11 7:27 ` Lee Jones
2024-10-15 9:10 ` (subset) " Lee Jones
2 siblings, 0 replies; 35+ messages in thread
From: Tzung-Bi Shih @ 2024-09-18 6:32 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Abhishek Pandit-Subedi, Pavan Holla, linux-usb,
chrome-platform
On Tue, Sep 10, 2024 at 10:15:21AM +0000, Łukasz Bartosik wrote:
> From: Pavan Holla <pholla@chromium.org>
>
> Define EC_FEATURE_UCSI_PPM to enable usage of the cros_ec_ucsi
> driver. Also, add any feature flags that are implemented by the EC
> but are missing in the kernel header.
>
> Signed-off-by: Pavan Holla <pholla@chromium.org>
> Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v6 2/8] platform/chrome: Update EC feature flags
2024-09-10 10:15 ` [PATCH v6 2/8] platform/chrome: Update EC feature flags Łukasz Bartosik
2024-09-18 6:32 ` Tzung-Bi Shih
@ 2024-10-11 7:27 ` Lee Jones
2024-10-11 9:17 ` Łukasz Bartosik
2024-10-15 9:10 ` (subset) " Lee Jones
2 siblings, 1 reply; 35+ messages in thread
From: Lee Jones @ 2024-10-11 7:27 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Heikki Krogerus, Greg Kroah-Hartman, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Tue, 10 Sep 2024, Łukasz Bartosik wrote:
> From: Pavan Holla <pholla@chromium.org>
>
> Define EC_FEATURE_UCSI_PPM to enable usage of the cros_ec_ucsi
> driver. Also, add any feature flags that are implemented by the EC
> but are missing in the kernel header.
>
> Signed-off-by: Pavan Holla <pholla@chromium.org>
> Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> ---
> .../linux/platform_data/cros_ec_commands.h | 32 +++++++++++++++++++
> 1 file changed, 32 insertions(+)
Looks as though this is only used in the MFD patches which breaks
without them. Can I take it without sending out a PR please?
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v6 2/8] platform/chrome: Update EC feature flags
2024-10-11 7:27 ` Lee Jones
@ 2024-10-11 9:17 ` Łukasz Bartosik
0 siblings, 0 replies; 35+ messages in thread
From: Łukasz Bartosik @ 2024-10-11 9:17 UTC (permalink / raw)
To: Lee Jones
Cc: Heikki Krogerus, Greg Kroah-Hartman, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Fri, Oct 11, 2024 at 9:27 AM Lee Jones <lee@kernel.org> wrote:
>
> On Tue, 10 Sep 2024, Łukasz Bartosik wrote:
>
> > From: Pavan Holla <pholla@chromium.org>
> >
> > Define EC_FEATURE_UCSI_PPM to enable usage of the cros_ec_ucsi
> > driver. Also, add any feature flags that are implemented by the EC
> > but are missing in the kernel header.
> >
> > Signed-off-by: Pavan Holla <pholla@chromium.org>
> > Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> > ---
> > .../linux/platform_data/cros_ec_commands.h | 32 +++++++++++++++++++
> > 1 file changed, 32 insertions(+)
>
> Looks as though this is only used in the MFD patches which breaks
> without them. Can I take it without sending out a PR please?
>
Yes please take this patch.
Thank you,
Lukasz
> --
> Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: (subset) [PATCH v6 2/8] platform/chrome: Update EC feature flags
2024-09-10 10:15 ` [PATCH v6 2/8] platform/chrome: Update EC feature flags Łukasz Bartosik
2024-09-18 6:32 ` Tzung-Bi Shih
2024-10-11 7:27 ` Lee Jones
@ 2024-10-15 9:10 ` Lee Jones
2 siblings, 0 replies; 35+ messages in thread
From: Lee Jones @ 2024-10-15 9:10 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Łukasz Bartosik
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Tue, 10 Sep 2024 10:15:21 +0000, Łukasz Bartosik wrote:
> Define EC_FEATURE_UCSI_PPM to enable usage of the cros_ec_ucsi
> driver. Also, add any feature flags that are implemented by the EC
> but are missing in the kernel header.
>
>
Applied, thanks!
[2/8] platform/chrome: Update EC feature flags
commit: 04a6116a36dfb86c80c930aaa03c66c2deb8e434
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v6 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
2024-09-10 10:15 ` [PATCH v6 1/8] platform/chrome: Update ChromeOS EC header for UCSI Łukasz Bartosik
2024-09-10 10:15 ` [PATCH v6 2/8] platform/chrome: Update EC feature flags Łukasz Bartosik
@ 2024-09-10 10:15 ` Łukasz Bartosik
2024-09-12 12:58 ` Dmitry Baryshkov
2024-09-10 10:15 ` [PATCH v6 4/8] usb: typec: cros_ec_ucsi: Use complete instead of resume Łukasz Bartosik
` (6 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-10 10:15 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
From: Pavan Holla <pholla@chromium.org>
Implementation of a UCSI transport driver for ChromeOS.
This driver will be loaded if the ChromeOS EC implements a PPM.
Signed-off-by: Pavan Holla <pholla@chromium.org>
Co-developed-by: Łukasz Bartosik <ukaszb@chromium.org>
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
MAINTAINERS | 7 +
drivers/usb/typec/ucsi/Kconfig | 13 ++
drivers/usb/typec/ucsi/Makefile | 1 +
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 273 ++++++++++++++++++++++++++
4 files changed, 294 insertions(+)
create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi.c
diff --git a/MAINTAINERS b/MAINTAINERS
index fe83ba7194ea..8c030ea0b503 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5300,6 +5300,13 @@ L: chrome-platform@lists.linux.dev
S: Maintained
F: drivers/watchdog/cros_ec_wdt.c
+CHROMEOS UCSI DRIVER
+M: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
+M: Łukasz Bartosik <ukaszb@chromium.org>
+L: chrome-platform@lists.linux.dev
+S: Maintained
+F: drivers/usb/typec/ucsi/cros_ec_ucsi.c
+
CHRONTEL CH7322 CEC DRIVER
M: Joe Tessler <jrt@google.com>
L: linux-media@vger.kernel.org
diff --git a/drivers/usb/typec/ucsi/Kconfig b/drivers/usb/typec/ucsi/Kconfig
index 680e1b87b152..75559601fe8f 100644
--- a/drivers/usb/typec/ucsi/Kconfig
+++ b/drivers/usb/typec/ucsi/Kconfig
@@ -69,6 +69,19 @@ config UCSI_PMIC_GLINK
To compile the driver as a module, choose M here: the module will be
called ucsi_glink.
+config CROS_EC_UCSI
+ tristate "UCSI Driver for ChromeOS EC"
+ depends on MFD_CROS_EC_DEV
+ depends on CROS_USBPD_NOTIFY
+ depends on !EXTCON_TCSS_CROS_EC
+ default MFD_CROS_EC_DEV
+ help
+ This driver enables UCSI support for a ChromeOS EC. The EC is
+ expected to implement a PPM.
+
+ To compile the driver as a module, choose M here: the module
+ will be called cros_ec_ucsi.
+
config UCSI_LENOVO_YOGA_C630
tristate "UCSI Interface Driver for Lenovo Yoga C630"
depends on EC_LENOVO_YOGA_C630
diff --git a/drivers/usb/typec/ucsi/Makefile b/drivers/usb/typec/ucsi/Makefile
index aed41d23887b..be98a879104d 100644
--- a/drivers/usb/typec/ucsi/Makefile
+++ b/drivers/usb/typec/ucsi/Makefile
@@ -21,4 +21,5 @@ obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o
obj-$(CONFIG_UCSI_CCG) += ucsi_ccg.o
obj-$(CONFIG_UCSI_STM32G0) += ucsi_stm32g0.o
obj-$(CONFIG_UCSI_PMIC_GLINK) += ucsi_glink.o
+obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o
obj-$(CONFIG_UCSI_LENOVO_YOGA_C630) += ucsi_yoga_c630.o
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
new file mode 100644
index 000000000000..20e608097fc6
--- /dev/null
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
@@ -0,0 +1,273 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * UCSI driver for ChromeOS EC
+ *
+ * Copyright 2024 Google LLC.
+ */
+
+#include <linux/container_of.h>
+#include <linux/dev_printk.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/platform_data/cros_ec_commands.h>
+#include <linux/platform_data/cros_usbpd_notify.h>
+#include <linux/platform_data/cros_ec_proto.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/wait.h>
+
+#include "ucsi.h"
+
+/*
+ * Maximum size in bytes of a UCSI message between AP and EC
+ */
+#define MAX_EC_DATA_SIZE 256
+
+/*
+ * Maximum time in miliseconds the cros_ec_ucsi driver
+ * will wait for a response to a command or and ack.
+ */
+#define WRITE_TMO_MS 5000
+
+struct cros_ucsi_data {
+ struct device *dev;
+ struct ucsi *ucsi;
+
+ struct cros_ec_device *ec;
+ struct notifier_block nb;
+ struct work_struct work;
+
+ struct completion complete;
+ unsigned long flags;
+};
+
+static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
+ size_t val_len)
+{
+ struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi);
+ struct ec_params_ucsi_ppm_get req = {
+ .offset = offset,
+ .size = val_len,
+ };
+ int ret;
+
+ if (val_len > MAX_EC_DATA_SIZE) {
+ dev_err(udata->dev, "Can't read %zu bytes. Too big.", val_len);
+ return -EINVAL;
+ }
+
+ ret = cros_ec_cmd(udata->ec, 0, EC_CMD_UCSI_PPM_GET,
+ &req, sizeof(req), val, val_len);
+ if (ret < 0) {
+ dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_GET: error=%d", ret);
+ return ret;
+ }
+ return 0;
+}
+
+static int cros_ucsi_read_version(struct ucsi *ucsi, u16 *version)
+{
+ return cros_ucsi_read(ucsi, UCSI_VERSION, version, sizeof(*version));
+}
+
+static int cros_ucsi_read_cci(struct ucsi *ucsi, u32 *cci)
+{
+ return cros_ucsi_read(ucsi, UCSI_CCI, cci, sizeof(*cci));
+}
+
+static int cros_ucsi_read_message_in(struct ucsi *ucsi, void *val,
+ size_t val_len)
+{
+ return cros_ucsi_read(ucsi, UCSI_MESSAGE_IN, val, val_len);
+}
+
+static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
+{
+ struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi);
+ u8 ec_buf[sizeof(struct ec_params_ucsi_ppm_set) + sizeof(cmd)];
+ struct ec_params_ucsi_ppm_set *req = (struct ec_params_ucsi_ppm_set *) ec_buf;
+ int ret;
+
+ req->offset = UCSI_CONTROL;
+ memcpy(req->data, &cmd, sizeof(cmd));
+ ret = cros_ec_cmd(udata->ec, 0, EC_CMD_UCSI_PPM_SET,
+ req, sizeof(ec_buf), NULL, 0);
+ if (ret < 0) {
+ dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d", ret);
+ return ret;
+ }
+ return 0;
+}
+
+static int cros_ucsi_sync_control(struct ucsi *ucsi, u64 cmd)
+{
+ struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi);
+ bool ack = UCSI_COMMAND(cmd) == UCSI_ACK_CC_CI;
+ int ret;
+
+ if (ack)
+ set_bit(ACK_PENDING, &udata->flags);
+ else
+ set_bit(COMMAND_PENDING, &udata->flags);
+
+ ret = cros_ucsi_async_control(ucsi, cmd);
+ if (ret)
+ goto out;
+
+ if (!wait_for_completion_timeout(&udata->complete, WRITE_TMO_MS))
+ ret = -ETIMEDOUT;
+
+out:
+ if (ack)
+ clear_bit(ACK_PENDING, &udata->flags);
+ else
+ clear_bit(COMMAND_PENDING, &udata->flags);
+ return ret;
+}
+
+struct ucsi_operations cros_ucsi_ops = {
+ .read_version = cros_ucsi_read_version,
+ .read_cci = cros_ucsi_read_cci,
+ .read_message_in = cros_ucsi_read_message_in,
+ .async_control = cros_ucsi_async_control,
+ .sync_control = cros_ucsi_sync_control,
+};
+
+static void cros_ucsi_work(struct work_struct *work)
+{
+ struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
+ u32 cci;
+
+ if (cros_ucsi_read_cci(udata->ucsi, &cci))
+ return;
+
+ if (UCSI_CCI_CONNECTOR(cci))
+ ucsi_connector_change(udata->ucsi, UCSI_CCI_CONNECTOR(cci));
+
+ if (cci & UCSI_CCI_ACK_COMPLETE &&
+ test_and_clear_bit(ACK_PENDING, &udata->flags))
+ complete(&udata->complete);
+ if (cci & UCSI_CCI_COMMAND_COMPLETE &&
+ test_and_clear_bit(COMMAND_PENDING, &udata->flags))
+ complete(&udata->complete);
+}
+
+static int cros_ucsi_event(struct notifier_block *nb,
+ unsigned long host_event, void *_notify)
+{
+ struct cros_ucsi_data *udata = container_of(nb, struct cros_ucsi_data, nb);
+
+ if (!(host_event & PD_EVENT_PPM))
+ return NOTIFY_OK;
+
+ dev_dbg(udata->dev, "UCSI notification received");
+ flush_work(&udata->work);
+ schedule_work(&udata->work);
+
+ return NOTIFY_OK;
+}
+
+static void cros_ucsi_destroy(struct cros_ucsi_data *udata)
+{
+ cros_usbpd_unregister_notify(&udata->nb);
+ cancel_work_sync(&udata->work);
+ ucsi_destroy(udata->ucsi);
+}
+
+static int cros_ucsi_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct cros_ec_dev *ec_data = dev_get_drvdata(dev->parent);
+ struct cros_ucsi_data *udata;
+ int ret;
+
+ udata = devm_kzalloc(dev, sizeof(*udata), GFP_KERNEL);
+ if (!udata)
+ return -ENOMEM;
+
+ udata->dev = dev;
+
+ udata->ec = ec_data->ec_dev;
+ if (!udata->ec) {
+ dev_err(dev, "couldn't find parent EC device");
+ return -ENODEV;
+ }
+
+ platform_set_drvdata(pdev, udata);
+
+ INIT_WORK(&udata->work, cros_ucsi_work);
+ init_completion(&udata->complete);
+
+ udata->ucsi = ucsi_create(dev, &cros_ucsi_ops);
+ if (IS_ERR(udata->ucsi)) {
+ dev_err(dev, "failed to allocate UCSI instance");
+ return PTR_ERR(udata->ucsi);
+ }
+
+ ucsi_set_drvdata(udata->ucsi, udata);
+
+ udata->nb.notifier_call = cros_ucsi_event;
+ ret = cros_usbpd_register_notify(&udata->nb);
+ if (ret) {
+ dev_err(dev, "failed to register notifier: error=%d", ret);
+ ucsi_destroy(udata->ucsi);
+ return ret;
+ }
+
+ ret = ucsi_register(udata->ucsi);
+ if (ret) {
+ dev_err(dev, "failed to register UCSI: error=%d", ret);
+ cros_ucsi_destroy(udata);
+ return ret;
+ }
+
+ return 0;
+}
+
+static void cros_ucsi_remove(struct platform_device *dev)
+{
+ struct cros_ucsi_data *udata = platform_get_drvdata(dev);
+
+ ucsi_unregister(udata->ucsi);
+ cros_ucsi_destroy(udata);
+}
+
+static int __maybe_unused cros_ucsi_suspend(struct device *dev)
+{
+ struct cros_ucsi_data *udata = dev_get_drvdata(dev);
+
+ cancel_work_sync(&udata->work);
+
+ return 0;
+}
+
+static int __maybe_unused cros_ucsi_resume(struct device *dev)
+{
+ struct cros_ucsi_data *udata = dev_get_drvdata(dev);
+
+ return ucsi_resume(udata->ucsi);
+}
+
+static SIMPLE_DEV_PM_OPS(cros_ucsi_pm_ops, cros_ucsi_suspend,
+ cros_ucsi_resume);
+
+static const struct platform_device_id cros_ucsi_id[] = {
+ { KBUILD_MODNAME, 0 },
+ {}
+};
+MODULE_DEVICE_TABLE(platform, cros_ucsi_id);
+
+static struct platform_driver cros_ucsi_driver = {
+ .driver = {
+ .name = KBUILD_MODNAME,
+ .pm = &cros_ucsi_pm_ops,
+ },
+ .id_table = cros_ucsi_id,
+ .probe = cros_ucsi_probe,
+ .remove = cros_ucsi_remove,
+};
+
+module_platform_driver(cros_ucsi_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("UCSI driver for ChromeOS EC");
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 35+ messages in thread* Re: [PATCH v6 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver
2024-09-10 10:15 ` [PATCH v6 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver Łukasz Bartosik
@ 2024-09-12 12:58 ` Dmitry Baryshkov
2024-09-14 22:50 ` Łukasz Bartosik
0 siblings, 1 reply; 35+ messages in thread
From: Dmitry Baryshkov @ 2024-09-12 12:58 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih,
linux-usb, chrome-platform
On Tue, Sep 10, 2024 at 10:15:22AM GMT, Łukasz Bartosik wrote:
> From: Pavan Holla <pholla@chromium.org>
>
> Implementation of a UCSI transport driver for ChromeOS.
> This driver will be loaded if the ChromeOS EC implements a PPM.
>
> Signed-off-by: Pavan Holla <pholla@chromium.org>
> Co-developed-by: Łukasz Bartosik <ukaszb@chromium.org>
> Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> ---
> MAINTAINERS | 7 +
> drivers/usb/typec/ucsi/Kconfig | 13 ++
> drivers/usb/typec/ucsi/Makefile | 1 +
> drivers/usb/typec/ucsi/cros_ec_ucsi.c | 273 ++++++++++++++++++++++++++
> 4 files changed, 294 insertions(+)
> create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi.c
>
[...]
> +
> +static int cros_ucsi_sync_control(struct ucsi *ucsi, u64 cmd)
> +{
> + struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi);
> + bool ack = UCSI_COMMAND(cmd) == UCSI_ACK_CC_CI;
> + int ret;
> +
> + if (ack)
> + set_bit(ACK_PENDING, &udata->flags);
> + else
> + set_bit(COMMAND_PENDING, &udata->flags);
> +
> + ret = cros_ucsi_async_control(ucsi, cmd);
> + if (ret)
> + goto out;
> +
> + if (!wait_for_completion_timeout(&udata->complete, WRITE_TMO_MS))
> + ret = -ETIMEDOUT;
> +
> +out:
> + if (ack)
> + clear_bit(ACK_PENDING, &udata->flags);
> + else
> + clear_bit(COMMAND_PENDING, &udata->flags);
> + return ret;
> +}
> +
> +struct ucsi_operations cros_ucsi_ops = {
> + .read_version = cros_ucsi_read_version,
> + .read_cci = cros_ucsi_read_cci,
> + .read_message_in = cros_ucsi_read_message_in,
> + .async_control = cros_ucsi_async_control,
> + .sync_control = cros_ucsi_sync_control,
Please use ucsi_sync_control_common instead.
> +};
> +
> +static void cros_ucsi_work(struct work_struct *work)
> +{
> + struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
> + u32 cci;
> +
> + if (cros_ucsi_read_cci(udata->ucsi, &cci))
> + return;
> +
> + if (UCSI_CCI_CONNECTOR(cci))
> + ucsi_connector_change(udata->ucsi, UCSI_CCI_CONNECTOR(cci));
> +
> + if (cci & UCSI_CCI_ACK_COMPLETE &&
> + test_and_clear_bit(ACK_PENDING, &udata->flags))
> + complete(&udata->complete);
> + if (cci & UCSI_CCI_COMMAND_COMPLETE &&
> + test_and_clear_bit(COMMAND_PENDING, &udata->flags))
> + complete(&udata->complete);
ucsi_notify_common(). Why are you ignoring these functions?
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver
2024-09-12 12:58 ` Dmitry Baryshkov
@ 2024-09-14 22:50 ` Łukasz Bartosik
2024-09-14 23:03 ` Dmitry Baryshkov
0 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-14 22:50 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih,
linux-usb, chrome-platform
On Thu, Sep 12, 2024 at 2:58 PM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Tue, Sep 10, 2024 at 10:15:22AM GMT, Łukasz Bartosik wrote:
> > From: Pavan Holla <pholla@chromium.org>
> >
> > Implementation of a UCSI transport driver for ChromeOS.
> > This driver will be loaded if the ChromeOS EC implements a PPM.
> >
> > Signed-off-by: Pavan Holla <pholla@chromium.org>
> > Co-developed-by: Łukasz Bartosik <ukaszb@chromium.org>
> > Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> > ---
> > MAINTAINERS | 7 +
> > drivers/usb/typec/ucsi/Kconfig | 13 ++
> > drivers/usb/typec/ucsi/Makefile | 1 +
> > drivers/usb/typec/ucsi/cros_ec_ucsi.c | 273 ++++++++++++++++++++++++++
> > 4 files changed, 294 insertions(+)
> > create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi.c
> >
>
> [...]
>
> > +
> > +static int cros_ucsi_sync_control(struct ucsi *ucsi, u64 cmd)
> > +{
> > + struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi);
> > + bool ack = UCSI_COMMAND(cmd) == UCSI_ACK_CC_CI;
> > + int ret;
> > +
> > + if (ack)
> > + set_bit(ACK_PENDING, &udata->flags);
> > + else
> > + set_bit(COMMAND_PENDING, &udata->flags);
> > +
> > + ret = cros_ucsi_async_control(ucsi, cmd);
> > + if (ret)
> > + goto out;
> > +
> > + if (!wait_for_completion_timeout(&udata->complete, WRITE_TMO_MS))
> > + ret = -ETIMEDOUT;
> > +
> > +out:
> > + if (ack)
> > + clear_bit(ACK_PENDING, &udata->flags);
> > + else
> > + clear_bit(COMMAND_PENDING, &udata->flags);
> > + return ret;
> > +}
> > +
> > +struct ucsi_operations cros_ucsi_ops = {
> > + .read_version = cros_ucsi_read_version,
> > + .read_cci = cros_ucsi_read_cci,
> > + .read_message_in = cros_ucsi_read_message_in,
> > + .async_control = cros_ucsi_async_control,
> > + .sync_control = cros_ucsi_sync_control,
>
> Please use ucsi_sync_control_common instead.
>
I will use ucsi_sync_control_common. Thanks for pointing it out.
> > +};
> > +
> > +static void cros_ucsi_work(struct work_struct *work)
> > +{
> > + struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
> > + u32 cci;
> > +
> > + if (cros_ucsi_read_cci(udata->ucsi, &cci))
> > + return;
> > +
> > + if (UCSI_CCI_CONNECTOR(cci))
> > + ucsi_connector_change(udata->ucsi, UCSI_CCI_CONNECTOR(cci));
> > +
> > + if (cci & UCSI_CCI_ACK_COMPLETE &&
> > + test_and_clear_bit(ACK_PENDING, &udata->flags))
> > + complete(&udata->complete);
> > + if (cci & UCSI_CCI_COMMAND_COMPLETE &&
> > + test_and_clear_bit(COMMAND_PENDING, &udata->flags))
> > + complete(&udata->complete);
>
> ucsi_notify_common(). Why are you ignoring these functions?
>
I have missed these common functions mainly because our baseline is on
the v6.6 kernel. I will use ucsi_notify_common() however I noticed one
major difference. The ucsi_notify_common() uses test_bit while above
we use test_and_clear_bit. I will send a separate commit to change
test_bit->test_and_clear_bit in the ucsi_notify_common() because usage
of test_and_clear_bit fixes possible race condition.
Thanks,
Lukasz
> --
> With best wishes
> Dmitry
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver
2024-09-14 22:50 ` Łukasz Bartosik
@ 2024-09-14 23:03 ` Dmitry Baryshkov
2024-09-14 23:43 ` Łukasz Bartosik
0 siblings, 1 reply; 35+ messages in thread
From: Dmitry Baryshkov @ 2024-09-14 23:03 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih,
linux-usb, chrome-platform
On Sun, 15 Sept 2024 at 01:50, Łukasz Bartosik <ukaszb@chromium.org> wrote:
>
> On Thu, Sep 12, 2024 at 2:58 PM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > On Tue, Sep 10, 2024 at 10:15:22AM GMT, Łukasz Bartosik wrote:
> > > From: Pavan Holla <pholla@chromium.org>
> > >
> > > Implementation of a UCSI transport driver for ChromeOS.
> > > This driver will be loaded if the ChromeOS EC implements a PPM.
> > >
> > > Signed-off-by: Pavan Holla <pholla@chromium.org>
> > > Co-developed-by: Łukasz Bartosik <ukaszb@chromium.org>
> > > Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> > > ---
> > > MAINTAINERS | 7 +
> > > drivers/usb/typec/ucsi/Kconfig | 13 ++
> > > drivers/usb/typec/ucsi/Makefile | 1 +
> > > drivers/usb/typec/ucsi/cros_ec_ucsi.c | 273 ++++++++++++++++++++++++++
> > > 4 files changed, 294 insertions(+)
> > > create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > >
> >
> > [...]
> >
> > > +
> > > +static int cros_ucsi_sync_control(struct ucsi *ucsi, u64 cmd)
> > > +{
> > > + struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi);
> > > + bool ack = UCSI_COMMAND(cmd) == UCSI_ACK_CC_CI;
> > > + int ret;
> > > +
> > > + if (ack)
> > > + set_bit(ACK_PENDING, &udata->flags);
> > > + else
> > > + set_bit(COMMAND_PENDING, &udata->flags);
> > > +
> > > + ret = cros_ucsi_async_control(ucsi, cmd);
> > > + if (ret)
> > > + goto out;
> > > +
> > > + if (!wait_for_completion_timeout(&udata->complete, WRITE_TMO_MS))
> > > + ret = -ETIMEDOUT;
> > > +
> > > +out:
> > > + if (ack)
> > > + clear_bit(ACK_PENDING, &udata->flags);
> > > + else
> > > + clear_bit(COMMAND_PENDING, &udata->flags);
> > > + return ret;
> > > +}
> > > +
> > > +struct ucsi_operations cros_ucsi_ops = {
> > > + .read_version = cros_ucsi_read_version,
> > > + .read_cci = cros_ucsi_read_cci,
> > > + .read_message_in = cros_ucsi_read_message_in,
> > > + .async_control = cros_ucsi_async_control,
> > > + .sync_control = cros_ucsi_sync_control,
> >
> > Please use ucsi_sync_control_common instead.
> >
>
> I will use ucsi_sync_control_common. Thanks for pointing it out.
>
> > > +};
> > > +
> > > +static void cros_ucsi_work(struct work_struct *work)
> > > +{
> > > + struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
> > > + u32 cci;
> > > +
> > > + if (cros_ucsi_read_cci(udata->ucsi, &cci))
> > > + return;
> > > +
> > > + if (UCSI_CCI_CONNECTOR(cci))
> > > + ucsi_connector_change(udata->ucsi, UCSI_CCI_CONNECTOR(cci));
> > > +
> > > + if (cci & UCSI_CCI_ACK_COMPLETE &&
> > > + test_and_clear_bit(ACK_PENDING, &udata->flags))
> > > + complete(&udata->complete);
> > > + if (cci & UCSI_CCI_COMMAND_COMPLETE &&
> > > + test_and_clear_bit(COMMAND_PENDING, &udata->flags))
> > > + complete(&udata->complete);
> >
> > ucsi_notify_common(). Why are you ignoring these functions?
> >
>
> I have missed these common functions mainly because our baseline is on
> the v6.6 kernel.
Please, don't send patches based on the old kernels. The development
should be done on the tip of the maintainer's tree.
> I will use ucsi_notify_common() however I noticed one
> major difference. The ucsi_notify_common() uses test_bit while above
> we use test_and_clear_bit. I will send a separate commit to change
> test_bit->test_and_clear_bit in the ucsi_notify_common() because usage
> of test_and_clear_bit fixes possible race condition.
Ack, thanks!
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver
2024-09-14 23:03 ` Dmitry Baryshkov
@ 2024-09-14 23:43 ` Łukasz Bartosik
0 siblings, 0 replies; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-14 23:43 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih,
linux-usb, chrome-platform
On Sun, Sep 15, 2024 at 1:03 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Sun, 15 Sept 2024 at 01:50, Łukasz Bartosik <ukaszb@chromium.org> wrote:
> >
> > On Thu, Sep 12, 2024 at 2:58 PM Dmitry Baryshkov
> > <dmitry.baryshkov@linaro.org> wrote:
> > >
> > > On Tue, Sep 10, 2024 at 10:15:22AM GMT, Łukasz Bartosik wrote:
> > > > From: Pavan Holla <pholla@chromium.org>
> > > >
> > > > Implementation of a UCSI transport driver for ChromeOS.
> > > > This driver will be loaded if the ChromeOS EC implements a PPM.
> > > >
> > > > Signed-off-by: Pavan Holla <pholla@chromium.org>
> > > > Co-developed-by: Łukasz Bartosik <ukaszb@chromium.org>
> > > > Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> > > > ---
> > > > MAINTAINERS | 7 +
> > > > drivers/usb/typec/ucsi/Kconfig | 13 ++
> > > > drivers/usb/typec/ucsi/Makefile | 1 +
> > > > drivers/usb/typec/ucsi/cros_ec_ucsi.c | 273 ++++++++++++++++++++++++++
> > > > 4 files changed, 294 insertions(+)
> > > > create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > > >
> > >
> > > [...]
> > >
> > > > +
> > > > +static int cros_ucsi_sync_control(struct ucsi *ucsi, u64 cmd)
> > > > +{
> > > > + struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi);
> > > > + bool ack = UCSI_COMMAND(cmd) == UCSI_ACK_CC_CI;
> > > > + int ret;
> > > > +
> > > > + if (ack)
> > > > + set_bit(ACK_PENDING, &udata->flags);
> > > > + else
> > > > + set_bit(COMMAND_PENDING, &udata->flags);
> > > > +
> > > > + ret = cros_ucsi_async_control(ucsi, cmd);
> > > > + if (ret)
> > > > + goto out;
> > > > +
> > > > + if (!wait_for_completion_timeout(&udata->complete, WRITE_TMO_MS))
> > > > + ret = -ETIMEDOUT;
> > > > +
> > > > +out:
> > > > + if (ack)
> > > > + clear_bit(ACK_PENDING, &udata->flags);
> > > > + else
> > > > + clear_bit(COMMAND_PENDING, &udata->flags);
> > > > + return ret;
> > > > +}
> > > > +
> > > > +struct ucsi_operations cros_ucsi_ops = {
> > > > + .read_version = cros_ucsi_read_version,
> > > > + .read_cci = cros_ucsi_read_cci,
> > > > + .read_message_in = cros_ucsi_read_message_in,
> > > > + .async_control = cros_ucsi_async_control,
> > > > + .sync_control = cros_ucsi_sync_control,
> > >
> > > Please use ucsi_sync_control_common instead.
> > >
> >
> > I will use ucsi_sync_control_common. Thanks for pointing it out.
> >
> > > > +};
> > > > +
> > > > +static void cros_ucsi_work(struct work_struct *work)
> > > > +{
> > > > + struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
> > > > + u32 cci;
> > > > +
> > > > + if (cros_ucsi_read_cci(udata->ucsi, &cci))
> > > > + return;
> > > > +
> > > > + if (UCSI_CCI_CONNECTOR(cci))
> > > > + ucsi_connector_change(udata->ucsi, UCSI_CCI_CONNECTOR(cci));
> > > > +
> > > > + if (cci & UCSI_CCI_ACK_COMPLETE &&
> > > > + test_and_clear_bit(ACK_PENDING, &udata->flags))
> > > > + complete(&udata->complete);
> > > > + if (cci & UCSI_CCI_COMMAND_COMPLETE &&
> > > > + test_and_clear_bit(COMMAND_PENDING, &udata->flags))
> > > > + complete(&udata->complete);
> > >
> > > ucsi_notify_common(). Why are you ignoring these functions?
> > >
> >
> > I have missed these common functions mainly because our baseline is on
> > the v6.6 kernel.
>
> Please, don't send patches based on the old kernels. The development
> should be done on the tip of the maintainer's tree.
>
I should have been more specific. I always rebase to the latest
upstream kernel and fix any
conflicts and compilation errors before sending patches to upstream
review. But living on a daily
basis on the v6.6 kernel caused me to miss the common function you pointed out.
Thanks,
Lukasz
> > I will use ucsi_notify_common() however I noticed one
> > major difference. The ucsi_notify_common() uses test_bit while above
> > we use test_and_clear_bit. I will send a separate commit to change
> > test_bit->test_and_clear_bit in the ucsi_notify_common() because usage
> > of test_and_clear_bit fixes possible race condition.
>
> Ack, thanks!
>
> --
> With best wishes
> Dmitry
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v6 4/8] usb: typec: cros_ec_ucsi: Use complete instead of resume
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
` (2 preceding siblings ...)
2024-09-10 10:15 ` [PATCH v6 3/8] usb: typec: ucsi: Implement ChromeOS UCSI driver Łukasz Bartosik
@ 2024-09-10 10:15 ` Łukasz Bartosik
2024-09-11 13:20 ` Heikki Krogerus
2024-09-10 10:15 ` [PATCH v6 5/8] usb: typec: cros_ec_ucsi: Add trace events Łukasz Bartosik
` (5 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-10 10:15 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
On platforms using cros_ec_lpc, resume is split into .resume_early and
.complete. To avoid missing EC events, use .complete to schedule work
when resuming.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
index 20e608097fc6..422b3b14028c 100644
--- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
@@ -241,15 +241,18 @@ static int __maybe_unused cros_ucsi_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused cros_ucsi_resume(struct device *dev)
+static void __maybe_unused cros_ucsi_complete(struct device *dev)
{
struct cros_ucsi_data *udata = dev_get_drvdata(dev);
-
- return ucsi_resume(udata->ucsi);
+ ucsi_resume(udata->ucsi);
}
-static SIMPLE_DEV_PM_OPS(cros_ucsi_pm_ops, cros_ucsi_suspend,
- cros_ucsi_resume);
+static const struct dev_pm_ops cros_ucsi_pm_ops = {
+#ifdef CONFIG_PM_SLEEP
+ .suspend = cros_ucsi_suspend,
+ .complete = cros_ucsi_complete,
+#endif
+};
static const struct platform_device_id cros_ucsi_id[] = {
{ KBUILD_MODNAME, 0 },
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 35+ messages in thread* Re: [PATCH v6 4/8] usb: typec: cros_ec_ucsi: Use complete instead of resume
2024-09-10 10:15 ` [PATCH v6 4/8] usb: typec: cros_ec_ucsi: Use complete instead of resume Łukasz Bartosik
@ 2024-09-11 13:20 ` Heikki Krogerus
2024-09-14 21:50 ` Łukasz Bartosik
0 siblings, 1 reply; 35+ messages in thread
From: Heikki Krogerus @ 2024-09-11 13:20 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
Hi Łukasz,
On Tue, Sep 10, 2024 at 10:15:23AM +0000, Łukasz Bartosik wrote:
> From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
>
> On platforms using cros_ec_lpc, resume is split into .resume_early and
> .complete. To avoid missing EC events, use .complete to schedule work
> when resuming.
>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> ---
> drivers/usb/typec/ucsi/cros_ec_ucsi.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> index 20e608097fc6..422b3b14028c 100644
> --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> @@ -241,15 +241,18 @@ static int __maybe_unused cros_ucsi_suspend(struct device *dev)
> return 0;
> }
>
> -static int __maybe_unused cros_ucsi_resume(struct device *dev)
> +static void __maybe_unused cros_ucsi_complete(struct device *dev)
> {
> struct cros_ucsi_data *udata = dev_get_drvdata(dev);
> -
> - return ucsi_resume(udata->ucsi);
> + ucsi_resume(udata->ucsi);
> }
>
> -static SIMPLE_DEV_PM_OPS(cros_ucsi_pm_ops, cros_ucsi_suspend,
> - cros_ucsi_resume);
> +static const struct dev_pm_ops cros_ucsi_pm_ops = {
> +#ifdef CONFIG_PM_SLEEP
> + .suspend = cros_ucsi_suspend,
> + .complete = cros_ucsi_complete,
> +#endif
> +};
>
> static const struct platform_device_id cros_ucsi_id[] = {
> { KBUILD_MODNAME, 0 },
Please merge this into the previous patch.
thanks,
--
heikki
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 4/8] usb: typec: cros_ec_ucsi: Use complete instead of resume
2024-09-11 13:20 ` Heikki Krogerus
@ 2024-09-14 21:50 ` Łukasz Bartosik
0 siblings, 0 replies; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-14 21:50 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Wed, Sep 11, 2024 at 3:21 PM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> Hi Łukasz,
>
> On Tue, Sep 10, 2024 at 10:15:23AM +0000, Łukasz Bartosik wrote:
> > From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> >
> > On platforms using cros_ec_lpc, resume is split into .resume_early and
> > .complete. To avoid missing EC events, use .complete to schedule work
> > when resuming.
> >
> > Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> > Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> > ---
> > drivers/usb/typec/ucsi/cros_ec_ucsi.c | 13 ++++++++-----
> > 1 file changed, 8 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > index 20e608097fc6..422b3b14028c 100644
> > --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > @@ -241,15 +241,18 @@ static int __maybe_unused cros_ucsi_suspend(struct device *dev)
> > return 0;
> > }
> >
> > -static int __maybe_unused cros_ucsi_resume(struct device *dev)
> > +static void __maybe_unused cros_ucsi_complete(struct device *dev)
> > {
> > struct cros_ucsi_data *udata = dev_get_drvdata(dev);
> > -
> > - return ucsi_resume(udata->ucsi);
> > + ucsi_resume(udata->ucsi);
> > }
> >
> > -static SIMPLE_DEV_PM_OPS(cros_ucsi_pm_ops, cros_ucsi_suspend,
> > - cros_ucsi_resume);
> > +static const struct dev_pm_ops cros_ucsi_pm_ops = {
> > +#ifdef CONFIG_PM_SLEEP
> > + .suspend = cros_ucsi_suspend,
> > + .complete = cros_ucsi_complete,
> > +#endif
> > +};
> >
> > static const struct platform_device_id cros_ucsi_id[] = {
> > { KBUILD_MODNAME, 0 },
>
> Please merge this into the previous patch.
>
I will merge it.
Thanks,
Lukasz
> thanks,
>
> --
> heikki
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v6 5/8] usb: typec: cros_ec_ucsi: Add trace events
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
` (3 preceding siblings ...)
2024-09-10 10:15 ` [PATCH v6 4/8] usb: typec: cros_ec_ucsi: Use complete instead of resume Łukasz Bartosik
@ 2024-09-10 10:15 ` Łukasz Bartosik
2024-09-11 13:36 ` Heikki Krogerus
2024-09-10 10:15 ` [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink Łukasz Bartosik
` (4 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-10 10:15 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
Add trace events to ChromeOS UCSI driver to enable debugging.
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
MAINTAINERS | 1 +
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 8 ++
drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h | 92 +++++++++++++++++++++
3 files changed, 101 insertions(+)
create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 8c030ea0b503..d084f32208f0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5306,6 +5306,7 @@ M: Łukasz Bartosik <ukaszb@chromium.org>
L: chrome-platform@lists.linux.dev
S: Maintained
F: drivers/usb/typec/ucsi/cros_ec_ucsi.c
+F: drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
CHRONTEL CH7322 CEC DRIVER
M: Joe Tessler <jrt@google.com>
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
index 422b3b14028c..70185616ec86 100644
--- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
@@ -16,7 +16,9 @@
#include <linux/slab.h>
#include <linux/wait.h>
+#define CREATE_TRACE_POINTS
#include "ucsi.h"
+#include "cros_ec_ucsi_trace.h"
/*
* Maximum size in bytes of a UCSI message between AP and EC
@@ -62,6 +64,8 @@ static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_GET: error=%d", ret);
return ret;
}
+
+ trace_cros_ec_opm_to_ppm_rd(offset, val, val_len);
return 0;
}
@@ -96,6 +100,8 @@ static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d", ret);
return ret;
}
+
+ trace_cros_ec_opm_to_ppm_wr(req->offset, &cmd, sizeof(cmd));
return 0;
}
@@ -138,6 +144,8 @@ static void cros_ucsi_work(struct work_struct *work)
struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
u32 cci;
+ trace_cros_ec_ppm_to_opm(0);
+
if (cros_ucsi_read_cci(udata->ucsi, &cci))
return;
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h b/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
new file mode 100644
index 000000000000..b765ef5c8236
--- /dev/null
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
@@ -0,0 +1,92 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM cros_ec_ucsi
+
+#if !defined(__CROS_EC_UCSI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define __CROS_EC_UCSI_TRACE_H
+
+#include <linux/tracepoint.h>
+
+#define decode_cmd(cmd) \
+ __print_symbolic(cmd, \
+ { 0, "Unknown command" }, \
+ { UCSI_PPM_RESET, "PPM_RESET" }, \
+ { UCSI_CONNECTOR_RESET, "CONNECTOR_RESET," }, \
+ { UCSI_ACK_CC_CI, "ACK_CC_CI" }, \
+ { UCSI_SET_NOTIFICATION_ENABLE, "SET_NOTIFICATION_ENABLE" }, \
+ { UCSI_GET_CAPABILITY, "GET_CAPABILITY" }, \
+ { UCSI_GET_CONNECTOR_CAPABILITY, "GET_CONNECTOR_CAPABILITY" }, \
+ { UCSI_SET_UOM, "SET_UOM" }, \
+ { UCSI_SET_UOR, "SET_UOR" }, \
+ { UCSI_SET_PDM, "SET_PDM" }, \
+ { UCSI_SET_PDR, "SET_PDR" }, \
+ { UCSI_GET_ALTERNATE_MODES, "GET_ALTERNATE_MODES" }, \
+ { UCSI_GET_CAM_SUPPORTED, "GET_CAM_SUPPORTED" }, \
+ { UCSI_GET_CURRENT_CAM, "GET_CURRENT_CAM" }, \
+ { UCSI_SET_NEW_CAM, "SET_NEW_CAM" }, \
+ { UCSI_GET_PDOS, "GET_PDOS" }, \
+ { UCSI_GET_CABLE_PROPERTY, "GET_CABLE_PROPERTY" }, \
+ { UCSI_GET_CONNECTOR_STATUS, "GET_CONNECTOR_STATUS" }, \
+ { UCSI_GET_ERROR_STATUS, "GET_ERROR_STATUS" })
+
+#define decode_offset(offset) \
+ __print_symbolic(offset, \
+ { UCSI_VERSION, "VER" }, \
+ { UCSI_CCI, "CCI" }, \
+ { UCSI_CONTROL, "CTRL" }, \
+ { UCSI_MESSAGE_IN, "MSG_IN" }, \
+ { UCSI_MESSAGE_OUT, "MSG_OUT" }, \
+ { UCSIv2_MESSAGE_OUT, "MSG_OUTv2" })
+
+DECLARE_EVENT_CLASS(cros_ec_opm_to_ppm,
+ TP_PROTO(u16 offset, const void *value, size_t length),
+ TP_ARGS(offset, value, length),
+ TP_STRUCT__entry(
+ __field(u8, cmd)
+ __field(u16, offset)
+ __field(size_t, length)
+ __dynamic_array(char, msg, length)
+ ),
+ TP_fast_assign(
+ __entry->cmd = *((u64 *) value + 3);
+ __entry->offset = offset;
+ __entry->length = length;
+ memcpy(__get_dynamic_array(msg), value, length);
+ ),
+ TP_printk("(%s) %s: %s",
+ decode_offset(__entry->offset),
+ __entry->offset == UCSI_CONTROL ?
+ decode_cmd(__entry->cmd) : "",
+ __print_hex(__get_dynamic_array(msg), __entry->length))
+);
+
+DEFINE_EVENT(cros_ec_opm_to_ppm, cros_ec_opm_to_ppm_rd,
+ TP_PROTO(u16 offset, const void *value, size_t length),
+ TP_ARGS(offset, value, length)
+);
+
+DEFINE_EVENT(cros_ec_opm_to_ppm, cros_ec_opm_to_ppm_wr,
+ TP_PROTO(u16 offset, const void *value, size_t length),
+ TP_ARGS(offset, value, length)
+);
+
+TRACE_EVENT(cros_ec_ppm_to_opm,
+ TP_PROTO(int x),
+ TP_ARGS(x),
+ TP_STRUCT__entry(__array(char, x, 0)),
+ TP_fast_assign((void)x),
+ TP_printk("notification%s", "")
+);
+
+#endif /* __CROS_EC_UCSI_TRACE_H */
+
+/* This part must be outside protection */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE cros_ec_ucsi_trace
+
+#include <trace/define_trace.h>
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 35+ messages in thread* Re: [PATCH v6 5/8] usb: typec: cros_ec_ucsi: Add trace events
2024-09-10 10:15 ` [PATCH v6 5/8] usb: typec: cros_ec_ucsi: Add trace events Łukasz Bartosik
@ 2024-09-11 13:36 ` Heikki Krogerus
2024-09-14 21:52 ` Łukasz Bartosik
0 siblings, 1 reply; 35+ messages in thread
From: Heikki Krogerus @ 2024-09-11 13:36 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Tue, Sep 10, 2024 at 10:15:24AM +0000, Łukasz Bartosik wrote:
> Add trace events to ChromeOS UCSI driver to enable debugging.
>
> Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> ---
> MAINTAINERS | 1 +
> drivers/usb/typec/ucsi/cros_ec_ucsi.c | 8 ++
> drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h | 92 +++++++++++++++++++++
> 3 files changed, 101 insertions(+)
> create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8c030ea0b503..d084f32208f0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5306,6 +5306,7 @@ M: Łukasz Bartosik <ukaszb@chromium.org>
> L: chrome-platform@lists.linux.dev
> S: Maintained
> F: drivers/usb/typec/ucsi/cros_ec_ucsi.c
> +F: drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
>
> CHRONTEL CH7322 CEC DRIVER
> M: Joe Tessler <jrt@google.com>
> diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> index 422b3b14028c..70185616ec86 100644
> --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> @@ -16,7 +16,9 @@
> #include <linux/slab.h>
> #include <linux/wait.h>
>
> +#define CREATE_TRACE_POINTS
> #include "ucsi.h"
> +#include "cros_ec_ucsi_trace.h"
>
> /*
> * Maximum size in bytes of a UCSI message between AP and EC
> @@ -62,6 +64,8 @@ static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
> dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_GET: error=%d", ret);
> return ret;
> }
> +
> + trace_cros_ec_opm_to_ppm_rd(offset, val, val_len);
> return 0;
> }
>
> @@ -96,6 +100,8 @@ static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
> dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d", ret);
> return ret;
> }
> +
> + trace_cros_ec_opm_to_ppm_wr(req->offset, &cmd, sizeof(cmd));
> return 0;
> }
>
> @@ -138,6 +144,8 @@ static void cros_ucsi_work(struct work_struct *work)
> struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
> u32 cci;
>
> + trace_cros_ec_ppm_to_opm(0);
> +
> if (cros_ucsi_read_cci(udata->ucsi, &cci))
> return;
>
> diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h b/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
> new file mode 100644
> index 000000000000..b765ef5c8236
> --- /dev/null
> +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
> @@ -0,0 +1,92 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM cros_ec_ucsi
> +
> +#if !defined(__CROS_EC_UCSI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define __CROS_EC_UCSI_TRACE_H
> +
> +#include <linux/tracepoint.h>
> +
> +#define decode_cmd(cmd) \
> + __print_symbolic(cmd, \
> + { 0, "Unknown command" }, \
> + { UCSI_PPM_RESET, "PPM_RESET" }, \
> + { UCSI_CONNECTOR_RESET, "CONNECTOR_RESET," }, \
> + { UCSI_ACK_CC_CI, "ACK_CC_CI" }, \
> + { UCSI_SET_NOTIFICATION_ENABLE, "SET_NOTIFICATION_ENABLE" }, \
> + { UCSI_GET_CAPABILITY, "GET_CAPABILITY" }, \
> + { UCSI_GET_CONNECTOR_CAPABILITY, "GET_CONNECTOR_CAPABILITY" }, \
> + { UCSI_SET_UOM, "SET_UOM" }, \
> + { UCSI_SET_UOR, "SET_UOR" }, \
> + { UCSI_SET_PDM, "SET_PDM" }, \
> + { UCSI_SET_PDR, "SET_PDR" }, \
> + { UCSI_GET_ALTERNATE_MODES, "GET_ALTERNATE_MODES" }, \
> + { UCSI_GET_CAM_SUPPORTED, "GET_CAM_SUPPORTED" }, \
> + { UCSI_GET_CURRENT_CAM, "GET_CURRENT_CAM" }, \
> + { UCSI_SET_NEW_CAM, "SET_NEW_CAM" }, \
> + { UCSI_GET_PDOS, "GET_PDOS" }, \
> + { UCSI_GET_CABLE_PROPERTY, "GET_CABLE_PROPERTY" }, \
> + { UCSI_GET_CONNECTOR_STATUS, "GET_CONNECTOR_STATUS" }, \
> + { UCSI_GET_ERROR_STATUS, "GET_ERROR_STATUS" })
Couldn't you just export ucsi_cmd_str() ?
> +#define decode_offset(offset) \
> + __print_symbolic(offset, \
> + { UCSI_VERSION, "VER" }, \
> + { UCSI_CCI, "CCI" }, \
> + { UCSI_CONTROL, "CTRL" }, \
> + { UCSI_MESSAGE_IN, "MSG_IN" }, \
> + { UCSI_MESSAGE_OUT, "MSG_OUT" }, \
> + { UCSIv2_MESSAGE_OUT, "MSG_OUTv2" })
> +
> +DECLARE_EVENT_CLASS(cros_ec_opm_to_ppm,
> + TP_PROTO(u16 offset, const void *value, size_t length),
> + TP_ARGS(offset, value, length),
> + TP_STRUCT__entry(
> + __field(u8, cmd)
> + __field(u16, offset)
> + __field(size_t, length)
> + __dynamic_array(char, msg, length)
> + ),
> + TP_fast_assign(
> + __entry->cmd = *((u64 *) value + 3);
> + __entry->offset = offset;
> + __entry->length = length;
> + memcpy(__get_dynamic_array(msg), value, length);
> + ),
> + TP_printk("(%s) %s: %s",
> + decode_offset(__entry->offset),
> + __entry->offset == UCSI_CONTROL ?
> + decode_cmd(__entry->cmd) : "",
> + __print_hex(__get_dynamic_array(msg), __entry->length))
> +);
> +
> +DEFINE_EVENT(cros_ec_opm_to_ppm, cros_ec_opm_to_ppm_rd,
> + TP_PROTO(u16 offset, const void *value, size_t length),
> + TP_ARGS(offset, value, length)
> +);
> +
> +DEFINE_EVENT(cros_ec_opm_to_ppm, cros_ec_opm_to_ppm_wr,
> + TP_PROTO(u16 offset, const void *value, size_t length),
> + TP_ARGS(offset, value, length)
> +);
> +
> +TRACE_EVENT(cros_ec_ppm_to_opm,
> + TP_PROTO(int x),
> + TP_ARGS(x),
> + TP_STRUCT__entry(__array(char, x, 0)),
> + TP_fast_assign((void)x),
> + TP_printk("notification%s", "")
> +);
This does not look cros_ec specific. Could you check if this could be
made part of the ucsi core tracepoints?
I can also look into this more carefully, and throw ideas if you like.
Let me know.
Br,
--
heikki
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 5/8] usb: typec: cros_ec_ucsi: Add trace events
2024-09-11 13:36 ` Heikki Krogerus
@ 2024-09-14 21:52 ` Łukasz Bartosik
2024-09-19 12:52 ` Heikki Krogerus
0 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-14 21:52 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Wed, Sep 11, 2024 at 3:36 PM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> On Tue, Sep 10, 2024 at 10:15:24AM +0000, Łukasz Bartosik wrote:
> > Add trace events to ChromeOS UCSI driver to enable debugging.
> >
> > Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> > ---
> > MAINTAINERS | 1 +
> > drivers/usb/typec/ucsi/cros_ec_ucsi.c | 8 ++
> > drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h | 92 +++++++++++++++++++++
> > 3 files changed, 101 insertions(+)
> > create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 8c030ea0b503..d084f32208f0 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -5306,6 +5306,7 @@ M: Łukasz Bartosik <ukaszb@chromium.org>
> > L: chrome-platform@lists.linux.dev
> > S: Maintained
> > F: drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > +F: drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
> >
> > CHRONTEL CH7322 CEC DRIVER
> > M: Joe Tessler <jrt@google.com>
> > diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > index 422b3b14028c..70185616ec86 100644
> > --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > @@ -16,7 +16,9 @@
> > #include <linux/slab.h>
> > #include <linux/wait.h>
> >
> > +#define CREATE_TRACE_POINTS
> > #include "ucsi.h"
> > +#include "cros_ec_ucsi_trace.h"
> >
> > /*
> > * Maximum size in bytes of a UCSI message between AP and EC
> > @@ -62,6 +64,8 @@ static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
> > dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_GET: error=%d", ret);
> > return ret;
> > }
> > +
> > + trace_cros_ec_opm_to_ppm_rd(offset, val, val_len);
> > return 0;
> > }
> >
> > @@ -96,6 +100,8 @@ static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
> > dev_warn(udata->dev, "Failed to send EC message UCSI_PPM_SET: error=%d", ret);
> > return ret;
> > }
> > +
> > + trace_cros_ec_opm_to_ppm_wr(req->offset, &cmd, sizeof(cmd));
> > return 0;
> > }
> >
> > @@ -138,6 +144,8 @@ static void cros_ucsi_work(struct work_struct *work)
> > struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
> > u32 cci;
> >
> > + trace_cros_ec_ppm_to_opm(0);
> > +
> > if (cros_ucsi_read_cci(udata->ucsi, &cci))
> > return;
> >
> > diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h b/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
> > new file mode 100644
> > index 000000000000..b765ef5c8236
> > --- /dev/null
> > +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
> > @@ -0,0 +1,92 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +
> > +#undef TRACE_SYSTEM
> > +#define TRACE_SYSTEM cros_ec_ucsi
> > +
> > +#if !defined(__CROS_EC_UCSI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
> > +#define __CROS_EC_UCSI_TRACE_H
> > +
> > +#include <linux/tracepoint.h>
> > +
> > +#define decode_cmd(cmd) \
> > + __print_symbolic(cmd, \
> > + { 0, "Unknown command" }, \
> > + { UCSI_PPM_RESET, "PPM_RESET" }, \
> > + { UCSI_CONNECTOR_RESET, "CONNECTOR_RESET," }, \
> > + { UCSI_ACK_CC_CI, "ACK_CC_CI" }, \
> > + { UCSI_SET_NOTIFICATION_ENABLE, "SET_NOTIFICATION_ENABLE" }, \
> > + { UCSI_GET_CAPABILITY, "GET_CAPABILITY" }, \
> > + { UCSI_GET_CONNECTOR_CAPABILITY, "GET_CONNECTOR_CAPABILITY" }, \
> > + { UCSI_SET_UOM, "SET_UOM" }, \
> > + { UCSI_SET_UOR, "SET_UOR" }, \
> > + { UCSI_SET_PDM, "SET_PDM" }, \
> > + { UCSI_SET_PDR, "SET_PDR" }, \
> > + { UCSI_GET_ALTERNATE_MODES, "GET_ALTERNATE_MODES" }, \
> > + { UCSI_GET_CAM_SUPPORTED, "GET_CAM_SUPPORTED" }, \
> > + { UCSI_GET_CURRENT_CAM, "GET_CURRENT_CAM" }, \
> > + { UCSI_SET_NEW_CAM, "SET_NEW_CAM" }, \
> > + { UCSI_GET_PDOS, "GET_PDOS" }, \
> > + { UCSI_GET_CABLE_PROPERTY, "GET_CABLE_PROPERTY" }, \
> > + { UCSI_GET_CONNECTOR_STATUS, "GET_CONNECTOR_STATUS" }, \
> > + { UCSI_GET_ERROR_STATUS, "GET_ERROR_STATUS" })
>
> Couldn't you just export ucsi_cmd_str() ?
>
I ran into an issue when using exported ucsi_cmd_str(). Trace-cmd
report reports [FAILED TO PARSE].
For example
trace-cmd record -e cros_ec_ucsi
...
trace-cmd report
kworker/0:3-1891 [000] 59.432234: cros_ec_ppm_to_opm: notification
kworker/0:3-1891 [000] 59.432971: cros_ec_opm_to_ppm_rd:
[FAILED TO PARSE] cmd=4 offset=4 length=4 msg=ARRAY[04, 00, 00, 20]
I believe this issue applies also to some UCSI trace events.
With decode_cmd from the above it works fine
For example
trace-cmd record -e cros_ec_ucsi
...
trace-cmd report
kworker/0:1-10 [000] 49.248920: cros_ec_ppm_to_opm: notification
kworker/0:1-10 [000] 49.249857: cros_ec_opm_to_ppm_rd:
(CCI) : 04 00 00 20
kworker/0:1-10 [000] 49.253230: cros_ec_opm_to_ppm_wr:
(CTRL) GET_CONNECTOR_STATUS: 12 00 02 00 00 00 00 00
> > +#define decode_offset(offset) \
> > + __print_symbolic(offset, \
> > + { UCSI_VERSION, "VER" }, \
> > + { UCSI_CCI, "CCI" }, \
> > + { UCSI_CONTROL, "CTRL" }, \
> > + { UCSI_MESSAGE_IN, "MSG_IN" }, \
> > + { UCSI_MESSAGE_OUT, "MSG_OUT" }, \
> > + { UCSIv2_MESSAGE_OUT, "MSG_OUTv2" })
> > +
> > +DECLARE_EVENT_CLASS(cros_ec_opm_to_ppm,
> > + TP_PROTO(u16 offset, const void *value, size_t length),
> > + TP_ARGS(offset, value, length),
> > + TP_STRUCT__entry(
> > + __field(u8, cmd)
> > + __field(u16, offset)
> > + __field(size_t, length)
> > + __dynamic_array(char, msg, length)
> > + ),
> > + TP_fast_assign(
> > + __entry->cmd = *((u64 *) value + 3);
> > + __entry->offset = offset;
> > + __entry->length = length;
> > + memcpy(__get_dynamic_array(msg), value, length);
> > + ),
> > + TP_printk("(%s) %s: %s",
> > + decode_offset(__entry->offset),
> > + __entry->offset == UCSI_CONTROL ?
> > + decode_cmd(__entry->cmd) : "",
> > + __print_hex(__get_dynamic_array(msg), __entry->length))
> > +);
> > +
> > +DEFINE_EVENT(cros_ec_opm_to_ppm, cros_ec_opm_to_ppm_rd,
> > + TP_PROTO(u16 offset, const void *value, size_t length),
> > + TP_ARGS(offset, value, length)
> > +);
> > +
> > +DEFINE_EVENT(cros_ec_opm_to_ppm, cros_ec_opm_to_ppm_wr,
> > + TP_PROTO(u16 offset, const void *value, size_t length),
> > + TP_ARGS(offset, value, length)
> > +);
> > +
> > +TRACE_EVENT(cros_ec_ppm_to_opm,
> > + TP_PROTO(int x),
> > + TP_ARGS(x),
> > + TP_STRUCT__entry(__array(char, x, 0)),
> > + TP_fast_assign((void)x),
> > + TP_printk("notification%s", "")
> > +);
>
> This does not look cros_ec specific. Could you check if this could be
> made part of the ucsi core tracepoints?
>
Good point. I will look into it.
> I can also look into this more carefully, and throw ideas if you like.
> Let me know.
>
I would definitely like to hear your ideas on the topic :).
Thanks,
Lukasz
> Br,
>
> --
> heikki
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 5/8] usb: typec: cros_ec_ucsi: Add trace events
2024-09-14 21:52 ` Łukasz Bartosik
@ 2024-09-19 12:52 ` Heikki Krogerus
2024-09-19 18:10 ` Łukasz Bartosik
0 siblings, 1 reply; 35+ messages in thread
From: Heikki Krogerus @ 2024-09-19 12:52 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
Hi Łukasz,
> > This does not look cros_ec specific. Could you check if this could be
> > made part of the ucsi core tracepoints?
> >
>
> Good point. I will look into it.
>
> > I can also look into this more carefully, and throw ideas if you like.
> > Let me know.
> >
>
> I would definitely like to hear your ideas on the topic :).
This information is more or less the same that you would like to get
from that netlink interface, right? If that's the case, then is there
some reason why you want to get the same information from two
different interfaces? Sorry if I'm missing something obvious.
thanks,
--
heikki
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v6 5/8] usb: typec: cros_ec_ucsi: Add trace events
2024-09-19 12:52 ` Heikki Krogerus
@ 2024-09-19 18:10 ` Łukasz Bartosik
0 siblings, 0 replies; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-19 18:10 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Thu, Sep 19, 2024 at 2:53 PM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> Hi Łukasz,
>
> > > This does not look cros_ec specific. Could you check if this could be
> > > made part of the ucsi core tracepoints?
> > >
> >
> > Good point. I will look into it.
> >
> > > I can also look into this more carefully, and throw ideas if you like.
> > > Let me know.
> > >
> >
> > I would definitely like to hear your ideas on the topic :).
>
> This information is more or less the same that you would like to get
> from that netlink interface, right? If that's the case, then is there
> some reason why you want to get the same information from two
> different interfaces? Sorry if I'm missing something obvious.
>
I find both trace events and netlink useful. I elaborated on the cases
for which netlink seems more appropriate in my other reply.
Thanks,
Lukasz
> thanks,
>
> --
> heikki
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
` (4 preceding siblings ...)
2024-09-10 10:15 ` [PATCH v6 5/8] usb: typec: cros_ec_ucsi: Add trace events Łukasz Bartosik
@ 2024-09-10 10:15 ` Łukasz Bartosik
2024-09-11 14:00 ` kernel test robot
` (2 more replies)
2024-09-10 10:15 ` [PATCH v6 7/8] mfd: cros_ec: Load cros_ec_ucsi on supported ECs Łukasz Bartosik
` (3 subsequent siblings)
9 siblings, 3 replies; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-10 10:15 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
Add netlink to ChromeOS UCSI driver to allow forwarding
of UCSI messages to userspace for debugging and testing
purposes.
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
MAINTAINERS | 4 +-
drivers/usb/typec/ucsi/Makefile | 4 +-
.../{cros_ec_ucsi.c => cros_ec_ucsi_main.c} | 66 +++++++++++++-
drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c | 87 +++++++++++++++++++
drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h | 52 +++++++++++
5 files changed, 209 insertions(+), 4 deletions(-)
rename drivers/usb/typec/ucsi/{cros_ec_ucsi.c => cros_ec_ucsi_main.c} (79%)
create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c
create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h
diff --git a/MAINTAINERS b/MAINTAINERS
index d084f32208f0..2afb406a24ce 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5305,7 +5305,9 @@ M: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
M: Łukasz Bartosik <ukaszb@chromium.org>
L: chrome-platform@lists.linux.dev
S: Maintained
-F: drivers/usb/typec/ucsi/cros_ec_ucsi.c
+F: drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
+F: drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c
+F: drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h
F: drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
CHRONTEL CH7322 CEC DRIVER
diff --git a/drivers/usb/typec/ucsi/Makefile b/drivers/usb/typec/ucsi/Makefile
index be98a879104d..82d960394c39 100644
--- a/drivers/usb/typec/ucsi/Makefile
+++ b/drivers/usb/typec/ucsi/Makefile
@@ -21,5 +21,7 @@ obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o
obj-$(CONFIG_UCSI_CCG) += ucsi_ccg.o
obj-$(CONFIG_UCSI_STM32G0) += ucsi_stm32g0.o
obj-$(CONFIG_UCSI_PMIC_GLINK) += ucsi_glink.o
-obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o
obj-$(CONFIG_UCSI_LENOVO_YOGA_C630) += ucsi_yoga_c630.o
+
+obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o
+cros_ec_ucsi-y := cros_ec_ucsi_main.o cros_ec_ucsi_nl.o
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
similarity index 79%
rename from drivers/usb/typec/ucsi/cros_ec_ucsi.c
rename to drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
index 70185616ec86..008b61921278 100644
--- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
@@ -19,6 +19,7 @@
#define CREATE_TRACE_POINTS
#include "ucsi.h"
#include "cros_ec_ucsi_trace.h"
+#include "cros_ec_ucsi_nl.h"
/*
* Maximum size in bytes of a UCSI message between AP and EC
@@ -43,6 +44,43 @@ struct cros_ucsi_data {
unsigned long flags;
};
+/*
+ * When set to true the cros_ec_ucsi driver will forward all UCSI messages
+ * exchanged between OPM <-> PPM to userspace through netlink
+ */
+static bool is_ap_sniffer_en;
+
+static ssize_t enable_ap_sniffer_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%d\n", is_ap_sniffer_en);
+}
+
+static ssize_t enable_ap_sniffer_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ u8 value;
+
+ if (kstrtou8(buf, 0, &value))
+ return -EINVAL;
+
+ is_ap_sniffer_en = value ? 1 : 0;
+ return count;
+}
+
+static DEVICE_ATTR_RW(enable_ap_sniffer);
+
+static struct attribute *cros_ec_ucsi_attrs[] = {
+ &dev_attr_enable_ap_sniffer.attr,
+ NULL
+};
+
+static const struct attribute_group cros_ec_ucsi_attrs_grp = {
+ .attrs = cros_ec_ucsi_attrs,
+};
+
static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
size_t val_len)
{
@@ -65,6 +103,9 @@ static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
return ret;
}
+ if (is_ap_sniffer_en)
+ nl_cros_ec_bcast_msg(NL_CROS_EC_TO_PPM, NL_CROS_EC_RD, offset,
+ val, val_len);
trace_cros_ec_opm_to_ppm_rd(offset, val, val_len);
return 0;
}
@@ -101,6 +142,9 @@ static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
return ret;
}
+ if (is_ap_sniffer_en)
+ nl_cros_ec_bcast_msg(NL_CROS_EC_TO_PPM, NL_CROS_EC_WR,
+ req->offset, (u8 *) &cmd, sizeof(cmd));
trace_cros_ec_opm_to_ppm_wr(req->offset, &cmd, sizeof(cmd));
return 0;
}
@@ -144,6 +188,8 @@ static void cros_ucsi_work(struct work_struct *work)
struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
u32 cci;
+ if (is_ap_sniffer_en)
+ nl_cros_ec_bcast_msg(NL_CROS_EC_TO_OPM, 0, 0, NULL, 0);
trace_cros_ec_ppm_to_opm(0);
if (cros_ucsi_read_cci(udata->ucsi, &cci))
@@ -229,13 +275,29 @@ static int cros_ucsi_probe(struct platform_device *pdev)
return ret;
}
+ ret = nl_cros_ec_register();
+ if (ret) {
+ dev_err(dev, "failed to register netlink: error=%d", ret);
+ cros_ucsi_destroy(udata);
+ return ret;
+ }
+
+ ret = sysfs_create_group(&dev->kobj, &cros_ec_ucsi_attrs_grp);
+ if (ret) {
+ dev_err(dev, "failed to register sysfs group: error=%d", ret);
+ cros_ucsi_destroy(udata);
+ return ret;
+ }
+
return 0;
}
-static void cros_ucsi_remove(struct platform_device *dev)
+static void cros_ucsi_remove(struct platform_device *pdev)
{
- struct cros_ucsi_data *udata = platform_get_drvdata(dev);
+ struct cros_ucsi_data *udata = platform_get_drvdata(pdev);
+ sysfs_remove_group(&pdev->dev.kobj, &cros_ec_ucsi_attrs_grp);
+ nl_cros_ec_unregister();
ucsi_unregister(udata->ucsi);
cros_ucsi_destroy(udata);
}
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c b/drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c
new file mode 100644
index 000000000000..360568044891
--- /dev/null
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c
@@ -0,0 +1,87 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <net/genetlink.h>
+#include "cros_ec_ucsi_nl.h"
+
+static const struct genl_multicast_group nl_mc_grps[] = {
+ { .name = NL_CROS_EC_MC_GRP_NAME },
+};
+
+static struct genl_family genl_fam = {
+ .name = NL_CROS_EC_NAME,
+ .version = NL_CROS_EC_VER,
+ .maxattr = NL_CROS_EC_A_MAX,
+ .mcgrps = nl_mc_grps,
+ .n_mcgrps = ARRAY_SIZE(nl_mc_grps),
+};
+
+int nl_cros_ec_register(void)
+{
+ return genl_register_family(&genl_fam);
+}
+
+void nl_cros_ec_unregister(void)
+{
+ genl_unregister_family(&genl_fam);
+}
+
+int nl_cros_ec_bcast_msg(enum nl_cros_ec_msg_dir dir,
+ enum nl_cros_ec_cmd_type cmd_type,
+ u16 offset, const u8 *payload, size_t msg_size)
+{
+ struct timespec64 ts;
+ struct sk_buff *skb;
+ int ret = -ENOMEM;
+ void *hdr;
+
+ skb = genlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!skb)
+ return -ENOMEM;
+
+ hdr = genlmsg_put(skb, 0, 0, &genl_fam, 0, NL_CROS_EC_C_UCSI);
+ if (!hdr)
+ goto free_mem;
+
+ ret = nla_put_u8(skb, NL_CROS_EC_A_SRC, NL_CROS_EC_AP);
+ if (ret)
+ goto cancel;
+
+ ret = nla_put_u8(skb, NL_CROS_EC_A_DIR, dir);
+ if (ret)
+ goto cancel;
+
+ ret = nla_put_u16(skb, NL_CROS_EC_A_OFFSET, offset);
+ if (ret)
+ goto cancel;
+
+ ret = nla_put_u8(skb, NL_CROS_EC_A_CMD_TYPE, cmd_type);
+ if (ret)
+ goto cancel;
+
+ ktime_get_ts64(&ts);
+ ret = nla_put_u32(skb, NL_CROS_EC_A_TSTAMP_SEC, (u32)ts.tv_sec);
+ if (ret)
+ goto cancel;
+
+ ret = nla_put_u32(skb, NL_CROS_EC_A_TSTAMP_USEC,
+ (u32)(ts.tv_nsec/1000));
+ if (ret)
+ goto cancel;
+
+ ret = nla_put(skb, NL_CROS_EC_A_PAYLOAD, msg_size, payload);
+ if (ret)
+ goto cancel;
+
+ genlmsg_end(skb, hdr);
+
+ ret = genlmsg_multicast(&genl_fam, skb, 0, 0, GFP_KERNEL);
+ if (ret && ret != -ESRCH)
+ goto free_mem;
+
+ return 0;
+cancel:
+ genlmsg_cancel(skb, hdr);
+free_mem:
+ nlmsg_free(skb);
+ return ret;
+}
diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h b/drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h
new file mode 100644
index 000000000000..c6192d8ace56
--- /dev/null
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __DRIVER_USB_TYPEC_CROS_EC_UCSI_NL_H
+#define __DRIVER_USB_TYPEC_CROS_EC_UCSI_NL_H
+
+#define NL_CROS_EC_NAME "cros_ec_ucsi"
+#define NL_CROS_EC_VER 1
+#define NL_CROS_EC_MC_GRP_NAME "cros_ec_ucsi_mc"
+
+/* attributes */
+enum nl_cros_ec_attrs {
+ NL_CROS_EC_A_SRC,
+ NL_CROS_EC_A_DIR,
+ NL_CROS_EC_A_OFFSET,
+ NL_CROS_EC_A_CMD_TYPE,
+ NL_CROS_EC_A_TSTAMP_SEC,
+ NL_CROS_EC_A_TSTAMP_USEC,
+ NL_CROS_EC_A_PAYLOAD,
+ NL_CROS_EC_A_MAX
+};
+
+enum nl_cros_ec_cmds {
+ NL_CROS_EC_C_UCSI,
+ NL_CROS_EC_C_MAX
+};
+
+/* where message was captured - EC or AP */
+enum nl_cros_ec_src {
+ NL_CROS_EC_AP,
+ NL_CROS_EC_EC
+};
+
+/* message destination */
+enum nl_cros_ec_msg_dir {
+ NL_CROS_EC_TO_PPM,
+ NL_CROS_EC_TO_OPM,
+ NL_CROS_EC_TO_LPM
+};
+
+/* command type - read or write */
+enum nl_cros_ec_cmd_type {
+ NL_CROS_EC_RD,
+ NL_CROS_EC_WR
+};
+
+int nl_cros_ec_register(void);
+void nl_cros_ec_unregister(void);
+int nl_cros_ec_bcast_msg(enum nl_cros_ec_msg_dir dir,
+ enum nl_cros_ec_cmd_type cmd_type,
+ u16 offset, const u8 *payload, size_t msg_size);
+
+#endif /* __DRIVER_USB_TYPEC_CROS_EC_UCSI_NL_H */
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 35+ messages in thread* Re: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-10 10:15 ` [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink Łukasz Bartosik
@ 2024-09-11 14:00 ` kernel test robot
2024-09-11 14:07 ` Heikki Krogerus
2024-09-21 7:11 ` kernel test robot
2 siblings, 0 replies; 35+ messages in thread
From: kernel test robot @ 2024-09-11 14:00 UTC (permalink / raw)
To: Łukasz Bartosik, Heikki Krogerus, Greg Kroah-Hartman,
Lee Jones, Benson Leung, Guenter Roeck
Cc: oe-kbuild-all, Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih,
linux-usb, chrome-platform
Hi Łukasz,
kernel test robot noticed the following build warnings:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus lee-mfd/for-mfd-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.11-rc7 next-20240910]
[cannot apply to lee-mfd/for-mfd-fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/ukasz-Bartosik/platform-chrome-Update-ChromeOS-EC-header-for-UCSI/20240910-182729
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20240910101527.603452-7-ukaszb%40chromium.org
patch subject: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
config: x86_64-randconfig-121-20240911 (https://download.01.org/0day-ci/archive/20240911/202409112121.GHL72j84-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240911/202409112121.GHL72j84-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409112121.GHL72j84-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/usb/typec/ucsi/cros_ec_ucsi_main.c:178:24: sparse: sparse: symbol 'cros_ucsi_ops' was not declared. Should it be static?
vim +/cros_ucsi_ops +178 drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 177
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 @178 struct ucsi_operations cros_ucsi_ops = {
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 179 .read_version = cros_ucsi_read_version,
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 180 .read_cci = cros_ucsi_read_cci,
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 181 .read_message_in = cros_ucsi_read_message_in,
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 182 .async_control = cros_ucsi_async_control,
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 183 .sync_control = cros_ucsi_sync_control,
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 184 };
ef8d61204d9db5 drivers/usb/typec/ucsi/cros_ec_ucsi.c Pavan Holla 2024-09-10 185
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-10 10:15 ` [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink Łukasz Bartosik
2024-09-11 14:00 ` kernel test robot
@ 2024-09-11 14:07 ` Heikki Krogerus
2024-09-14 22:08 ` Łukasz Bartosik
2024-09-21 7:11 ` kernel test robot
2 siblings, 1 reply; 35+ messages in thread
From: Heikki Krogerus @ 2024-09-11 14:07 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
Hi,
On Tue, Sep 10, 2024 at 10:15:25AM +0000, Łukasz Bartosik wrote:
> Add netlink to ChromeOS UCSI driver to allow forwarding
> of UCSI messages to userspace for debugging and testing
> purposes.
Why does this need to be cros_ec specific?
> Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> ---
> MAINTAINERS | 4 +-
> drivers/usb/typec/ucsi/Makefile | 4 +-
> .../{cros_ec_ucsi.c => cros_ec_ucsi_main.c} | 66 +++++++++++++-
> drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c | 87 +++++++++++++++++++
> drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h | 52 +++++++++++
> 5 files changed, 209 insertions(+), 4 deletions(-)
> rename drivers/usb/typec/ucsi/{cros_ec_ucsi.c => cros_ec_ucsi_main.c} (79%)
> create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c
> create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index d084f32208f0..2afb406a24ce 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5305,7 +5305,9 @@ M: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> M: Łukasz Bartosik <ukaszb@chromium.org>
> L: chrome-platform@lists.linux.dev
> S: Maintained
> -F: drivers/usb/typec/ucsi/cros_ec_ucsi.c
> +F: drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
> +F: drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c
> +F: drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h
> F: drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
>
> CHRONTEL CH7322 CEC DRIVER
> diff --git a/drivers/usb/typec/ucsi/Makefile b/drivers/usb/typec/ucsi/Makefile
> index be98a879104d..82d960394c39 100644
> --- a/drivers/usb/typec/ucsi/Makefile
> +++ b/drivers/usb/typec/ucsi/Makefile
> @@ -21,5 +21,7 @@ obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o
> obj-$(CONFIG_UCSI_CCG) += ucsi_ccg.o
> obj-$(CONFIG_UCSI_STM32G0) += ucsi_stm32g0.o
> obj-$(CONFIG_UCSI_PMIC_GLINK) += ucsi_glink.o
> -obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o
> obj-$(CONFIG_UCSI_LENOVO_YOGA_C630) += ucsi_yoga_c630.o
> +
> +obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o
> +cros_ec_ucsi-y := cros_ec_ucsi_main.o cros_ec_ucsi_nl.o
> diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
> similarity index 79%
> rename from drivers/usb/typec/ucsi/cros_ec_ucsi.c
> rename to drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
> index 70185616ec86..008b61921278 100644
> --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
> @@ -19,6 +19,7 @@
> #define CREATE_TRACE_POINTS
> #include "ucsi.h"
> #include "cros_ec_ucsi_trace.h"
> +#include "cros_ec_ucsi_nl.h"
>
> /*
> * Maximum size in bytes of a UCSI message between AP and EC
> @@ -43,6 +44,43 @@ struct cros_ucsi_data {
> unsigned long flags;
> };
>
> +/*
> + * When set to true the cros_ec_ucsi driver will forward all UCSI messages
> + * exchanged between OPM <-> PPM to userspace through netlink
> + */
> +static bool is_ap_sniffer_en;
> +
> +static ssize_t enable_ap_sniffer_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + return sprintf(buf, "%d\n", is_ap_sniffer_en);
> +}
> +
> +static ssize_t enable_ap_sniffer_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + u8 value;
> +
> + if (kstrtou8(buf, 0, &value))
> + return -EINVAL;
> +
> + is_ap_sniffer_en = value ? 1 : 0;
> + return count;
> +}
> +
> +static DEVICE_ATTR_RW(enable_ap_sniffer);
> +
> +static struct attribute *cros_ec_ucsi_attrs[] = {
> + &dev_attr_enable_ap_sniffer.attr,
> + NULL
> +};
> +
> +static const struct attribute_group cros_ec_ucsi_attrs_grp = {
> + .attrs = cros_ec_ucsi_attrs,
> +};
Undocumented sysfs entry.
> static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
> size_t val_len)
> {
> @@ -65,6 +103,9 @@ static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
> return ret;
> }
>
> + if (is_ap_sniffer_en)
> + nl_cros_ec_bcast_msg(NL_CROS_EC_TO_PPM, NL_CROS_EC_RD, offset,
> + val, val_len);
> trace_cros_ec_opm_to_ppm_rd(offset, val, val_len);
> return 0;
> }
> @@ -101,6 +142,9 @@ static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
> return ret;
> }
>
> + if (is_ap_sniffer_en)
> + nl_cros_ec_bcast_msg(NL_CROS_EC_TO_PPM, NL_CROS_EC_WR,
> + req->offset, (u8 *) &cmd, sizeof(cmd));
> trace_cros_ec_opm_to_ppm_wr(req->offset, &cmd, sizeof(cmd));
> return 0;
> }
> @@ -144,6 +188,8 @@ static void cros_ucsi_work(struct work_struct *work)
> struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
> u32 cci;
>
> + if (is_ap_sniffer_en)
> + nl_cros_ec_bcast_msg(NL_CROS_EC_TO_OPM, 0, 0, NULL, 0);
> trace_cros_ec_ppm_to_opm(0);
>
> if (cros_ucsi_read_cci(udata->ucsi, &cci))
> @@ -229,13 +275,29 @@ static int cros_ucsi_probe(struct platform_device *pdev)
> return ret;
> }
>
> + ret = nl_cros_ec_register();
> + if (ret) {
> + dev_err(dev, "failed to register netlink: error=%d", ret);
> + cros_ucsi_destroy(udata);
> + return ret;
> + }
> +
> + ret = sysfs_create_group(&dev->kobj, &cros_ec_ucsi_attrs_grp);
> + if (ret) {
> + dev_err(dev, "failed to register sysfs group: error=%d", ret);
> + cros_ucsi_destroy(udata);
> + return ret;
> + }
> +
> return 0;
> }
>
> -static void cros_ucsi_remove(struct platform_device *dev)
> +static void cros_ucsi_remove(struct platform_device *pdev)
> {
> - struct cros_ucsi_data *udata = platform_get_drvdata(dev);
> + struct cros_ucsi_data *udata = platform_get_drvdata(pdev);
Please merge that change into the patch 3/8.
> + sysfs_remove_group(&pdev->dev.kobj, &cros_ec_ucsi_attrs_grp);
> + nl_cros_ec_unregister();
> ucsi_unregister(udata->ucsi);
> cros_ucsi_destroy(udata);
> }
thanks,
--
heikki
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-11 14:07 ` Heikki Krogerus
@ 2024-09-14 22:08 ` Łukasz Bartosik
2024-09-19 9:38 ` Heikki Krogerus
0 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-14 22:08 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Wed, Sep 11, 2024 at 4:09 PM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> Hi,
>
> On Tue, Sep 10, 2024 at 10:15:25AM +0000, Łukasz Bartosik wrote:
> > Add netlink to ChromeOS UCSI driver to allow forwarding
> > of UCSI messages to userspace for debugging and testing
> > purposes.
>
> Why does this need to be cros_ec specific?
>
You're right. Netlink does not have to be cros_ec_ucsi specific.
Would you like to have netlink in typec_ucsi ?
> > Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> > ---
> > MAINTAINERS | 4 +-
> > drivers/usb/typec/ucsi/Makefile | 4 +-
> > .../{cros_ec_ucsi.c => cros_ec_ucsi_main.c} | 66 +++++++++++++-
> > drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c | 87 +++++++++++++++++++
> > drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h | 52 +++++++++++
> > 5 files changed, 209 insertions(+), 4 deletions(-)
> > rename drivers/usb/typec/ucsi/{cros_ec_ucsi.c => cros_ec_ucsi_main.c} (79%)
> > create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c
> > create mode 100644 drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index d084f32208f0..2afb406a24ce 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -5305,7 +5305,9 @@ M: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> > M: Łukasz Bartosik <ukaszb@chromium.org>
> > L: chrome-platform@lists.linux.dev
> > S: Maintained
> > -F: drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > +F: drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
> > +F: drivers/usb/typec/ucsi/cros_ec_ucsi_nl.c
> > +F: drivers/usb/typec/ucsi/cros_ec_ucsi_nl.h
> > F: drivers/usb/typec/ucsi/cros_ec_ucsi_trace.h
> >
> > CHRONTEL CH7322 CEC DRIVER
> > diff --git a/drivers/usb/typec/ucsi/Makefile b/drivers/usb/typec/ucsi/Makefile
> > index be98a879104d..82d960394c39 100644
> > --- a/drivers/usb/typec/ucsi/Makefile
> > +++ b/drivers/usb/typec/ucsi/Makefile
> > @@ -21,5 +21,7 @@ obj-$(CONFIG_UCSI_ACPI) += ucsi_acpi.o
> > obj-$(CONFIG_UCSI_CCG) += ucsi_ccg.o
> > obj-$(CONFIG_UCSI_STM32G0) += ucsi_stm32g0.o
> > obj-$(CONFIG_UCSI_PMIC_GLINK) += ucsi_glink.o
> > -obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o
> > obj-$(CONFIG_UCSI_LENOVO_YOGA_C630) += ucsi_yoga_c630.o
> > +
> > +obj-$(CONFIG_CROS_EC_UCSI) += cros_ec_ucsi.o
> > +cros_ec_ucsi-y := cros_ec_ucsi_main.o cros_ec_ucsi_nl.o
> > diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
> > similarity index 79%
> > rename from drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > rename to drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
> > index 70185616ec86..008b61921278 100644
> > --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
> > +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi_main.c
> > @@ -19,6 +19,7 @@
> > #define CREATE_TRACE_POINTS
> > #include "ucsi.h"
> > #include "cros_ec_ucsi_trace.h"
> > +#include "cros_ec_ucsi_nl.h"
> >
> > /*
> > * Maximum size in bytes of a UCSI message between AP and EC
> > @@ -43,6 +44,43 @@ struct cros_ucsi_data {
> > unsigned long flags;
> > };
> >
> > +/*
> > + * When set to true the cros_ec_ucsi driver will forward all UCSI messages
> > + * exchanged between OPM <-> PPM to userspace through netlink
> > + */
> > +static bool is_ap_sniffer_en;
> > +
> > +static ssize_t enable_ap_sniffer_show(struct device *dev,
> > + struct device_attribute *attr,
> > + char *buf)
> > +{
> > + return sprintf(buf, "%d\n", is_ap_sniffer_en);
> > +}
> > +
> > +static ssize_t enable_ap_sniffer_store(struct device *dev,
> > + struct device_attribute *attr,
> > + const char *buf, size_t count)
> > +{
> > + u8 value;
> > +
> > + if (kstrtou8(buf, 0, &value))
> > + return -EINVAL;
> > +
> > + is_ap_sniffer_en = value ? 1 : 0;
> > + return count;
> > +}
> > +
> > +static DEVICE_ATTR_RW(enable_ap_sniffer);
> > +
> > +static struct attribute *cros_ec_ucsi_attrs[] = {
> > + &dev_attr_enable_ap_sniffer.attr,
> > + NULL
> > +};
> > +
> > +static const struct attribute_group cros_ec_ucsi_attrs_grp = {
> > + .attrs = cros_ec_ucsi_attrs,
> > +};
>
> Undocumented sysfs entry.
>
I will document the new sysfs entry.
> > static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
> > size_t val_len)
> > {
> > @@ -65,6 +103,9 @@ static int cros_ucsi_read(struct ucsi *ucsi, unsigned int offset, void *val,
> > return ret;
> > }
> >
> > + if (is_ap_sniffer_en)
> > + nl_cros_ec_bcast_msg(NL_CROS_EC_TO_PPM, NL_CROS_EC_RD, offset,
> > + val, val_len);
> > trace_cros_ec_opm_to_ppm_rd(offset, val, val_len);
> > return 0;
> > }
> > @@ -101,6 +142,9 @@ static int cros_ucsi_async_control(struct ucsi *ucsi, u64 cmd)
> > return ret;
> > }
> >
> > + if (is_ap_sniffer_en)
> > + nl_cros_ec_bcast_msg(NL_CROS_EC_TO_PPM, NL_CROS_EC_WR,
> > + req->offset, (u8 *) &cmd, sizeof(cmd));
> > trace_cros_ec_opm_to_ppm_wr(req->offset, &cmd, sizeof(cmd));
> > return 0;
> > }
> > @@ -144,6 +188,8 @@ static void cros_ucsi_work(struct work_struct *work)
> > struct cros_ucsi_data *udata = container_of(work, struct cros_ucsi_data, work);
> > u32 cci;
> >
> > + if (is_ap_sniffer_en)
> > + nl_cros_ec_bcast_msg(NL_CROS_EC_TO_OPM, 0, 0, NULL, 0);
> > trace_cros_ec_ppm_to_opm(0);
> >
> > if (cros_ucsi_read_cci(udata->ucsi, &cci))
> > @@ -229,13 +275,29 @@ static int cros_ucsi_probe(struct platform_device *pdev)
> > return ret;
> > }
> >
> > + ret = nl_cros_ec_register();
> > + if (ret) {
> > + dev_err(dev, "failed to register netlink: error=%d", ret);
> > + cros_ucsi_destroy(udata);
> > + return ret;
> > + }
> > +
> > + ret = sysfs_create_group(&dev->kobj, &cros_ec_ucsi_attrs_grp);
> > + if (ret) {
> > + dev_err(dev, "failed to register sysfs group: error=%d", ret);
> > + cros_ucsi_destroy(udata);
> > + return ret;
> > + }
> > +
> > return 0;
> > }
> >
> > -static void cros_ucsi_remove(struct platform_device *dev)
> > +static void cros_ucsi_remove(struct platform_device *pdev)
> > {
> > - struct cros_ucsi_data *udata = platform_get_drvdata(dev);
> > + struct cros_ucsi_data *udata = platform_get_drvdata(pdev);
>
> Please merge that change into the patch 3/8.
>
I will merge this change to the"usb: typec: ucsi: Implement ChromeOS
UCSI driver".
Thanks,
Lukasz
> > + sysfs_remove_group(&pdev->dev.kobj, &cros_ec_ucsi_attrs_grp);
> > + nl_cros_ec_unregister();
> > ucsi_unregister(udata->ucsi);
> > cros_ucsi_destroy(udata);
> > }
>
> thanks,
>
> --
> heikki
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-14 22:08 ` Łukasz Bartosik
@ 2024-09-19 9:38 ` Heikki Krogerus
2024-09-19 18:03 ` Łukasz Bartosik
0 siblings, 1 reply; 35+ messages in thread
From: Heikki Krogerus @ 2024-09-19 9:38 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Sun, Sep 15, 2024 at 12:08:45AM +0200, Łukasz Bartosik wrote:
> On Wed, Sep 11, 2024 at 4:09 PM Heikki Krogerus
> <heikki.krogerus@linux.intel.com> wrote:
> >
> > Hi,
> >
> > On Tue, Sep 10, 2024 at 10:15:25AM +0000, Łukasz Bartosik wrote:
> > > Add netlink to ChromeOS UCSI driver to allow forwarding
> > > of UCSI messages to userspace for debugging and testing
> > > purposes.
> >
> > Why does this need to be cros_ec specific?
> >
>
> You're right. Netlink does not have to be cros_ec_ucsi specific.
> Would you like to have netlink in typec_ucsi ?
Does it need to be netlink? We would then have tracepoints, the
custom debugfs interface, and this netlink interface.
I think this information could be exposed via trancepoints (unless I'm
missing something).
Br,
--
heikki
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-19 9:38 ` Heikki Krogerus
@ 2024-09-19 18:03 ` Łukasz Bartosik
2024-09-19 20:00 ` Dmitry Baryshkov
0 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-19 18:03 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Lee Jones, Benson Leung, Guenter Roeck,
Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Thu, Sep 19, 2024 at 11:38 AM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> On Sun, Sep 15, 2024 at 12:08:45AM +0200, Łukasz Bartosik wrote:
> > On Wed, Sep 11, 2024 at 4:09 PM Heikki Krogerus
> > <heikki.krogerus@linux.intel.com> wrote:
> > >
> > > Hi,
> > >
> > > On Tue, Sep 10, 2024 at 10:15:25AM +0000, Łukasz Bartosik wrote:
> > > > Add netlink to ChromeOS UCSI driver to allow forwarding
> > > > of UCSI messages to userspace for debugging and testing
> > > > purposes.
> > >
> > > Why does this need to be cros_ec specific?
> > >
> >
> > You're right. Netlink does not have to be cros_ec_ucsi specific.
> > Would you like to have netlink in typec_ucsi ?
>
> Does it need to be netlink? We would then have tracepoints, the
> custom debugfs interface, and this netlink interface.
>
> I think this information could be exposed via trancepoints (unless I'm
> missing something).
>
Hi Heikki,
I agree that there is a common area which is covered by both trace
events and netlink.
However netlink also has advantages which IMHO trace events lack. One
of our cases is that
from userspace it is easy to forward the UCSI messages to a Wireshark
with a plugin
which can decode it. Another case is to use UCSI forwarded messages
through netlink
for testing and validation of chromebooks.
How about leaving netlink specific to cros_ec_ucsi driver ? Would you
consent to that ?
Thanks,
Lukasz
> Br,
>
> --
> heikki
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-19 18:03 ` Łukasz Bartosik
@ 2024-09-19 20:00 ` Dmitry Baryshkov
2024-09-23 14:42 ` Łukasz Bartosik
0 siblings, 1 reply; 35+ messages in thread
From: Dmitry Baryshkov @ 2024-09-19 20:00 UTC (permalink / raw)
To: Łukasz Bartosik
Cc: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih,
linux-usb, chrome-platform
On Thu, Sep 19, 2024 at 08:03:37PM GMT, Łukasz Bartosik wrote:
> On Thu, Sep 19, 2024 at 11:38 AM Heikki Krogerus
> <heikki.krogerus@linux.intel.com> wrote:
> >
> > On Sun, Sep 15, 2024 at 12:08:45AM +0200, Łukasz Bartosik wrote:
> > > On Wed, Sep 11, 2024 at 4:09 PM Heikki Krogerus
> > > <heikki.krogerus@linux.intel.com> wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Tue, Sep 10, 2024 at 10:15:25AM +0000, Łukasz Bartosik wrote:
> > > > > Add netlink to ChromeOS UCSI driver to allow forwarding
> > > > > of UCSI messages to userspace for debugging and testing
> > > > > purposes.
> > > >
> > > > Why does this need to be cros_ec specific?
> > > >
> > >
> > > You're right. Netlink does not have to be cros_ec_ucsi specific.
> > > Would you like to have netlink in typec_ucsi ?
> >
> > Does it need to be netlink? We would then have tracepoints, the
> > custom debugfs interface, and this netlink interface.
> >
> > I think this information could be exposed via trancepoints (unless I'm
> > missing something).
> >
>
> Hi Heikki,
>
> I agree that there is a common area which is covered by both trace
> events and netlink.
> However netlink also has advantages which IMHO trace events lack. One
> of our cases is that
> from userspace it is easy to forward the UCSI messages to a Wireshark
> with a plugin
> which can decode it. Another case is to use UCSI forwarded messages
> through netlink
> for testing and validation of chromebooks.
>
> How about leaving netlink specific to cros_ec_ucsi driver ? Would you
> consent to that ?
I think having it specific to cros_ec_ucsi is the worst option out of
three. It should either be generified to work with all UCSI drivers or
go away and be replaced by tracepoints (against, generic to all UCSI
drivers) or some other mechanism (e.g. TCPM has rolling log of
messages).
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-19 20:00 ` Dmitry Baryshkov
@ 2024-09-23 14:42 ` Łukasz Bartosik
0 siblings, 0 replies; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-23 14:42 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih,
linux-usb, chrome-platform
On Thu, Sep 19, 2024 at 10:00 PM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Thu, Sep 19, 2024 at 08:03:37PM GMT, Łukasz Bartosik wrote:
> > On Thu, Sep 19, 2024 at 11:38 AM Heikki Krogerus
> > <heikki.krogerus@linux.intel.com> wrote:
> > >
> > > On Sun, Sep 15, 2024 at 12:08:45AM +0200, Łukasz Bartosik wrote:
> > > > On Wed, Sep 11, 2024 at 4:09 PM Heikki Krogerus
> > > > <heikki.krogerus@linux.intel.com> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > On Tue, Sep 10, 2024 at 10:15:25AM +0000, Łukasz Bartosik wrote:
> > > > > > Add netlink to ChromeOS UCSI driver to allow forwarding
> > > > > > of UCSI messages to userspace for debugging and testing
> > > > > > purposes.
> > > > >
> > > > > Why does this need to be cros_ec specific?
> > > > >
> > > >
> > > > You're right. Netlink does not have to be cros_ec_ucsi specific.
> > > > Would you like to have netlink in typec_ucsi ?
> > >
> > > Does it need to be netlink? We would then have tracepoints, the
> > > custom debugfs interface, and this netlink interface.
> > >
> > > I think this information could be exposed via trancepoints (unless I'm
> > > missing something).
> > >
> >
> > Hi Heikki,
> >
> > I agree that there is a common area which is covered by both trace
> > events and netlink.
> > However netlink also has advantages which IMHO trace events lack. One
> > of our cases is that
> > from userspace it is easy to forward the UCSI messages to a Wireshark
> > with a plugin
> > which can decode it. Another case is to use UCSI forwarded messages
> > through netlink
> > for testing and validation of chromebooks.
> >
> > How about leaving netlink specific to cros_ec_ucsi driver ? Would you
> > consent to that ?
>
> I think having it specific to cros_ec_ucsi is the worst option out of
> three. It should either be generified to work with all UCSI drivers or
> go away and be replaced by tracepoints (against, generic to all UCSI
> drivers) or some other mechanism (e.g. TCPM has rolling log of
> messages).
>
I will come up with a proposal to make netlink generic to all UCSI
drivers.
Thanks,
Lukasz
> --
> With best wishes
> Dmitry
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
2024-09-10 10:15 ` [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink Łukasz Bartosik
2024-09-11 14:00 ` kernel test robot
2024-09-11 14:07 ` Heikki Krogerus
@ 2024-09-21 7:11 ` kernel test robot
2 siblings, 0 replies; 35+ messages in thread
From: kernel test robot @ 2024-09-21 7:11 UTC (permalink / raw)
To: Łukasz Bartosik, Heikki Krogerus, Greg Kroah-Hartman,
Lee Jones, Benson Leung, Guenter Roeck
Cc: llvm, oe-kbuild-all, Abhishek Pandit-Subedi, Pavan Holla,
Tzung-Bi Shih, linux-usb, chrome-platform
Hi Łukasz,
kernel test robot noticed the following build errors:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus lee-mfd/for-mfd-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.11 next-20240920]
[cannot apply to lee-mfd/for-mfd-fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/ukasz-Bartosik/platform-chrome-Update-ChromeOS-EC-header-for-UCSI/20240910-182729
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20240910101527.603452-7-ukaszb%40chromium.org
patch subject: [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink
config: x86_64-buildonly-randconfig-005-20240921 (https://download.01.org/0day-ci/archive/20240921/202409211431.LpvxyX25-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240921/202409211431.LpvxyX25-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409211431.LpvxyX25-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-mgr-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-bridge-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-region-test.o
>> ERROR: modpost: "genl_register_family" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
>> ERROR: modpost: "genl_unregister_family" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
>> ERROR: modpost: "__alloc_skb" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
>> ERROR: modpost: "genlmsg_put" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
>> ERROR: modpost: "nla_put" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
>> ERROR: modpost: "skb_trim" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
>> ERROR: modpost: "sk_skb_reason_drop" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
>> ERROR: modpost: "init_net" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
>> ERROR: modpost: "netlink_broadcast_filtered" [drivers/usb/typec/ucsi/cros_ec_ucsi.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v6 7/8] mfd: cros_ec: Load cros_ec_ucsi on supported ECs
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
` (5 preceding siblings ...)
2024-09-10 10:15 ` [PATCH v6 6/8] usb: typec: cros_ec_ucsi: Add netlink Łukasz Bartosik
@ 2024-09-10 10:15 ` Łukasz Bartosik
2024-09-10 10:15 ` [PATCH v6 8/8] mfd: cros_ec: Don't load charger with UCSI Łukasz Bartosik
` (2 subsequent siblings)
9 siblings, 0 replies; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-10 10:15 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
From: Pavan Holla <pholla@chromium.org>
Load cros_ec_ucsi driver if the ChromeOS EC implements
UCSI Platform Policy Manager (PPM).
Signed-off-by: Pavan Holla <pholla@chromium.org>
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
drivers/mfd/cros_ec_dev.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index e2aae8918679..d5d63df7fcbd 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -108,6 +108,10 @@ static const struct mfd_cell cros_ec_keyboard_leds_cells[] = {
{ .name = "cros-keyboard-leds", },
};
+static const struct mfd_cell cros_ec_ucsi_cells[] = {
+ { .name = "cros_ec_ucsi", },
+};
+
static const struct cros_feature_to_cells cros_subdevices[] = {
{
.id = EC_FEATURE_CEC,
@@ -124,6 +128,11 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
.mfd_cells = cros_ec_rtc_cells,
.num_cells = ARRAY_SIZE(cros_ec_rtc_cells),
},
+ {
+ .id = EC_FEATURE_UCSI_PPM,
+ .mfd_cells = cros_ec_ucsi_cells,
+ .num_cells = ARRAY_SIZE(cros_ec_ucsi_cells),
+ },
{
.id = EC_FEATURE_USB_PD,
.mfd_cells = cros_usbpd_charger_cells,
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 35+ messages in thread* [PATCH v6 8/8] mfd: cros_ec: Don't load charger with UCSI
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
` (6 preceding siblings ...)
2024-09-10 10:15 ` [PATCH v6 7/8] mfd: cros_ec: Load cros_ec_ucsi on supported ECs Łukasz Bartosik
@ 2024-09-10 10:15 ` Łukasz Bartosik
2024-10-09 10:11 ` (subset) " Lee Jones
2024-10-09 10:11 ` (subset) [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Lee Jones
2024-10-15 9:10 ` Lee Jones
9 siblings, 1 reply; 35+ messages in thread
From: Łukasz Bartosik @ 2024-09-10 10:15 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
When UCSI is enabled, don't load cros_usbpd_charger and cros_usbpd_logger
drivers. Charger functionality is provided by the UCSI driver already and
logging will need to be added.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
drivers/mfd/cros_ec_dev.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index d5d63df7fcbd..bc083c7b21de 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -133,11 +133,6 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
.mfd_cells = cros_ec_ucsi_cells,
.num_cells = ARRAY_SIZE(cros_ec_ucsi_cells),
},
- {
- .id = EC_FEATURE_USB_PD,
- .mfd_cells = cros_usbpd_charger_cells,
- .num_cells = ARRAY_SIZE(cros_usbpd_charger_cells),
- },
{
.id = EC_FEATURE_HANG_DETECT,
.mfd_cells = cros_ec_wdt_cells,
@@ -261,6 +256,21 @@ static int ec_device_probe(struct platform_device *pdev)
}
}
+ /*
+ * UCSI provides power supply information so we don't need to separately
+ * load the cros_usbpd_charger driver.
+ */
+ if (cros_ec_check_features(ec, EC_FEATURE_USB_PD) &&
+ !cros_ec_check_features(ec, EC_FEATURE_UCSI_PPM)) {
+ retval = mfd_add_hotplug_devices(ec->dev,
+ cros_usbpd_charger_cells,
+ ARRAY_SIZE(cros_usbpd_charger_cells));
+
+ if (retval)
+ dev_warn(ec->dev, "failed to add usbpd-charger: %d\n",
+ retval);
+ }
+
/*
* Lightbar is a special case. Newer devices support autodetection,
* but older ones do not.
--
2.46.0.598.g6f2099f65c-goog
^ permalink raw reply related [flat|nested] 35+ messages in thread* Re: (subset) [PATCH v6 8/8] mfd: cros_ec: Don't load charger with UCSI
2024-09-10 10:15 ` [PATCH v6 8/8] mfd: cros_ec: Don't load charger with UCSI Łukasz Bartosik
@ 2024-10-09 10:11 ` Lee Jones
0 siblings, 0 replies; 35+ messages in thread
From: Lee Jones @ 2024-10-09 10:11 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Łukasz Bartosik
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Tue, 10 Sep 2024 10:15:27 +0000, Łukasz Bartosik wrote:
> When UCSI is enabled, don't load cros_usbpd_charger and cros_usbpd_logger
> drivers. Charger functionality is provided by the UCSI driver already and
> logging will need to be added.
>
>
Applied, thanks!
[8/8] mfd: cros_ec: Don't load charger with UCSI
commit: 1b11529097cebae663b36b45886600a14f04eaa1
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: (subset) [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
` (7 preceding siblings ...)
2024-09-10 10:15 ` [PATCH v6 8/8] mfd: cros_ec: Don't load charger with UCSI Łukasz Bartosik
@ 2024-10-09 10:11 ` Lee Jones
2024-10-15 9:10 ` Lee Jones
9 siblings, 0 replies; 35+ messages in thread
From: Lee Jones @ 2024-10-09 10:11 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Łukasz Bartosik
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Tue, 10 Sep 2024 10:15:19 +0000, Łukasz Bartosik wrote:
> This series implements a UCSI ChromeOS EC transport driver.
> The ChromeOS EC is expected to implement UCSI Platform Policy
> Manager (PPM).
>
Applied, thanks!
[7/8] mfd: cros_ec: Load cros_ec_ucsi on supported ECs
commit: c2b9dd2fcd15b6cddaeb9559720a67a6268b2fa2
[8/8] mfd: cros_ec: Don't load charger with UCSI
commit: 1b11529097cebae663b36b45886600a14f04eaa1
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: (subset) [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS
2024-09-10 10:15 [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Łukasz Bartosik
` (8 preceding siblings ...)
2024-10-09 10:11 ` (subset) [PATCH v6 0/8] usb: typec: Implement UCSI driver for ChromeOS Lee Jones
@ 2024-10-15 9:10 ` Lee Jones
9 siblings, 0 replies; 35+ messages in thread
From: Lee Jones @ 2024-10-15 9:10 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Lee Jones, Benson Leung,
Guenter Roeck, Łukasz Bartosik
Cc: Abhishek Pandit-Subedi, Pavan Holla, Tzung-Bi Shih, linux-usb,
chrome-platform
On Tue, 10 Sep 2024 10:15:19 +0000, Łukasz Bartosik wrote:
> This series implements a UCSI ChromeOS EC transport driver.
> The ChromeOS EC is expected to implement UCSI Platform Policy
> Manager (PPM).
>
Applied, thanks!
[2/8] platform/chrome: Update EC feature flags
commit: 04a6116a36dfb86c80c930aaa03c66c2deb8e434
[7/8] mfd: cros_ec: Load cros_ec_ucsi on supported ECs
(no commit info)
[8/8] mfd: cros_ec: Don't load charger with UCSI
(no commit info)
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 35+ messages in thread