• Hans de Goede's avatar
    ACPI / scan: Create platform device for INT33FE ACPI nodes · 589edb56
    Hans de Goede authored
    Bay and Cherry Trail devices with a Dollar Cove or Whiskey Cove PMIC
    have an ACPI node with a HID of INT33FE which is a "virtual" battery
    device implementing a standard ACPI battery interface which depends upon
    a proprietary, undocument OpRegion called BMOP. Since we do have docs
    for the actual fuel-gauges used on these boards we instead use native
    fuel-gauge drivers talking directly to the fuel-gauge ICs on boards which
    rely on this INT33FE device for their battery monitoring.
    
    On boards with a Dollar Cove PMIC the INT33FE device's resources (_CRS)
    describe a non-existing I2C client at address 0x6b with a bus-speed of
    100KHz. This is a problem on some boards since there are actual devices
    on that same bus which need a speed of 400KHz to function properly.
    
    This commit adds the INT33FE HID to the list of devices with I2C resources
    which should be enumerated as a platform-device rather then letting the
    i2c-core instantiate an i2c-client matching the first I2C resource,
    so that its bus-speed will not influence the max speed of the I2C bus.
    This fixes e.g. the touchscreen not working on the Teclast X98 II Plus.
    
    The INT33FE device on boards with a Whiskey Cove PMIC is somewhat special.
    Its first I2C resource is for a secondary I2C address of the PMIC itself,
    which is already described in an ACPI device with an INT34D3 HID.
    
    But it has 3 more I2C resources describing 3 other chips for which we do
    need to instantiate I2C clients and which need device-connections added
    between them for things to work properly. This special case is handled by
    the drivers/platform/x86/intel_cht_int33fe.c code.
    
    Before this commit that code was binding to the i2c-client instantiated
    for the secondary I2C address of the PMIC, since we now instantiate a
    platform device for the INT33FE device instead, this commit also changes
    the intel_cht_int33fe driver from an i2c driver to a platform driver.
    
    This also brings the intel_cht_int33fe drv inline with how we instantiate
    multiple i2c clients from a single ACPI device in other cases, as done
    by the drivers/platform/x86/i2c-multi-instantiate.c code.
    Reported-and-tested-by: default avatarAlexander Meiler <alex.meiler@protonmail.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Acked-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    589edb56
intel_cht_int33fe.c 8.23 KB