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

Commit a4a039e8 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ARM: dts: msm: Add video device to sdm670"

parents 84c5f890 d4abc608
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7,9 +7,11 @@ Required properties:
- compatible : one of:
	- "qcom,msm-vidc"
        - "qcom,sdm845-vidc" : Invokes driver specific data for SDM845.
        - "qcom,sdm670-vidc" : Invokes driver specific data for SDM670.

Optional properties:
- reg : offset and length of the register set for the device.
- sku-index : sku version of the hardware.
- interrupts : should contain the vidc interrupt.
- 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
+214 −0
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/msm/msm-bus-ids.h>
#include <dt-bindings/clock/qcom,videocc-sdm845.h>

&soc {
	msm_vidc0: qcom,vidc0 {
		compatible = "qcom,msm-vidc", "qcom,sdm670-vidc";
		status = "ok";
		sku-index = <0>;
		reg = <0xaa00000 0x200000>;
		interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;

		/* Supply */
		venus-supply = <&venus_gdsc>;
		venus-core0-supply = <&vcodec0_gdsc>;
		venus-core1-supply = <&vcodec1_gdsc>;

		/* Clocks */
		clock-names = "core_clk", "iface_clk", "bus_clk",
			"core0_clk", "core0_bus_clk",
			"core1_clk", "core1_bus_clk";
		clocks = <&clock_videocc VIDEO_CC_VENUS_CTL_CORE_CLK>,
			<&clock_videocc VIDEO_CC_VENUS_AHB_CLK>,
			<&clock_videocc VIDEO_CC_VENUS_CTL_AXI_CLK>,
			<&clock_videocc VIDEO_CC_VCODEC0_CORE_CLK>,
			<&clock_videocc VIDEO_CC_VCODEC0_AXI_CLK>,
			<&clock_videocc VIDEO_CC_VCODEC1_CORE_CLK>,
			<&clock_videocc VIDEO_CC_VCODEC1_AXI_CLK>;
		qcom,proxy-clock-names = "core_clk", "iface_clk",
			"bus_clk", "core0_clk", "core0_bus_clk",
			"core1_clk", "core1_bus_clk";
		qcom,clock-configs = <0x1 0x0 0x0 0x1 0x0 0x1 0x0>;
		qcom,allowed-clock-rates = <100000000 200000000 320000000
			380000000 444000000 533000000>;

		/* Buses */
		bus_cnoc {
			compatible = "qcom,msm-vidc,bus";
			label = "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 = <1000 1000>;
		};

		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>;
		};
		arm9_bus_ddr {
			compatible = "qcom,msm-vidc,bus";
			label = "venus-arm9-ddr";
			qcom,bus-master = <MSM_BUS_MASTER_VIDEO_P0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_EBI_CH0>;
			qcom,bus-governor = "performance";
			qcom,bus-range-kbps = <1000 1000>;
		};

		/* MMUs */
		non_secure_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_ns";
			iommus =
				<&apps_smmu 0x10a0 0x8>,
				<&apps_smmu 0x10b0 0x0>;
			buffer-types = <0xfff>;
			virtual-addr-pool = <0x70800000 0x6f800000>;
		};

		secure_bitstream_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_bitstream";
			iommus =
				<&apps_smmu 0x10a1 0x8>,
				<&apps_smmu 0x10a5 0x8>;
			buffer-types = <0x241>;
			virtual-addr-pool = <0x4b000000 0x25800000>;
			qcom,secure-context-bank;
		};

		secure_pixel_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_pixel";
			iommus =
				<&apps_smmu 0x10a3 0x8>;
			buffer-types = <0x106>;
			virtual-addr-pool = <0x25800000 0x25800000>;
			qcom,secure-context-bank;
		};

		secure_non_pixel_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_non_pixel";
			iommus =
				<&apps_smmu 0x10a4 0x8>,
				<&apps_smmu 0x10b4 0x0>;
			buffer-types = <0x480>;
			virtual-addr-pool = <0x1000000 0x24800000>;
			qcom,secure-context-bank;
		};
	};

	msm_vidc1: qcom,vidc1 {
		compatible = "qcom,msm-vidc", "qcom,sdm670-vidc";
		status = "ok";
		sku-index = <1>;
		reg = <0xaa00000 0x200000>;
		interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;

		/* Supply */
		venus-supply = <&venus_gdsc>;
		venus-core0-supply = <&vcodec0_gdsc>;

		/* Clocks */
		clock-names = "core_clk", "iface_clk", "bus_clk",
			"core0_clk", "core0_bus_clk";
		clocks = <&clock_videocc VIDEO_CC_VENUS_CTL_CORE_CLK>,
			<&clock_videocc VIDEO_CC_VENUS_AHB_CLK>,
			<&clock_videocc VIDEO_CC_VENUS_CTL_AXI_CLK>,
			<&clock_videocc VIDEO_CC_VCODEC0_CORE_CLK>,
			<&clock_videocc VIDEO_CC_VCODEC0_AXI_CLK>;
		qcom,proxy-clock-names = "core_clk", "iface_clk",
			"bus_clk", "core0_clk", "core0_bus_clk";
		qcom,clock-configs = <0x1 0x0 0x0 0x1 0x0>;
		qcom,allowed-clock-rates = <100000000 200000000 320000000
			364800000>;

		/* Buses */
		bus_cnoc {
			compatible = "qcom,msm-vidc,bus";
			label = "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 = <1000 1000>;
		};

		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 2128000>;
		};
		arm9_bus_ddr {
			compatible = "qcom,msm-vidc,bus";
			label = "venus-arm9-ddr";
			qcom,bus-master = <MSM_BUS_MASTER_VIDEO_P0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_EBI_CH0>;
			qcom,bus-governor = "performance";
			qcom,bus-range-kbps = <1000 1000>;
		};

		/* MMUs */
		non_secure_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_ns";
			iommus =
				<&apps_smmu 0x10a0 0x8>,
				<&apps_smmu 0x10b0 0x0>;
			buffer-types = <0xfff>;
			virtual-addr-pool = <0x70800000 0x6f800000>;
		};

		secure_bitstream_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_bitstream";
			iommus =
				<&apps_smmu 0x10a1 0x8>,
				<&apps_smmu 0x10a5 0x8>;
			buffer-types = <0x241>;
			virtual-addr-pool = <0x4b000000 0x25800000>;
			qcom,secure-context-bank;
		};

		secure_pixel_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_pixel";
			iommus =
				<&apps_smmu 0x10a3 0x8>;
			buffer-types = <0x106>;
			virtual-addr-pool = <0x25800000 0x25800000>;
			qcom,secure-context-bank;
		};

		secure_non_pixel_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_non_pixel";
			iommus =
				<&apps_smmu 0x10a4 0x8>,
				<&apps_smmu 0x10b4 0x0>;
			buffer-types = <0x480>;
			virtual-addr-pool = <0x1000000 0x24800000>;
			qcom,secure-context-bank;
		};
	};
};
+3 −0
Original line number Diff line number Diff line
@@ -611,6 +611,9 @@
#include "sdm670-qupv3.dtsi"

#include "sdm670-coresight.dtsi"

#include "sdm670-vidc.dtsi"

&soc {
	#address-cells = <1>;
	#size-cells = <1>;
+7 −34
Original line number Diff line number Diff line
@@ -448,14 +448,14 @@ static ssize_t store_thermal_level(struct device *dev,
static DEVICE_ATTR(thermal_level, 0644, show_thermal_level,
		store_thermal_level);

static ssize_t show_platform_version(struct device *dev,
static ssize_t show_sku_version(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	return scnprintf(buf, PAGE_SIZE, "%d",
			vidc_driver->platform_version);
			vidc_driver->sku_version);
}

static ssize_t store_platform_version(struct device *dev,
static ssize_t store_sku_version(struct device *dev,
		struct device_attribute *attr, const char *buf,
		size_t count)
{
@@ -463,13 +463,13 @@ static ssize_t store_platform_version(struct device *dev,
	return count;
}

static DEVICE_ATTR(platform_version, 0444, show_platform_version,
		store_platform_version);
static DEVICE_ATTR(sku_version, 0444, show_sku_version,
		store_sku_version);

static struct attribute *msm_vidc_core_attrs[] = {
		&dev_attr_pwr_collapse_delay.attr,
		&dev_attr_thermal_level.attr,
		&dev_attr_platform_version.attr,
		&dev_attr_sku_version.attr,
		NULL
};

@@ -487,8 +487,6 @@ static const struct of_device_id msm_vidc_dt_match[] = {
static int msm_vidc_probe_vidc_device(struct platform_device *pdev)
{
	int rc = 0;
	void __iomem *base;
	struct resource *res;
	struct msm_vidc_core *core;
	struct device *dev;
	int nr = BASE_DEVICE_NUMBER;
@@ -605,32 +603,7 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev)
	core->debugfs_root = msm_vidc_debugfs_init_core(
		core, vidc_driver->debugfs_root);

	vidc_driver->platform_version = 0;
	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "efuse");
	if (!res) {
		dprintk(VIDC_DBG, "failed to get efuse resource\n");
	} else {
		base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
		if (!base) {
			dprintk(VIDC_ERR,
				"failed efuse ioremap: res->start %#x, size %d\n",
				(u32)res->start, (u32)resource_size(res));
		} else {
			u32 efuse = 0;
			struct platform_version_table *pf_ver_tbl =
				core->resources.pf_ver_tbl;

			efuse = readl_relaxed(base);
			vidc_driver->platform_version =
				(efuse & pf_ver_tbl->version_mask) >>
				pf_ver_tbl->version_shift;
			dprintk(VIDC_DBG,
				"efuse 0x%x, platform version 0x%x\n",
				efuse, vidc_driver->platform_version);

			devm_iounmap(&pdev->dev, base);
		}
	}
	vidc_driver->sku_version = core->resources.sku_version;

	dprintk(VIDC_DBG, "populating sub devices\n");
	/*
+22 −1
Original line number Diff line number Diff line
@@ -195,12 +195,33 @@ struct msm_vidc_codec_data {
	int low_power_cycles;
};

enum efuse_purpose {
	SKU_VERSION = 0,
};

enum sku_version {
	SKU_VERSION_0 = 0,
	SKU_VERSION_1,
	SKU_VERSION_2,
};

struct msm_vidc_efuse_data {
	u32 start_address;
	u32 size;
	u32 mask;
	u32 shift;
	enum efuse_purpose purpose;
};

struct msm_vidc_platform_data {
	struct msm_vidc_common_data *common_data;
	unsigned int common_data_length;
	struct msm_vidc_codec_data *codec_data;
	unsigned int codec_data_length;
	struct msm_vidc_csc_coeff csc_data;
	struct msm_vidc_efuse_data *efuse_data;
	unsigned int efuse_data_length;
	unsigned int sku_version;
};

struct msm_vidc_format {
@@ -218,7 +239,7 @@ struct msm_vidc_drv {
	int num_cores;
	struct dentry *debugfs_root;
	int thermal_level;
	u32 platform_version;
	u32 sku_version;
};

struct msm_video_device {
Loading