forked from len0rd/rockbox
FS#8898 - Prefix AS3514 registers with AS3514_
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17130 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a987b7ef2d
commit
a24f4b7a80
9 changed files with 99 additions and 94 deletions
|
|
@ -1220,7 +1220,7 @@ bool dbg_ports(void)
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT));
|
snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT));
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X", i2c_readbyte(AS3514_I2C_ADDR, CHRGR), i2c_readbyte(AS3514_I2C_ADDR, IRQ_ENRD0));
|
snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X", i2c_readbyte(AS3514_I2C_ADDR, AS3514_CHARGER), i2c_readbyte(AS3514_I2C_ADDR, AS3514_IRQ_ENRD0));
|
||||||
lcd_puts(0, line++, buf);
|
lcd_puts(0, line++, buf);
|
||||||
#endif
|
#endif
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
|
||||||
|
|
@ -161,33 +161,33 @@ void audiohw_init(void)
|
||||||
/* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */
|
/* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */
|
||||||
|
|
||||||
/* Turn on SUM, DAC */
|
/* Turn on SUM, DAC */
|
||||||
as3514_write(AUDIOSET1, (1 << 6) | (1 << 5));
|
as3514_write(AS3514_AUDIOSET1, (1 << 6) | (1 << 5));
|
||||||
|
|
||||||
/* Set BIAS on, DITH on, AGC on, IBR_DAC max, LSP_LP on, IBR_LSP min */
|
/* Set BIAS on, DITH on, AGC on, IBR_DAC max, LSP_LP on, IBR_LSP min */
|
||||||
as3514_write(AUDIOSET2, (1 << 2) | (3 << 0));
|
as3514_write(AS3514_AUDIOSET2, (1 << 2) | (3 << 0));
|
||||||
|
|
||||||
/* Set HPCM off, ZCU off*/
|
/* Set HPCM off, ZCU off*/
|
||||||
as3514_write(AUDIOSET3, (1 << 2) | (1 << 0));
|
as3514_write(AS3514_AUDIOSET3, (1 << 2) | (1 << 0));
|
||||||
|
|
||||||
/* Mute and disable speaker */
|
/* Mute and disable speaker */
|
||||||
as3514_write(LSP_OUT_R, 0);
|
as3514_write(AS3514_LSP_OUT_R, 0);
|
||||||
as3514_write(LSP_OUT_L, (1 << 7));
|
as3514_write(AS3514_LSP_OUT_L, (1 << 7));
|
||||||
|
|
||||||
/* set vol and set headphone over-current to 0 */
|
/* set vol and set headphone over-current to 0 */
|
||||||
as3514_write(HPH_OUT_R, (0x3 << 6) | 0x16);
|
as3514_write(AS3514_HPH_OUT_R, (0x3 << 6) | 0x16);
|
||||||
/* set default vol for headphone */
|
/* set default vol for headphone */
|
||||||
as3514_write(HPH_OUT_L, 0x16);
|
as3514_write(AS3514_HPH_OUT_L, 0x16);
|
||||||
|
|
||||||
/* LRCK 24-48kHz */
|
/* LRCK 24-48kHz */
|
||||||
as3514_write(PLLMODE, 0x00);
|
as3514_write(AS3514_PLLMODE, 0x00);
|
||||||
|
|
||||||
/* DAC_Mute_off */
|
/* DAC_Mute_off */
|
||||||
as3514_write_or(DAC_L, (1 << 6));
|
as3514_write_or(AS3514_DAC_L, (1 << 6));
|
||||||
|
|
||||||
/* M1_Sup_off */
|
/* M1_Sup_off */
|
||||||
as3514_write_or(MIC1_L, (1 << 7));
|
as3514_write_or(AS3514_MIC1_L, (1 << 7));
|
||||||
/* M2_Sup_off */
|
/* M2_Sup_off */
|
||||||
as3514_write_or(MIC2_L, (1 << 7));
|
as3514_write_or(AS3514_MIC2_L, (1 << 7));
|
||||||
|
|
||||||
/* read all reg values */
|
/* read all reg values */
|
||||||
for (i = 0; i < ARRAYLEN(as3514.regs); i++)
|
for (i = 0; i < ARRAYLEN(as3514.regs); i++)
|
||||||
|
|
@ -207,18 +207,18 @@ void audiohw_enable_output(bool enable)
|
||||||
/* reset the I2S controller into known state */
|
/* reset the I2S controller into known state */
|
||||||
i2s_reset();
|
i2s_reset();
|
||||||
|
|
||||||
as3514_write_or(HPH_OUT_L, (1 << 6)); /* power on */
|
as3514_write_or(AS3514_HPH_OUT_L, (1 << 6)); /* power on */
|
||||||
audiohw_mute(0);
|
audiohw_mute(0);
|
||||||
} else {
|
} else {
|
||||||
audiohw_mute(1);
|
audiohw_mute(1);
|
||||||
as3514_write_and(HPH_OUT_L, ~(1 << 6)); /* power off */
|
as3514_write_and(AS3514_HPH_OUT_L, ~(1 << 6)); /* power off */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_set_master_vol(int vol_l, int vol_r)
|
void audiohw_set_master_vol(int vol_l, int vol_r)
|
||||||
{
|
{
|
||||||
unsigned int hph_r = as3514.regs[HPH_OUT_R] & ~0x1f;
|
unsigned int hph_r = as3514.regs[AS3514_HPH_OUT_R] & ~0x1f;
|
||||||
unsigned int hph_l = as3514.regs[HPH_OUT_L] & ~0x1f;
|
unsigned int hph_l = as3514.regs[AS3514_HPH_OUT_L] & ~0x1f;
|
||||||
unsigned int mix_l, mix_r;
|
unsigned int mix_l, mix_r;
|
||||||
unsigned int mix_reg_r, mix_reg_l;
|
unsigned int mix_reg_r, mix_reg_l;
|
||||||
|
|
||||||
|
|
@ -227,11 +227,11 @@ void audiohw_set_master_vol(int vol_l, int vol_r)
|
||||||
as3514.vol_r = vol_r;
|
as3514.vol_r = vol_r;
|
||||||
|
|
||||||
if (source == SOURCE_LINE_IN1_ANALOG) {
|
if (source == SOURCE_LINE_IN1_ANALOG) {
|
||||||
mix_reg_r = LINE_IN1_R;
|
mix_reg_r = AS3514_LINE_IN1_R;
|
||||||
mix_reg_l = LINE_IN1_L;
|
mix_reg_l = AS3514_LINE_IN1_L;
|
||||||
} else {
|
} else {
|
||||||
mix_reg_r = DAC_R;
|
mix_reg_r = AS3514_DAC_R;
|
||||||
mix_reg_l = DAC_L;
|
mix_reg_l = AS3514_DAC_L;
|
||||||
}
|
}
|
||||||
|
|
||||||
mix_r = as3514.regs[mix_reg_r] & ~0x1f;
|
mix_r = as3514.regs[mix_reg_r] & ~0x1f;
|
||||||
|
|
@ -257,22 +257,22 @@ void audiohw_set_master_vol(int vol_l, int vol_r)
|
||||||
|
|
||||||
as3514_write(mix_reg_r, mix_r);
|
as3514_write(mix_reg_r, mix_r);
|
||||||
as3514_write(mix_reg_l, mix_l);
|
as3514_write(mix_reg_l, mix_l);
|
||||||
as3514_write(HPH_OUT_R, hph_r);
|
as3514_write(AS3514_HPH_OUT_R, hph_r);
|
||||||
as3514_write(HPH_OUT_L, hph_l);
|
as3514_write(AS3514_HPH_OUT_L, hph_l);
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_set_lineout_vol(int vol_l, int vol_r)
|
void audiohw_set_lineout_vol(int vol_l, int vol_r)
|
||||||
{
|
{
|
||||||
as3514_write(LINE_OUT_R, vol_r);
|
as3514_write(AS3514_LINE_OUT_R, vol_r);
|
||||||
as3514_write(LINE_OUT_L, (1 << 6) | vol_l);
|
as3514_write(AS3514_LINE_OUT_L, (1 << 6) | vol_l);
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_mute(bool mute)
|
void audiohw_mute(bool mute)
|
||||||
{
|
{
|
||||||
if (mute) {
|
if (mute) {
|
||||||
as3514_write_or(HPH_OUT_L, (1 << 7));
|
as3514_write_or(AS3514_HPH_OUT_L, (1 << 7));
|
||||||
} else {
|
} else {
|
||||||
as3514_write_and(HPH_OUT_L, ~(1 << 7));
|
as3514_write_and(AS3514_HPH_OUT_L, ~(1 << 7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,7 +283,7 @@ void audiohw_close(void)
|
||||||
audiohw_mute(true);
|
audiohw_mute(true);
|
||||||
|
|
||||||
/* turn off everything */
|
/* turn off everything */
|
||||||
as3514_write(AUDIOSET1, 0x0);
|
as3514_write(AS3514_AUDIOSET1, 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_set_sample_rate(int sampling_control)
|
void audiohw_set_sample_rate(int sampling_control)
|
||||||
|
|
@ -300,29 +300,29 @@ void audiohw_enable_recording(bool source_mic)
|
||||||
audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
|
audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
|
||||||
|
|
||||||
/* ADCmux = Stereo Microphone */
|
/* ADCmux = Stereo Microphone */
|
||||||
as3514_write_and(ADC_R, ~(0x3 << 6));
|
as3514_write_and(AS3514_ADC_R, ~(0x3 << 6));
|
||||||
/* MIC1_on, LIN1_off */
|
/* MIC1_on, LIN1_off */
|
||||||
as3514_write(AUDIOSET1,
|
as3514_write(AS3514_AUDIOSET1,
|
||||||
(as3514.regs[AUDIOSET1] & ~(1 << 2)) | (1 << 0));
|
(as3514.regs[AS3514_AUDIOSET1] & ~(1 << 2)) | (1 << 0));
|
||||||
/* M1_AGC_off */
|
/* M1_AGC_off */
|
||||||
as3514_write_and(MIC1_R, ~(1 << 7));
|
as3514_write_and(AS3514_MIC1_R, ~(1 << 7));
|
||||||
} else {
|
} else {
|
||||||
source = SOURCE_LINE_IN1;
|
source = SOURCE_LINE_IN1;
|
||||||
|
|
||||||
audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
|
audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
|
||||||
|
|
||||||
/* ADCmux = Line_IN1 */
|
/* ADCmux = Line_IN1 */
|
||||||
as3514_write(ADC_R,
|
as3514_write(AS3514_ADC_R,
|
||||||
(as3514.regs[ADC_R] & ~(0x3 << 6)) | (0x1 << 6));
|
(as3514.regs[AS3514_ADC_R] & ~(0x3 << 6)) | (0x1 << 6));
|
||||||
/* MIC1_off, LIN1_on */
|
/* MIC1_off, LIN1_on */
|
||||||
as3514_write(AUDIOSET1,
|
as3514_write(AS3514_AUDIOSET1,
|
||||||
(as3514.regs[AUDIOSET1] & ~(1 << 0)) | (1 << 2));
|
(as3514.regs[AS3514_AUDIOSET1] & ~(1 << 0)) | (1 << 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ADC_Mute_off */
|
/* ADC_Mute_off */
|
||||||
as3514_write_or(ADC_L, (1 << 6));
|
as3514_write_or(AS3514_ADC_L, (1 << 6));
|
||||||
/* ADC_on */
|
/* ADC_on */
|
||||||
as3514_write_or(AUDIOSET1, (1 << 7));
|
as3514_write_or(AS3514_AUDIOSET1, (1 << 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_disable_recording(void)
|
void audiohw_disable_recording(void)
|
||||||
|
|
@ -330,10 +330,10 @@ void audiohw_disable_recording(void)
|
||||||
source = SOURCE_DAC;
|
source = SOURCE_DAC;
|
||||||
|
|
||||||
/* ADC_Mute_on */
|
/* ADC_Mute_on */
|
||||||
as3514_write_and(ADC_L, ~(1 << 6));
|
as3514_write_and(AS3514_ADC_L, ~(1 << 6));
|
||||||
|
|
||||||
/* ADC_off, LIN1_off, MIC_off */
|
/* ADC_off, LIN1_off, MIC_off */
|
||||||
as3514_write_and(AUDIOSET1, ~((1 << 7) | (1 << 2) | (1 << 0)));
|
as3514_write_and(AS3514_AUDIOSET1, ~((1 << 7) | (1 << 2) | (1 << 0)));
|
||||||
|
|
||||||
audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
|
audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
|
||||||
}
|
}
|
||||||
|
|
@ -354,7 +354,7 @@ void audiohw_set_recvol(int left, int right, int type)
|
||||||
case AUDIO_GAIN_MIC:
|
case AUDIO_GAIN_MIC:
|
||||||
{
|
{
|
||||||
/* Combine MIC gains seamlessly with ADC levels */
|
/* Combine MIC gains seamlessly with ADC levels */
|
||||||
unsigned int mic1_r = as3514.regs[MIC1_R] & ~(0x3 << 5);
|
unsigned int mic1_r = as3514.regs[AS3514_MIC1_R] & ~(0x3 << 5);
|
||||||
|
|
||||||
if (left >= 36) {
|
if (left >= 36) {
|
||||||
/* M1_Gain = +40db, ADR_Vol = +7.5dB .. +12.0 dB =>
|
/* M1_Gain = +40db, ADR_Vol = +7.5dB .. +12.0 dB =>
|
||||||
|
|
@ -372,7 +372,7 @@ void audiohw_set_recvol(int left, int right, int type)
|
||||||
|
|
||||||
right = left;
|
right = left;
|
||||||
|
|
||||||
as3514_write(MIC1_R, mic1_r);
|
as3514_write(AS3514_MIC1_R, mic1_r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AUDIO_GAIN_LINEIN:
|
case AUDIO_GAIN_LINEIN:
|
||||||
|
|
@ -381,8 +381,8 @@ void audiohw_set_recvol(int left, int right, int type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
as3514_write(ADC_R, (as3514.regs[ADC_R] & ~0x1f) | right);
|
as3514_write(AS3514_ADC_R, (as3514.regs[AS3514_ADC_R] & ~0x1f) | right);
|
||||||
as3514_write(ADC_L, (as3514.regs[ADC_L] & ~0x1f) | left);
|
as3514_write(AS3514_ADC_L, (as3514.regs[AS3514_ADC_L] & ~0x1f) | left);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -392,11 +392,11 @@ void audiohw_set_recvol(int left, int right, int type)
|
||||||
void audiohw_set_monitor(bool enable)
|
void audiohw_set_monitor(bool enable)
|
||||||
{
|
{
|
||||||
/* LI1R_Mute_on - default */
|
/* LI1R_Mute_on - default */
|
||||||
unsigned int line_in1_r = as3514.regs[LINE_IN1_R] & ~(1 << 5);
|
unsigned int line_in1_r = as3514.regs[AS3514_LINE_IN1_R] & ~(1 << 5);
|
||||||
/* LI1L_Mute_on - default */
|
/* LI1L_Mute_on - default */
|
||||||
unsigned int line_in1_l = as3514.regs[LINE_IN1_L] & ~(1 << 5);
|
unsigned int line_in1_l = as3514.regs[AS3514_LINE_IN1_L] & ~(1 << 5);
|
||||||
/* LIN1_off - default */
|
/* LIN1_off - default */
|
||||||
unsigned int audioset1 = as3514.regs[AUDIOSET1] & ~(1 << 2);
|
unsigned int audioset1 = as3514.regs[AS3514_AUDIOSET1] & ~(1 << 2);
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
source = SOURCE_LINE_IN1_ANALOG;
|
source = SOURCE_LINE_IN1_ANALOG;
|
||||||
|
|
@ -409,9 +409,9 @@ void audiohw_set_monitor(bool enable)
|
||||||
audioset1 |= (1 << 2);
|
audioset1 |= (1 << 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
as3514_write(AUDIOSET1, audioset1);
|
as3514_write(AS3514_AUDIOSET1, audioset1);
|
||||||
as3514_write(LINE_IN1_R, line_in1_r);
|
as3514_write(AS3514_LINE_IN1_R, line_in1_r);
|
||||||
as3514_write(LINE_IN1_L, line_in1_l);
|
as3514_write(AS3514_LINE_IN1_L, line_in1_l);
|
||||||
|
|
||||||
/* Sync mixer volume */
|
/* Sync mixer volume */
|
||||||
audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
|
audiohw_set_master_vol(as3514.vol_l, as3514.vol_r);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ int rtc_read_datetime(unsigned char* buf)
|
||||||
|
|
||||||
/* RTC_AS3514's slave address is 0x46*/
|
/* RTC_AS3514's slave address is 0x46*/
|
||||||
for (i=0;i<4;i++){
|
for (i=0;i<4;i++){
|
||||||
tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, RTC_0 + i);
|
tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, AS3514_RTC_0 + i);
|
||||||
}
|
}
|
||||||
seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24);
|
seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24);
|
||||||
|
|
||||||
|
|
@ -160,7 +160,7 @@ int rtc_write_datetime(unsigned char* buf)
|
||||||
|
|
||||||
/* Send data to RTC */
|
/* Send data to RTC */
|
||||||
for (i=0;i<4;i++){
|
for (i=0;i<4;i++){
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, RTC_0 + i, ((seconds >> (8 * i)) & 0xff));
|
pp_i2c_send(AS3514_I2C_ADDR, AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff));
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,44 +29,49 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
|
||||||
extern void audiohw_set_sample_rate(int sampling_control);
|
extern void audiohw_set_sample_rate(int sampling_control);
|
||||||
|
|
||||||
/* Register Descriptions */
|
/* Register Descriptions */
|
||||||
#define LINE_OUT_R 0x00
|
#define AS3514_LINE_OUT_R 0x00
|
||||||
#define LINE_OUT_L 0x01
|
#define AS3514_LINE_OUT_L 0x01
|
||||||
#define HPH_OUT_R 0x02
|
#define AS3514_HPH_OUT_R 0x02
|
||||||
#define HPH_OUT_L 0x03
|
#define AS3514_HPH_OUT_L 0x03
|
||||||
#define LSP_OUT_R 0x04
|
#define AS3514_LSP_OUT_R 0x04
|
||||||
#define LSP_OUT_L 0x05
|
#define AS3514_LSP_OUT_L 0x05
|
||||||
#define MIC1_R 0x06
|
#define AS3514_MIC1_R 0x06
|
||||||
#define MIC1_L 0x07
|
#define AS3514_MIC1_L 0x07
|
||||||
#define MIC2_R 0x08
|
#define AS3514_MIC2_R 0x08
|
||||||
#define MIC2_L 0x09
|
#define AS3514_MIC2_L 0x09
|
||||||
#define LINE_IN1_R 0x0a
|
#define AS3514_LINE_IN1_R 0x0a
|
||||||
#define LINE_IN1_L 0x0b
|
#define AS3514_LINE_IN1_L 0x0b
|
||||||
#define LINE_IN2_R 0x0c
|
#define AS3514_LINE_IN2_R 0x0c
|
||||||
#define LINE_IN2_L 0x0d
|
#define AS3514_LINE_IN2_L 0x0d
|
||||||
#define DAC_R 0x0e
|
#define AS3514_DAC_R 0x0e
|
||||||
#define DAC_L 0x0f
|
#define AS3514_DAC_L 0x0f
|
||||||
#define ADC_R 0x10
|
#define AS3514_ADC_R 0x10
|
||||||
#define ADC_L 0x11
|
#define AS3514_ADC_L 0x11
|
||||||
#define AUDIOSET1 0x14
|
#define AS3514_AUDIOSET1 0x14
|
||||||
#define AUDIOSET2 0x15
|
#define AS3514_AUDIOSET2 0x15
|
||||||
#define AUDIOSET3 0x16
|
#define AS3514_AUDIOSET3 0x16
|
||||||
#define PLLMODE 0x1d
|
#define AS3514_PLLMODE 0x1d
|
||||||
|
|
||||||
#define SYSTEM 0x20
|
#define AS3514_SYSTEM 0x20
|
||||||
#define CHRGR 0x22
|
#define AS3514_CVDD_DCDC3 0x21
|
||||||
#define DCDC15 0x23
|
#define AS3514_CHARGER 0x22
|
||||||
#define SUPERVISOR 0x24
|
#define AS3514_DCDC15 0x23
|
||||||
|
#define AS3514_SUPERVISOR 0x24
|
||||||
|
|
||||||
#define IRQ_ENRD0 0x25
|
#define AS3514_IRQ_ENRD0 0x25
|
||||||
#define IRQ_ENRD1 0x26
|
#define AS3514_IRQ_ENRD1 0x26
|
||||||
#define IRQ_ENRD2 0x27
|
#define AS3514_IRQ_ENRD2 0x27
|
||||||
|
|
||||||
#define RTC_0 0x2a
|
#define AS3514_RTCV 0x28
|
||||||
#define RTC_1 0x2b
|
#define AS3514_RTCT 0x29
|
||||||
#define RTC_2 0x2c
|
#define AS3514_RTC_0 0x2a
|
||||||
#define RTC_3 0x2d
|
#define AS3514_RTC_1 0x2b
|
||||||
#define ADC_0 0x2e
|
#define AS3514_RTC_2 0x2c
|
||||||
#define ADC_1 0x2f
|
#define AS3514_RTC_3 0x2d
|
||||||
|
#define AS3514_ADC_0 0x2e
|
||||||
|
#define AS3514_ADC_1 0x2f
|
||||||
|
|
||||||
|
#define AS3514_UID_0 0x30
|
||||||
|
|
||||||
/* Headphone volume goes from -73.5 ... +6dB */
|
/* Headphone volume goes from -73.5 ... +6dB */
|
||||||
#define VOLUME_MIN -735
|
#define VOLUME_MIN -735
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ void i2c_init(void)
|
||||||
outl(0, 0x600060a4);
|
outl(0, 0x600060a4);
|
||||||
outl(0x1e, 0x600060a4);
|
outl(0x1e, 0x600060a4);
|
||||||
|
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, SUPERVISOR, 5);
|
pp_i2c_send(AS3514_I2C_ADDR, AS3514_SUPERVISOR, 5);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ unsigned short adc_read(int channel)
|
||||||
i2c_lock();
|
i2c_lock();
|
||||||
|
|
||||||
/* Select channel */
|
/* Select channel */
|
||||||
if (pp_i2c_send( AS3514_I2C_ADDR, ADC_0, (channel << 4)) >= 0)
|
if (pp_i2c_send( AS3514_I2C_ADDR, AS3514_ADC_0, (channel << 4)) >= 0)
|
||||||
{
|
{
|
||||||
unsigned char buf[2];
|
unsigned char buf[2];
|
||||||
|
|
||||||
/* Read data */
|
/* Read data */
|
||||||
if (i2c_readbytes( AS3514_I2C_ADDR, ADC_0, 2, buf) >= 0)
|
if (i2c_readbytes( AS3514_I2C_ADDR, AS3514_ADC_0, 2, buf) >= 0)
|
||||||
{
|
{
|
||||||
data = (((buf[0] & 0x3) << 8) | buf[1]);
|
data = (((buf[0] & 0x3) << 8) | buf[1]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,12 @@ void _backlight_on(void)
|
||||||
#if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER)
|
#if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER)
|
||||||
_lcd_sleep_timer = 0; /* LCD should be awake already */
|
_lcd_sleep_timer = 0; /* LCD should be awake already */
|
||||||
#endif
|
#endif
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, DCDC15, backlight_brightness);
|
pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _backlight_off(void)
|
void _backlight_off(void)
|
||||||
{
|
{
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, DCDC15, 0x0);
|
pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0);
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off lcd */
|
lcd_enable(false); /* power off lcd */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ void power_off(void)
|
||||||
char byte;
|
char byte;
|
||||||
|
|
||||||
/* Send shutdown command to PMU */
|
/* Send shutdown command to PMU */
|
||||||
byte = i2c_readbyte(AS3514_I2C_ADDR, SYSTEM);
|
byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM);
|
||||||
byte &= ~0x1;
|
byte &= ~0x1;
|
||||||
pp_i2c_send(AS3514_I2C_ADDR, SYSTEM, byte);
|
pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte);
|
||||||
|
|
||||||
/* Stop interrupts on both cores */
|
/* Stop interrupts on both cores */
|
||||||
disable_interrupt(IRQ_FIQ_STATUS);
|
disable_interrupt(IRQ_FIQ_STATUS);
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ static void set_serial_descriptor(void)
|
||||||
short* p = &usb_string_iSerial.wString[1];
|
short* p = &usb_string_iSerial.wString[1];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i2c_readbytes(AS3514_I2C_ADDR, 0x30, 0x10, serial);
|
i2c_readbytes(AS3514_I2C_ADDR, AS3514_UID_0, 0x10, serial);
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
*p++ = hex[(serial[i] >> 4) & 0xF];
|
*p++ = hex[(serial[i] >> 4) & 0xF];
|
||||||
*p++ = hex[(serial[i] >> 0) & 0xF];
|
*p++ = hex[(serial[i] >> 0) & 0xF];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue