Commit 99e44722 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull more i2c updates from Wolfram Sang:
 "Designware:
   - refactor the transfer path to support I2C_M_STOP
   - handle pm runtime by using the active auto try macros
   - handle controllers lacking explicit START and STOP conditions
   - general cleanups

  Other i2c drivers:
   - qualcomm: add support for qcs8300-cci
   - amd8111: general cleanups
   - cp2112: add DT bindings"

* tag 'i2c-for-7.0-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  dt-bindings: i2c: Add CP2112 HID USB to SMBus Bridge
  i2c: amd8111: switch to devm_ functions
  i2c: amd8111: Remove spaces in MODULE_* macros
  i2c: designware-platdrv: fix cleanup on probe failure
  i2c: designware-platdrv: simplify reset control
  dt-bindings: i2c: qcom-cci: Document qcs8300 compatible
  i2c: designware: Remove dead code in AMD ISP case
  i2c: designware: Support of controller with IC_EMPTYFIFO_HOLD_MASTER disabled
  i2c: designware: Use runtime PM macro for auto-cleanup
  i2c: designware: Implement I2C_M_STOP support
parents bc1d4e70 709cc48d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ properties:
          - enum:
              - qcom,kaanapali-cci
              - qcom,qcm2290-cci
              - qcom,qcs8300-cci
              - qcom,sa8775p-cci
              - qcom,sc7280-cci
              - qcom,sc8280xp-cci
@@ -133,6 +134,7 @@ allOf:
            enum:
              - qcom,kaanapali-cci
              - qcom,qcm2290-cci
              - qcom,qcs8300-cci
              - qcom,sm8750-cci
    then:
      properties:
+100 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/i2c/silabs,cp2112.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: CP2112 HID USB to SMBus/I2C Bridge

maintainers:
  - Danny Kaehn <danny.kaehn@plexus.com>

description:
  The CP2112 is a USB HID device which includes an integrated I2C controller
  and 8 GPIO pins. Its GPIO pins can each be configured as inputs, open-drain
  outputs, or push-pull outputs.

properties:
  compatible:
    const: usb10c4,ea90

  reg:
    maxItems: 1
    description: The USB port number

  interrupt-controller: true
  "#interrupt-cells":
    const: 2

  gpio-controller: true
  "#gpio-cells":
    const: 2

  gpio-line-names:
    minItems: 1
    maxItems: 8

  i2c:
    description: The SMBus/I2C controller node for the CP2112
    $ref: /schemas/i2c/i2c-controller.yaml#
    unevaluatedProperties: false

    properties:
      clock-frequency:
        minimum: 10000
        default: 100000
        maximum: 400000

patternProperties:
  "-hog(-[0-9]+)?$":
    type: object

    required:
      - gpio-hog

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/gpio/gpio.h>

    usb {
        #address-cells = <1>;
        #size-cells = <0>;

        cp2112: device@1 {
            compatible = "usb10c4,ea90";
            reg = <1>;

            gpio-controller;
            interrupt-controller;
            #interrupt-cells = <2>;
            #gpio-cells = <2>;
            gpio-line-names = "CP2112_SDA", "CP2112_SCL", "TEST2",
                              "TEST3","TEST4", "TEST5", "TEST6";

            fan-rst-hog {
                gpio-hog;
                gpios = <7 GPIO_ACTIVE_HIGH>;
                output-high;
                line-name = "FAN_RST";
            };

            i2c {
                #address-cells = <1>;
                #size-cells = <0>;
                sda-gpios = <&cp2112 0 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
                scl-gpios = <&cp2112 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;

                temp@48 {
                    compatible = "national,lm75";
                    reg = <0x48>;
                };
            };
        };
    };
+9 −21
Original line number Diff line number Diff line
@@ -427,7 +427,7 @@ static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
	if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO))
		return -ENODEV;

	smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL);
	smbus = devm_kzalloc(&dev->dev, sizeof(struct amd_smbus), GFP_KERNEL);
	if (!smbus)
		return -ENOMEM;

