Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp736693imm; Fri, 8 Jun 2018 04:33:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ9BpIK8eXaMHUw7vnxSrxdsBbAWSfWpa6HFnYZ2rUXBg6Pu7UFEKYqJkceV+4edOxJUMaN X-Received: by 2002:a65:6591:: with SMTP id u17-v6mr4827799pgv.401.1528457596876; Fri, 08 Jun 2018 04:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528457596; cv=none; d=google.com; s=arc-20160816; b=TBcYEUz4QB9ffm/2rsvGfrsh3U3/U1zU4QEs+/7mX4Cu9lSfrOxqotg7T4y7gavnjK GuljsZgxtQtJwMXSNb5PxhNl45QpXnhSvPS3H4Cv2b3s/t+q87QgnKyDFdxOY0e2tJGM SWpuzH5lOLj6r3OLIhQZL2axhfLh9gulm6rjws2XUrJkQ/bNNmbQMhwFzf+4Lc1F0ven nZzLxTpf+2sm/pzSfp/XCDMzokxdvc6HLlSAOjTqTtOyv0BKQ/Jq3VQu4haOwdA78CFO 7bb5K3Yt3HMm6Daphd+McVi9foDYeqsxPjrRmQaM8zUH4dwfGhPwgAEGmPUnIbMiDFds 5DWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=AU+YGi1NslMpa68RaUMDxcKSYd+O9BKp3og+5lEoiuc=; b=MaegYq5mFaqgow7Cm9iTRWmSZx7TsTzqEt1uQOMCEwZFGIJ6Q+1MNiLhfQQgpiL0yE 43VVnAegH39taGLQQ1C38cEf7MWXLayGia98SLuF6t5KpkxXJrhVhqDc/B6FG2EOlHB/ +KxV4DnvzYJ4ZHPq+xiY0qdiIinwLn3ZuEHaGW0IkNZenFS9ryE7v0yVQFU/MjZu962l GQ/wXpm8ucaHktV3hP7WPWvs0R+FWeOl2b9B5PKNWiQBLlpH4LEYwQr8gs92CpdVxAq+ jj6Vet2MLzFNhu7jMoxyNWKKTMTFCt+cLS9hxzcWxx+z7grAd2FqsxdQDPtOxXTvin1p BdQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si44988444plo.363.2018.06.08.04.33.02; Fri, 08 Jun 2018 04:33:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1753084AbeFHLcE (ORCPT + 99 others); Fri, 8 Jun 2018 07:32:04 -0400 Received: from mga17.intel.com ([192.55.52.151]:32416 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752769AbeFHL3s (ORCPT ); Fri, 8 Jun 2018 07:29:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2018 04:29:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,490,1520924400"; d="scan'208";a="62388985" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 08 Jun 2018 04:29:46 -0700 From: Heikki Krogerus To: Guenter Roeck , Hans de Goede Cc: Greg Kroah-Hartman , Jun Li , Mats Karrman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v4 2/8] usb: typec: helper for checking cable plug orientation Date: Fri, 8 Jun 2018 14:29:35 +0300 Message-Id: <20180608112941.26332-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180608112941.26332-1-heikki.krogerus@linux.intel.com> References: <20180608112941.26332-1-heikki.krogerus@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds function typec_get_orientation() that can be used for checking the current cable plug orientation. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/class.c | 11 +++++++++++ include/linux/usb/typec.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 53df10df2f9d..02db9bcbac0c 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -1279,6 +1279,17 @@ int typec_set_orientation(struct typec_port *port, } EXPORT_SYMBOL_GPL(typec_set_orientation); +/** + * typec_get_orientation - Get USB Type-C cable plug orientation + * @port: USB Type-C Port + * + * Get current cable plug orientation for @port. + */ +enum typec_orientation typec_get_orientation(struct typec_port *port) +{ + return port->orientation; +} + /** * typec_set_mode - Set mode of operation for USB Type-C connector * @port: USB Type-C port for the connector diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 672b39bb0adc..a5f6433e218b 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -265,6 +265,7 @@ void typec_set_pwr_opmode(struct typec_port *port, enum typec_pwr_opmode mode); int typec_set_orientation(struct typec_port *port, enum typec_orientation orientation); +enum typec_orientation typec_get_orientation(struct typec_port *port); int typec_set_mode(struct typec_port *port, int mode); #endif /* __LINUX_USB_TYPEC_H */ -- 2.17.1