Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp915596pxf; Wed, 7 Apr 2021 14:59:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN3+kSuBrvVQHTQ6BhjKnh3hJTFW4skDoz86vdKmTrxlFFZmOv40R8bdQs/0uFKRx6hTP5 X-Received: by 2002:a63:3102:: with SMTP id x2mr5167827pgx.123.1617832777146; Wed, 07 Apr 2021 14:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617832777; cv=none; d=google.com; s=arc-20160816; b=E/bQx6kKXs81XoVmcGJEevFArDjGeXcyzineTZdZbXiEmLiTocKSArnf7qiykh9mxT 0nYmCfumQ8bDq9vs0w6HDkObq03OtfQsrjPH/i7FzpwS4gY8u/2YFjf5BcgCLFODsGSU WREjnDvFfWunWmJ2HTCkQ3L+xHCFiDeUNufiDV9jLlkzNuDcMhD29uJ+eVCT6C33x5r+ +UHmIGgnZjxlhk9/wKOrH35eS4n4nEROYdxlUl6vP2Dnbhr85hNbo7ZpAmq59OMYEjN5 btOXTCI+rV/5h7wfX76AAOhRvHTZVsBl2WdgQA9JjB85h15lw2BO5tupMHf1hddWfqR7 oyjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=ZHNgOhbcBGIxSCKPDQlgoIy0m+9VFY0wXe/8bm4YHTE=; b=FonuNGqoBAAkmnAvDkBads+JfTkFlX84exsQodK2LbLPSsP/RrvRJwuS2QkUmUuhds kZLgWH2GG4lNmYtcPIl11ft4bpZdF2Pcpm4FPEsjXdZD0gIWn073kJe3Jfr18wUOEoDl XV4TDj4x1h7cmUwYQrwaqN29+/C+dhRE8Eub9r0oMXICeg4+YIpO1LVS9tMyqF03D+td h+NWR4IJaYBkWmqaRQDlvQVJ2xfwcxib1/W2bGUjVXgCSoRCOvJBbvsVNbjfPK9OW8b6 e/KwWJ62IhBqgULreHwQORx/XtN1Y8CzVe3i32YNraCZJa7rDbe3cbzGHH7Xh9GrW2Je OF1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CcxsuTq6; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r15si7626330pjo.90.2021.04.07.14.59.23; Wed, 07 Apr 2021 14:59:37 -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=@google.com header.s=20161025 header.b=CcxsuTq6; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355920AbhDGUHu (ORCPT + 99 others); Wed, 7 Apr 2021 16:07:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355906AbhDGUHn (ORCPT ); Wed, 7 Apr 2021 16:07:43 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E45DDC061761 for ; Wed, 7 Apr 2021 13:07:31 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id b20so8045152qvf.2 for ; Wed, 07 Apr 2021 13:07:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=ZHNgOhbcBGIxSCKPDQlgoIy0m+9VFY0wXe/8bm4YHTE=; b=CcxsuTq6nOfVVtaFysl/WbmIZWJ8Y7tCDtjLWq++bLaMadYBg0LoVCqEYtBiwN+m2Q ba7a/Mo9Aszkb2RRB/GqWUQkZRwqhLbW1W/NHYDnpP9npIYBEDMTHs1njBizSzCsiRY6 lr0W5EioZZPbZH9M9Coizz2WeSdQnLh6jM/UWF52AeVjGHneKqTrrpJQaDmTNns6cz5D yAdLMS7uaTuPYsCMZG4qUg/BvrP8p1nswRYOOy0d31CXolBdmWYeuCnE+/ERVt+oMW35 NhZTxTZZVakscfQseDwQk1e/804YAyNPK8cJYYQC8rvb/NICARUColyiHMY3qi5awBgB zrJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=ZHNgOhbcBGIxSCKPDQlgoIy0m+9VFY0wXe/8bm4YHTE=; b=BRItvRnT3TKZDl+sQ7YDXLKXietaCOKG3OD1PyXfx4LVFIXB4oeeOK74g2uc/Ki34Y t8qFQlYJhRnM2IwxyptUC14SyYaTcIesphVPw+C58jQ7l+GCwN78O4+eU501a/7NEhcb BUA1whO4A1Xf/XaWJGLMaJKs/+AC2fufuKCzX2DNFdsiKXddoy2u3AadZ2is2rYqbqdM IgYJshA1Q9Jbk/zewpJQEX0pJarBozQYvambFUR/9epjNvXndwaBkpJrvMJ3eV2L6hTF HfYh4kLq4U/RIapMZRPTuOdYp8rvh0z/EGDDDkWkegtFNNRyKhNBG7wvF/vr/2lY3DYc wINQ== X-Gm-Message-State: AOAM530cIHfzX2ZD4J5UosKPyeo4dHEtChzAeG+RsZwL47CohFoUK8uG HZUfX3dqq150Nk3UgtmgVJqYjqsHuCs= X-Received: from badhri.mtv.corp.google.com ([2620:15c:211:201:991:6d08:9e6d:683d]) (user=badhri job=sendgmr) by 2002:a05:6214:10ca:: with SMTP id r10mr5249610qvs.53.1617826051169; Wed, 07 Apr 2021 13:07:31 -0700 (PDT) Date: Wed, 7 Apr 2021 13:07:20 -0700 In-Reply-To: <20210407200723.1914388-1-badhri@google.com> Message-Id: <20210407200723.1914388-3-badhri@google.com> Mime-Version: 1.0 References: <20210407200723.1914388-1-badhri@google.com> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog Subject: [PATCH v2 3/6] usb: typec: tcpm: update power supply once partner accepts From: Badhri Jagan Sridharan To: Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman , Rob Herring , Adam Thomson Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Kyle Tso , Badhri Jagan Sridharan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org power_supply_changed needs to be called to notify clients after the partner accepts the requested values for the pps case. Also, remove the redundant power_supply_changed at the end of the tcpm_reset_port as power_supply_changed is already called right after usb_type is changed. Fixes: f2a8aa053c176 ("typec: tcpm: Represent source supply through power_supply") Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Adam Thomson --- Changes since V1: * Updated commit description to clarify Guenter Roeck's concern. * Added Reviewed-by tags --- drivers/usb/typec/tcpm/tcpm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index b4a40099d7e9..d1d03ee90d8f 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2568,6 +2568,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, port->pps_data.max_curr = port->pps_data.req_max_curr; port->req_supply_voltage = port->pps_data.req_out_volt; port->req_current_limit = port->pps_data.req_op_curr; + power_supply_changed(port->psy); tcpm_set_state(port, SNK_TRANSITION_SINK, 0); break; case SOFT_RESET_SEND: @@ -3136,7 +3137,6 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port) port->pps_data.req_out_volt)); port->pps_data.req_op_curr = min(port->pps_data.max_curr, port->pps_data.req_op_curr); - power_supply_changed(port->psy); } return src_pdo; @@ -3561,8 +3561,6 @@ static void tcpm_reset_port(struct tcpm_port *port) port->sink_cap_done = false; if (port->tcpc->enable_frs) port->tcpc->enable_frs(port->tcpc, false); - - power_supply_changed(port->psy); } static void tcpm_detach(struct tcpm_port *port) -- 2.31.1.295.g9ea45b61b8-goog