From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752976AbbLCTRF (ORCPT ); Thu, 3 Dec 2015 14:17:05 -0500 Received: from mail-lb0-f179.google.com ([209.85.217.179]:36215 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751763AbbLCTRD (ORCPT ); Thu, 3 Dec 2015 14:17:03 -0500 Subject: Re: [PATCHv2 1/2] extcon: add driver for Intel USB mux To: Heikki Krogerus , Chanwoo Choi , Greg Kroah-Hartman References: <1449134991-39095-1-git-send-email-heikki.krogerus@linux.intel.com> <1449134991-39095-2-git-send-email-heikki.krogerus@linux.intel.com> Cc: MyungJoo Ham , David Cohen , Lu Baolu , Mathias Nyman , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <5660952A.4010108@cogentembedded.com> Date: Thu, 3 Dec 2015 22:16:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1449134991-39095-2-git-send-email-heikki.krogerus@linux.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/03/2015 12:29 PM, Heikki Krogerus wrote: > Several Intel PCHs and SOCs have an internal mux that is > used to share one USB port between USB Device Controller and > xHCI. The mux is normally handled by System FW/BIOS, but not > always. For those platforms where the FW does not take care > of the mux, this driver is needed. > > Signed-off-by: Heikki Krogerus [...] > diff --git a/drivers/extcon/extcon-intel-usb.c b/drivers/extcon/extcon-intel-usb.c > new file mode 100644 > index 0000000..3da6039 > --- /dev/null > +++ b/drivers/extcon/extcon-intel-usb.c > @@ -0,0 +1,118 @@ [...] > +struct intel_usb_mux *intel_usb_mux_register(struct device *dev, > + struct resource *r) > +{ > + struct intel_usb_mux *mux; > + int ret; > + > + mux = kzalloc(sizeof(*mux), GFP_KERNEL); > + if (!mux) > + return ERR_PTR(-ENOMEM); > + > + mux->regs = ioremap_nocache(r->start, resource_size(r)); > + if (!mux->regs) { > + kfree(mux); > + return ERR_PTR(-ENOMEM); > + } > + > + mux->cfg0_ctx = readl(mux->regs + INTEL_MUX_CFG0); > + > + mux->edev.dev.parent = dev; > + mux->edev.supported_cable = intel_mux_cable; > + > + ret = extcon_dev_register(&mux->edev); I don't see where are you calling extcon_set_cable_state() fot the "USB-HOST" cable... This doesn't seem a legitimate extcon driver to me... :-/ > + if (ret) > + goto err; > + > + mux->edev.name = "intel_usb_mux"; > + mux->edev.state = !!(readl(mux->regs + INTEL_MUX_CFG1) & CFG1_MODE); > + > + /* An external source needs to tell us what to do */ > + mux->nb.notifier_call = intel_usb_mux_notifier; > + ret = extcon_register_notifier(&mux->edev, EXTCON_USB_HOST, &mux->nb); So in reality this is an extcon client, not a provider? BTW, this API isn't recommended... MBR, Sergei