0001
0002
0003
0004 #ifndef _ICE_GNSS_H_
0005 #define _ICE_GNSS_H_
0006
0007 #include <linux/tty.h>
0008 #include <linux/tty_flip.h>
0009
0010 #define ICE_E810T_GNSS_I2C_BUS 0x2
0011 #define ICE_GNSS_TIMER_DELAY_TIME (HZ / 10)
0012
0013
0014
0015 #define ICE_GNSS_TTY_MINOR_DEVICES 2
0016 #define ICE_GNSS_TTY_WRITE_BUF 250
0017 #define ICE_MAX_I2C_DATA_SIZE FIELD_MAX(ICE_AQC_I2C_DATA_SIZE_M)
0018 #define ICE_MAX_I2C_WRITE_BYTES 4
0019
0020
0021 #define ICE_GNSS_UBX_I2C_BUS_ADDR 0x42
0022
0023 #define ICE_GNSS_UBX_DATA_LEN_H 0xFD
0024 #define ICE_GNSS_UBX_DATA_LEN_WIDTH 2
0025 #define ICE_GNSS_UBX_EMPTY_DATA 0xFF
0026
0027
0028
0029 #define ICE_GNSS_UBX_WRITE_BYTES (ICE_MAX_I2C_WRITE_BYTES + 1)
0030 #define ICE_MAX_UBX_READ_TRIES 255
0031 #define ICE_MAX_UBX_ACK_READ_TRIES 4095
0032
0033 struct gnss_write_buf {
0034 struct list_head queue;
0035 unsigned int size;
0036 unsigned char *buf;
0037 };
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 struct gnss_serial {
0052 struct ice_pf *back;
0053 struct tty_struct *tty;
0054 int open_count;
0055 struct mutex gnss_mutex;
0056 struct kthread_worker *kworker;
0057 struct kthread_delayed_work read_work;
0058 struct kthread_work write_work;
0059 struct list_head queue;
0060 };
0061
0062 #if IS_ENABLED(CONFIG_TTY)
0063 void ice_gnss_init(struct ice_pf *pf);
0064 void ice_gnss_exit(struct ice_pf *pf);
0065 bool ice_gnss_is_gps_present(struct ice_hw *hw);
0066 #else
0067 static inline void ice_gnss_init(struct ice_pf *pf) { }
0068 static inline void ice_gnss_exit(struct ice_pf *pf) { }
0069 static inline bool ice_gnss_is_gps_present(struct ice_hw *hw)
0070 {
0071 return false;
0072 }
0073 #endif
0074 #endif