Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3890499pxb; Mon, 1 Feb 2021 07:16:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSLjSOp5eKyl5f24jTtiQbPHhQ9lAgZ9VoCfnfO4iT9XS26V6l/ADHQhD0zWfPHS+NOihu X-Received: by 2002:a17:906:aed1:: with SMTP id me17mr8873845ejb.190.1612192594141; Mon, 01 Feb 2021 07:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612192594; cv=none; d=google.com; s=arc-20160816; b=XSuw/OPSTkNn+tXbTPFXUzIelWWfdzbjycz/s3dLRZ4FNpnYN/572NfC01IzRwGNyn L8VowStjIw/oblcSv2td7nPKAfU8elWSw7eLFhW9ay+AmngZOAIa9lm6JgxqppC0442Q ADUJslDr0mjq9+WihjrLjJduP1ryj3o74UoNaH3h7vX3RSv0v9HwtnUVIdOIR0UmxjwJ N9ChKnefKCSLQ4NCO67JtxTcxCuwWvQWQndPyPXEbF+tlWXDV8bdJtUIDX/AEOExWh+b TYmDk+ueK+qjMPwuGq/GIcGcA6NpkBoq7zNKNYhWXksRHamqVTvg89K6SilU+oyHoMJg aX0g== 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:ironport-sdr :ironport-sdr; bh=D/Pf/8K99y8+tqR/45zFZe22nHmcGCGeX2yaf5upHNI=; b=QgMjzEuZHemIJ7v9domlHfHFOQ7JxDrZ30bfhCioelP3TK9qpueWcmiNqBUxg0vgJr EfhTS+o3oFd8ghYYc3hUj2cwB7lLaeM2X4GKDIRluyE/O8zeSOaKr3430jNQ50wU8mw8 rM8VPPTHODtoHGKA8GltQULr8MR6heBrYVRi1briUtcKqASUG8g271QpdSZZZZ4Bm4EX yt4MwKmAQ1QQsLXWSEulJXPvgA9Ihfzl3Rcs7f4PJKF+pDGmpkXf7bTssHIvDF1pZTlQ mOmeaHpctsv/mag1Go+TxgWeDzPJQ/R0DEWh4FFkw0BKOqZUL0K2Rki9NSs1Vvjtt7Ph meHQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds7si12326274ejc.212.2021.02.01.07.16.07; Mon, 01 Feb 2021 07:16:34 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231444AbhBAPOu (ORCPT + 99 others); Mon, 1 Feb 2021 10:14:50 -0500 Received: from mga06.intel.com ([134.134.136.31]:34708 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231352AbhBAPOY (ORCPT ); Mon, 1 Feb 2021 10:14:24 -0500 IronPort-SDR: 5OB1Fo6nzCIco4h+WZJHiky4fniavJSErHtoFoLx1yLjdr+Gt2fi+ItPGJQXOparRmetKfwzDc cqRH31nlFKIQ== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="242216663" X-IronPort-AV: E=Sophos;i="5.79,392,1602572400"; d="scan'208";a="242216663" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 07:12:57 -0800 IronPort-SDR: D8Eo3K9uxGsdx7eRPyVaS59lfnItmzj9PJFRof3MD+QghKIFhc3DNFD4WYDPepGd4gq6d2qtE0 0VoPYxIVV80w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,392,1602572400"; d="scan'208";a="479113880" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 01 Feb 2021 07:12:54 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 01 Feb 2021 17:12:53 +0200 Date: Mon, 1 Feb 2021 17:12:53 +0200 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , Kyle Tso , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/3] usb: typec: tcpm: Add Callback to Usb Communication capable partner Message-ID: <20210201151253.GG2465@kuha.fi.intel.com> References: <20210201095309.39486-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210201095309.39486-1-badhri@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2021 at 01:53:07AM -0800, Badhri Jagan Sridharan wrote: > The USB Communications Capable bit indicates if port > partner is capable of communication over the USB data lines > (e.g. D+/- or SS Tx/Rx). Notify the status of the bit to low > level drivers to perform chip specific operation. > For instance, low level driver enables USB switches on D+/D- > lines to set up data path when the bit is set. > > Refactored from patch initially authored by > Kyle Tso > > Signed-off-by: Badhri Jagan Sridharan > --- > drivers/usb/typec/tcpm/tcpm.c | 16 ++++++++++++++++ > include/linux/usb/tcpm.h | 5 +++++ > 2 files changed, 21 insertions(+) ... > diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h > index 3af99f85e8b9..42fcfbe10590 100644 > --- a/include/linux/usb/tcpm.h > +++ b/include/linux/usb/tcpm.h > @@ -108,6 +108,10 @@ enum tcpm_transmit_type { > * is supported by TCPC, set this callback for TCPM to query > * whether vbus is at VSAFE0V when needed. > * Returns true when vbus is at VSAFE0V, false otherwise. > + * @set_partner_usb_comm_capable: > + * Optional; The USB Communications Capable bit indicates if port > + * partner is capable of communication over the USB data lines > + * (e.g. D+/- or SS Tx/Rx). Called to notify the status of the bit. > */ > struct tcpc_dev { > struct fwnode_handle *fwnode; > @@ -139,6 +143,7 @@ struct tcpc_dev { > int (*set_auto_vbus_discharge_threshold)(struct tcpc_dev *dev, enum typec_pwr_opmode mode, > bool pps_active, u32 requested_vbus_voltage); > bool (*is_vbus_vsafe0v)(struct tcpc_dev *dev); > + void (*set_partner_usb_comm_capable)(struct tcpc_dev *dev, bool enable); > }; > > struct tcpm_port; There start to be a lot of callback there, separate for each function. And I guess flags too... Would it be possible to have a single notification callback instead, that would take the type of the notification as a parameter (we could have an enum for those), and then the specific object(s) for each type as another paramter (RDO I guess in this case)? It would then be up to the TCPC driver to extract the detail it needs from that object. That would somehow feel more cleaner to me, but what do you guys think? thanks, -- heikki