Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1878282ybk; Mon, 11 May 2020 06:36:14 -0700 (PDT) X-Google-Smtp-Source: APiQypJQYv8QXQ3y1/FcgZAW0kGhxMKSEDrq/1dbgYPtBhHchRXLY5gYKViIHufLod6I7eBl0agb X-Received: by 2002:a17:906:6944:: with SMTP id c4mr13586192ejs.96.1589204174724; Mon, 11 May 2020 06:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589204174; cv=none; d=google.com; s=arc-20160816; b=TozI7kIaAGQnZOktV9WTm8tKbx2xz0SjHvP+eMSaQJ/IWpaOPLCqE8BA89Em/F+IHJ yxfcwF8G6MEvAPcpQDM4YSpCkFFo/K/mNvPkV3CYkInWXZBMUFCgYNqMUyLJeQ/CKD0Z jIk46+8lfND9d28HcEqlL9m9uCOctFCnTNNRvvgcR91aCv4yRz1xXiJDXx1YEDxfa9hY QdvjO7oTg69sVMzxR/qN6/4ypc8Mn9KDGESwJIXNmiTQ8BMC3E/HgQHikt2ahmRK96qj DUXQueQxSrFveou6T8mXzbwLvTjbJUw4b2eZPdMBleFc1R2DONlDjfO7shP5IhMN1tim HC6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=8kB6UwraBuEVVvRL03x7reg2Dj4+Vm6xTqGjhcvwkhE=; b=vsQ38JPdQ/mxD3wXtr4oxVcOzaAsF1YnjZXBLctJX014YOxDKS/6+GGEYkQhRL8eXu NVsw55smaxNR/JW5ZtCuqnh20iUDvdxM99MSe45qbIZl7hdpjAkKVkdL/Dix+p4tQWqe HMh8pR7l3Zd2EIAK89vRfjuYf4Tfyu1KjWK+sGgAhLMS0ZGElVLW38Bm1RVApEqcD5NO OebVuf368ss0Kwj2/wpyht6NSz5caYFPVayr6nt1/RomxA3MNIT0oetZY2whTAFGYY88 Z0b3T/EhsrQ123awaaeYEhsPgQYK4zH4E18alI7ugi/peeppHsXvnoSA75OG0icLAgOI O9rw== 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 q18si6106700edw.260.2020.05.11.06.35.51; Mon, 11 May 2020 06:36:14 -0700 (PDT) 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 S1729555AbgEKNcH (ORCPT + 99 others); Mon, 11 May 2020 09:32:07 -0400 Received: from mga03.intel.com ([134.134.136.65]:31493 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729485AbgEKNcG (ORCPT ); Mon, 11 May 2020 09:32:06 -0400 IronPort-SDR: KUWThOVokw+22igPqcGhYXsNpQTG/Rn8xP6pdyU0AOxfQEqoRZTz6RC44EHylq2Q+EoZq2SV16 VTegjmUHF7xg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2020 06:32:06 -0700 IronPort-SDR: ua08l74jDK6N53RK+hzjn3UO03K2ocJBHhbnx0ofM7hCCzQ1S9igxVMp/aa60S5eLLphK5FFa5 UbI6MuvIfEHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,380,1583222400"; d="scan'208";a="371223357" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 11 May 2020 06:32:03 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 11 May 2020 16:32:02 +0300 Date: Mon, 11 May 2020 16:32:02 +0300 From: Heikki Krogerus To: Prashant Malani Cc: Greg Kroah-Hartman , Benson Leung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: Re: [PATCH 2/4] usb: typec: mux: intel_pmc_mux: Support for static SBU/HSL orientation Message-ID: <20200511133202.GA2085641@kuha.fi.intel.com> References: <20200507150900.12102-1-heikki.krogerus@linux.intel.com> <20200507150900.12102-3-heikki.krogerus@linux.intel.com> <20200507224041.GA247416@google.com> <20200508111840.GG645261@kuha.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200508111840.GG645261@kuha.fi.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 08, 2020 at 02:18:44PM +0300, Heikki Krogerus wrote: > Hi Prashant, > > On Thu, May 07, 2020 at 03:40:41PM -0700, Prashant Malani wrote: > > > +static int sbu_orientation(struct pmc_usb_port *port) > > > +{ > > > + if (port->sbu_orientation) > > > + return port->sbu_orientation - 1; > > > + > > > + return port->orientation - 1; > > > +} > > > + > > > +static int hsl_orientation(struct pmc_usb_port *port) > > > +{ > > > + if (port->hsl_orientation) > > > + return port->hsl_orientation - 1; > > > + > > > + return port->orientation - 1; > > > +} > > > + > > > static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len) > > > { > > > u8 response[4]; > > > @@ -151,8 +170,9 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) > > > > > > req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; > > > req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; > > > - req.mode_data |= (port->orientation - 1) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; > > > - req.mode_data |= (port->orientation - 1) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; > > > + > > > + req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; > > > > I'm curious to know what would happen when sbu-orientation == "normal". > > That means |port->sbu_orientation| == 1. > > > > It sounds like what should happen is the AUX_SHIFT orientation > > setting should follow what |port->orientation| is, but here it > > looks like it will always be set to |port->sbu_orientation - 1|, i.e 0, > > even if port->orientation == TYPEC_ORIENTATION_REVERSE, i.e 2, meaning > > it should be set to 1 ? > > I'll double check this, and get back to you.. This is not exactly an answer to your question, but it seems that those bits are only valid if "Alternate-Direct" message is used. Currently the driver does not support that message. I think the correct thing to do now is to remove the two lines from the driver where those bits (ORI-HSL and ORI-Aux) are set. Let me know if that's OK, and I'll update the series. thanks, -- heikki