Hamad Kadmany | 6d2a9c7 | 2013-01-31 14:49:20 +0200 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Joel Nider | 5556a85 | 2011-10-16 10:52:13 +0200 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _MSM_TSPP_H_ |
| 14 | #define _MSM_TSPP_H_ |
| 15 | |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 16 | #include <linux/tspp.h> /* tspp_source */ |
| 17 | |
Joel Nider | 5556a85 | 2011-10-16 10:52:13 +0200 | [diff] [blame] | 18 | struct msm_tspp_platform_data { |
| 19 | int num_gpios; |
| 20 | const struct msm_gpio *gpios; |
| 21 | const char *tsif_pclk; |
| 22 | const char *tsif_ref_clk; |
Vikram Mulukutla | e9ca54b | 2013-04-19 11:08:42 -0700 | [diff] [blame] | 23 | int tsif_vreg_present; |
Joel Nider | 5556a85 | 2011-10-16 10:52:13 +0200 | [diff] [blame] | 24 | }; |
| 25 | |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 26 | struct tspp_data_descriptor { |
| 27 | void *virt_base; /* logical address of the actual data */ |
| 28 | u32 phys_base; /* physical address of the actual data */ |
Liron Kuch | 72b7855 | 2012-10-30 17:47:50 +0200 | [diff] [blame] | 29 | u32 size; /* size of buffer in bytes */ |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 30 | int id; /* unique identifier */ |
| 31 | void *user; /* user-defined data */ |
| 32 | }; |
| 33 | |
Liron Kuch | 72b7855 | 2012-10-30 17:47:50 +0200 | [diff] [blame] | 34 | typedef void (tspp_notifier)(int channel_id, void *user); |
| 35 | typedef void* (tspp_allocator)(int channel_id, u32 size, |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 36 | u32 *phys_base, void *user); |
Liron Kuch | 72b7855 | 2012-10-30 17:47:50 +0200 | [diff] [blame] | 37 | typedef void (tspp_memfree)(int channel_id, u32 size, |
| 38 | void *virt_base, u32 phys_base, void *user); |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 39 | |
| 40 | /* Kernel API functions */ |
Hamad Kadmany | 92705b3 | 2012-10-23 14:15:41 +0200 | [diff] [blame] | 41 | int tspp_open_stream(u32 dev, u32 channel_id, |
Liron Kuch | 72b7855 | 2012-10-30 17:47:50 +0200 | [diff] [blame] | 42 | struct tspp_select_source *source); |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 43 | int tspp_close_stream(u32 dev, u32 channel_id); |
| 44 | int tspp_open_channel(u32 dev, u32 channel_id); |
| 45 | int tspp_close_channel(u32 dev, u32 channel_id); |
Hamad Kadmany | 6d2a9c7 | 2013-01-31 14:49:20 +0200 | [diff] [blame] | 46 | int tspp_get_ref_clk_counter(u32 dev, |
| 47 | enum tspp_source source, u32 *tcr_counter); |
Liron Kuch | 72b7855 | 2012-10-30 17:47:50 +0200 | [diff] [blame] | 48 | int tspp_add_filter(u32 dev, u32 channel_id, struct tspp_filter *filter); |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 49 | int tspp_remove_filter(u32 dev, u32 channel_id, struct tspp_filter *filter); |
| 50 | int tspp_set_key(u32 dev, u32 channel_id, struct tspp_key *key); |
Liron Kuch | 72b7855 | 2012-10-30 17:47:50 +0200 | [diff] [blame] | 51 | int tspp_register_notification(u32 dev, u32 channel_id, tspp_notifier *notify, |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 52 | void *data, u32 timer_ms); |
Liron Kuch | 72b7855 | 2012-10-30 17:47:50 +0200 | [diff] [blame] | 53 | int tspp_unregister_notification(u32 dev, u32 channel_id); |
| 54 | const struct tspp_data_descriptor *tspp_get_buffer(u32 dev, u32 channel_id); |
| 55 | int tspp_release_buffer(u32 dev, u32 channel_id, u32 descriptor_id); |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 56 | int tspp_allocate_buffers(u32 dev, u32 channel_id, u32 count, |
Liron Kuch | 72b7855 | 2012-10-30 17:47:50 +0200 | [diff] [blame] | 57 | u32 size, u32 int_freq, tspp_allocator *alloc, |
| 58 | tspp_memfree *memfree, void *user); |
Joel Nider | 435ad8e | 2011-12-14 16:53:30 +0200 | [diff] [blame] | 59 | |
Joel Nider | 5556a85 | 2011-10-16 10:52:13 +0200 | [diff] [blame] | 60 | #endif /* _MSM_TSPP_H_ */ |
| 61 | |