/* SPDX-License-Identifier: GPL-2.0-or-later */ /* tuner-i2c.h - i2c interface for different tuners Copyright (C) 2007 Michael Krufky ([email protected]) */ #ifndef __TUNER_I2C_H__ #define __TUNER_I2C_H__ #include <linux/i2c.h> #include <linux/slab.h> struct tuner_i2c_props { … }; static inline int tuner_i2c_xfer_send(struct tuner_i2c_props *props, unsigned char *buf, int len) { … } static inline int tuner_i2c_xfer_recv(struct tuner_i2c_props *props, unsigned char *buf, int len) { … } static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, unsigned char *obuf, int olen, unsigned char *ibuf, int ilen) { … } /* Callers must declare as a global for the module: * * static LIST_HEAD(hybrid_tuner_instance_list); * * hybrid_tuner_instance_list should be the third argument * passed into hybrid_tuner_request_state(). * * state structure must contain the following: * * struct list_head hybrid_tuner_instance_list; * struct tuner_i2c_props i2c_props; * * hybrid_tuner_instance_list (both within state structure and globally) * is only required if the driver is using hybrid_tuner_request_state * and hybrid_tuner_release_state to manage state sharing between * multiple instances of hybrid tuners. */ #define tuner_printk(kernlvl, i2cprops, fmt, arg...) … /* TO DO: convert all callers of these macros to pass in * struct tuner_i2c_props, then remove the macro wrappers */ #define __tuner_warn(i2cprops, fmt, arg...) … #define __tuner_info(i2cprops, fmt, arg...) … #define __tuner_err(i2cprops, fmt, arg...) … #define __tuner_dbg(i2cprops, fmt, arg...) … #define tuner_warn(fmt, arg...) … #define tuner_info(fmt, arg...) … #define tuner_err(fmt, arg...) … #define tuner_dbg(fmt, arg...) … /****************************************************************************/ /* The return value of hybrid_tuner_request_state indicates the number of * instances using this tuner object. * * 0 - no instances, indicates an error - kzalloc must have failed * * 1 - one instance, indicates that the tuner object was created successfully * * 2 (or more) instances, indicates that an existing tuner object was found */ #define hybrid_tuner_request_state(type, state, list, i2cadap, i2caddr, devname) … #define hybrid_tuner_release_state(state) … #define hybrid_tuner_report_instance_count(state) … #endif /* __TUNER_I2C_H__ */