diff options
author | Rajendra Nayak <rnayak@codeaurora.org> | 2015-10-13 17:38:52 +0530 |
---|---|---|
committer | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2016-05-10 14:18:03 +0100 |
commit | 2bd5c6d85ff69d7ca8588f5ad1f0bba0c97da6d5 (patch) | |
tree | 050dd43b62ac801b3fd547c7f11d21a9675aaa35 | |
parent | 44549e8f5eea4e0a41b487b63e616cb089922b99 (diff) |
drivers: usb: Add bus scaling suppporttracking-qcomlt-usb
Add msm bus scaling support and hack to request
max bandwith at probe
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
-rw-r--r-- | drivers/usb/phy/phy-msm-usb.c | 28 | ||||
-rw-r--r-- | include/linux/usb/msm_hsusb.h | 16 |
2 files changed, 44 insertions, 0 deletions
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 72b387d592c27..861d1db276f61 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -45,6 +45,7 @@ #include <linux/usb/msm_hsusb.h> #include <linux/usb/msm_hsusb_hw.h> #include <linux/regulator/consumer.h> +#include <linux/msm-bus.h> #define MSM_USB_BASE (motg->regs) #define DRIVER_NAME "msm_otg" @@ -1635,6 +1636,19 @@ static int msm_otg_reboot_notify(struct notifier_block *this, return NOTIFY_DONE; } +static void msm_otg_bus_vote(struct msm_otg *motg, enum usb_bus_vote vote) +{ + int ret; + + if (motg->bus_perf_client) { + ret = msm_bus_scale_client_update_request( + motg->bus_perf_client, vote); + if (ret) + dev_err(motg->phy.dev, "%s: Failed to vote (%d)\n" + "for bus bw %d\n", __func__, vote, ret); + } +} + static int msm_otg_probe(struct platform_device *pdev) { struct regulator_bulk_data regs[3]; @@ -1792,6 +1806,19 @@ static int msm_otg_probe(struct platform_device *pdev) goto disable_ldo; } + motg->pdata->bus_scale_table = msm_bus_cl_get_pdata(pdev); + if (!motg->pdata->bus_scale_table) + dev_dbg(&pdev->dev, "bus scaling is disabled\n"); + else { + motg->bus_perf_client = + msm_bus_scale_register_client(motg->pdata->bus_scale_table); + if (!motg->bus_perf_client) + dev_err(motg->phy.dev, "%s: Failed to register BUS\n" + "scaling client!!\n", __func__); + } + /* Hack to max out usb performace */ + msm_otg_bus_vote(motg, USB_MAX_PERF_VOTE); + platform_set_drvdata(pdev, motg); device_init_wakeup(&pdev->dev, 1); @@ -1867,6 +1894,7 @@ static int msm_otg_remove(struct platform_device *pdev) usb_remove_phy(phy); disable_irq(motg->irq); + msm_bus_scale_unregister_client(motg->bus_perf_client); /* * Put PHY in low power mode. diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 8c8f6854c993b..e1cee47b8c048 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h @@ -99,6 +99,20 @@ enum usb_chg_type { }; /** + * Requested USB votes for BUS bandwidth + * + * USB_NO_PERF_VOTE BUS Vote for inactive USB session or disconnect + * USB_MAX_PERF_VOTE Maximum BUS bandwidth vote + * USB_MIN_PERF_VOTE Minimum BUS bandwidth vote (for some hw same as NO_PERF) + * + */ +enum usb_bus_vote { + USB_NO_PERF_VOTE = 0, + USB_MAX_PERF_VOTE, + USB_MIN_PERF_VOTE, +}; + +/** * struct msm_otg_platform_data - platform device data * for msm_otg driver. * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as @@ -114,6 +128,7 @@ struct msm_otg_platform_data { int phy_init_sz; void (*vbus_power)(bool on); unsigned power_budget; + struct msm_bus_scale_pdata *bus_scale_table; enum usb_dr_mode mode; enum otg_control_type otg_control; enum msm_usb_phy_type phy_type; @@ -195,6 +210,7 @@ struct msm_otg { struct gpio_desc *switch_gpio; struct notifier_block reboot; + uint32_t bus_perf_client; }; #endif |