Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3648594pxu; Mon, 19 Oct 2020 18:26:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjADuZN8dV5m5/3Syz2ybwvfSC/pfVt+X40iGNhjGjHfg9Nib8tuQWxd3llQEZmn7ED+og X-Received: by 2002:a17:906:54c7:: with SMTP id c7mr668319ejp.21.1603157193478; Mon, 19 Oct 2020 18:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603157193; cv=none; d=google.com; s=arc-20160816; b=aarGjWeVytpYWmvHfzRPUkWuF79gyGMj6a7adli5RpoXmyzW2n5uO/HDAyx39Ie3pV 4xXKEcbbYu+1iw27JV1qusju25TibDaY5vlRBrYqz3+WyiJYQRaXayv8++4gAuPcdS8Y FrFGpmdBjn0i4BJy7LW+QN0O96v6DkHLDcH7wj5K54RGx9bjqDERTx0PAF8ThgCIuNpy 7sqhu6Z8y+xplB3BH4Yg7ctjY7b1I3X3hX6Xi7eArA9B3+xCJ7U/Xnt2LLdUY4JnmgOm kIitFCgK1h8pgKiUNCgupPdAqR4GlFrhZq1Vf4BoFdlZCCr9JZKhkdaJMxdU4+8qqbap 1RLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=rBxFUnQBk/m6WFG5UWAjjL5sVxq6CrHcqtP9Rz1rzjg=; b=fT3sYg7MrR4/wYpR9AvalsEIH/9aSCmKcFWqi5jJfRJIXs5CpjnPU/76bOnxiRoRLI po/HWdRvLiAvyM7cKQ2Ppw/I2QQreuezTsuwtV/OtkTJnGZdVxWGAhrU5dwQK6pRV58j 2rx7Vx4tPIL8KFMj0X95HzY/C235EUhtUoWECT9o+SU67oAj/SPENetrjzX0Upq9RZrD RdH/9onObreT67HzOXI3N3wEW9CQU27Z9gLTq8ab19608VnmPOfSyCOWWmOZFUPG95FJ G9trWu+t3GOM7HedH5sKRFhaN7zZs8sCVc8/YGdcoyZq6GWfMYfnFJZVp/KWzRUVnsgz xBGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v20si117024edq.25.2020.10.19.18.26.11; Mon, 19 Oct 2020 18:26:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728449AbgJSNli (ORCPT + 99 others); Mon, 19 Oct 2020 09:41:38 -0400 Received: from mga17.intel.com ([192.55.52.151]:27697 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727796AbgJSNli (ORCPT ); Mon, 19 Oct 2020 09:41:38 -0400 IronPort-SDR: Q5iSzDY53nNwGE4xyQCLQSxpQPh7MH2YIcHbeABbgraRBQfq6cuOjA7eUjNcClY2H3EGQJw5uP LxOJadBOhcow== X-IronPort-AV: E=McAfee;i="6000,8403,9778"; a="146890174" X-IronPort-AV: E=Sophos;i="5.77,394,1596524400"; d="scan'208";a="146890174" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2020 06:41:37 -0700 IronPort-SDR: tE7NqGOjh23Ez0tt0O8aR0eBLBovkxERKJjkwDV6kW8YynteJUhL7az+0YS7ab+6m7ZNZlV0To 1cYBHzx1KTzg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,394,1596524400"; d="scan'208";a="422183600" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 19 Oct 2020 06:41:33 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 19 Oct 2020 16:41:33 +0300 Date: Mon, 19 Oct 2020 16:41:33 +0300 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , Rob Herring , Lee Jones , Mark Brown , Maxime Ripard , Alexandre Belloni , Thierry Reding , Prashant Malani , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Amelie Delaunay Subject: Re: [PATCH v10 10/15] usb: typec: tcpci: frs sourcing vbus callback Message-ID: <20201019134133.GE1667571@kuha.fi.intel.com> References: <20201008061556.1402293-1-badhri@google.com> <20201008061556.1402293-11-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201008061556.1402293-11-badhri@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 07, 2020 at 11:15:51PM -0700, Badhri Jagan Sridharan wrote: > During FRS hardware autonomously starts to source vbus. Provide > callback to perform chip specific operations. > > Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Heikki Krogerus > --- > v9 is the first version of this patch in the series. Added to fix > occasional bug of vbus turning back on when disconnecting the FRS accessory > after disconnect. No changes since v9. > --- > drivers/usb/typec/tcpm/tcpci.c | 9 +++++++++ > drivers/usb/typec/tcpm/tcpci.h | 4 ++++ > 2 files changed, 13 insertions(+) > > diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c > index f9f0af64da5f..f91688e43991 100644 > --- a/drivers/usb/typec/tcpm/tcpci.c > +++ b/drivers/usb/typec/tcpm/tcpci.c > @@ -284,6 +284,14 @@ static int tcpci_enable_frs(struct tcpc_dev *dev, bool enable) > return ret; > } > > +static void tcpci_frs_sourcing_vbus(struct tcpc_dev *dev) > +{ > + struct tcpci *tcpci = tcpc_to_tcpci(dev); > + > + if (tcpci->data->frs_sourcing_vbus) > + tcpci->data->frs_sourcing_vbus(tcpci, tcpci->data); > +} > + > static int tcpci_set_bist_data(struct tcpc_dev *tcpc, bool enable) > { > struct tcpci *tcpci = tcpc_to_tcpci(tcpc); > @@ -628,6 +636,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data) > tcpci->tcpc.pd_transmit = tcpci_pd_transmit; > tcpci->tcpc.set_bist_data = tcpci_set_bist_data; > tcpci->tcpc.enable_frs = tcpci_enable_frs; > + tcpci->tcpc.frs_sourcing_vbus = tcpci_frs_sourcing_vbus; > > err = tcpci_parse_config(tcpci); > if (err < 0) > diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h > index 5ef07a56d67a..b418fe11b527 100644 > --- a/drivers/usb/typec/tcpm/tcpci.h > +++ b/drivers/usb/typec/tcpm/tcpci.h > @@ -143,6 +143,9 @@ > /* > * @TX_BUF_BYTE_x_hidden > * optional; Set when TX_BUF_BYTE_x can only be accessed through I2C_WRITE_BYTE_COUNT. > + * @frs_sourcing_vbus: > + * Optional; Callback to perform chip specific operations when FRS > + * is sourcing vbus. > */ > struct tcpci; > struct tcpci_data { > @@ -154,6 +157,7 @@ struct tcpci_data { > int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *data, > enum typec_cc_status cc); > int (*set_vbus)(struct tcpci *tcpci, struct tcpci_data *data, bool source, bool sink); > + void (*frs_sourcing_vbus)(struct tcpci *tcpci, struct tcpci_data *data); > }; > > struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data); > -- > 2.28.0.806.g8561365e88-goog thanks, -- heikki