[v3,0/9] i2c: add support for filters
mbox series

Message ID 1562678049-17581-1-git-send-email-eugen.hristev@microchip.com
Headers show
Series
  • i2c: add support for filters
Related show

Message

Eugen Hristev July 9, 2019, 1:19 p.m. UTC
From: Eugen Hristev <eugen.hristev@microchip.com>

Hello,

This series adds support for analog and digital filters for i2c controllers

This series is based on the series:
[PATCH v2 0/9] i2c: at91: filters support for at91 SoCs
and enhanced to add the bindings for all controllers plus an extra binding
for the width of the spikes in nanoseconds.

First, bindings are created for
'i2c-ana-filter'
'i2c-dig-filter'
'i2c-filter-width-ns'

The support is added in the i2c core to retrieve filter width and add it
to the timings structure.
Next, the at91 driver is enhanced for supporting digital filter, advanced
digital filter (with selectable spike width) and the analog filter.

Finally the device tree for two boards are modified to make use of the
new properties.

This series is the result of the comments on the ML in the direction
requested: to make the bindings globally available for i2c drivers.

Changes in v3:
- made bindings global for i2c controllers and modified accordingly
- gave up PADFCDF bit because it's a lack in datasheet
- the computation on the width of the spike is based on periph clock as it
is done for hold time.

Changes in v2:
- added device tree bindings and support for enable-ana-filt and
enable-dig-filt
- added the new properties to the DT for sama5d4_xplained/sama5d2_xplained

Eugen Hristev (9):
  dt-bindings: i2c: at91: add new compatible
  dt-bindings: i2c: add bindings for i2c analog and digital filter
  i2c: add support for filter-width-ns optional property
  i2c: at91: add new platform support for sam9x60
  i2c: at91: add support for digital filtering
  i2c: at91: add support for advanced digital filtering
  i2c: at91: add support for analog filtering
  ARM: dts: at91: sama5d2_xplained: add analog and digital filter for
    i2c
  ARM: dts: at91: sama5d4_xplained: add analog filter for i2c

 Documentation/devicetree/bindings/i2c/i2c-at91.txt |  3 +-
 Documentation/devicetree/bindings/i2c/i2c.txt      | 11 +++++
 arch/arm/boot/dts/at91-sama5d2_xplained.dts        |  6 +++
 arch/arm/boot/dts/at91-sama5d4_xplained.dts        |  1 +
 drivers/i2c/busses/i2c-at91-core.c                 | 38 +++++++++++++++++
 drivers/i2c/busses/i2c-at91-master.c               | 49 ++++++++++++++++++++--
 drivers/i2c/busses/i2c-at91.h                      | 13 ++++++
 drivers/i2c/i2c-core-base.c                        |  2 +
 include/linux/i2c.h                                |  2 +
 9 files changed, 121 insertions(+), 4 deletions(-)

Comments

