public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chanho Park" <chanho61.park@samsung.com>
To: "'Marek Szyprowski'" <m.szyprowski@samsung.com>,
	<linux-samsung-soc@vger.kernel.org>, <linux-i2c@vger.kernel.org>
Cc: "'Krzysztof Kozlowski'" <krzysztof.kozlowski@linaro.org>,
	"'Alim Akhtar'" <alim.akhtar@samsung.com>,
	"'Andi Shyti'" <andi.shyti@kernel.org>,
	"'Wolfram Sang'" <wsa@kernel.org>
Subject: RE: [PATCH v2 3/3] i2c: s3c24xx: add support for atomic transfers
Date: Fri, 27 Oct 2023 19:54:47 +0900	[thread overview]
Message-ID: <000701da08c4$00aa1650$01fe42f0$@samsung.com> (raw)
In-Reply-To: <20231025121725.46028-4-m.szyprowski@samsung.com>

> -----Original Message-----
> From: Marek Szyprowski <m.szyprowski@samsung.com>
> Sent: Wednesday, October 25, 2023 9:17 PM
> To: linux-samsung-soc@vger.kernel.org; linux-i2c@vger.kernel.org
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>; Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org>; Alim Akhtar <alim.akhtar@samsung.com>;
> Andi Shyti <andi.shyti@kernel.org>; Wolfram Sang <wsa@kernel.org>
> Subject: [PATCH v2 3/3] i2c: s3c24xx: add support for atomic transfers
> 
> 
> Add support for atomic transfers using polling mode with interrupts
> intentionally disabled to get rid of the warning introduced by commit
> 63b96983a5dd ("i2c: core: introduce callbacks for atomic transfers")
> during system reboot and power-off.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Reviewed-by: Chanho Park <chanho61.park@samsung.com>

> ---
>  drivers/i2c/busses/i2c-s3c2410.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-
> s3c2410.c
> index 8da85cb42980..586b82b30bdf 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -76,6 +76,7 @@
>  #define QUIRK_HDMIPHY		(1 << 1)
>  #define QUIRK_NO_GPIO		(1 << 2)
>  #define QUIRK_POLL		(1 << 3)
> +#define QUIRK_ATOMIC		(1 << 4)
> 
>  /* Max time to wait for bus to become idle after a xfer (in us) */
>  #define S3C2410_IDLE_TIMEOUT	5000
> @@ -174,7 +175,7 @@ static inline void s3c24xx_i2c_master_complete(struct
> s3c24xx_i2c *i2c, int ret)
>  	if (ret)
>  		i2c->msg_idx = ret;
> 
> -	if (!(i2c->quirks & QUIRK_POLL))
> +	if (!(i2c->quirks & (QUIRK_POLL | QUIRK_ATOMIC)))
>  		wake_up(&i2c->wait);
>  }
> 
> @@ -700,7 +701,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
>  	s3c24xx_i2c_enable_irq(i2c);
>  	s3c24xx_i2c_message_start(i2c, msgs);
> 
> -	if (i2c->quirks & QUIRK_POLL) {
> +	if (i2c->quirks & (QUIRK_POLL | QUIRK_ATOMIC)) {
>  		while ((i2c->msg_num != 0) && is_ack(i2c)) {
>  			unsigned long stat = readl(i2c->regs +
> S3C2410_IICSTAT);
> 
> @@ -774,6 +775,21 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
>  	return -EREMOTEIO;
>  }
> 
> +static int s3c24xx_i2c_xfer_atomic(struct i2c_adapter *adap,
> +				   struct i2c_msg *msgs, int num)
> +{
> +	struct s3c24xx_i2c *i2c = (struct s3c24xx_i2c *)adap->algo_data;
> +	int ret;
> +
> +	disable_irq(i2c->irq);
> +	i2c->quirks |= QUIRK_ATOMIC;
> +	ret = s3c24xx_i2c_xfer(adap, msgs, num);
> +	i2c->quirks &= ~QUIRK_ATOMIC;
> +	enable_irq(i2c->irq);
> +
> +	return ret;
> +}
> +
>  /* declare our i2c functionality */
>  static u32 s3c24xx_i2c_func(struct i2c_adapter *adap)
>  {
> @@ -784,6 +800,7 @@ static u32 s3c24xx_i2c_func(struct i2c_adapter *adap)
>  /* i2c bus registration info */
>  static const struct i2c_algorithm s3c24xx_i2c_algorithm = {
>  	.master_xfer		= s3c24xx_i2c_xfer,
> +	.master_xfer_atomic     = s3c24xx_i2c_xfer_atomic,
>  	.functionality		= s3c24xx_i2c_func,
>  };
> 
> --
> 2.34.1



      reply	other threads:[~2023-10-27 10:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20231025121735eucas1p22b65a2c0bc6d30342c4935e3903823a1@eucas1p2.samsung.com>
2023-10-25 12:17 ` [PATCH v2 0/3] Add atomic transfers to s3c24xx i2c driver Marek Szyprowski
2023-10-25 12:17   ` [PATCH v2 1/3] i2c: s3c24xx: fix read transfers in polling mode Marek Szyprowski
2023-10-27 10:54     ` Chanho Park
     [not found]     ` <20231027133950.kntkq6ddgifaor76@zenone.zhora.eu>
2023-10-31 14:00       ` Marek Szyprowski
     [not found]       ` <3484d2c1-942b-4145-801f-8b8bda7dd9ec@samsung.com>
2023-11-02  0:49         ` Andi Shyti
2023-11-02 11:07           ` Marek Szyprowski
2023-11-02  1:31     ` 대인기/Tizen Platform Lab(SR)/삼성전자
2023-11-02 11:23       ` Marek Szyprowski
     [not found]       ` <ace37058-1bcb-4fb4-8ffe-628f5e9249c0@samsung.com>
2023-11-02 23:35         ` Andi Shyti
2023-10-25 12:17   ` [PATCH v2 2/3] i2c: s3c24xx: fix transferring more than one message " Marek Szyprowski
2023-10-27 10:55     ` Chanho Park
2023-10-25 12:17   ` [PATCH v2 3/3] i2c: s3c24xx: add support for atomic transfers Marek Szyprowski
2023-10-27 10:54     ` Chanho Park [this message]

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='000701da08c4$00aa1650$01fe42f0$@samsung.com' \
    --to=chanho61.park@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andi.shyti@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=wsa@kernel.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