mbox series

[v6,0/5] Add support for HiSilicon I2C controller

Message ID 1617197790-30627-1-git-send-email-yangyicong@hisilicon.com
Headers show
Series Add support for HiSilicon I2C controller | expand

Message

Yicong Yang March 31, 2021, 1:36 p.m. UTC
Add driver and MAINTAINERS for HiSilicon I2C controller on Kunpeng SoC. Also
provide the devm_*() variants for adding the I2C adapters. Add a public
api to provide I2C frequency mode strings and convert designware driver
to use it.

Change since v5:
- address the comment from Dmitry and add his Reviewed-by
- address the comment from Jarkko and add his Reviewed-by and Tested-by
- add Jarkko's Acked-by for designware patch
Link: https://lore.kernel.org/linux-i2c/1617113966-40498-1-git-send-email-yangyicong@hisilicon.com/

Change since v4:
- and Andy's Reviewed-by
- attach Andy's patch of switch designware driver to use i2c_freq_mode_string()
Link: https://lore.kernel.org/linux-i2c/1617109549-4013-1-git-send-email-yangyicong@hisilicon.com/
Link: https://lore.kernel.org/linux-i2c/20210330134633.29889-1-andriy.shevchenko@linux.intel.com/

Change since v3:
- split the bus mode string api to I2C as suggested by Andy
- simplify the devm variants and change the export format
- address the comments of the HiSilicon I2C driver from Andy and Dmitry, thanks!
Link: https://lore.kernel.org/linux-i2c/1616411413-7177-1-git-send-email-yangyicong@hisilicon.com/

Change since v2:
- handle -EPROBE_DEFER case when get irq number by platform_get_irq()
Link: https://lore.kernel.org/linux-i2c/1615296137-14558-1-git-send-email-yangyicong@hisilicon.com/

Change since v1:
- fix compile test error on 32bit arch, reported by intel lkp robot:
  64 bit division without using kernel wrapper in probe function.
Link:https://lore.kernel.org/linux-i2c/1615016946-55670-1-git-send-email-yangyicong@hisilicon.com/

Andy Shevchenko (1):
  i2c: designware: Switch over to i2c_freq_mode_string()

Yicong Yang (4):
  i2c: core: add managed function for adding i2c adapters
  i2c: core: add api to provide frequency mode strings
  i2c: add support for HiSilicon I2C controller
  MAINTAINERS: Add maintainer for HiSilicon I2C driver

 MAINTAINERS                                |   7 +
 drivers/i2c/busses/Kconfig                 |  10 +
 drivers/i2c/busses/Makefile                |   1 +
 drivers/i2c/busses/i2c-designware-master.c |  20 +-
 drivers/i2c/busses/i2c-hisi.c              | 505 +++++++++++++++++++++++++++++
 drivers/i2c/i2c-core-base.c                |  26 ++
 include/linux/i2c.h                        |  21 ++
 7 files changed, 574 insertions(+), 16 deletions(-)
 create mode 100644 drivers/i2c/busses/i2c-hisi.c

Comments

Wolfram Sang April 6, 2021, 8:16 p.m. UTC | #1
On Wed, Mar 31, 2021 at 09:36:26PM +0800, Yicong Yang wrote:
> Some I2C controller drivers will only unregister the I2C

> adapter in their .remove() callback, which can be done

> by simply using a managed variant to add the I2C adapter.

> 

> So add the managed functions for adding the I2C adapter.


Yes, I think we can do this. We just need to pay attention that people
make sure interrupts are disabled and/or freed when the adapter gets
removed. But this is also true for the current situation. I.e. removing
the adapter manually in remove() and then relying on devm_ to free the
interrupt is a bit dangerous.

> +	return devm_add_action_or_reset(dev, devm_i2c_del_adapter, adapter);


Cool, I didn't know this function.
Wolfram Sang April 6, 2021, 8:18 p.m. UTC | #2
On Wed, Mar 31, 2021 at 09:36:25PM +0800, Yicong Yang wrote:
> Add driver and MAINTAINERS for HiSilicon I2C controller on Kunpeng SoC. Also

> provide the devm_*() variants for adding the I2C adapters. Add a public

> api to provide I2C frequency mode strings and convert designware driver

> to use it.


Thanks, this series is in a very good condition. One question about
patch 2, the rest are minor nits (see the patches themselves). It will
make it for 5.13.