~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mfd/dln2.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __LINUX_USB_DLN2_H
  3 #define __LINUX_USB_DLN2_H
  4 
  5 #define DLN2_CMD(cmd, id)               ((cmd) | ((id) << 8))
  6 
  7 struct dln2_platform_data {
  8         u16 handle;             /* sub-driver handle (internally used only) */
  9         u8 port;                /* I2C/SPI port */
 10 };
 11 
 12 /**
 13  * dln2_event_cb_t - event callback function signature
 14  *
 15  * @pdev - the sub-device that registered this callback
 16  * @echo - the echo header field received in the message
 17  * @data - the data payload
 18  * @len  - the data payload length
 19  *
 20  * The callback function is called in interrupt context and the data payload is
 21  * only valid during the call. If the user needs later access of the data, it
 22  * must copy it.
 23  */
 24 
 25 typedef void (*dln2_event_cb_t)(struct platform_device *pdev, u16 echo,
 26                                 const void *data, int len);
 27 
 28 /**
 29  * dl2n_register_event_cb - register a callback function for an event
 30  *
 31  * @pdev - the sub-device that registers the callback
 32  * @event - the event for which to register a callback
 33  * @event_cb - the callback function
 34  *
 35  * @return 0 in case of success, negative value in case of error
 36  */
 37 int dln2_register_event_cb(struct platform_device *pdev, u16 event,
 38                            dln2_event_cb_t event_cb);
 39 
 40 /**
 41  * dln2_unregister_event_cb - unregister the callback function for an event
 42  *
 43  * @pdev - the sub-device that registered the callback
 44  * @event - the event for which to register a callback
 45  */
 46 void dln2_unregister_event_cb(struct platform_device *pdev, u16 event);
 47 
 48 /**
 49  * dln2_transfer - issue a DLN2 command and wait for a response and the
 50  * associated data
 51  *
 52  * @pdev - the sub-device which is issuing this transfer
 53  * @cmd - the command to be sent to the device
 54  * @obuf - the buffer to be sent to the device; it can be NULL if the user
 55  *      doesn't need to transmit data with this command
 56  * @obuf_len - the size of the buffer to be sent to the device
 57  * @ibuf - any data associated with the response will be copied here; it can be
 58  *      NULL if the user doesn't need the response data
 59  * @ibuf_len - must be initialized to the input buffer size; it will be modified
 60  *      to indicate the actual data transferred;
 61  *
 62  * @return 0 for success, negative value for errors
 63  */
 64 int dln2_transfer(struct platform_device *pdev, u16 cmd,
 65                   const void *obuf, unsigned obuf_len,
 66                   void *ibuf, unsigned *ibuf_len);
 67 
 68 /**
 69  * dln2_transfer_rx - variant of @dln2_transfer() where TX buffer is not needed
 70  *
 71  * @pdev - the sub-device which is issuing this transfer
 72  * @cmd - the command to be sent to the device
 73  * @ibuf - any data associated with the response will be copied here; it can be
 74  *      NULL if the user doesn't need the response data
 75  * @ibuf_len - must be initialized to the input buffer size; it will be modified
 76  *      to indicate the actual data transferred;
 77  *
 78  * @return 0 for success, negative value for errors
 79  */
 80 
 81 static inline int dln2_transfer_rx(struct platform_device *pdev, u16 cmd,
 82                                    void *ibuf, unsigned *ibuf_len)
 83 {
 84         return dln2_transfer(pdev, cmd, NULL, 0, ibuf, ibuf_len);
 85 }
 86 
 87 /**
 88  * dln2_transfer_tx - variant of @dln2_transfer() where RX buffer is not needed
 89  *
 90  * @pdev - the sub-device which is issuing this transfer
 91  * @cmd - the command to be sent to the device
 92  * @obuf - the buffer to be sent to the device; it can be NULL if the
 93  *      user doesn't need to transmit data with this command
 94  * @obuf_len - the size of the buffer to be sent to the device
 95  *
 96  * @return 0 for success, negative value for errors
 97  */
 98 static inline int dln2_transfer_tx(struct platform_device *pdev, u16 cmd,
 99                                    const void *obuf, unsigned obuf_len)
100 {
101         return dln2_transfer(pdev, cmd, obuf, obuf_len, NULL, NULL);
102 }
103 
104 #endif
105 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php