FS#12319 - HiFiMAN HM-601 initial work

Attached to Project: Rockbox
Opened by Andrew Ryabinin (mortalis) - Thursday, 06 October 2011, 20:50 GMT
Last edited by Marcin Bukat (MarcinBukat) - Monday, 17 October 2011, 10:33 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To No-one
Operating System Another
Severity Low
Priority Normal
Reported Version Release 3.9
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Initial work for HiFiMAN HM-601 audio player.
This task depends upon

Closed by  Marcin Bukat (MarcinBukat)
Monday, 17 October 2011, 10:33 GMT
Reason for closing:  Accepted
Additional comments about closing:  commited as r30765
Comment by Marcin Bukat (MarcinBukat) - Friday, 07 October 2011, 08:45 GMT
First - thanks for your contribution. Now a few things to mention:
1) firmware/export/config.h - define for HM601_PAD is misaligned
2) firmware/export/config/hm601.h - we tend to call configuration files with vendormodel.h scheme
define for RK27XX_CODEC is wrong apparently and this should be refined
3) firmware/target/arm/rk27xx/hm601/button-hm601.c - in firmware/target/arm/rk27xx/adc-target.h there are defines for adc channel numbers. As channel 1 is used for buttons on all rk27xx players using such key reading scheme I ever saw, I think ADC_UNKNOWN_1 should be changed to ADC_BUTTONS and used in your button_read_device()
4) firmware/target/arm/rk27xx/hm601/lcd-hm601.c - there is huge code duplication. There should be separated LCDIF setup part which is common to all rk27xx devices and panel/driver specific part. Additionally look at current svn - I implemented partial updates which speedup things quite a bit. You can shape something similar in your driver.
Comment by Andrew Ryabinin (mortalis) - Friday, 07 October 2011, 19:48 GMT
Thanks for remarks.

Fixed 3 first points + some buttons bugs.
Comment by Andrew Ryabinin (mortalis) - Sunday, 09 October 2011, 08:40 GMT
Fixed 'make reconf'.
Added audio driver.
Comment by Andrew Ryabinin (mortalis) - Sunday, 09 October 2011, 09:13 GMT
Forgot to add keymap
Comment by Marcin Bukat (MarcinBukat) - Sunday, 09 October 2011, 19:09 GMT
1) Nice catch in pcm-rk27xx.c
2) Your tda1543.{ch} are wrong. You should define valid volume range in audiohw_settings[] because our settings code depends on this.
3) What is output amp used in this DAP? Does it have fixed gain (simple opamp setup) or one can control attenuation? If output stage has fixed gain you need to setup vol control with help of our dsp engine (look how ondas do that).
4) I still think lcd driver should be factored out into two parts a) lcdif setup common to all rk27xx devices b) lcd controller specific part.
5) It would be nice to workout sound output before commiting.
Comment by Marcin Bukat (MarcinBukat) - Sunday, 09 October 2011, 19:47 GMT
Ok. I think I understand - it doesn't have digital gain control but analog attenuator right?
Comment by Andrew Ryabinin (mortalis) - Monday, 10 October 2011, 16:47 GMT
Yes, it have ananlog attunuator.
Is it possible to disable volume control in rockbox at all?
Playback isn't working. Played time is allways 0:00, as though pause pressed.

New patch:
- Seareted lcdif and lcd parts
- Implemented lcd partial updates
Comment by Andrew Ryabinin (mortalis) - Monday, 10 October 2011, 17:54 GMT
Previous patch not working.
Here is correct one
Comment by Andrew Ryabinin (mortalis) - Wednesday, 12 October 2011, 12:11 GMT
Sound is working but playback speed is above normal.
Comment by Marcin Bukat (MarcinBukat) - Wednesday, 12 October 2011, 15:15 GMT
Could you estimate what is the difference in playback speed and recalculate i2s MCLK based on that? Datasheet is rather cryptic in this regard but I suspect I2S clock in master mode is derived from CODECCLK this in turn can be either 12MHz or any value setup in PLLCODEC.

Your change to i2s_init() is not correct - this is perfectly possible (and judging from SDK sources used in practice) to have external codec working as i2s master. We have CODEC_SLAVE define which should be exploited here.

Is playback choppy or smooth?
Comment by Andrew Ryabinin (mortalis) - Thursday, 13 October 2011, 17:58 GMT
Fix playback speed
Comment by Marcin Bukat (MarcinBukat) - Thursday, 13 October 2011, 19:56 GMT
You may use such program (which is rather quick hack) to calc PLL settings.
./pll_settings 11289600
will give you 6 possible settings to get 'nice' frequency and stay within limits
Comment by Andrew Ryabinin (mortalis) - Sunday, 16 October 2011, 17:54 GMT
Added support for several sample rates.

Also changed target name to hm60x cause hm-601/hm-602/hm-603 have same hardware.