Loading Documentation/devicetree/bindings/media/video/msm-vidc.txt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ Optional properties: - interrupts : should contain the vidc interrupt. - qcom,platform-version : mask and shift of the platform version bits in efuse register. - qcom,capability-version : mask and shift of the capability 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: Loading drivers/media/platform/msm/vidc/msm_v4l2_vidc.c +56 −29 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-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 Loading Loading @@ -416,10 +416,29 @@ static ssize_t store_platform_version(struct device *dev, static DEVICE_ATTR(platform_version, S_IRUGO, show_platform_version, store_platform_version); static ssize_t show_capability_version(struct device *dev, struct device_attribute *attr, char *buf) { return scnprintf(buf, PAGE_SIZE, "%d", vidc_driver->capability_version); } static ssize_t store_capability_version(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { dprintk(VIDC_WARN, "store capability version is not allowed\n"); return count; } static DEVICE_ATTR(capability_version, S_IRUGO, show_capability_version, store_capability_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_capability_version.attr, NULL }; Loading @@ -434,11 +453,38 @@ static const struct of_device_id msm_vidc_dt_match[] = { {} }; static int msm_vidc_probe_vidc_device(struct platform_device *pdev) static u32 msm_vidc_read_efuse_version(struct platform_device *pdev, struct version_table *table, const char *fuse_name) { int rc = 0; void __iomem *base; struct resource *res; u32 ret = 0; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, fuse_name); if (!res) { dprintk(VIDC_DBG, "Failed to get resource %s\n", fuse_name); goto exit; } base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!base) { dprintk(VIDC_ERR, "failed ioremap: res->start %#x, size %d\n", (u32)res->start, (u32)resource_size(res)); goto exit; } else { ret = readl_relaxed(base); ret = (ret & table->version_mask) >> table->version_shift; devm_iounmap(&pdev->dev, base); } exit: return ret; } static int msm_vidc_probe_vidc_device(struct platform_device *pdev) { int rc = 0; struct msm_vidc_core *core; struct device *dev; int nr = BASE_DEVICE_NUMBER; Loading Loading @@ -553,32 +599,13 @@ 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); msm_vidc_read_efuse_version(pdev, core->resources.pf_ver_tbl, "efuse"); devm_iounmap(&pdev->dev, base); } } vidc_driver->capability_version = msm_vidc_read_efuse_version( pdev, core->resources.pf_cap_tbl, "efuse2"); dprintk(VIDC_DBG, "populating sub devices\n"); /* Loading drivers/media/platform/msm/vidc/msm_vidc_internal.h +2 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-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 Loading Loading @@ -149,6 +149,7 @@ struct msm_vidc_drv { struct dentry *debugfs_root; int thermal_level; u32 platform_version; u32 capability_version; }; struct msm_video_device { Loading drivers/media/platform/msm/vidc/msm_vidc_res_parse.c +40 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-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 Loading Loading @@ -83,6 +83,12 @@ static inline void msm_vidc_free_platform_version_table( res->pf_ver_tbl = NULL; } static inline void msm_vidc_free_capability_version_table( struct msm_vidc_platform_resources *res) { res->pf_cap_tbl = NULL; } static inline void msm_vidc_free_freq_table( struct msm_vidc_platform_resources *res) { Loading Loading @@ -162,6 +168,7 @@ void msm_vidc_free_platform_resources( msm_vidc_free_regulator_table(res); msm_vidc_free_freq_table(res); msm_vidc_free_platform_version_table(res); msm_vidc_free_capability_version_table(res); msm_vidc_free_dcvs_table(res); msm_vidc_free_dcvs_limit(res); msm_vidc_free_cycles_per_mb_table(res); Loading Loading @@ -392,6 +399,33 @@ static int msm_vidc_load_platform_version_table( return 0; } static int msm_vidc_load_capability_version_table( struct msm_vidc_platform_resources *res) { int rc = 0; struct platform_device *pdev = res->pdev; if (!of_find_property(pdev->dev.of_node, "qcom,capability-version", NULL)) { dprintk(VIDC_DBG, "qcom,capability-version not found\n"); return 0; } rc = msm_vidc_load_u32_table(pdev, pdev->dev.of_node, "qcom,capability-version", sizeof(*res->pf_cap_tbl), (u32 **)&res->pf_cap_tbl, NULL); if (rc) { dprintk(VIDC_ERR, "%s: failed to read platform version table\n", __func__); return rc; } return 0; } static int msm_vidc_load_allowed_clocks_table( struct msm_vidc_platform_resources *res) { Loading Loading @@ -1007,6 +1041,11 @@ int read_platform_resources_from_dt( if (rc) dprintk(VIDC_ERR, "Failed to load pf version table: %d\n", rc); rc = msm_vidc_load_capability_version_table(res); if (rc) dprintk(VIDC_ERR, "Failed to load pf capability table: %d\n", rc); rc = msm_vidc_load_freq_table(res); if (rc) { dprintk(VIDC_ERR, "Failed to load freq table: %d\n", rc); Loading drivers/media/platform/msm/vidc/msm_vidc_resources.h +4 −3 Original line number Diff line number Diff line /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-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 Loading @@ -19,7 +19,7 @@ #include <media/msm_vidc.h> #define MAX_BUFFER_TYPES 32 struct platform_version_table { struct version_table { u32 version_mask; u32 version_shift; }; Loading Loading @@ -155,7 +155,8 @@ struct msm_vidc_platform_resources { phys_addr_t register_base; uint32_t register_size; uint32_t irq; struct platform_version_table *pf_ver_tbl; struct version_table *pf_ver_tbl; struct version_table *pf_cap_tbl; struct allowed_clock_rates_table *allowed_clks_tbl; u32 allowed_clks_tbl_size; struct clock_freq_table clock_freq_tbl; Loading Loading
Documentation/devicetree/bindings/media/video/msm-vidc.txt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ Optional properties: - interrupts : should contain the vidc interrupt. - qcom,platform-version : mask and shift of the platform version bits in efuse register. - qcom,capability-version : mask and shift of the capability 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: Loading
drivers/media/platform/msm/vidc/msm_v4l2_vidc.c +56 −29 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-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 Loading Loading @@ -416,10 +416,29 @@ static ssize_t store_platform_version(struct device *dev, static DEVICE_ATTR(platform_version, S_IRUGO, show_platform_version, store_platform_version); static ssize_t show_capability_version(struct device *dev, struct device_attribute *attr, char *buf) { return scnprintf(buf, PAGE_SIZE, "%d", vidc_driver->capability_version); } static ssize_t store_capability_version(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { dprintk(VIDC_WARN, "store capability version is not allowed\n"); return count; } static DEVICE_ATTR(capability_version, S_IRUGO, show_capability_version, store_capability_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_capability_version.attr, NULL }; Loading @@ -434,11 +453,38 @@ static const struct of_device_id msm_vidc_dt_match[] = { {} }; static int msm_vidc_probe_vidc_device(struct platform_device *pdev) static u32 msm_vidc_read_efuse_version(struct platform_device *pdev, struct version_table *table, const char *fuse_name) { int rc = 0; void __iomem *base; struct resource *res; u32 ret = 0; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, fuse_name); if (!res) { dprintk(VIDC_DBG, "Failed to get resource %s\n", fuse_name); goto exit; } base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!base) { dprintk(VIDC_ERR, "failed ioremap: res->start %#x, size %d\n", (u32)res->start, (u32)resource_size(res)); goto exit; } else { ret = readl_relaxed(base); ret = (ret & table->version_mask) >> table->version_shift; devm_iounmap(&pdev->dev, base); } exit: return ret; } static int msm_vidc_probe_vidc_device(struct platform_device *pdev) { int rc = 0; struct msm_vidc_core *core; struct device *dev; int nr = BASE_DEVICE_NUMBER; Loading Loading @@ -553,32 +599,13 @@ 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); msm_vidc_read_efuse_version(pdev, core->resources.pf_ver_tbl, "efuse"); devm_iounmap(&pdev->dev, base); } } vidc_driver->capability_version = msm_vidc_read_efuse_version( pdev, core->resources.pf_cap_tbl, "efuse2"); dprintk(VIDC_DBG, "populating sub devices\n"); /* Loading
drivers/media/platform/msm/vidc/msm_vidc_internal.h +2 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-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 Loading Loading @@ -149,6 +149,7 @@ struct msm_vidc_drv { struct dentry *debugfs_root; int thermal_level; u32 platform_version; u32 capability_version; }; struct msm_video_device { Loading
drivers/media/platform/msm/vidc/msm_vidc_res_parse.c +40 −1 Original line number Diff line number Diff line /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-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 Loading Loading @@ -83,6 +83,12 @@ static inline void msm_vidc_free_platform_version_table( res->pf_ver_tbl = NULL; } static inline void msm_vidc_free_capability_version_table( struct msm_vidc_platform_resources *res) { res->pf_cap_tbl = NULL; } static inline void msm_vidc_free_freq_table( struct msm_vidc_platform_resources *res) { Loading Loading @@ -162,6 +168,7 @@ void msm_vidc_free_platform_resources( msm_vidc_free_regulator_table(res); msm_vidc_free_freq_table(res); msm_vidc_free_platform_version_table(res); msm_vidc_free_capability_version_table(res); msm_vidc_free_dcvs_table(res); msm_vidc_free_dcvs_limit(res); msm_vidc_free_cycles_per_mb_table(res); Loading Loading @@ -392,6 +399,33 @@ static int msm_vidc_load_platform_version_table( return 0; } static int msm_vidc_load_capability_version_table( struct msm_vidc_platform_resources *res) { int rc = 0; struct platform_device *pdev = res->pdev; if (!of_find_property(pdev->dev.of_node, "qcom,capability-version", NULL)) { dprintk(VIDC_DBG, "qcom,capability-version not found\n"); return 0; } rc = msm_vidc_load_u32_table(pdev, pdev->dev.of_node, "qcom,capability-version", sizeof(*res->pf_cap_tbl), (u32 **)&res->pf_cap_tbl, NULL); if (rc) { dprintk(VIDC_ERR, "%s: failed to read platform version table\n", __func__); return rc; } return 0; } static int msm_vidc_load_allowed_clocks_table( struct msm_vidc_platform_resources *res) { Loading Loading @@ -1007,6 +1041,11 @@ int read_platform_resources_from_dt( if (rc) dprintk(VIDC_ERR, "Failed to load pf version table: %d\n", rc); rc = msm_vidc_load_capability_version_table(res); if (rc) dprintk(VIDC_ERR, "Failed to load pf capability table: %d\n", rc); rc = msm_vidc_load_freq_table(res); if (rc) { dprintk(VIDC_ERR, "Failed to load freq table: %d\n", rc); Loading
drivers/media/platform/msm/vidc/msm_vidc_resources.h +4 −3 Original line number Diff line number Diff line /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-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 Loading @@ -19,7 +19,7 @@ #include <media/msm_vidc.h> #define MAX_BUFFER_TYPES 32 struct platform_version_table { struct version_table { u32 version_mask; u32 version_shift; }; Loading Loading @@ -155,7 +155,8 @@ struct msm_vidc_platform_resources { phys_addr_t register_base; uint32_t register_size; uint32_t irq; struct platform_version_table *pf_ver_tbl; struct version_table *pf_ver_tbl; struct version_table *pf_cap_tbl; struct allowed_clock_rates_table *allowed_clks_tbl; u32 allowed_clks_tbl_size; struct clock_freq_table clock_freq_tbl; Loading