diff mbox

[v2,1/3] usb: roles: intel_xhci: Always allow user control

Message ID 20180523143758.66348-2-heikki.krogerus@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Heikki Krogerus May 23, 2018, 2:37 p.m. UTC
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 <heikki.krogerus@linux.intel.com>
---
 .../usb/roles/intel-xhci-usb-role-switch.c    | 21 +------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

Comments

Sergei Shtylyov May 23, 2018, 4:10 p.m. UTC | #1
On 05/23/2018 05:37 PM, Heikki Krogerus wrote:

> 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. :-)

> control, even if the port is USB Type-C port.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans de Goede May 23, 2018, 6:03 p.m. UTC | #2
Hi,

On 23-05-18 16:37, Heikki Krogerus wrote:
> 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 <heikki.krogerus@linux.intel.com>
> ---
>   .../usb/roles/intel-xhci-usb-role-switch.c    | 21 +------------------
>   1 file changed, 1 insertion(+), 20 deletions(-)
> 
> diff --git a/drivers/usb/roles/intel-xhci-usb-role-switch.c b/drivers/usb/roles/intel-xhci-usb-role-switch.c
> index 30b07ea3a3c6..3f14153d753f 100644
> --- a/drivers/usb/roles/intel-xhci-usb-role-switch.c
> +++ b/drivers/usb/roles/intel-xhci-usb-role-switch.c
> @@ -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)


I hate to be pedantic here, but the sw_desc can and should be made
const now, with that fixed the entire series is:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> @@ -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);
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Heikki Krogerus May 24, 2018, 6:03 a.m. UTC | #3
On Wed, May 23, 2018 at 08:03:43PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 23-05-18 16:37, Heikki Krogerus wrote:
> > 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 <heikki.krogerus@linux.intel.com>
> > ---
> >   .../usb/roles/intel-xhci-usb-role-switch.c    | 21 +------------------
> >   1 file changed, 1 insertion(+), 20 deletions(-)
> > 
> > diff --git a/drivers/usb/roles/intel-xhci-usb-role-switch.c b/drivers/usb/roles/intel-xhci-usb-role-switch.c
> > index 30b07ea3a3c6..3f14153d753f 100644
> > --- a/drivers/usb/roles/intel-xhci-usb-role-switch.c
> > +++ b/drivers/usb/roles/intel-xhci-usb-role-switch.c
> > @@ -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)
> 
> 
> I hate to be pedantic here, but the sw_desc can and should be made
> const now, with that fixed the entire series is:

Sure, I'll fix that.

> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

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 May 24, 2018, 6:08 a.m. UTC | #4
On Wed, May 23, 2018 at 07:10:58PM +0300, Sergei Shtylyov wrote:
> On 05/23/2018 05:37 PM, Heikki Krogerus wrote:
> 
> > 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,
diff mbox

Patch

diff --git a/drivers/usb/roles/intel-xhci-usb-role-switch.c b/drivers/usb/roles/intel-xhci-usb-role-switch.c
index 30b07ea3a3c6..3f14153d753f 100644
--- a/drivers/usb/roles/intel-xhci-usb-role-switch.c
+++ b/drivers/usb/roles/intel-xhci-usb-role-switch.c
@@ -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);