1 // SPDX-License-Identifier: BSD-3-Clause
2 //
3 // Copyright(c) 2016 Intel Corporation. All rights reserved.
4 //
5 // Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
6
7 #include <sof/audio/component.h>
8 #include <sof/common.h>
9 #include <sof/lib/memory.h>
10 #include <sof/lib/uuid.h>
11 #include <sof/trace/trace.h>
12 #include <sof/ut.h>
13 #include <ipc/topology.h>
14 #include <user/trace.h>
15 #include <stddef.h>
16
17 static const struct comp_driver comp_switch;
18
19 /* 385cc44b-f34e-4b9b-8be0-535c5f43a825 */
20 DECLARE_SOF_RT_UUID("switch", switch_uuid, 0x385cc44b, 0xf34e, 0x4b9b,
21 0x8b, 0xe0, 0x53, 0x5c, 0x5f, 0x43, 0xa8, 0x25);
22
23 DECLARE_TR_CTX(switch_tr, SOF_UUID(switch_uuid), LOG_LEVEL_INFO);
24
switch_new(const struct comp_driver * drv,struct comp_ipc_config * config,void * spec)25 static struct comp_dev *switch_new(const struct comp_driver *drv,
26 struct comp_ipc_config *config,
27 void *spec)
28 {
29 comp_cl_info(&comp_switch, "switch_new()");
30
31 return NULL;
32 }
33
switch_free(struct comp_dev * dev)34 static void switch_free(struct comp_dev *dev)
35 {
36 }
37
38 /* set component audio stream parameters */
switch_params(struct comp_dev * dev,struct sof_ipc_stream_params * params)39 static int switch_params(struct comp_dev *dev,
40 struct sof_ipc_stream_params *params)
41 {
42 return 0;
43 }
44
45 /* used to pass standard and bespoke commands (with data) to component */
switch_cmd(struct comp_dev * dev,int cmd,void * data,int max_data_size)46 static int switch_cmd(struct comp_dev *dev, int cmd, void *data,
47 int max_data_size)
48 {
49 /* switch will use buffer "connected" status */
50 return 0;
51 }
52
53 /* copy and process stream data from source to sink buffers */
switch_copy(struct comp_dev * dev)54 static int switch_copy(struct comp_dev *dev)
55 {
56 return 0;
57 }
58
switch_reset(struct comp_dev * dev)59 static int switch_reset(struct comp_dev *dev)
60 {
61 return 0;
62 }
63
switch_prepare(struct comp_dev * dev)64 static int switch_prepare(struct comp_dev *dev)
65 {
66 return 0;
67 }
68
69 static const struct comp_driver comp_switch = {
70 .type = SOF_COMP_SWITCH,
71 .uid = SOF_RT_UUID(switch_uuid),
72 .tctx = &switch_tr,
73 .ops = {
74 .create = switch_new,
75 .free = switch_free,
76 .params = switch_params,
77 .cmd = switch_cmd,
78 .copy = switch_copy,
79 .prepare = switch_prepare,
80 .reset = switch_reset,
81 },
82 };
83
84 static SHARED_DATA struct comp_driver_info comp_switch_info = {
85 .drv = &comp_switch,
86 };
87
sys_comp_switch_init(void)88 UT_STATIC void sys_comp_switch_init(void)
89 {
90 comp_register(platform_shared_get(&comp_switch_info,
91 sizeof(comp_switch_info)));
92 }
93
94 DECLARE_MODULE(sys_comp_switch_init);
95