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

Commit a57b56bc authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Add snapshot of MSM VIDC video driver" into msm-4.8

parents d94bb26b 6e6fbdb9
Loading
Loading
Loading
Loading
+49 −0
Original line number Original line Diff line number Diff line
* Qualcomm Technologies Inc MSM VIDC BUS

Required properties:
- compatible : "qcom,msm-vidc,governor,table"
- name : name of the governor.
- qcom,bus-table : node containing individual domain nodes, each with:
  - qcom,codec-mask: a bitmap of supported codec types, every two bits
    represents a codec type.
  - qcom,load-busfreq-tbl: load (in macroblocks/sec) and the corresponding
    bus frequency (in KBps) table.

Optional properties:
- qcom,low-power-mode: a boolean which indicates whether bus profile need
  to be used when client enables low-power mode.
- qcom,ubwc-mode: a boolean which indicates whether the bus profile need
  to be used when client enables UBWC mode.

Example:

venus-bus-gov {
	compatible = "qcom,msm-vidc,governor,table";
	name = "qcom,venus-gov";
	qcom,bus-freq-table {
		qcom,profile-dec {
			qcom,codec-mask = <0xffffffff>;
			qcom,ubwc-mode;
			qcom,load-busfreq-tbl =
				<489600 1205248>,  /* 1080p60D   */
				<244800 618496>,   /* 1080p30D   */
				<216000 618496>,   /* 720p60D    */
				<108000 314368>,   /* 720p30D    */
				<72000  233472>,   /* VGA60D     */
				<36000  118784>,   /* VGA30D     */
				<0      0>;
		};
		qcom,profile-enc {
			qcom,codec-mask = <0x55555555>;
			qcom,low-power-mode;
			qcom,load-busfreq-tbl =
				<244800 787456>,   /* 1080p30E   */
				<216000 350208>,   /* 720p60E    */
				<108000 350208>,   /* 720p30E    */
				<72000  350208>,   /* VGA60E     */
				<36000  136806>,   /* VGA30E     */
				<0      0>;
		};
	};
};
+42 −0
Original line number Original line Diff line number Diff line
* Qualcomm Technologies Inc MSM VIDC VMEM

Required properties:
- compatible : "qcom,msm-vmem".
- interrupts : Contains the interrupt that maps to the VMEM module.
- reg : A set of 2 start address and size pairs that describe the hardware
register address space and mappable memory address space.
- reg-names : Strings that describe the pairs in "reg".  The register address
space should be called "reg-base" and the memory space should be called "mem-base".
- clocks : A set of clocks that correspond to the AHB and MAXI clocks that the
hardware uses.
- clock-names : A string that describes the "clocks" property.  The AHB clock
should be named "ahb" and the MAXI clock should be named "maxi".
- qcom,bank-size : The size of each memory bank, in bytes.
- vdd-supply: phandle to a regulator that is considered to be the footswitch for vmem.
- qcom,msm-bus,(name|num-cases,num-paths,vectors-KBps) - Bus to be voted for prior to
  issuing any IO transactions to vmem.  Refer to Documentation/devicetree/bindings/arm/\
  msm/msm_bus_adhoc.txt for further details.

Example:

qcom,vmem@880000 {
	compatible = "qcom,msm-vmem";
	interrupts = <0 429 0>;
	reg = <0x880000 0x800>,
	    <0x6800000 0x100000>;
	reg-names = "reg-base", "mem-base";

	vdd-supply = <&gdsc_mmagic_video>;
	clocks = <&clock_mmss clk_vmem_ahb_clk>,
	       <&clock_mmss clk_vmem_maxi_clk>;
	clock-names = "ahb", "maxi";

	qcom,bank-size = <131072>;

	qcom,msm-bus,name = "vmem";
	qcom,msm-bus,num-cases = <2>;
	qcom,msm-bus,num-paths = <1>;
	qcom,msm-bus,vectors-KBps =
	        <MSM_BUS_MASTER_AMPSS_M0 MSM_BUS_SLAVE_VMEM_CFG   0   0>,
	        <MSM_BUS_MASTER_AMPSS_M0 MSM_BUS_SLAVE_VMEM_CFG 500 800>;
};
+289 −0
Original line number Original line Diff line number Diff line
* Qualcomm Technologies, Inc. MSM VIDC

[Root level node]
Venus
=====
Required properties:
- compatible : one of:
	- "qcom,msm-vidc"
- qcom,max-hw-load: The maximum load the hardware can support expressed in units
  of macroblocks per second. The load is a reflection of hardware capability
  rather than a performance guarantee. Performance is guaranteed only up to
  advertised capability of the chipset.
- qcom,firmware-name : firmware file name to be downloaded.

