diff options
author | Neil Patel <neilp@nvidia.com> | 2014-03-26 10:41:07 -0400 |
---|---|---|
committer | Steve Lin <stlin@nvidia.com> | 2014-03-26 13:13:07 -0700 |
commit | 8aa3ef6c308b70cba6b270542221d7f16b61585c (patch) | |
tree | c70a6478422db2cb19907015be7195173efcb380 /drivers/misc/tegra-baseband | |
parent | 82a9c9c8c6591a2bcd54df72f7ccb748ffc9fcd6 (diff) |
misc: tegra-baseband: remove legacy edp code
With the new sysedp framework in place the older EDP framework code
has been removed. The modem driver references to the old framework
are removed in this patch.
Bug 1486840
Change-Id: Ieeaa5cbce9d493a145db56389f17bae5ece2b7eb
Signed-off-by: Neil Patel <neilp@nvidia.com>
Reviewed-on: http://git-master/r/385657
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Owain Jones <ojones@nvidia.com>
Reviewed-by: Steve Lin <stlin@nvidia.com>
Diffstat (limited to 'drivers/misc/tegra-baseband')
-rw-r--r-- | drivers/misc/tegra-baseband/tegra_usb_modem_power.c | 325 |
1 files changed, 0 insertions, 325 deletions
diff --git a/drivers/misc/tegra-baseband/tegra_usb_modem_power.c b/drivers/misc/tegra-baseband/tegra_usb_modem_power.c index feb9377686a6..b6772395b606 100644 --- a/drivers/misc/tegra-baseband/tegra_usb_modem_power.c +++ b/drivers/misc/tegra-baseband/tegra_usb_modem_power.c @@ -31,7 +31,6 @@ #include <linux/wakelock.h> #include <linux/pm_qos.h> #include <linux/regulator/consumer.h> -#include <linux/edp.h> #include <linux/sysedp.h> #include <mach/gpio-tegra.h> #include <linux/platform_data/tegra_usb_modem_power.h> @@ -76,18 +75,6 @@ struct tegra_usb_modem { int short_autosuspend_enabled; struct platform_device *hc; /* USB host controller */ struct mutex hc_lock; - struct edp_client *modem_boot_edp_client; - struct edp_client modem_edp_client; - unsigned int modem_edp_states[MAX_MODEM_EDP_STATES]; - int edp_client_registered; - int edp_boot_client_registered; - int edp_initialized; - char *edp_manager_name; - unsigned int i_breach_ppm; /* percent time current exceeds i_thresh */ - unsigned int i_thresh_3g_adjperiod; /* 3g i_thresh adj period */ - unsigned int i_thresh_lte_adjperiod; /* lte i_thresh adj period */ - struct work_struct edp_work; - struct mutex edp_lock; struct sysedp_consumer *sysedpc; unsigned int sysedpc_state_updated; struct work_struct sysedp_work; @@ -140,56 +127,6 @@ static void cpu_freq_boost(struct work_struct *ws) msecs_to_jiffies(BOOST_CPU_FREQ_TIMEOUT)); } -static void edp_work(struct work_struct *ws) -{ - struct tegra_usb_modem *modem = container_of(ws, struct tegra_usb_modem, - edp_work); - struct edp_manager *mgr; - int ret; - - mutex_lock(&modem->edp_lock); - if (!modem->edp_client_registered && - modem->edp_boot_client_registered) { - pr_err("modem boot client already registered\n"); - goto done; - } - - /* unregister modem client */ - ret = edp_unregister_client(&modem->modem_edp_client); - if (ret) { - pr_err("edp unregistration failed\n"); - goto done; - } - - modem->edp_client_registered = 0; - - /* register modem boot client */ - mgr = edp_get_manager(modem->edp_manager_name); - if (!mgr) { - pr_err("can't get edp manager\n"); - goto done; - } - - ret = edp_register_client(mgr, modem->modem_boot_edp_client); - if (ret) { - pr_err("unable to register modem boot edp client\n"); - goto done; - } - - /* request E0 */ - ret = edp_update_client_request(modem->modem_boot_edp_client, - 0, NULL); - if (ret) { - pr_err("unable to set E0 state\n"); - goto done; - } - - modem->edp_boot_client_registered = 1; - -done: - mutex_unlock(&modem->edp_lock); -} - static void sysedp_work(struct work_struct *ws) { struct tegra_usb_modem *modem = container_of(ws, struct tegra_usb_modem, @@ -254,9 +191,6 @@ static irqreturn_t tegra_usb_modem_boot_thread(int irq, void *data) if (!work_pending(&modem->cpu_boost_work)) queue_work(modem->wq, &modem->cpu_boost_work); - if (modem->edp_initialized && !v) - queue_work(modem->wq, &modem->edp_work); - if (modem->sysedpc && !modem->sysedpc_state_updated) queue_work(modem->wq, &modem->sysedp_work); @@ -578,189 +512,6 @@ static ssize_t load_unload_usb_host(struct device *dev, static DEVICE_ATTR(load_host, S_IRUSR | S_IWUSR, show_usb_host, load_unload_usb_host); -#define EDP_INT_ATTR(field) \ -static ssize_t \ -field ## _show(struct device *pdev, struct device_attribute *attr, \ - char *buf) \ -{ \ - struct tegra_usb_modem *modem = dev_get_drvdata(pdev); \ - \ - if (!modem) \ - return -EAGAIN; \ - \ - return sprintf(buf, "%d\n", modem->field); \ -} \ -static DEVICE_ATTR(field, S_IRUSR, field ## _show, NULL); - -EDP_INT_ATTR(i_breach_ppm); -EDP_INT_ATTR(i_thresh_3g_adjperiod); -EDP_INT_ATTR(i_thresh_lte_adjperiod); - -static ssize_t i_max_show(struct device *pdev, struct device_attribute *attr, - char *buf) -{ - struct tegra_usb_modem *modem = dev_get_drvdata(pdev); - int i = 0; - int count = 0; - - mutex_lock(&modem->edp_lock); - for (i = 0; i < MAX_MODEM_EDP_STATES; i++) { - if (modem->modem_edp_states[i] <= 0) - break; - - count += sprintf(&buf[count], "%d ", - modem->modem_edp_states[i]); - } - mutex_unlock(&modem->edp_lock); - - count += sprintf(&buf[count], "\n"); - - return count; -} - -static ssize_t i_max_store(struct device *pdev, struct device_attribute *attr, - const char *buff, size_t size) -{ - struct tegra_usb_modem *modem; - char *s, *state_i_max, buf[50]; - unsigned int num_states = 0; - struct edp_manager *mgr; - int ret; - - modem = (struct tegra_usb_modem *)dev_get_drvdata(pdev); - - mutex_lock(&modem->edp_lock); - - /* client should only be registered once per modem boot */ - if (modem->edp_client_registered) { - pr_err("modem edp client already registered\n"); - ret = -EBUSY; - goto done; - } - - memset(modem->modem_edp_states, 0, sizeof(modem->modem_edp_states)); - memset(&modem->modem_edp_client, 0, sizeof(modem->modem_edp_client)); - - /* retrieve max current for supported states */ - strlcpy(buf, buff, sizeof(buf)); - s = strim(buf); - while (s && (num_states < MAX_MODEM_EDP_STATES)) { - state_i_max = strsep(&s, ","); - ret = kstrtoul(state_i_max, 10, - (unsigned long *)&modem->modem_edp_states[num_states]); - if (ret) { - pr_err("invalid modem state-current setting\n"); - goto done; - } - num_states++; - } - - if (s && (num_states == MAX_MODEM_EDP_STATES)) { - pr_err("number of modem EDP states exceeded max\n"); - ret = -EINVAL; - goto done; - } - - strncpy(modem->modem_edp_client.name, "modem", EDP_NAME_LEN); - modem->modem_edp_client.name[EDP_NAME_LEN - 1] = '\0'; - modem->modem_edp_client.states = modem->modem_edp_states; - modem->modem_edp_client.num_states = num_states; - modem->modem_edp_client.e0_index = 0; - modem->modem_edp_client.priority = EDP_MAX_PRIO; - - mgr = edp_get_manager(modem->edp_manager_name); - if (!mgr) { - dev_err(pdev, "can't get edp manager\n"); - ret = -EINVAL; - goto done; - } - - /* register modem client */ - ret = edp_register_client(mgr, &modem->modem_edp_client); - if (ret) { - dev_err(pdev, "unable to register modem edp client\n"); - goto done; - } - modem->edp_client_registered = 1; - - /* unregister modem_boot_client */ - ret = edp_unregister_client(modem->modem_boot_edp_client); - if (ret) { - dev_err(pdev, "unable to register modem boot edp client\n"); - goto done; - } - - modem->edp_boot_client_registered = 0; - ret = size; - -done: - mutex_unlock(&modem->edp_lock); - return ret; -} -static DEVICE_ATTR(i_max, S_IRUSR | S_IWUSR, i_max_show, i_max_store); - -static ssize_t request_store(struct device *pdev, struct device_attribute *attr, - const char *buff, size_t size) -{ - struct tegra_usb_modem *modem = dev_get_drvdata(pdev); - struct edp_client *c; - unsigned int id; - int ret; - - if (sscanf(buff, "%u", &id) != 1) - return -EINVAL; - - if (!modem->edp_client_registered) - return -EINVAL; - - c = &modem->modem_edp_client; - if (id >= c->num_states) - return -EINVAL; - - ret = edp_update_client_request(c, id, NULL); - if (ret) - dev_err(pdev, "state update to %u failed\n", id); - else - ret = size; - - return ret; -} -static DEVICE_ATTR(request, S_IWUSR, NULL, request_store); - -static ssize_t threshold_store(struct device *pdev, - struct device_attribute *attr, - const char *buff, size_t size) -{ - struct tegra_usb_modem *modem = dev_get_drvdata(pdev); - unsigned int tv; - int ret; - - if (sscanf(buff, "%u", &tv) != 1) - return -EINVAL; - - if (!modem->edp_client_registered) - return -EINVAL; - - ret = edp_update_loan_threshold(&modem->modem_edp_client, tv); - if (ret) - dev_err(pdev, "threshold update to %u failed\n", tv); - else - ret = size; - - return ret; -} -static DEVICE_ATTR(threshold, S_IWUSR, NULL, threshold_store); - -static struct device_attribute *edp_attributes[] = { - &dev_attr_i_breach_ppm, - &dev_attr_i_thresh_3g_adjperiod, - &dev_attr_i_thresh_lte_adjperiod, - &dev_attr_i_max, - &dev_attr_request, - &dev_attr_threshold, - NULL -}; - static struct tegra_usb_phy_platform_ops tegra_usb_modem_platform_ops = { .post_remote_wakeup = tegra_usb_modem_post_remote_wakeup, }; @@ -770,9 +521,6 @@ static int mdm_init(struct tegra_usb_modem *modem, struct platform_device *pdev) struct tegra_usb_modem_power_platform_data *pdata = pdev->dev.platform_data; int ret = 0; - struct edp_manager *mgr; - struct device_attribute **edp_attrs; - struct device_attribute *attr; modem->pdata = pdata; modem->pdev = pdev; @@ -793,54 +541,6 @@ static int mdm_init(struct tegra_usb_modem *modem, struct platform_device *pdev) } } - if (pdata->modem_boot_edp_client && pdata->edp_manager_name) { - mutex_init(&modem->edp_lock); - - /* register modem boot client */ - modem->edp_manager_name = pdata->edp_manager_name; - mgr = edp_get_manager(pdata->edp_manager_name); - if (!mgr) { - dev_err(&pdev->dev, "can't get edp manager\n"); - goto error; - } - - modem->modem_boot_edp_client = pdata->modem_boot_edp_client; - ret = edp_register_client(mgr, modem->modem_boot_edp_client); - if (ret) { - dev_err(&pdev->dev, - "unable to register modem boot edp client\n"); - goto error; - } - - /* request E0 */ - ret = edp_update_client_request(modem->modem_boot_edp_client, - 0, NULL); - if (ret) { - dev_err(&pdev->dev, - "unable to set e0 state\n"); - goto error; - } - - modem->edp_boot_client_registered = 1; - - modem->i_breach_ppm = pdata->i_breach_ppm; - modem->i_thresh_3g_adjperiod = pdata->i_thresh_3g_adjperiod; - modem->i_thresh_lte_adjperiod = pdata->i_thresh_lte_adjperiod; - - edp_attrs = edp_attributes; - while ((attr = *edp_attrs++)) { - ret = device_create_file(&pdev->dev, attr); - if (ret) { - dev_err(&pdev->dev, "can't create sysfs file\n"); - goto error; - } - } - - INIT_WORK(&modem->edp_work, edp_work); - - modem->edp_initialized = 1; - } - if (pdata->sysedpc_name) { modem->sysedpc = sysedp_create_consumer(pdata->sysedpc_name, pdata->sysedpc_name); @@ -947,15 +647,6 @@ error: sysedp_free_consumer(modem->sysedpc); } - if (modem->edp_initialized) { - edp_attrs = edp_attributes; - while ((attr = *edp_attrs++)) - device_remove_file(&pdev->dev, attr); - } - - if (modem->edp_boot_client_registered) - edp_unregister_client(modem->modem_boot_edp_client); - if (!IS_ERR(modem->regulator)) regulator_put(modem->regulator); @@ -994,8 +685,6 @@ static int tegra_usb_modem_probe(struct platform_device *pdev) static int __exit tegra_usb_modem_remove(struct platform_device *pdev) { struct tegra_usb_modem *modem = platform_get_drvdata(pdev); - struct device_attribute **edp_attrs; - struct device_attribute *attr; unregister_pm_notifier(&modem->pm_notifier); usb_unregister_notify(&modem->usb_notifier); @@ -1014,20 +703,6 @@ static int __exit tegra_usb_modem_remove(struct platform_device *pdev) sysedp_free_consumer(modem->sysedpc); } - if (modem->edp_initialized) { - cancel_work_sync(&modem->edp_work); - - edp_attrs = edp_attributes; - while ((attr = *edp_attrs++)) - device_remove_file(&pdev->dev, attr); - } - - if (modem->edp_boot_client_registered) - edp_unregister_client(modem->modem_boot_edp_client); - - if (modem->edp_client_registered) - edp_unregister_client(&modem->modem_edp_client); - if (!IS_ERR(modem->regulator)) regulator_put(modem->regulator); |