Merge branch 'i2c/for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 22 Feb 2021 17:02:24 +0000 (09:02 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 22 Feb 2021 17:02:24 +0000 (09:02 -0800)
Pull i2c updates from Wolfram Sang:

 - mostly driver updates. Bigger ones for mlxcpld and iproc. But most of
   them are all over the place.

 - removal of the efm32, sirf, u300, and zte zx bus drivers because of
   platform removal. So, we have a pleasant diffstat this time.

 - first set of cleanups in the I2C core as preparation to increase
   maximum length of SMBus transfers to 255 (as specified in the new
   standard). Better documentation of struct i2c_msg and its flags stand
   out here.

 - the testunit can now respond to SMBus block process calls which is
   the testcase when implementing the above new maximum length.

* 'i2c/for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (62 commits)
  i2c: remove redundant error print in stm32f7_i2c_probe
  i2c: testunit: add support for block process calls
  i2c: busses: Replace spin_lock_irqsave with spin_lock in hard IRQ
  dt-bindings: eeprom: at24: Document ROHM BR24G01
  i2c: i801: Add support for Intel Alder Lake PCH-P
  i2c: mv64xxx: Fix check for missing clock after adding RPM
  i2c: mux: mlxcpld: Add callback to notify mux creation completion
  i2c: mux: mlxcpld: Extend supported mux number
  i2c: mux: mlxcpld: Extend driver to support word address space devices
  i2c: mux: mlxcpld: Get rid of adapter numbers enforcement
  i2c: mux: mlxcpld: Prepare mux selection infrastructure for two-byte support
  i2c: mux: mlxcpld: Convert driver to platform driver
  i2c: imx: Synthesize end of transaction events without idle interrupts
  i2c: i2c-qcom-geni: Add shutdown callback for i2c
  i2c: mv64xxx: Add runtime PM support
  i2c: amd-mp2: Remove unused macro
  i2c: amd-mp2: convert to PCI logging functions
  i2c: mux: mlxcpld: Move header file out of x86 realm
  platform/x86: mlxcpld: Update module license
  i2c: mux: mlxcpld: Update module license
  ...

1  2 
drivers/gpio/gpiolib.c
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-elektor.c
drivers/i2c/busses/i2c-stm32f7.c

