Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4517093pxf; Tue, 16 Mar 2021 16:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOejtqeDcig/+TD1IxQ7+zLTnI3p7Y2pEJW8xZblq0LQovTU55uHSl3jjU05W6GXvrdZHk X-Received: by 2002:a17:906:fa04:: with SMTP id lo4mr32323557ejb.44.1615935787765; Tue, 16 Mar 2021 16:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615935787; cv=none; d=google.com; s=arc-20160816; b=WeGH43E9JXA7X6JEXvJCO08fhzuFNLEObnDQOa5UZ9FU3RrE+LMyWKxtnAdlzAqZ27 Z63ZoEm8PnITTF1SDyLYqgO0QtgVF3X+Fb+300a9SDwwQ11c4U2Cd0IGg1ZwGb7qfERS lJUrGUfzudNGsiATZwrI9KBl0jtF+RvK8xm4tSU4y1zHFkHYNYhZHki13zJH1n6vhSdS w8WHNYqGq8FH6tmZYIAGhSrg8WDs0fasG7TShB3sby9Tz94Lo/hwvO0EmqvoX/7tQ6Np w4M1m2QzPruJtcmXFxyfm7l7egulN3U/SlmxrBu7Q6pIGfRyHcmH+uMt5TIlfpKvY41X yD4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject:sender:dkim-signature; bh=DsZA7M2L6ElXBpjZUXtVLrRd/T9BA8yOoed8azovsvw=; b=d+NytEJ0suDMjkkPUDLDyX7zwDXoYS54MzcSuIjc0FK9PSptBs2sSbU+qc5txsH7/N CYqrcFvP8wgxMBEEIZ6Uzt8BahS1k86VoeS3Dnh481Go9nxsN3xrFqxQi30rcpLh2Ltk M8YEgE/HAfrERJzBccakyxsI8HMteylMzm06m2WxOW8lEZE2JIsRNN4hdqsDowVavBhy M4DWRRbo3zB/lVI7fVp6zawCJ7C0do37trX5gW0BK36M/VFyLslUy7ASgQIwCmU6VZx4 CPZ6MsrRPdskZ1Th6Ll3UeNKF8dZxjPcZxrdikhd3d7Pv/LXODRCw3LnoQo0qgRhjF39 Rluw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cqa452dQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x26si14759175ejj.525.2021.03.16.16.02.42; Tue, 16 Mar 2021 16:03:07 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cqa452dQ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231637AbhCPWwt (ORCPT + 99 others); Tue, 16 Mar 2021 18:52:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbhCPWwi (ORCPT ); Tue, 16 Mar 2021 18:52:38 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE8F4C06174A; Tue, 16 Mar 2021 15:52:37 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id w125so11276062oib.13; Tue, 16 Mar 2021 15:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DsZA7M2L6ElXBpjZUXtVLrRd/T9BA8yOoed8azovsvw=; b=cqa452dQ0OMw5O1M9HQNaOhhHYxkRg9ubwuTkMzn9Boie5napRdXJIF3B6CVHl/Qe0 tbPo+QG1R1wJaMR26XtoZ2LOuHvvhNH6YMGf326x9UJ1QkB8B/NvaN5da3abo3+eWRSr g94hube0EustyXEzawO8DLC3qJutptP4rjBF9Y/bJhuJxIVkkdzW4xYYsRrjEYeIB6St m6+CMNpvdAdYC3PHQZR7Os0MpXSmcSPCaeicOmGixKL42rMFi5nQidx+U5tqKb2XlzLu BxGx/mCLvxbPJcjx6tYfQ6MJUoheTu2e3gZaT/wGf9aphtYT87FMWyUOumeTx30q8ZXN 3TGg== 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:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=DsZA7M2L6ElXBpjZUXtVLrRd/T9BA8yOoed8azovsvw=; b=EifLy8aJUxJtw7AiAVH3yT78eN2ApFW/X8hwCmczeECeBph3fAL8Z6nP1n4FEBFpdK ZyiPgbyjjdm6oBzIiKORfbcJ4H8TT0Z9GV9rskMY2Vu5EDXqodrNVWILgqPA0YlAzE0a FvL3uaS+4mTmSj+tT0LUor6Aa59uxZAhPW+kslwlXO5VGwt2yFkMrVJ7Ny6CM6SkcAJk sxbE5l7cLS45RU9LUqagHOrltHNi00WkZEovvPV2dI9ZbbpKzsw7lCszpgn+UASOEEIH oaJWTIaNjRqcKrDs/aTF/gfAnWyQKLjiB8+pVCY+P+vLuKwRNhvaeNQ9eeG4ETolgH2b Gm+Q== X-Gm-Message-State: AOAM53079jVvCr2w3JNm+KoTISZ3OaKHX6bxkYRYSbV+Rzqrznp9tK7R O0SEPKVAGWRVNcbUYQaS9eU= X-Received: by 2002:aca:1a01:: with SMTP id a1mr695812oia.33.1615935156424; Tue, 16 Mar 2021 15:52:36 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id b9sm8214394ooa.47.2021.03.16.15.52.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Mar 2021 15:52:35 -0700 (PDT) Sender: Guenter Roeck Subject: Re: [PATCH] usb: typec: tcpm: Invoke power_supply_changed for tcpm-source-psy- To: Badhri Jagan Sridharan , Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Adam Thomson References: <20210316215657.387357-1-badhri@google.com> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3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nBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <2175cb45-5fdc-eb57-150c-9d7adee73184@roeck-us.net> Date: Tue, 16 Mar 2021 15:52:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210316215657.387357-1-badhri@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/16/21 2:56 PM, Badhri Jagan Sridharan wrote: > tcpm-source-psy- does not invoke power_supply_changed API when > one of the published power supply property is changed. properties > 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") Is that supposed to be split ? > Signed-off-by: Badhri Jagan Sridharan Otherwise Reviewed-by: Guenter Roeck > --- > 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)) { >