guard(raw_spinlock_irqsave)(&drvdata->spinlock);
- /* no need to do anything if enabled or unpowered*/
- if (config->hw_enabled || !config->hw_powered)
+ /* no need to do anything if enabled */
+ if (config->hw_enabled)
goto cti_state_unchanged;
/* claim the device */
if (--drvdata->config.enable_req_count > 0)
return 0;
- /* no need to do anything if disabled or cpu unpowered */
- if (!config->hw_enabled || !config->hw_powered)
+ /* no need to do anything if disabled */
+ if (!config->hw_enabled)
return 0;
CS_UNLOCK(drvdata->base);
return PTR_ERR(pdata);
}
- /* default to powered - could change on PM notifications */
- drvdata->config.hw_powered = true;
-
/*
* Set up device name - will depend if cpu bound or otherwise.
*
char *buf)
{
int enable_req;
- bool enabled, powered;
struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
- scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock) {
+ scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock)
enable_req = drvdata->config.enable_req_count;
- powered = drvdata->config.hw_powered;
- enabled = drvdata->config.hw_enabled;
- }
- if (powered)
- return sprintf(buf, "%d\n", enabled);
- else
- return sprintf(buf, "%d\n", !!enable_req);
+ return sprintf(buf, "%d\n", !!enable_req);
}
static ssize_t enable_store(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- bool powered;
- struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
-
- scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock)
- powered = drvdata->config.hw_powered;
+ bool powered = pm_runtime_active(dev->parent);
return sprintf(buf, "%d\n", powered);
}
pm_runtime_get_sync(dev->parent);
- scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock) {
- if (drvdata->config.hw_powered)
- val = cti_read_single_reg(drvdata, cti_attr->off);
- }
+ scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock)
+ val = cti_read_single_reg(drvdata, cti_attr->off);
pm_runtime_put_sync(dev->parent);
return sysfs_emit(buf, "0x%x\n", val);
pm_runtime_get_sync(dev->parent);
- scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock) {
- if (drvdata->config.hw_powered)
- cti_write_single_reg(drvdata, cti_attr->off, val);
- }
+ scoped_guard(raw_spinlock_irqsave, &drvdata->spinlock)
+ cti_write_single_reg(drvdata, cti_attr->off, val);
pm_runtime_put_sync(dev->parent);
return size;
* @asicctl_impl: true if asicctl is implemented.
* @enable_req_count: CTI is enabled alongside >=1 associated devices.
* @hw_enabled: true if hw is currently enabled.
- * @hw_powered: true if associated cpu powered on, or no cpu.
* @trig_in_use: bitfield of in triggers registered as in use.
* @trig_out_use: bitfield of out triggers registered as in use.
* @trig_out_filter: bitfield of out triggers that are blocked if filter
/* cti enable control */
int enable_req_count;
bool hw_enabled;
- bool hw_powered;
/* registered triggers and filtering */
u32 trig_in_use;
coresight_cti_get_platform_data(struct device *dev);
const char *cti_plat_get_node_name(struct fwnode_handle *fwnode);
-/* cti powered and enabled */
+/* Check if a cti device is enabled */
static inline bool cti_is_active(struct cti_config *cfg)
{
- return cfg->hw_powered && cfg->hw_enabled;
+ return cfg->hw_enabled;
}
#endif /* _CORESIGHT_CORESIGHT_CTI_H */