Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3861482pxb; Mon, 1 Feb 2021 06:36:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHrGPC6k09Ldhxm7TMN5dSYi8rD0UUTFlBoQwxzp3uUxzxMOZTfjT1jOw/D6HQQW3VI9cs X-Received: by 2002:a50:e8c1:: with SMTP id l1mr18980680edn.168.1612190209655; Mon, 01 Feb 2021 06:36:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612190209; cv=none; d=google.com; s=arc-20160816; b=roK+BUsdH/EZBGkoFKgGAcNuOoLkwChQDvqbqcJzR4/WECTBGMHAOWk0wU76vJGuT8 WZ4rpvTT3hDKdNwewDoWqKZ1Qg/X9gNNDDXFMU6I/rTThfHvqswdyp+YYDMBvYlBA7Ew cMq67UL13cMaMY24DOtUCezZi377jwRV3y64yoYLJBRmEfVeb5NWUjtObmTpTzp5KYGc Hh5n1RLCF1y+pOn8MkxppiUXB4tdWAnWoDRfpplnlqTpVWxKAza8qi2dONd0ICOqqqkA PXkf2pcpuy0Pgpb4asMUlSBbQS3eQiookBSBVXCMM/JeouU9m4Oavyb3qjI0/YFZGnhp 5B7w== 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:from:references :cc:to:subject; bh=kYh9kUkhQdiiEwdTrr9y3kw/F2d9yRTBfS2as15pF3A=; b=eKwXkPUFSWh71Pwzq/ORW2hZa5qVvx4ZKFSSDKTQ7IIkKmx+GIbN41/Pa1LA4kqRvX 5we7gH8gXGrVrrkptL2UHgRAwLHZ7UgkfquUHzsOQCJJkGFoE26zdVnkcU/5lwPd3mGp +MjzQOxYl6/l6e0z2+FwvLfDb0O2SDw4ditcpshqssM346+7WAR6i5l0QhZM2XD6XrSx h2ghiUyk+2vRyhzXZ2VdQaHNwOhELCHFlfn3t1+uJD38CfZePGVSkHv+S74SOaICXFu5 YeT5f2N7Zr+DCQrLNO7pPyOMyHZnRWXyv1cr1ZImGQQ8oEeo3YvT1Z/pKEqxU5jQjLYp 7Sdw== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si4248958eds.525.2021.02.01.06.36.24; Mon, 01 Feb 2021 06:36:49 -0800 (PST) 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbhBAOev (ORCPT + 99 others); Mon, 1 Feb 2021 09:34:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230214AbhBAOeR (ORCPT ); Mon, 1 Feb 2021 09:34:17 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2943FC06174A; Mon, 1 Feb 2021 06:33:37 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id CCF071F44612 Subject: Re: [PATCH 5/6] platform/chrome: cros_ec_typec: Set Partner PD revision from status To: Benson Leung , heikki.krogerus@linux.intel.com, pmalani@chromium.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: groeck@chromium.org, bleung@google.com References: <20210129061406.2680146-1-bleung@chromium.org> <20210129061406.2680146-6-bleung@chromium.org> From: Enric Balletbo i Serra Message-ID: <6f33af27-2ede-462a-1683-f97137a40a0f@collabora.com> Date: Mon, 1 Feb 2021 15:33:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210129061406.2680146-6-bleung@chromium.org> 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 Hi Benson, On 29/1/21 7:14, Benson Leung wrote: > Status provides sop_revision. Process it, and set it using the new > setter in the typec class. > > Signed-off-by: Benson Leung Acked-by: Enric Balletbo i Serra > --- > drivers/platform/chrome/cros_ec_typec.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c > index 30600e9454e1..6bc6fafd54a4 100644 > --- a/drivers/platform/chrome/cros_ec_typec.c > +++ b/drivers/platform/chrome/cros_ec_typec.c > @@ -824,7 +824,7 @@ static int cros_typec_handle_sop_prime_disc(struct cros_typec_data *typec, int p > return ret; > } > > -static int cros_typec_handle_sop_disc(struct cros_typec_data *typec, int port_num) > +static int cros_typec_handle_sop_disc(struct cros_typec_data *typec, int port_num, u16 pd_revision) > { > struct cros_typec_port *port = typec->ports[port_num]; > struct ec_response_typec_discovery *sop_disc = port->disc_data; > @@ -842,6 +842,12 @@ static int cros_typec_handle_sop_disc(struct cros_typec_data *typec, int port_nu > goto disc_exit; > } > > + ret = typec_partner_set_pd_revision(port->partner, pd_revision); > + if (ret < 0) { > + dev_err(typec->dev, "Failed to update partner PD revision, port: %d\n", port_num); > + goto disc_exit; > + } > + > memset(sop_disc, 0, EC_PROTO2_MAX_RESPONSE_SIZE); > ret = cros_typec_ec_command(typec, 0, EC_CMD_TYPEC_DISCOVERY, &req, sizeof(req), > sop_disc, EC_PROTO2_MAX_RESPONSE_SIZE); > @@ -885,7 +891,11 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num > > /* Handle any events appropriately. */ > if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE && !typec->ports[port_num]->sop_disc_done) { > - ret = cros_typec_handle_sop_disc(typec, port_num); > + u16 sop_revision; > + > + /* Convert BCD to the format preferred by the TypeC framework */ > + sop_revision = (le16_to_cpu(resp.sop_revision) & 0xff00) >> 4; > + ret = cros_typec_handle_sop_disc(typec, port_num, sop_revision); > if (ret < 0) > dev_err(typec->dev, "Couldn't parse SOP Disc data, port: %d\n", port_num); > else >