Ludovic Desroches July 12, 2019, 8:20 a.m. UTC | #1
On Tue, Jul 09, 2019 at 03:19:26PM +0200, Eugen Hristev - M18282 wrote:
> From: Eugen Hristev <eugen.hristev@microchip.com>
> 
> Hello,
> 
> This series adds support for analog and digital filters for i2c controllers
> 
> This series is based on the series:
> [PATCH v2 0/9] i2c: at91: filters support for at91 SoCs
> and enhanced to add the bindings for all controllers plus an extra binding
> for the width of the spikes in nanoseconds.
> 
> First, bindings are created for
> 'i2c-ana-filter'
> 'i2c-dig-filter'
> 'i2c-filter-width-ns'
> 
> The support is added in the i2c core to retrieve filter width and add it
> to the timings structure.
> Next, the at91 driver is enhanced for supporting digital filter, advanced
> digital filter (with selectable spike width) and the analog filter.
> 
> Finally the device tree for two boards are modified to make use of the
> new properties.
> 
> This series is the result of the comments on the ML in the direction
> requested: to make the bindings globally available for i2c drivers.
> 
> Changes in v3:
> - made bindings global for i2c controllers and modified accordingly
> - gave up PADFCDF bit because it's a lack in datasheet
> - the computation on the width of the spike is based on periph clock as it
> is done for hold time.
> 
> Changes in v2:
> - added device tree bindings and support for enable-ana-filt and
> enable-dig-filt
> - added the new properties to the DT for sama5d4_xplained/sama5d2_xplained
> 
> Eugen Hristev (9):
>   dt-bindings: i2c: at91: add new compatible
>   dt-bindings: i2c: add bindings for i2c analog and digital filter
>   i2c: add support for filter-width-ns optional property
>   i2c: at91: add new platform support for sam9x60
>   i2c: at91: add support for digital filtering
>   i2c: at91: add support for advanced digital filtering
>   i2c: at91: add support for analog filtering
>   ARM: dts: at91: sama5d2_xplained: add analog and digital filter for
>     i2c
>   ARM: dts: at91: sama5d4_xplained: add analog filter for i2c
> 
>  Documentation/devicetree/bindings/i2c/i2c-at91.txt |  3 +-
>  Documentation/devicetree/bindings/i2c/i2c.txt      | 11 +++++
>  arch/arm/boot/dts/at91-sama5d2_xplained.dts        |  6 +++
>  arch/arm/boot/dts/at91-sama5d4_xplained.dts        |  1 +
>  drivers/i2c/busses/i2c-at91-core.c                 | 38 +++++++++++++++++
>  drivers/i2c/busses/i2c-at91-master.c               | 49 ++++++++++++++++++++--
>  drivers/i2c/busses/i2c-at91.h                      | 13 ++++++
>  drivers/i2c/i2c-core-base.c                        |  2 +
>  include/linux/i2c.h                                |  2 +
>  9 files changed, 121 insertions(+), 4 deletions(-)

Hi,

I don't know if it will fit other vendors need concerning the binding
but for Microchip it sounds good.

Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
for the whole serie.

Regards

Ludovic
Eugen Hristev Aug. 22, 2019, 3 p.m. UTC | #2
On 12.07.2019 11:20, Ludovic Desroches wrote:
> On Tue, Jul 09, 2019 at 03:19:26PM +0200, Eugen Hristev - M18282 wrote:
>> From: Eugen Hristev <eugen.hristev@microchip.com>
>>
>> Hello,
>>
>> This series adds support for analog and digital filters for i2c controllers
>>
>> This series is based on the series:
>> [PATCH v2 0/9] i2c: at91: filters support for at91 SoCs
>> and enhanced to add the bindings for all controllers plus an extra binding
>> for the width of the spikes in nanoseconds.
>>
>> First, bindings are created for
>> 'i2c-ana-filter'
>> 'i2c-dig-filter'
>> 'i2c-filter-width-ns'
>>
>> The support is added in the i2c core to retrieve filter width and add it
>> to the timings structure.
>> Next, the at91 driver is enhanced for supporting digital filter, advanced
>> digital filter (with selectable spike width) and the analog filter.
>>
>> Finally the device tree for two boards are modified to make use of the
>> new properties.
>>
>> This series is the result of the comments on the ML in the direction
>> requested: to make the bindings globally available for i2c drivers.
>>
>> Changes in v3:
>> - made bindings global for i2c controllers and modified accordingly
>> - gave up PADFCDF bit because it's a lack in datasheet
>> - the computation on the width of the spike is based on periph clock as it
>> is done for hold time.
>>
>> Changes in v2:
>> - added device tree bindings and support for enable-ana-filt and
>> enable-dig-filt
>> - added the new properties to the DT for sama5d4_xplained/sama5d2_xplained
>>
>> Eugen Hristev (9):
>>    dt-bindings: i2c: at91: add new compatible
>>    dt-bindings: i2c: add bindings for i2c analog and digital filter
>>    i2c: add support for filter-width-ns optional property
>>    i2c: at91: add new platform support for sam9x60
>>    i2c: at91: add support for digital filtering
>>    i2c: at91: add support for advanced digital filtering
>>    i2c: at91: add support for analog filtering
>>    ARM: dts: at91: sama5d2_xplained: add analog and digital filter for
>>      i2c
>>    ARM: dts: at91: sama5d4_xplained: add analog filter for i2c
>>
>>   Documentation/devicetree/bindings/i2c/i2c-at91.txt |  3 +-
>>   Documentation/devicetree/bindings/i2c/i2c.txt      | 11 +++++
>>   arch/arm/boot/dts/at91-sama5d2_xplained.dts        |  6 +++
>>   arch/arm/boot/dts/at91-sama5d4_xplained.dts        |  1 +
>>   drivers/i2c/busses/i2c-at91-core.c                 | 38 +++++++++++++++++
>>   drivers/i2c/busses/i2c-at91-master.c               | 49 ++++++++++++++++++++--
>>   drivers/i2c/busses/i2c-at91.h                      | 13 ++++++
>>   drivers/i2c/i2c-core-base.c                        |  2 +
>>   include/linux/i2c.h                                |  2 +
>>   9 files changed, 121 insertions(+), 4 deletions(-)
> 
> Hi,
> 
> I don't know if it will fit other vendors need concerning the binding
> but for Microchip it sounds good.
> 
> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> for the whole serie.
> 
> Regards
> 
> Ludovic
> 

