[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r1each0s.fsf@kernel.org>
Date: Tue, 31 Aug 2021 08:34:56 +0300
From: Felipe Balbi <balbi@...nel.org>
To: Sandeep Maheswaram <sanm@...eaurora.org>
Cc: Rob Herring <robh+dt@...nel.org>, Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Stephen Boyd <swboyd@...omium.org>,
Doug Anderson <dianders@...omium.org>,
Matthias Kaehlcke <mka@...omium.org>,
devicetree@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Pratham Pratap <prathampratap@...eaurora.org>
Subject: Re: [PATCH 2/3] usb: dwc3: qcom: Add multi-pd support
Hi,
Sandeep Maheswaram <sanm@...eaurora.org> writes:
> Add multi pd support to set performance state for cx domain
> to maintain minimum corner voltage for USB clocks.
>
> Signed-off-by: Sandeep Maheswaram <sanm@...eaurora.org>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 9abbd01..777a647 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -17,6 +17,7 @@
> #include <linux/of_platform.h>
> #include <linux/platform_device.h>
> #include <linux/phy/phy.h>
> +#include <linux/pm_domain.h>
> #include <linux/usb/of.h>
> #include <linux/reset.h>
> #include <linux/iopoll.h>
> @@ -89,6 +90,10 @@ struct dwc3_qcom {
> bool pm_suspended;
> struct icc_path *icc_path_ddr;
> struct icc_path *icc_path_apps;
> + /* power domain for cx */
> + struct device *pd_cx;
> + /* power domain for usb gdsc */
> + struct device *pd_usb_gdsc;
> };
>
> static inline void dwc3_qcom_setbits(void __iomem *base, u32 offset, u32 val)
> @@ -521,6 +526,46 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
> return 0;
> }
>
> +static int dwc3_qcom_attach_pd(struct device *dev)
> +{
> + struct dwc3_qcom *qcom = dev_get_drvdata(dev);
> + struct device_link *link;
> +
> + /* Do nothing when in a single power domain */
> + if (dev->pm_domain)
> + return 0;
> +
> + qcom->pd_cx = dev_pm_domain_attach_by_name(dev, "cx");
> + if (IS_ERR(qcom->pd_cx))
> + return PTR_ERR(qcom->pd_cx);
> + /* Do nothing when power domain missing */
> + if (!qcom->pd_cx)
> + return 0;
> + link = device_link_add(dev, qcom->pd_cx,
> + DL_FLAG_STATELESS |
> + DL_FLAG_PM_RUNTIME |
> + DL_FLAG_RPM_ACTIVE);
> + if (!link) {
> + dev_err(dev, "Failed to add device_link to cx pd.\n");
do you need to call dev_pm_domain_dettach() here?
> + return -EINVAL;
> + }
> +
> + qcom->pd_usb_gdsc = dev_pm_domain_attach_by_name(dev, "usb_gdsc");
> + if (IS_ERR(qcom->pd_usb_gdsc))
do you need to call dev_pm_domain_dettach() here?
> + return PTR_ERR(qcom->pd_usb_gdsc);
> +
> + link = device_link_add(dev, qcom->pd_usb_gdsc,
> + DL_FLAG_STATELESS |
> + DL_FLAG_PM_RUNTIME |
> + DL_FLAG_RPM_ACTIVE);
> + if (!link) {
> + dev_err(dev, "Failed to add device_link to usb gdsc pd.\n");
do you need to call dev_pm_domain_dettach() here?
--
balbi
Powered by blists - more mailing lists