Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1850974lqe; Tue, 9 Apr 2024 02:11:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsAiPsae/kM5TGeFZm1SE1qtiNK6qpksEprrcwGF2F5MoPpbZuTNtodXex/dtGGydyHtl9hjS4i58TygXHERvjKSjMwtC5lzwCeKPqEw== X-Google-Smtp-Source: AGHT+IEjDWOqagrbB5f5fEOJYG3L3G+2hg9gqHuF+CFzKSUow60Sxhrsf3tzIdU/lBDvvml3mTn/ X-Received: by 2002:a05:6a21:3941:b0:1a7:5401:5aaf with SMTP id ac1-20020a056a21394100b001a754015aafmr11703782pzc.20.1712653911353; Tue, 09 Apr 2024 02:11:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712653911; cv=pass; d=google.com; s=arc-20160816; b=QWl8ydZ9PkfrsCLZI7QKk/kjeuJejOjYFsXdqT+X+WgfNnRQj/Rrfgpf27N3ZAR2q9 ILTZQcyiBMtRYkd5ba/7xZ/rh+ZvN+blowG9HqUT4Jeaehcxbr1fciH+d9fFRLWfG2yy OjMkACKVef8J5Q2zUJZ7ajYPQalzaOXvgRkA4yJdc4t9Sm3rqcYmWXeHNiIB0h0aOhEY ldKUY6v1H//jmMnMykxO5IfzJ7vhyh9Ec7QeG4fkD2zBWiDH8uspQsoFcl5pHFAWrkRI CKTVtLXboUIf+JbxHX6cTK9Oy1y4EtHuIDeVmTjp8Xh/H0i+hckfKrlazbhblCt4qmOD 4daQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Vyn8L4ARXA/9Zld5+1F+B3AtCHDVRPgwAGVXyq/UjKs=; fh=UXUL8cFUpQi3eVy+A3GfoNkLC2OoKPIrJofCuFo0FDw=; b=wD7AksQViapgaQ+JOAEDQpkNA+HlXvYtM0hfK0cyPmtanrKi905GAzGKBTODaJG96A kqGkRoLKvCcwQh1JTYCXv5VvsFgI2VQeaT7KsEskQECWo9HBwVGouorm1hBTwMwj1xQS 3Ks53Bd7eSKM5ex+duCMq/H5WND4mOF5+/FtC8M2DdmBdJSLk7tXUOxC3ISYUR4eaZni x7oX2TLciSqpAECTKZc8DqjuDpAznK/6Kqmx+H54Nm9u33tdmRpRfTbecGFsJFNpt+x7 dciqM04AINcaRT9r0LzBYPcxqtp4Of4nq9tCnr6retVHlFqMklN6ZGT4o66l7+/hrsku Mduw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CDs2tXkF; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-136410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136410-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q5-20020a170902a3c500b001e030ca061asi8091497plb.452.2024.04.09.02.11.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 02:11:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CDs2tXkF; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-136410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136410-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CE6F8B20F6E for ; Tue, 9 Apr 2024 08:05:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B12F97E58E; Tue, 9 Apr 2024 08:05:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CDs2tXkF" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2561269DF4; Tue, 9 Apr 2024 08:05:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712649914; cv=none; b=MZ9M3qhR7IrQWJ4HDnM/TOJ4Y8ETI08XhKUA7/bUVKaR1hHEOJl5OzqlnkonTh0HhElxYqPMzxPoY/tJhnVbqgOSqeZEMSzkNSTXMEJHRrfNgw+i2ApGD5T9jHcpfQK53oJ8CalHVTQtaEeB0+E+3GPsslTuRsRQxdX0XD9+Prg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712649914; c=relaxed/simple; bh=G+z6oXhYsSEPNHieDlTJJ1G7pqLswl3Dl4SmhdePMOI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iwBnOjte7kp4oKz9rsUvLmaaJ2tJkZa8yxydGdRj0i//RfFOHd43HGAqOhhwQq/AhUPuAqTgg5dufo9msZgjOX5EKwCPdLGg3IgKn5nhA+ZAV//J85zTpMQAvGlnfPF4OYeIBWgS3abRWIwLJpoqS5YKsrf7ucl0reODNRp5u5U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CDs2tXkF; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712649913; x=1744185913; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=G+z6oXhYsSEPNHieDlTJJ1G7pqLswl3Dl4SmhdePMOI=; b=CDs2tXkF/JVs7GNPSTsGW/tFAFOvKR7obcGfgW65h5JBms8pgC4l725s NqaO1mYRFSPvirDbxkzNWbqCj8HxUIX7Awf8nNRa78MNY4kNClg6vAzic iHusndGoXYeG1ZoAdhqTYgmW4EgzVm2033IXExQw8xL6fF2Q4eOY8wfut HpNuXhxLoSXgRaPFON69ZjJK+bdLB6NxGtu9nyhYyKaetm/2TX8KmL5v3 7I7dtOl3ceEBuRe8Ql0lveUcBuBFMI2UacWk5Cc43pRzEBMssD6UuO6sm n7s06bGKPB/YhDTB16GLapWKi/Mq6i4wnT8V+uB3M+Ev/O4Cw/CYkhdvv g==; X-CSE-ConnectionGUID: S4KLZgVmQOWI6sofC/m13A== X-CSE-MsgGUID: M0qE0d3QTfmrX4mZCxpwtg== X-IronPort-AV: E=McAfee;i="6600,9927,11038"; a="11750101" X-IronPort-AV: E=Sophos;i="6.07,189,1708416000"; d="scan'208";a="11750101" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 01:05:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11038"; a="937093185" X-IronPort-AV: E=Sophos;i="6.07,189,1708416000"; d="scan'208";a="937093185" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 09 Apr 2024 01:05:09 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 09 Apr 2024 11:05:09 +0300 Date: Tue, 9 Apr 2024 11:05:09 +0300 From: Heikki Krogerus To: Dmitry Baryshkov Cc: Greg Kroah-Hartman , Neil Armstrong , linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/5] usb: typec: ucsi: make it orientation-aware Message-ID: References: <20240408-ucsi-orient-aware-v1-0-95a74a163a10@linaro.org> <20240408-ucsi-orient-aware-v1-4-95a74a163a10@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240408-ucsi-orient-aware-v1-4-95a74a163a10@linaro.org> Hi Dmitry, On Mon, Apr 08, 2024 at 07:30:52AM +0300, Dmitry Baryshkov wrote: > The UCSI 1.0 is not orientation aware. Only UCSI 2.0 has added > orientation status to GET_CONNECTOR_STATUS data. However the glue code > can be able to detect cable orientation on its own (and report it via > corresponding typec API). Add a flag to let UCSI mark registered ports > as orientation aware. > > Signed-off-by: Dmitry Baryshkov > --- > drivers/usb/typec/ucsi/ucsi.c | 2 ++ > drivers/usb/typec/ucsi/ucsi.h | 1 + > 2 files changed, 3 insertions(+) > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c > index 7ad544c968e4..6f5adc335980 100644 > --- a/drivers/usb/typec/ucsi/ucsi.c > +++ b/drivers/usb/typec/ucsi/ucsi.c > @@ -1551,6 +1551,8 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con) > cap->svdm_version = SVDM_VER_2_0; > cap->prefer_role = TYPEC_NO_PREFERRED_ROLE; > > + cap->orientation_aware = !!(ucsi->quirks & UCSI_ORIENTATION_AWARE); > + > if (con->cap.op_mode & UCSI_CONCAP_OPMODE_AUDIO_ACCESSORY) > *accessory++ = TYPEC_ACCESSORY_AUDIO; > if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DEBUG_ACCESSORY) > diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h > index 6599fbd09bee..e92be45e4c1c 100644 > --- a/drivers/usb/typec/ucsi/ucsi.h > +++ b/drivers/usb/typec/ucsi/ucsi.h > @@ -410,6 +410,7 @@ struct ucsi { > unsigned long quirks; > #define UCSI_NO_PARTNER_PDOS BIT(0) /* Don't read partner's PDOs */ > #define UCSI_DELAY_DEVICE_PDOS BIT(1) /* Reading PDOs fails until the parter is in PD mode */ > +#define UCSI_ORIENTATION_AWARE BIT(2) /* UCSI is orientation aware */ You are not using that flag anywhere in this series. But why would orientation need a "quirk" in the first place? I'm not sure where you are going with this, but please try to avoid the quirk flags in general in this driver rather than considering them as the first way of solving things. Use them only as the last resort. I don't want this driver to end up like xhci and some other drivers, where refactoring is almost impossible because every place is full of conditions checking the quirks, and where in worst case a quirk meant to solve a problem on one hardware causes problems on another. thanks, -- heikki