video: tegra: adf: replace nvmap_alloc_dmabuf with v4l2 API
Krishna Reddy [Fri, 1 Aug 2014 21:33:42 +0000 (14:33 -0700)]
Replace deprecated nvmap_alloc_dmabuf with V4L2 videobuf2 contig dma API.

Bug 1540346

Change-Id: I06dd4a64a5a548d29443a0dfb8e4ccdeee62644c
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/450681
(cherry picked from commit 9fa74918f508958b99d0314581683969454f9eb3)
Reviewed-on: http://git-master/r/456779
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/video/tegra/Kconfig
drivers/video/tegra/tegra_adf.c

index 7de456f..fd00dd0 100644 (file)
@@ -113,6 +113,7 @@ config ADF_TEGRA
        depends on TEGRA_DC && ADF
        default ADF
        select ADF_FBDEV
+       select VIDEOBUF2_DMA_CONTIG
        help
          ADF device support for the Tegra display controller.
 
index 3c76095..90b3fe8 100644 (file)
  *
  */
 
-#include <linux/nvmap.h>
+#include <linux/gfp.h>
+#include <media/videobuf2-dma-contig.h>
 #include <video/adf.h>
 #include <video/adf_fbdev.h>
 #include <video/adf_format.h>
 
 #include "dc/dc_config.h"
 #include "dc/dc_priv.h"
-#include "nvmap/nvmap_priv.h"
 #include "tegra_adf.h"
 
 struct tegra_adf_info {
@@ -30,6 +30,7 @@ struct tegra_adf_info {
        struct adf_interface            intf;
        struct adf_overlay_engine       eng;
        struct tegra_dc                 *dc;
+       void                            *vb2_dma_conf;
 };
 
 #define adf_dev_to_tegra(p) \
@@ -810,6 +811,9 @@ static int tegra_adf_intf_alloc_simple_buffer(struct adf_interface *intf,
                struct dma_buf **dma_buf, u32 *offset, u32 *pitch)
 {
        size_t i;
+       struct tegra_adf_info *adf_info = adf_intf_to_tegra(intf);
+       const struct vb2_mem_ops *mem_ops = &vb2_dma_contig_memops;
+       void *vb2_buf;
        bool format_valid = false;
 
        for (i = 0; i < ARRAY_SIZE(tegra_adf_formats); i++) {
@@ -961,6 +965,10 @@ struct tegra_adf_info *tegra_adf_init(struct platform_device *ndev,
        if (err < 0)
                goto err_attach;
 
+       adf_info->vb2_dma_conf = vb2_dma_contig_init_ctx(&ndev->dev);
+       if ((err = IS_ERR(adf_info->vb2_dma_conf)))
+               goto err_attach;
+
        if (dc->out->n_modes) {
                err = tegra_adf_process_hotplug_connected(adf_info, NULL);
                if (err < 0)