public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-i2c@vger.kernel.org
Cc: Wolfram Sang <wsa@the-dreams.de>,
	Christian Ruppert <christian.ruppert@abilis.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] i2c-designware: configure *CNT values from ACPI
Date: Wed, 10 Jul 2013 16:01:16 +0300	[thread overview]
Message-ID: <20130710130116.GC4898@intel.com> (raw)
In-Reply-To: <1373283927-21677-2-git-send-email-mika.westerberg@linux.intel.com>

On Mon, Jul 08, 2013 at 02:45:27PM +0300, Mika Westerberg wrote:
> Some Intel LPSS I2C devices make the *CNT values available from ACPI
> namespace in similar way than the SDA hold value. These values allow
> platform/BIOS to specify the most accurate *CNT values for the device
> driver to use.
> 
> So change the ACPI part of the driver to use these values if they exists
> and otherwise use the default method based solely on the input clock speed.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
> This applies on top of following patch which is not yet in i2c tree:
> 
> http://permalink.gmane.org/gmane.linux.drivers.i2c/15754
> 
>  drivers/i2c/busses/i2c-designware-platdrv.c | 25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index c7cfdac..a1488df 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -59,7 +59,6 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
>  	struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
>  	struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER };
>  	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
> -	acpi_string name;
>  
>  	if (!handle)
>  		return -ENODEV;
> @@ -68,14 +67,32 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
>  	dev->tx_fifo_depth = 32;
>  	dev->rx_fifo_depth = 32;
>  
> -	name = dev->master_cfg & DW_IC_CON_SPEED_FAST ? "FMCN" : "SSCN";
> -	if (ACPI_SUCCESS(acpi_evaluate_object(handle, name, NULL, &buf))) {
> +	/* Standard speed configuration */
> +	if (ACPI_SUCCESS(acpi_evaluate_object(handle, "SSCN", NULL, &buf))) {
>  		union acpi_object *obj = (union acpi_object *)buf.pointer;
>  
>  		if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 3) {
>  			const union acpi_object *objs = obj->package.elements;
>  
> -			dev->sda_hold_time = (u32)objs[2].integer.value;
> +			dev->ss_hcnt = (u16)objs[0].integer.value;
> +			dev->ss_lcnt = (u16)objs[1].integer.value;
> +			if (!(dev->master_cfg & DW_IC_CON_SPEED_FAST))
> +				dev->sda_hold_time = (u32)objs[2].integer.value;
> +		}
> +
> +		kfree(buf.pointer);
> +	}
> +	/* Fast speed configuration */
> +	if (ACPI_SUCCESS(acpi_evaluate_object(handle, "FMCN", NULL, &buf))) {

There is a problem with the above as it reuses buf from the previous call.
I'll post a new revision of the patches with this fixed.

> +		union acpi_object *obj = (union acpi_object *)buf.pointer;
> +
> +		if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 3) {
> +			const union acpi_object *objs = obj->package.elements;
> +
> +			dev->fs_hcnt = (u16)objs[0].integer.value;
> +			dev->fs_lcnt = (u16)objs[1].integer.value;
> +			if (dev->master_cfg & DW_IC_CON_SPEED_FAST)
> +				dev->sda_hold_time = (u32)objs[2].integer.value;
>  		}
>  
>  		kfree(buf.pointer);
> -- 
> 1.8.3.2

  reply	other threads:[~2013-07-10 12:55 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08 11:45 [PATCH 1/2] i2c-designware: make *CNT values configurable Mika Westerberg
2013-07-08 11:45 ` [PATCH 2/2] i2c-designware: configure *CNT values from ACPI Mika Westerberg
2013-07-10 13:01   ` Mika Westerberg [this message]
2013-07-08 13:42 ` [PATCH 1/2] i2c-designware: make *CNT values configurable Christian Ruppert
2013-07-09  8:44   ` Mika Westerberg
2013-07-09 16:19     ` Christian Ruppert
2013-07-10 10:52       ` Mika Westerberg
2013-07-10 16:56         ` Christian Ruppert
2013-07-11  7:36           ` Mika Westerberg
2013-07-11 10:13             ` Mika Westerberg
2013-07-12  7:56               ` Shinya Kuribayashi
2013-07-12  8:51                 ` Mika Westerberg
2013-07-13  5:36                   ` Shinya Kuribayashi
2013-07-16 11:16                     ` Christian Ruppert
2013-07-17 14:39                       ` Shinya Kuribayashi
2013-07-22 13:17                         ` Christian Ruppert
2013-07-24 14:31                           ` Shinya Kuribayashi
2013-08-05  9:31                             ` Christian Ruppert
2013-08-05 10:02                               ` Wolfram Sang
2013-08-12  7:48                                 ` Christian Ruppert
2013-08-12 11:09                                   ` Wolfram Sang
2013-08-16  2:15                               ` Shinya Kuribayashi
2013-08-19 11:36                                 ` Mika Westerberg
2013-08-19 12:22                                   ` Shinya Kuribayashi
2013-08-21 14:39                                 ` Christian Ruppert
2013-08-24  4:58                                   ` Shinya Kuribayashi
2013-08-28 15:34                                     ` Christian Ruppert
2013-10-08 15:00                                       ` [PATCH 1/2] i2c designware make SCL and SDA falling time configurable Romain Baeriswyl
2013-10-09  7:55                                         ` Mika Westerberg
2013-10-10  0:54                                           ` Ryan Mallon
2013-10-13 11:36                                             ` Shinya Kuribayashi
2014-01-16 19:43                                               ` Wolfram Sang
2014-01-20 16:43                                                 ` [PATCH v2 " Romain Baeriswyl
2014-03-09  8:20                                                   ` Wolfram Sang
2013-10-08 15:00                                       ` [PATCH 2/2] i2c designware add support of I2C standard mode Romain Baeriswyl
2013-10-09  7:56                                         ` Mika Westerberg
2013-10-13 11:46                                           ` Shinya Kuribayashi
2014-01-16 19:33                                         ` Wolfram Sang
2014-01-20 16:45                                           ` [PATCH v2 " Romain Baeriswyl
2014-03-09  8:07                                             ` Wolfram Sang
2014-03-25 10:18                                               ` [PATCH V3 " Romain Baeriswyl
2013-08-19  6:39                       ` [PATCH 1/2] i2c-designware: make *CNT values configurable Mika Westerberg

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=20130710130116.GC4898@intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=christian.ruppert@abilis.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@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