1 /*
2 ** =============================================================================
3 ** Copyright (c) 2016 Texas Instruments Inc.
4 **
5 ** This program is free software; you can redistribute it and/or modify it under
6 ** the terms of the GNU General Public License as published by the Free Software
7 ** Foundation; version 2.
8 **
9 ** This program is distributed in the hope that it will be useful, but WITHOUT
10 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 ** FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 **
13 ** File:
14 ** tas2557-core.h
15 **
16 ** Description:
17 ** header file for tas2557-core.c
18 **
19 ** =============================================================================
20 */
22 #ifndef _TAS2557_CORE_H
23 #define _TAS2557_CORE_H
25 #include "tas2557.h"
27 #define TAS2557_YRAM_BOOK1 140
29 #define TAS2557_YRAM1_PAGE 42
30 #define TAS2557_YRAM1_START_REG 88
31 #define TAS2557_YRAM1_END_REG 127
33 #define TAS2557_YRAM2_START_PAGE 43
34 #define TAS2557_YRAM2_END_PAGE 49
35 #define TAS2557_YRAM2_START_REG 8
36 #define TAS2557_YRAM2_END_REG 127
38 #define TAS2557_YRAM3_PAGE 50
39 #define TAS2557_YRAM3_START_REG 8
40 #define TAS2557_YRAM3_END_REG 27
42 /* should not include B0_P53_R44-R47 */
43 #define TAS2557_YRAM_BOOK2 0
44 #define TAS2557_YRAM4_START_PAGE 50
45 #define TAS2557_YRAM4_END_PAGE 60
46 #define TAS2557_YRAM4_START_REG 8
47 #define TAS2557_YRAM4_END_REG 127
49 #define TAS2557_YRAM5_PAGE 61
50 #define TAS2557_YRAM5_START_REG 8
51 #define TAS2557_YRAM5_END_REG 27
53 #define TAS2557_SAFE_GUARD_PATTERN 0x5a
54 #define LOW_TEMPERATURE_CHECK_PERIOD 5000 /* 5 second */
56 struct TYCRC {
57 unsigned char mnOffset;
58 unsigned char mnLen;
59 };
61 int tas2557_enable(struct tas2557_priv *pTAS2557, bool bEnable);
62 int tas2557_SA_DevChnSetup(struct tas2557_priv *pTAS2557, unsigned int mode);
63 int tas2557_get_die_temperature(struct tas2557_priv *pTAS2557, int *pTemperature);
64 int tas2557_set_sampling_rate(struct tas2557_priv *pTAS2557, unsigned int nSamplingRate);
65 int tas2557_set_bit_rate(struct tas2557_priv *pTAS2557, unsigned int nBitRate);
66 int tas2557_get_bit_rate(struct tas2557_priv *pTAS2557, unsigned char *pBitRate);
67 int tas2557_set_config(struct tas2557_priv *pTAS2557, int config);
68 void tas2557_fw_ready(const struct firmware *pFW, void *pContext);
69 int tas2557_set_program(struct tas2557_priv *pTAS2557, unsigned int nProgram, int nConfig);
70 int tas2557_set_calibration(struct tas2557_priv *pTAS2557, int nCalibration);
71 int tas2557_load_default(struct tas2557_priv *pTAS2557);
72 int tas2557_parse_dt(struct device *dev, struct tas2557_priv *pTAS2557);
73 int tas2557_get_DAC_gain(struct tas2557_priv *pTAS2557, unsigned char *pnGain);
74 int tas2557_set_DAC_gain(struct tas2557_priv *pTAS2557, unsigned int nGain);
75 int tas2557_configIRQ(struct tas2557_priv *pTAS2557);
76 #endif /* _TAS2557_CORE_H */