18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef B43_TABLES_LPPHY_H_
38c2ecf20Sopenharmony_ci#define B43_TABLES_LPPHY_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#define B43_LPTAB_TYPEMASK		0xF0000000
78c2ecf20Sopenharmony_ci#define B43_LPTAB_8BIT			0x10000000
88c2ecf20Sopenharmony_ci#define B43_LPTAB_16BIT			0x20000000
98c2ecf20Sopenharmony_ci#define B43_LPTAB_32BIT			0x30000000
108c2ecf20Sopenharmony_ci#define B43_LPTAB8(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_8BIT)
118c2ecf20Sopenharmony_ci#define B43_LPTAB16(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_16BIT)
128c2ecf20Sopenharmony_ci#define B43_LPTAB32(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_32BIT)
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* Table definitions */
158c2ecf20Sopenharmony_ci#define B43_LPTAB_TXPWR_R2PLUS		B43_LPTAB32(0x07, 0) /* TX power lookup table (rev >= 2) */
168c2ecf20Sopenharmony_ci#define B43_LPTAB_TXPWR_R0_1		B43_LPTAB32(0xA0, 0) /* TX power lookup table (rev < 2) */
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciu32 b43_lptab_read(struct b43_wldev *dev, u32 offset);
198c2ecf20Sopenharmony_civoid b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value);
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Bulk table access. Note that these functions return the bulk data in
228c2ecf20Sopenharmony_ci * host endianness! The returned data is _not_ a bytearray, but an array
238c2ecf20Sopenharmony_ci * consisting of nr_elements of the data type. */
248c2ecf20Sopenharmony_civoid b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset,
258c2ecf20Sopenharmony_ci			 unsigned int nr_elements, void *data);
268c2ecf20Sopenharmony_civoid b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset,
278c2ecf20Sopenharmony_ci			  unsigned int nr_elements, const void *data);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_civoid b2062_upload_init_table(struct b43_wldev *dev);
308c2ecf20Sopenharmony_civoid b2063_upload_init_table(struct b43_wldev *dev);
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistruct lpphy_tx_gain_table_entry {
338c2ecf20Sopenharmony_ci	u8 gm,  pga,  pad,  dac,  bb_mult;
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_civoid lpphy_write_gain_table(struct b43_wldev *dev, int offset,
378c2ecf20Sopenharmony_ci			    struct lpphy_tx_gain_table_entry data);
388c2ecf20Sopenharmony_civoid lpphy_write_gain_table_bulk(struct b43_wldev *dev, int offset, int count,
398c2ecf20Sopenharmony_ci				 struct lpphy_tx_gain_table_entry *table);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_civoid lpphy_rev0_1_table_init(struct b43_wldev *dev);
428c2ecf20Sopenharmony_civoid lpphy_rev2plus_table_init(struct b43_wldev *dev);
438c2ecf20Sopenharmony_civoid lpphy_init_tx_gain_table(struct b43_wldev *dev);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#endif /* B43_TABLES_LPPHY_H_ */
46