aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-03-08 17:12:53 +0100
committerTakashi Iwai <tiwai@suse.de>2021-03-08 17:13:35 +0100
commit279ace49a63bcb6a03b2d8a161b444173840bf98 (patch)
treecab024c29b89b7c7aba0509c9db5ab9545d33415
parent23b0dfdbe5e44ce8cc0c2a1b53c98acba520b269 (diff)
downloadhda-emu-279ace49a63bcb6a03b2d8a161b444173840bf98.tar.gz
Build also hdac_controller.c
A part of it is actually used now. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/linux/device.h6
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/wrapper.h19
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/hdac_controller.c4
5 files changed, 31 insertions, 2 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 386b792..293af0b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -42,7 +42,11 @@ struct device {
#define dev_info(dev, fmt, args...) pr_info(fmt, ##args)
#define dev_dbg(dev, fmt, args...) pr_debug(fmt, ##args)
-/* device management */
+#define dev_err_ratelimited(dev, fmt, args...) pr_err(fmt, ##args)
+#define dev_warn_ratelimited(dev, fmt, args...) pr_err(fmt, ##args)
+#define dev_info_ratelimited(dev, fmt, args...) pr_err(fmt, ##args)
+#define dev_dbg_ratelimited(dev, fmt, args...) pr_err(fmt, ##args)
+
struct device;
#define get_device(dev) /* NOP */
#define put_device(dev) /* NOP */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index b0ce893..1c194ac 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -27,6 +27,8 @@ static inline size_t strlcpy(char *dest, const char *src, size_t size)
return ret;
}
+#define strscpy(a,b,c) strlcpy(a,b,c)
+
static inline void *kmemdup(const void *src, size_t size, int gfp)
{
void *dst = kmalloc(size, GFP_KERNEL);
diff --git a/include/wrapper.h b/include/wrapper.h
index 579664d..c453937 100644
--- a/include/wrapper.h
+++ b/include/wrapper.h
@@ -5,6 +5,7 @@
#define __HDA_WRAPPER_H
#include <stdarg.h>
+#include <linux/delay.h>
#define min(x, y) ({ \
typeof(x) _min1 = (x); \
@@ -159,6 +160,7 @@ typedef unsigned int uuid_le;
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define cond_resched()
+#define schedule_timeout(x)
#undef abs
#define abs(x) ({ \
@@ -183,6 +185,9 @@ typedef unsigned int uuid_le;
static inline bool time_after_eq(unsigned long a, unsigned long b)
{ return 1; }
+static inline bool time_after(unsigned long a, unsigned long b)
+{ return 1; }
+
static inline bool time_before(unsigned long a, unsigned long b)
{ return 0; }
@@ -201,6 +206,8 @@ static inline int _WARN_ON(int cond, const char *func, int line)
#define WARN_ON(cond) _WARN_ON(!!(cond), __func__, __LINE__)
+#define WARN_ON_ONCE(cond) WARN_ON(cond)
+
#define simple_strtoul strtoul
#define simple_strtol strtol
@@ -361,4 +368,16 @@ struct completion {
#define DIV_ROUND_UP(a, b) (((a) + (b) - 1) / (b))
#define roundup(a, b) (DIV_ROUND_UP(a, b) * (b))
+
+/* XXX just for hdac_controller.c */
+typedef int wait_queue_entry_t;
+#define waitqueue_active(x) false
+#define wake_up(x) do {} while (0)
+#define init_wait_entry(x,y) do {} while (0)
+#define prepare_to_wait(x,y,z) do {} while (0)
+#define finish_wait(x,y) do {} while (0)
+
+#define snd_dma_alloc_pages(type, dev, size, dp) 0
+#define snd_dma_free_pages(dp)
+
#endif /* __HDA_WRAPPER_H */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index b15ac9e..227d6c0 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,4 +1,4 @@
noinst_LIBRARIES = libhdacore.a
libhdacore_a_SOURCES = hda_bus_type.c hdac_bus.c hdac_device.c hdac_sysfs.c \
- hdac_regmap.c array.c hdac_stream.c hdmi_chmap.c
+ hdac_regmap.c array.c hdac_stream.c hdmi_chmap.c hdac_controller.c
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/dist/include
diff --git a/lib/hdac_controller.c b/lib/hdac_controller.c
new file mode 100644
index 0000000..9016a3b
--- /dev/null
+++ b/lib/hdac_controller.c
@@ -0,0 +1,4 @@
+#define snd_hdac_bus_send_cmd __dontuse_snd_hdac_bus_send_cmd
+#define snd_hdac_bus_get_response __dontuse_snd_hdac_bus_get_response
+
+#include "../dist/sound/hda/hdac_controller.c"