This is a follow up patch set to enable typec orientation swtich
via a simple HW block(e.g. controlled by GPIOs), the implementation
is based on Rob's commment to use existing mux controller bindings,
typec port directly use mux controller consumer API, typec_switch
struct is not used.
Last discussion is here:
https://www.spinics.net/lists/linux-usb/msg205492.html
Li Jun (4):
dt-bindings: connector: Add typec orientation switch properties
usb: typec: use typec cap fwnode's of_node for typec port
usb: typec: add typec orientation switch support via mux controller
arm64: dts: imx8mp-evk: enable usb0 with typec connector
.../bindings/connector/usb-connector.yaml | 21 ++++
arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 110 ++++++++++++++++++
drivers/usb/typec/class.c | 28 ++++-
drivers/usb/typec/class.h | 2 +
drivers/usb/typec/mux.c | 34 ++++++
include/linux/usb/typec_mux.h | 4 +
6 files changed, 198 insertions(+), 1 deletion(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Typec orientation switch can be implementaed as a consumer of mux
controller, with this way, mux-control-name must be provided with
name "typec-orientation-switch", along with its 3 states value array
for none(high impedance), cc1, cc2.
Signed-off-by: Li Jun <redacted>
---
.../bindings/connector/usb-connector.yaml | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
@@ -111,6 +111,24 @@ properties:-1.5A-3.0A+mux-controls:+description:+mux controller node to use for orientation switch selection.+maxItems:1++mux-control-name:+items:+-const:typec-orientation-switch++mux-control-switch-states:+description:|+An ordered u32 array describing the mux state value for each typec+orientations:NONE(high impedance), CC1, CC2, if there is no HW mux+state for NONE, use value of CC1 or CC2 for it,+minItems:3+maxItems:3+$ref:/schemas/types.yaml#/definitions/uint32-array+# The following are optional properties for "usb-c-connector" with power# delivery support.source-pdos:
Asssign typec cap fwnode's of_node to typec port, then we can use
typec port device to get properties from its OF.
Signed-off-by: Li Jun <redacted>
---
drivers/usb/typec/class.c | 2 ++
1 file changed, 2 insertions(+)
Some dedicated mux block can use existing mux controller as a
mux provider, typec port as a consumer to select channel for
orientation switch, this can be an alternate way to current
typec_switch interface.
Signed-off-by: Li Jun <redacted>
---
drivers/usb/typec/class.c | 26 +++++++++++++++++++++++++-
drivers/usb/typec/class.h | 2 ++
drivers/usb/typec/mux.c | 34 ++++++++++++++++++++++++++++++++++
include/linux/usb/typec_mux.h | 4 ++++
4 files changed, 65 insertions(+), 1 deletion(-)
@@ -2068,6 +2076,22 @@ struct typec_port *typec_register_port(struct device *parent,returnERR_PTR(ret);}+if(!port->sw){+/* Try to get typec switch via general mux controller */+port->mux_control_switch=typec_mux_control_switch_get(&port->dev);+if(IS_ERR(port->mux_control_switch))+ret=PTR_ERR(port->mux_control_switch);+elseif(port->mux_control_switch)+ret=device_property_read_u32_array(&port->dev,+"mux-control-switch-states",+port->mux_control_switch_states,+3);+if(ret){+put_device(&port->dev);+returnERR_PTR(ret);+}+}+port->mux=typec_mux_get(&port->dev,NULL);if(IS_ERR(port->mux)){ret=PTR_ERR(port->mux);
The first usb port on imx8mp evk board has typec connector,
it has dual data role and dual power role with power delivery
support.
Signed-off-by: Li Jun <redacted>
---
arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 110 +++++++++++++++++++
1 file changed, 110 insertions(+)
From: Heikki Krogerus <heikki.krogerus@linux.intel.com> Date: 2021-05-20 12:33:53
On Wed, May 19, 2021 at 03:14:49PM +0800, Li Jun wrote:
quoted hunk
Some dedicated mux block can use existing mux controller as a
mux provider, typec port as a consumer to select channel for
orientation switch, this can be an alternate way to current
typec_switch interface.
Signed-off-by: Li Jun <redacted>
---
drivers/usb/typec/class.c | 26 +++++++++++++++++++++++++-
drivers/usb/typec/class.h | 2 ++
drivers/usb/typec/mux.c | 34 ++++++++++++++++++++++++++++++++++
include/linux/usb/typec_mux.h | 4 ++++
4 files changed, 65 insertions(+), 1 deletion(-)
@@ -2068,6 +2076,22 @@ struct typec_port *typec_register_port(struct device *parent,returnERR_PTR(ret);}+if(!port->sw){+/* Try to get typec switch via general mux controller */+port->mux_control_switch=typec_mux_control_switch_get(&port->dev);+if(IS_ERR(port->mux_control_switch))+ret=PTR_ERR(port->mux_control_switch);+elseif(port->mux_control_switch)+ret=device_property_read_u32_array(&port->dev,+"mux-control-switch-states",+port->mux_control_switch_states,+3);+if(ret){+put_device(&port->dev);+returnERR_PTR(ret);+}+}
Why not just do that inside fwnode_typec_switch_get() and handle the
whole thing in drivers/usb/typec/mux.c (or in its own file if you
prefer)?
You'll just need to register a "wrapper" Type-C switch object for the
OF mux controller, but that should not be a problem. That way you
don't need to export any new functions, touch this file or anything
else.
thanks,
--
heikki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Heikki Krogerus <heikki.krogerus@linux.intel.com> Date: 2021-05-20 12:38:50
On Wed, May 19, 2021 at 03:14:48PM +0800, Li Jun wrote:
quoted hunk
Asssign typec cap fwnode's of_node to typec port, then we can use
typec port device to get properties from its OF.
Signed-off-by: Li Jun <redacted>
---
drivers/usb/typec/class.c | 2 ++
1 file changed, 2 insertions(+)
From: Rob Herring <robh@kernel.org> Date: 2021-05-21 01:30:57
On Wed, May 19, 2021 at 03:14:47PM +0800, Li Jun wrote:
quoted hunk
Typec orientation switch can be implementaed as a consumer of mux
controller, with this way, mux-control-name must be provided with
name "typec-orientation-switch", along with its 3 states value array
for none(high impedance), cc1, cc2.
Signed-off-by: Li Jun <redacted>
---
.../bindings/connector/usb-connector.yaml | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
@@ -111,6 +111,24 @@ properties:-1.5A-3.0A+mux-controls:+description:+mux controller node to use for orientation switch selection.+maxItems:1++mux-control-name:+items:+-const:typec-orientation-switch
Don't really need a name with only 1 entry.
+
+ mux-control-switch-states:
Not really part of the 'mux-control' binding, but part of the connector.
So 'typec-orientation-switch-states' or something.
quoted hunk
+ description: |
+ An ordered u32 array describing the mux state value for each typec
+ orientations: NONE(high impedance), CC1, CC2, if there is no HW mux
+ state for NONE, use value of CC1 or CC2 for it,
+ minItems: 3
+ maxItems: 3
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+
# The following are optional properties for "usb-c-connector" with power
# delivery support.
source-pdos:
From: Heikki Krogerus <heikki.krogerus@linux.intel.com> Date: 2021-05-21 08:37:55
Hi,
On Thu, May 20, 2021 at 03:33:36PM +0300, Heikki Krogerus wrote:
Why not just do that inside fwnode_typec_switch_get() and handle the
whole thing in drivers/usb/typec/mux.c (or in its own file if you
prefer)?
You'll just need to register a "wrapper" Type-C switch object for the
OF mux controller, but that should not be a problem. That way you
don't need to export any new functions, touch this file or anything
else.
I wrote a bit of code just to see how that would look. I'm attaching
you the hack I made. I guess something like that would not be too bad.
A wrapper is probable always a bit clumsy, but I'm not sure that in
this case it's a huge problem. Of course if there are any better
ideas, let's here them :-)
thanks,
--
heikki
-----Original Message-----
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Sent: Thursday, May 20, 2021 8:34 PM
To: Jun Li <redacted>
Cc: robh+dt@kernel.org; shawnguo@kernel.org; gregkh@linuxfoundation.org;
linux@roeck-us.net; linux-usb@vger.kernel.org; dl-linux-imx
[off-list ref]; devicetree@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] usb: typec: add typec orientation switch support
via mux controller
On Wed, May 19, 2021 at 03:14:49PM +0800, Li Jun wrote:
quoted
Some dedicated mux block can use existing mux controller as a mux
provider, typec port as a consumer to select channel for orientation
switch, this can be an alternate way to current typec_switch
interface.
Signed-off-by: Li Jun <redacted>
---
drivers/usb/typec/class.c | 26 +++++++++++++++++++++++++-
drivers/usb/typec/class.h | 2 ++
drivers/usb/typec/mux.c | 34 ++++++++++++++++++++++++++++++++++
include/linux/usb/typec_mux.h | 4 ++++
4 files changed, 65 insertions(+), 1 deletion(-)
@@ -1816,6 +1817,13 @@ int typec_set_orientation(struct typec_port *port,if(ret)returnret;+if(!port->sw){+ret=typec_mux_control_switch_set(port->mux_control_switch,+port->mux_control_switch_states[orientation]);+if(ret)+returnret;+}+port->orientation=orientation;sysfs_notify(&port->dev.kobj,NULL,"orientation");kobject_uevent(&port->dev.kobj,KOBJ_CHANGE);@@-1991,7+1999,7@@
struct typec_port *typec_register_port(struct device *parent,
const struct typec_capability *cap) {
struct typec_port *port;
- int ret;
+ int ret = 0;
int id;
port = kzalloc(sizeof(*port), GFP_KERNEL); @@ -2068,6 +2076,22 @@
struct typec_port *typec_register_port(struct device *parent,
return ERR_PTR(ret);
}
+ if (!port->sw) {
+ /* Try to get typec switch via general mux controller */
+ port->mux_control_switch =
typec_mux_control_switch_get(&port->dev);
quoted
+ if (IS_ERR(port->mux_control_switch))
+ ret = PTR_ERR(port->mux_control_switch);
+ else if (port->mux_control_switch)
+ ret = device_property_read_u32_array(&port->dev,
+ "mux-control-switch-states",
+ port->mux_control_switch_states,
+ 3);
+ if (ret) {
+ put_device(&port->dev);
+ return ERR_PTR(ret);
+ }
+ }
Why not just do that inside fwnode_typec_switch_get() and handle the whole
thing in drivers/usb/typec/mux.c (or in its own file if you prefer)?
You'll just need to register a "wrapper" Type-C switch object for the OF
mux controller, but that should not be a problem. That way you don't need
to export any new functions, touch this file or anything else.
Okay, so stick to current typec_switch is preferred, actually I hesitated
on this, I know that approach will have a unified interface, but with
the cost of creating it only for wrap.
My v2 will go with the direction you suggested.
Thanks
Li Jun
-----Original Message-----
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Sent: Friday, May 21, 2021 4:38 PM
To: Jun Li <redacted>
Cc: robh+dt@kernel.org; shawnguo@kernel.org; gregkh@linuxfoundation.org;
linux@roeck-us.net; linux-usb@vger.kernel.org; dl-linux-imx
[off-list ref]; devicetree@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] usb: typec: add typec orientation switch support
via mux controller
Hi,
On Thu, May 20, 2021 at 03:33:36PM +0300, Heikki Krogerus wrote:
quoted
Why not just do that inside fwnode_typec_switch_get() and handle the
whole thing in drivers/usb/typec/mux.c (or in its own file if you
prefer)?
You'll just need to register a "wrapper" Type-C switch object for the
OF mux controller, but that should not be a problem. That way you
don't need to export any new functions, touch this file or anything
else.
I wrote a bit of code just to see how that would look. I'm attaching you
the hack I made. I guess something like that would not be too bad.
A wrapper is probable always a bit clumsy, but I'm not sure that in this
case it's a huge problem. Of course if there are any better ideas, let's
here them :-)
Thanks for your patch, I am pasting the patch as below.
seems we need consider more than that.
How to support multiple typec_switch_get() for of_mux case?
the second call to fwnode_typec_switch_get() will get the switch
via fwnode_connection_find_match()? This means we still need
a property "orientation-switch" for mux controller node, this
seems not the expected way for a mux consumer, even with this
property, we will get a EPROBE_DEFER for the first call.
If we use mux_control_get() for multiple caller/consumer, then
we need some other device as input.
typec_switch object looks to me is a provider, if we create
and maintain it in consumer side, I have not come out a better
way:-).
Thanks
Li Jun
if (!IS_ERR_OR_NULL(sw))
WARN_ON(!try_module_get(sw->dev.parent->driver->owner));
@@ -0,0 +1,97 @@+// SPDX-License-Identifier: GPL-2.0+/*+*Wrapperformuxcontrollershandlingorientation+*+*Copyright(C)2021IntelCorporation+*/++#include<linux/device.h>+#include<linux/slab.h>+#include<linux/of.h>+#include<linux/mux/consumer.h>+#include<linux/usb/typec_mux.h>++#include"mux.h"++structof_switch{+structmux_control*mc;+unsignedintstate[3];+};++staticintof_switch_set(structtypec_switch*sw,enumtypec_orientationorientation)+{+intret;++/* Checking has the switch been unregistered - just not released yet */+if(!sw->osw)+return-ENODEV;++ret=mux_control_deselect(sw->osw->mc);+if(ret)+returnret;++returnmux_control_select(sw->osw->mc,sw->osw->state[orientation]);+}++structtypec_switch*of_switch_register(structfwnode_handle*fwnode)+{+structtypec_switch_descdesc;+structtypec_switch*sw;+structmux_control*mc;+unsignedintstate[3];+structof_switch*osw;+intret;++if(!fwnode_property_present(fwnode,"mux-control-names"))+returnNULL;++ret=fwnode_property_read_u32_array(fwnode,"mux-control-switch-states",+state,3);+if(ret)+returnERR_PTR(ret);++desc.fwnode=fwnode;+desc.set=of_switch_set;+desc.name=fwnode_get_name(fwnode);+desc.drvdata=NULL;++sw=typec_switch_register(NULL,&desc);+if(IS_ERR(sw))+returnsw;++sw->dev.of_node=to_of_node(fwnode);++mc=mux_control_get(&sw->dev,"typec-orientation-switch");+if(IS_ERR_OR_NULL(mc)){+typec_switch_unregister(sw);+if(IS_ERR(mc))+returnERR_CAST(mc);+returnERR_PTR(-ENODEV);+}++osw=kzalloc(sizeof(osw),GFP_KERNEL);+if(!osw){+typec_switch_unregister(sw);+mux_control_put(mc);+returnERR_PTR(-ENOMEM);+}++memcpy(osw->state,state,sizeof(unsignedint)*3);+osw->mc=mc;+sw->osw=osw;++returnsw;+}++voidof_switch_unregister(structtypec_switch*sw)+{+structof_switch*osw=sw->osw;++if(!osw)+return;++sw->osw=NULL;+typec_switch_unregister(sw);+mux_control_put(osw->mc);+kfree(osw);+}
--
2.30.2
>
>
> thanks,
>
> --
> heikki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
-----Original Message-----
From: Rob Herring <robh@kernel.org>
Sent: Friday, May 21, 2021 9:31 AM
To: Jun Li <redacted>
Cc: heikki.krogerus@linux.intel.com; shawnguo@kernel.org;
gregkh@linuxfoundation.org; linux@roeck-us.net;
linux-usb@vger.kernel.org; dl-linux-imx [off-list ref];
devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/4] dt-bindings: connector: Add typec orientation
switch properties
On Wed, May 19, 2021 at 03:14:47PM +0800, Li Jun wrote:
quoted
Typec orientation switch can be implementaed as a consumer of mux
controller, with this way, mux-control-name must be provided with name
"typec-orientation-switch", along with its 3 states value array for
none(high impedance), cc1, cc2.
Signed-off-by: Li Jun <redacted>
---
.../bindings/connector/usb-connector.yaml | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git
a/Documentation/devicetree/bindings/connector/usb-connector.yaml
b/Documentation/devicetree/bindings/connector/usb-connector.yaml
index 32509b98142e..567183e199a3 100644
@@ -111,6 +111,24 @@ properties:-1.5A-3.0A+mux-controls:+description:+mux controller node to use for orientation switch selection.+maxItems:1++mux-control-name:+items:+-const:typec-orientation-switch
Don't really need a name with only 1 entry.
Okay, will remove it.
quoted
+
+ mux-control-switch-states:
Not really part of the 'mux-control' binding, but part of the connector.
Yes, agree.
So 'typec-orientation-switch-states' or something.
will use typec-orientation-switch-states.
Thanks
Li Jun
quoted
+ description: |
+ An ordered u32 array describing the mux state value for each typec
+ orientations: NONE(high impedance), CC1, CC2, if there is no HW mux
+ state for NONE, use value of CC1 or CC2 for it,
+ minItems: 3
+ maxItems: 3
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+
# The following are optional properties for "usb-c-connector" with power
# delivery support.
source-pdos:
From: Heikki Krogerus <heikki.krogerus@linux.intel.com> Date: 2021-05-26 09:16:25
On Tue, May 25, 2021 at 11:46:18AM +0000, Jun Li wrote:
quoted hunk
Hi Heikki,
quoted
-----Original Message-----
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Sent: Friday, May 21, 2021 4:38 PM
To: Jun Li <redacted>
Cc: robh+dt@kernel.org; shawnguo@kernel.org; gregkh@linuxfoundation.org;
linux@roeck-us.net; linux-usb@vger.kernel.org; dl-linux-imx
[off-list ref]; devicetree@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] usb: typec: add typec orientation switch support
via mux controller
Hi,
On Thu, May 20, 2021 at 03:33:36PM +0300, Heikki Krogerus wrote:
quoted
Why not just do that inside fwnode_typec_switch_get() and handle the
whole thing in drivers/usb/typec/mux.c (or in its own file if you
prefer)?
You'll just need to register a "wrapper" Type-C switch object for the
OF mux controller, but that should not be a problem. That way you
don't need to export any new functions, touch this file or anything
else.
I wrote a bit of code just to see how that would look. I'm attaching you
the hack I made. I guess something like that would not be too bad.
A wrapper is probable always a bit clumsy, but I'm not sure that in this
case it's a huge problem. Of course if there are any better ideas, let's
here them :-)
Thanks for your patch, I am pasting the patch as below.
seems we need consider more than that.
How to support multiple typec_switch_get() for of_mux case?
the second call to fwnode_typec_switch_get() will get the switch
via fwnode_connection_find_match()? This means we still need
a property "orientation-switch" for mux controller node, this
seems not the expected way for a mux consumer, even with this
property, we will get a EPROBE_DEFER for the first call.
If we use mux_control_get() for multiple caller/consumer, then
we need some other device as input.
typec_switch object looks to me is a provider, if we create
and maintain it in consumer side, I have not come out a better
way:-).
Sorry, but can we rewind a bit: Why can't you just register the
orientation switch from your mux driver and be done with it? You
should then be able to use OF graph, and no special bindings should
be needed, no?
If you want to reuse a mux-controller driver, then you do need to
modify it (but only a little), and what ever mux-controller specific
bindings there are, you will not use those when the mux supplies the
orientation switching function, instead you'll use the OF graph for
that. But surely that is not a problem?
The mux-controller framework expects the "consumers" of the muxes to
understand the final function that the mux is used for. The Type-C
"mux" framework (I should not even talk about muxes with those) works
the other way around. The driver for the component that supplies the
orientation switch function must understand that it is handling that
function, and there is a good reason for doing it that way with the
USB Type-C switches. The orientation switch for example quite simply
is _not_ always a mux. In fact, it's seems to be rarely a mux these
days. With USB4 for example the orientation is handled almost always
by the first on-board retimer.
There are actually also some technical reasons why Hans failed to get
the mux-controller thing to work, which is the original reason why we
introduced the dedicated framework for the Type-C "muxes" (I really
should stop talking about muxes), but I don't remember what was the
reason.
In any case, to summarise: the orientation switch is a function. A mux
is a device that can supply that function, and if it does, then the
driver for it really needs to register the dedicated orientation
switch.
thanks,
--
heikki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
-----Original Message-----
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Sent: Wednesday, May 26, 2021 5:16 PM
To: Jun Li <redacted>
Cc: robh+dt@kernel.org; shawnguo@kernel.org; gregkh@linuxfoundation.org;
linux@roeck-us.net; linux-usb@vger.kernel.org; dl-linux-imx
[off-list ref]; devicetree@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] usb: typec: add typec orientation switch support
via mux controller
On Tue, May 25, 2021 at 11:46:18AM +0000, Jun Li wrote:
quoted
Hi Heikki,
quoted
-----Original Message-----
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Sent: Friday, May 21, 2021 4:38 PM
To: Jun Li <redacted>
Cc: robh+dt@kernel.org; shawnguo@kernel.org;
gregkh@linuxfoundation.org; linux@roeck-us.net;
linux-usb@vger.kernel.org; dl-linux-imx [off-list ref];
devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] usb: typec: add typec orientation switch
support via mux controller
Hi,
On Thu, May 20, 2021 at 03:33:36PM +0300, Heikki Krogerus wrote:
quoted
Why not just do that inside fwnode_typec_switch_get() and handle
the whole thing in drivers/usb/typec/mux.c (or in its own file if
you prefer)?
You'll just need to register a "wrapper" Type-C switch object for
the OF mux controller, but that should not be a problem. That way
you don't need to export any new functions, touch this file or
anything else.
I wrote a bit of code just to see how that would look. I'm attaching
you the hack I made. I guess something like that would not be too bad.
A wrapper is probable always a bit clumsy, but I'm not sure that in
this case it's a huge problem. Of course if there are any better
ideas, let's here them :-)
Thanks for your patch, I am pasting the patch as below.
seems we need consider more than that.
fwnode_handle *fwnode)
sw = fwnode_connection_find_match(fwnode, "orientation-switch", NULL,
typec_switch_match);
+ if (!sw)
+ sw = of_switch_register(fwnode);
+
How to support multiple typec_switch_get() for of_mux case?
the second call to fwnode_typec_switch_get() will get the switch via
fwnode_connection_find_match()? This means we still need a property
"orientation-switch" for mux controller node, this seems not the
expected way for a mux consumer, even with this property, we will get
a EPROBE_DEFER for the first call.
If we use mux_control_get() for multiple caller/consumer, then we need
some other device as input.
typec_switch object looks to me is a provider, if we create and
maintain it in consumer side, I have not come out a better way:-).
Sorry, but can we rewind a bit: Why can't you just register the orientation
switch from your mux driver and be done with it? You should then be able
to use OF graph, and no special bindings should be needed, no?
So we still need a special property for OF graph per discussion on another
thread(use device type other than device name for match), and this has
to be a mux controller core binding for possible different mux chips
(GPIO/MMIO...), register a typec switch if this property exist, but this
is the user specific thing from mux controller point view, I feed this
is again against DT binding's expectation.
If you want to reuse a mux-controller driver, then you do need to modify
it (but only a little), and what ever mux-controller specific bindings there
are, you will not use those when the mux supplies the orientation switching
function, instead you'll use the OF graph for that. But surely that is not
a problem?
The mux-controller framework expects the "consumers" of the muxes to
understand the final function that the mux is used for. The Type-C "mux"
framework (I should not even talk about muxes with those) works the other
way around.
Fully agree.
The driver for the component that supplies the orientation switch
function must understand that it is handling that function, and there is
a good reason for doing it that way with the USB Type-C switches.
I understand yes if the switch is only part function of the driver.
The
orientation switch for example quite simply is _not_ always a mux. In fact,
it's seems to be rarely a mux these days. With USB4 for example the orientation
is handled almost always by the first on-board retimer.
If the mux is only part function of a new driver, use the tyepc
"mux" framework and create new binding for the new driver is fine.
But if the typec switch control need a dedicated driver to handle,
on DT platforms, now mux-controller is the only proposed way to go
from binding point view. I am not sure if my case is a normal HW
design, but I guess I should not the only user of this kind of
situation.
There are actually also some technical reasons why Hans failed to get the
mux-controller thing to work, which is the original reason why we introduced
the dedicated framework for the Type-C "muxes" (I really should stop talking
about muxes), but I don't remember what was the reason.
I checked the patches Hans did, that was mainly to address non-DT
platform, I don't see a clear reason why it can't fit DT platform,
maybe I missed something.
+Hans, It would be great if you can comment on this, thanks.
In any case, to summarise: the orientation switch is a function. A mux is
a device that can supply that function, and if it does, then the driver for
it really needs to register the dedicated orientation switch.
Understand your point, if register the dedicated orientation switch is a must,
I feel using general mux control can't make much sense.
Thanks
Li Jun