Commit 51b56c39 authored by Benoit Parrot's avatar Benoit Parrot Committed by Mauro Carvalho Chehab

[media] media: ti-vpe: Make colorspace converter library into its own module

In preparation to add colorspace conversion support to VIP,
we need to turn csc.c into its own kernel module.
Signed-off-by: default avatarBenoit Parrot <bparrot@ti.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent ee1c0294
...@@ -366,6 +366,7 @@ config VIDEO_TI_VPE ...@@ -366,6 +366,7 @@ config VIDEO_TI_VPE
select V4L2_MEM2MEM_DEV select V4L2_MEM2MEM_DEV
select VIDEO_TI_VPDMA select VIDEO_TI_VPDMA
select VIDEO_TI_SC select VIDEO_TI_SC
select VIDEO_TI_CSC
default n default n
---help--- ---help---
Support for the TI VPE(Video Processing Engine) block Support for the TI VPE(Video Processing Engine) block
...@@ -387,6 +388,9 @@ config VIDEO_TI_VPDMA ...@@ -387,6 +388,9 @@ config VIDEO_TI_VPDMA
config VIDEO_TI_SC config VIDEO_TI_SC
tristate tristate
config VIDEO_TI_CSC
tristate
menuconfig V4L_TEST_DRIVERS menuconfig V4L_TEST_DRIVERS
bool "Media test drivers" bool "Media test drivers"
depends on MEDIA_CAMERA_SUPPORT depends on MEDIA_CAMERA_SUPPORT
......
obj-$(CONFIG_VIDEO_TI_VPE) += ti-vpe.o obj-$(CONFIG_VIDEO_TI_VPE) += ti-vpe.o
obj-$(CONFIG_VIDEO_TI_VPDMA) += ti-vpdma.o obj-$(CONFIG_VIDEO_TI_VPDMA) += ti-vpdma.o
obj-$(CONFIG_VIDEO_TI_SC) += ti-sc.o obj-$(CONFIG_VIDEO_TI_SC) += ti-sc.o
obj-$(CONFIG_VIDEO_TI_CSC) += ti-csc.o
ti-vpe-y := vpe.o csc.o ti-vpe-y := vpe.o
ti-vpdma-y := vpdma.o ti-vpdma-y := vpdma.o
ti-sc-y := sc.o ti-sc-y := sc.o
ti-csc-y := csc.o
ccflags-$(CONFIG_VIDEO_TI_VPE_DEBUG) += -DDEBUG ccflags-$(CONFIG_VIDEO_TI_VPE_DEBUG) += -DDEBUG
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
...@@ -105,11 +106,13 @@ void csc_dump_regs(struct csc_data *csc) ...@@ -105,11 +106,13 @@ void csc_dump_regs(struct csc_data *csc)
#undef DUMPREG #undef DUMPREG
} }
EXPORT_SYMBOL(csc_dump_regs);
void csc_set_coeff_bypass(struct csc_data *csc, u32 *csc_reg5) void csc_set_coeff_bypass(struct csc_data *csc, u32 *csc_reg5)
{ {
*csc_reg5 |= CSC_BYPASS; *csc_reg5 |= CSC_BYPASS;
} }
EXPORT_SYMBOL(csc_set_coeff_bypass);
/* /*
* set the color space converter coefficient shadow register values * set the color space converter coefficient shadow register values
...@@ -160,8 +163,9 @@ void csc_set_coeff(struct csc_data *csc, u32 *csc_reg0, ...@@ -160,8 +163,9 @@ void csc_set_coeff(struct csc_data *csc, u32 *csc_reg0,
for (; coeff < end_coeff; coeff += 2) for (; coeff < end_coeff; coeff += 2)
*shadow_csc++ = (*(coeff + 1) << 16) | *coeff; *shadow_csc++ = (*(coeff + 1) << 16) | *coeff;
} }
EXPORT_SYMBOL(csc_set_coeff);
struct csc_data *csc_create(struct platform_device *pdev) struct csc_data *csc_create(struct platform_device *pdev, const char *res_name)
{ {
struct csc_data *csc; struct csc_data *csc;
...@@ -176,9 +180,10 @@ struct csc_data *csc_create(struct platform_device *pdev) ...@@ -176,9 +180,10 @@ struct csc_data *csc_create(struct platform_device *pdev)
csc->pdev = pdev; csc->pdev = pdev;
csc->res = platform_get_resource_byname(pdev, IORESOURCE_MEM, csc->res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"csc"); res_name);
if (csc->res == NULL) { if (csc->res == NULL) {
dev_err(&pdev->dev, "missing platform resources data\n"); dev_err(&pdev->dev, "missing '%s' platform resources data\n",
res_name);
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
...@@ -190,3 +195,8 @@ struct csc_data *csc_create(struct platform_device *pdev) ...@@ -190,3 +195,8 @@ struct csc_data *csc_create(struct platform_device *pdev)
return csc; return csc;
} }
EXPORT_SYMBOL(csc_create);
MODULE_DESCRIPTION("TI VIP/VPE Color Space Converter");
MODULE_AUTHOR("Texas Instruments Inc.");
MODULE_LICENSE("GPL v2");
...@@ -63,6 +63,6 @@ void csc_set_coeff_bypass(struct csc_data *csc, u32 *csc_reg5); ...@@ -63,6 +63,6 @@ void csc_set_coeff_bypass(struct csc_data *csc, u32 *csc_reg5);
void csc_set_coeff(struct csc_data *csc, u32 *csc_reg0, void csc_set_coeff(struct csc_data *csc, u32 *csc_reg0,
enum v4l2_colorspace src_colorspace, enum v4l2_colorspace src_colorspace,
enum v4l2_colorspace dst_colorspace); enum v4l2_colorspace dst_colorspace);
struct csc_data *csc_create(struct platform_device *pdev); struct csc_data *csc_create(struct platform_device *pdev, const char *res_name);
#endif #endif
...@@ -2496,7 +2496,7 @@ static int vpe_probe(struct platform_device *pdev) ...@@ -2496,7 +2496,7 @@ static int vpe_probe(struct platform_device *pdev)
goto runtime_put; goto runtime_put;
} }
dev->csc = csc_create(pdev); dev->csc = csc_create(pdev, "csc");
if (IS_ERR(dev->csc)) { if (IS_ERR(dev->csc)) {
ret = PTR_ERR(dev->csc); ret = PTR_ERR(dev->csc);
goto runtime_put; goto runtime_put;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment