From: Ajay Gupta <ajaykuee@gmail.com>
To: heikki.krogerus@linux.intel.com, wsa@the-dreams.de
Cc: linux-usb@vger.kernel.org, linux-i2c@vger.kernel.org,
Ajay Gupta <ajayg@nvidia.com>
Subject: [PATCH v2 4/5] i2c: nvidia-gpu: resume ccgx i2c client
Date: Mon, 20 May 2019 11:37:49 -0700 [thread overview]
Message-ID: <20190520183750.2932-5-ajayg@nvidia.com> (raw)
In-Reply-To: <20190520183750.2932-1-ajayg@nvidia.com>
From: Ajay Gupta <ajayg@nvidia.com>
Cypress USB Type-C CCGx controller firmware version 3.1.10
(which is being used in many NVIDIA GPU cards) has known issue of
not triggering interrupt when a USB device is hot plugged to runtime
resume the controller. If any GPU card gets latest kernel with runtime
pm support but does not get latest fixed firmware then also it should
continue to work and therefore a workaround is required to check for
any connector change event
The workaround is to request runtime resume of i2c client
which is UCSI Cypress CCGx driver. CCG driver will call the ISR
for any connector change event only if NVIDIA GPU has old
CCG firmware with the known issue.
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
---
Changes from v1->v2:
Fixed comment from Wolfram by fixing comment style.
drivers/i2c/busses/i2c-nvidia-gpu.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
index af445590041b..6826740fd0f5 100644
--- a/drivers/i2c/busses/i2c-nvidia-gpu.c
+++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
@@ -51,6 +51,7 @@ struct gpu_i2c_dev {
void __iomem *regs;
struct i2c_adapter adapter;
struct i2c_board_info *gpu_ccgx_ucsi;
+ struct i2c_client *ccgx_client;
};
static void gpu_enable_i2c_bus(struct gpu_i2c_dev *i2cd)
@@ -271,8 +272,6 @@ static const struct property_entry ccgx_props[] = {
static int gpu_populate_client(struct gpu_i2c_dev *i2cd, int irq)
{
- struct i2c_client *ccgx_client;
-
i2cd->gpu_ccgx_ucsi = devm_kzalloc(i2cd->dev,
sizeof(*i2cd->gpu_ccgx_ucsi),
GFP_KERNEL);
@@ -284,8 +283,8 @@ static int gpu_populate_client(struct gpu_i2c_dev *i2cd, int irq)
i2cd->gpu_ccgx_ucsi->addr = 0x8;
i2cd->gpu_ccgx_ucsi->irq = irq;
i2cd->gpu_ccgx_ucsi->properties = ccgx_props;
- ccgx_client = i2c_new_device(&i2cd->adapter, i2cd->gpu_ccgx_ucsi);
- if (!ccgx_client)
+ i2cd->ccgx_client = i2c_new_device(&i2cd->adapter, i2cd->gpu_ccgx_ucsi);
+ if (!i2cd->ccgx_client)
return -ENODEV;
return 0;
@@ -375,6 +374,13 @@ static __maybe_unused int gpu_i2c_resume(struct device *dev)
struct gpu_i2c_dev *i2cd = dev_get_drvdata(dev);
gpu_enable_i2c_bus(i2cd);
+ /*
+ * Runtime resume ccgx client so that it can see for any
+ * connector change event. Old ccg firmware has known
+ * issue of not triggering interrupt when a device is
+ * connected to runtime resume the controller.
+ */
+ pm_request_resume(&i2cd->ccgx_client->dev);
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2019-05-20 18:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 18:37 [PATCH v2 0/5] usb: typec: ucsi: ccg: add runtime pm support Ajay Gupta
2019-05-20 18:37 ` [PATCH v2 1/5] i2c: nvidia-gpu: refactor master_xfer Ajay Gupta
2019-05-20 18:37 ` [PATCH v2 2/5] i2c: nvidia-gpu: add runtime pm support Ajay Gupta
2019-05-20 18:37 ` [PATCH v2 3/5] usb: typec: ucsi: ccg: enable " Ajay Gupta
2019-05-21 13:37 ` Heikki Krogerus
2019-05-21 13:49 ` Heikki Krogerus
2019-05-21 17:44 ` Ajay Gupta
2019-05-22 11:12 ` Heikki Krogerus
2019-05-20 18:37 ` Ajay Gupta [this message]
2019-05-20 18:37 ` [PATCH v2 5/5] usb: typec: ucsi: ccg: add runtime pm workaround Ajay Gupta
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=20190520183750.2932-5-ajayg@nvidia.com \
--to=ajaykuee@gmail.com \
--cc=ajayg@nvidia.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=wsa@the-dreams.de \
/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).