From: soren.brinkmann@xilinx.com (Sören Brinkmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] i2c: cadence: Move to sensible power management
Date: Wed, 28 Oct 2015 09:18:10 -0700 [thread overview]
Message-ID: <20151028161810.GB6436@xsjsorenbubuntu> (raw)
In-Reply-To: <1446017200-30373-1-git-send-email-shubhraj@xilinx.com>
Hi Shubhrajyoti,
On Wed, 2015-10-28 at 12:56PM +0530, Shubhrajyoti Datta wrote:
> Currently the clocks are enabled at probe and disabled at remove.
> Which keeps the clocks enabled even if no transaction is going on.
> This patch enables the clocks at the start of transfer and disables
> after it.
>
> Also adapts to runtime pm.
> Remove xi2c->suspended and use pm runtime status instead.
>
> converts dev pm to const to silence a checkpatch warning.
>
> Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com>
To me, this looks all good. Just one small concern below.
> ---
> changes since v2
> update the cc list
>
> drivers/i2c/busses/i2c-cadence.c | 73 ++++++++++++++++++++++++--------------
> 1 files changed, 46 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index 84deed6..6b08d16 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -18,6 +18,7 @@
> #include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/of.h>
> +#include <linux/pm_runtime.h>
>
> /* Register offsets for the I2C device. */
> #define CDNS_I2C_CR_OFFSET 0x00 /* Control Register, RW */
> @@ -96,6 +97,8 @@
> CDNS_I2C_IXR_COMP)
>
> #define CDNS_I2C_TIMEOUT msecs_to_jiffies(1000)
> +/* timeout for pm runtime autosuspend */
> +#define CNDS_I2C_PM_TIMEOUT 1000 /* ms */
>
> #define CDNS_I2C_FIFO_DEPTH 16
> /* FIFO depth at which the DATA interrupt occurs */
> @@ -128,7 +131,6 @@
> * @xfer_done: Transfer complete status
> * @p_send_buf: Pointer to transmit buffer
> * @p_recv_buf: Pointer to receive buffer
> - * @suspended: Flag holding the device's PM status
> * @send_count: Number of bytes still expected to send
> * @recv_count: Number of bytes still expected to receive
> * @curr_recv_count: Number of bytes to be received in current transfer
> @@ -141,6 +143,7 @@
> * @quirks: flag for broken hold bit usage in r1p10
> */
> struct cdns_i2c {
> + struct device *dev;
> void __iomem *membase;
> struct i2c_adapter adap;
> struct i2c_msg *p_msg;
> @@ -148,7 +151,6 @@ struct cdns_i2c {
> struct completion xfer_done;
> unsigned char *p_send_buf;
> unsigned char *p_recv_buf;
> - u8 suspended;
There might have been a reason to store this flag here. Did you test
this with lockdep and CONFIG_DEBUG_ATOMIC_SLEEP? Just to make sure that
nothing that can sleep is called from atomic context.
S?ren
next prev parent reply other threads:[~2015-10-28 16:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-28 7:26 [PATCH v2] i2c: cadence: Move to sensible power management Shubhrajyoti Datta
2015-10-28 16:18 ` Sören Brinkmann [this message]
2015-10-29 14:57 ` Shubhrajyoti Datta
2015-11-21 13:30 ` Shubhrajyoti Datta
2015-11-23 18:47 ` Sören Brinkmann
2015-11-24 4:28 ` Shubhrajyoti Datta
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=20151028161810.GB6436@xsjsorenbubuntu \
--to=soren.brinkmann@xilinx.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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