Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1712991imm; Sun, 9 Sep 2018 07:45:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZxOgxvBqoD/KHqNbWdDCzg38Qr++aGXWdwtg8OX2oyVjM2n7YYgQYDQiDpd1Y9zV3cMQ6C X-Received: by 2002:a62:9541:: with SMTP id p62-v6mr18984634pfd.194.1536504311755; Sun, 09 Sep 2018 07:45:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536504311; cv=none; d=google.com; s=arc-20160816; b=0mMagcVKk0R7GvLSY5oSaNb22mvfBH2RembWNXXmI3Sf4eL7383grNmawfxWsS9ksC 1bDm3cZbDGj1n7LScBFg5UXQFlU5mZLL/N3K5ECMrVtpew4K3vHgAVC1ahDLhT0RRVgG zFMxXUcQm9Uyb299CSgP9AvDrV74+Qc4codOPE1IVqzA9TgTCMsd67eOSvfdD34m1G/1 G1x26xQqaFIf2CgJm64cGS/f91tNQPi63S3WtS1u4HqS6EdPX2/xn3wTH8aD7ia66qEO 1E5CCc4ufPc1kE5l6qdfosWHqLokVqVPeCfvFBaSA5byT79b+0mJmahDLNsGh4M6PHub PEEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=4ZHj/guxuBV4JlDmlZA6KWi8fwS2/XD6hEakjr67tcM=; b=JXetS25TY2ARTqyLcij43IPa5VDttL/CM91VTbKGkZGcrbhdjO6Wv91BuMVVMxWKSc g4UjoQrFNDgyRfzCdF4khvENyvr0aPxKrcCzDs/HrXOEgx3pEpfBrr3LvWwFms7+Jh8a 4u7DbB5lDJ9AVxJIcrpmlYtAakUbFfpbMkte48kcSFRtfIXWGQgUTbb0yVjVcJOBnJbr b/usBT7zcmfTQ8OXMDsfmLmKjQlDChE06oKgd4CHltHA8IkZwOcw0UYirVAoaoKbYCSs IXZH+V0OdoZoVn5IPUXqNwGzx6f178nZCCWy0D7U81Aw+Urn7SzuL7fo01FoESOT69JZ HojQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GIgSgenV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a68-v6si14027345pla.361.2018.09.09.07.44.55; Sun, 09 Sep 2018 07:45:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GIgSgenV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727642AbeIITdn (ORCPT + 99 others); Sun, 9 Sep 2018 15:33:43 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:37268 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727241AbeIITdm (ORCPT ); Sun, 9 Sep 2018 15:33:42 -0400 Received: by mail-oi0-f65.google.com with SMTP id p84-v6so35537762oic.4; Sun, 09 Sep 2018 07:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4ZHj/guxuBV4JlDmlZA6KWi8fwS2/XD6hEakjr67tcM=; b=GIgSgenVgH85yA9XP+CF2pfdADTAH4nefHZ0l2GRIf/MsTcaxjZgwXUb488jm2pCg/ sPwCOawNFjYFKWZJhux+LrJ5Rb4GvvuKRk1g5KLbERBU+zW69UPWZ8J5k1W/SoCJl1jX 5O0hEd6zgAqUa9XVB+vzvrgIzR3P3ZDM0xfPYbxhYexlfB4tkFW84nSZq56trPhWMT5J Pb0ASwZ54U5vXXCSYinLDJCh59LOalOeXzTFyoV8RXItkdsS4Ch8E/Y96MxwV5g3iEFM G7d4n4okdPF6FkExwtwadxiza48VmgcHBprSO3YXlAacp/vpYnADCVNwUzArQIEwziPy rTew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4ZHj/guxuBV4JlDmlZA6KWi8fwS2/XD6hEakjr67tcM=; b=niviDUw3hdE3R287wL8sKw+Gp29xvNLjaJRnCT8atqDU/j7pBY+8nLkeojT+s42gBT DxP+rJ2ZkzFsK3HTgkkCTmZT1tBoCUW5zFfRCVCezYcZ/CLnUDvUvgt9vrUI16qJCO7Q jIs445NtwNAjnPN1PRSrKaDgWJKR6lVFzNz2C/wy921mLjesyxRG458D9xRBniNVz1uM /H3XLy+/8lKZVhwYXQ79sTNgkCVbrrqMZQNkzPRvBj9bjjW43NCepz9A6NC51Ygd6c00 JTjCX8VeafAkFssP+SqNjpO+6nGZGI9z6aLG4JH3omYQ7B6hWah6/McFaeld5CH6GxO8 Jriw== X-Gm-Message-State: APzg51DJTvaLM5WH2Txd3dfEGdCJr64vCzy2URrofrRxLgnOHsLbjWao Rt8El2SbWOrXFp4VXcC7Foc= X-Received: by 2002:aca:b702:: with SMTP id h2-v6mr18321428oif.66.1536504227914; Sun, 09 Sep 2018 07:43:47 -0700 (PDT) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id a144-v6sm33186324oii.30.2018.09.09.07.43.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Sep 2018 07:43:47 -0700 (PDT) Subject: Re: [PATCH] usb: typec: don't disable sink or source on initialization To: Angus Ainslie Cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck References: <20180906192644.24587-1-angus@akkea.ca> <20180907103438.GI25121@kuha.fi.intel.com> <0adff11c-4836-4035-39a7-1cd2ea3ff74d@roeck-us.net> <00ed8e5a4ae0dd40181b8de534684960@www.akkea.ca> <690375f9-b721-51d5-7292-59acff44af7c@roeck-us.net> <363bd1128780d8de8e560b1b82ce361a@www.akkea.ca> From: Guenter Roeck Message-ID: Date: Sun, 9 Sep 2018 07:43:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <363bd1128780d8de8e560b1b82ce361a@www.akkea.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/09/2018 07:36 AM, Angus Ainslie wrote: > On 2018-09-09 08:20, Guenter Roeck wrote: >> On 09/09/2018 07:08 AM, Angus Ainslie wrote: >>> Hi Guenter >>> >>> On 2018-09-07 06:55, Guenter Roeck wrote: >>>> On 09/07/2018 03:34 AM, Heikki Krogerus wrote: >>>>> +Guenter >>>>> >>>>> On Thu, Sep 06, 2018 at 01:26:44PM -0600, Angus Ainslie (Purism) wrote: >>>>>> If the board is being powered by USB disabling the source and sink >>>>>> can remove power from the board. Default to source and sink enabled. >>>>>> >>>> >>>> Seems to me that might violate the specification, and cause trouble for systems >>>> where vbus has to be off initially. It may be better to provide this kind of >>>> information as configuration parameter instead of imposing it on everyone. >>>> >>> >>> It felt like it would not be the correct thing to do either. I've tried re-arranging the code in tcpci.c to enable the sink before disabling the source but the only way I found to not disable the power was by setting both of those to true. >>> >>> What about adding some device tree entries for the initial vbus state and default to false if they are not present ? >>> >>> init-vbus-source and init-vbus-charge ? >>> >> >> Yes, I think we should do something along that line. Another question is >> if we could or should optionally pull the current state from the low level >> driver, but that may be secondary. >> > > I thought of trying to do that but from reading the "PTN5110N PD PHY application programming guide" there didn't seem to be a direct way to read those parameters. > Let's put that on the backburner (maybe it works for some other chips) and go with the devicetree property for now. Guenter >> Thanks, >> Guenter >> >>> Angus >>> >>>> Guenter >>>> >>>>>> Signed-off-by: Angus Ainslie (Purism) >>>>>> --- >>>>>>   drivers/usb/typec/tcpm.c | 8 +++++--- >>>>>>   1 file changed, 5 insertions(+), 3 deletions(-) >>>>>> >>>>>> diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c >>>>>> index ca7bedb46f7f..a1b819cf31da 100644 >>>>>> --- a/drivers/usb/typec/tcpm.c >>>>>> +++ b/drivers/usb/typec/tcpm.c >>>>>> @@ -2462,9 +2462,11 @@ static int tcpm_init_vbus(struct tcpm_port *port) >>>>>>   { >>>>>>       int ret; >>>>>>   -    ret = port->tcpc->set_vbus(port->tcpc, false, false); >>>>>> -    port->vbus_source = false; >>>>>> -    port->vbus_charge = false; >>>>>> +    /* default to source and sink enabled in case USB is our only power >>>>>> +     * source */ >>>> >>>> I am personally in favor of standard multi-line comments. >>>> >>>>>> +    ret = port->tcpc->set_vbus(port->tcpc, true, true); >>>>>> +    port->vbus_source = true; >>>>>> +    port->vbus_charge = true; >>>>>>       return ret; >>>>>>   } >>>>> >>> >>> > >