@@ -436,15 +436,11 @@ static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
	smbus->size = pci_resource_len(dev, 0);

	error = acpi_check_resource_conflict(&dev->resource[0]);
	if (error) {
		error = -ENODEV;
		goto out_kfree;
	}
	if (error)
		return -ENODEV;

	if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) {
		error = -EBUSY;
		goto out_kfree;
	}
	if (!devm_request_region(&dev->dev, smbus->base, smbus->size, amd8111_driver.name))
		return -EBUSY;

	smbus->adapter.owner = THIS_MODULE;
	snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
@@ -459,16 +455,10 @@ static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
	pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0);
	error = i2c_add_adapter(&smbus->adapter);
	if (error)
		goto out_release_region;
		return error;

	pci_set_drvdata(dev, smbus);
	return 0;

 out_release_region:
	release_region(smbus->base, smbus->size);
 out_kfree:
	kfree(smbus);
	return error;
}

static void amd8111_remove(struct pci_dev *dev)
@@ -476,8 +466,6 @@ static void amd8111_remove(struct pci_dev *dev)
	struct amd_smbus *smbus = pci_get_drvdata(dev);

	i2c_del_adapter(&smbus->adapter);
	release_region(smbus->base, smbus->size);
	kfree(smbus);
}

static struct pci_driver amd8111_driver = {
+1 −12
Original line number Diff line number Diff line
@@ -18,9 +18,6 @@
static void amd_isp_dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *i2c_dev)
{
	pm_runtime_disable(i2c_dev->dev);

	if (i2c_dev->shared_with_punit)
		pm_runtime_put_noidle(i2c_dev->dev);
}

static inline u32 amd_isp_dw_i2c_get_clk_rate(struct dw_i2c_dev *i2c_dev)
@@ -79,9 +76,6 @@ static int amd_isp_dw_i2c_plat_probe(struct platform_device *pdev)

	device_enable_async_suspend(&pdev->dev);

	if (isp_i2c_dev->shared_with_punit)
		pm_runtime_get_noresume(&pdev->dev);

	pm_runtime_enable(&pdev->dev);
	pm_runtime_get_sync(&pdev->dev);

@@ -130,9 +124,6 @@ static int amd_isp_dw_i2c_plat_runtime_suspend(struct device *dev)
{
	struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);

	if (i_dev->shared_with_punit)
		return 0;

	i2c_dw_disable(i_dev);
	i2c_dw_prepare_clk(i_dev, false);

@@ -161,9 +152,7 @@ static int amd_isp_dw_i2c_plat_runtime_resume(struct device *dev)
	if (!i_dev)
		return -ENODEV;

	if (!i_dev->shared_with_punit)
	i2c_dw_prepare_clk(i_dev, true);

	i2c_dw_init(i_dev);

	return 0;
+20 −0
Original line number Diff line number Diff line
@@ -492,6 +492,12 @@ int i2c_dw_fw_parse_and_configure(struct dw_i2c_dev *dev)

	dev->clk_freq_optimized = device_property_read_bool(device, "snps,clk-freq-optimized");

	/* Mobileye controllers do not hold the clock on empty FIFO */
	if (device_is_compatible(device, "mobileye,eyeq6lplus-i2c"))
		dev->emptyfifo_hold_master = false;
	else
		dev->emptyfifo_hold_master = true;

	i2c_dw_adjust_bus_speed(dev);

	if (is_of_node(fwnode))
@@ -918,6 +924,20 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
	else
		irq_flags = IRQF_SHARED | IRQF_COND_SUSPEND;

	/*
	 * The first writing to TX FIFO buffer causes transmission start.
	 * If IC_EMPTYFIFO_HOLD_MASTER_EN is not set, when TX FIFO gets
	 * empty, I2C controller finishes the transaction. If writing to
	 * FIFO is interrupted, FIFO can get empty and the transaction will
	 * be finished prematurely. FIFO buffer is filled in IRQ handler,
	 * but in PREEMPT_RT kernel IRQ handler by default is executed
	 * in thread that can be preempted with another higher priority
	 * thread or an interrupt. So, IRQF_NO_THREAD flag is required in
	 * order to prevent any preemption when filling the FIFO.
	 */
	if (!dev->emptyfifo_hold_master)
		irq_flags |= IRQF_NO_THREAD;

	ret = i2c_dw_acquire_lock(dev);
	if (ret)
		return ret;
Loading