usb: typec: fixes for Cherry Trails
Subsystems (5)
Heikki Krogerus
maintainerv2 cover usb: typec: fixes for Cherry Trails
Hi,
This is second version of the remaining patches that fix various problems I encountered while testing my USB Type-C Alternate Mode patches with GPD Win board (Intel Cherry Trail based). In this version I've addressed the problems pointed out by Hans and Guenter.
Link to the original version:
https://lkml.org/lkml/2018/4/30/350
Heikki Krogerus (3):
usb: roles: intel_xhci: Always allow user control
platform: x86: intel_cht_int33fe: Fix dependencies
usb: typec: fusb302: Fix debugfs issue
drivers/i2c/busses/Kconfig | 3 +-- drivers/platform/x86/Kconfig | 4 ++-- .../usb/roles/intel-xhci-usb-role-switch.c | 21 +------------------ drivers/usb/typec/fusb302/fusb302.c | 1 + 4 files changed, 5 insertions(+), 24 deletions(-)
Signature · 1 line
2.17.0
Heikki Krogerus
maintainerPATCH v2 1/3 usb: roles: intel_xhci: Always allow user control
Trying to determine the USB port type with this mux is very difficult. To simplify the situation, always allowing user control, even if the port is USB Type-C port.
--- .../usb/roles/intel-xhci-usb-role-switch.c | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-)
drivers/usb/roles/intel-xhci-usb-role-switch.c +1 -20
@@ -39,20 +39,6 @@ struct intel_xhci_usb_data {void __iomem *base; }; -struct intel_xhci_acpi_match { -const char *hid; -int hrv; -}; - -/* -* ACPI IDs for PMICs which do not support separate data and power role -* detection (USB ACA detection for micro USB OTG), we allow userspace to -* change the role manually on these. -*/ -static const struct intel_xhci_acpi_match allow_userspace_ctrl_ids[] = { - {"INT33F4" ,3 },/* X-Powers AXP288 PMIC */ -}; -static int intel_xhci_usb_set_role (struct device *dev,enum usb_role role) {struct intel_xhci_usb_data *data =dev_get_drvdata (dev);
@@ -139,6 +125,7 @@ static enum usb_role intel_xhci_usb_get_role(struct device *dev)static struct usb_role_switch_desc sw_desc = { .set = intel_xhci_usb_set_role, .get = intel_xhci_usb_get_role, + .allow_userspace_control = true, };static int intel_xhci_usb_probe (struct platform_device *pdev)
@@ -146,7 +133,6 @@ static int intel_xhci_usb_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct intel_xhci_usb_data *data;struct resource *res; -int i; data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -159,11 +145,6 @@ static int intel_xhci_usb_probe(struct platform_device *pdev)if (!data->base)return -ENOMEM ; -for (i =0 ; i <ARRAY_SIZE (allow_userspace_ctrl_ids); i++) -if (acpi_dev_present (allow_userspace_ctrl_ids[i].hid,"1" , - allow_userspace_ctrl_ids[i].hrv)) - sw_desc.allow_userspace_control = true; -platform_set_drvdata (pdev, data); data->role_sw =usb_role_switch_register (dev, &sw_desc);
Re: [PATCH v2 1/3] usb: roles: intel_xhci: Always allow user control
Quoted 2 lines · Heikki Krogerus
Trying to determine the USB port type with this mux is very difficult. To simplify the situation, always allowing user
s/allowing/allow/? Else the statement doesn't parse for me. :-)
Quoted 3 lines
control, even if the port is USB Type-C port.
Signed-off-by Heikki Krogerus <[email protected]>
[...]
MBR, Sergei
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Heikki Krogerus
maintainerRe: [PATCH v2 1/3] usb: roles: intel_xhci: Always allow user control
Quoted 6 lines · Sergei Shtylyov
Quoted 2 lines · Heikki Krogerus
Trying to determine the USB port type with this mux is very difficult. To simplify the situation, always allowing user
s/allowing/allow/? Else the statement doesn't parse for me. :-)
Thanks, I'll fix that, and the other patch too.
Cheers,
Re: [PATCH v2 1/3] usb: roles: intel_xhci: Always allow user control
In reply to Heikki KrogerusHi,
Quoted 35 lines · Heikki Krogerus
Trying to determine the USB port type with this mux is very difficult. To simplify the situation, always allowing user control, even if the port is USB Type-C port.
Signed-off-by Heikki Krogerus <[email protected]>--- .../usb/roles/intel-xhci-usb-role-switch.c | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-)drivers/usb/roles/intel-xhci-usb-role-switch.c +0
-14@@ -39,20 +39,6 @@ struct intel_xhci_usb_data {void __iomem *base; }; -struct intel_xhci_acpi_match { -const char *hid; -int hrv; -}; - -/* -* ACPI IDs for PMICs which do not support separate data and power role -* detection (USB ACA detection for micro USB OTG), we allow userspace to -* change the role manually on these. -*/ -static const struct intel_xhci_acpi_match allow_userspace_ctrl_ids[] = { - {"INT33F4" ,3 },/* X-Powers AXP288 PMIC */ -}; -static int intel_xhci_usb_set_role (struct device *dev,enum usb_role role) {struct intel_xhci_usb_data *data =dev_get_drvdata (dev);
drivers/usb/roles/intel-xhci-usb-role-switch.c static enum usb_role intel_xhci_usb_get_role(struct device *dev) · line 131
Quoted 7 lines
drivers/usb/roles/intel-xhci-usb-role-switch.c +1
-0@@ -139,6 +125,7 @@ static enum usb_role intel_xhci_usb_get_role(struct device *dev)static struct usb_role_switch_desc sw_desc = { .set = intel_xhci_usb_set_role, .get = intel_xhci_usb_get_role, + .allow_userspace_control = true, };static int intel_xhci_usb_probe (struct platform_device *pdev)
I hate to be pedantic here, but the sw_desc can and should be made const now, with that fixed the entire series is:
Regards,
Hans
Quoted 11 lines
drivers/usb/roles/intel-xhci-usb-role-switch.c +0
-1@@ -146,7 +133,6 @@ static int intel_xhci_usb_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct intel_xhci_usb_data *data;struct resource *res; -int i; data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)@@ -159,11 +145,6 @@ static int intel_xhci_usb_probe(struct platform_device *pdev)if (!data->base)
drivers/usb/roles/intel-xhci-usb-role-switch.c static int intel_xhci_usb_probe(struct platform_device *pdev) · line 150
Quoted 10 lines
drivers/usb/roles/intel-xhci-usb-role-switch.c +0
-5return -ENOMEM ; -for (i =0 ; i <ARRAY_SIZE (allow_userspace_ctrl_ids); i++) -if (acpi_dev_present (allow_userspace_ctrl_ids[i].hid,"1" , - allow_userspace_ctrl_ids[i].hrv)) - sw_desc.allow_userspace_control = true; -platform_set_drvdata (pdev, data); data->role_sw =usb_role_switch_register (dev, &sw_desc);
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Heikki Krogerus
maintainerRe: [PATCH v2 1/3] usb: roles: intel_xhci: Always allow user control
Quoted 39 lines · Hans de Goede
Hi,
Quoted 36 lines · Heikki Krogerus
Trying to determine the USB port type with this mux is very difficult. To simplify the situation, always allowing user control, even if the port is USB Type-C port.
Signed-off-by Heikki Krogerus <[email protected]>--- .../usb/roles/intel-xhci-usb-role-switch.c | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-)drivers/usb/roles/intel-xhci-usb-role-switch.c +0
-14@@ -39,20 +39,6 @@ struct intel_xhci_usb_data {void __iomem *base; }; -struct intel_xhci_acpi_match { -const char *hid; -int hrv; -}; - -/* -* ACPI IDs for PMICs which do not support separate data and power role -* detection (USB ACA detection for micro USB OTG), we allow userspace to -* change the role manually on these. -*/ -static const struct intel_xhci_acpi_match allow_userspace_ctrl_ids[] = { - {"INT33F4" ,3 },/* X-Powers AXP288 PMIC */ -}; -static int intel_xhci_usb_set_role (struct device *dev,enum usb_role role) {struct intel_xhci_usb_data *data =dev_get_drvdata (dev);@@ -139,6 +125,7 @@ static enum usb_role intel_xhci_usb_get_role(struct device *dev)static struct usb_role_switch_desc sw_desc = { .set = intel_xhci_usb_set_role,
Quoted 8 lines
drivers/usb/roles/intel-xhci-usb-role-switch.c static enum usb_role intel_xhci_usb_get_role(struct device *dev) · line 131
Quoted 4 lines
drivers/usb/roles/intel-xhci-usb-role-switch.c +1
-0.get = intel_xhci_usb_get_role, + .allow_userspace_control = true, };static int intel_xhci_usb_probe (struct platform_device *pdev)I hate to be pedantic here, but the
sw_desccan and should be made const now, with that fixed the entire series is:
Sure, I'll fix that.
Quoted 1 line
Reviewed-by Hans de Goede <[email protected]>
Thanks Hans. I'll send the v3. I need to add one more fix to the series.
I got a report where somebody hit the issue related to the runtime PM we talked about a while back: If xHCI is suspended, we fail to program the mux registers as they are part of xHCI MMIO, so I will add a patch to this series where I enable runtime PM here to fix that problem.
Cheers,
Heikki Krogerus
maintainerPATCH v2 2/3 platform: x86: intel_cht_int33fe: Fix dependencies
In reply to Heikki KrogerusThe driver will not probe unless bq24190 is loaded, so making it a dependency.
--- drivers/i2c/busses/Kconfig | 3 +-- drivers/platform/x86/Kconfig | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/i2c/busses/Kconfig +1 -2
@@ -202,8 +202,7 @@ config I2C_CHT_WC Note this controller is hooked up to a TI bq24292i charger-IC, combined with a FUSB302 Type-C port-controller as such it is advised - to also select CONFIG_CHARGER_BQ24190=m and CONFIG_TYPEC_FUSB302=m - (the fusb302 driver currently is in drivers/staging). + to also select CONFIG_TYPEC_FUSB302=m. config I2C_NFORCE2 tristate "Nvidia nForce2, nForce3 and nForce4"
drivers/platform/x86/Kconfig +2 -2
@@ -866,6 +866,7 @@ config ACPI_CMPC config INTEL_CHT_INT33FE tristate "Intel Cherry Trail ACPI INT33FE Driver" depends on X86 && ACPI && I2C && REGULATOR + depends on CHARGER_BQ24190=y || (CHARGER_BQ24190=m && m) ---help--- This driver add support for the INT33FE ACPI device found on some Intel Cherry Trail devices.
@@ -877,8 +878,7 @@ config INTEL_CHT_INT33FE i2c drivers for these chips can bind to the them. If you enable this driver it is advised to also select - CONFIG_TYPEC_FUSB302=m, CONFIG_CHARGER_BQ24190=m and - CONFIG_BATTERY_MAX17042=m. + CONFIG_TYPEC_FUSB302=m and CONFIG_BATTERY_MAX17042=m. config INTEL_INT0002_VGPIO tristate "Intel ACPI INT0002 Virtual GPIO driver"
Re: [PATCH v2 2/3] platform: x86: intel_cht_int33fe: Fix dependencies
Quoted 3 lines · Heikki Krogerus
The driver will not probe unless bq24190 is loaded, so making it a dependency.
assuming it will go through some other tree.
Quoted 50 lines
Signed-off-by Heikki Krogerus <[email protected]>Cc Wolfram Sang <[email protected]>Cc Darren Hart <[email protected]>Cc Andy Shevchenko <[email protected]>--- drivers/i2c/busses/Kconfig | 3 +-- drivers/platform/x86/Kconfig | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)drivers/i2c/busses/Kconfig +0
-0@@ -202,8 +202,7 @@ config I2C_CHT_WC Note this controller is hooked up to a TI bq24292i charger- IC, combined with a FUSB302 Type-C port-controller as such itis advised
drivers/i2c/busses/Kconfig +0
-1- to also select CONFIG_CHARGER_BQ24190=m and
CONFIG_TYPEC_FUSB302=mdrivers/i2c/busses/Kconfig +1
-1- (the fusb302 driver currently is in drivers/staging). + to also select CONFIG_TYPEC_FUSB302=m. config I2C_NFORCE2 tristate "Nvidia nForce2, nForce3 and nForce4"drivers/platform/x86/Kconfig +1
-0@@ -866,6 +866,7 @@ config ACPI_CMPC config INTEL_CHT_INT33FE tristate "Intel Cherry Trail ACPI INT33FE Driver" depends on X86 && ACPI && I2C && REGULATOR + depends on CHARGER_BQ24190=y || (CHARGER_BQ24190=m && m) ---help--- This driver add support for the INT33FE ACPI device foundon
drivers/platform/x86/Kconfig +1
-2some Intel Cherry Trail devices.@@ -877,8 +878,7 @@ config INTEL_CHT_INT33FE i2c drivers for these chips can bind to the them. If you enable this driver it is advised to also select - CONFIG_TYPEC_FUSB302=m, CONFIG_CHARGER_BQ24190=m and - CONFIG_BATTERY_MAX17042=m. + CONFIG_TYPEC_FUSB302=m and CONFIG_BATTERY_MAX17042=m. config INTEL_INT0002_VGPIO tristate "Intel ACPI INT0002 Virtual GPIO driver"
Heikki Krogerus
maintainerPATCH v2 3/3 usb: typec: fusb302: Fix debugfs issue
In reply to Heikki KrogerusRemoving the "fusb302" debugfs directory when unloading the driver. That allows the driver to be loaded more then ones. The directory will not get actually removed until it is empty, so only after the last instance has been removed.
This fixes an issue where the driver can't be re-loaded if it has been unloaded as the "fusb302" debugfs directory already exists.
--- drivers/usb/typec/fusb302/fusb302.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/typec/fusb302/fusb302.c +1 -0
@@ -234,6 +234,7 @@ static int fusb302_debugfs_init(struct fusb302_chip *chip)static void fusb302_debugfs_exit (struct fusb302_chip *chip) {debugfs_remove (chip->dentry); +debugfs_remove (rootdir); }#else
Re: [PATCH v2 3/3] usb: typec: fusb302: Fix debugfs issue
Hello!
Quoted 3 lines · Heikki Krogerus
Removing the "fusb302" debugfs directory when unloading the driver. That allows the driver to be loaded more then ones. The directory will not get actually removed until it
s/ones/once/?
Quoted 8 lines
is empty, so only after the last instance has been removed.
This fixes an issue where the driver can't be re-loaded if it has been unloaded as the "fusb302" debugfs directory already exists.
Fixes 76f0c53d08b9 ("usb: typec: fusb302: Move out of staging")Signed-off-by Heikki Krogerus <[email protected]>
[...]
MBR, Sergei
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html