From: Chanwoo Choi <cw00.choi@samsung.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
kishon@ti.com, robh+dt@kernel.org, pawel.moll@arm.com,
mark.rutland@arm.com, ijc+devicetree@hellion.org.uk,
galak@codeaurora.org
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 3/3] phy: rcar-gen3-usb2: add extcon support
Date: Mon, 14 Mar 2016 12:36:01 +0900 [thread overview]
Message-ID: <56E631A1.2090302@samsung.com> (raw)
In-Reply-To: <1456999746-2800-4-git-send-email-yoshihiro.shimoda.uh@renesas.com>
Hi Yoshihiro,
On 2016년 03월 03일 19:09, Yoshihiro Shimoda wrote:
> This patch adds extcon support for otg related channel.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> drivers/phy/Kconfig | 1 +
> drivers/phy/phy-rcar-gen3-usb2.c | 26 ++++++++++++++++++++++++++
> 2 files changed, 27 insertions(+)
>
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index ba68f14..db57d6c 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -121,6 +121,7 @@ config PHY_RCAR_GEN2
> config PHY_RCAR_GEN3_USB2
> tristate "Renesas R-Car generation 3 USB 2.0 PHY driver"
> depends on OF && ARCH_RENESAS
> + depends on EXTCON
> select GENERIC_PHY
> help
> Support for USB 2.0 PHY found on Renesas R-Car generation 3 SoCs.
> diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c
> index 7b14244..76bb88f 100644
> --- a/drivers/phy/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/phy-rcar-gen3-usb2.c
> @@ -12,6 +12,7 @@
> * published by the Free Software Foundation.
> */
>
> +#include <linux/extcon.h>
> #include <linux/interrupt.h>
> #include <linux/io.h>
> #include <linux/module.h>
> @@ -77,6 +78,7 @@
>
> struct rcar_gen3_chan {
> void __iomem *base;
> + struct extcon_dev *extcon;
> struct phy *phy;
> struct regulator *vbus;
> bool has_otg;
> @@ -127,6 +129,9 @@ static void rcar_gen3_init_for_host(struct rcar_gen3_chan *ch)
> rcar_gen3_set_linectrl(ch, 1, 1);
> rcar_gen3_set_host_mode(ch, 1);
> rcar_gen3_enable_vbus_ctrl(ch, 1);
> +
> + extcon_set_cable_state_(ch->extcon, EXTCON_USB_HOST, true);
> + extcon_set_cable_state_(ch->extcon, EXTCON_USB, false);
> }
>
> static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)
> @@ -134,6 +139,9 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)
> rcar_gen3_set_linectrl(ch, 0, 1);
> rcar_gen3_set_host_mode(ch, 0);
> rcar_gen3_enable_vbus_ctrl(ch, 0);
> +
> + extcon_set_cable_state_(ch->extcon, EXTCON_USB_HOST, false);
> + extcon_set_cable_state_(ch->extcon, EXTCON_USB, true);
> }
>
> static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch)
> @@ -272,6 +280,12 @@ static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
> };
> MODULE_DEVICE_TABLE(of, rcar_gen3_phy_usb2_match_table);
>
> +static const unsigned int rcar_gen3_phy_cable[] = {
> + EXTCON_USB,
> + EXTCON_USB_HOST,
> + EXTCON_NONE,
> +};
> +
> static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -297,11 +311,23 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
> /* call request_irq for OTG */
> irq = platform_get_irq(pdev, 0);
> if (irq >= 0) {
> + int ret;
> +
> irq = devm_request_irq(dev, irq, rcar_gen3_phy_usb2_irq,
> IRQF_SHARED, dev_name(dev), channel);
> if (irq < 0)
> dev_err(dev, "No irq handler (%d)\n", irq);
> channel->has_otg = true;
> + channel->extcon = devm_extcon_dev_allocate(dev,
> + rcar_gen3_phy_cable);
> + if (IS_ERR(channel->extcon))
> + return PTR_ERR(channel->extcon);
> +
> + ret = devm_extcon_dev_register(dev, channel->extcon);
> + if (ret < 0) {
> + dev_err(dev, "Failed to register extcon\n");
> + return ret;
> + }
> }
>
> /* devm_phy_create() will call pm_runtime_enable(dev); */
>
Looks good to me about extcon usgae.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Best Regards,
Chanwoo Choi
next prev parent reply other threads:[~2016-03-14 3:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 10:09 [PATCH 0/3] phy: rcar-gen3-usb2: add vbus-supply and extcon Yoshihiro Shimoda
2016-03-03 10:09 ` [PATCH 1/3] phy: rcar-gen3-usb2: remove unnecesary struct rcar_gen3_data Yoshihiro Shimoda
2016-03-03 10:09 ` [PATCH 2/3] phy: rcar-gen3-usb2: Add vbus-supply to handle VBUS on/off Yoshihiro Shimoda
2016-04-05 10:53 ` Kishon Vijay Abraham I
2016-04-06 0:25 ` Yoshihiro Shimoda
2016-04-06 12:45 ` Kishon Vijay Abraham I
2016-03-03 10:09 ` [PATCH 3/3] phy: rcar-gen3-usb2: add extcon support Yoshihiro Shimoda
2016-03-14 3:36 ` Chanwoo Choi [this message]
2016-04-05 9:56 ` Yoshihiro Shimoda
2016-04-29 8:53 ` [PATCH 0/3] phy: rcar-gen3-usb2: add vbus-supply and extcon Kishon Vijay Abraham I
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=56E631A1.2090302@samsung.com \
--to=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox