From patchwork Tue May 1 22:21:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mats Karrman X-Patchwork-Id: 10374561 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 8BDBB60234 for ; Tue, 1 May 2018 22:22:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F8A028D47 for ; Tue, 1 May 2018 22:22:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D65E28DBF; Tue, 1 May 2018 22:22:03 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 194DF28D68 for ; Tue, 1 May 2018 22:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751140AbeEAWVl (ORCPT ); Tue, 1 May 2018 18:21:41 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:43035 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750969AbeEAWVj (ORCPT ); Tue, 1 May 2018 18:21:39 -0400 Received: by mail-lf0-f68.google.com with SMTP id g12-v6so18069443lfb.10 for ; Tue, 01 May 2018 15:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iqqbSlxR4MMAQ5J2tcteTNyc+G6YyWbMKUtp4waQklc=; b=mWtiZK+6kg7EXjekxVZRYuhi34R4QwKsgB+4QhurrTKZcdFKLKWDzjiFgaziOfz4c3 6V+ZjOgInPpxHFEgyvmn8aA+5IVe+EHxSYegSimRaa8GOxrGIT4ZDGAXQMo3YbV1ibDV sEuuMbo4eib8xGRzQ6Z5JZ4kZtr5y+Na4Z5jaRQnf9ygvZB+HF1UJe05zITyALSvCYU9 X/7ASgZKGBEzx2x9P3kuBjh2cjLvlRiART0SefaTTNjtkB36Z5XrM8kBidkvZ82CRuzD omIz1o8V1GhAo79TPOEfluv+k65AlexQHpu0g+fC+rmWBfKCPbDprg/NeH/+9aICbpRC 98yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iqqbSlxR4MMAQ5J2tcteTNyc+G6YyWbMKUtp4waQklc=; b=TMNk1QujCKaU++sjB796Nz7HaYCdfft8eksZi4/jD0kkyLWGzDcik4P9fREKcwc91c 92piZslIjbW1GnerkzDOitMxD04KJZ3wdwgPpRD69dTIVDaW4FpqhdFgz0zv8RFfdMqq tuQ1gj2I+40WQcB1Oh5cRImGEVX0nAVie4uFXHePK0oXQTIe8FQPrGdewZan3euEBrbf JKoMmu+OavOjoscAFK4pFd5zhInb52cBrBIeCvxOOWUhz33qGKyMB2Yo5zaTi+4sVzK6 Vi7lIK4lU10qj1biYX9gjAJ42QsLnamjCX5nBKyc6bHWAydiSj2u0P2OVjNGgmQtc+UE RE0Q== X-Gm-Message-State: ALQs6tC32WV7XYvjLPT1AlWAB3228vZz4uXO/29CHROvvM10iXBn8pq5 TG+ylGePbZxNu1Oy2j3JHpc= X-Google-Smtp-Source: AB8JxZrKaMW/atWmnKMIY4TanTfJ8RlDgNngXaRn9CBGs8k44oErlvdc0wvwcluzshMm4KDU+hkdOw== X-Received: by 2002:a2e:988f:: with SMTP id b15-v6mr11981488ljj.65.1525213298424; Tue, 01 May 2018 15:21:38 -0700 (PDT) Received: from matsnb.lan ([195.84.96.49]) by smtp.gmail.com with ESMTPSA id j85-v6sm2196840lfh.5.2018.05.01.15.21.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 May 2018 15:21:37 -0700 (PDT) From: Mats Karrman To: Heikki Krogerus , Hans de Goede , Guenter Roeck , Greg Kroah-Hartman Cc: Rob Herring , linux-usb@vger.kernel.org Subject: [RFC PATCH 2/7] usb: typec: Move mux mode type definition to limit dependency Date: Wed, 2 May 2018 00:21:08 +0200 Message-Id: <1525213273-6103-3-git-send-email-mats.dev.list@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525213273-6103-1-git-send-email-mats.dev.list@gmail.com> References: <1525213273-6103-1-git-send-email-mats.dev.list@gmail.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 To avoid unnecessary dependencies on tcpm.h and to pave the way for comming patches, move the tcpc_mux_mode enum from tcpm.h to typec.h and change its name to typec_mux_mode (the enum constants already follow this naming). Signed-off-by: Mats Karrman --- drivers/usb/typec/mux/pi3usb30532.c | 6 +++--- drivers/usb/typec/tcpm.c | 2 +- include/linux/usb/tcpm.h | 12 ------------ include/linux/usb/typec.h | 11 +++++++++++ include/linux/usb/typec_mux.h | 4 ++-- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/usb/typec/mux/pi3usb30532.c b/drivers/usb/typec/mux/pi3usb30532.c index 279f3c3..d995883 100644 --- a/drivers/usb/typec/mux/pi3usb30532.c +++ b/drivers/usb/typec/mux/pi3usb30532.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #define PI3USB30532_CONF 0x00 @@ -73,7 +73,7 @@ static int pi3usb30532_sw_set(struct typec_switch *sw, return ret; } -static int pi3usb30532_mux_set(struct typec_mux *mux, int state) +static int pi3usb30532_mux_set(struct typec_mux *mux, enum typec_mux_mode mode) { struct pi3usb30532 *pi = container_of(mux, struct pi3usb30532, mux); u8 new_conf; @@ -82,7 +82,7 @@ static int pi3usb30532_mux_set(struct typec_mux *mux, int state) mutex_lock(&pi->lock); new_conf = pi->conf; - switch (state) { + switch (mode) { default: case TYPEC_MUX_NONE: new_conf = PI3USB30532_CONF_OPEN; diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index 0451ea0..aaf6d57 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -644,7 +644,7 @@ void tcpm_pd_transmit_complete(struct tcpm_port *port, } EXPORT_SYMBOL_GPL(tcpm_pd_transmit_complete); -static int tcpm_mux_set(struct tcpm_port *port, enum tcpc_mux_mode mode, +static int tcpm_mux_set(struct tcpm_port *port, enum typec_mux_mode mode, enum usb_role usb_role, enum typec_orientation orientation) { diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h index 3518965..e641e21 100644 --- a/include/linux/usb/tcpm.h +++ b/include/linux/usb/tcpm.h @@ -93,18 +93,6 @@ struct tcpc_config { const struct typec_altmode_desc *alt_modes; }; -/* Mux modes */ -enum tcpc_mux_mode { - TYPEC_MUX_NONE, /* Open switch */ - TYPEC_MUX_2CH_USBSS, /* 2ch USB SS */ - TYPEC_MUX_4CH_AM, /* 4ch Alt Mode */ - TYPEC_MUX_2CH_USBSS_2CH_AM, /* 2ch USB SS + 2ch Alt Mode */ - - // Example of additional modes that may be needed in future: - TYPEC_MUX_4CH_USBSS, /* 4ch USB SS */ - TYPEC_MUX_2CH_USBSS_2CH_AM_B, /* 2ch USB SS + 2ch Alt Mode (e.g. DP GPU2) */ -}; - /** * struct tcpc_dev - Port configuration and callback functions diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 672b39b..d356577 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -72,6 +72,17 @@ enum typec_orientation { TYPEC_ORIENTATION_REVERSE, }; +enum typec_mux_mode { + TYPEC_MUX_NONE, /* Open switch */ + TYPEC_MUX_2CH_USBSS, /* 2ch USB SS */ + TYPEC_MUX_4CH_AM, /* 4ch Alt Mode */ + TYPEC_MUX_2CH_USBSS_2CH_AM, /* 2ch USB SS + 2ch Alt Mode */ + + // Example of additional modes that may be needed in future: + TYPEC_MUX_4CH_USBSS, /* 4ch USB SS */ + TYPEC_MUX_2CH_USBSS_2CH_AM_B, /* 2ch USB SS + 2ch Alt Mode (e.g. DP GPU2) */ +}; + /* * struct usb_pd_identity - USB Power Delivery identity data * @id_header: ID Header VDO diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h index 12c1b05..e44137d 100644 --- a/include/linux/usb/typec_mux.h +++ b/include/linux/usb/typec_mux.h @@ -29,7 +29,7 @@ struct typec_switch { * struct typec_switch - USB Type-C connector pin mux * @dev: Mux device * @entry: List entry - * @set: Callback to the driver for setting the state of the mux + * @set: Callback to the driver for setting the mode of the mux * * Pin Multiplexer/DeMultiplexer switch routing the USB Type-C connector pins to * different components depending on the requested mode of operation. Used with @@ -39,7 +39,7 @@ struct typec_mux { struct device *dev; struct list_head entry; - int (*set)(struct typec_mux *mux, int state); + int (*set)(struct typec_mux *mux, enum typec_mux_mode mode); }; struct typec_switch *typec_switch_get(struct device *dev);