linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Tan Chin Yew <chin.yew.tan@intel.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: designware: Get selected speed mode sda-hold-time via ACPI
Date: Tue, 28 Mar 2017 12:13:46 +0300	[thread overview]
Message-ID: <1490692426.708.26.camel@linux.intel.com> (raw)
In-Reply-To: <1490690882-11623-2-git-send-email-chin.yew.tan@intel.com>

On Tue, 2017-03-28 at 16:48 +0800, Tan Chin Yew wrote:
> Sda-hold-time is an important parameter for tuning i2c to meet the
> electrical specification especially for high speed. I2C with incorrect
> sda-hold-time may cause lost arbitration error. Instead of loading all
> speed mode settings, only selected speed mode settings are loaded.
> 
> Signed-off-by: Tan Chin Yew <chin.yew.tan@intel.com>


Looks good to me:

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> ---
>  drivers/i2c/busses/i2c-designware-platdrv.c | 31
> ++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
> b/drivers/i2c/busses/i2c-designware-platdrv.c
> index a597ba32..5a4eb6b 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -85,8 +85,7 @@ static void dw_i2c_acpi_params(struct
> platform_device *pdev, char method[],
>  
>  		*hcnt = (u16)objs[0].integer.value;
>  		*lcnt = (u16)objs[1].integer.value;
> -		if (sda_hold)
> -			*sda_hold = (u32)objs[2].integer.value;
> +		*sda_hold = (u32)objs[2].integer.value;
>  	}
>  
>  	kfree(buf.pointer);
> @@ -105,14 +104,28 @@ static int dw_i2c_acpi_configure(struct
> platform_device *pdev)
>  	dev->rx_fifo_depth = 32;
>  
>  	/*
> -	 * Try to get SDA hold time and *CNT values from an ACPI
> method if
> -	 * it exists for both supported speed modes.
> +	 * Try to get SDA hold time and *CNT values from an ACPI
> method for
> +	 * selected speed modes.
>  	 */
> -	dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev-
> >ss_lcnt, NULL);
> -	dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev-
> >fs_lcnt,
> -			   &dev->sda_hold_time);
> -	dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev-
> >fp_lcnt, NULL);
> -	dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev-
> >hs_lcnt, NULL);
> +	switch (dev->clk_freq) {
> +	case 100000:
> +		dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev-
> >ss_lcnt,
> +				   &dev->sda_hold_time);
> +		break;
> +	case 1000000:
> +		dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev-
> >fp_lcnt,
> +				   &dev->sda_hold_time);
> +		break;
> +	case 3400000:
> +		dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev-
> >hs_lcnt,
> +				   &dev->sda_hold_time);
> +		break;
> +	case 400000:
> +	default:
> +		dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev-
> >fs_lcnt,
> +				   &dev->sda_hold_time);
> +		break;
> +	}
>  
>  	id = acpi_match_device(pdev->dev.driver->acpi_match_table,
> &pdev->dev);
>  	if (id && id->driver_data)

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2017-03-28  9:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  8:48 [PATCH V3] Set sda-hold-time based on ACPI *CNT value Tan Chin Yew
2017-03-28  8:48 ` [PATCH] i2c: designware: Get selected speed mode sda-hold-time via ACPI Tan Chin Yew
2017-03-28  9:13   ` Andy Shevchenko [this message]
2017-03-31 12:12     ` Jarkko Nikula
2017-04-19 18:57   ` Wolfram Sang
  -- strict thread matches above, loose matches on Subject: below --
2017-02-14  5:54 [PATCH v2] Set sda-hold-time based on ACPI *CNT value chin.yew.tan
2017-02-14  5:54 ` [PATCH] i2c: designware: Get selected speed mode sda-hold-time via ACPI chin.yew.tan
2017-02-14  7:00   ` Jarkko Nikula
2017-03-06 12:30     ` Tan, Chin Yew
2017-02-14 10:05   ` Andy Shevchenko
2017-03-23 20:58   ` Wolfram Sang
2017-03-23 21:00     ` Wolfram Sang
2017-03-27  9:43       ` Tan, Chin Yew
2017-03-27 10:07         ` Wolfram Sang
2017-02-10 11:28 [PATCH] Set sda-hold-time based on ACPI *CNT value chin.yew.tan
2017-02-10 11:28 ` [PATCH] i2c: designware: Get selected speed mode sda-hold-time via ACPI chin.yew.tan
2017-02-10 12:28   ` Jarkko Nikula
2017-02-10 12:31   ` Andy Shevchenko
2017-02-13  8:41     ` Tan, Chin Yew
2017-02-13  9:33       ` Jarkko Nikula
2017-02-13 10:56         ` Andy Shevchenko

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=1490692426.708.26.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=chin.yew.tan@intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --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).