Optional properties:
- reg : offset and length of the register set for the device.
- interrupts : should contain the vidc interrupt.
- qcom,platform-version : mask and shift of the platform version bits
    in efuse register.
- qcom,load-freq-tbl : load (in macroblocks/sec) and corresponding vcodec
  clock required along with codec's config, which is a bitmap that describes
  what the clock is used for. The bitmaps are as follows:
    supports mvc encoder = 0x00000001
    supports mvc decoder = 0x00000003
    supports h264 encoder = 0x00000004
    supports h264 decoder = 0x0000000c
    supports h263 encoder = 0x00000010
    supports h263 decoder = 0x00000030
    supports mpeg1 encoder = 0x00000040
    supports mpeg1 decoder = 0x000000c0
    supports mpeg2 encoder = 0x00000100
    supports mpeg2 decoder = 0x00000300
    supports mpeg4 encoder = 0x00000400
    supports mpeg4 decoder = 0x00000c00
    supports divx_311 encoder = 0x00001000
    supports divx_311 decoder = 0x00003000
    supports divx encoder = 0x00004000
    supports divx decoder = 0x0000c000
    supports vc1 encoder = 0x00010000
    supports vc1 decoder = 0x00030000
    supports spark encoder = 0x00040000
    supports spark decoder = 0x000c0000
    supports vp6 encoder = 0x00100000
    supports vp6 decoder = 0x00300000
    supports vp7 encoder = 0x00400000
    supports vp7 decoder = 0x00c00000
    supports vp8 encoder = 0x01000000
    supports vp8 decoder = 0x03000000
    supports hevc encoder = 0x04000000
    supports hevc decoder = 0x0c000000
    supports hevc_hybrid encoder = 0x10000000
    supports hevc_hybrid decoder = 0x30000000
- qcom,dcvs-tbl : specifies the parameter to configure DCVS algorithm. Video
  instance load (in mbs/sec) and corresponding low and high threshold DCVS
  load for supported codec formats.
- qcom,dcvs-limit : specifies the minimum specifications required to kick in
  DCVS algorithm. Min MBs per frame and the fps for encoder and decoder to
  kick in DCVS.
- qcom,imem-ab-tbl : video core frequency in Hz and corresponding imem ab value
  in kbps. The imem ab value corresponds to the clock frequency at which imem
  should operate for a particular video core frequency.
- qcom,reg-presets : list of offset-value pairs for registers to be written.
  The offsets are from the base offset specified in 'reg'. This is mainly
  used for QoS, VBIF, etc. presets for video.
- qcom,qdss-presets : list of physical address and memory allocation size pairs.
  when fw_debug_mode is set as HFI_DEBUG_MODE_QDSS, all firmware messages will be
  written to QDSS memory.
- qcom,imem-size: imem size required by hardware for optimum performance.
  If imem is not present then there is no need to specify this property.
- *-supply: A phandle pointing to the appropriate regulator. Number of
  regulators vary across targets.
- clock-names: an array of clocks that the driver is supposed to be
  manipulating. The clocks names here correspond to the clock names used in
  clk_get(<name>).
