diff --git a/tas2562-codec.c b/tas2562-codec.c
index 9e1a87a0506c3bf16190d07b26e2398cb8a3e825..e77b2b7e4d434bdd84528d36a715672528d6c9bd 100644 (file)
--- a/tas2562-codec.c
+++ b/tas2562-codec.c
#define TAS2562_MDELAY 0xFFFFFFFE
#define TAS2562_MSLEEP 0xFFFFFFFD
-static char pICN[] = {0x00, 0x03, 0x46, 0xdc};
static char const *iv_enable_text[] = {"Off", "On"};
-static int tas2562iv_enable;
+static int tas2562iv_enable = 1;
static int mbMute;
static const struct soc_enum tas2562_enum[] = {
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(iv_enable_text), iv_enable_text),
struct snd_ctl_elem_value *pValue);
static unsigned int p_tas2562_classH_D_data[] = {
- /* reg address size values */
+ /* reg address size values */
TAS2562_ClassHHeadroom, 0x4, 0x09, 0x99, 0x99, 0x9a,
TAS2562_ClassHHysteresis, 0x4, 0x0, 0x0, 0x0, 0x0,
TAS2562_ClassHMtct, 0x4, 0xb, 0x0, 0x0, 0x0,
{
int nResult = 0;
/*unsigned int nValue;*/
+ int irqreg;
if ((pTAS2562->mbMute) && (state == TAS2562_POWER_ACTIVE))
state = TAS2562_POWER_MUTE;
if (nResult < 0)
return nResult;
- nResult = pTAS2562->update_bits(pTAS2562, TAS2562_PowerControl,
- TAS2562_PowerControl_OperationalMode10_Mask,
- TAS2562_PowerControl_OperationalMode10_Active);
- if (nResult < 0)
- return nResult;
+//Clear latched IRQ before power on
+
+ pTAS2562->update_bits(pTAS2562, TAS2562_InterruptConfiguration,
+ TAS2562_InterruptConfiguration_LTCHINTClear_Mask,
+ TAS2562_InterruptConfiguration_LTCHINTClear);
+
+ pTAS2562->read(pTAS2562, TAS2562_LatchedInterruptReg0, &irqreg);
+ dev_info(pTAS2562->dev, "IRQ reg is: %s %d, %d\n", __func__, irqreg, __LINE__);
+
pTAS2562->mbPowerUp = true;
- dev_info(pTAS2562->dev, "set ICN to -80dB\n");
- nResult = pTAS2562->bulk_write(pTAS2562, TAS2562_ICN_REG, pICN, 4);
pTAS2562->mnPowerState = TAS2562_POWER_ACTIVE;
- pTAS2562->enableIRQ(pTAS2562, true);
+ schedule_delayed_work(&pTAS2562->irq_work, msecs_to_jiffies(10));
break;
case TAS2562_POWER_MUTE:
},
};
+static int tas2562_load_init(struct tas2562_priv *pTAS2562)
+{
+ int ret;
+
+#ifdef TAS2558_CODEC
+/* Max voltage to 9V */
+ ret = pTAS2562->update_bits(pTAS2562, TAS2562_BoostConfiguration2,
+ TAS2562_BoostConfiguration2_BoostMaxVoltage_Mask,
+ 0x7);
+ if(ret < 0)
+ return ret;
+
+ ret = pTAS2562->update_bits(pTAS2562, TAS2562_PlaybackConfigurationReg0,
+ TAS2562_PlaybackConfigurationReg0_AmplifierLevel51_Mask,
+ 0xd << 1);
+ if(ret < 0)
+ return ret;
+
+#endif
+
+ ret = pTAS2562->write(pTAS2562, TAS2562_MiscConfigurationReg0, 0xcf);
+ if(ret < 0)
+ return ret;
+ ret = pTAS2562->write(pTAS2562, TAS2562_TDMConfigurationReg4, 0x01);
+ if(ret < 0)
+ return ret;
+ ret = pTAS2562->write(pTAS2562, TAS2562_ClockConfiguration, 0x0c);
+ if(ret < 0)
+ return ret;
+ ret = tas2562_i2c_load_data(pTAS2562, p_tas2562_classH_D_data);
+
+ return ret;
+}
+
static int tas2562_codec_probe(struct snd_soc_codec *codec)
{
int ret;
return ret;
}
+ tas2562_load_init(pTAS2562);
tas2562_iv_enable(pTAS2562, 1);
pTAS2562->codec = codec;
dev_err(pTAS2562->dev, "%s\n", __func__);
- tas2562_i2c_load_data(pTAS2562, p_tas2562_classH_D_data);
return 0;
}
hrtimer_cancel(&pTAS2562->mtimer);
} else
dev_info(pTAS2562->dev, "timer not active\n");
-
+
pTAS2562->hw_reset(pTAS2562);
+ msleep(2);
pTAS2562->write(pTAS2562, TAS2562_SoftwareReset,
TAS2562_SoftwareReset_SoftwareReset_Reset);
- msleep(3);
+ msleep(3);
- pTAS2562->write(pTAS2562, TAS2562_MiscConfigurationReg0, 0xce);
+ tas2562_load_init(pTAS2562);
+ tas2562_iv_enable(pTAS2562, tas2562iv_enable);
ret = tas2562_set_slot(pTAS2562->codec, pTAS2562->mnSlot_width);
if (ret < 0)