Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3860600pxb; Mon, 1 Feb 2021 06:35:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoAitxMar1ooA7fZ6Ba0zfxbuOChwEHEbLOJbz36x/OJWVcM/y7wqUo5UXlneSzZS2dOAJ X-Received: by 2002:aa7:d58b:: with SMTP id r11mr1267371edq.241.1612190141388; Mon, 01 Feb 2021 06:35:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612190141; cv=none; d=google.com; s=arc-20160816; b=YB6QCFIigEaqeTBSvocJfFZseB2PWuALoOe44YKwTYNbkZffR8zpa61G1vDjT1d8BL 4/5daJ2F25sveyRXdI3t2DjjmusCaKtfFyGKLEHTQmXtpQcpPVMzhMV+i4R+h4Syb8tZ WjGjf6ypDVllt0/nzgmoPeStuiIqVSXNPPYGjT2SpcfQolaHRzbXDlnobQMP5tNCSPAn nNXB8NbBd9ji91ikybhbfOCxdltrDmrX3H/bNLKVB3LOcl2g5rjJPq4ESbpOxVPxg2To JVOw73DvTvyfJDcAG49P9HZNTUO5KHc/wSFrz5AHOJtgiiuF2SfRWe3iSIInP1ALBsyE Dy1A== 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=JvFI9ges6UmLdL4+PstNhUEM25jmOjHMJD6ue+rVmi0=; b=d9a5yeBXv8OQCMiKw/ZYXyZthVNH7dnGuEWk5IjMjc+9n1RMKIvHwzDP/Th4kJILPI 6x5FUifsIq9eXC0MLEZy1n1ZmsUxE5xlnQjCvRUDI1vqVzSwxvZ0UYCJQKmHw27tAX5t +1VUBRDGF8mN9C0etk8FCvfR4NSHNDuSJDt5IVF/k4t0Fb7Ql5hZZ5/ZdVT+gdq4bZBz P/QL2weJMuzDyrpG0W70wnMkkV6enO2rZti8UL7D/1c9LU2mQFt1UuadSiYh7UdWv4hY NTPutxfhHYnYD2ivgqkst50jzns/UNc1Rk8zucFsyA6kKlOAf92ll/5tv/ZSZPEyiRLw joiQ== 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 l22si11064889edr.554.2021.02.01.06.35.15; Mon, 01 Feb 2021 06:35:41 -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 S230151AbhBAOeP (ORCPT + 99 others); Mon, 1 Feb 2021 09:34:15 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:33770 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbhBAOeC (ORCPT ); Mon, 1 Feb 2021 09:34:02 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 142191F445F9 Subject: Re: [PATCH 4/6] platform/chrome: cros_ec_typec: Report SOP' 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-5-bleung@chromium.org> From: Enric Balletbo i Serra Message-ID: <5459ad99-ce1b-5ce5-baba-a9658f7a6dd6@collabora.com> Date: Mon, 1 Feb 2021 15:33:14 +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-5-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: > cros_typec_handle_sop_prime_disc now takes the PD revision provided > by the EC_CMD_TYPEC_STATUS command response for the SOP'. > > Attach the properly formatted pd_revision to the cable desc before > registering the cable. > > Signed-off-by: Benson Leung Acked-by: Enric Balletbo i Serra > --- > drivers/platform/chrome/cros_ec_typec.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c > index e724a5eaef1c..30600e9454e1 100644 > --- a/drivers/platform/chrome/cros_ec_typec.c > +++ b/drivers/platform/chrome/cros_ec_typec.c > @@ -748,7 +748,7 @@ static void cros_typec_parse_pd_identity(struct usb_pd_identity *id, > id->vdo[i - 3] = disc->discovery_vdo[i]; > } > > -static int cros_typec_handle_sop_prime_disc(struct cros_typec_data *typec, int port_num) > +static int cros_typec_handle_sop_prime_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 *disc = port->disc_data; > @@ -794,6 +794,7 @@ static int cros_typec_handle_sop_prime_disc(struct cros_typec_data *typec, int p > } > > c_desc.identity = &port->c_identity; > + c_desc.pd_revision = pd_revision; > > port->cable = typec_register_cable(port->port, &c_desc); > if (IS_ERR(port->cable)) { > @@ -893,7 +894,11 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num > > if (resp.events & PD_STATUS_EVENT_SOP_PRIME_DISC_DONE && > !typec->ports[port_num]->sop_prime_disc_done) { > - ret = cros_typec_handle_sop_prime_disc(typec, port_num); > + u16 sop_prime_revision; > + > + /* Convert BCD to the format preferred by the TypeC framework */ > + sop_prime_revision = (le16_to_cpu(resp.sop_prime_revision) & 0xff00) >> 4; > + ret = cros_typec_handle_sop_prime_disc(typec, port_num, sop_prime_revision); > if (ret < 0) > dev_err(typec->dev, "Couldn't parse SOP' Disc data, port: %d\n", port_num); > else >