Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1975291imm; Sun, 9 Sep 2018 12:53:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZsH/biYvro4AiKRYi4iyzjVb5Ss7KahG9pYtbXpZ6+JDK86WFqh/eKt2h48GLXiSPVe0o1 X-Received: by 2002:a62:3a08:: with SMTP id h8-v6mr19849886pfa.61.1536522818898; Sun, 09 Sep 2018 12:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536522818; cv=none; d=google.com; s=arc-20160816; b=Y4pP/KWlo18xieOCc2lMQAFuCuwfo42doH89rZcSBIQIXWvCfF2hVy8VdqVRFWKvik DH1+il0AIv65mqpgc4gMIlrwgpQs4Ly/6/KuWU5v/X2Fj7dI57dvsmOXcuWRnT/FF/Jb CL8NvECrV0nqPMECzxEcWQMEMdqGPunmZSv0l7IYoVUffpMEbtvcih9eMiDVMIZW57st PqSfbIT6FslCGo8Z7fsOyLkeJA7ShJAg3ksnNR5VISdMaHF/AVKffmf+RKWEErTOrdCu 7T6Wj4dx3OcQgQpLZE3KYn0lVof5+WVXrDrNl6UICc1yQaCdGseQtpaSWJcoWBaioHQx sk1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=hcro95bS/xyvnkepZZ+Phehq/MdcVVSwfMZygXPm4O8=; b=bEb4NO6hZiEA5uZEw5sGUOoR2CGTV2wETASoKh3BZepF9bhzmQgvAhuvX75z7nIjt7 smvtghjuTMnjyBYCLvvnTUisFlgXGrNPswA5wtigyqf/Ts6+RC5m1vnSh4Eb1dUJFc3m WG1KtqYgyy55kpIWW5bcUXjEGiPKYWDOOl+VjT8i64l+xHVDtq1nU1b9Jb/G5b/3hCnj 3H8aNrtFglK0x//z1HzpS+zQGQOkw0CjC4u5wUPKbh+Et1WaK+VcEFrcw3hi1SSbJl0S /EfvVExhZIvhYhmb7RwR4zKhztuEgxsdFvO98nydb5iIPVv8RXXcLlJvPYrvAn0yy89C AFVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Y/zDbKQN"; 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 t1-v6si14355466plb.177.2018.09.09.12.53.20; Sun, 09 Sep 2018 12:53:38 -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="Y/zDbKQN"; 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 S1726725AbeIJAmw (ORCPT + 99 others); Sun, 9 Sep 2018 20:42:52 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:43545 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbeIJAmw (ORCPT ); Sun, 9 Sep 2018 20:42:52 -0400 Received: by mail-pl1-f194.google.com with SMTP id f66-v6so577799plb.10; Sun, 09 Sep 2018 12:52:07 -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-transfer-encoding:content-language; bh=hcro95bS/xyvnkepZZ+Phehq/MdcVVSwfMZygXPm4O8=; b=Y/zDbKQNC3j3a+146eDkW8Ma0YzZR3on3MDpNsBA6lT7Ah1n8JNKFjwP7gO6oorIyA i2HI6wkzbcXCrk909XieZSu7wJGAFaN9dk6uzpH0ErqCLACQUi1+7bfJ02f/nur43hPG xNHzxI4juIaxwHZjLLPY4vGheLHleoWrqku3Wz/QjEn9i8HYLYORsr7i89oOEfV+UIbC XdBUn2V9cjKKD6lAmNcd2JJ6R0oFSR4UZrWAti6wYNTAWM9YxGk9iMMKSbEiCslSfa+F lR+KR3gLAt8dqkm6VTKYJY2tRmGpzeMfm/cwVPENMSgjdWRprwi42vf1QXG+rFMZotoJ 5c/g== 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-transfer-encoding :content-language; bh=hcro95bS/xyvnkepZZ+Phehq/MdcVVSwfMZygXPm4O8=; b=m/S4vMHyDPa1KvAJdWpsx7AVyuSDH2j5ZzGEu2h7IA5dHhqo1xOwKwqCi4ebDYRn1O apnptrTPRSZ7Ki+zussEe3HxPF/WzYdhOehNmsmgK3ZvnxeGR538v6SWnsRsqqgcGNAa UB6e/nyHC/4j80T0Q+2E/boKSMDc8243mOtPmrNwOvOhYLPB6Mw6s+SZ2mhf/Y2c1RWC E2zu7+eI3oO+5te1HwsOC6b/eMg2+pUQgiJoOfw7cJdvlzX+NJ9fToUdtVYkiRL33cKK ocRmEq0IvYn06xX3BZpSDo10Yf1v0YGMmWdARZRqfHvCIRxe6cob5Wla4Wszi8aXi3cS 7jlg== X-Gm-Message-State: APzg51Aies0/D4wV4AXuLDgmQV725L2D1g8fzceS2ucJu/XRcAo/eTm+ qBXuXJZZ/NKhySh/EqXEcKYagkFY X-Received: by 2002:a17:902:9302:: with SMTP id bc2-v6mr18683190plb.280.1536522726378; Sun, 09 Sep 2018 12:52:06 -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 l84-v6sm31422866pfg.3.2018.09.09.12.52.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Sep 2018 12:52:05 -0700 (PDT) Subject: Re: [PATCH v2] usb: typec: get the vbus source and charge values from the devicetree To: "Angus Ainslie (Purism)" , Guenter Roeck Cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, "linux-kernel@vger.kernel.org" References: <20180906192644.24587-1-angus@akkea.ca> <20180909180531.28092-1-angus@akkea.ca> From: Guenter Roeck Message-ID: <3f2ae49a-9029-3f75-fb2d-abebc537594a@roeck-us.net> Date: Sun, 9 Sep 2018 12:52:04 -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: <20180909180531.28092-1-angus@akkea.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/09/2018 11:05 AM, 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. > This change will require DT maintainer approval. Thanks, Guenter > 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; >