From patchwork Fri Apr 20 19:03:21 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: 10353545 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 3733660231 for ; Fri, 20 Apr 2018 19:03:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2825A2882E for ; Fri, 20 Apr 2018 19:03:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C97328832; Fri, 20 Apr 2018 19:03:32 +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=unavailable 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 A81C72882E for ; Fri, 20 Apr 2018 19:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751375AbeDTTD3 (ORCPT ); Fri, 20 Apr 2018 15:03:29 -0400 Received: from osg.samsung.com ([64.30.133.232]:61924 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbeDTTD3 (ORCPT ); Fri, 20 Apr 2018 15:03:29 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id D8A5338FD2; Fri, 20 Apr 2018 12:03:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0t-ZnoIW9Jxv; Fri, 20 Apr 2018 12:03:27 -0700 (PDT) Received: from vento.lan (unknown [179.179.47.30]) by osg.samsung.com (Postfix) with ESMTPSA id DD9A838FCC; Fri, 20 Apr 2018 12:03:24 -0700 (PDT) Date: Fri, 20 Apr 2018 16:03:21 -0300 From: Mauro Carvalho Chehab Cc: 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 v2 7/7] media: via-camera: allow build on non-x86 archs with COMPILE_TEST Message-ID: <20180420160321.4ecefa00@vento.lan> In-Reply-To: <396bfb33e763c31ead093ac1035b2ecf7311b5bc.1524245455.git.mchehab@s-opensource.com> References: <396bfb33e763c31ead093ac1035b2ecf7311b5bc.1524245455.git.mchehab@s-opensource.com> Organization: Samsung X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 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 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..ced4419baef8 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 +static inline 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..209bff950e22 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,9 @@ 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 +static inline +struct i2c_adapter *viafb_find_i2c_adapter(enum viafb_i2c_adap which) +{ return NULL; } +#endif #endif /* __VIA_I2C_H__ */