- qcom,clock-configs = an array of bitmaps of clocks' configurations. The index
  of the bitmap corresponds to the clock at the same index in qcom,clock-names.
  The bitmaps describes the actions that the device needs to take regarding the
  clock (i.e. scale it based on load).

  The bitmap is defined as:
  scalable = 0x1 (if the driver should vary the clock's frequency based on load)
- qcom,allowed-clock-rates = an array of supported clock rates by the chipset.
- qcom,clock-freq-tbl = node containing individual domain nodes, each with:
     - qcom,codec-mask: a bitmap of supported codec types, every two bits
       represents a codec type.
     - qcom,cycles-per-mb: number of cycles required to process each macro
       block.
     - qcom,low-power-mode-factor: the factor which needs to be multiple with
       the required frequency to get the final frequency, the factor is
       represented in Q16 format.
- qcom,sw-power-collapse = A bool indicating if video hardware core can be
  power collapsed in idle state.
- qcom,slave-side-cp = A bool indicating the content protection mode for an
  ongoing video session. It is true for targets where the mode is slave side.
- qcom,never-unload-fw = A bool indicating if video firmware should be not be
  unloaded after all active sessions have closed.  Once a new session starts up
  after this, the firmware will be ready to go.  This should be set on platforms
  that desire low-latency video startup and don't mind "leakage" of some memory.
- qcom,use-non-secure-pil = A bool indicating which type of pil to use to load
  the fw.
- qcom,fw-bias = The address at which venus fw is loaded (manually).
- qcom,enable-idle-indicator = A bool to enable video hardware to generate
  idle message when it is in idle state.
- qcom,enable-thermal-mitigation = A bool to enable thermal mitigation when
  thermal run away occurs.
- qcom,hfi-version = The hfi packetization version supported by venus firmware.
  If hfi version is not specified, then packetization type will default to
  legacy.
- qcom,vidc-iommu-domains = node containing individual domain nodes, each with:
     - a unique domain name for the domain node (e.g vidc,domain-ns)
     - qcom,vidc-domain-phandle: phandle for the domain as defined in
       <target>-iommu-domains.dtsi (e.g msm8974-v1-iommu-domains.dtsi)
     - qcom,vidc-buffer-types: bitmap of buffer types that can be mapped into each
       IOMMU domain.
       - Buffer types are defined as the following:
           input = 0x1
           output = 0x2
           output2 = 0x4
           extradata input = 0x8
           extradata output = 0x10
           extradata output2 = 0x20
           internal scratch = 0x40
           internal scratch1 = 0x80
           internal scratch2 = 0x100
           internal persist = 0x200
           internal persist1 = 0x400
           internal cmd queue = 0x800
- qcom,pm-qos-latency-us = The latency used to vote for QOS power manager. This
value is typically max(latencies of every cluster at all power levels) + 1
- qcom,max-secure-instances = An int containing max number of concurrent secure
  instances supported, accounting for venus and system wide limitations like
  memory, performance etc.
- qcom,debug-timeout = A bool indicating that FW errors such as SYS_ERROR,
  SESSION_ERROR and timeouts will be treated as Fatal.

[Second level nodes]
Context Banks
=============
Required properties:
- compatible : one of:
	- "qcom,msm-vidc,context-bank"
- iommus : A phandle parsed by smmu driver. Number of entries will vary
  across targets.

Optional properties:
- label - string describing iommu domain usage.
- buffer-types : bitmap of buffer types that can be mapped into the current
	IOMMU domain.
        - Buffer types are defined as the following:
          input = 0x1
          output = 0x2
          output2 = 0x4
          extradata input = 0x8
          extradata output = 0x10
          extradata output2 = 0x20
          internal scratch = 0x40
          internal scratch1 = 0x80
          internal scratch2 = 0x100
          internal persist = 0x200
          internal persist1 = 0x400
          internal cmd queue = 0x800
- virtual-addr-pool : offset and length of virtual address pool.
- qcom,fw-context-bank : bool indicating firmware context bank.
- qcom,secure-context-bank : bool indicating secure context bank.

Buses
=====
Required properties:
- compatible : one of:
	- "qcom,msm-vidc,bus"
- label : an arbitrary name
- qcom,bus-master : an integer descriptor of the bus master. Refer to arch/arm/\
  boot/dts/include/dt-bindings/msm/msm-bus-ids.h for list of acceptable masters
- qcom,bus-slave : an integer descriptor of the bus slave. Refer to arch/arm/\
  boot/dts/include/dt-bindings/msm/msm-bus-ids.h for list of acceptable slaves

Optional properties:
- qcom,bus-governor : governor to use when scaling bus, generally any commonly
  found devfreq governor might be used.  In addition to those governors, the
  custom Venus governors, "msm-vidc-ddr" or "msm-vidc-vmem" are also
  acceptable values.
  In the absence of this property the "performance" governor is used.
- qcom,bus-rage-kbps : an array of two items (<min max>) that indicate the
  minimum and maximum acceptable votes for the bus.
  In the absence of this property <0 INT_MAX> is used.
- qcom,ubwc-10bit : UBWC 10 bit content has different bus requirements,
  this tag will be used to pick the appropriate bus as per the session profile
  as shown below in example.

Example:


	qcom,vidc@fdc00000 {
		compatible = "qcom,msm-vidc";
		reg = <0xfdc00000 0xff000>;
		interrupts = <0 44 0>;
		venus-supply = <&gdsc>;
		venus-core0-supply = <&gdsc1>;
		venus-core1-supply = <&gdsc2>;
		qcom,load-freq-tbl =
			<489600 266670000 0x030fcfff>, /* Legacy decoder 1080p 60fps  */
			<108000 133330000 0x030fcfff>, /* Legacy decoder 720p 30fps   */
			<108000 200000000 0x01000414>, /* Legacy encoder 720p 30fps   */
			<72000 133330000 0x0c000000>, /* HEVC decoder VGA 60fps   */
			<36000 133330000 0x0c000000>, /* HEVC VGA 30 fps  */
			<36000 133330000 0x01000414>; /* Legacy encoder VGA 30 fps   */
		qcom,dcvs-tbl =
			<972000 972000 19944000 0xffffffff>, /* Legacy decoder UHD 30fps */
			<489600 489600   972000 0xffffffff>, /* Legacy decoder 1080p 60fps */
			<244800 244800   489600 0xffffffff>, /* Legacy decoder 1080p 30fps */
			<829440 489600   972000 0x55555555>; /* Legacy encoder DCI 24fps
		qcom,dcvs-limit =
			<32400 30>, /* Encoder UHD */
			<14400 30>; /* Decoder WQHD */
		qcom,imem-ab-tbl =
			<75000000  1500000>, /* imem clk @ 75 Mhz  */
			<150000000 1500000>, /* imem clk @ 75 Mhz  */
			<355333333 2500000>, /* imem clk @ 170 Mhz */
			<533000000 6000000>; /* imem clk @ 320 Mhz */

		qcom,imem-size = <4096>;
		qcom,firmware-name = "venus";
		qcom,hfi-version = "3xx";
		qcom,reg-presets = <0x80004 0x1>,
			<0x80178 0x00001FFF>;
		qcom,qdss-presets = <0xFC307000 0x1000>,
			<0xFC322000 0x1000>;
		qcom,max-hw-load = <1224450>; /* 4k @ 30 + 1080p @ 30*/
		qcom,never-unload-fw;
		clock-names = "foo_clk", "bar_clk", "baz_clk";
		qcom,clock-configs = <0x3 0x1 0x0>;
		qcom,sw-power-collapse;
		qcom,enable-idle-indicator;
		qcom,buffer-type-tz-usage-table = <0x1 0x1>,
						<0x1fe 0x2>;
		qcom,enable-thermal-mitigation;
		qcom,use-non-secure-pil;
		qcom,slave-side-cp;
		qcom,use_dynamic_bw_update;
		qcom,fw-bias = <0xe000000>;
		msm_vidc_cb1: msm_vidc_cb1 {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_ns";
			iommus = <&venus_smmu 0x0a>,
				<&venus_smmu 0x0b>,
				<&venus_smmu 0x0c>;
			buffer-types = <0xfff>;
			virtual-addr-pool = <0x5dc00000 0x80000000>;
			qcom,secure-context-bank;
		};

		msm_vidc_cb2: msm_vidc_cb2 {
			compatible = "qcom,msm-vidc,context-bank";
			qcom,fw-context-bank;
			iommus = <&venus_smmu 0x100>,
				<&venus_smmu 0x106>;
		};

		bus_cnoc {
			compatible = "qcom,msm-vidc,bus";
			label = "venus-cnoc";
			qcom,bus-master = <MSM_BUS_MASTER_AMPSS_M0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_VENUS_CFG>;
			qcom,bus-governor = "performance";
			qcom,bus-range-kbps = <1 1>;
		};

		venus_bus_ddr {
			compatible = "qcom,msm-vidc,bus";
			label = "venus-ddr";
			qcom,bus-master = <MSM_BUS_MASTER_VIDEO_P0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_EBI_CH0>;
			qcom,bus-governor = "msm-vidc-ddr";
			qcom,bus-range-kbps = <1000 3388000>;
		};
		qcom,profile-dec-ubwc-10bit {
			qcom,codec-mask = <0xffffffff>;
			qcom,ubwc-10bit;
			qcom,load-busfreq-tbl =
				<979200 2446336>,  /* UHD30D     */
				<864000 2108416>,  /* 720p240D   */
				<489600 1207296>,  /* 1080p60D   */
				<432000 1058816>,  /* 720p120D   */
				<244800 616448>,   /* 1080p30D   */
				<216000 534528>,   /* 720p60D    */
				<108000 271360>,   /* 720p30D    */
				<0 0>;
		};
	};
+1 −0
Original line number Original line Diff line number Diff line
@@ -120,6 +120,7 @@ source "drivers/media/platform/am437x/Kconfig"
source "drivers/media/platform/xilinx/Kconfig"
source "drivers/media/platform/xilinx/Kconfig"
source "drivers/media/platform/rcar-vin/Kconfig"
source "drivers/media/platform/rcar-vin/Kconfig"
source "drivers/media/platform/atmel/Kconfig"
source "drivers/media/platform/atmel/Kconfig"
source "drivers/media/platform/msm/Kconfig"


config VIDEO_TI_CAL
config VIDEO_TI_CAL
	tristate "TI CAL (Camera Adaptation Layer) driver"
	tristate "TI CAL (Camera Adaptation Layer) driver"
+2 −0
Original line number Original line Diff line number Diff line
@@ -66,3 +66,5 @@ ccflags-y += -I$(srctree)/drivers/media/i2c
obj-$(CONFIG_VIDEO_MEDIATEK_VPU)	+= mtk-vpu/
obj-$(CONFIG_VIDEO_MEDIATEK_VPU)	+= mtk-vpu/


obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC)	+= mtk-vcodec/
obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC)	+= mtk-vcodec/

obj-y  += msm/
Loading