1 /* SPDX-License-Identifier: GPL-2.0-only */ << 2 /* 1 /* 3 * HSI core header file. 2 * HSI core header file. 4 * 3 * 5 * Copyright (C) 2010 Nokia Corporation. All r 4 * Copyright (C) 2010 Nokia Corporation. All rights reserved. 6 * 5 * 7 * Contact: Carlos Chinea <carlos.chinea@nokia 6 * Contact: Carlos Chinea <carlos.chinea@nokia.com> >> 7 * >> 8 * This program is free software; you can redistribute it and/or >> 9 * modify it under the terms of the GNU General Public License >> 10 * version 2 as published by the Free Software Foundation. >> 11 * >> 12 * This program is distributed in the hope that it will be useful, but >> 13 * WITHOUT ANY WARRANTY; without even the implied warranty of >> 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> 15 * General Public License for more details. >> 16 * >> 17 * You should have received a copy of the GNU General Public License >> 18 * along with this program; if not, write to the Free Software >> 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA >> 20 * 02110-1301 USA 8 */ 21 */ 9 22 10 #ifndef __LINUX_HSI_H__ 23 #ifndef __LINUX_HSI_H__ 11 #define __LINUX_HSI_H__ 24 #define __LINUX_HSI_H__ 12 25 13 #include <linux/device.h> 26 #include <linux/device.h> 14 #include <linux/mutex.h> 27 #include <linux/mutex.h> 15 #include <linux/scatterlist.h> 28 #include <linux/scatterlist.h> 16 #include <linux/list.h> 29 #include <linux/list.h> 17 #include <linux/module.h> 30 #include <linux/module.h> 18 #include <linux/notifier.h> 31 #include <linux/notifier.h> 19 32 20 /* HSI message ttype */ 33 /* HSI message ttype */ 21 #define HSI_MSG_READ 0 34 #define HSI_MSG_READ 0 22 #define HSI_MSG_WRITE 1 35 #define HSI_MSG_WRITE 1 23 36 24 /* HSI configuration values */ 37 /* HSI configuration values */ 25 enum { 38 enum { 26 HSI_MODE_STREAM = 1, 39 HSI_MODE_STREAM = 1, 27 HSI_MODE_FRAME, 40 HSI_MODE_FRAME, 28 }; 41 }; 29 42 30 enum { 43 enum { 31 HSI_FLOW_SYNC, /* Synchronized flow * 44 HSI_FLOW_SYNC, /* Synchronized flow */ 32 HSI_FLOW_PIPE, /* Pipelined flow */ 45 HSI_FLOW_PIPE, /* Pipelined flow */ 33 }; 46 }; 34 47 35 enum { 48 enum { 36 HSI_ARB_RR, /* Round-robin arbitra 49 HSI_ARB_RR, /* Round-robin arbitration */ 37 HSI_ARB_PRIO, /* Channel priority ar 50 HSI_ARB_PRIO, /* Channel priority arbitration */ 38 }; 51 }; 39 52 40 #define HSI_MAX_CHANNELS 16 53 #define HSI_MAX_CHANNELS 16 41 54 42 /* HSI message status codes */ 55 /* HSI message status codes */ 43 enum { 56 enum { 44 HSI_STATUS_COMPLETED, /* Message tra 57 HSI_STATUS_COMPLETED, /* Message transfer is completed */ 45 HSI_STATUS_PENDING, /* Message pen 58 HSI_STATUS_PENDING, /* Message pending to be read/write (POLL) */ 46 HSI_STATUS_PROCEEDING, /* Message tra 59 HSI_STATUS_PROCEEDING, /* Message transfer is ongoing */ 47 HSI_STATUS_QUEUED, /* Message wai 60 HSI_STATUS_QUEUED, /* Message waiting to be served */ 48 HSI_STATUS_ERROR, /* Error when 61 HSI_STATUS_ERROR, /* Error when message transfer was ongoing */ 49 }; 62 }; 50 63 51 /* HSI port event codes */ 64 /* HSI port event codes */ 52 enum { 65 enum { 53 HSI_EVENT_START_RX, 66 HSI_EVENT_START_RX, 54 HSI_EVENT_STOP_RX, 67 HSI_EVENT_STOP_RX, 55 }; 68 }; 56 69 57 /** 70 /** 58 * struct hsi_channel - channel resource used 71 * struct hsi_channel - channel resource used by the hsi clients 59 * @id: Channel number 72 * @id: Channel number 60 * @name: Channel name 73 * @name: Channel name 61 */ 74 */ 62 struct hsi_channel { 75 struct hsi_channel { 63 unsigned int id; 76 unsigned int id; 64 const char *name; 77 const char *name; 65 }; 78 }; 66 79 67 /** 80 /** 68 * struct hsi_config - Configuration for RX/TX 81 * struct hsi_config - Configuration for RX/TX HSI modules 69 * @mode: Bit transmission mode (STREAM or FRA 82 * @mode: Bit transmission mode (STREAM or FRAME) 70 * @channels: Channel resources used by the cl 83 * @channels: Channel resources used by the client 71 * @num_channels: Number of channel resources 84 * @num_channels: Number of channel resources 72 * @num_hw_channels: Number of channels the tr 85 * @num_hw_channels: Number of channels the transceiver is configured for [1..16] 73 * @speed: Max bit transmission speed (Kbit/s) 86 * @speed: Max bit transmission speed (Kbit/s) 74 * @flow: RX flow type (SYNCHRONIZED or PIPELI 87 * @flow: RX flow type (SYNCHRONIZED or PIPELINE) 75 * @arb_mode: Arbitration mode for TX frame (R 88 * @arb_mode: Arbitration mode for TX frame (Round robin, priority) 76 */ 89 */ 77 struct hsi_config { 90 struct hsi_config { 78 unsigned int mode; 91 unsigned int mode; 79 struct hsi_channel *channels; 92 struct hsi_channel *channels; 80 unsigned int num_channels; 93 unsigned int num_channels; 81 unsigned int num_hw_channel 94 unsigned int num_hw_channels; 82 unsigned int speed; 95 unsigned int speed; 83 union { 96 union { 84 unsigned int flow; 97 unsigned int flow; /* RX only */ 85 unsigned int arb_mode; 98 unsigned int arb_mode; /* TX only */ 86 }; 99 }; 87 }; 100 }; 88 101 89 /** 102 /** 90 * struct hsi_board_info - HSI client board in 103 * struct hsi_board_info - HSI client board info 91 * @name: Name for the HSI device 104 * @name: Name for the HSI device 92 * @hsi_id: HSI controller id where the client 105 * @hsi_id: HSI controller id where the client sits 93 * @port: Port number in the controller where 106 * @port: Port number in the controller where the client sits 94 * @tx_cfg: HSI TX configuration 107 * @tx_cfg: HSI TX configuration 95 * @rx_cfg: HSI RX configuration 108 * @rx_cfg: HSI RX configuration 96 * @platform_data: Platform related data 109 * @platform_data: Platform related data 97 * @archdata: Architecture-dependent device da 110 * @archdata: Architecture-dependent device data 98 */ 111 */ 99 struct hsi_board_info { 112 struct hsi_board_info { 100 const char *name; 113 const char *name; 101 unsigned int hsi_id; 114 unsigned int hsi_id; 102 unsigned int port; 115 unsigned int port; 103 struct hsi_config tx_cfg; 116 struct hsi_config tx_cfg; 104 struct hsi_config rx_cfg; 117 struct hsi_config rx_cfg; 105 void *platform_data 118 void *platform_data; 106 struct dev_archdata *archdata; 119 struct dev_archdata *archdata; 107 }; 120 }; 108 121 109 #ifdef CONFIG_HSI_BOARDINFO 122 #ifdef CONFIG_HSI_BOARDINFO 110 extern int hsi_register_board_info(struct hsi_ 123 extern int hsi_register_board_info(struct hsi_board_info const *info, 111 124 unsigned int len); 112 #else 125 #else 113 static inline int hsi_register_board_info(stru 126 static inline int hsi_register_board_info(struct hsi_board_info const *info, 114 127 unsigned int len) 115 { 128 { 116 return 0; 129 return 0; 117 } 130 } 118 #endif /* CONFIG_HSI_BOARDINFO */ 131 #endif /* CONFIG_HSI_BOARDINFO */ 119 132 120 /** 133 /** 121 * struct hsi_client - HSI client attached to 134 * struct hsi_client - HSI client attached to an HSI port 122 * @device: Driver model representation of the 135 * @device: Driver model representation of the device 123 * @tx_cfg: HSI TX configuration 136 * @tx_cfg: HSI TX configuration 124 * @rx_cfg: HSI RX configuration 137 * @rx_cfg: HSI RX configuration 125 */ 138 */ 126 struct hsi_client { 139 struct hsi_client { 127 struct device device; 140 struct device device; 128 struct hsi_config tx_cfg; 141 struct hsi_config tx_cfg; 129 struct hsi_config rx_cfg; 142 struct hsi_config rx_cfg; 130 /* private: */ 143 /* private: */ 131 void (*ehandler)(st 144 void (*ehandler)(struct hsi_client *, unsigned long); 132 unsigned int pclaimed:1; 145 unsigned int pclaimed:1; 133 struct notifier_block nb; 146 struct notifier_block nb; 134 }; 147 }; 135 148 136 #define to_hsi_client(dev) container_of(dev, s 149 #define to_hsi_client(dev) container_of(dev, struct hsi_client, device) 137 150 138 static inline void hsi_client_set_drvdata(stru 151 static inline void hsi_client_set_drvdata(struct hsi_client *cl, void *data) 139 { 152 { 140 dev_set_drvdata(&cl->device, data); 153 dev_set_drvdata(&cl->device, data); 141 } 154 } 142 155 143 static inline void *hsi_client_drvdata(struct 156 static inline void *hsi_client_drvdata(struct hsi_client *cl) 144 { 157 { 145 return dev_get_drvdata(&cl->device); 158 return dev_get_drvdata(&cl->device); 146 } 159 } 147 160 148 int hsi_register_port_event(struct hsi_client 161 int hsi_register_port_event(struct hsi_client *cl, 149 void (*handler)(struct 162 void (*handler)(struct hsi_client *, unsigned long)); 150 int hsi_unregister_port_event(struct hsi_clien 163 int hsi_unregister_port_event(struct hsi_client *cl); 151 164 152 /** 165 /** 153 * struct hsi_client_driver - Driver associate 166 * struct hsi_client_driver - Driver associated to an HSI client 154 * @driver: Driver model representation of the 167 * @driver: Driver model representation of the driver 155 */ 168 */ 156 struct hsi_client_driver { 169 struct hsi_client_driver { 157 struct device_driver driver; 170 struct device_driver driver; 158 }; 171 }; 159 172 160 #define to_hsi_client_driver(drv) container_of 173 #define to_hsi_client_driver(drv) container_of(drv, struct hsi_client_driver,\ 161 174 driver) 162 175 163 int hsi_register_client_driver(struct hsi_clie 176 int hsi_register_client_driver(struct hsi_client_driver *drv); 164 177 165 static inline void hsi_unregister_client_drive 178 static inline void hsi_unregister_client_driver(struct hsi_client_driver *drv) 166 { 179 { 167 driver_unregister(&drv->driver); 180 driver_unregister(&drv->driver); 168 } 181 } 169 182 170 /** 183 /** 171 * struct hsi_msg - HSI message descriptor 184 * struct hsi_msg - HSI message descriptor 172 * @link: Free to use by the current descripto 185 * @link: Free to use by the current descriptor owner 173 * @cl: HSI device client that issues the tran 186 * @cl: HSI device client that issues the transfer 174 * @sgt: Head of the scatterlist array 187 * @sgt: Head of the scatterlist array 175 * @context: Client context data associated to 188 * @context: Client context data associated to the transfer 176 * @complete: Transfer completion callback 189 * @complete: Transfer completion callback 177 * @destructor: Destructor to free resources w 190 * @destructor: Destructor to free resources when flushing 178 * @status: Status of the transfer when comple 191 * @status: Status of the transfer when completed 179 * @actual_len: Actual length of data transfer 192 * @actual_len: Actual length of data transferred on completion 180 * @channel: Channel were to TX/RX the message 193 * @channel: Channel were to TX/RX the message 181 * @ttype: Transfer type (TX if set, RX otherw 194 * @ttype: Transfer type (TX if set, RX otherwise) 182 * @break_frame: if true HSI will send/receive 195 * @break_frame: if true HSI will send/receive a break frame. Data buffers are 183 * ignored in the request. 196 * ignored in the request. 184 */ 197 */ 185 struct hsi_msg { 198 struct hsi_msg { 186 struct list_head link; 199 struct list_head link; 187 struct hsi_client *cl; 200 struct hsi_client *cl; 188 struct sg_table sgt; 201 struct sg_table sgt; 189 void *context; 202 void *context; 190 203 191 void (*complete)(st 204 void (*complete)(struct hsi_msg *msg); 192 void (*destructor)( 205 void (*destructor)(struct hsi_msg *msg); 193 206 194 int status; 207 int status; 195 unsigned int actual_len; 208 unsigned int actual_len; 196 unsigned int channel; 209 unsigned int channel; 197 unsigned int ttype:1; 210 unsigned int ttype:1; 198 unsigned int break_frame:1; 211 unsigned int break_frame:1; 199 }; 212 }; 200 213 201 struct hsi_msg *hsi_alloc_msg(unsigned int n_f 214 struct hsi_msg *hsi_alloc_msg(unsigned int n_frag, gfp_t flags); 202 void hsi_free_msg(struct hsi_msg *msg); 215 void hsi_free_msg(struct hsi_msg *msg); 203 216 204 /** 217 /** 205 * struct hsi_port - HSI port device 218 * struct hsi_port - HSI port device 206 * @device: Driver model representation of the 219 * @device: Driver model representation of the device 207 * @tx_cfg: Current TX path configuration 220 * @tx_cfg: Current TX path configuration 208 * @rx_cfg: Current RX path configuration 221 * @rx_cfg: Current RX path configuration 209 * @num: Port number 222 * @num: Port number 210 * @shared: Set when port can be shared by dif 223 * @shared: Set when port can be shared by different clients 211 * @claimed: Reference count of clients which 224 * @claimed: Reference count of clients which claimed the port 212 * @lock: Serialize port claim 225 * @lock: Serialize port claim 213 * @async: Asynchronous transfer callback 226 * @async: Asynchronous transfer callback 214 * @setup: Callback to set the HSI client conf 227 * @setup: Callback to set the HSI client configuration 215 * @flush: Callback to clean the HW state and 228 * @flush: Callback to clean the HW state and destroy all pending transfers 216 * @start_tx: Callback to inform that a client 229 * @start_tx: Callback to inform that a client wants to TX data 217 * @stop_tx: Callback to inform that a client 230 * @stop_tx: Callback to inform that a client no longer wishes to TX data 218 * @release: Callback to inform that a client 231 * @release: Callback to inform that a client no longer uses the port 219 * @n_head: Notifier chain for signaling port 232 * @n_head: Notifier chain for signaling port events to the clients. 220 */ 233 */ 221 struct hsi_port { 234 struct hsi_port { 222 struct device device 235 struct device device; 223 struct hsi_config tx_cfg 236 struct hsi_config tx_cfg; 224 struct hsi_config rx_cfg 237 struct hsi_config rx_cfg; 225 unsigned int num; 238 unsigned int num; 226 unsigned int shared 239 unsigned int shared:1; 227 int claime 240 int claimed; 228 struct mutex lock; 241 struct mutex lock; 229 int (*asyn 242 int (*async)(struct hsi_msg *msg); 230 int (*setu 243 int (*setup)(struct hsi_client *cl); 231 int (*flus 244 int (*flush)(struct hsi_client *cl); 232 int (*star 245 int (*start_tx)(struct hsi_client *cl); 233 int (*stop 246 int (*stop_tx)(struct hsi_client *cl); 234 int (*rele 247 int (*release)(struct hsi_client *cl); 235 /* private */ 248 /* private */ 236 struct blocking_notifier_head n_head 249 struct blocking_notifier_head n_head; 237 }; 250 }; 238 251 239 #define to_hsi_port(dev) container_of(dev, str 252 #define to_hsi_port(dev) container_of(dev, struct hsi_port, device) 240 #define hsi_get_port(cl) to_hsi_port((cl)->dev 253 #define hsi_get_port(cl) to_hsi_port((cl)->device.parent) 241 254 242 int hsi_event(struct hsi_port *port, unsigned 255 int hsi_event(struct hsi_port *port, unsigned long event); 243 int hsi_claim_port(struct hsi_client *cl, unsi 256 int hsi_claim_port(struct hsi_client *cl, unsigned int share); 244 void hsi_release_port(struct hsi_client *cl); 257 void hsi_release_port(struct hsi_client *cl); 245 258 246 static inline int hsi_port_claimed(struct hsi_ 259 static inline int hsi_port_claimed(struct hsi_client *cl) 247 { 260 { 248 return cl->pclaimed; 261 return cl->pclaimed; 249 } 262 } 250 263 251 static inline void hsi_port_set_drvdata(struct 264 static inline void hsi_port_set_drvdata(struct hsi_port *port, void *data) 252 { 265 { 253 dev_set_drvdata(&port->device, data); 266 dev_set_drvdata(&port->device, data); 254 } 267 } 255 268 256 static inline void *hsi_port_drvdata(struct hs 269 static inline void *hsi_port_drvdata(struct hsi_port *port) 257 { 270 { 258 return dev_get_drvdata(&port->device); 271 return dev_get_drvdata(&port->device); 259 } 272 } 260 273 261 /** 274 /** 262 * struct hsi_controller - HSI controller devi 275 * struct hsi_controller - HSI controller device 263 * @device: Driver model representation of the 276 * @device: Driver model representation of the device 264 * @owner: Pointer to the module owning the co 277 * @owner: Pointer to the module owning the controller 265 * @id: HSI controller ID 278 * @id: HSI controller ID 266 * @num_ports: Number of ports in the HSI cont 279 * @num_ports: Number of ports in the HSI controller 267 * @port: Array of HSI ports 280 * @port: Array of HSI ports 268 */ 281 */ 269 struct hsi_controller { 282 struct hsi_controller { 270 struct device device; 283 struct device device; 271 struct module *owner; 284 struct module *owner; 272 unsigned int id; 285 unsigned int id; 273 unsigned int num_ports; 286 unsigned int num_ports; 274 struct hsi_port **port; 287 struct hsi_port **port; 275 }; 288 }; 276 289 277 #define to_hsi_controller(dev) container_of(de 290 #define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device) 278 291 279 struct hsi_controller *hsi_alloc_controller(un 292 struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags); 280 void hsi_put_controller(struct hsi_controller 293 void hsi_put_controller(struct hsi_controller *hsi); 281 int hsi_register_controller(struct hsi_control 294 int hsi_register_controller(struct hsi_controller *hsi); 282 void hsi_unregister_controller(struct hsi_cont 295 void hsi_unregister_controller(struct hsi_controller *hsi); 283 struct hsi_client *hsi_new_client(struct hsi_p 296 struct hsi_client *hsi_new_client(struct hsi_port *port, 284 297 struct hsi_board_info *info); 285 int hsi_remove_client(struct device *dev, void 298 int hsi_remove_client(struct device *dev, void *data); 286 void hsi_port_unregister_clients(struct hsi_po 299 void hsi_port_unregister_clients(struct hsi_port *port); 287 300 288 #ifdef CONFIG_OF 301 #ifdef CONFIG_OF 289 void hsi_add_clients_from_dt(struct hsi_port * 302 void hsi_add_clients_from_dt(struct hsi_port *port, 290 struct device_nod 303 struct device_node *clients); 291 #else 304 #else 292 static inline void hsi_add_clients_from_dt(str 305 static inline void hsi_add_clients_from_dt(struct hsi_port *port, 293 str 306 struct device_node *clients) 294 { 307 { 295 return; 308 return; 296 } 309 } 297 #endif 310 #endif 298 311 299 static inline void hsi_controller_set_drvdata( 312 static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi, 300 313 void *data) 301 { 314 { 302 dev_set_drvdata(&hsi->device, data); 315 dev_set_drvdata(&hsi->device, data); 303 } 316 } 304 317 305 static inline void *hsi_controller_drvdata(str 318 static inline void *hsi_controller_drvdata(struct hsi_controller *hsi) 306 { 319 { 307 return dev_get_drvdata(&hsi->device); 320 return dev_get_drvdata(&hsi->device); 308 } 321 } 309 322 310 static inline struct hsi_port *hsi_find_port_n 323 static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi, 311 324 unsigned int num) 312 { 325 { 313 return (num < hsi->num_ports) ? hsi->p 326 return (num < hsi->num_ports) ? hsi->port[num] : NULL; 314 } 327 } 315 328 316 /* 329 /* 317 * API for HSI clients 330 * API for HSI clients 318 */ 331 */ 319 int hsi_async(struct hsi_client *cl, struct hs 332 int hsi_async(struct hsi_client *cl, struct hsi_msg *msg); 320 333 321 int hsi_get_channel_id_by_name(struct hsi_clie 334 int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name); 322 335 323 /** 336 /** 324 * hsi_id - Get HSI controller ID associated t 337 * hsi_id - Get HSI controller ID associated to a client 325 * @cl: Pointer to a HSI client 338 * @cl: Pointer to a HSI client 326 * 339 * 327 * Return the controller id where the client i 340 * Return the controller id where the client is attached to 328 */ 341 */ 329 static inline unsigned int hsi_id(struct hsi_c 342 static inline unsigned int hsi_id(struct hsi_client *cl) 330 { 343 { 331 return to_hsi_controller(cl->device.p 344 return to_hsi_controller(cl->device.parent->parent)->id; 332 } 345 } 333 346 334 /** 347 /** 335 * hsi_port_id - Gets the port number a client 348 * hsi_port_id - Gets the port number a client is attached to 336 * @cl: Pointer to HSI client 349 * @cl: Pointer to HSI client 337 * 350 * 338 * Return the port number associated to the cl 351 * Return the port number associated to the client 339 */ 352 */ 340 static inline unsigned int hsi_port_id(struct 353 static inline unsigned int hsi_port_id(struct hsi_client *cl) 341 { 354 { 342 return to_hsi_port(cl->device.parent) 355 return to_hsi_port(cl->device.parent)->num; 343 } 356 } 344 357 345 /** 358 /** 346 * hsi_setup - Configure the client's port 359 * hsi_setup - Configure the client's port 347 * @cl: Pointer to the HSI client 360 * @cl: Pointer to the HSI client 348 * 361 * 349 * When sharing ports, clients should either r 362 * When sharing ports, clients should either relay on a single 350 * client setup or have the same setup for all 363 * client setup or have the same setup for all of them. 351 * 364 * 352 * Return -errno on failure, 0 on success 365 * Return -errno on failure, 0 on success 353 */ 366 */ 354 static inline int hsi_setup(struct hsi_client 367 static inline int hsi_setup(struct hsi_client *cl) 355 { 368 { 356 if (!hsi_port_claimed(cl)) 369 if (!hsi_port_claimed(cl)) 357 return -EACCES; 370 return -EACCES; 358 return hsi_get_port(cl)->setup(cl); 371 return hsi_get_port(cl)->setup(cl); 359 } 372 } 360 373 361 /** 374 /** 362 * hsi_flush - Flush all pending transactions 375 * hsi_flush - Flush all pending transactions on the client's port 363 * @cl: Pointer to the HSI client 376 * @cl: Pointer to the HSI client 364 * 377 * 365 * This function will destroy all pending hsi_ 378 * This function will destroy all pending hsi_msg in the port and reset 366 * the HW port so it is ready to receive and t 379 * the HW port so it is ready to receive and transmit from a clean state. 367 * 380 * 368 * Return -errno on failure, 0 on success 381 * Return -errno on failure, 0 on success 369 */ 382 */ 370 static inline int hsi_flush(struct hsi_client 383 static inline int hsi_flush(struct hsi_client *cl) 371 { 384 { 372 if (!hsi_port_claimed(cl)) 385 if (!hsi_port_claimed(cl)) 373 return -EACCES; 386 return -EACCES; 374 return hsi_get_port(cl)->flush(cl); 387 return hsi_get_port(cl)->flush(cl); 375 } 388 } 376 389 377 /** 390 /** 378 * hsi_async_read - Submit a read transfer 391 * hsi_async_read - Submit a read transfer 379 * @cl: Pointer to the HSI client 392 * @cl: Pointer to the HSI client 380 * @msg: HSI message descriptor of the transfe 393 * @msg: HSI message descriptor of the transfer 381 * 394 * 382 * Return -errno on failure, 0 on success 395 * Return -errno on failure, 0 on success 383 */ 396 */ 384 static inline int hsi_async_read(struct hsi_cl 397 static inline int hsi_async_read(struct hsi_client *cl, struct hsi_msg *msg) 385 { 398 { 386 msg->ttype = HSI_MSG_READ; 399 msg->ttype = HSI_MSG_READ; 387 return hsi_async(cl, msg); 400 return hsi_async(cl, msg); 388 } 401 } 389 402 390 /** 403 /** 391 * hsi_async_write - Submit a write transfer 404 * hsi_async_write - Submit a write transfer 392 * @cl: Pointer to the HSI client 405 * @cl: Pointer to the HSI client 393 * @msg: HSI message descriptor of the transfe 406 * @msg: HSI message descriptor of the transfer 394 * 407 * 395 * Return -errno on failure, 0 on success 408 * Return -errno on failure, 0 on success 396 */ 409 */ 397 static inline int hsi_async_write(struct hsi_c 410 static inline int hsi_async_write(struct hsi_client *cl, struct hsi_msg *msg) 398 { 411 { 399 msg->ttype = HSI_MSG_WRITE; 412 msg->ttype = HSI_MSG_WRITE; 400 return hsi_async(cl, msg); 413 return hsi_async(cl, msg); 401 } 414 } 402 415 403 /** 416 /** 404 * hsi_start_tx - Signal the port that the cli 417 * hsi_start_tx - Signal the port that the client wants to start a TX 405 * @cl: Pointer to the HSI client 418 * @cl: Pointer to the HSI client 406 * 419 * 407 * Return -errno on failure, 0 on success 420 * Return -errno on failure, 0 on success 408 */ 421 */ 409 static inline int hsi_start_tx(struct hsi_clie 422 static inline int hsi_start_tx(struct hsi_client *cl) 410 { 423 { 411 if (!hsi_port_claimed(cl)) 424 if (!hsi_port_claimed(cl)) 412 return -EACCES; 425 return -EACCES; 413 return hsi_get_port(cl)->start_tx(cl); 426 return hsi_get_port(cl)->start_tx(cl); 414 } 427 } 415 428 416 /** 429 /** 417 * hsi_stop_tx - Signal the port that the clie 430 * hsi_stop_tx - Signal the port that the client no longer wants to transmit 418 * @cl: Pointer to the HSI client 431 * @cl: Pointer to the HSI client 419 * 432 * 420 * Return -errno on failure, 0 on success 433 * Return -errno on failure, 0 on success 421 */ 434 */ 422 static inline int hsi_stop_tx(struct hsi_clien 435 static inline int hsi_stop_tx(struct hsi_client *cl) 423 { 436 { 424 if (!hsi_port_claimed(cl)) 437 if (!hsi_port_claimed(cl)) 425 return -EACCES; 438 return -EACCES; 426 return hsi_get_port(cl)->stop_tx(cl); 439 return hsi_get_port(cl)->stop_tx(cl); 427 } 440 } 428 #endif /* __LINUX_HSI_H__ */ 441 #endif /* __LINUX_HSI_H__ */ 429 442
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.