Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fe7f363 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Remove PPD



Only one 4xx target supported PPD so remove the sysfs files
we don't need anymore.

Change-Id: Ic0dedbad063ba566dc90a0f747cd1809ccbeb257
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 49852411
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ static struct adreno_device device_3d0 = {
	.long_ib_detect = 1,
	.input_work = __WORK_INITIALIZER(device_3d0.input_work,
		adreno_input_work),
	.pwrctrl_flag = BIT(ADRENO_SPTP_PC_CTRL) | BIT(ADRENO_PPD_CTRL) |
	.pwrctrl_flag = BIT(ADRENO_SPTP_PC_CTRL) |
		BIT(ADRENO_LM_CTRL) | BIT(ADRENO_HWCG_CTRL) |
		BIT(ADRENO_THROTTLING_CTRL),
	.profile.enabled = false,
+4 −7
Original line number Diff line number Diff line
@@ -77,8 +77,6 @@
/* Adreno core features */
/* The core supports SP/TP hw controlled power collapse */
#define ADRENO_SPTP_PC BIT(3)
/* The core supports Peak Power Detection(PPD)*/
#define ADRENO_PPD BIT(4)
/* The GPU supports content protection */
#define ADRENO_CONTENT_PROTECTION BIT(5)
/* The GPU supports preemption */
@@ -223,11 +221,10 @@ enum adreno_gpurev {
#define ADRENO_CTX_DETATCH_TIMEOUT_FAULT BIT(6)

#define ADRENO_SPTP_PC_CTRL 0
#define ADRENO_PPD_CTRL     1
#define ADRENO_LM_CTRL      2
#define ADRENO_HWCG_CTRL    3
#define ADRENO_THROTTLING_CTRL 4
#define ADRENO_ACD_CTRL 5
#define ADRENO_LM_CTRL      1
#define ADRENO_HWCG_CTRL    2
#define ADRENO_THROTTLING_CTRL 3
#define ADRENO_ACD_CTRL 4

/* VBIF,  GBIF halt request and ack mask */
#define GBIF_HALT_REQUEST       0x1E0
+1 −8
Original line number Diff line number Diff line
@@ -1586,14 +1586,7 @@ static void a5xx_pwrlevel_change_settings(struct adreno_device *adreno_dev,
{
	int on = 0;

	/*
	 * On pre A540 HW only call through if PPD or LMx
	 * is supported and enabled
	 */
	if (ADRENO_FEATURE(adreno_dev, ADRENO_PPD) &&
		test_bit(ADRENO_PPD_CTRL, &adreno_dev->pwrctrl_flag))
		on = ADRENO_PPD;

	/* On pre A540 HW only call through if LMx is supported and enabled */
	if (ADRENO_FEATURE(adreno_dev, ADRENO_LM) &&
		test_bit(ADRENO_LM_CTRL, &adreno_dev->pwrctrl_flag))
		on = ADRENO_LM;
+1 −133
Original line number Diff line number Diff line
@@ -444,130 +444,6 @@ static const struct attribute *_attr_list[] = {
	NULL,
};

/* Add a ppd directory for controlling different knobs from sysfs */
struct adreno_ppd_attribute {
	struct attribute attr;
	ssize_t (*show)(struct kgsl_device *device, char *buf);
	ssize_t (*store)(struct kgsl_device *device, const char *buf,
		size_t count);
};

#define PPD_ATTR(_name, _mode, _show, _store) \
struct adreno_ppd_attribute attr_##_name = { \
	.attr = { .name = __stringify(_name), .mode = _mode }, \
	.show = _show, \
	.store = _store, \
}

#define to_ppd_attr(a) \
container_of((a), struct adreno_ppd_attribute, attr)

#define kobj_to_device(a) \
container_of((a), struct kgsl_device, ppd_kobj)

static ssize_t ppd_enable_store(struct kgsl_device *device,
				const char *buf, size_t count)
{
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
	unsigned int ppd_on = 0;
	int ret;

	if (!ADRENO_FEATURE(adreno_dev, ADRENO_PPD))
		return count;

	ret = kgsl_sysfs_store(buf, &ppd_on);
	if (ret < 0)
		return ret;

	ppd_on = (ppd_on) ? 1 : 0;

	if (ppd_on == test_bit(ADRENO_PPD_CTRL, &adreno_dev->pwrctrl_flag))
		return count;

	mutex_lock(&device->mutex);

	kgsl_pwrctrl_change_state(device, KGSL_STATE_SUSPEND);
	change_bit(ADRENO_PPD_CTRL, &adreno_dev->pwrctrl_flag);
	kgsl_pwrctrl_change_state(device, KGSL_STATE_SLUMBER);

	mutex_unlock(&device->mutex);
	return count;
}

static ssize_t ppd_enable_show(struct kgsl_device *device,
					char *buf)
{
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);

	return scnprintf(buf, PAGE_SIZE, "%u\n",
		test_bit(ADRENO_PPD_CTRL, &adreno_dev->pwrctrl_flag));
}
/* Add individual ppd attributes here */
static PPD_ATTR(enable, 0644, ppd_enable_show, ppd_enable_store);

static ssize_t ppd_sysfs_show(struct kobject *kobj,
	struct attribute *attr, char *buf)
{
	struct adreno_ppd_attribute *pattr = to_ppd_attr(attr);
	struct kgsl_device *device = kobj_to_device(kobj);
	ssize_t ret = -EIO;

	if (device != NULL && pattr->show != NULL)
		ret = pattr->show(device, buf);

	return ret;
}

static ssize_t ppd_sysfs_store(struct kobject *kobj,
	struct attribute *attr, const char *buf, size_t count)
{
	struct adreno_ppd_attribute *pattr = to_ppd_attr(attr);
	struct kgsl_device *device = kobj_to_device(kobj);
	ssize_t ret = -EIO;

	if (device != NULL && pattr->store != NULL)
		ret = pattr->store(device, buf, count);

	return ret;
}

static const struct sysfs_ops ppd_sysfs_ops = {
	.show = ppd_sysfs_show,
	.store = ppd_sysfs_store,
};

static struct kobj_type ktype_ppd = {
	.sysfs_ops = &ppd_sysfs_ops,
};

static void ppd_sysfs_close(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);

	if (!ADRENO_FEATURE(adreno_dev, ADRENO_PPD))
		return;

	sysfs_remove_file(&device->ppd_kobj, &attr_enable.attr);
	kobject_put(&device->ppd_kobj);
}

static int ppd_sysfs_init(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	int ret;

	if (!ADRENO_FEATURE(adreno_dev, ADRENO_PPD))
		return -ENODEV;

	ret = kobject_init_and_add(&device->ppd_kobj, &ktype_ppd,
		&device->dev->kobj, "ppd");

	if (ret == 0)
		ret = sysfs_create_file(&device->ppd_kobj, &attr_enable.attr);

	return ret;
}

/**
 * adreno_sysfs_close() - Take down the adreno sysfs files
 * @adreno_dev: Pointer to the adreno device
@@ -578,7 +454,6 @@ void adreno_sysfs_close(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);

	ppd_sysfs_close(adreno_dev);
	sysfs_remove_files(&device->dev->kobj, _attr_list);
}

@@ -592,14 +467,7 @@ void adreno_sysfs_close(struct adreno_device *adreno_dev)
int adreno_sysfs_init(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	int ret;

	ret = sysfs_create_files(&device->dev->kobj, _attr_list);

	/* Add the PPD directory and files */
	if (ret == 0)
		ppd_sysfs_init(adreno_dev);

	return 0;
	return sysfs_create_files(&device->dev->kobj, _attr_list);
}