blob: ddc99f38c6dcd2feab993075df62f3785ec591ef [file] [log] [blame]
Hamad Kadmany6d2a9c72013-01-31 14:49:20 +02001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Joel Nider5556a852011-10-16 10:52:13 +02002 *
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 Nider435ad8e2011-12-14 16:53:30 +020016#include <linux/tspp.h> /* tspp_source */
17
Joel Nider5556a852011-10-16 10:52:13 +020018struct 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 Mulukutlae9ca54b2013-04-19 11:08:42 -070023 int tsif_vreg_present;
Joel Nider5556a852011-10-16 10:52:13 +020024};
25
Joel Nider435ad8e2011-12-14 16:53:30 +020026struct tspp_data_descriptor {
27 void *virt_base; /* logical address of the actual data */
28 u32 phys_base; /* physical address of the actual data */
Liron Kuch72b78552012-10-30 17:47:50 +020029 u32 size; /* size of buffer in bytes */
Joel Nider435ad8e2011-12-14 16:53:30 +020030 int id; /* unique identifier */
31 void *user; /* user-defined data */
32};
33
Liron Kuch72b78552012-10-30 17:47:50 +020034typedef void (tspp_notifier)(int channel_id, void *user);
35typedef void* (tspp_allocator)(int channel_id, u32 size,
Joel Nider435ad8e2011-12-14 16:53:30 +020036 u32 *phys_base, void *user);
Liron Kuch72b78552012-10-30 17:47:50 +020037typedef void (tspp_memfree)(int channel_id, u32 size,
38 void *virt_base, u32 phys_base, void *user);
Joel Nider435ad8e2011-12-14 16:53:30 +020039
40/* Kernel API functions */
Hamad Kadmany92705b32012-10-23 14:15:41 +020041int tspp_open_stream(u32 dev, u32 channel_id,
Liron Kuch72b78552012-10-30 17:47:50 +020042 struct tspp_select_source *source);
Joel Nider435ad8e2011-12-14 16:53:30 +020043int tspp_close_stream(u32 dev, u32 channel_id);
44int tspp_open_channel(u32 dev, u32 channel_id);
45int tspp_close_channel(u32 dev, u32 channel_id);
Hamad Kadmany6d2a9c72013-01-31 14:49:20 +020046int tspp_get_ref_clk_counter(u32 dev,
47 enum tspp_source source, u32 *tcr_counter);
Liron Kuch72b78552012-10-30 17:47:50 +020048int tspp_add_filter(u32 dev, u32 channel_id, struct tspp_filter *filter);
Joel Nider435ad8e2011-12-14 16:53:30 +020049int tspp_remove_filter(u32 dev, u32 channel_id, struct tspp_filter *filter);
50int tspp_set_key(u32 dev, u32 channel_id, struct tspp_key *key);
Liron Kuch72b78552012-10-30 17:47:50 +020051int tspp_register_notification(u32 dev, u32 channel_id, tspp_notifier *notify,
Joel Nider435ad8e2011-12-14 16:53:30 +020052 void *data, u32 timer_ms);
Liron Kuch72b78552012-10-30 17:47:50 +020053int tspp_unregister_notification(u32 dev, u32 channel_id);
54const struct tspp_data_descriptor *tspp_get_buffer(u32 dev, u32 channel_id);
55int tspp_release_buffer(u32 dev, u32 channel_id, u32 descriptor_id);
Joel Nider435ad8e2011-12-14 16:53:30 +020056int tspp_allocate_buffers(u32 dev, u32 channel_id, u32 count,
Liron Kuch72b78552012-10-30 17:47:50 +020057 u32 size, u32 int_freq, tspp_allocator *alloc,
58 tspp_memfree *memfree, void *user);
Joel Nider435ad8e2011-12-14 16:53:30 +020059
Joel Nider5556a852011-10-16 10:52:13 +020060#endif /* _MSM_TSPP_H_ */
61