Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4215055imm; Tue, 11 Sep 2018 08:34:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZVDpUYDIxAwqsFzjc2NMgoLp4rA8+utXL7ANdsRYdjwsJYqzOC4AjblXAJ+U4l8IX8iRpZ X-Received: by 2002:a65:448a:: with SMTP id l10-v6mr29406077pgq.382.1536680049066; Tue, 11 Sep 2018 08:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536680049; cv=none; d=google.com; s=arc-20160816; b=OKhflQdJtOn7aDXkiu7FJmGGUiPq/96V2Rsfo2Spc+ioXHb8N3MIQ71iOJVnODKlnQ p+xsmArbqsEix0jhq+lXg8dObpZbsn/oSRnHPzN1IlJJhyLuvCF57vxK8n2YLXkynk45 FWBC5mLoMhNebMKlGKxeOsGBxYKo+HxtDCd4lmPNuh7lvwQMrGnVGSH+dVLFcklVaZQZ G3tf2fjdoceHv/h5b0jmXeOUCD+xttgmctihF1TXCSNvjj4hNlVUSAugb+NQqnkd1+AK 2LMr6QOocjvcc+4kyOwN+J4Urrvg5Nj9HDa0EWDj/8Qn8/3LZpcPMzmqCVza5s+LknlW KEng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=hO4ptVjqIF1H9wiW4ryILDVrxT+zLd5nC2KssR2sleo=; b=okdAqssz1WsggGI+pYyQIVtot9llvvZdosMsdamtEBfAin8ty5GBnE0h0ywvhGtwxQ uMr1Axthqsf+JJItk9x+YsaKbJ+mjfRRHL+e1zEVXb+asBe5eTMfqKW7Ugm6Ycft3m/z 61libd5iss/fRosB4Kk/fPzRZQe3yVEHum9O9oCl+TDfZlNO+xBlsoJAmdWkUZv1l1Om eZWlCVVBIl5dFU/CSwjPXPFmn813S+LviU6OVliDxVFk+wG1h4KxHEOpMWL4+VeHZdI7 psPHxKdWSYRVZh6jqqaB4/WYyPMQDbsCQ4d8PftP1pqk8L6jQUqy3TUtwPI3HG0xENdN p2Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="UP/SMae7"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18-v6si22371755pgh.162.2018.09.11.08.33.53; Tue, 11 Sep 2018 08:34:09 -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=@gmail.com header.s=20161025 header.b="UP/SMae7"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727517AbeIKUdQ (ORCPT + 99 others); Tue, 11 Sep 2018 16:33:16 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35404 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726933AbeIKUdP (ORCPT ); Tue, 11 Sep 2018 16:33:15 -0400 Received: by mail-pg1-f194.google.com with SMTP id 7-v6so12464476pgf.2; Tue, 11 Sep 2018 08:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hO4ptVjqIF1H9wiW4ryILDVrxT+zLd5nC2KssR2sleo=; b=UP/SMae7S3TFJRvj6TvJUdn4+S/aooaaM2eXYL1gv6KySwFu8urLn7mXos0z5U8POx aZdSHhXKOTgwc1GUAIzq/laroPasOrdIQEx6bkW68G5i5DkbMs+VVBp9n9zxwMI5LKQB 0qmAM4QDzQBMiSIKjB6xIFGmBDz0Tz4CyeDHKnwR62EBzySk47RoDsx2ikvOgzNbpuce QKCwhw89MmPqKpK2zGvEHj/c+gvR78X83evYgYSsnHDTfDVacHfPNptkt4X91OjwLvJ+ UyLQTFfodBtFb8TJ5qu7kdFyjHLZ3LN5nyvLBQ1nqXPcIUvobOsxlabjqOf/UFC8jYc9 dWoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hO4ptVjqIF1H9wiW4ryILDVrxT+zLd5nC2KssR2sleo=; b=qPZ92sBzzC2/03mBPxlyP/iNSodI+B/eh6Xyxy2/EZYnkoYfYHZ6cwoEVg+76TcykY c228aRkZDom1W1O+fBlsnVAaOM+XyV7VmCHjKsepxLvHbNFi6AU1rbTA5rqr8Yi2nYPQ +pwBBBSIGT044i1nEzWM5HF9pvx9Qqm6pCZZY7vBW3bYvfxrNyuhD5ipAVnf1ILKy5Ga WgQHbMDcdXgRu9Rs9E3qD4aXkm39+N8uS9MWwgkIPC6veUhmBMk8oHbg1N3JQH6h8p29 Dxot9BB5lVLBldnLvk1vhon6HHTpIFkxU9O/sG+yILPUUu5hQLjGham0AACrg8i+l8Qb Ufqg== X-Gm-Message-State: APzg51CmYf0yL3foNuy791LNztqde4B9CwiHE2wrgR+u9OzPdGM3VnQw wdkbdOHAvFj2dqU4n+y1hAg= X-Received: by 2002:a63:115f:: with SMTP id 31-v6mr28945614pgr.53.1536680005761; Tue, 11 Sep 2018 08:33:25 -0700 (PDT) Received: from [192.168.84.35] (148.98.198.104.bc.googleusercontent.com. [104.198.98.148]) by smtp.gmail.com with ESMTPSA id y69-v6sm37886650pfd.36.2018.09.11.08.33.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 08:33:24 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v3] usb: typec: get the vbus source and charge values from the devicetree From: Guenter Roeck X-Mailer: iPhone Mail (15G77) In-Reply-To: <20180911145931.32441-1-angus@akkea.ca> Date: Tue, 11 Sep 2018 08:33:22 -0700 Cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <8A418EC6-62A4-4354-8928-7693696409D1@gmail.com> References: <20180906192644.24587-1-angus@akkea.ca> <20180911145931.32441-1-angus@akkea.ca> To: "Angus Ainslie (Purism)" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I cant put my finger on it but this seems wrong. As i said both src and sink= should never be true at the same time. I also din=E2=80=99t understand why t= urning off src should power off your board. Ultimately my concern is that we= may be just painting over the real problem, and that would be really bad to= do with dt properties. Note that sending to groeck7@ makes it hard for me to see your emails and to= reply. Using linux@roeck-us.net would be much better. Guenter Sent from my iPhone > On Sep 11, 2018, at 7:59 AM, Angus Ainslie (Purism) wrote= : >=20 > 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. >=20 > Changed since V2: >=20 > Change the devicetree documentation. > Change the devicetree property names. >=20 > Changed since V1: >=20 > use devicetree values instead of hardcoded initialization. >=20 > Signed-off-by: Angus Ainslie (Purism) > --- > .../devicetree/bindings/usb/typec-tcpci.txt | 6 ++++++ > drivers/usb/typec/tcpm.c | 14 +++++++++++--- > 2 files changed, 17 insertions(+), 3 deletions(-) >=20 > diff --git a/Documentation/devicetree/bindings/usb/typec-tcpci.txt b/Docum= entation/devicetree/bindings/usb/typec-tcpci.txt > index 0dd1469e7318..b07418ae6482 100644 > --- a/Documentation/devicetree/bindings/usb/typec-tcpci.txt > +++ b/Documentation/devicetree/bindings/usb/typec-tcpci.txt > @@ -15,6 +15,12 @@ Required sub-node: > of connector node are specified in > Documentation/devicetree/bindings/connector/usb-connector.txt >=20 > +Optional properties for usb-c-connector sub-node: > +- 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-sink: set the initalization value for vbus-sink to true. > + If this property is not present the initial value will be false. > + > Example: >=20 > ptn5110@50 { > diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c > index ca7bedb46f7f..10c14ece3858 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; >=20 > - ret =3D port->tcpc->set_vbus(port->tcpc, false, false); > - port->vbus_source =3D false; > - port->vbus_charge =3D false; > + ret =3D port->tcpc->set_vbus(port->tcpc, port->vbus_source, port->vbu= s_charge); > return ret; > } >=20 > @@ -4266,6 +4264,16 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,= > return -EINVAL; > port->port_type =3D port->typec_caps.type; >=20 > + if (fwnode_property_present(fwnode, "init-vbus-source")) > + port->vbus_source =3D true; > + else > + port->vbus_source =3D false; > + > + if (fwnode_property_present(fwnode, "init-vbus-sink")) > + port->vbus_charge =3D true; > + else > + port->vbus_charge =3D false; > + > if (port->port_type =3D=3D TYPEC_PORT_SNK) > goto sink; >=20 > --=20 > 2.17.1 >=20