ath25: switch default kernel to 5.15
[openwrt/staging/ldir.git] / target / linux / at91 / patches-5.10 / 190-media-atmel-fix-build-when-ISC-m-and-XISC-y.patch
1 From dfcc0395f5e838c0b5c3fb93c9335b6a8892178a Mon Sep 17 00:00:00 2001
2 From: Eugen Hristev <eugen.hristev@microchip.com>
3 Date: Mon, 5 Jul 2021 14:57:08 +0200
4 Subject: [PATCH 190/247] media: atmel: fix build when ISC=m and XISC=y
5
6 Building VIDEO_ATMEL_ISC as module and VIDEO_ATMEL_XISC as built-in
7 (or viceversa) causes build errors:
8
9 or1k-linux-ld: drivers/media/platform/atmel/atmel-isc-base.o: in function `isc_async_complete':
10 atmel-isc-base.c:(.text+0x40d0): undefined reference to `__this_module'
11 or1k-linux-ld: atmel-isc-base.c:(.text+0x40f0): undefined reference to `__this_module'
12 or1k-linux-ld: drivers/media/platform/atmel/atmel-isc-base.o:(.rodata+0x390): undefined reference to `__this_module'
13 or1k-linux-ld: drivers/media/platform/atmel/atmel-isc-base.o:(__param+0x4): undefined reference to `__this_module'
14 or1k-linux-ld: drivers/media/platform/atmel/atmel-isc-base.o:(__param+0x18): undefined reference to `__this_module'
15
16 This is caused by the file atmel-isc-base.c which is common code between
17 the two drivers.
18
19 The solution is to create another Kconfig symbol that is automatically
20 selected and generates the module atmel-isc-base.ko. This module can be
21 loaded when both drivers are modules, or built-in when at least one of them
22 is built-in.
23
24 Reported-by: kernel test robot <lkp@intel.com>
25 Fixes: c9aa973884a1 ("media: atmel: atmel-isc: add microchip-xisc driver")
26 Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
27 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
28 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
29 ---
30 drivers/media/platform/atmel/Kconfig | 8 ++++++++
31 drivers/media/platform/atmel/Makefile | 5 +++--
32 drivers/media/platform/atmel/atmel-isc-base.c | 11 +++++++++++
33 3 files changed, 22 insertions(+), 2 deletions(-)
34
35 --- a/drivers/media/platform/atmel/Kconfig
36 +++ b/drivers/media/platform/atmel/Kconfig
37 @@ -8,6 +8,7 @@ config VIDEO_ATMEL_ISC
38 select VIDEOBUF2_DMA_CONTIG
39 select REGMAP_MMIO
40 select V4L2_FWNODE
41 + select VIDEO_ATMEL_ISC_BASE
42 help
43 This module makes the ATMEL Image Sensor Controller available
44 as a v4l2 device.
45 @@ -19,10 +20,17 @@ config VIDEO_ATMEL_XISC
46 select VIDEOBUF2_DMA_CONTIG
47 select REGMAP_MMIO
48 select V4L2_FWNODE
49 + select VIDEO_ATMEL_ISC_BASE
50 help
51 This module makes the ATMEL eXtended Image Sensor Controller
52 available as a v4l2 device.
53
54 +config VIDEO_ATMEL_ISC_BASE
55 + tristate
56 + default n
57 + help
58 + ATMEL ISC and XISC common code base.
59 +
60 config VIDEO_ATMEL_ISI
61 tristate "ATMEL Image Sensor Interface (ISI) support"
62 depends on VIDEO_V4L2 && OF
63 --- a/drivers/media/platform/atmel/Makefile
64 +++ b/drivers/media/platform/atmel/Makefile
65 @@ -1,7 +1,8 @@
66 # SPDX-License-Identifier: GPL-2.0-only
67 -atmel-isc-objs = atmel-sama5d2-isc.o atmel-isc-base.o
68 -atmel-xisc-objs = atmel-sama7g5-isc.o atmel-isc-base.o
69 +atmel-isc-objs = atmel-sama5d2-isc.o
70 +atmel-xisc-objs = atmel-sama7g5-isc.o
71
72 obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o
73 +obj-$(CONFIG_VIDEO_ATMEL_ISC_BASE) += atmel-isc-base.o
74 obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o
75 obj-$(CONFIG_VIDEO_ATMEL_XISC) += atmel-xisc.o
76 --- a/drivers/media/platform/atmel/atmel-isc-base.c
77 +++ b/drivers/media/platform/atmel/atmel-isc-base.c
78 @@ -378,6 +378,7 @@ int isc_clk_init(struct isc_device *isc)
79
80 return 0;
81 }
82 +EXPORT_SYMBOL_GPL(isc_clk_init);
83
84 void isc_clk_cleanup(struct isc_device *isc)
85 {
86 @@ -392,6 +393,7 @@ void isc_clk_cleanup(struct isc_device *
87 clk_unregister(isc_clk->clk);
88 }
89 }
90 +EXPORT_SYMBOL_GPL(isc_clk_cleanup);
91
92 static int isc_queue_setup(struct vb2_queue *vq,
93 unsigned int *nbuffers, unsigned int *nplanes,
94 @@ -1575,6 +1577,7 @@ irqreturn_t isc_interrupt(int irq, void
95
96 return ret;
97 }
98 +EXPORT_SYMBOL_GPL(isc_interrupt);
99
100 static void isc_hist_count(struct isc_device *isc, u32 *min, u32 *max)
101 {
102 @@ -2209,6 +2212,7 @@ const struct v4l2_async_notifier_operati
103 .unbind = isc_async_unbind,
104 .complete = isc_async_complete,
105 };
106 +EXPORT_SYMBOL_GPL(isc_async_ops);
107
108 void isc_subdev_cleanup(struct isc_device *isc)
109 {
110 @@ -2221,6 +2225,7 @@ void isc_subdev_cleanup(struct isc_devic
111
112 INIT_LIST_HEAD(&isc->subdev_entities);
113 }
114 +EXPORT_SYMBOL_GPL(isc_subdev_cleanup);
115
116 int isc_pipeline_init(struct isc_device *isc)
117 {
118 @@ -2261,6 +2266,7 @@ int isc_pipeline_init(struct isc_device
119
120 return 0;
121 }
122 +EXPORT_SYMBOL_GPL(isc_pipeline_init);
123
124 /* regmap configuration */
125 #define ATMEL_ISC_REG_MAX 0xd5c
126 @@ -2270,4 +2276,9 @@ const struct regmap_config isc_regmap_co
127 .val_bits = 32,
128 .max_register = ATMEL_ISC_REG_MAX,
129 };
130 +EXPORT_SYMBOL_GPL(isc_regmap_config);
131
132 +MODULE_AUTHOR("Songjun Wu");
133 +MODULE_AUTHOR("Eugen Hristev");
134 +MODULE_DESCRIPTION("Atmel ISC common code base");
135 +MODULE_LICENSE("GPL v2");