From patchwork Fri Jun 8 11:29:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 10454203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8F40260467 for ; Fri, 8 Jun 2018 11:32:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CD7A294A1 for ; Fri, 8 Jun 2018 11:32:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 713D6294C0; Fri, 8 Jun 2018 11:32:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EFD5294A1 for ; Fri, 8 Jun 2018 11:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751241AbeFHLcD (ORCPT ); Fri, 8 Jun 2018 07:32:03 -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-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 */