From patchwork Wed Sep 28 21:23:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit Parrot X-Patchwork-Id: 9355015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2EF9560757 for ; Wed, 28 Sep 2016 21:25:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FA5A296D8 for ; Wed, 28 Sep 2016 21:25:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13AD1296DE; Wed, 28 Sep 2016 21:25:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A485D29700 for ; Wed, 28 Sep 2016 21:25:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754738AbcI1VZh (ORCPT ); Wed, 28 Sep 2016 17:25:37 -0400 Received: from arroyo.ext.ti.com ([198.47.19.12]:48750 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933875AbcI1VXY (ORCPT ); Wed, 28 Sep 2016 17:23:24 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id u8SLNHLJ008106; Wed, 28 Sep 2016 16:23:17 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u8SLNH1x022396; Wed, 28 Sep 2016 16:23:17 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Wed, 28 Sep 2016 16:23:16 -0500 Received: from uda0869644a.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u8SLNH99014286; Wed, 28 Sep 2016 16:23:17 -0500 From: Benoit Parrot To: Hans Verkuil CC: , Subject: [Patch 29/35] media: ti-vpe: Make scaler library into its own module Date: Wed, 28 Sep 2016 16:23:17 -0500 Message-ID: <20160928212317.27625-1-bparrot@ti.com> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation to add scaler support into VIP we need to turn sc.c into its own kernel module. Add support for multiple SC memory block as VIP contains 2 scaler instances. This is done by passing the resource name to sc_create() and modify the vpe invocation accordingly. Signed-off-by: Benoit Parrot --- drivers/media/platform/Kconfig | 4 ++++ drivers/media/platform/ti-vpe/Makefile | 4 +++- drivers/media/platform/ti-vpe/sc.c | 17 ++++++++++++++--- drivers/media/platform/ti-vpe/sc.h | 2 +- drivers/media/platform/ti-vpe/vpe.c | 2 +- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 3c15c5a53bd5..169626371a89 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -335,6 +335,7 @@ config VIDEO_TI_VPE select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV select VIDEO_TI_VPDMA + select VIDEO_TI_SC default n ---help--- Support for the TI VPE(Video Processing Engine) block @@ -353,6 +354,9 @@ endif # V4L_MEM2MEM_DRIVERS config VIDEO_TI_VPDMA tristate +config VIDEO_TI_SC + tristate + menuconfig V4L_TEST_DRIVERS bool "Media test drivers" depends on MEDIA_CAMERA_SUPPORT diff --git a/drivers/media/platform/ti-vpe/Makefile b/drivers/media/platform/ti-vpe/Makefile index faca5e115c1d..736558d309ad 100644 --- a/drivers/media/platform/ti-vpe/Makefile +++ b/drivers/media/platform/ti-vpe/Makefile @@ -1,8 +1,10 @@ obj-$(CONFIG_VIDEO_TI_VPE) += ti-vpe.o obj-$(CONFIG_VIDEO_TI_VPDMA) += ti-vpdma.o +obj-$(CONFIG_VIDEO_TI_SC) += ti-sc.o -ti-vpe-y := vpe.o sc.o csc.o +ti-vpe-y := vpe.o csc.o ti-vpdma-y := vpdma.o +ti-sc-y := sc.o ccflags-$(CONFIG_VIDEO_TI_VPE_DEBUG) += -DDEBUG diff --git a/drivers/media/platform/ti-vpe/sc.c b/drivers/media/platform/ti-vpe/sc.c index 02f3dae8ae42..52ce1450362f 100644 --- a/drivers/media/platform/ti-vpe/sc.c +++ b/drivers/media/platform/ti-vpe/sc.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -52,6 +53,7 @@ void sc_dump_regs(struct sc_data *sc) #undef DUMPREG } +EXPORT_SYMBOL(sc_dump_regs); /* * set the horizontal scaler coefficients according to the ratio of output to @@ -100,6 +102,7 @@ void sc_set_hs_coeffs(struct sc_data *sc, void *addr, unsigned int src_w, sc->load_coeff_h = true; } +EXPORT_SYMBOL(sc_set_hs_coeffs); /* * set the vertical scaler coefficients according to the ratio of output to @@ -140,6 +143,7 @@ void sc_set_vs_coeffs(struct sc_data *sc, void *addr, unsigned int src_h, sc->load_coeff_v = true; } +EXPORT_SYMBOL(sc_set_vs_coeffs); void sc_config_scaler(struct sc_data *sc, u32 *sc_reg0, u32 *sc_reg8, u32 *sc_reg17, unsigned int src_w, unsigned int src_h, @@ -267,8 +271,9 @@ void sc_config_scaler(struct sc_data *sc, u32 *sc_reg0, u32 *sc_reg8, *sc_reg24 = (src_w << CFG_ORG_W_SHIFT) | (src_h << CFG_ORG_H_SHIFT); } +EXPORT_SYMBOL(sc_config_scaler); -struct sc_data *sc_create(struct platform_device *pdev) +struct sc_data *sc_create(struct platform_device *pdev, const char *res_name) { struct sc_data *sc; @@ -282,9 +287,10 @@ struct sc_data *sc_create(struct platform_device *pdev) sc->pdev = pdev; - sc->res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sc"); + sc->res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); if (!sc->res) { - 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); } @@ -296,3 +302,8 @@ struct sc_data *sc_create(struct platform_device *pdev) return sc; } +EXPORT_SYMBOL(sc_create); + +MODULE_DESCRIPTION("TI VIP/VPE Scaler"); +MODULE_AUTHOR("Texas Instruments Inc."); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/media/platform/ti-vpe/sc.h b/drivers/media/platform/ti-vpe/sc.h index de947db98990..d0aab5ef0eca 100644 --- a/drivers/media/platform/ti-vpe/sc.h +++ b/drivers/media/platform/ti-vpe/sc.h @@ -200,6 +200,6 @@ void sc_set_vs_coeffs(struct sc_data *sc, void *addr, unsigned int src_h, void sc_config_scaler(struct sc_data *sc, u32 *sc_reg0, u32 *sc_reg8, u32 *sc_reg17, unsigned int src_w, unsigned int src_h, unsigned int dst_w, unsigned int dst_h); -struct sc_data *sc_create(struct platform_device *pdev); +struct sc_data *sc_create(struct platform_device *pdev, const char *res_name); #endif diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index 875da06acd67..d0d222b3a173 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -2454,7 +2454,7 @@ static int vpe_probe(struct platform_device *pdev) vpe_top_vpdma_reset(dev); - dev->sc = sc_create(pdev); + dev->sc = sc_create(pdev, "sc"); if (IS_ERR(dev->sc)) { ret = PTR_ERR(dev->sc); goto runtime_put;