# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: "http://devicetree.org/schemas/soc/qcom/cdsprm.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"

title: Qualcomm Technologies, Inc. CDSP Request Manager driver

description:
  CDSP Request Manager driver implements an rpmsg interface with
  CDSP subsystem to serve L3 frequency and CPU QoS requests from CDSP.
  It also interacts with NPU, Camera modules for Cx iPeak mitigations and
  thermal module via CDSP/HVX cooling devices for thermal mitigation of
  CDSP core. It sends VTCM partitioning information on supported chipsets
  to CDSP.

maintainers:
  - Gokul krishna Krishnakumar<quic_gokukris@quicinc.com>

properties:
  required:
    compatible:
      const: qcom,msm-cdsprm-rpmsg
    qcom,glink-channels: Glink channel for communication with CDSP
    qcom,intents: A list of <size of each intent, number of intents>

  child-node:
    description:
      A sub-device node to define CDSPM RM, Cx iPeak mitigation
      driver, CDSP core thermal cooling device and CDSP VTCM partitioning
    properties:
      required:
        compatible:
          const: qcom,msm-cdsprm-rm
	  qcom,qos-latency-us: pm_qos latency vote to be applied on CDSP request in
				micro seconds
	  qcom,qos-maxhold-ms: Maximum hold time for pm_qos latency vote from CDSP
				in milli seconds
      optional:
        qcom,compute-cx-limit-en: To enable CX ipeak limit management for compute
				subsystem
        qcom,compute-priority-mode: when Cx iPeak mitigation is enabled,
				this field sets desired compute priority mode
				for AIX and HVX concurrency cases based on
				following values, where in HVX and NPU cores,
				if required, are throttled in concurrency based
				on the selected priority mode
				1 : HVX_MAX - Allows HVX to run at maximum possible
						frequency during concurrency with NPU
				2 : AIX_MAX - Allows NPU to run at maximum possible
						frequency during concurrency with HVX
				3 : HVX_OVER_AIX - Allows HVX to run at a higher
						frequency than NPU during concurrency
				4 : AIX_OVER_HVX - Allows NPU to run at a higher
						frequency than HVX during concurrency
	qcom,vtcm-paritions: Number of VTCM partitions (maximum 16)
	qcom,vtcm-partition-info: Specifies the partitions, their sizes and
				flags. Most importantly flags can be used to
				set some partitions as privileged,
				i.e. only available to privileged clients.
				Currently VTCM_FLAG_PRIMARY(0x1), VTCM_FLAG_SECONDARY (0x2)and
				VTCM_FLAG_PRIVILEGED(0x4) are the supported flags per partition
				(only one per partition).
				Size of each partition should be a multiple of 256KB.
				Given 256KB is the minimum VTCM allocation size,
				256K, 1M, 4M are supported page sizes.
				Specifying a 3MB partition will allow maximum of 1MB page (3x).
				Similarly, a 512KB partition will be of 256KB pages (2x).
				PRIMARY and SECONDARY partitions are available to all the clients while
				the PRIMARY partition is used by default. Partition selection is
				controlled by the vtcm-partition-map information.
				There must be only one PRIMARY partition.
				Partitions must be defined with a linear partition index
				starting with 0 till (Number of VTCM partitions - 1).
				VTCM memory will be partitioned in the order provided
				(0 being the first partition).
	qcom,vtcm-partition-map: Maps application type identifiers to
				partitions. Clients use application type IDs to
				request non-default partitions.
				Application identifier is specified as a value [0 – 31]
				in the device tree. The default application identifier
				will be 0. Application identifier must be unique for each
				partition map. Any unassigned application identifier
				in the set of [0 – 31] will be mapped to the PRIMARY partition
				and will return failure if there is no
	qcom,resmgr-pdkill-enable: To enable resource manager PD kill mechanism. When enabled,
				the resource manager (managing VTCM, HMX resources) can kill an
				unsigned process holding any of the resources being
				requested by a privileged process if the release requests sent by
				the resource manager are not acted upon.
	cooling-cells: Number of cooling cells for CDSP cooling device based on
			CDSP Q6 core clock throttling
  child-node:
    description:
      A sub-device node to define HVX based thermal cooling device
    properties:
      required:
        compatible:
          const: qcom,msm-hvx-rm

	cooling-cells: Number of cooling cells for CDSP cooling device based on
			HVX hardware throttling
  child-node:
    description:
      A sub-device node to define CDSP L3 target device for L3 clock voting
    properties:
      required:
        compatible:
          const: qcom,cdsp-l3

	qcom,target-dev: The DT device that corresponds to the CDSP L3
			devfreq-simple-dev

examples:
	qcom,msm_cdsprm_rpmsg {
		compatible = "qcom,msm-cdsprm-rpmsg";
		qcom,glink-channels = "cdsprmglink-apps-dsp";
		qcom,intents = <0x14 64>;

		qcom,cdsp-l3 {
			compatible = "qcom,cdsp-l3";
			qcom,target-dev = <&cdsp-cdsp-l3-lat>;
		};

		qcom,msm_cdsp_rm {
			compatible = "qcom,msm-cdsp-rm";
			qcom,qos-latency-us = <100>;
			qcom,qos-maxhold-ms = <20>;
			qcom,compute-cx-limit-en;
			qcom,compute-priority-mode = <2>;
			#cooling-cells = <2>;
			qcom,vtcm-paritions = <4>;
			qcom,vtcm-partition-info = < 0 2048 0x1 >,
										< 1 1024 0x2 >,
										< 2  512 0x4 >,
										< 3  512 0x4 >;
			qcom,vtcm-partition-map = < 0 0 >,
										< 1 0 >,
										< 2 1 >,
										< 30 2 >,
										< 31 3 >;
		};

		msm_hvx_rm: qcom,msm_hvx_rm {
			compatible = "qcom,msm-hvx-rm";
			#cooling-cells = <2>;
		};
	};
