Loading Documentation/devicetree/bindings/devfreq/devbw.txt +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ Optional properties: enforced only when the CPU subsystem is active. - governor: Initial governor to use for the device. Default: "performance" - qcom,ab-percent: Indicates a value in percent of instantaneous bandwidth which will be used to calculate the absolute/average bandwidth. Example: Loading drivers/devfreq/devfreq_devbw.c +21 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ struct dev_data { int cur_ab; int cur_ib; long gov_ab; unsigned int ab_percent; struct devfreq *df; struct devfreq_dev_profile dp; }; Loading Loading @@ -78,6 +79,11 @@ static int set_bw(struct device *dev, int new_ib, int new_ab) return ret; } static unsigned int find_ab(struct dev_data *d, unsigned long *freq) { return (d->ab_percent * (*freq)) / 100; } static void find_freq(struct devfreq_dev_profile *p, unsigned long *freq, u32 flags) { Loading Loading @@ -105,6 +111,10 @@ static int devbw_target(struct device *dev, unsigned long *freq, u32 flags) struct dev_data *d = dev_get_drvdata(dev); find_freq(&d->dp, freq, flags); if (!d->gov_ab) return set_bw(dev, *freq, find_ab(d, freq)); else return set_bw(dev, *freq, d->gov_ab); } Loading @@ -119,6 +129,7 @@ static int devbw_get_dev_status(struct device *dev, #define PROP_PORTS "qcom,src-dst-ports" #define PROP_TBL "qcom,bw-tbl" #define PROP_AB_PER "qcom,ab-percent" #define PROP_ACTIVE "qcom,active-only" int devfreq_add_devbw(struct device *dev) Loading Loading @@ -196,6 +207,15 @@ int devfreq_add_devbw(struct device *dev) p->max_state = len; } if (of_find_property(dev->of_node, PROP_AB_PER, &len)) { ret = of_property_read_u32(dev->of_node, PROP_AB_PER, &d->ab_percent); if (ret) return ret; dev_dbg(dev, "ab-percent used %u\n", d->ab_percent); } d->bus_client = msm_bus_scale_register_client(&d->bw_data); if (!d->bus_client) { dev_err(dev, "Unable to register bus client\n"); Loading Loading
Documentation/devicetree/bindings/devfreq/devbw.txt +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,9 @@ Optional properties: enforced only when the CPU subsystem is active. - governor: Initial governor to use for the device. Default: "performance" - qcom,ab-percent: Indicates a value in percent of instantaneous bandwidth which will be used to calculate the absolute/average bandwidth. Example: Loading
drivers/devfreq/devfreq_devbw.c +21 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ struct dev_data { int cur_ab; int cur_ib; long gov_ab; unsigned int ab_percent; struct devfreq *df; struct devfreq_dev_profile dp; }; Loading Loading @@ -78,6 +79,11 @@ static int set_bw(struct device *dev, int new_ib, int new_ab) return ret; } static unsigned int find_ab(struct dev_data *d, unsigned long *freq) { return (d->ab_percent * (*freq)) / 100; } static void find_freq(struct devfreq_dev_profile *p, unsigned long *freq, u32 flags) { Loading Loading @@ -105,6 +111,10 @@ static int devbw_target(struct device *dev, unsigned long *freq, u32 flags) struct dev_data *d = dev_get_drvdata(dev); find_freq(&d->dp, freq, flags); if (!d->gov_ab) return set_bw(dev, *freq, find_ab(d, freq)); else return set_bw(dev, *freq, d->gov_ab); } Loading @@ -119,6 +129,7 @@ static int devbw_get_dev_status(struct device *dev, #define PROP_PORTS "qcom,src-dst-ports" #define PROP_TBL "qcom,bw-tbl" #define PROP_AB_PER "qcom,ab-percent" #define PROP_ACTIVE "qcom,active-only" int devfreq_add_devbw(struct device *dev) Loading Loading @@ -196,6 +207,15 @@ int devfreq_add_devbw(struct device *dev) p->max_state = len; } if (of_find_property(dev->of_node, PROP_AB_PER, &len)) { ret = of_property_read_u32(dev->of_node, PROP_AB_PER, &d->ab_percent); if (ret) return ret; dev_dbg(dev, "ab-percent used %u\n", d->ab_percent); } d->bus_client = msm_bus_scale_register_client(&d->bw_data); if (!d->bus_client) { dev_err(dev, "Unable to register bus client\n"); Loading