Liam Girdwood | c0dfb4e | 2016-09-21 15:57:22 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016, Intel Corporation |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are met: |
| 7 | * * Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * * Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * * Neither the name of the Intel Corporation nor the |
| 13 | * names of its contributors may be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 26 | * POSSIBILITY OF SUCH DAMAGE. |
| 27 | * |
| 28 | * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com> |
| 29 | */ |
| 30 | |
| 31 | #include <stdint.h> |
| 32 | #include <stddef.h> |
Pierre-Louis Bossart | 81708a5 | 2018-04-04 18:46:50 -0500 | [diff] [blame] | 33 | #include <sof/lock.h> |
| 34 | #include <sof/list.h> |
| 35 | #include <sof/stream.h> |
| 36 | #include <sof/audio/component.h> |
Liam Girdwood | c0dfb4e | 2016-09-21 15:57:22 +0100 | [diff] [blame] | 37 | |
Liam Girdwood | 425aa5e | 2017-06-06 20:34:10 +0100 | [diff] [blame] | 38 | /* tracing */ |
| 39 | #define trace_switch(__e) trace_event(TRACE_CLASS_SWITCH, __e) |
| 40 | #define trace_switch_error(__e) trace_error(TRACE_CLASS_SWITCH, __e) |
| 41 | #define tracev_switch(__e) tracev_event(TRACE_CLASS_SWITCH, __e) |
Liam Girdwood | c0dfb4e | 2016-09-21 15:57:22 +0100 | [diff] [blame] | 42 | |
Liam Girdwood | 425aa5e | 2017-06-06 20:34:10 +0100 | [diff] [blame] | 43 | static struct comp_dev *switch_new(struct sof_ipc_comp *comp) |
| 44 | { |
| 45 | trace_switch("new"); |
| 46 | |
| 47 | return NULL; |
Liam Girdwood | c0dfb4e | 2016-09-21 15:57:22 +0100 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | static void switch_free(struct comp_dev *dev) |
| 51 | { |
| 52 | |
| 53 | } |
| 54 | |
Pierre-Louis Bossart | f945809 | 2017-11-09 15:24:07 -0600 | [diff] [blame] | 55 | /* set component audio stream parameters */ |
Liam Girdwood | 2cfaebe | 2017-08-21 17:13:52 +0100 | [diff] [blame] | 56 | static int switch_params(struct comp_dev *dev) |
Liam Girdwood | c0dfb4e | 2016-09-21 15:57:22 +0100 | [diff] [blame] | 57 | { |
| 58 | |
| 59 | return 0; |
| 60 | } |
| 61 | |
| 62 | /* used to pass standard and bespoke commands (with data) to component */ |
| 63 | static int switch_cmd(struct comp_dev *dev, int cmd, void *data) |
| 64 | { |
| 65 | /* switch will use buffer "connected" status */ |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | /* copy and process stream data from source to sink buffers */ |
| 70 | static int switch_copy(struct comp_dev *dev) |
| 71 | { |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | static int switch_reset(struct comp_dev *dev) |
| 77 | { |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | static int switch_prepare(struct comp_dev *dev) |
| 82 | { |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | struct comp_driver comp_switch = { |
Liam Girdwood | 425aa5e | 2017-06-06 20:34:10 +0100 | [diff] [blame] | 87 | .type = SOF_COMP_SWITCH, |
Liam Girdwood | c0dfb4e | 2016-09-21 15:57:22 +0100 | [diff] [blame] | 88 | .ops = { |
| 89 | .new = switch_new, |
| 90 | .free = switch_free, |
| 91 | .params = switch_params, |
| 92 | .cmd = switch_cmd, |
| 93 | .copy = switch_copy, |
| 94 | .prepare = switch_prepare, |
| 95 | .reset = switch_reset, |
| 96 | }, |
| 97 | }; |
| 98 | |
| 99 | void sys_comp_switch_init(void) |
| 100 | { |
| 101 | comp_register(&comp_switch); |
| 102 | } |