Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp156269rwb; Thu, 18 Aug 2022 01:07:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR4XzWWk0Zf8SDu1a4f/HyOeICWI9ADUeDm6E5U0GqREOWX1WpDno4bvTEm5brl6T190IHdm X-Received: by 2002:a17:902:b581:b0:172:a34e:18fd with SMTP id a1-20020a170902b58100b00172a34e18fdmr1867014pls.163.1660810079470; Thu, 18 Aug 2022 01:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660810079; cv=none; d=google.com; s=arc-20160816; b=qQ+X0C9nDYzAVITDRyfW5xn2jIfvWwyv2CCgJd5jCVAObPhcAty7tzRWp5+AssVBlh 6znAEsTWSv72tMIRGwevqX66iD0BqHo39irlbG1tof+6KliyuvXUqG2CqA/UumWW1u44 yJnwEp6SFNsVVzrUnpDguzP/Fbmt38ttlsZUeW68aMabHdWxrD1DT16gx0XoQrdQaaRo 8kViGRAchNU5AOOObVH1S7bO+lzfTDKL9qsJ7hGppRgr8oUeV3zzYLuw2FqIg9UBGQRg rX0k+vwUlBxONL45d8ytIhueusnBaCmBpMRKnNKO4486zF6CB6BVuui5nAIVoiQr61Dz qXnQ== 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=0+x0nieTkTS2MrBQozJBTIAsC9RkWJd+YqXVISpxbq8=; b=VwAz3jvfyZ03kPFv/ihZl0f94Tkbplc7rje0GZwfeMj3hwzvyK9GFSjDyxBpaNHx/X BGBG1pL0m5pvJGDKR502XLr7fnz2g89XzSEOZ9d+ALSH7ASEMcBaIv2NHZnY0krK3qT0 9ft7NYs0a3IuE1z9UKWmZ4UUM6trKmGzSqrHJMBs4NGJ1roN//4GfBVhfbIh8xzskp3b jmG3GeOpADLOGCClkdoqcLGjYjQQaHDkKs4ntXO57uxpWHn8dj0G/1RazwLSqPi98L0F AO+3iUJN+CAQ2mOKpuddv44SpIuxPwNH90WVbBS2QKF2GNfQBlQB4vkM9y98C1QOo0wl yX0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g5eQIHXj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a63310a000000b0041bc196f495si864254pgx.131.2022.08.18.01.07.48; Thu, 18 Aug 2022 01:07:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g5eQIHXj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243995AbiHRIA6 (ORCPT + 99 others); Thu, 18 Aug 2022 04:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243928AbiHRIA5 (ORCPT ); Thu, 18 Aug 2022 04:00:57 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB23BAEDA7; Thu, 18 Aug 2022 01:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660809656; x=1692345656; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=eAy8aSdTk5OKQzWybqKrFUdpqxDntwotIfbfSmRhmTA=; b=g5eQIHXjIB9t2q0ujnBvPrbIkft1sS5QTKuqQowNKbHzZ2jdd/mvn0i8 g66pwiRsU4n4KgRGxyU+UlUAMxUt0X4vR1OAg6VR0lYfKYqWBNyHJa6B1 LAIM9Qfa2wggmTiYL5okJzYkYcNw4isRk4i0v9Q0peBBjjMvhiZskRiS8 6QQ/fu3bQzbt1eZacX0teZvq3x4lIscdbJDePBP0RM7diSTUV5v8RvSyj ov16n9F93IwtVnyv8Uq70YiXBo6UU+uPiqGsaQErR2KlMrkdoAmLkHZz7 yNVfAKDe/vOdKT+RkJW+hYv0zz6XJ+1b58NTAstuK3ctAhpZJofsgQJQU w==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="292692798" X-IronPort-AV: E=Sophos;i="5.93,245,1654585200"; d="scan'208";a="292692798" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 01:00:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,245,1654585200"; d="scan'208";a="750014755" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 18 Aug 2022 01:00:40 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 18 Aug 2022 11:00:40 +0300 Date: Thu, 18 Aug 2022 11:00:40 +0300 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kyle Tso , stable@vger.kernel.org Subject: Re: [PATCH v3] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes Message-ID: References: <20220817215410.1807477-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220817215410.1807477-1-badhri@google.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 17, 2022 at 02:54:10PM -0700, Badhri Jagan Sridharan wrote: > When the port does not support USB PD, prevent transition to PD > only states when power supply property is written. In this case, > TCPM transitions to SNK_NEGOTIATE_CAPABILITIES > which should not be the case given that the port is not pd_capable. > > [ 84.308251] state change SNK_READY -> SNK_NEGOTIATE_CAPABILITIES [rev3 NONE_AMS] > [ 84.308335] Setting usb_comm capable false > [ 84.323367] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:5000 ret:0 > [ 84.323376] state change SNK_NEGOTIATE_CAPABILITIES -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS] > > Fixes: e9e6e164ed8f6 ("usb: typec: tcpm: Support non-PD mode") > Cc: stable@vger.kernel.org > Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Heikki Krogerus > --- > Changes since v1: > - Add Fixes tag. > Changes since v2: > - CCed stable > --- > drivers/usb/typec/tcpm/tcpm.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index ea5a917c51b1..904c7b4ce2f0 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -6320,6 +6320,13 @@ static int tcpm_psy_set_prop(struct power_supply *psy, > struct tcpm_port *port = power_supply_get_drvdata(psy); > int ret; > > + /* > + * All the properties below are related to USB PD. The check needs to be > + * property specific when a non-pd related property is added. > + */ > + if (!port->pd_supported) > + return -EOPNOTSUPP; > + > switch (psp) { > case POWER_SUPPLY_PROP_ONLINE: > ret = tcpm_psy_set_online(port, val); > -- > 2.37.1.595.g718a3a8f04-goog -- heikki