Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp614977pxb; Tue, 1 Feb 2022 07:03:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwa6rUdQEx943rN+mYfmKro8kMeFKRoTeWo18/dbOwzono7O0wGoM6OvTW3Ss1p0k1iWT1U X-Received: by 2002:aa7:da07:: with SMTP id r7mr26225985eds.246.1643727831183; Tue, 01 Feb 2022 07:03:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643727831; cv=none; d=google.com; s=arc-20160816; b=tRTAO+iKjI+ToolvWbNJ2Wb1pSP1/i7cHLChF7TTFQQ5T9qDPJmw5GuPPSxxlD5pfx 4X+zwUuAaVfzZVXT/VflXqo1IEpQ9EmwSyeCX5LoBMKeBup++MHxu3go+Ed2An7P4v4p SNhn166xjdMp8HBIOSE1Bxc2FJi/zSnHrS0XFzfvTtrUj0ldRYTE2DPs4BkWs0Fl1LGi QIeuWEQ+pWyRWZSYf3+TX0hcSnxS7Ts2WlRYstoQ/xxV6j1QmWxHCuOQ2N4CzOUzHC7I Jq0xYgtsKHoioxmZ5dfS1U9ul4QrqkpbZ3Vjtiljoy7CZVksf7lnd43zvc3LJOXesmXx 88/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bW8DdTVaBX9h2DB7v+Ft01LfwylVxKpkKnPwWem0oPo=; b=avPMavlkW8jVD1pwt++sH4LdKtX+qrAi/LuTHV+EJfxuIH1jJgqkSqqMFmqEGL0J41 6EGVf65+7n9oZ6EZdUCIi7OfVIt7lbRRS+qdK8viBmOYrm6hUudhyVIbm7KL4vSH1Rgh njmx0X4v6urpsY1g2JWJKO+Lw087ouqPMwjD6v0Z9AeUkHY3855OOPXZgzvf5pjXq3Rl ZKaWV2acTpnv4YXdfI2mL1sdC2ZZ5ZQAg9foXv3bES73fd4q6LCvyVOllC2FTYNr3+I3 Hs9NytDC/NF5CQ+KCkgb3hNgZajLfIC4bL7APeM1iydUBF7IZnE4kMv90LK4WsoP5vE3 6Gfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cOHmj4pZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si12024764eda.1.2022.02.01.07.03.23; Tue, 01 Feb 2022 07:03:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cOHmj4pZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356160AbiA3UqK (ORCPT + 99 others); Sun, 30 Jan 2022 15:46:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:52577 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356140AbiA3UqJ (ORCPT ); Sun, 30 Jan 2022 15:46:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643575568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bW8DdTVaBX9h2DB7v+Ft01LfwylVxKpkKnPwWem0oPo=; b=cOHmj4pZZ5stbqnz8+9yATOnYXzETHNM8ob6CPBiJYnHv+uGn7/hyA/VKc4T9kpn7nbDc5 FNbklQDNMXxTXY8IIjHljarcSsQnFm/c0HkUcMguMncmYmxopDdWmFjAyLSIFA3oXQBdxG N9SEIvIJ7V5Goa2/6W2Qv3PGLzYJ/yk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-607-omt38AfqMnKZU9BdfYeq2A-1; Sun, 30 Jan 2022 15:46:04 -0500 X-MC-Unique: omt38AfqMnKZU9BdfYeq2A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 268B31083F60; Sun, 30 Jan 2022 20:46:02 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3048346975; Sun, 30 Jan 2022 20:45:58 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Mika Westerberg , Mark Gross , Andy Shevchenko , Wolfram Sang , Lee Jones , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel Cc: Hans de Goede , Len Brown , linux-acpi@vger.kernel.org, Yauhen Kharuzhy , Tsuchiya Yuto , Fabio Aiuto , platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: [PATCH v4 resend 00/20] power-suppy/i2c/extcon: Fix charger setup on Xiaomi Mi Pad 2 and Lenovo Yogabook Date: Sun, 30 Jan 2022 21:45:37 +0100 Message-Id: <20220130204557.15662-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sebastian, Here is a resend of v4 of my patch series to fix the charger setup on Xiaomi Mi Pad 2 and Lenovo Yogabook devices, as well as fix host/device mode switching. I'm resending this because this has not made it into 5.17, this resend has been rebased on top of 5.17-rc1. Since patches 14-20 rely on the power-supply changes from patch 1-13 and since they all touch files which generally do not see much changes, the intention is for this entire series to be merged through your (Sebastian's) linux-power-supply tree. Patches 14-20 all have ackes from the relevant subsystem maintainers for merging them through the linux-power-supply tree. ### For more details on this series, here is some info from the v2 cover-letter: So far almost all the kernel code surrounding the Cherry Trail Whiskey Cove PMIC has been developed on the GPD win / pocket devices and it has various assumption based on that. In the mean time I've learned (and gotten access to) about 2 more designs and none of the 3 now known designs use a single standard setup for the charger, fuel-gauge and other chips surrounding the PMIC / charging+data USB port: 1. The GPD Win and GPD Pocket mini-laptops, these are really 2 models but the Pocket re-uses the GPD Win's design in a different housing: The WC PMIC is connected to a TI BQ24292i charger, paired with a Maxim MAX17047 fuelgauge + a FUSB302 USB Type-C Controller + a PI3USB30532 USB switch, for a fully functional Type-C port. 2. The Xiaomi Mi Pad 2: The WC PMIC is connected to a TI BQ25890 charger, paired with a TI BQ27520 fuelgauge, using the TI BQ25890 for BC1.2 charger type detection, for a USB-2 only Type-C port without PD. 3. The Lenovo Yoga Book YB1-X90 / Lenovo Yoga Book YB1-X91 series: The WC PMIC is connected to a TI BQ25892 charger, paired with a TI BQ27542 fuelgauge, using the WC PMIC for BC1.2 charger type detection and using the BQ25892's Mediatek Pump Express+ (1.0) Unlike what is normal on X86 this diversity in designs is not handled / abstracted away by the ACPI tables. This series takes care of making sure that charging and device/host mode switching also works on the Xiaomi Mi Pad 2 and the Lenovo Yogabook. Patches 1-13: Prepare the bq25890 power_supply driver to fully support the Mi Pad 2 and the Yogabook. Note this includes a new version of 2 bq25890 patches send earlier by Yauhen Kharuzhy Patch 14: Adds the intel_cht_wc_get_model() helper Patch 15: Uses this intel_cht_wc_get_model() value to instantiate an i2c-client with the right type and properties for the charger IC used on the board (instead of harcoding the GPD values) Patches 16-20: Modify the extcon code to provide charger-detection results to the charger driver and to take care of the Vbus boost regulator control (for host-mode) and device/host mode switching I've tried to keep the power_supply patches as generic as possible while focussing some of the special handling these boards need in the WC PMIC MFD and cell drivers, which will only get loaded on these boards. Regards, Hans p.s. Sebastian, I also have another power-supply series pending for merging into -next: https://lore.kernel.org/linux-pm/20220106110608.66231-1-hdegoede@redhat.com/ Hans de Goede (17): power: supply: core: Refactor power_supply_set_input_current_limit_from_supplier() power: supply: bq25890: Add a bq25890_rw_init_data() helper power: supply: bq25890: Add support to skip reset at probe() / remove() power: supply: bq25890: Add support to read back the settings from the chip power: supply: bq25890: Enable charging on boards where we skip reset power: supply: bq25890: Drop dev->platform_data == NULL check power: supply: bq25890: Add bq25890_set_otg_cfg() helper power: supply: bq25890: Add support for registering the Vbus boost converter as a regulator power: supply: bq25890: On the bq25892 set the IINLIM based on external charger detection power: supply: bq25890: Use the devm_regmap_field_bulk_alloc() helper mfd: intel_soc_pmic_chtwc: Add cht_wc_model data to struct intel_soc_pmic i2c: cht-wc: Make charger i2c-client instantiation board/device-model specific extcon: intel-cht-wc: Use new cht_wc_model intel_soc_pmic field extcon: intel-cht-wc: Support devs with Micro-B / USB-2 only Type-C connectors extcon: intel-cht-wc: Refactor cht_wc_extcon_get_charger() extcon: intel-cht-wc: Add support for registering a power_supply class-device extcon: intel-cht-wc: Report RID_A for ACA adapters Yauhen Kharuzhy (3): power: supply: bq25890: Rename IILIM field to IINLIM power: supply: bq25890: Reduce reported CONSTANT_CHARGE_CURRENT_MAX for low temperatures power: supply: bq25890: Support higher charging voltages through Pump Express+ protocol drivers/extcon/Kconfig | 2 + drivers/extcon/extcon-intel-cht-wc.c | 240 ++++++++++++-- drivers/i2c/busses/i2c-cht-wc.c | 120 +++++-- drivers/mfd/intel_soc_pmic_chtwc.c | 40 +++ drivers/power/supply/bq24190_charger.c | 10 +- drivers/power/supply/bq25890_charger.c | 396 ++++++++++++++++++----- drivers/power/supply/power_supply_core.c | 57 ++-- include/linux/mfd/intel_soc_pmic.h | 8 + include/linux/power/bq25890_charger.h | 15 + include/linux/power_supply.h | 5 +- 10 files changed, 742 insertions(+), 151 deletions(-) create mode 100644 include/linux/power/bq25890_charger.h -- 2.33.1