From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> To: gregkh@linuxfoundation.org, robh+dt@kernel.org, mark.rutland@arm.com, frowand.list@gmail.com Cc: heikki.krogerus@linux.intel.com, hdegoede@redhat.com, andy.shevchenko@gmail.com, p.zabel@pengutronix.de, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Subject: [PATCH/RFC 07/11] usb: common: roles: add getting device pointer APIs Date: Wed, 18 Apr 2018 17:10:01 +0900 [thread overview] Message-ID: <1524039005-30618-8-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw) In-Reply-To: <1524039005-30618-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> This patch adds APIs that a role switch driver can get device pointer of USB 2.0/3.0 and udc. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/usb/common/roles.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/usb/role.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c index 381259c..5fd14b2 100644 --- a/drivers/usb/common/roles.c +++ b/drivers/usb/common/roles.c @@ -34,6 +34,42 @@ struct usb_role_switch { #define to_role_switch(d) container_of(d, struct usb_role_switch, dev) /** + * usb_role_switch_get_usb2_port - Get device of a USB 2.0 host + * @sw: USB role switch + * + * Returns USB 2.0 host device pointer. + */ +struct device *usb_role_switch_get_usb2_port(struct usb_role_switch *sw) +{ + return sw->usb2_port; +} +EXPORT_SYMBOL(usb_role_switch_get_usb2_port); + +/** + * usb_role_switch_get_usb3_port - Get device of a USB 3.0 host + * @sw: USB role switch + * + * Returns USB 3.0 host device pointer. + */ +struct device *usb_role_switch_get_usb3_port(struct usb_role_switch *sw) +{ + return sw->usb3_port; +} +EXPORT_SYMBOL(usb_role_switch_get_usb3_port); + +/** + * usb_role_switch_get_udc - Get device of a udc + * @sw: USB role switch + * + * Returns udc device pointer. + */ +struct device *usb_role_switch_get_udc(struct usb_role_switch *sw) +{ + return sw->udc; +} +EXPORT_SYMBOL(usb_role_switch_get_udc); + +/** * usb_role_switch_set_role - Set USB role for a switch * @sw: USB role switch * @role: USB role to be switched to diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h index edc51be..c7eb73b 100644 --- a/include/linux/usb/role.h +++ b/include/linux/usb/role.h @@ -40,6 +40,10 @@ struct usb_role_switch_desc { bool allow_userspace_control; }; +struct device *usb_role_switch_get_usb2_port(struct usb_role_switch *sw); +struct device *usb_role_switch_get_usb3_port(struct usb_role_switch *sw); +struct device *usb_role_switch_get_udc(struct usb_role_switch *sw); + int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role); enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw); struct usb_role_switch *usb_role_switch_get(struct device *dev); -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> To: gregkh@linuxfoundation.org, robh+dt@kernel.org, mark.rutland@arm.com, frowand.list@gmail.com Cc: heikki.krogerus@linux.intel.com, hdegoede@redhat.com, andy.shevchenko@gmail.com, p.zabel@pengutronix.de, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Subject: [PATCH/RFC,07/11] usb: common: roles: add getting device pointer APIs Date: Wed, 18 Apr 2018 17:10:01 +0900 [thread overview] Message-ID: <1524039005-30618-8-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw) This patch adds APIs that a role switch driver can get device pointer of USB 2.0/3.0 and udc. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/usb/common/roles.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/usb/role.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c index 381259c..5fd14b2 100644 --- a/drivers/usb/common/roles.c +++ b/drivers/usb/common/roles.c @@ -34,6 +34,42 @@ struct usb_role_switch { #define to_role_switch(d) container_of(d, struct usb_role_switch, dev) /** + * usb_role_switch_get_usb2_port - Get device of a USB 2.0 host + * @sw: USB role switch + * + * Returns USB 2.0 host device pointer. + */ +struct device *usb_role_switch_get_usb2_port(struct usb_role_switch *sw) +{ + return sw->usb2_port; +} +EXPORT_SYMBOL(usb_role_switch_get_usb2_port); + +/** + * usb_role_switch_get_usb3_port - Get device of a USB 3.0 host + * @sw: USB role switch + * + * Returns USB 3.0 host device pointer. + */ +struct device *usb_role_switch_get_usb3_port(struct usb_role_switch *sw) +{ + return sw->usb3_port; +} +EXPORT_SYMBOL(usb_role_switch_get_usb3_port); + +/** + * usb_role_switch_get_udc - Get device of a udc + * @sw: USB role switch + * + * Returns udc device pointer. + */ +struct device *usb_role_switch_get_udc(struct usb_role_switch *sw) +{ + return sw->udc; +} +EXPORT_SYMBOL(usb_role_switch_get_udc); + +/** * usb_role_switch_set_role - Set USB role for a switch * @sw: USB role switch * @role: USB role to be switched to diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h index edc51be..c7eb73b 100644 --- a/include/linux/usb/role.h +++ b/include/linux/usb/role.h @@ -40,6 +40,10 @@ struct usb_role_switch_desc { bool allow_userspace_control; }; +struct device *usb_role_switch_get_usb2_port(struct usb_role_switch *sw); +struct device *usb_role_switch_get_usb3_port(struct usb_role_switch *sw); +struct device *usb_role_switch_get_udc(struct usb_role_switch *sw); + int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role); enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw); struct usb_role_switch *usb_role_switch_get(struct device *dev);
next prev parent reply other threads:[~2018-04-18 8:10 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-18 8:09 [PATCH/RFC 00/11] add support for R-Car USB3.0 role switch Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC 01/11] Documentation: of: Add device-connection-id property Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC,01/11] " Yoshihiro Shimoda 2018-04-24 14:33 ` [PATCH/RFC 01/11] " Rob Herring 2018-04-24 14:33 ` [PATCH/RFC,01/11] " Rob Herring 2018-04-25 9:09 ` [PATCH/RFC 01/11] " Yoshihiro Shimoda 2018-04-25 9:09 ` [PATCH/RFC,01/11] " Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC 02/11] dt-bindings: usb: add usb role switch driver Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC,02/11] " Yoshihiro Shimoda 2018-04-24 14:35 ` [PATCH/RFC 02/11] " Rob Herring 2018-04-24 14:35 ` [PATCH/RFC,02/11] " Rob Herring 2018-04-18 8:09 ` [PATCH/RFC 03/11] dt-bindings: usb: add Renesas R-Car USB 3.0 " Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC,03/11] " Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC 04/11] of: platform: add device connection parsing Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC,04/11] " Yoshihiro Shimoda 2018-04-24 12:33 ` [PATCH/RFC 04/11] " Heikki Krogerus 2018-04-24 12:33 ` [PATCH/RFC,04/11] " Heikki Krogerus 2018-04-25 8:59 ` [PATCH/RFC 04/11] " Yoshihiro Shimoda 2018-04-25 8:59 ` [PATCH/RFC,04/11] " Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC 05/11] usb: common: roles: add fwnode graph parsing Yoshihiro Shimoda 2018-04-18 8:09 ` [PATCH/RFC,05/11] " Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC 06/11] usb: common: roles: Allow if the parent dev_name matches Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC,06/11] " Yoshihiro Shimoda 2018-04-18 8:10 ` Yoshihiro Shimoda [this message] 2018-04-18 8:10 ` [PATCH/RFC,07/11] usb: common: roles: add getting device pointer APIs Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC 08/11] usb: role: rcar-usb3-role-switch: add support for R-Car SoCs Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC,08/11] " Yoshihiro Shimoda 2018-04-18 8:47 ` [PATCH/RFC 08/11] " Geert Uytterhoeven 2018-04-18 8:47 ` [PATCH/RFC,08/11] " Geert Uytterhoeven 2018-04-18 8:10 ` [PATCH/RFC 09/11] usb: gadget: udc: renesas_usb3: add support for a usb role switch Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC,09/11] " Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC 10/11] arm64: dts: renesas: r8a7795: add OF graph for " Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC,10/11] " Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC 11/11] arm64: dts: renesas: r8a7795: salvator-xs: " Yoshihiro Shimoda 2018-04-18 8:10 ` [PATCH/RFC,11/11] " Yoshihiro Shimoda
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1524039005-30618-8-git-send-email-yoshihiro.shimoda.uh@renesas.com \ --to=yoshihiro.shimoda.uh@renesas.com \ --cc=andy.shevchenko@gmail.com \ --cc=devicetree@vger.kernel.org \ --cc=frowand.list@gmail.com \ --cc=gregkh@linuxfoundation.org \ --cc=hdegoede@redhat.com \ --cc=heikki.krogerus@linux.intel.com \ --cc=linux-renesas-soc@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=p.zabel@pengutronix.de \ --cc=robh+dt@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.