summaryrefslogtreecommitdiffstats
blob: 90fc2ff201cbb5664152dd1f2d8171e296a8bb1f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
** =============================================================================
** Copyright (c) 2016  Texas Instruments Inc.
**
** This program is free software; you can redistribute it and/or modify it under
** the terms of the GNU General Public License as published by the Free Software
** Foundation; version 2.
**
** This program is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
** FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
**
** File:
**     tas2557-core.h
**
** Description:
**     header file for tas2557-core.c
**
** =============================================================================
*/

#ifndef _TAS2557_CORE_H
#define _TAS2557_CORE_H

#include "tas2557.h"

#define TAS2557_YRAM_BOOK1				140

#define TAS2557_YRAM1_PAGE				42
#define TAS2557_YRAM1_START_REG			88
#define TAS2557_YRAM1_END_REG			127

#define TAS2557_YRAM2_START_PAGE		43
#define TAS2557_YRAM2_END_PAGE			49
#define TAS2557_YRAM2_START_REG			8
#define TAS2557_YRAM2_END_REG			127

#define TAS2557_YRAM3_PAGE				50
#define TAS2557_YRAM3_START_REG			8
#define TAS2557_YRAM3_END_REG			27

/* should not include B0_P53_R44-R47 */
#define TAS2557_YRAM_BOOK2				0
#define TAS2557_YRAM4_START_PAGE		50
#define TAS2557_YRAM4_END_PAGE			60
#define TAS2557_YRAM4_START_REG			8
#define TAS2557_YRAM4_END_REG			127

#define TAS2557_YRAM5_PAGE				61
#define TAS2557_YRAM5_START_REG			8
#define TAS2557_YRAM5_END_REG			27

#define TAS2557_COEFFICIENT_TMAX	0x7fffffff
#define TAS2557_SAFE_GUARD_PATTERN		0x5a
#define LOW_TEMPERATURE_CHECK_PERIOD 5000	/* 5 second */

struct TYCRC {
	unsigned char mnOffset;
	unsigned char mnLen;
};

int tas2557_enable(struct tas2557_priv *pTAS2557, bool bEnable);
int tas2557_SA_DevChnSetup(struct tas2557_priv *pTAS2557, unsigned int mode);
int tas2557_set_VBoost(struct tas2557_priv *pTAS2557, int vboost, bool bPowerUp);
int tas2557_get_VBoost(struct tas2557_priv *pTAS2557, int *pVBoost);
int tas2557_SA_ctl_echoRef(struct tas2557_priv *pTAS2557);
int tas2557_get_die_temperature(struct tas2557_priv *pTAS2557, int *pTemperature);
int tas2557_set_sampling_rate(struct tas2557_priv *pTAS2557, unsigned int nSamplingRate);
int tas2557_set_bit_rate(struct tas2557_priv *pTAS2557, enum channel chn, unsigned int nBitRate);
int tas2557_get_bit_rate(struct tas2557_priv *pTAS2557, enum channel chn, unsigned char *pBitRate);
int tas2557_set_config(struct tas2557_priv *pTAS2557, int config);
void tas2557_fw_ready(const struct firmware *pFW, void *pContext);
bool tas2557_get_Cali_prm_r0(struct tas2557_priv *pTAS2557, enum channel chl, int *prm_r0);
int tas2557_set_program(struct tas2557_priv *pTAS2557, unsigned int nProgram, int nConfig);
int tas2557_set_calibration(struct tas2557_priv *pTAS2557, int nCalibration);
int tas2557_load_default(struct tas2557_priv *pTAS2557);
int tas2557_parse_dt(struct device *dev, struct tas2557_priv *pTAS2557);
int tas2557_get_DAC_gain(struct tas2557_priv *pTAS2557, enum channel chl, unsigned char *pnGain);
int tas2557_set_DAC_gain(struct tas2557_priv *pTAS2557, enum channel chl, unsigned int nGain);
int tas2557_configIRQ(struct tas2557_priv *pTAS2557);
#endif /* _TAS2557_CORE_H */