OSDN Git Service

Merge tag 'v4.4.196' of https://shanghai.source.codeaurora.org/quic/la/kernel/msm...
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / include / sound / wcd-spi.h
1 /*
2  * Copyright (c) 2016, The Linux Foundation. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 and
6  * only version 2 as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13
14 #ifndef __WCD_SPI_H__
15 #define __WCD_SPI_H__
16
17 struct wcd_spi_msg {
18         /*
19          * Caller's buffer pointer that holds data to
20          * be transmitted in case of data_write and
21          * data to be copied to in case of data_read.
22          */
23         void *data;
24
25         /* Length of data to write/read */
26         size_t len;
27
28         /*
29          * Address in remote memory to write to
30          * or read from.
31          */
32         u32 remote_addr;
33
34         /* Bitmask of flags, currently unused */
35         u32 flags;
36 };
37
38 #ifdef CONFIG_SND_SOC_WCD_SPI
39
40 int wcd_spi_data_write(struct spi_device *spi, struct wcd_spi_msg *msg);
41 int wcd_spi_data_read(struct spi_device *spi, struct wcd_spi_msg *msg);
42
43 #else
44
45 int wcd_spi_data_write(struct spi_device *spi, struct wcd_spi_msg *msg)
46 {
47         return -ENODEV;
48 }
49
50 int wcd_spi_data_read(struct spi_device *spi, struct wcd_spi_msg *msg)
51 {
52         return -ENODEV;
53 }
54
55 #endif /* End of CONFIG_SND_SOC_WCD_SPI */
56
57 #endif /* End of __WCD_SPI_H__ */