Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1988690imm; Sun, 9 Sep 2018 13:10:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbCn3g4GJxhxiRmVZUmzNoF0BVhlj4EQv7hNCabfMTJdE85aLZ6lY88dq+sXcpvots3Wyuq X-Received: by 2002:a63:de4b:: with SMTP id y11-v6mr19100453pgi.435.1536523859076; Sun, 09 Sep 2018 13:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536523859; cv=none; d=google.com; s=arc-20160816; b=UL35U3aklX7z34R7Mz3r+ikYIkuYe3gQ/6EyyZcv4Bcend3OF7+xxk4dshYtuXUznf IrI29XtehveD7TV3OX+5mVSrVBIwhyEJdZ5oCplS5yGF0tOhgf1jwMPzekbq+CEaY8j+ XFnxc0dgXi8ukeIlAYuN+bN5sFaoradYjV6JhW0m1YUD47qop5qK1B3ZGxd6E0HsD68f lr1GwI5KeBbZEetgrJfmVvJkKXM2R1ajNh+MuY3Qu9m8qzzUd5oPE4q4t5P7XJ6n3rwt 4c9K1SDoYgOJ4SvZy0d7Ruv3uyfJ+B/H2rJ3Jdil9/lYu/PsmabSGtyLvVzQrwYTLlxY R2HQ== 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=dKWtGkfJ1lKaTGPaprYczE0V3+f9w1Slwg7xt/giesI=; b=VCiwtuv4/BmG4P8+8fYs3D6irct5OI1mvyERRUUYS68obfvwwv8GcskMBdetWg1MbP QREyTpwxhiLBVh0R+wV79pfaMXQ4utr9LPZVz/fYtbcwR670aM0/elq/bg0NY1Bb8v/4 YlyASlzn1KyrnQesmXY86A8XJ4n5eKzX/+fCBKnYmqilEGRPM8EgaD9c7MWpQUdRSj3M eSEu9pGGrNpLpuhLyLppb+d4slHDnTKQaWLlCLJo6lbMbDYxwpfHAyYT2lwKAYojBPw1 TJdf5FYl/IA6IWReLwe+sejuhBOsz00S/KwluQiLjNsqMZHMpaNAXsLmM/hrbfnV2ARi r8Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@akkea.ca header.s=mail header.b="T/++29S6"; 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 z5-v6si14032023pgn.348.2018.09.09.13.10.42; Sun, 09 Sep 2018 13:10:59 -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="T/++29S6"; 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 S1726739AbeIJBAX (ORCPT + 99 others); Sun, 9 Sep 2018 21:00:23 -0400 Received: from node.akkea.ca ([192.155.83.177]:57028 "EHLO node.akkea.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbeIJBAX (ORCPT ); Sun, 9 Sep 2018 21:00:23 -0400 Received: by node.akkea.ca (Postfix, from userid 33) id 5BD695420DB; Sun, 9 Sep 2018 20:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akkea.ca; s=mail; t=1536523774; bh=dKWtGkfJ1lKaTGPaprYczE0V3+f9w1Slwg7xt/giesI=; h=To:Subject:Date:From:Cc:In-Reply-To:References; b=T/++29S6amXtp2zuy87hPfSmEGLtLFgVNMhJqVtadQgrSvv7Lmo1bvdXDMHouoRXc XF1ySlc3j5bxdkXtmE34+bm1Cs3OZKcRqjrLnHDh3fBFcxvUesHDcVHc0SCq+miQXi hKv5BokPGXgGIScPp8QzK7rH3N8yTiJe7Fk9Wrl4= To: groeck7@gmail.com, Mark Rutland , Rob Herring Subject: Re: [PATCH v2] usb: typec: get the vbus source and charge values from the devicetree 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 14:09:34 -0600 From: Angus Ainslie Cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org In-Reply-To: <20180909180531.28092-1-angus@akkea.ca> References: <20180906192644.24587-1-angus@akkea.ca> <20180909180531.28092-1-angus@akkea.ca> Message-ID: 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 +Mark +Rob On 2018-09-09 12:05, Angus Ainslie (Purism) wrote: > If the board is being powered by USB disabling the source and sink > can remove power from the board. Allow the source and sink to be > initallized based on devicetree values. > > Changed since V1: > > use devicetree values instead of hardcoded initialization. > > Signed-off-by: Angus Ainslie (Purism) > --- > .../bindings/connector/usb-connector.txt | 4 ++++ > drivers/usb/typec/tcpm.c | 14 +++++++++++--- > 2 files changed, 15 insertions(+), 3 deletions(-) > > diff --git > a/Documentation/devicetree/bindings/connector/usb-connector.txt > b/Documentation/devicetree/bindings/connector/usb-connector.txt > index 8855bfcfd778..afe851a713c3 100644 > --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > @@ -22,6 +22,10 @@ Optional properties for usb-c-connector: > or Try.SRC, should be "sink" for Try.SNK or "source" for Try.SRC. > - data-role: should be one of "host", "device", "dual"(DRD) if typec > connector supports USB data. > +- init-vbus-source: set the initalization value for vbus-source to > true. > + If this property is not present the initial value will be false. > +- init-vbus-charge: set the initalization value for vbus-charge to > true. > + If this property is not present the initial value will be false. > > Required properties for usb-c-connector with power delivery support: > - source-pdos: An array of u32 with each entry providing supported > power > diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c > index ca7bedb46f7f..7f5d4f209e07 100644 > --- a/drivers/usb/typec/tcpm.c > +++ b/drivers/usb/typec/tcpm.c > @@ -2462,9 +2462,7 @@ 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; > + ret = port->tcpc->set_vbus(port->tcpc, port->vbus_source, > port->vbus_charge); > return ret; > } > > @@ -4266,6 +4264,16 @@ static int tcpm_fw_get_caps(struct tcpm_port > *port, > return -EINVAL; > port->port_type = port->typec_caps.type; > > + if (fwnode_property_present(fwnode, "init-vbus-source")) > + port->vbus_source = true; > + else > + port->vbus_source = false; > + > + if (fwnode_property_present(fwnode, "init-vbus-charge")) > + port->vbus_charge = true; > + else > + port->vbus_charge = false; > + > if (port->port_type == TYPEC_PORT_SNK) > goto sink;