From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Hector Martin <marcan@marcan.st>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Sven Peter" <sven@svenpeter.dev>,
"Guido Günther" <agx@sigxcpu.org>,
"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: typec: tipd: Fix initialization sequence for cd321x
Date: Thu, 18 Nov 2021 15:12:17 +0200 [thread overview]
Message-ID: <YZZRMfchQ7Y6gPqQ@kuha.fi.intel.com> (raw)
In-Reply-To: <20211117151450.207168-3-marcan@marcan.st>
Hi,
On Thu, Nov 18, 2021 at 12:14:50AM +0900, Hector Martin wrote:
> The power state switch needs to happen first, as that
> kickstarts the firmware into normal mode.
>
> Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Please resend these with the appropriate Fixes tag included.
> ---
> drivers/usb/typec/tipd/core.c | 33 ++++++++++++++++-----------------
> 1 file changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index 4da5a0b2aed2..6d27a5b5e3ca 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -707,6 +707,7 @@ static int tps6598x_probe(struct i2c_client *client)
> u32 conf;
> u32 vid;
> int ret;
> + u64 mask1;
>
> tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
> if (!tps)
> @@ -730,11 +731,6 @@ static int tps6598x_probe(struct i2c_client *client)
> if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
> tps->i2c_protocol = true;
>
> - /* Make sure the controller has application firmware running */
> - ret = tps6598x_check_mode(tps);
> - if (ret)
> - return ret;
> -
> if (np && of_device_is_compatible(np, "apple,cd321x")) {
> /* Switch CD321X chips to the correct system power state */
> ret = cd321x_switch_power_state(tps, TPS_SYSTEM_POWER_STATE_S0);
> @@ -742,24 +738,27 @@ static int tps6598x_probe(struct i2c_client *client)
> return ret;
>
> /* CD321X chips have all interrupts masked initially */
> - ret = tps6598x_write64(tps, TPS_REG_INT_MASK1,
> - APPLE_CD_REG_INT_POWER_STATUS_UPDATE |
> - APPLE_CD_REG_INT_DATA_STATUS_UPDATE |
> - APPLE_CD_REG_INT_PLUG_EVENT);
> - if (ret)
> - return ret;
> + mask1 = APPLE_CD_REG_INT_POWER_STATUS_UPDATE |
> + APPLE_CD_REG_INT_DATA_STATUS_UPDATE |
> + APPLE_CD_REG_INT_PLUG_EVENT;
>
> irq_handler = cd321x_interrupt;
> } else {
> /* Enable power status, data status and plug event interrupts */
> - ret = tps6598x_write64(tps, TPS_REG_INT_MASK1,
> - TPS_REG_INT_POWER_STATUS_UPDATE |
> - TPS_REG_INT_DATA_STATUS_UPDATE |
> - TPS_REG_INT_PLUG_EVENT);
> - if (ret)
> - return ret;
> + mask1 = TPS_REG_INT_POWER_STATUS_UPDATE |
> + TPS_REG_INT_DATA_STATUS_UPDATE |
> + TPS_REG_INT_PLUG_EVENT;
> }
>
> + /* Make sure the controller has application firmware running */
> + ret = tps6598x_check_mode(tps);
> + if (ret)
> + return ret;
> +
> + ret = tps6598x_write64(tps, TPS_REG_INT_MASK1, mask1);
> + if (ret)
> + return ret;
> +
> ret = tps6598x_read32(tps, TPS_REG_STATUS, &status);
> if (ret < 0)
> return ret;
> --
> 2.33.0
thanks,
--
heikki
next prev parent reply other threads:[~2021-11-18 13:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 15:14 [PATCH 0/2] usb: typec: tipd: Fixes for Apple M1 (CD321X) support Hector Martin
2021-11-17 15:14 ` [PATCH 1/2] usb: typec: tipd: Fix typo in cd321x_switch_power_state Hector Martin
2021-11-17 16:03 ` Greg Kroah-Hartman
2021-11-17 16:07 ` Hector Martin
2021-11-18 13:05 ` Heikki Krogerus
2021-11-17 15:14 ` [PATCH 2/2] usb: typec: tipd: Fix initialization sequence for cd321x Hector Martin
2021-11-17 16:04 ` Greg Kroah-Hartman
2021-11-17 16:11 ` Hector Martin
2021-11-18 13:12 ` Heikki Krogerus [this message]
2021-11-20 3:08 ` Hector Martin
2021-11-17 18:19 ` [PATCH 0/2] usb: typec: tipd: Fixes for Apple M1 (CD321X) support Sven Peter
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=YZZRMfchQ7Y6gPqQ@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=agx@sigxcpu.org \
--cc=alyssa@rosenzweig.io \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=sven@svenpeter.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).