Loading drivers/gpu/msm/adreno.c +7 −32 Original line number Diff line number Diff line Loading @@ -2019,31 +2019,6 @@ int adreno_reset(struct kgsl_device *device) return ret; } /** * _ft_sysfs_store() - Common routine to write to FT sysfs files * @buf: value to write * @count: size of the value to write * @ptr: pointer to config to write * * This is a common routine to write to FT sysfs files. */ static ssize_t _ft_sysfs_store(const char *buf, size_t count, unsigned int *ptr) { char temp[20]; unsigned long val; int rc; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = kstrtoul(temp, 0, &val); if (rc) return rc; *ptr = val; return count; } /** * _get_adreno_dev() - Routine to get a pointer to adreno dev * @dev: device ptr Loading Loading @@ -2081,7 +2056,7 @@ static ssize_t _ft_policy_store(struct device *dev, return 0; mutex_lock(&adreno_dev->dev.mutex); ret = _ft_sysfs_store(buf, count, &adreno_dev->ft_policy); ret = kgsl_sysfs_store(buf, count, &adreno_dev->ft_policy); mutex_unlock(&adreno_dev->dev.mutex); return ret; Loading Loading @@ -2132,7 +2107,7 @@ static ssize_t _ft_pagefault_policy_store(struct device *dev, return 0; mutex_lock(&adreno_dev->dev.mutex); ret = _ft_sysfs_store(buf, count, &adreno_dev->ft_pf_policy); ret = kgsl_sysfs_store(buf, count, &adreno_dev->ft_pf_policy); mutex_unlock(&adreno_dev->dev.mutex); return ret; Loading Loading @@ -2182,7 +2157,7 @@ static ssize_t _ft_fast_hang_detect_store(struct device *dev, tmp = adreno_dev->fast_hang_detect; ret = _ft_sysfs_store(buf, count, &adreno_dev->fast_hang_detect); ret = kgsl_sysfs_store(buf, count, &adreno_dev->fast_hang_detect); if (tmp != adreno_dev->fast_hang_detect) { if (adreno_dev->fast_hang_detect) { Loading Loading @@ -2241,7 +2216,7 @@ static ssize_t _ft_long_ib_detect_store(struct device *dev, return 0; mutex_lock(&adreno_dev->dev.mutex); ret = _ft_sysfs_store(buf, count, &adreno_dev->long_ib_detect); ret = kgsl_sysfs_store(buf, count, &adreno_dev->long_ib_detect); mutex_unlock(&adreno_dev->dev.mutex); return ret; Loading Loading @@ -2278,7 +2253,7 @@ static ssize_t _ft_hang_intr_status_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned int new_setting, old_setting; unsigned int new_setting = 0, old_setting; struct kgsl_device *device = kgsl_device_from_dev(dev); struct adreno_device *adreno_dev; int ret; Loading @@ -2287,7 +2262,7 @@ static ssize_t _ft_hang_intr_status_store(struct device *dev, adreno_dev = ADRENO_DEVICE(device); mutex_lock(&device->mutex); ret = _ft_sysfs_store(buf, count, &new_setting); ret = kgsl_sysfs_store(buf, count, &new_setting); if (ret != count) goto done; if (new_setting) Loading Loading @@ -2369,7 +2344,7 @@ static ssize_t _wake_timeout_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { return _ft_sysfs_store(buf, count, &_wake_timeout); return kgsl_sysfs_store(buf, count, &_wake_timeout); } /** Loading drivers/gpu/msm/adreno_dispatch.c +5 −4 Original line number Diff line number Diff line Loading @@ -1594,10 +1594,11 @@ static ssize_t _store_uint(struct adreno_dispatcher *dispatcher, struct dispatcher_attribute *attr, const char *buf, size_t size) { unsigned long val; int ret = kstrtoul(buf, 0, &val); unsigned int val = 0; int ret; if (ret) ret = kgsl_sysfs_store(buf, size, &val); if (ret != size) return ret; if (!val || (attr->max && (val > attr->max))) Loading @@ -1611,7 +1612,7 @@ static ssize_t _show_uint(struct adreno_dispatcher *dispatcher, struct dispatcher_attribute *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", return snprintf(buf, PAGE_SIZE, "%u\n", *((unsigned int *) attr->value)); } Loading drivers/gpu/msm/kgsl_device.h +21 −0 Original line number Diff line number Diff line Loading @@ -760,4 +760,25 @@ static inline int kgsl_property_read_u32(struct kgsl_device *device, return of_property_read_u32(pdev->dev.of_node, prop, ptr); } /** * kgsl_sysfs_store() - parse a string from a sysfs store function * @buf: Incoming string to parse * @count: Size of the incoming string * @ptr: Pointer to an unsigned int to store the value */ static inline ssize_t kgsl_sysfs_store(const char *buf, size_t count, unsigned int *ptr) { unsigned int val; int rc; rc = kstrtou32(buf, 0, &val); if (rc) return rc; if (ptr) *ptr = val; return count; } #endif /* __KGSL_DEVICE_H */ drivers/gpu/msm/kgsl_pwrctrl.c +42 −65 Original line number Diff line number Diff line Loading @@ -216,19 +216,18 @@ static ssize_t kgsl_pwrctrl_thermal_pwrlevel_store(struct device *dev, { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; int ret, level; int ret; unsigned int level = 0; if (device == NULL) return 0; pwr = &device->pwrctrl; ret = sscanf(buf, "%d", &level); if (ret != 1) return count; ret = kgsl_sysfs_store(buf, count, &level); if (level < 0) return count; if (ret != count) return ret; mutex_lock(&device->mutex); Loading Loading @@ -270,20 +269,16 @@ static ssize_t kgsl_pwrctrl_max_pwrlevel_store(struct device *dev, { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; int ret, level, max_level; int ret, level = 0, max_level; if (device == NULL) return 0; pwr = &device->pwrctrl; ret = sscanf(buf, "%d", &level); if (ret != 1) return count; /* If the use specifies a negative number, then don't change anything */ if (level < 0) return count; ret = kgsl_sysfs_store(buf, count, &level); if (ret != count) return ret; mutex_lock(&device->mutex); Loading Loading @@ -325,20 +320,16 @@ static ssize_t kgsl_pwrctrl_min_pwrlevel_store(struct device *dev, const char *buf, size_t count) { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; int ret, level, min_level; int ret, level = 0, min_level; if (device == NULL) return 0; pwr = &device->pwrctrl; ret = sscanf(buf, "%d", &level); if (ret != 1) return count; /* Don't do anything on obviously incorrect values */ if (level < 0) return count; ret = kgsl_sysfs_store(buf, count, &level); if (ret != count) return ret; mutex_lock(&device->mutex); if (level > pwr->num_pwrlevels - 2) Loading Loading @@ -409,7 +400,7 @@ static ssize_t kgsl_pwrctrl_max_gpuclk_store(struct device *dev, { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; unsigned long val; unsigned int val = 0; int ret, level; if (device == NULL) Loading @@ -417,9 +408,9 @@ static ssize_t kgsl_pwrctrl_max_gpuclk_store(struct device *dev, pwr = &device->pwrctrl; ret = sscanf(buf, "%ld", &val); if (ret != 1) return count; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); level = _get_nearest_pwrlevel(pwr, val); Loading Loading @@ -461,7 +452,7 @@ static ssize_t kgsl_pwrctrl_gpuclk_store(struct device *dev, { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; unsigned long val; unsigned int val = 0; int ret, level; if (device == NULL) Loading @@ -469,9 +460,9 @@ static ssize_t kgsl_pwrctrl_gpuclk_store(struct device *dev, pwr = &device->pwrctrl; ret = sscanf(buf, "%ld", &val); if (ret != 1) return count; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); level = _get_nearest_pwrlevel(pwr, val); Loading @@ -498,28 +489,23 @@ static ssize_t kgsl_pwrctrl_idle_timer_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { char temp[20]; unsigned long val; unsigned int val = 0; struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; const long div = 1000/HZ; int rc; int ret; if (device == NULL) return 0; pwr = &device->pwrctrl; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = strict_strtoul(temp, 0, &val); if (rc) return rc; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); /* Let the timeout be requested in ms, but convert to jiffies. */ val /= div; pwr->interval_timeout = val; device->pwrctrl.interval_timeout = val; mutex_unlock(&device->mutex); Loading @@ -543,19 +529,16 @@ static ssize_t kgsl_pwrctrl_pmqos_latency_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { char temp[20]; unsigned long val; unsigned int val = 0; struct kgsl_device *device = kgsl_device_from_dev(dev); int rc; int ret; if (device == NULL) return 0; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = kstrtoul(temp, 0, &val); if (rc) return rc; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); device->pwrctrl.pm_qos_latency = val; Loading Loading @@ -690,19 +673,16 @@ static ssize_t __force_on_store(struct device *dev, const char *buf, size_t count, int flag) { char temp[20]; unsigned long val; unsigned int val = 0; struct kgsl_device *device = kgsl_device_from_dev(dev); int rc; int ret; if (device == NULL) return 0; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = kstrtoul(temp, 0, &val); if (rc) return rc; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); __force_on(device, flag, val); Loading Loading @@ -768,19 +748,16 @@ static ssize_t kgsl_pwrctrl_bus_split_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { char temp[20]; unsigned long val; unsigned int val = 0; struct kgsl_device *device = kgsl_device_from_dev(dev); int rc; int ret; if (device == NULL) return 0; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = kstrtoul(temp, 0, &val); if (rc) return rc; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); device->pwrctrl.bus_control = val ? true : false; Loading drivers/gpu/msm/kgsl_sharedmem.c +5 −5 Original line number Diff line number Diff line Loading @@ -256,13 +256,13 @@ static ssize_t kgsl_drv_full_cache_threshold_store(struct device *dev, const char *buf, size_t count) { int ret; unsigned int thresh; ret = sscanf(buf, "%d", &thresh); if (ret != 1) return count; unsigned int thresh = 0; kgsl_driver.full_cache_threshold = thresh; ret = kgsl_sysfs_store(buf, count, &thresh); if (ret != count) return ret; kgsl_driver.full_cache_threshold = thresh; return count; } Loading Loading
drivers/gpu/msm/adreno.c +7 −32 Original line number Diff line number Diff line Loading @@ -2019,31 +2019,6 @@ int adreno_reset(struct kgsl_device *device) return ret; } /** * _ft_sysfs_store() - Common routine to write to FT sysfs files * @buf: value to write * @count: size of the value to write * @ptr: pointer to config to write * * This is a common routine to write to FT sysfs files. */ static ssize_t _ft_sysfs_store(const char *buf, size_t count, unsigned int *ptr) { char temp[20]; unsigned long val; int rc; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = kstrtoul(temp, 0, &val); if (rc) return rc; *ptr = val; return count; } /** * _get_adreno_dev() - Routine to get a pointer to adreno dev * @dev: device ptr Loading Loading @@ -2081,7 +2056,7 @@ static ssize_t _ft_policy_store(struct device *dev, return 0; mutex_lock(&adreno_dev->dev.mutex); ret = _ft_sysfs_store(buf, count, &adreno_dev->ft_policy); ret = kgsl_sysfs_store(buf, count, &adreno_dev->ft_policy); mutex_unlock(&adreno_dev->dev.mutex); return ret; Loading Loading @@ -2132,7 +2107,7 @@ static ssize_t _ft_pagefault_policy_store(struct device *dev, return 0; mutex_lock(&adreno_dev->dev.mutex); ret = _ft_sysfs_store(buf, count, &adreno_dev->ft_pf_policy); ret = kgsl_sysfs_store(buf, count, &adreno_dev->ft_pf_policy); mutex_unlock(&adreno_dev->dev.mutex); return ret; Loading Loading @@ -2182,7 +2157,7 @@ static ssize_t _ft_fast_hang_detect_store(struct device *dev, tmp = adreno_dev->fast_hang_detect; ret = _ft_sysfs_store(buf, count, &adreno_dev->fast_hang_detect); ret = kgsl_sysfs_store(buf, count, &adreno_dev->fast_hang_detect); if (tmp != adreno_dev->fast_hang_detect) { if (adreno_dev->fast_hang_detect) { Loading Loading @@ -2241,7 +2216,7 @@ static ssize_t _ft_long_ib_detect_store(struct device *dev, return 0; mutex_lock(&adreno_dev->dev.mutex); ret = _ft_sysfs_store(buf, count, &adreno_dev->long_ib_detect); ret = kgsl_sysfs_store(buf, count, &adreno_dev->long_ib_detect); mutex_unlock(&adreno_dev->dev.mutex); return ret; Loading Loading @@ -2278,7 +2253,7 @@ static ssize_t _ft_hang_intr_status_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned int new_setting, old_setting; unsigned int new_setting = 0, old_setting; struct kgsl_device *device = kgsl_device_from_dev(dev); struct adreno_device *adreno_dev; int ret; Loading @@ -2287,7 +2262,7 @@ static ssize_t _ft_hang_intr_status_store(struct device *dev, adreno_dev = ADRENO_DEVICE(device); mutex_lock(&device->mutex); ret = _ft_sysfs_store(buf, count, &new_setting); ret = kgsl_sysfs_store(buf, count, &new_setting); if (ret != count) goto done; if (new_setting) Loading Loading @@ -2369,7 +2344,7 @@ static ssize_t _wake_timeout_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { return _ft_sysfs_store(buf, count, &_wake_timeout); return kgsl_sysfs_store(buf, count, &_wake_timeout); } /** Loading
drivers/gpu/msm/adreno_dispatch.c +5 −4 Original line number Diff line number Diff line Loading @@ -1594,10 +1594,11 @@ static ssize_t _store_uint(struct adreno_dispatcher *dispatcher, struct dispatcher_attribute *attr, const char *buf, size_t size) { unsigned long val; int ret = kstrtoul(buf, 0, &val); unsigned int val = 0; int ret; if (ret) ret = kgsl_sysfs_store(buf, size, &val); if (ret != size) return ret; if (!val || (attr->max && (val > attr->max))) Loading @@ -1611,7 +1612,7 @@ static ssize_t _show_uint(struct adreno_dispatcher *dispatcher, struct dispatcher_attribute *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%d\n", return snprintf(buf, PAGE_SIZE, "%u\n", *((unsigned int *) attr->value)); } Loading
drivers/gpu/msm/kgsl_device.h +21 −0 Original line number Diff line number Diff line Loading @@ -760,4 +760,25 @@ static inline int kgsl_property_read_u32(struct kgsl_device *device, return of_property_read_u32(pdev->dev.of_node, prop, ptr); } /** * kgsl_sysfs_store() - parse a string from a sysfs store function * @buf: Incoming string to parse * @count: Size of the incoming string * @ptr: Pointer to an unsigned int to store the value */ static inline ssize_t kgsl_sysfs_store(const char *buf, size_t count, unsigned int *ptr) { unsigned int val; int rc; rc = kstrtou32(buf, 0, &val); if (rc) return rc; if (ptr) *ptr = val; return count; } #endif /* __KGSL_DEVICE_H */
drivers/gpu/msm/kgsl_pwrctrl.c +42 −65 Original line number Diff line number Diff line Loading @@ -216,19 +216,18 @@ static ssize_t kgsl_pwrctrl_thermal_pwrlevel_store(struct device *dev, { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; int ret, level; int ret; unsigned int level = 0; if (device == NULL) return 0; pwr = &device->pwrctrl; ret = sscanf(buf, "%d", &level); if (ret != 1) return count; ret = kgsl_sysfs_store(buf, count, &level); if (level < 0) return count; if (ret != count) return ret; mutex_lock(&device->mutex); Loading Loading @@ -270,20 +269,16 @@ static ssize_t kgsl_pwrctrl_max_pwrlevel_store(struct device *dev, { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; int ret, level, max_level; int ret, level = 0, max_level; if (device == NULL) return 0; pwr = &device->pwrctrl; ret = sscanf(buf, "%d", &level); if (ret != 1) return count; /* If the use specifies a negative number, then don't change anything */ if (level < 0) return count; ret = kgsl_sysfs_store(buf, count, &level); if (ret != count) return ret; mutex_lock(&device->mutex); Loading Loading @@ -325,20 +320,16 @@ static ssize_t kgsl_pwrctrl_min_pwrlevel_store(struct device *dev, const char *buf, size_t count) { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; int ret, level, min_level; int ret, level = 0, min_level; if (device == NULL) return 0; pwr = &device->pwrctrl; ret = sscanf(buf, "%d", &level); if (ret != 1) return count; /* Don't do anything on obviously incorrect values */ if (level < 0) return count; ret = kgsl_sysfs_store(buf, count, &level); if (ret != count) return ret; mutex_lock(&device->mutex); if (level > pwr->num_pwrlevels - 2) Loading Loading @@ -409,7 +400,7 @@ static ssize_t kgsl_pwrctrl_max_gpuclk_store(struct device *dev, { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; unsigned long val; unsigned int val = 0; int ret, level; if (device == NULL) Loading @@ -417,9 +408,9 @@ static ssize_t kgsl_pwrctrl_max_gpuclk_store(struct device *dev, pwr = &device->pwrctrl; ret = sscanf(buf, "%ld", &val); if (ret != 1) return count; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); level = _get_nearest_pwrlevel(pwr, val); Loading Loading @@ -461,7 +452,7 @@ static ssize_t kgsl_pwrctrl_gpuclk_store(struct device *dev, { struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; unsigned long val; unsigned int val = 0; int ret, level; if (device == NULL) Loading @@ -469,9 +460,9 @@ static ssize_t kgsl_pwrctrl_gpuclk_store(struct device *dev, pwr = &device->pwrctrl; ret = sscanf(buf, "%ld", &val); if (ret != 1) return count; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); level = _get_nearest_pwrlevel(pwr, val); Loading @@ -498,28 +489,23 @@ static ssize_t kgsl_pwrctrl_idle_timer_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { char temp[20]; unsigned long val; unsigned int val = 0; struct kgsl_device *device = kgsl_device_from_dev(dev); struct kgsl_pwrctrl *pwr; const long div = 1000/HZ; int rc; int ret; if (device == NULL) return 0; pwr = &device->pwrctrl; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = strict_strtoul(temp, 0, &val); if (rc) return rc; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); /* Let the timeout be requested in ms, but convert to jiffies. */ val /= div; pwr->interval_timeout = val; device->pwrctrl.interval_timeout = val; mutex_unlock(&device->mutex); Loading @@ -543,19 +529,16 @@ static ssize_t kgsl_pwrctrl_pmqos_latency_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { char temp[20]; unsigned long val; unsigned int val = 0; struct kgsl_device *device = kgsl_device_from_dev(dev); int rc; int ret; if (device == NULL) return 0; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = kstrtoul(temp, 0, &val); if (rc) return rc; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); device->pwrctrl.pm_qos_latency = val; Loading Loading @@ -690,19 +673,16 @@ static ssize_t __force_on_store(struct device *dev, const char *buf, size_t count, int flag) { char temp[20]; unsigned long val; unsigned int val = 0; struct kgsl_device *device = kgsl_device_from_dev(dev); int rc; int ret; if (device == NULL) return 0; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = kstrtoul(temp, 0, &val); if (rc) return rc; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); __force_on(device, flag, val); Loading Loading @@ -768,19 +748,16 @@ static ssize_t kgsl_pwrctrl_bus_split_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { char temp[20]; unsigned long val; unsigned int val = 0; struct kgsl_device *device = kgsl_device_from_dev(dev); int rc; int ret; if (device == NULL) return 0; snprintf(temp, sizeof(temp), "%.*s", (int)min(count, sizeof(temp) - 1), buf); rc = kstrtoul(temp, 0, &val); if (rc) return rc; ret = kgsl_sysfs_store(buf, count, &val); if (ret != count) return ret; mutex_lock(&device->mutex); device->pwrctrl.bus_control = val ? true : false; Loading
drivers/gpu/msm/kgsl_sharedmem.c +5 −5 Original line number Diff line number Diff line Loading @@ -256,13 +256,13 @@ static ssize_t kgsl_drv_full_cache_threshold_store(struct device *dev, const char *buf, size_t count) { int ret; unsigned int thresh; ret = sscanf(buf, "%d", &thresh); if (ret != 1) return count; unsigned int thresh = 0; kgsl_driver.full_cache_threshold = thresh; ret = kgsl_sysfs_store(buf, count, &thresh); if (ret != count) return ret; kgsl_driver.full_cache_threshold = thresh; return count; } Loading