Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp134079pxf; Wed, 17 Mar 2021 01:00:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxryYb6fdUReSxJqxdhZY1YfXudA2SqzskzwZMF/AEzFhva/OIsyE9RluYC3jQjYgZuexR X-Received: by 2002:a17:906:819:: with SMTP id e25mr34625256ejd.292.1615968012521; Wed, 17 Mar 2021 01:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615968012; cv=none; d=google.com; s=arc-20160816; b=ERRF4dKYNkczZnkCBeVtjnAzE7msR9Y+ms4x9cr/hs25DQVS5cTfv1kDxzACn7m0w9 2LqBQMFTKumlHgyKEZMNJZViIXmhQYhCmWHHJnKZJdFhW7elC+26bAnN6S9qyN9qMoZz VsW9J+1CH5D9nbMNMknkPSZNbU3X58XvplaejDtSLkr9pdXG9rmbppDVm2rCBjpnNKXd diIJCydbudaDY5CLu8t3WcM7UgtbTPIeHcmvGOiFeRFaFR5R6dcv0UHAJL3N4t0SxtVi y8Mgv/fHHwN+S8m0kOYdeqX2aK3qj8Nw6+9wuo8eOISIl0ALOE0fr3pimEJeIYf9qrf1 aBUw== 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=ig817wVv42/0McsAqKOwiO4fNxoYzP0HPNGaSpRVxdY=; b=CnPhr3LoUYyuWLTIY46Siz2Tlj3v556cGE4Giy+ceHjg2jsRPJwsDgiVUdPiKU6Q3y R13CwWVTXcz/DW07RiUiJN+nko7V3R5z5GE3wHv7dL+72Rk2n+LATxzNq/CjbjbBLpQF ToX09G7f0Mg6auJppM7V4CdIdsFayBdvb6qLezvUGG3qJZknxZKraU60Glltzqirm3yc tveTawgzrQkr0FwcjJmv9pzkqF6noVNytmk43wRyiVi7s2BS0AJDvepDPoKvSFSdaQoB UozAz+YXeO3mIMjdk9c87jV+aRv+cAZh02zj6wLcM1jB9vZTORrocEl1wEs8LadMFScO nROw== 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 fi16si15963808ejb.239.2021.03.17.00.59.50; Wed, 17 Mar 2021 01:00:12 -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 S230509AbhCQH4e (ORCPT + 99 others); Wed, 17 Mar 2021 03:56:34 -0400 Received: from mga01.intel.com ([192.55.52.88]:4772 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbhCQH4I (ORCPT ); Wed, 17 Mar 2021 03:56:08 -0400 IronPort-SDR: hT06F8oU2iWsNNCMv+RXMkpMxu8TidJ7pPloKVOOKBhxYL5y0f1vwdBF1RhM81A6fjdj1vqfgB vFvcfHGgMTFA== X-IronPort-AV: E=McAfee;i="6000,8403,9925"; a="209374137" X-IronPort-AV: E=Sophos;i="5.81,255,1610438400"; d="scan'208";a="209374137" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 00:56:07 -0700 IronPort-SDR: mSgWDomlrrV6GH7Preaa18CmJgLxGH3sB+bdT41bhEXQhjAChRZWSnjyU3WV8wXBZbkbVvwfKv WoxYFtwPbg1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,255,1610438400"; d="scan'208";a="511644820" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 17 Mar 2021 00:56:04 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 17 Mar 2021 09:56:03 +0200 Date: Wed, 17 Mar 2021 09:56:03 +0200 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Adam Thomson Subject: Re: [PATCH] usb: typec: tcpm: Invoke power_supply_changed for tcpm-source-psy- Message-ID: References: <20210316215657.387357-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210316215657.387357-1-badhri@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 16, 2021 at 02:56:57PM -0700, Badhri Jagan Sridharan wrote: > tcpm-source-psy- does not invoke power_supply_changed API when > one of the published power supply property is changed. > power_supply_changed needs to be called to notify > userspace clients(uevents) and kernel clients. > > Fixes: f2a8aa053c176("typec: tcpm: Represent source supply through > power_supply") > Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/tcpm/tcpm.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 11d0c40bc47d..e8936ea17f80 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -945,6 +945,7 @@ static int tcpm_set_current_limit(struct tcpm_port *port, u32 max_ma, u32 mv) > > port->supply_voltage = mv; > port->current_limit = max_ma; > + power_supply_changed(port->psy); > > if (port->tcpc->set_current_limit) > ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv); > @@ -2931,6 +2932,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo, > > port->pps_data.supported = false; > port->usb_type = POWER_SUPPLY_USB_TYPE_PD; > + power_supply_changed(port->psy); > > /* > * Select the source PDO providing the most power which has a > @@ -2955,6 +2957,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo, > port->pps_data.supported = true; > port->usb_type = > POWER_SUPPLY_USB_TYPE_PD_PPS; > + power_supply_changed(port->psy); > } > continue; > default: > @@ -3112,6 +3115,7 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port) > port->pps_data.out_volt)); > port->pps_data.op_curr = min(port->pps_data.max_curr, > port->pps_data.op_curr); > + power_supply_changed(port->psy); > } > > return src_pdo; > @@ -3347,6 +3351,7 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge) > return ret; > } > port->vbus_charge = charge; > + power_supply_changed(port->psy); > return 0; > } > > @@ -3530,6 +3535,7 @@ static void tcpm_reset_port(struct tcpm_port *port) > port->try_src_count = 0; > port->try_snk_count = 0; > port->usb_type = POWER_SUPPLY_USB_TYPE_C; > + power_supply_changed(port->psy); > port->nr_sink_caps = 0; > port->sink_cap_done = false; > if (port->tcpc->enable_frs) > @@ -5957,7 +5963,7 @@ static int tcpm_psy_set_prop(struct power_supply *psy, > ret = -EINVAL; > break; > } > - > + power_supply_changed(port->psy); > return ret; > } > > @@ -6110,6 +6116,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) > err = devm_tcpm_psy_register(port); > if (err) > goto out_role_sw_put; > + power_supply_changed(port->psy); > > port->typec_port = typec_register_port(port->dev, &port->typec_caps); > if (IS_ERR(port->typec_port)) { > -- > 2.31.0.rc2.261.g7f71774620-goog -- heikki