From patchwork Fri Apr 20 17:42:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10353395 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 0B65A600CC for ; Fri, 20 Apr 2018 17:43:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F012A284FC for ; Fri, 20 Apr 2018 17:43:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4C342876B; Fri, 20 Apr 2018 17:43:11 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 6D6B5284FC for ; Fri, 20 Apr 2018 17:43:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753494AbeDTRnJ (ORCPT ); Fri, 20 Apr 2018 13:43:09 -0400 Received: from osg.samsung.com ([64.30.133.232]:44402 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753514AbeDTRnB (ORCPT ); Fri, 20 Apr 2018 13:43:01 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 104C438CF5; Fri, 20 Apr 2018 10:43:01 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PhHfemLFznaT; Fri, 20 Apr 2018 10:43:00 -0700 (PDT) Received: from smtp.s-opensource.com (unknown [179.179.47.30]) by osg.samsung.com (Postfix) with ESMTPSA id 9AAC238CB5; Fri, 20 Apr 2018 10:42:57 -0700 (PDT) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.90_1) (envelope-from ) id 1f9a3j-0003nE-1Z; Fri, 20 Apr 2018 13:42:55 -0400 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Florian Tobias Schandinat , Hans Verkuil , Arnd Bergmann , Sakari Ailus , Stanimir Varbanov , Philipp Zabel , Ramesh Shanmugasundaram , Jacob Chen , Bhumika Goyal , Al Viro , linux-fbdev@vger.kernel.org Subject: [PATCH 7/7] media: via-camera: allow build on non-x86 archs with COMPILE_TEST Date: Fri, 20 Apr 2018 13:42:53 -0400 Message-Id: <396bfb33e763c31ead093ac1035b2ecf7311b5bc.1524245455.git.mchehab@s-opensource.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: To: unlisted-recipients:; (no To-header on input) 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 This driver depends on FB_VIA for lots of things. Provide stubs for the functions it needs, in order to allow building it with COMPILE_TEST outside x86 architecture. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/Kconfig | 2 +- drivers/media/platform/via-camera.c | 10 +++++++++- include/linux/via-core.h | 17 +++++++++++++++++ include/linux/via-gpio.h | 4 ++++ include/linux/via_i2c.h | 5 +++++ 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index e3229f7baed1..abaaed98a044 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -15,7 +15,7 @@ source "drivers/media/platform/marvell-ccic/Kconfig" config VIDEO_VIA_CAMERA tristate "VIAFB camera controller support" - depends on FB_VIA + depends on FB_VIA || COMPILE_TEST select VIDEOBUF_DMA_SG select VIDEO_OV7670 help diff --git a/drivers/media/platform/via-camera.c b/drivers/media/platform/via-camera.c index e9a02639554b..4ab1695b33af 100644 --- a/drivers/media/platform/via-camera.c +++ b/drivers/media/platform/via-camera.c @@ -27,7 +27,10 @@ #include #include #include + +#ifdef CONFIG_FB_VIA #include +#endif #include "via-camera.h" @@ -1283,6 +1286,11 @@ static bool viacam_serial_is_enabled(void) struct pci_bus *pbus = pci_find_bus(0, 0); u8 cbyte; +#ifdef CONFIG_FB_VIA + if (!machine_is_olpc()) + return false; +#endif + if (!pbus) return false; pci_bus_read_config_byte(pbus, VIACAM_SERIAL_DEVFN, @@ -1343,7 +1351,7 @@ static int viacam_probe(struct platform_device *pdev) return -ENOMEM; } - if (machine_is_olpc() && viacam_serial_is_enabled()) + if (viacam_serial_is_enabled()) return -EBUSY; /* diff --git a/include/linux/via-core.h b/include/linux/via-core.h index 9c21cdf3e3b3..7aaee6a82392 100644 --- a/include/linux/via-core.h +++ b/include/linux/via-core.h @@ -70,8 +70,12 @@ struct viafb_pm_hooks { void *private; }; +#ifdef CONFIG_FB_VIA void viafb_pm_register(struct viafb_pm_hooks *hooks); void viafb_pm_unregister(struct viafb_pm_hooks *hooks); +#else +void viafb_pm_register(struct viafb_pm_hooks *hooks) {} +#endif /* CONFIG_FB_VIA */ #endif /* CONFIG_PM */ /* @@ -113,8 +117,13 @@ struct viafb_dev { * Interrupt management. */ +#ifdef CONFIG_FB_VIA void viafb_irq_enable(u32 mask); void viafb_irq_disable(u32 mask); +#else +static inline void viafb_irq_enable(u32 mask) {} +static inline void viafb_irq_disable(u32 mask) {} +#endif /* * The global interrupt control register and its bits. @@ -157,10 +166,18 @@ void viafb_irq_disable(u32 mask); /* * DMA management. */ +#ifdef CONFIG_FB_VIA int viafb_request_dma(void); void viafb_release_dma(void); /* void viafb_dma_copy_out(unsigned int offset, dma_addr_t paddr, int len); */ int viafb_dma_copy_out_sg(unsigned int offset, struct scatterlist *sg, int nsg); +#else +static inline int viafb_request_dma(void) { return 0; } +static inline void viafb_release_dma(void) {} +static inline int viafb_dma_copy_out_sg(unsigned int offset, + struct scatterlist *sg, int nsg) +{ return 0; } +#endif /* * DMA Controller registers. diff --git a/include/linux/via-gpio.h b/include/linux/via-gpio.h index 8281aea3dd6d..b5a96cf7a874 100644 --- a/include/linux/via-gpio.h +++ b/include/linux/via-gpio.h @@ -8,7 +8,11 @@ #ifndef __VIA_GPIO_H__ #define __VIA_GPIO_H__ +#ifdef CONFIG_FB_VIA extern int viafb_gpio_lookup(const char *name); extern int viafb_gpio_init(void); extern void viafb_gpio_exit(void); +#else +static inline int viafb_gpio_lookup(const char *name) { return 0; } +#endif #endif diff --git a/include/linux/via_i2c.h b/include/linux/via_i2c.h index 44532e468c05..61ae0e7e4576 100644 --- a/include/linux/via_i2c.h +++ b/include/linux/via_i2c.h @@ -32,6 +32,7 @@ struct via_i2c_stuff { }; +#ifdef CONFIG_FB_VIA int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata); int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data); int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len); @@ -39,4 +40,8 @@ struct i2c_adapter *viafb_find_i2c_adapter(enum viafb_i2c_adap which); extern int viafb_i2c_init(void); extern void viafb_i2c_exit(void); +#else +struct i2c_adapter *viafb_find_i2c_adapter(enum viafb_i2c_adap which) +{ return NULL; } +#endif #endif /* __VIA_I2C_H__ */