From patchwork Wed May 12 14:46:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 437236 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F10C5C433B4 for ; Wed, 12 May 2021 14:53:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0CBC6141C for ; Wed, 12 May 2021 14:53:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbhELOyM (ORCPT ); Wed, 12 May 2021 10:54:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:42678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231548AbhELOyG (ORCPT ); Wed, 12 May 2021 10:54:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E377761413; Wed, 12 May 2021 14:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620831177; bh=QZYQjn8aRKO6mZugu3Ig5Q1DRO+YkRJUYh3x6BZ7obo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x3dT9J55DqaPFc5BHHco5/IdXypAHWgvRY72Fr/25AEIB3VbDGZpxU2WqX0gyfMcv I5EWIz4HPmsmoqMPJ6d8FY5YfI7cWc4IV2T4yARWHq1w+Bz/EQyqmfGKLPRRataWU5 QH7Io9fRt+J6TV+IDKg8wSvZsn5FfF382Q50zGKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Badhri Jagan Sridharan , Adam Thomson , Heikki Krogerus Subject: [PATCH 5.4 016/244] usb: typec: tcpm: update power supply once partner accepts Date: Wed, 12 May 2021 16:46:27 +0200 Message-Id: <20210512144743.562049448@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144743.039977287@linuxfoundation.org> References: <20210512144743.039977287@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Badhri Jagan Sridharan commit 4050f2683f2c3151dc3dd1501ac88c57caf810ff upstream. 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 Cc: stable Reviewed-by: Adam Thomson Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20210407200723.1914388-3-badhri@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -1820,6 +1820,7 @@ static void tcpm_pd_ctrl_request(struct 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: @@ -2343,7 +2344,6 @@ static unsigned int tcpm_pd_select_pps_a 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; @@ -2743,8 +2743,6 @@ static void tcpm_reset_port(struct tcpm_ port->try_src_count = 0; port->try_snk_count = 0; port->usb_type = POWER_SUPPLY_USB_TYPE_C; - - power_supply_changed(port->psy); } static void tcpm_detach(struct tcpm_port *port)