Chris Lew | fa6135e | 2016-08-01 13:29:46 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. |
| 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 | #ifndef _SOC_QCOM_GLINK_RPM_XPRT_H_ |
| 13 | #define _SOC_QCOM_GLINK_RPM_XPRT_H_ |
| 14 | |
| 15 | #include <linux/types.h> |
| 16 | |
| 17 | #ifdef CONFIG_MSM_GLINK |
| 18 | |
| 19 | /** |
| 20 | * glink_rpm_rx_poll() - Poll and receive any available events |
| 21 | * @handle: Channel handle in which this operation is performed. |
| 22 | * |
| 23 | * This function is used to poll and receive events and packets while the |
| 24 | * receive interrupt from RPM is disabled. |
| 25 | * |
| 26 | * Note that even if a return value > 0 is returned indicating that some events |
| 27 | * were processed, clients should only use the notification functions passed |
| 28 | * into glink_open() to determine if an entire packet has been received since |
| 29 | * some events may be internal details that are not visible to clients. |
| 30 | * |
| 31 | * Return: 0 for no packets available; > 0 for events available; standard |
| 32 | * Linux error codes on failure. |
| 33 | */ |
| 34 | int glink_rpm_rx_poll(void *handle); |
| 35 | |
| 36 | /** |
| 37 | * glink_rpm_mask_rx_interrupt() - Mask or unmask the RPM receive interrupt |
| 38 | * @handle: Channel handle in which this operation is performed. |
| 39 | * @mask: Flag to mask or unmask the interrupt. |
| 40 | * @pstruct: Pointer to any platform specific data. |
| 41 | * |
| 42 | * This function is used to mask or unmask the receive interrupt from RPM. |
| 43 | * "mask" set to true indicates masking the interrupt and when set to false |
| 44 | * indicates unmasking the interrupt. |
| 45 | * |
| 46 | * Return: 0 on success, standard Linux error codes on failure. |
| 47 | */ |
| 48 | int glink_rpm_mask_rx_interrupt(void *handle, bool mask, void *pstruct); |
| 49 | |
| 50 | /** |
| 51 | * glink_wait_link_down() - Return whether read/write indices in FIFO are all 0. |
| 52 | * @handle: Channel handle in which this operation is performed. |
| 53 | * |
| 54 | * This function returns the status of the read/write indices in the FIFO. |
| 55 | * |
| 56 | * Return: 1 if the indices are all 0, 0 otherwise. |
| 57 | */ |
| 58 | int glink_wait_link_down(void *handle); |
| 59 | |
| 60 | #else |
| 61 | static inline int glink_rpm_rx_poll(void *handle) |
| 62 | { |
| 63 | return -ENODEV; |
| 64 | } |
| 65 | |
| 66 | static inline int glink_rpm_mask_rx_interrupt(void *handle, bool mask, |
| 67 | void *pstruct) |
| 68 | { |
| 69 | return -ENODEV; |
| 70 | } |
| 71 | static inline int glink_wait_link_down(void *handle) |
| 72 | { |
| 73 | return -ENODEV; |
| 74 | } |
| 75 | |
| 76 | #endif /* CONFIG_MSM_GLINK */ |
| 77 | |
| 78 | #endif /* _SOC_QCOM_GLINK_RPM_XPRT_H_ */ |