Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp293377pxf; Tue, 6 Apr 2021 22:49:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGTl9/Zs+M3ev3S0VQiAKiCUKBpdtOzQCx5F30n0ifSh+W87S9oyqy8ARmYojBFVb7Wu7X X-Received: by 2002:a05:6638:3293:: with SMTP id f19mr1877078jav.0.1617774540846; Tue, 06 Apr 2021 22:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617774540; cv=none; d=google.com; s=arc-20160816; b=yM/ebqfA5aqVph2syx1uzaJ+fQ7g3VmwtCACzcSN8kEcUge0Gmw9z+a6FDs68o8WP1 LhN8zI03+EN5EKhFB0rXu6/J3iWM3oEaSl1oF2Iek3W34wsV4NQYMzpOe/P7VSayp6x8 DtCenIuDarP9SwJD+mqoLQcdzonxOoe6VTLJfOufugpXORgwbn+41jlz9JT8XH1kLPa9 zRDLgY1fydVj7h5j1BxO1eS0lLUoF856XV+sO0ymu34jkK4jYRaTPZxNIjuSDo36Myal KilhM7VZbkurvhJ4OrQ8ChX2EDJCo6H6PeJG2EqKHpDxpS1oKug7ZF9mYU6gBDE2UCbv AgoA== 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:dkim-signature; bh=4Z7jf2TFVUJ9XDItH/5vfzmLLJH9LKeIrpVbgEOV3bI=; b=D17QoNMt40f7gqZB+we6V1uCGfQ0SOmZ/cuhZHIs2aMDF9FRL7bdaxlAvwBVvvkUi5 VRpfwxSTsG+J6xzlTDeuDd5IPV74IQ8BlaPS8NEmBmRKymlIyWpm6K9wCT/JGoI+IrrP Cqgh4Jt6eL0y/Q9tv7xlcHhvmy4/2HkjbCjeypKX1az8r0/zk1A+Txtfznexn3BYKNis Dsm+FCZZinDvH4DMd/6aBpNRsLzxi3ah3o2rWgVB31e6tjksuKnui7L4Hl1z42QkYySf wNiRKC1BpNi89f7oh765ShWWvLLSv/oG2RkOOTRm4yKIAszKjC4JRy7Fc2xbLFgVCVNi 6I0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ruMciBRy; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l11si19729425iop.53.2021.04.06.22.48.49; Tue, 06 Apr 2021 22:49:00 -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=@linuxfoundation.org header.s=korg header.b=ruMciBRy; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244380AbhDFOPD (ORCPT + 99 others); Tue, 6 Apr 2021 10:15:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:41074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244364AbhDFOO5 (ORCPT ); Tue, 6 Apr 2021 10:14:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E84A61382; Tue, 6 Apr 2021 14:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617718489; bh=INz753g/rP6LpFipcHZBYmnDy3NFV9T5EzJWjxWQUkc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ruMciBRyJxZwyxh8uc/3tSywGv/2V4c4b2rk1kxagDSHiad5LFNGJ9oqoS4jqlqZy TJSSLH1dob+YrSSlkITZk/sdzQDNYEBvmQi9aCE96Ee1HxJ0asYeOe2IBAcJkEsyvv TXVknqxlmYX51sx4I9EKshKoj93eShjsPV1l/dtk= Date: Tue, 6 Apr 2021 16:14:42 +0200 From: Greg Kroah-Hartman To: Badhri Jagan Sridharan Cc: Guenter Roeck , Heikki Krogerus , Rob Herring , Adam Thomson , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Kyle Tso Subject: Re: [PATCH v1 2/6] usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply Message-ID: References: <20210406013643.3280369-1-badhri@google.com> <20210406013643.3280369-3-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210406013643.3280369-3-badhri@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 05, 2021 at 06:36:39PM -0700, Badhri Jagan Sridharan wrote: > tcpm_pd_select_pps_apdo overwrites port->pps_data.min_volt, > port->pps_data.max_volt, port->pps_data.max_curr even before > port partner accepts the requests. This leaves incorrect values > in current_limit and supply_voltage that get exported by > "tcpm-source-psy-". Solving this problem by caching the request > values in req_min_volt, req_max_volt, req_max_curr, req_out_volt, > req_op_curr. min_volt, max_volt, max_curr gets updated once the > partner accepts the request. current_limit, supply_voltage gets updated > once local port's tcpm enters SNK_TRANSITION_SINK when the accepted > current_limit and supply_voltage is enforced. > > Fixes: f2a8aa053c176 ("typec: tcpm: Represent source supply through power_supply") > Signed-off-by: Badhri Jagan Sridharan > --- > drivers/usb/typec/tcpm/tcpm.c | 84 ++++++++++++++++++++--------------- > 1 file changed, 49 insertions(+), 35 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 03eca5061132..d43774cc2ccf 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -269,11 +269,22 @@ struct pd_mode_data { > }; > > struct pd_pps_data { > + /* Actual min voltage at the local port */ > u32 min_volt; > + /* Requested min voltage to the port partner */ > + u32 req_min_volt; > + /* Actual max voltage at the local port */ > u32 max_volt; > + /* Requested max voltage to the port partner */ > + u32 req_max_volt; > + /* Actual max current at the local port */ > u32 max_curr; > - u32 out_volt; > - u32 op_curr; > + /* Requested max current of the port partner */ > + u32 req_max_curr; > + /* Requested output voltage to the port partner */ > + u32 req_out_volt; > + /* Requested operating current to the port partner */ > + u32 req_op_curr; Shouldn't you just document this all properly in a kerneldoc header right above the structure? thanks, greg k-h