// SPDX-License-Identifier: GPL-2.0 #define pr_fmt(fmt) … #include <media/drv-intf/saa7146_vv.h> static u32 saa7146_i2c_func(struct i2c_adapter *adapter) { … } /* this function returns the status-register of our i2c-device */ static inline u32 saa7146_i2c_status(struct saa7146_dev *dev) { … } /* this function runs through the i2c-messages and prepares the data to be sent through the saa7146. have a look at the specifications p. 122 ff to understand this. it returns the number of u32s to send, or -1 in case of an error. */ static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, __le32 *op) { … } /* this functions loops through all i2c-messages. normally, it should determine which bytes were read through the adapter and write them back to the corresponding i2c-message. but instead, we simply write back all bytes. fixme: this could be improved. */ static int saa7146_i2c_msg_cleanup(const struct i2c_msg *m, int num, __le32 *op) { … } /* this functions resets the i2c-device and returns 0 if everything was fine, otherwise -1 */ static int saa7146_i2c_reset(struct saa7146_dev *dev) { … } /* this functions writes out the data-byte 'dword' to the i2c-device. it returns 0 if ok, -1 if the transfer failed, -2 if the transfer failed badly (e.g. address error) */ static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int short_delay) { … } static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, int num, int retries) { … } /* utility functions */ static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num) { … } /*****************************************************************************/ /* i2c-adapter helper functions */ /* exported algorithm data */ static const struct i2c_algorithm saa7146_algo = …; int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate) { … }