diff options
author | Tracy Yi | 2018-10-15 00:57:48 -0500 |
---|---|---|
committer | Tracy Yi | 2018-10-15 00:57:48 -0500 |
commit | e10f7b4d2a5ecd93df9ba6bc3b14ce73c0b12761 (patch) | |
tree | 79bf031f2a67b51726e2fce431d4d5964440856b | |
parent | 925dabf6442eb0023db691ffc8f77a2e6e7b3b6b (diff) | |
download | tas2557-stereo-driver-e10f7b4d2a5ecd93df9ba6bc3b14ce73c0b12761.tar.gz tas2557-stereo-driver-e10f7b4d2a5ecd93df9ba6bc3b14ce73c0b12761.tar.xz tas2557-stereo-driver-e10f7b4d2a5ecd93df9ba6bc3b14ce73c0b12761.zip |
Signed-off-by: Tracy Yi <tracy-yi@ti.com>
-rwxr-xr-x | tas2557-core.c | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/tas2557-core.c b/tas2557-core.c index 6a8c903..3b8d27b 100755 --- a/tas2557-core.c +++ b/tas2557-core.c | |||
@@ -994,6 +994,12 @@ int tas2557_enable(struct tas2557_priv *pTAS2557, bool bEnable) | |||
994 | pProgram = &(pTAS2557->mpFirmware->mpPrograms[pTAS2557->mnCurrentProgram]); | 994 | pProgram = &(pTAS2557->mpFirmware->mpPrograms[pTAS2557->mnCurrentProgram]); |
995 | if (bEnable) { | 995 | if (bEnable) { |
996 | if (!pTAS2557->mbPowerUp) { | 996 | if (!pTAS2557->mbPowerUp) { |
997 | /*Load calibration*/ | ||
998 | if (!pTAS2557->mbCalibrationLoaded) { | ||
999 | tas2557_set_calibration(pTAS2557, 0xFF); | ||
1000 | pTAS2557->mbCalibrationLoaded = true; | ||
1001 | } | ||
1002 | |||
997 | if (pTAS2557->mbLoadConfigurationPrePowerUp) { | 1003 | if (pTAS2557->mbLoadConfigurationPrePowerUp) { |
998 | dev_dbg(pTAS2557->dev, "load coefficient before power\n"); | 1004 | dev_dbg(pTAS2557->dev, "load coefficient before power\n"); |
999 | pTAS2557->mbLoadConfigurationPrePowerUp = false; | 1005 | pTAS2557->mbLoadConfigurationPrePowerUp = false; |
@@ -2217,46 +2223,46 @@ void tas2557_clear_firmware(struct TFirmware *pFirmware) | |||
2217 | static int tas2557_load_calibration(struct tas2557_priv *pTAS2557, char *pFileName) | 2223 | static int tas2557_load_calibration(struct tas2557_priv *pTAS2557, char *pFileName) |
2218 | { | 2224 | { |
2219 | int nResult = 0; | 2225 | int nResult = 0; |
2220 | /* | 2226 | |
2221 | * int nFile; | 2227 | int nFile; |
2222 | * mm_segment_t fs; | 2228 | mm_segment_t fs; |
2223 | * unsigned char pBuffer[1000]; | 2229 | unsigned char pBuffer[1000]; |
2224 | * int nSize = 0; | 2230 | int nSize = 0; |
2225 | * | 2231 | |
2226 | * dev_dbg(pTAS2557->dev, "%s:\n", __func__); | 2232 | dev_dbg(pTAS2557->dev, "%s:\n", __func__); |
2227 | * | 2233 | |
2228 | * fs = get_fs(); | 2234 | fs = get_fs(); |
2229 | * set_fs(KERNEL_DS); | 2235 | set_fs(KERNEL_DS); |
2230 | * nFile = sys_open(pFileName, O_RDONLY, 0); | 2236 | nFile = sys_open(pFileName, O_RDONLY, 0); |
2231 | * | 2237 | |
2232 | * dev_info(pTAS2557->dev, "TAS2557 calibration file = %s, handle = %d\n", | 2238 | dev_info(pTAS2557->dev, "TAS2557 calibration file = %s, handle = %d\n", |
2233 | * pFileName, nFile); | 2239 | pFileName, nFile); |
2234 | * | 2240 | |
2235 | * if (nFile >= 0) { | 2241 | if (nFile >= 0) { |
2236 | * nSize = sys_read(nFile, pBuffer, 1000); | 2242 | nSize = sys_read(nFile, pBuffer, 1000); |
2237 | * sys_close(nFile); | 2243 | sys_close(nFile); |
2238 | * } else { | 2244 | } else { |
2239 | * dev_err(pTAS2557->dev, "TAS2557 cannot open calibration file: %s\n", | 2245 | dev_err(pTAS2557->dev, "TAS2557 cannot open calibration file: %s\n", |
2240 | * pFileName); | 2246 | pFileName); |
2241 | * } | 2247 | } |
2242 | * | 2248 | |
2243 | * set_fs(fs); | 2249 | set_fs(fs); |
2244 | * | 2250 | |
2245 | * if (!nSize) | 2251 | if (!nSize) |
2246 | * goto end; | 2252 | goto end; |
2247 | * | 2253 | |
2248 | * tas2557_clear_firmware(pTAS2557->mpCalFirmware); | 2254 | tas2557_clear_firmware(pTAS2557->mpCalFirmware); |
2249 | * dev_info(pTAS2557->dev, "TAS2557 calibration file size = %d\n", nSize); | 2255 | dev_info(pTAS2557->dev, "TAS2557 calibration file size = %d\n", nSize); |
2250 | * nResult = fw_parse(pTAS2557, pTAS2557->mpCalFirmware, pBuffer, nSize); | 2256 | nResult = fw_parse(pTAS2557, pTAS2557->mpCalFirmware, pBuffer, nSize); |
2251 | * | 2257 | |
2252 | * if (nResult) | 2258 | if (nResult) |
2253 | * dev_err(pTAS2557->dev, "TAS2557 calibration file is corrupt\n"); | 2259 | dev_err(pTAS2557->dev, "TAS2557 calibration file is corrupt\n"); |
2254 | * else | 2260 | else |
2255 | * dev_info(pTAS2557->dev, "TAS2557 calibration: %d calibrations\n", | 2261 | dev_info(pTAS2557->dev, "TAS2557 calibration: %d calibrations\n", |
2256 | * pTAS2557->mpCalFirmware->mnCalibrations); | 2262 | pTAS2557->mpCalFirmware->mnCalibrations); |
2257 | * | 2263 | |
2258 | *end: | 2264 | end: |
2259 | **/ | 2265 | |
2260 | return nResult; | 2266 | return nResult; |
2261 | } | 2267 | } |
2262 | 2268 | ||