diff options
Diffstat (limited to 'firmware/target/arm/as3525/ascodec-as3525.c')
-rw-r--r-- | firmware/target/arm/as3525/ascodec-as3525.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/firmware/target/arm/as3525/ascodec-as3525.c b/firmware/target/arm/as3525/ascodec-as3525.c index d23859e420..14c3ee7a36 100644 --- a/firmware/target/arm/as3525/ascodec-as3525.c +++ b/firmware/target/arm/as3525/ascodec-as3525.c | |||
@@ -623,25 +623,11 @@ void i2c_init(void) | |||
623 | /* required function but called too late for our needs */ | 623 | /* required function but called too late for our needs */ |
624 | } | 624 | } |
625 | 625 | ||
626 | static void i2c_set_prescaler(unsigned int prescaler) | ||
627 | { | ||
628 | int oldlevel = disable_interrupt_save(IRQ_FIQ_STATUS); | ||
629 | /* must be on to write regs */ | ||
630 | bool i2c_enabled = bitset32(&CGU_PERI, CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE) & | ||
631 | CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE; | ||
632 | |||
633 | I2C2_CPSR0 = prescaler & 0xFF; /* 8 lsb */ | ||
634 | I2C2_CPSR1 = (prescaler >> 8) & 0x3; /* 2 msb */ | ||
635 | |||
636 | if (!i2c_enabled) /* put it back how we found it */ | ||
637 | bitclr32(&CGU_PERI, CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE); | ||
638 | |||
639 | restore_irq(oldlevel); | ||
640 | } | ||
641 | |||
642 | /* initialises the internal i2c bus and prepares for transfers to the codec */ | 626 | /* initialises the internal i2c bus and prepares for transfers to the codec */ |
643 | void ascodec_init(void) | 627 | void ascodec_init(void) |
644 | { | 628 | { |
629 | int prescaler; | ||
630 | |||
645 | ll_init(&req_list); | 631 | ll_init(&req_list); |
646 | mutex_init(&as_mtx); | 632 | mutex_init(&as_mtx); |
647 | ascodec_async_init(&as_audio_req, ascodec_int_audio_cb, 0); | 633 | ascodec_async_init(&as_audio_req, ascodec_int_audio_cb, 0); |
@@ -651,7 +637,9 @@ void ascodec_init(void) | |||
651 | bitset32(&CGU_PERI, CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE); | 637 | bitset32(&CGU_PERI, CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE); |
652 | 638 | ||
653 | /* prescaler for i2c clock */ | 639 | /* prescaler for i2c clock */ |
654 | i2c_set_prescaler(AS3525_I2C_PRESCALER); | 640 | prescaler = AS3525_I2C_PRESCALER; |
641 | I2C2_CPSR0 = prescaler & 0xFF; /* 8 lsb */ | ||
642 | I2C2_CPSR1 = (prescaler >> 8) & 0x3; /* 2 msb */ | ||
655 | 643 | ||
656 | /* set i2c slave address of codec part */ | 644 | /* set i2c slave address of codec part */ |
657 | I2C2_SLAD0 = AS3514_I2C_ADDR << 1; | 645 | I2C2_SLAD0 = AS3514_I2C_ADDR << 1; |
@@ -702,12 +690,3 @@ void ams_i2c_get_debug_cpsr(unsigned int *i2c_cpsr) | |||
702 | 690 | ||
703 | restore_irq(oldlevel); | 691 | restore_irq(oldlevel); |
704 | } | 692 | } |
705 | |||
706 | #if defined(CONFIG_POWER_SAVING) && (CONFIG_POWER_SAVING & POWERSV_I2C) | ||
707 | /* declared in system-as3525.c */ | ||
708 | void ams_i2c_set_low_speed(bool slow) | ||
709 | { | ||
710 | i2c_set_prescaler(slow ? AS3525_I2C_PRESCALER_MAX : AS3525_I2C_PRESCALER); | ||
711 | } | ||
712 | #endif | ||
713 | |||