diff mbox series

usb: dwc3: pci: Don't set "linux,phy_charger_detect" property on Lenovo Yoga Tab2 1380

Message ID 20240406140127.17885-1-hdegoede@redhat.com
State New
Headers show
Series usb: dwc3: pci: Don't set "linux,phy_charger_detect" property on Lenovo Yoga Tab2 1380 | expand

Commit Message

Hans de Goede April 6, 2024, 2:01 p.m. UTC
The Lenovo Yoga Tablet 2 Pro 1380 model is the exception to the rule that
devices which use the Crystal Cove PMIC without using ACPI for battery and
AC power_supply class support use the USB-phy for charger detection.

Unlike the Lenovo Yoga Tablet 2 830 / 1050 models this model has an extra
LC824206XA Micro USB switch which does the charger detection.

Add a DMI quirk to not set the "linux,phy_charger_detect" property on
the 1380 model. This quirk matches on the BIOS version to differentiate
the 1380 model from the 830 and 1050 models which otherwise have
the same DMI strings.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/dwc3/dwc3-pci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Thinh Nguyen April 9, 2024, 12:26 a.m. UTC | #1
On Sat, Apr 06, 2024, Hans de Goede wrote:
> The Lenovo Yoga Tablet 2 Pro 1380 model is the exception to the rule that
> devices which use the Crystal Cove PMIC without using ACPI for battery and
> AC power_supply class support use the USB-phy for charger detection.
> 
> Unlike the Lenovo Yoga Tablet 2 830 / 1050 models this model has an extra
> LC824206XA Micro USB switch which does the charger detection.
> 
> Add a DMI quirk to not set the "linux,phy_charger_detect" property on
> the 1380 model. This quirk matches on the BIOS version to differentiate
> the 1380 model from the 830 and 1050 models which otherwise have
> the same DMI strings.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/usb/dwc3/dwc3-pci.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
> index 497deed38c0c..9ef821ca2fc7 100644
> --- a/drivers/usb/dwc3/dwc3-pci.c
> +++ b/drivers/usb/dwc3/dwc3-pci.c
> @@ -8,6 +8,7 @@
>   *	    Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>   */
>  
> +#include <linux/dmi.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/slab.h>
> @@ -220,6 +221,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc,
>  
>  		if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) {
>  			struct gpio_desc *gpio;
> +			const char *bios_ver;
>  			int ret;
>  
>  			/* On BYT the FW does not always enable the refclock */
> @@ -277,8 +279,12 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc,
>  			 * detection. These can be identified by them _not_
>  			 * using the standard ACPI battery and ac drivers.
>  			 */
> +			bios_ver = dmi_get_system_info(DMI_BIOS_VERSION);
>  			if (acpi_dev_present("INT33FD", "1", 2) &&
> -			    acpi_quirk_skip_acpi_ac_and_battery()) {
> +			    acpi_quirk_skip_acpi_ac_and_battery() &&
> +			    /* Lenovo Yoga Tablet 2 Pro 1380 uses LC824206XA instead */
> +			    !(bios_ver &&
> +			      strstarts(bios_ver, "BLADE_21.X64.0005.R00.1504101516"))) {
>  				dev_info(&pdev->dev, "Using TUSB1211 phy for charger detection\n");
>  				swnode = &dwc3_pci_intel_phy_charger_detect_swnode;
>  			}
> -- 
> 2.44.0
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 497deed38c0c..9ef821ca2fc7 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -8,6 +8,7 @@ 
  *	    Sebastian Andrzej Siewior <bigeasy@linutronix.de>
  */
 
+#include <linux/dmi.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -220,6 +221,7 @@  static int dwc3_pci_quirks(struct dwc3_pci *dwc,
 
 		if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) {
 			struct gpio_desc *gpio;
+			const char *bios_ver;
 			int ret;
 
 			/* On BYT the FW does not always enable the refclock */
@@ -277,8 +279,12 @@  static int dwc3_pci_quirks(struct dwc3_pci *dwc,
 			 * detection. These can be identified by them _not_
 			 * using the standard ACPI battery and ac drivers.
 			 */
+			bios_ver = dmi_get_system_info(DMI_BIOS_VERSION);
 			if (acpi_dev_present("INT33FD", "1", 2) &&
-			    acpi_quirk_skip_acpi_ac_and_battery()) {
+			    acpi_quirk_skip_acpi_ac_and_battery() &&
+			    /* Lenovo Yoga Tablet 2 Pro 1380 uses LC824206XA instead */
+			    !(bios_ver &&
+			      strstarts(bios_ver, "BLADE_21.X64.0005.R00.1504101516"))) {
 				dev_info(&pdev->dev, "Using TUSB1211 phy for charger detection\n");
 				swnode = &dwc3_pci_intel_phy_charger_detect_swnode;
 			}