From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AD8F482EB for ; Thu, 19 Dec 2024 01:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734571446; cv=none; b=WsE0VP0hgXFYhSUXbUMwP7zuAtVPqfVQh0liH0xLTsBb7yJifE9RtKkHP+olekJC0s5ka9I9TXMbRi50Vbv5F3Mduo3vTNqHDm5CZWbq91DNKxxdqp5yg4O1ySENVynLu0K95nvrw/znO3XGQ1jSes4jyi/mafWUNqMuT73/pXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734571446; c=relaxed/simple; bh=C6XyGEl+4JGQUnuKfD9opbycijz+c9g9Y8SrwNryp70=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=U0jACBEFZorkI4YgJnKzp14W7UlLo6AJMEpUTQJpTketbhORmEprp/cveByPN5BOagG4zOfyLm4B5Tk8L7u45XET3uki22Wj+dDuvRq4ASFre6pi/N31PFNSl6oSAFvMXzZlZ3UGY4oOOtvFPTAYzgROJ+VR8riTxL3eudttSCk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Mc3dWcD6; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Mc3dWcD6" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-7f71f2b1370so103522a12.1 for ; Wed, 18 Dec 2024 17:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1734571444; x=1735176244; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QeqA1W7HgN/1BEGMNZZ5O+/9wdsSo7XuIwN5RQ+xvQY=; b=Mc3dWcD69/geq2SX00m2jziMuLEYkd5WrVAxMfFMXsQLIkEFXPqSjuwAvwQ8ilZL5g iqPyS65VvHrwBzUR5TScCXpK8OGBiBL2nEsXLb0xFPer3abRpx1uMo2cxHCjGAvmgLIE A5NCGpZEdREFbzYmt4cK6uojYenA+rc9Nswd1Apz/1UqQqJW/fQ2VFdJ+oO9n55Afqik ly7PF2dn/l/MdtqgQhJKjGDCYRGj8xmda3wKaRQUEXkmVrFYojn10vo1moqS3rJTkbKE UXce8ojM4mFLAffpJ7Jjdzz9DTcZ31cUN058z/9WcFxDDsFCRcIsESpILQVuAhFEcYVd vvCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734571444; x=1735176244; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QeqA1W7HgN/1BEGMNZZ5O+/9wdsSo7XuIwN5RQ+xvQY=; b=YhcVT61DUYls6Ne3nSIb8nQjwQU8F+ir08Yymixlj+aLUpohx+RRiE+Dm+8Mds+w1G GC8OalaeEugDYNoBfXpTAakLM4QXI7Bs0XtzMRMKia1WP5Y2R30b81/flKwS1N5NhkaB UWVTJ+quryjDTwZzYJP8X/KNb5a3z7ZletKj1uyci7TMaGONT7wCnlcN9MbkoY8MKZC8 kayS1BBUnFaDGkQeJqidCJ/z4y8pB7piMdzXXV/n2NFJIQQnQLdN4hQamMMg2LAhU8IP P+xHDtRC641VP9J0xebu4SO6fplyYHyIR+ECQuWrH6ftPrHdJ5kPlIyJ3Gx5i29SNpiB hlLg== X-Forwarded-Encrypted: i=1; AJvYcCVEiXWx7h0y7it9/QodBLT/3qDlN2Q6fRaWNqAoprjdpWFfyeE7asFj7/cm41pDn9ibbNKqsHcONsx6bUA=@vger.kernel.org X-Gm-Message-State: AOJu0YzSQ8EnxqRTAOsY+GshLWhjMdZq2JftWfvv4Ow59qM+pHKgUtl9 5NlQhETE2C5Oxn04Rjggtu8iz72F30R9ou9HLNfp5BXKssQIdwmSKCiqDU2A1w== X-Gm-Gg: ASbGncuK7LNHB3a/nJUFSE+THFztMQwHymveAb+mJYhAEAZRL7SEdwrxp1uf7zBXk0r JZBGVC1r0teZ7HhHcDfMGrptakInX1oQJKnyxG8ePLV/0CGGeleJUe7WBSoPQC1MWiYlEeqkLum vW/oQm9Bn0hJbFp3kuaOhPH8gT1b9Kc9SNyyxp1QPdNWZTEgkLlZWbbH66kr0A/xugKxE8YJ3Ip ivLEcKFRGG/QV2Jq1VmdKA/tRkd4EoS+g1uKn0jl6cnEhO4WIQ2FMHOOEA/bIcUubeB3fPoM7xL QFtlazMK/ZId7hHi X-Google-Smtp-Source: AGHT+IGLsnsDna2mnXoogFYmcXNYx7Aw7CMzWVyI52xBFBmbW0omcnochVS+D1fp/HqWS1IUPexG4A== X-Received: by 2002:a17:90a:c884:b0:2ee:d824:b559 with SMTP id 98e67ed59e1d1-2f2e938a64fmr6291306a91.28.1734571443962; Wed, 18 Dec 2024 17:24:03 -0800 (PST) Received: from google.com (30.176.125.34.bc.googleusercontent.com. [34.125.176.30]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2db9939b5sm3149919a91.1.2024.12.18.17.24.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 17:24:02 -0800 (PST) Date: Thu, 19 Dec 2024 01:23:58 +0000 From: Benson Leung To: Abhishek Pandit-Subedi Cc: heikki.krogerus@linux.intel.com, tzungbi@kernel.org, linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev, akuchynski@google.com, sboyd@kernel.org, pmalani@chromium.org, badhri@google.com, rdbabiera@google.com, dmitry.baryshkov@linaro.org, jthies@google.com, Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 3/8] usb: typec: Make active on port altmode writable Message-ID: References: <20241213233552.451927-1-abhishekpandit@chromium.org> <20241213153543.v5.3.I794566684ab2965e209f326b08232006eff333f8@changeid> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uitaZZ4HI1y6kP8G" Content-Disposition: inline In-Reply-To: <20241213153543.v5.3.I794566684ab2965e209f326b08232006eff333f8@changeid> --uitaZZ4HI1y6kP8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 13, 2024 at 03:35:44PM -0800, Abhishek Pandit-Subedi wrote: > The active property of port altmode should be writable (to prevent or > allow partner altmodes from entering) and needs to be part of > typec_altmode_desc so we can initialize the port to an inactive state if > desired. >=20 > Signed-off-by: Abhishek Pandit-Subedi Reviewed-by: Benson Leung > --- >=20 > Changes in v5: > - Extract port altmode ".active" changes to its own patch >=20 > drivers/usb/typec/class.c | 5 +++-- > include/linux/usb/typec.h | 2 ++ > 2 files changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c > index febe453b96be..b5e67a57762c 100644 > --- a/drivers/usb/typec/class.c > +++ b/drivers/usb/typec/class.c > @@ -458,7 +458,8 @@ static umode_t typec_altmode_attr_is_visible(struct k= object *kobj, > struct typec_altmode *adev =3D to_typec_altmode(kobj_to_dev(kobj)); > =20 > if (attr =3D=3D &dev_attr_active.attr) > - if (!adev->ops || !adev->ops->activate) > + if (!is_typec_port(adev->dev.parent) && > + (!adev->ops || !adev->ops->activate)) > return 0444; > =20 > return attr->mode; > @@ -563,7 +564,7 @@ typec_register_altmode(struct device *parent, > =20 > if (is_port) { > alt->attrs[3] =3D &dev_attr_supported_roles.attr; > - alt->adev.active =3D true; /* Enabled by default */ > + alt->adev.active =3D !desc->inactive; /* Enabled by default */ > } > =20 > sprintf(alt->group_name, "mode%d", desc->mode); > diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h > index d616b8807000..252af3f77039 100644 > --- a/include/linux/usb/typec.h > +++ b/include/linux/usb/typec.h > @@ -140,6 +140,7 @@ int typec_cable_set_identity(struct typec_cable *cabl= e); > * @mode: Index of the Mode > * @vdo: VDO returned by Discover Modes USB PD command > * @roles: Only for ports. DRP if the mode is available in both roles > + * @inactive: Only for ports. Make this port inactive (default is active= ). > * > * Description of an Alternate Mode which a connector, cable plug or par= tner > * supports. > @@ -150,6 +151,7 @@ struct typec_altmode_desc { > u32 vdo; > /* Only used with ports */ > enum typec_port_data roles; > + bool inactive; > }; > =20 > void typec_partner_set_pd_revision(struct typec_partner *partner, u16 pd= _revision); > --=20 > 2.47.1.613.gc27f4b7a9f-goog >=20 >=20 --uitaZZ4HI1y6kP8G Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQCtZK6p/AktxXfkOlzbaomhzOwwgUCZ2N1rgAKCRBzbaomhzOw woa/AQClwvgkDgjG8nKbR+T6b3aSmlK/AY9NW+YEO8etrtu2CQD/VoPsbnYYRSRD wfJa2/2WUrHFrKSpbvZi5szLUf5XcAw= =dvzt -----END PGP SIGNATURE----- --uitaZZ4HI1y6kP8G--