Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1725551

Re: [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant defines

From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject Re: [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant defines
Date 2017-09-02 21:10 +0200
Message-ID <ullXQ-6Pl-11@gated-at.bofh.it> (permalink)
References <ul1Z7-2jb-7@gated-at.bofh.it> <ul1Z7-2jb-11@gated-at.bofh.it> <ulidA-4un-7@gated-at.bofh.it> <uliZX-4Mu-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Sep 02, 2017 at 05:59:14PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 02-09-17 16:59, Guenter Roeck wrote:
> >On 09/01/2017 02:48 PM, Hans de Goede wrote:
> >>Add MUX_USB_* state constant defines, which can be used by USB
> >>device/host and Type-C polarity/role/altmode mux drivers and consumers
> >>to ensure that they agree on the meaning of the mux_control_select()
> >>state argument.
> >>
> >>Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >>---
> >>  include/linux/mux/consumer.h | 16 ++++++++++++++++
> >>  1 file changed, 16 insertions(+)
> >>
> >>diff --git a/include/linux/mux/consumer.h b/include/linux/mux/consumer.h
> >>index 912dd48a3a5d..e3ec9b4db962 100644
> >>--- a/include/linux/mux/consumer.h
> >>+++ b/include/linux/mux/consumer.h
> >>@@ -15,6 +15,22 @@
> >>  #include <linux/compiler.h>
> >>+/*
> >>+ * Mux state values for USB muxes, used for both USB device/host role muxes
> >>+ * as well as for Type-C polarity/role/altmode muxes.
> >>+ *
> >>+ * MUX_USB_POLARITY_INV may be or-ed together with any other mux-state as
> >>+ * inverted-polarity (Type-C plugged in upside down) can happen with any
> >>+ * other mux-state.
> >>+ */
> >>+#define MUX_USB_POLARITY_INV    BIT(0)   /* Polarity inverted bit */
> >>+#define MUX_USB_NONE        (1 << 1) /* Mux open / not connected */
> >
> >
> >Why BIT(0) but (1 << 1) and so on ?
> 
> Because the polarity can be or-ed together with any of the other options.
> Each option can be selected normal and inverted polarity (connector
> inserted upside down).
> 
Ah yes, it is (2 << 1), not (1 << 2). But then why don't the options start
with (0 << 1) ?

I'll have to look into the series more closely; so far the polarity was
a separate parameter to tcpm_mux_set() and the low level API.

Guenter

> Regards,
> 
> Hans
> 
> >>+#define MUX_USB_DEVICE        (2 << 1) /* USB device mode */
> >>+#define MUX_USB_HOST        (3 << 1) /* USB host mode */
> >>+#define MUX_USB_HOST_AND_DP_SRC    (4 << 1) /* USB host + 2 lanes Display Port */
> >>+#define MUX_USB_DP_SRC        (5 << 1) /* 4 lanes Display Port source */
> >>+#define MUX_USB_STATES        (6 << 1)
> >>+
> >>  struct device;
> >>  struct mux_control;
> >>
> >

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/11] mux/typec: Add USB / TypeC mux drivers and hook them up on some x86 systems Hans de Goede <hdegoede@redhat.com> - 2017-09-01 23:50 +0200
  [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant defines Hans de Goede <hdegoede@redhat.com> - 2017-09-01 23:50 +0200
    Re: [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant defines Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-09-02 12:20 +0200
      Re: [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant  defines Hans de Goede <hdegoede@redhat.com> - 2017-09-02 14:10 +0200
    Re: [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant  defines Guenter Roeck <linux@roeck-us.net> - 2017-09-02 17:10 +0200
      Re: [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant  defines Hans de Goede <hdegoede@redhat.com> - 2017-09-02 18:00 +0200
        Re: [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant  defines Guenter Roeck <linux@roeck-us.net> - 2017-09-02 21:10 +0200
          Re: [PATCH 03/11] mux: consumer.h: Add MUX_USB_* state constant  defines Hans de Goede <hdegoede@redhat.com> - 2017-09-02 21:50 +0200
  [PATCH 08/11] staging: typec: tcpm: Set mux to device mode when configured as such Hans de Goede <hdegoede@redhat.com> - 2017-09-01 23:50 +0200
  [PATCH 07/11] extcon: intel-int3496: Add support for controlling the USB-role mux Hans de Goede <hdegoede@redhat.com> - 2017-09-01 23:50 +0200
    Re: [PATCH 07/11] extcon: intel-int3496: Add support for controlling  the USB-role mux Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-09-02 12:40 +0200
      Re: [PATCH 07/11] extcon: intel-int3496: Add support for controlling  the USB-role mux Hans de Goede <hdegoede@redhat.com> - 2017-09-04 16:20 +0200
  [PATCH 10/11] staging: typec: fusb302: Hook up mux support using tcpc_gen_mux support Hans de Goede <hdegoede@redhat.com> - 2017-09-01 23:50 +0200
  [PATCH 01/11] mux: core: Add of_mux_control_get helper function Hans de Goede <hdegoede@redhat.com> - 2017-09-01 23:50 +0200
  [PATCH 09/11] staging: typec: Add Generic TCPC mux driver using the mux subsys Hans de Goede <hdegoede@redhat.com> - 2017-09-02 00:00 +0200
  [PATCH 04/11] usb: xhci: Add Intel cherrytrail extended cap / otg phy mux handling Hans de Goede <hdegoede@redhat.com> - 2017-09-02 00:00 +0200
    Re: [PATCH 04/11] usb: xhci: Add Intel cherrytrail extended cap /  otg phy mux handling Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2017-09-04 09:40 +0200
      Re: [PATCH 04/11] usb: xhci: Add Intel cherrytrail extended cap / otg  phy mux handling Hans de Goede <hdegoede@redhat.com> - 2017-09-05 12:10 +0200
  [PATCH 06/11] mux: Add Pericom PI3USB30532 Type-C mux driver Hans de Goede <hdegoede@redhat.com> - 2017-09-02 00:00 +0200
  [PATCH 02/11] mux: core: Add support for getting a mux controller on a non DT platform Hans de Goede <hdegoede@redhat.com> - 2017-09-02 00:00 +0200
    Re: [PATCH 02/11] mux: core: Add support for getting a mux controller  on a non DT platform sathya <sathyaosid@gmail.com> - 2017-09-02 21:20 +0200
      Re: [PATCH 02/11] mux: core: Add support for getting a mux controller  on a non DT platform Hans de Goede <hdegoede@redhat.com> - 2017-09-04 16:30 +0200
    Re: [PATCH 02/11] mux: core: Add support for getting a mux controller  on a non DT platform Hans de Goede <hdegoede@redhat.com> - 2017-09-05 13:00 +0200
  Re: [PATCH 00/11] mux/typec: Add USB / TypeC mux drivers and hook  them up on some x86 systems Hans de Goede <hdegoede@redhat.com> - 2017-09-05 13:00 +0200

csiph-web