Hello Wolfram,

What is the plan for this patch series?

Thanks,
Eugen
Wolfram Sang Aug. 29, 2019, 8:28 p.m. UTC | #3
> > I don't know if it will fit other vendors need concerning the binding
> > but for Microchip it sounds good.
> > 
> > Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
> > for the whole serie.
> > 
> > Regards
> > 
> > Ludovic
> > 
> 
> Hello Wolfram,
> 
> What is the plan for this patch series?

I hope to review it this weekend and my hope it is good to go for 5.4.
Wolfram Sang Aug. 31, 2019, 12:13 p.m. UTC | #4
> diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c
> index a663a7a..62610af 100644
> --- a/drivers/i2c/busses/i2c-at91-core.c
> +++ b/drivers/i2c/busses/i2c-at91-core.c
> @@ -68,6 +68,7 @@ static struct at91_twi_pdata at91rm9200_config = {
>  	.has_unre_flag = true,
>  	.has_alt_cmd = false,
>  	.has_hold_field = false,
> +	.has_dig_filtr = false,

Hmm, 'false' is the default. Maybe not for this series, but it might
make sense to clean up the driver afterwards removing the superfluous
'false'. The precedence will make adding new properties much simpler.


> +	dev->enable_dig_filt = of_property_read_bool(pdev->dev.of_node,
> +						     "i2c-dig-filter");
> +

What do you think of the idea to introduce 'flags' to struct i2c_timings
and parse the bindings in the core, too? Then you'd have sth like:

	if (t->flags & I2C_TIMINGS_ANALOG_FILTER)

Would that be useful for you?
Wolfram Sang Aug. 31, 2019, 12:17 p.m. UTC | #5
> > +	dev->enable_dig_filt = of_property_read_bool(pdev->dev.of_node,
> > +						     "i2c-dig-filter");
> > +
> 
> What do you think of the idea to introduce 'flags' to struct i2c_timings
> and parse the bindings in the core, too? Then you'd have sth like:
> 
> 	if (t->flags & I2C_TIMINGS_ANALOG_FILTER)
> 
> Would that be useful for you?

Forgot to say, we can also implement this incrementally to make sure
your patches land in 5.4 in case you are currently busy with sth else.
Wolfram Sang Aug. 31, 2019, 12:19 p.m. UTC | #6
> > What is the plan for this patch series?
> 
> I hope to review it this weekend and my hope it is good to go for 5.4.

Series looks good basically. Just a few comments for some patches. See
there.

Thanks!
Eugen Hristev Sept. 2, 2019, 8:54 a.m. UTC | #7
On 31.08.2019 15:17, Wolfram Sang wrote:
> 
>>> +	dev->enable_dig_filt = of_property_read_bool(pdev->dev.of_node,
>>> +						     "i2c-dig-filter");
>>> +
>>
>> What do you think of the idea to introduce 'flags' to struct i2c_timings
>> and parse the bindings in the core, too? Then you'd have sth like:
>>
>> 	if (t->flags & I2C_TIMINGS_ANALOG_FILTER)
>>
>> Would that be useful for you?
> 
> Forgot to say, we can also implement this incrementally to make sure
> your patches land in 5.4 in case you are currently busy with sth else.
> 

Hi Wolfram,

Your idea looks good but I would prefer to have it as a separate 
enhancement patch, after this series gets in.
As things are now, this series/patches do just the filtering part. We 
can then move all the optional 'flags' as another change.
So yes, we can do this incrementally.

Thanks !
Eugen

> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>