Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp672559pxb; Tue, 2 Feb 2021 15:06:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkBuDG5gW2TiucnIxuKFla0RSeqvFqv026CoQlizcfvpYkGHBHc+FhEZKx3Go8O2zFHWi6 X-Received: by 2002:a17:906:494c:: with SMTP id f12mr328568ejt.56.1612307185086; Tue, 02 Feb 2021 15:06:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612307185; cv=none; d=google.com; s=arc-20160816; b=OyxRVzy958KKTKEdivJu3dfKedlJavomWDYzfzGsZQ9qGfCQrcPh7MNAslD1n3Ymjw 5ywkZz52yEhdd31I4W8MKIZ+pn8HhA1HIxHgFp2JKkxXW0xcOof5RNDQiLkUBqPyftCT ZyxVJ3ErGXylIaeDSaXrJZXlzRhj/TZ2ieuTEWAnJYDm5x4oTz6fB55esEf/5eh0iXGd N9Rk+f18b1col205AvrNuUvqGunxm/GvFAGVDlLkow+TRf54juolOvpvlSwxcerfKwt5 OFYiSXilka5eEfUcAiMIwf4z9AG9CPpNxt1Tg9y9Q3TbIMVzedqDgHTdMrIXqTncy3sL pXYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :dkim-signature; bh=CT/F6WABXrxDgwV5W6Oavn37EbmFXivRPDSuygeRcYo=; b=a3Y/lcNPn0Z1p1jvWs8tWT9KQBOZbMg8vAabziXNUaRL3gLB17ATQ2POR/5ewLTtjR LmsLe5iUZCKGDNNshmRz4AwZbn3zB+Kf768UlAVaS0AQC6jqNkOAR074Y/4btWbOkxBo juKRD6lWV2CqoRQBbdr9Bwr3w/kJUomRf7JYlXCVYVlSNXLdyjWxEW8sFIsNEvhtQmRX d76GX4t8HnlTDpz18cmIJum0qRnckyQEMn7wN7C0773SEandUosqfgs1G6vnlHDmj9/m fjVGbO6jxgHUkXCg/nVGfCuPaWhArYMNtRH7gcR4cvxUUfwWgADhEXYNDjL00xw8014p KI2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Jqr3Tyeh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ia25si165573ejc.464.2021.02.02.15.05.59; Tue, 02 Feb 2021 15:06:25 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Jqr3Tyeh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236139AbhBBQ2A (ORCPT + 99 others); Tue, 2 Feb 2021 11:28:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236265AbhBBQ0P (ORCPT ); Tue, 2 Feb 2021 11:26:15 -0500 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8BD1C061788; Tue, 2 Feb 2021 08:25:34 -0800 (PST) Received: by mail-oi1-x22d.google.com with SMTP id x71so23307964oia.9; Tue, 02 Feb 2021 08:25:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CT/F6WABXrxDgwV5W6Oavn37EbmFXivRPDSuygeRcYo=; b=Jqr3TyehlYeYFOH638c81n13OpL/1Z4W04SInHnw0pBrZZSOUsme+UqsLkoqBHQf4O jMVSkQ3DePWozCD24BNp/HNtuB5fw7h1EhCZJ8FMXhK7arEtwOJFKWNKOMkRar5MEecw VGYeqzgXxkGgQu4k9sHmoBKViMCg7EPdkiUAng3ONNlaQFiZ3Hl7LWyNPjZX9TqzvE5I KuocjQ4um1efOU/naDd03+Sb5nH5A1O9ZxjU8Q112k+6mwj98Vld5wGtR82NcedMUX5j vUyGSPxpo4hAChMUy9SuP3uFZSuCyl+u7aEPHKea92u4v07yhF8W5aIthaMBq6PguikF paVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=CT/F6WABXrxDgwV5W6Oavn37EbmFXivRPDSuygeRcYo=; b=fpCwAsL8U/JE3yboaKEoQ0LNcWebqlzJppSxAZi6lfWbG5qcX5kaYViZNRZAXYUn3U nzoClFWtHx/tIc+v5RwmyI6u3OCRWO4pjPgH9Epn4h5yhloQmA4EAp7jCF39ReEQJWDH QAQiXcXTgtS3iDpzTq7OZ8F5fmXqpclOGWen3hr/P6JH69QwzEwVhlysUKX3zGInhHYx PDvRkl9QSZg8Dl7eB0l4bhI5/69ZnUNYxagsyrFneDr/YgfFM9H3d15wwBlLNz9Mt4yJ 5l6o2RT2QA3VGrsosF2q8NOsVIN7y7Jt+yZ7SQ2vgYt5Nau34iILmSnyAbHZAz7fxX4m G54A== X-Gm-Message-State: AOAM533FuIseEa3a7D+Jk8yb5umZG7fGORbEAF/kSPX93Nubrl2dlNDB LwK2POvpEMW9qnzuL3G8kwA= X-Received: by 2002:aca:4a15:: with SMTP id x21mr3280962oia.116.1612283134386; Tue, 02 Feb 2021 08:25:34 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id p22sm4629012oth.38.2021.02.02.08.25.33 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Feb 2021 08:25:33 -0800 (PST) Sender: Guenter Roeck Date: Tue, 2 Feb 2021 08:25:32 -0800 From: Guenter Roeck To: Badhri Jagan Sridharan Cc: Heikki Krogerus , Greg Kroah-Hartman , Kyle Tso , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] usb: typec: tcpci_maxim: Enable data path when partner is USB Comm capable Message-ID: <20210202162532.GC159455@roeck-us.net> References: <20210202003101.221145-1-badhri@google.com> <20210202003101.221145-3-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210202003101.221145-3-badhri@google.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2021 at 04:31:01PM -0800, Badhri Jagan Sridharan wrote: > Configure USB switches when partner is USB Communication capable. > The is enabled USB data communication over D+/D- pins. > > Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Guenter Roeck > --- > drivers/usb/typec/tcpm/tcpci_maxim.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/usb/typec/tcpm/tcpci_maxim.c b/drivers/usb/typec/tcpm/tcpci_maxim.c > index f1674a611033..041a1c393594 100644 > --- a/drivers/usb/typec/tcpm/tcpci_maxim.c > +++ b/drivers/usb/typec/tcpm/tcpci_maxim.c > @@ -19,6 +19,9 @@ > #define PD_ACTIVITY_TIMEOUT_MS 10000 > > #define TCPC_VENDOR_ALERT 0x80 > +#define TCPC_VENDOR_USBSW_CTRL 0x93 > +#define TCPC_VENDOR_USBSW_CTRL_ENABLE_USB_DATA 0x9 > +#define TCPC_VENDOR_USBSW_CTRL_DISABLE_USB_DATA 0 > > #define TCPC_RECEIVE_BUFFER_COUNT_OFFSET 0 > #define TCPC_RECEIVE_BUFFER_FRAME_TYPE_OFFSET 1 > @@ -274,6 +277,21 @@ static void process_tx(struct max_tcpci_chip *chip, u16 status) > max_tcpci_init_regs(chip); > } > > +/* Enable USB switches when partner is USB communications capable */ > +static void max_tcpci_set_partner_usb_comm_capable(struct tcpci *tcpci, struct tcpci_data *data, > + bool capable) > +{ > + struct max_tcpci_chip *chip = tdata_to_max_tcpci(data); > + int ret; > + > + ret = max_tcpci_write8(chip, TCPC_VENDOR_USBSW_CTRL, capable ? > + TCPC_VENDOR_USBSW_CTRL_ENABLE_USB_DATA : > + TCPC_VENDOR_USBSW_CTRL_DISABLE_USB_DATA); > + > + if (ret < 0) > + dev_err(chip->dev, "Failed to enable USB switches"); > +} > + > static irqreturn_t _max_tcpci_irq(struct max_tcpci_chip *chip, u16 status) > { > u16 mask; > @@ -453,6 +471,7 @@ static int max_tcpci_probe(struct i2c_client *client, const struct i2c_device_id > chip->data.frs_sourcing_vbus = max_tcpci_frs_sourcing_vbus; > chip->data.auto_discharge_disconnect = true; > chip->data.vbus_vsafe0v = true; > + chip->data.set_partner_usb_comm_capable = max_tcpci_set_partner_usb_comm_capable; > > max_tcpci_init_regs(chip); > chip->tcpci = tcpci_register_port(chip->dev, &chip->data); > -- > 2.30.0.365.g02bc693789-goog >