diff mbox series

[v5,1/8] platform/chrome: Update ChromeOS EC header for UCSI

Message ID 20240903163033.3170815-2-ukaszb@chromium.org (mailing list archive)
State Superseded
Headers show
Series usb: typec: Implement UCSI driver for ChromeOS | expand

Commit Message

Łukasz Bartosik Sept. 3, 2024, 4:30 p.m. UTC
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>
---
 .../linux/platform_data/cros_ec_commands.h    | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Comments

Tzung-Bi Shih Sept. 6, 2024, 8:44 a.m. UTC | #1
On Tue, Sep 03, 2024 at 04:30:26PM +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>

It needs your S-o-b tag at the end.  See [1].

[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by

> --- a/include/linux/platform_data/cros_ec_commands.h
> +++ b/include/linux/platform_data/cros_ec_commands.h
> @@ -5012,8 +5012,10 @@ struct ec_response_pd_status {
[...]
>  struct ec_response_host_event_status {
> -	uint32_t status;      /* PD MCU host event status */
> +	u32 status;      /* PD MCU host event status */

Even though ./scripts/checkpatch.pl dislikes it, but please don't do that.
The header is a re-import from EC's repo.  We should try not to be divergent
from the origin too much.

> +/*
> + * Read/write interface for UCSI OPM <-> PPM communication.
> + */

Same reason: it'd be better if it can align to [2].

[2]: https://crrev.com/1454f2e8dac20ca37428744345c1bb4fdec30255/include/ec_commands.h#8055

> +#define EC_CMD_UCSI_PPM_SET 0x0140
> +
> +/* The data size is stored in the host command protocol header. */
> +struct ec_params_ucsi_ppm_set {
> +	u16 offset;
> +	u8 data[];

Same for the u16 and u8.

> +struct ec_params_ucsi_ppm_get {
> +	u16 offset;
> +	u8 size;

Same here.
Łukasz Bartosik Sept. 6, 2024, 1:01 p.m. UTC | #2
On Fri, Sep 6, 2024 at 10:44 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> On Tue, Sep 03, 2024 at 04:30:26PM +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>
>
> It needs your S-o-b tag at the end.  See [1].
>
> [1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
>
> > --- a/include/linux/platform_data/cros_ec_commands.h
> > +++ b/include/linux/platform_data/cros_ec_commands.h
> > @@ -5012,8 +5012,10 @@ struct ec_response_pd_status {
> [...]
> >  struct ec_response_host_event_status {
> > -     uint32_t status;      /* PD MCU host event status */
> > +     u32 status;      /* PD MCU host event status */
>
> Even though ./scripts/checkpatch.pl dislikes it, but please don't do that.
> The header is a re-import from EC's repo.  We should try not to be divergent
> from the origin too much.
>
> > +/*
> > + * Read/write interface for UCSI OPM <-> PPM communication.
> > + */
>
> Same reason: it'd be better if it can align to [2].
>
> [2]: https://crrev.com/1454f2e8dac20ca37428744345c1bb4fdec30255/include/ec_commands.h#8055
>

I will do.

> > +#define EC_CMD_UCSI_PPM_SET 0x0140
> > +
> > +/* The data size is stored in the host command protocol header. */
> > +struct ec_params_ucsi_ppm_set {
> > +     u16 offset;
> > +     u8 data[];
>
> Same for the u16 and u8.
>
> > +struct ec_params_ucsi_ppm_get {
> > +     u16 offset;
> > +     u8 size;
>
> Same here.

It was a comment from Greg no to use uint*_t types but I agree the
changes I made are inconsistent with the rest of cros_ec_commands.h
file.

Greg would you be ok to stay with uint*_t types in cros_ec_commands.h
to be consistent with the rest of the file ?

Thanks,
Lukasz
diff mbox series

Patch

diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
index e574b790be6f..08b6c98ed890 100644
--- a/include/linux/platform_data/cros_ec_commands.h
+++ b/include/linux/platform_data/cros_ec_commands.h
@@ -5012,8 +5012,10 @@  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 */
+	u32 status;      /* PD MCU host event status */
 } __ec_align4;
 
 /* Set USB type-C port role and muxes */
@@ -6073,6 +6075,24 @@  struct ec_response_typec_vdm_response {
 
 #undef VDO_MAX_SIZE
 
+/*
+ * Read/write interface for UCSI OPM <-> PPM communication.
+ */
+#define EC_CMD_UCSI_PPM_SET 0x0140
+
+/* The data size is stored in the host command protocol header. */
+struct ec_params_ucsi_ppm_set {
+	u16 offset;
+	u8 data[];
+} __ec_align2;
+
+#define EC_CMD_UCSI_PPM_GET 0x0141
+
+struct ec_params_ucsi_ppm_get {
+	u16 offset;
+	u8 size;
+} __ec_align2;
+
 /*****************************************************************************/
 /* The command range 0x200-0x2FF is reserved for Rotor. */