diff --combined drivers/gpio/gpiolib.c
@@@ -603,11 -603,7 +603,11 @@@ int gpiochip_add_data_with_key(struct g
                ret = gdev->id;
                goto err_free_gdev;
        }
 -      dev_set_name(&gdev->dev, GPIOCHIP_NAME "%d", gdev->id);
 +
 +      ret = dev_set_name(&gdev->dev, GPIOCHIP_NAME "%d", gdev->id);
 +      if (ret)
 +              goto err_free_ida;
 +
        device_initialize(&gdev->dev);
        dev_set_drvdata(&gdev->dev, gdev);
        if (gc->parent && gc->parent->driver)
        gdev->descs = kcalloc(gc->ngpio, sizeof(gdev->descs[0]), GFP_KERNEL);
        if (!gdev->descs) {
                ret = -ENOMEM;
 -              goto err_free_ida;
 +              goto err_free_dev_name;
        }
  
        if (gc->ngpio == 0) {
@@@ -772,8 -768,6 +772,8 @@@ err_free_label
        kfree_const(gdev->label);
  err_free_descs:
        kfree(gdev->descs);
 +err_free_dev_name:
 +      kfree(dev_name(&gdev->dev));
  err_free_ida:
        ida_free(&gpio_ida, gdev->id);
  err_free_gdev:
@@@ -2557,7 -2551,7 +2557,7 @@@ int gpiod_get_array_value_complex(bool 
                struct gpio_chip *gc = desc_array[i]->gdev->chip;
                unsigned long fastpath[2 * BITS_TO_LONGS(FASTPATH_NGPIO)];
                unsigned long *mask, *bits;
 -              int first, j, ret;
 +              int first, j;
  
                if (likely(gc->ngpio <= FASTPATH_NGPIO)) {
                        mask = fastpath;
@@@ -3469,6 -3463,10 +3469,10 @@@ EXPORT_SYMBOL_GPL(gpiod_add_lookup_tabl
   */
  void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
  {
+       /* Nothing to remove */
+       if (!table)
+               return;
        mutex_lock(&gpio_lookup_lock);
  
        list_del(&table->list);
@@@ -586,13 -586,6 +586,6 @@@ config I2C_DIGICOLO
          This driver can also be built as a module.  If so, the module
          will be called i2c-digicolor.
  
- config I2C_EFM32
-       tristate "EFM32 I2C controller"
-       depends on ARCH_EFM32 || COMPILE_TEST
-       help
-         This driver supports the i2c block found in Energy Micro's EFM32
-         SoCs.
  config I2C_EG20T
        tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) I2C"
        depends on PCI && (X86_32 || MIPS || COMPILE_TEST)
@@@ -1000,16 -993,6 +993,6 @@@ config I2C_SIMTE
          This driver can also be built as a module. If so, the module
          will be called i2c-simtec.
  
- config I2C_SIRF
-       tristate "CSR SiRFprimaII I2C interface"
-       depends on ARCH_SIRF || COMPILE_TEST
-       help
-         If you say yes to this option, support will be included for the
-         CSR SiRFprimaII I2C interface.
-         This driver can also be built as a module.  If so, the module
-         will be called i2c-sirf.
  config I2C_SPRD
        tristate "Spreadtrum I2C interface"
        depends on I2C=y && (ARCH_SPRD || COMPILE_TEST)
@@@ -1050,19 -1033,6 +1033,6 @@@ config I2C_STM32F
          This driver can also be built as module. If so, the module
          will be called i2c-stm32f7.
  
- config I2C_STU300
-       tristate "ST Microelectronics DDC I2C interface"
-       depends on MACH_U300 || COMPILE_TEST
-       default y if MACH_U300
-       help
-         If you say yes to this option, support will be included for the
-         I2C interface from ST Microelectronics simply called "DDC I2C"
-         supporting both I2C and DDC, used in e.g. the U300 series
-         mobile platforms.
-         This driver can also be built as a module. If so, the module
-         will be called i2c-stu300.
  config I2C_SUN6I_P2WI
        tristate "Allwinner sun6i internal P2WI controller"
        depends on RESET_CONTROLLER
@@@ -1175,8 -1145,8 +1145,8 @@@ config I2C_XILIN
          will be called xilinx_i2c.
  
  config I2C_XLR
 -      tristate "Netlogic XLR and Sigma Designs I2C support"
 -      depends on CPU_XLR || ARCH_TANGO || COMPILE_TEST
 +      tristate "Netlogic XLR I2C support"
 +      depends on CPU_XLR || COMPILE_TEST
        help
          This driver enables support for the on-chip I2C interface of
          the Netlogic XLR/XLS MIPS processors and Sigma Designs SOCs.
@@@ -1401,15 -1371,6 +1371,6 @@@ config I2C_OPA
          This driver can also be built as a module. If so, the module will be
          called as i2c-opal.
  
- config I2C_ZX2967
-       tristate "ZTE ZX2967 I2C support"
-       depends on ARCH_ZX
-       default y
-       help
-         Selecting this option will add ZX2967 I2C driver.
-         This driver can also be built as a module. If so, the module will be
-         called i2c-zx2967.
  config I2C_FSI
        tristate "FSI I2C driver"
        depends on FSI
@@@ -49,7 -49,7 +49,7 @@@ static int mmapped
  
  static wait_queue_head_t pcf_wait;
  static int pcf_pending;
- static spinlock_t lock;
+ static DEFINE_SPINLOCK(lock);
  
  static struct i2c_adapter pcf_isa_ops;
  
@@@ -132,7 -132,6 +132,6 @@@ static irqreturn_t pcf_isa_handler(int 
  
  static int pcf_isa_init(void)
  {
-       spin_lock_init(&lock);
        if (!mmapped) {
                if (!request_region(base, 2, pcf_isa_ops.name)) {
                        printk(KERN_ERR "%s: requested I/O region (%#x:2) is "
@@@ -282,7 -281,7 +281,7 @@@ static int elektor_probe(struct device 
        return -ENODEV;
  }
  
 -static int elektor_remove(struct device *dev, unsigned int id)
 +static void elektor_remove(struct device *dev, unsigned int id)
  {
        i2c_del_adapter(&pcf_isa_ops);
  
                iounmap(base_iomem);
                release_mem_region(base, 2);
        }
 -
 -      return 0;
  }
  
  static struct isa_driver i2c_elektor_driver = {
@@@ -57,8 -57,6 +57,8 @@@
  #define STM32F7_I2C_CR1_RXDMAEN                       BIT(15)
  #define STM32F7_I2C_CR1_TXDMAEN                       BIT(14)
  #define STM32F7_I2C_CR1_ANFOFF                        BIT(12)
 +#define STM32F7_I2C_CR1_DNF_MASK              GENMASK(11, 8)
 +#define STM32F7_I2C_CR1_DNF(n)                        (((n) & 0xf) << 8)
  #define STM32F7_I2C_CR1_ERRIE                 BIT(7)
  #define STM32F7_I2C_CR1_TCIE                  BIT(6)
  #define STM32F7_I2C_CR1_STOPIE                        BIT(5)
@@@ -162,7 -160,7 +162,7 @@@ enum 
  };
  
  #define STM32F7_I2C_DNF_DEFAULT                       0
 -#define STM32F7_I2C_DNF_MAX                   16
 +#define STM32F7_I2C_DNF_MAX                   15
  
  #define STM32F7_I2C_ANALOG_FILTER_ENABLE      1
  #define STM32F7_I2C_ANALOG_FILTER_DELAY_MIN   50      /* ns */
@@@ -727,13 -725,6 +727,13 @@@ static void stm32f7_i2c_hw_config(struc
        else
                stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1,
                                     STM32F7_I2C_CR1_ANFOFF);
 +
 +      /* Program the Digital Filter */
 +      stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1,
 +                           STM32F7_I2C_CR1_DNF_MASK);
 +      stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1,
 +                           STM32F7_I2C_CR1_DNF(i2c_dev->setup.dnf));
 +
        stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1,
                             STM32F7_I2C_CR1_PE);
  }
@@@ -2035,12 -2026,8 +2035,8 @@@ static int stm32f7_i2c_probe(struct pla
        }
  
        irq_error = platform_get_irq(pdev, 1);
-       if (irq_error <= 0) {
-               if (irq_error != -EPROBE_DEFER)
-                       dev_err(&pdev->dev, "Failed to get IRQ error: %d\n",
-                               irq_error);
+       if (irq_error <= 0)
                return irq_error ? : -ENOENT;
-       }
  
        i2c_dev->wakeup_src = of_property_read_bool(pdev->dev.of_node,
                                                    "wakeup-source");