public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Pooja Katiyar <pooja.katiyar@intel.com>,
	linux-usb@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH v2 1/3] usb: typec: ucsi: Add support for message out data structure
Date: Tue, 1 Jul 2025 12:03:05 +0300	[thread overview]
Message-ID: <aGOkSVHxEGeAXFFV@kuha.fi.intel.com> (raw)
In-Reply-To: <da49edc4-4aa9-462f-94d4-a2f2c920619a@oss.qualcomm.com>

Hi Dmitry,

Please check the comment from Greg. I think we need to revert
back to the original. Please let us know if you still disagree.

But I tend to agree with Greg. There are too many parameters for the
functions like this. Let's just supply a separate function that can be
used to fill the message_out like Pooja originally suggested.

> > diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
> > index 6b92f296e985..c0426bb1e81b 100644
> > --- a/drivers/usb/typec/ucsi/ucsi_acpi.c
> > +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
> > @@ -86,6 +86,21 @@ static int ucsi_acpi_read_message_in(struct ucsi *ucsi, void *val, size_t val_le
> >   	return 0;
> >   }
> > +static int ucsi_acpi_write_message_out(struct ucsi *ucsi, void *data, size_t data_len)
> > +{
> > +	struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
> > +
> > +	if (!data || !data_len)
> > +		return -EINVAL;
> > +
> > +	if (ucsi->version <= UCSI_VERSION_1_2)
> > +		memcpy(ua->base + UCSI_MESSAGE_OUT, data, data_len);
> > +	else
> > +		memcpy(ua->base + UCSIv2_MESSAGE_OUT, data, data_len);
> > +
> > +	return ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_WRITE);
> 
> Why do we need extra WRITE? Isn't the one performed by
> ucsi_acpi_async_control() not enough?

This is actually a good point!

Syncing the mailbox before there is a command will confuse at least
some of the EC firmwares. But more importantly, the previous command
may still be in the control field, no? So that write may actually
cause the previous command to be executed again.

So Pooja, please drop that write.

thanks,

-- 
heikki

  reply	other threads:[~2025-07-01  9:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 18:10 [PATCH v2 0/3] usb: typec: ucsi: Add support for SET_PDOS command Pooja Katiyar
2025-06-27 18:10 ` [PATCH v2 1/3] usb: typec: ucsi: Add support for message out data structure Pooja Katiyar
2025-06-28  1:40   ` Dmitry Baryshkov
2025-07-01  9:03     ` Heikki Krogerus [this message]
2025-06-28 14:51   ` Greg KH
2025-07-01  8:46     ` Heikki Krogerus
2025-07-01  8:50       ` Dmitry Baryshkov
2025-07-01 10:05         ` Heikki Krogerus
2025-07-01 10:11           ` Dmitry Baryshkov
2025-07-01 12:51             ` Heikki Krogerus
2025-07-03  4:28               ` Katiyar, Pooja
2025-07-03 12:55                 ` Dmitry Baryshkov
2025-06-27 18:10 ` [PATCH v2 2/3] usb: typec: ucsi: Enable debugfs for message_out " Pooja Katiyar
2025-06-28  1:43   ` Dmitry Baryshkov
2025-06-27 18:10 ` [PATCH v2 3/3] usb: typec: ucsi: Add support for SET_PDOS command Pooja Katiyar
2025-06-28  1:43   ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aGOkSVHxEGeAXFFV@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pooja.katiyar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox