diff mbox

[v3,2/2] i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz

Message ID 20170713134502.10816-2-hdegoede@redhat.com
State Accepted
Headers show

Commit Message

Hans de Goede July 13, 2017, 1:45 p.m. UTC
At least the Acer Iconia Tab8 / aka W1-810 uses 1MiHz instead of
1MHz for one of its busses, fix this up to 1MHz instead of failing
the probe of that bus.

This fixes the accelerometer on the Acer Iconia Tab8 not working.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andy Shevchenko July 16, 2017, 2:04 p.m. UTC | #1
On Thu, 2017-07-13 at 15:45 +0200, Hans de Goede wrote:
> At least the Acer Iconia Tab8 / aka W1-810 uses 1MiHz instead of
> 1MHz for one of its busses, fix this up to 1MHz instead of failing
> the probe of that bus.
> 
> This fixes the accelerometer on the Acer Iconia Tab8 not working.
> 

Should it have a Fixes tag?

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

(on condition Jarkko and Wolfram are okay with this; in the future it
would be better to have a list of possible speeds and algo that chooses
one based on FW configuration)

> Cc: stable@vger.kernel.org
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
> b/drivers/i2c/busses/i2c-designware-platdrv.c
> index d139b156f9c9..143a8fd582b4 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -298,6 +298,9 @@ static int dw_i2c_plat_probe(struct
> platform_device *pdev)
>  	}
>  
>  	acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev);
> +	/* Some broken DSTDs use 1MiHz instead of 1MHz */
> +	if (acpi_speed == 1048576)
> +		acpi_speed = 1000000;
>  	/*
>  	 * Find bus speed from the "clock-frequency" device property,
> ACPI
>  	 * or by using fast mode if neither is set.
Hans de Goede July 21, 2017, 10:15 p.m. UTC | #2
Hi,

On 16-07-17 16:04, Andy Shevchenko wrote:
> On Thu, 2017-07-13 at 15:45 +0200, Hans de Goede wrote:
>> At least the Acer Iconia Tab8 / aka W1-810 uses 1MiHz instead of
>> 1MHz for one of its busses, fix this up to 1MHz instead of failing
>> the probe of that bus.
>>
>> This fixes the accelerometer on the Acer Iconia Tab8 not working.
>>
> 
> Should it have a Fixes tag?

No I don't think so, as this worksaround a firmware bug the original
commit introducing the check is not really fixed by this, as the
original commit is fine really.

Regards,

Hans



> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> (on condition Jarkko and Wolfram are okay with this; in the future it
> would be better to have a list of possible speeds and algo that chooses
> one based on FW configuration)
> 
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
>> b/drivers/i2c/busses/i2c-designware-platdrv.c
>> index d139b156f9c9..143a8fd582b4 100644
>> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
>> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
>> @@ -298,6 +298,9 @@ static int dw_i2c_plat_probe(struct
>> platform_device *pdev)
>>   	}
>>   
>>   	acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev);
>> +	/* Some broken DSTDs use 1MiHz instead of 1MHz */
>> +	if (acpi_speed == 1048576)
>> +		acpi_speed = 1000000;
>>   	/*
>>   	 * Find bus speed from the "clock-frequency" device property,
>> ACPI
>>   	 * or by using fast mode if neither is set.
>
Wolfram Sang July 31, 2017, 1:56 p.m. UTC | #3
On Thu, Jul 13, 2017 at 03:45:02PM +0200, Hans de Goede wrote:
> At least the Acer Iconia Tab8 / aka W1-810 uses 1MiHz instead of
> 1MHz for one of its busses, fix this up to 1MHz instead of failing
> the probe of that bus.
> 
> This fixes the accelerometer on the Acer Iconia Tab8 not working.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Applied to for-current, thanks!
Wolfram Sang July 31, 2017, 1:57 p.m. UTC | #4
> (on condition Jarkko and Wolfram are okay with this; in the future it
> would be better to have a list of possible speeds and algo that chooses
> one based on FW configuration)

In deed, that sounds feasible if more broken firmware shows up.
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index d139b156f9c9..143a8fd582b4 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -298,6 +298,9 @@  static int dw_i2c_plat_probe(struct platform_device *pdev)
 	}
 
 	acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev);
+	/* Some broken DSTDs use 1MiHz instead of 1MHz */
+	if (acpi_speed == 1048576)
+		acpi_speed = 1000000;
 	/*
 	 * Find bus speed from the "clock-frequency" device property, ACPI
 	 * or by using fast mode if neither is set.