All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error
@ 2017-07-08 13:10 Hans de Goede
  2017-07-08 13:10 ` [PATCH 2/2] i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz Hans de Goede
  2017-07-08 13:54 ` [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error Andy Shevchenko
  0 siblings, 2 replies; 6+ messages in thread
From: Hans de Goede @ 2017-07-08 13:10 UTC (permalink / raw)
  To: Jarkko Nikula, Wolfram Sang, Andy Shevchenko, Mika Westerberg
  Cc: Hans de Goede, linux-i2c

When we refuse to probe due to an invalid clock frequency, log
the frequency which is causing this error.

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

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index d1263b82d646..d5acaf8d65bf 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -275,7 +275,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 	if (dev->clk_freq != 100000 && dev->clk_freq != 400000
 	    && dev->clk_freq != 1000000 && dev->clk_freq != 3400000) {
 		dev_err(&pdev->dev,
-			"Only 100kHz, 400kHz, 1MHz and 3.4MHz supported");
+			"%d Hz is unsupported, only 100kHz, 400kHz, 1MHz and 3.4MHz are supported",
+			dev->clk_freq);
 		r = -EINVAL;
 		goto exit_reset;
 	}
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz
  2017-07-08 13:10 [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error Hans de Goede
@ 2017-07-08 13:10 ` Hans de Goede
  2017-07-08 13:55   ` Andy Shevchenko
  2017-07-08 13:54 ` [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error Andy Shevchenko
  1 sibling, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2017-07-08 13:10 UTC (permalink / raw)
  To: Jarkko Nikula, Wolfram Sang, Andy Shevchenko, Mika Westerberg
  Cc: Hans de Goede, linux-i2c, stable

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(+)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index d5acaf8d65bf..c6f5a41d72b5 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -254,6 +254,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.
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error
  2017-07-08 13:10 [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error Hans de Goede
  2017-07-08 13:10 ` [PATCH 2/2] i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz Hans de Goede
@ 2017-07-08 13:54 ` Andy Shevchenko
  2017-07-09 18:53   ` Hans de Goede
  1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2017-07-08 13:54 UTC (permalink / raw)
  To: Hans de Goede, Jarkko Nikula, Wolfram Sang, Mika Westerberg; +Cc: linux-i2c

On Sat, 2017-07-08 at 15:10 +0200, Hans de Goede wrote:
> When we refuse to probe due to an invalid clock frequency, log
> the frequency which is causing this error.

Shouldn't it have \n as well?

> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/i2c/busses/i2c-designware-platdrv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
> b/drivers/i2c/busses/i2c-designware-platdrv.c
> index d1263b82d646..d5acaf8d65bf 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -275,7 +275,8 @@ static int dw_i2c_plat_probe(struct
> platform_device *pdev)
>  	if (dev->clk_freq != 100000 && dev->clk_freq != 400000
>  	    && dev->clk_freq != 1000000 && dev->clk_freq != 3400000)
> {
>  		dev_err(&pdev->dev,
> -			"Only 100kHz, 400kHz, 1MHz and 3.4MHz
> supported");
> +			"%d Hz is unsupported, only 100kHz, 400kHz,
> 1MHz and 3.4MHz are supported",
> +			dev->clk_freq);
>  		r = -EINVAL;
>  		goto exit_reset;
>  	}

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz
  2017-07-08 13:10 ` [PATCH 2/2] i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz Hans de Goede
@ 2017-07-08 13:55   ` Andy Shevchenko
  2017-07-09 18:54     ` Hans de Goede
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2017-07-08 13:55 UTC (permalink / raw)
  To: Hans de Goede, Jarkko Nikula, Wolfram Sang, Mika Westerberg
  Cc: linux-i2c, stable

On Sat, 2017-07-08 at 15:10 +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>
> ---
>  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 d5acaf8d65bf..c6f5a41d72b5 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -254,6 +254,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;

I would rather convert to choose closest one, though I am not sure at
all which approach would be better in long term.

>  	/*
>  	 * Find bus speed from the "clock-frequency" device property,
> ACPI
>  	 * or by using fast mode if neither is set.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error
  2017-07-08 13:54 ` [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error Andy Shevchenko
@ 2017-07-09 18:53   ` Hans de Goede
  0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-07-09 18:53 UTC (permalink / raw)
  To: Andy Shevchenko, Jarkko Nikula, Wolfram Sang, Mika Westerberg; +Cc: linux-i2c

Hi,

On 08-07-17 15:54, Andy Shevchenko wrote:
> On Sat, 2017-07-08 at 15:10 +0200, Hans de Goede wrote:
>> When we refuse to probe due to an invalid clock frequency, log
>> the frequency which is causing this error.
> 
> Shouldn't it have \n as well?

Right will fix for v2.

Regards,

Hans


> 
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/i2c/busses/i2c-designware-platdrv.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c
>> b/drivers/i2c/busses/i2c-designware-platdrv.c
>> index d1263b82d646..d5acaf8d65bf 100644
>> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
>> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
>> @@ -275,7 +275,8 @@ static int dw_i2c_plat_probe(struct
>> platform_device *pdev)
>>   	if (dev->clk_freq != 100000 && dev->clk_freq != 400000
>>   	    && dev->clk_freq != 1000000 && dev->clk_freq != 3400000)
>> {
>>   		dev_err(&pdev->dev,
>> -			"Only 100kHz, 400kHz, 1MHz and 3.4MHz
>> supported");
>> +			"%d Hz is unsupported, only 100kHz, 400kHz,
>> 1MHz and 3.4MHz are supported",
>> +			dev->clk_freq);
>>   		r = -EINVAL;
>>   		goto exit_reset;
>>   	}
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz
  2017-07-08 13:55   ` Andy Shevchenko
@ 2017-07-09 18:54     ` Hans de Goede
  0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-07-09 18:54 UTC (permalink / raw)
  To: Andy Shevchenko, Jarkko Nikula, Wolfram Sang, Mika Westerberg
  Cc: linux-i2c, stable

Hi,

On 08-07-17 15:55, Andy Shevchenko wrote:
> On Sat, 2017-07-08 at 15:10 +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>
>> ---
>>   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 d5acaf8d65bf..c6f5a41d72b5 100644
>> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
>> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
>> @@ -254,6 +254,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;
> 
> I would rather convert to choose closest one, though I am not sure at
> all which approach would be better in long term.

We could always choose the closest lower one. I've been thinking
about doing that instead myself.

Wolfram, do you have any opinion on this ?

Regards,

Hans


> 
>>   	/*
>>   	 * Find bus speed from the "clock-frequency" device property,
>> ACPI
>>   	 * or by using fast mode if neither is set.
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-07-09 18:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-08 13:10 [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error Hans de Goede
2017-07-08 13:10 ` [PATCH 2/2] i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz Hans de Goede
2017-07-08 13:55   ` Andy Shevchenko
2017-07-09 18:54     ` Hans de Goede
2017-07-08 13:54 ` [PATCH 1/2] i2c: designware: Print clock freq on invalid clock freq error Andy Shevchenko
2017-07-09 18:53   ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.