Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1683180imm; Sun, 9 Sep 2018 07:10:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYSRTW/OvdCZT8lxZzM7r6SPeXsU0t83JvwKnUPuJcwcuFp9a4+8NzCSQ9dVIJPSIN9CzwL X-Received: by 2002:a63:5d1f:: with SMTP id r31-v6mr17796371pgb.445.1536502206683; Sun, 09 Sep 2018 07:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536502206; cv=none; d=google.com; s=arc-20160816; b=cObqGrwe0h63Y2uhdHWZlNdeBchlHtD8Q3lMer7GzYmtf2v6hXX6CBzp4XJ9ixcvly KTkHO27trz/NfkSeDTItvL1MtvDbP6FvfXq0AcNlf0lI22nQu1qdAubri58xq80oDscp zD5w60c/8uiktOqJ6Qfkif0A2ylg+VgCgB4qt1LpG1iHsFEFoY/Tlk4gVjtGS5beTpo8 5Yxnu7TacY0/jaQQ4ZcY0/vov5mh/huI+z4Bl9asenpOmoI4yDwxXd3zVaAsyaWldz/T UlAb9VEyQZGrKmonkNOYEV65/fLwtkaoRhRjLNkqyCin7FUw/Hj2GwBa7dyfhvxcdckg Vd5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:cc:from:date:content-transfer-encoding:mime-version :subject:to:dkim-signature; bh=9GXyO9+nTX5jyWXGAWK5AbmxhVL5P60JylDrRPh9wTA=; b=DNElUxPlTxQsKMuno67rhYH6NIYyfDKnGGBnPsQN79bjWONQGD5Rln8OuPggu/Egpn 7s2DCG6dmWcL6IrGrk9s/f5hTkC3U2URoPJ6+Tr2UdhNUE860ZA3zGAwXdtw4MVFFzQ0 LWKm9JW4bCN5TOfDPPfPXqvioqi3HWO6Yyu7h/+HpSQGcyDQZ9nyMBhSL35/x/p/C/e1 c11cg+0AQ/z77M0YyBeBH0h7lE+269kIMrTb7j1/Y68yJAU/SP2+bxnCElkOTuHc2ds0 q4G8g2WB+5NcuzYIciJTFezQnlMSiNxa+UUBFuEITJucos6Rjq72Z0PPf6/otcKdavO9 F0BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@akkea.ca header.s=mail header.b=B+SZ4whu; 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 c4-v6si14132757pfa.285.2018.09.09.07.09.50; Sun, 09 Sep 2018 07:10:06 -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=pass header.i=@akkea.ca header.s=mail header.b=B+SZ4whu; 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 S1727521AbeIIS6f (ORCPT + 99 others); Sun, 9 Sep 2018 14:58:35 -0400 Received: from node.akkea.ca ([192.155.83.177]:48226 "EHLO node.akkea.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727076AbeIIS6f (ORCPT ); Sun, 9 Sep 2018 14:58:35 -0400 Received: by node.akkea.ca (Postfix, from userid 33) id 947CB5420DB; Sun, 9 Sep 2018 14:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1536502126; bh=9GXyO9+nTX5jyWXGAWK5AbmxhVL5P60JylDrRPh9wTA=; h=To:Subject:Date:From:Cc:In-Reply-To:References; b=B+SZ4whuivrRf00uDa78XE5NFK0Ug3UfGHtfnDS0Tjth2Fk7PmArcrGr3bfVg/1t7 oOSmX/WruHDZW/0HJb+SxSreaYI9r66It6E368OaGprhsmekoIf2Xxthvt02izm5OI IRCPGk2baparMujeiaVIcYOjmUFWg8BeACxEQ8GE= To: Guenter Roeck Subject: Re: [PATCH] usb: typec: don't disable sink or source on initialization X-PHP-Originating-Script: 1000:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 09 Sep 2018 08:08:46 -0600 From: Angus Ainslie Cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck In-Reply-To: <0adff11c-4836-4035-39a7-1cd2ea3ff74d@roeck-us.net> References: <20180906192644.24587-1-angus@akkea.ca> <20180907103438.GI25121@kuha.fi.intel.com> <0adff11c-4836-4035-39a7-1cd2ea3ff74d@roeck-us.net> Message-ID: <00ed8e5a4ae0dd40181b8de534684960@www.akkea.ca> X-Sender: angus@akkea.ca User-Agent: Roundcube Webmail/1.1.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? 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; >>> } >>