mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 11:11:26 +02:00
Merge "arm64: configs: Enable CRM driver for pineapple_GKI"
This commit is contained in:
commit
85e22bfdf0
|
|
@ -78,6 +78,7 @@ CONFIG_QCOM_CLK_RPMH=m
|
|||
# CONFIG_QCOM_COINCELL is not set
|
||||
CONFIG_QCOM_COMMAND_DB=m
|
||||
CONFIG_QCOM_CPUSS_SLEEP_STATS=m
|
||||
CONFIG_QCOM_CRM=m
|
||||
CONFIG_QCOM_DCC_V2=m
|
||||
CONFIG_QCOM_DMABUF_HEAPS=m
|
||||
CONFIG_QCOM_DMABUF_HEAPS_CARVEOUT=y
|
||||
|
|
|
|||
|
|
@ -51,6 +51,16 @@ config QCOM_CPUSS_SLEEP_STATS
|
|||
low power modes. This driver creates debugfs entry which provide
|
||||
provision to read those counters.
|
||||
|
||||
config QCOM_CRM
|
||||
tristate "Qualcomm Technologies, Inc. (QTI) CRM driver"
|
||||
depends on QCOM_RPMH && (ARCH_QCOM || COMPILE_TEST)
|
||||
help
|
||||
Support for communication with the hardened-CRM blocks in
|
||||
Qualcomm Technologies, Inc. (QTI) SoCs. CRM provides interface to
|
||||
vote desired power state of resources local to a subsystem. A set
|
||||
of hardware components aggregate requests for these resources and
|
||||
help apply the aggregated power state on the resource.
|
||||
|
||||
config QCOM_DCC_V2
|
||||
tristate "Qualcomm Technologies Data Capture and Compare enigne support for V2"
|
||||
help
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o
|
|||
obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
|
||||
obj-$(CONFIG_QCOM_CPR) += cpr.o
|
||||
obj-$(CONFIG_QCOM_CPUSS_SLEEP_STATS) += qcom_cpuss_sleep_stats.o
|
||||
obj-$(CONFIG_QCOM_CRM) += crm.o
|
||||
obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o
|
||||
obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o
|
||||
obj-$(CONFIG_QCOM_OCMEM) += ocmem.o
|
||||
|
|
|
|||
1138
drivers/soc/qcom/crm.c
Normal file
1138
drivers/soc/qcom/crm.c
Normal file
File diff suppressed because it is too large
Load Diff
111
drivers/soc/qcom/trace-crm.h
Normal file
111
drivers/soc/qcom/trace-crm.h
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#if !defined(_TRACE_CRM_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_CRM_H
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM crm
|
||||
|
||||
#include <linux/tracepoint.h>
|
||||
#include <soc/qcom/crm.h>
|
||||
|
||||
DECLARE_EVENT_CLASS(crm_vcd_votes,
|
||||
|
||||
TP_PROTO(const char *name, u32 vcd_type, u32 resource_idx, u32 pwr_state, u32 data),
|
||||
|
||||
TP_ARGS(name, vcd_type, resource_idx, pwr_state, data),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, name)
|
||||
__field(u32, vcd_type)
|
||||
__field(u32, resource_idx)
|
||||
__field(u32, pwr_state)
|
||||
__field(u32, data)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, name);
|
||||
__entry->vcd_type = vcd_type;
|
||||
__entry->resource_idx = resource_idx;
|
||||
__entry->pwr_state = pwr_state;
|
||||
__entry->data = data;
|
||||
),
|
||||
|
||||
TP_printk("%s: vcd_type: %u resource_idx: %u pwr_state: %u data: %#x",
|
||||
__get_str(name), __entry->vcd_type, __entry->resource_idx,
|
||||
__entry->pwr_state, __entry->data)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(crm_vcd_votes, crm_cache_vcd_votes,
|
||||
|
||||
TP_PROTO(const char *name, u32 vcd_type, u32 resource_idx, u32 pwr_state, u32 data),
|
||||
|
||||
TP_ARGS(name, vcd_type, resource_idx, pwr_state, data)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(crm_vcd_votes, crm_write_vcd_votes,
|
||||
|
||||
TP_PROTO(const char *name, u32 vcd_type, u32 resource_idx, u32 pwr_state, u32 data),
|
||||
|
||||
TP_ARGS(name, vcd_type, resource_idx, pwr_state, data)
|
||||
);
|
||||
|
||||
TRACE_EVENT(crm_irq,
|
||||
|
||||
TP_PROTO(const char *name, u32 vcd_type, u32 resource_idx, unsigned long irq_status),
|
||||
|
||||
TP_ARGS(name, vcd_type, resource_idx, irq_status),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, name)
|
||||
__field(u32, vcd_type)
|
||||
__field(u32, resource_idx)
|
||||
__field(unsigned long, irq_status)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, name);
|
||||
__entry->vcd_type = vcd_type;
|
||||
__entry->resource_idx = resource_idx;
|
||||
__entry->irq_status = irq_status;
|
||||
),
|
||||
|
||||
TP_printk("%s: IRQ vcd_type: %u resource_idx: %u irq_status: %lu",
|
||||
__get_str(name), __entry->vcd_type, __entry->resource_idx,
|
||||
__entry->irq_status)
|
||||
);
|
||||
|
||||
TRACE_EVENT(crm_switch_channel,
|
||||
|
||||
TP_PROTO(const char *name, int ch, int ret),
|
||||
|
||||
TP_ARGS(name, ch, ret),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, name)
|
||||
__field(int, ch)
|
||||
__field(int, ret)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, name);
|
||||
__entry->ch = ch;
|
||||
__entry->ret = ret;
|
||||
),
|
||||
|
||||
TP_printk("%s: channel switched to: %d ret: %d",
|
||||
__get_str(name), __entry->ch, __entry->ret)
|
||||
);
|
||||
|
||||
#endif /* _TRACE_CRM_H */
|
||||
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH .
|
||||
|
||||
#undef TRACE_INCLUDE_FILE
|
||||
#define TRACE_INCLUDE_FILE trace-crm
|
||||
|
||||
#include <trace/define_trace.h>
|
||||
108
include/soc/qcom/crm.h
Normal file
108
include/soc/qcom/crm.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __SOC_QCOM_CRM_H__
|
||||
#define __SOC_QCOM_CRM_H__
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
/**
|
||||
* enum crm_hw_drv_state: Progressive higher power states for the HW DRV request
|
||||
*
|
||||
* @CRM_PWR_STATE0: Power State0
|
||||
* @CRM_PWR_STATE1: Power State1
|
||||
* @CRM_PWR_STATE2: Power State2
|
||||
* @CRM_PWR_STATE3: Power State3
|
||||
* @CRM_PWR_STATE4: Power State4
|
||||
*/
|
||||
enum crm_hw_drv_state {
|
||||
CRM_PWR_STATE0,
|
||||
CRM_PWR_STATE1,
|
||||
CRM_PWR_STATE2,
|
||||
CRM_PWR_STATE3,
|
||||
CRM_PWR_STATE4,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum crm_sw_drv_state: Power states for the SW DRV request
|
||||
*
|
||||
* @CRM_ACTIVE_STATE: Active or AMC mode requests. Resource state
|
||||
* is aggregated immediately.
|
||||
* @CRM_SLEEP_STATE: State of the resource when the subsystem is
|
||||
* powered down. There is no client using the
|
||||
* resource actively.
|
||||
* @CRM_WAKE_STATE: Resume resource state to the value previously
|
||||
* requested before the subsystem was powered down.
|
||||
*/
|
||||
enum crm_sw_drv_state {
|
||||
CRM_ACTIVE_STATE,
|
||||
CRM_SLEEP_STATE,
|
||||
CRM_WAKE_STATE,
|
||||
};
|
||||
|
||||
union power_state {
|
||||
enum crm_hw_drv_state hw;
|
||||
enum crm_sw_drv_state sw;
|
||||
};
|
||||
|
||||
/**
|
||||
* enum crm_drv_type: CRM DRV type
|
||||
*
|
||||
* @CRM_HW_DRV: DRV is HW (HW Client)
|
||||
* @CRM_SW_DRV: DRV is SW (SW Client)
|
||||
*/
|
||||
enum crm_drv_type {
|
||||
CRM_HW_DRV,
|
||||
CRM_SW_DRV,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct crm_cmd: The message to be sent to CRM
|
||||
*
|
||||
* @pwr_state: The pwr_state for HW/SW DRV
|
||||
* @resource_idx: The index of the VCD OR ND to apply data
|
||||
* @data: The Clock Plan index for the VCDs voted by PERF_OL.
|
||||
* BW vote for the VCDs voted by BW.
|
||||
* @wait: Set by the client want if want to wait for the vote completion IRQ.
|
||||
* Applicable for only SW DRV client.
|
||||
* Don't care for HW DRV client.
|
||||
*/
|
||||
struct crm_cmd {
|
||||
union power_state pwr_state;
|
||||
u32 resource_idx;
|
||||
u32 data;
|
||||
bool wait;
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_QCOM_CRM)
|
||||
int crm_write_perf_ol(const struct device *dev, enum crm_drv_type drv,
|
||||
u32 drv_id, const struct crm_cmd *cmd);
|
||||
int crm_write_bw_vote(const struct device *dev, enum crm_drv_type drv,
|
||||
u32 drv_id, const struct crm_cmd *cmd);
|
||||
int crm_write_pwr_states(const struct device *dev, u32 drv_id);
|
||||
|
||||
const struct device *crm_get_device(const char *name);
|
||||
#else
|
||||
|
||||
static inline int crm_write_perf_ol(const struct device *dev,
|
||||
enum crm_drv_type drv,
|
||||
u32 drv_id,
|
||||
const struct crm_cmd *cmd)
|
||||
{ return -ENODEV; }
|
||||
|
||||
static inline int crm_write_bw_vote(const struct device *dev,
|
||||
enum crm_drv_type drv,
|
||||
u32 drv_id,
|
||||
const struct crm_cmd *cmd)
|
||||
{ return -ENODEV; }
|
||||
|
||||
static inline int crm_write_pwr_states(const struct device *dev, u32 drv_id)
|
||||
{ return -ENODEV; }
|
||||
|
||||
static inline const struct device *crm_get_device(const char *name)
|
||||
{ return ERR_PTR(-ENODEV); }
|
||||
#endif /* CONFIG_QCOM_CRM */
|
||||
|
||||
#endif /* __SOC_QCOM_CRM_H__ */
|
||||
Loading…
Reference in New Issue
Block a user