mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: MyungJoo Ham <myungjoo.ham@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	Peter Rosin <peda@axentia.se>,
	Mathias Nyman <mathias.nyman@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, devel@driverdev.osuosl.org,
	Kuppuswamy Sathyanarayanan 
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Sathyanarayanan Kuppuswamy Natarajan <sathyaosid@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org
Subject: [PATCH v3 02/14] mux: core: Add explicit hook to leave the mux as-is on init/registration
Date: Fri, 22 Sep 2017 20:37:51 +0200	[thread overview]
Message-ID: <20170922183803.10701-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20170922183803.10701-1-hdegoede@redhat.com>

From: Peter Rosin <peda@axentia.se>

A board may need a mux controller to stay as-is for a while longer, e.g.
if setting the normally preferred idle state destroys booting.

The mechanism provided here is not perfect in two ways.
1. As soon as the mux controller is registered, some mux consumer can
   access it and set a state that destroys booting all the same.
2. The mux controller might linger in a state that is not the
   preferred idle state indefinitely, if no mux consumer ever selects
   and then deselects the mux.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/mux/core.c         | 3 +++
 include/linux/mux/driver.h | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/mux/core.c b/drivers/mux/core.c
index 244bceb17877..d0ad56abca2a 100644
--- a/drivers/mux/core.c
+++ b/drivers/mux/core.c
@@ -155,6 +155,9 @@ int mux_chip_register(struct mux_chip *mux_chip)
 	for (i = 0; i < mux_chip->controllers; ++i) {
 		struct mux_control *mux = &mux_chip->mux[i];
 
+		if (mux->init_as_is)
+			continue;
+
 		if (mux->idle_state == mux->cached_state)
 			continue;
 
diff --git a/include/linux/mux/driver.h b/include/linux/mux/driver.h
index 35c3579c3304..21cf6041a962 100644
--- a/include/linux/mux/driver.h
+++ b/include/linux/mux/driver.h
@@ -36,6 +36,9 @@ struct mux_control_ops {
  * @states:		The number of mux controller states.
  * @idle_state:		The mux controller state to use when inactive, or one
  *			of MUX_IDLE_AS_IS and MUX_IDLE_DISCONNECT.
+ * @init_as_is:		Set to true to have the core leave the mux controller
+ *			state as-is until first selection. If @idle_state is
+ *			MUX_IDLE_AS_IS, @init_as_is is irrelevant.
  *
  * Mux drivers may only change @states and @idle_state, and may only do so
  * between allocation and registration of the mux controller. Specifically,
@@ -50,6 +53,7 @@ struct mux_control {
 
 	unsigned int states;
 	int idle_state;
+	bool init_as_is;
 };
 
 /**
-- 
2.14.1

  reply	other threads:[~2017-09-22 18:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 18:37 [PATCH v3 01/14] mux: core: Add mux_control_get_optional() API Hans de Goede
2017-09-22 18:37 ` Hans de Goede [this message]
2017-09-22 18:37 ` [PATCH v3 03/14] mux: core: Add of_mux_control_get helper function Hans de Goede
2017-09-22 18:37 ` [PATCH v3 04/14] mux: core: Add support for getting a mux controller on a non DT platform Hans de Goede
2017-09-22 18:37 ` [PATCH v3 05/14] mux: core: Add usb.h header with MUX_USB_* and and MUX_TYPEC_* state constants Hans de Goede
2017-09-26  7:45   ` Heikki Krogerus
2017-09-22 18:37 ` [PATCH v3 06/14] xhci: Add option to get next extended capability in list by passing id = 0 Hans de Goede
2017-09-22 18:37 ` [PATCH v3 07/14] xhci: Add Intel cherrytrail extended cap / otg phy mux handling Hans de Goede
2017-10-05 11:13   ` Mathias Nyman
2017-09-22 18:37 ` [PATCH v3 08/14] mux: Add Intel Cherrytrail USB mux driver Hans de Goede
2017-09-22 18:37 ` [PATCH v3 09/14] mux: Add Pericom PI3USB30532 Type-C " Hans de Goede
2017-09-22 18:37 ` [PATCH v3 10/14] extcon: intel-int3496: Add support for controlling the USB-role mux Hans de Goede
2017-10-18  2:33   ` Chanwoo Choi
2017-10-18  9:14     ` Hans de Goede
2017-10-18  9:40       ` Chanwoo Choi
2017-09-22 18:38 ` [PATCH v3 11/14] staging: typec: tcpm: Set mux to device mode when configured as such Hans de Goede
2017-09-22 18:38 ` [PATCH v3 12/14] staging: typec: Add Generic TCPC mux driver using the mux subsys Hans de Goede
2017-09-22 18:38 ` [PATCH v3 13/14] staging: typec: fusb302: Hook up mux support using tcpc_gen_mux support Hans de Goede
2017-09-22 18:38 ` [PATCH v3 14/14] platform/x86: intel_cht_int33fe: Add mux mappings for the Type-C port Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170922183803.10701-2-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy@infradead.org \
    --cc=cw00.choi@samsung.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dvhart@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mathias.nyman@intel.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=peda@axentia.se \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=sathyaosid@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®