ASoC: wm5102: Write register value corrections after SYSCLK is enabled

Evalation of the WM5102 has identified a number of register values which
should be written after SYSCLK is enabled on revision A in order to
improve performance.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Mark Brown 2012-10-08 15:15:46 +09:00
parent 5a5210c6ad
commit fe81ad1c2d

View File

@ -42,6 +42,556 @@ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
static const struct reg_default wm5102_sysclk_reva_patch[] = {
{ 0x3000, 0x2225 },
{ 0x3001, 0x3a03 },
{ 0x3002, 0x0225 },
{ 0x3003, 0x0801 },
{ 0x3004, 0x6249 },
{ 0x3005, 0x0c04 },
{ 0x3006, 0x0225 },
{ 0x3007, 0x5901 },
{ 0x3008, 0xe249 },
{ 0x3009, 0x030d },
{ 0x300a, 0x0249 },
{ 0x300b, 0x2c01 },
{ 0x300c, 0xe249 },
{ 0x300d, 0x4342 },
{ 0x300e, 0xe249 },
{ 0x300f, 0x73c0 },
{ 0x3010, 0x4249 },
{ 0x3011, 0x0c00 },
{ 0x3012, 0x0225 },
{ 0x3013, 0x1f01 },
{ 0x3014, 0x0225 },
{ 0x3015, 0x1e01 },
{ 0x3016, 0x0225 },
{ 0x3017, 0xfa00 },
{ 0x3018, 0x0000 },
{ 0x3019, 0xf000 },
{ 0x301a, 0x0000 },
{ 0x301b, 0xf000 },
{ 0x301c, 0x0000 },
{ 0x301d, 0xf000 },
{ 0x301e, 0x0000 },
{ 0x301f, 0xf000 },
{ 0x3020, 0x0000 },
{ 0x3021, 0xf000 },
{ 0x3022, 0x0000 },
{ 0x3023, 0xf000 },
{ 0x3024, 0x0000 },
{ 0x3025, 0xf000 },
{ 0x3026, 0x0000 },
{ 0x3027, 0xf000 },
{ 0x3028, 0x0000 },
{ 0x3029, 0xf000 },
{ 0x302a, 0x0000 },
{ 0x302b, 0xf000 },
{ 0x302c, 0x0000 },
{ 0x302d, 0xf000 },
{ 0x302e, 0x0000 },
{ 0x302f, 0xf000 },
{ 0x3030, 0x0225 },
{ 0x3031, 0x1a01 },
{ 0x3032, 0x0225 },
{ 0x3033, 0x1e00 },
{ 0x3034, 0x0225 },
{ 0x3035, 0x1f00 },
{ 0x3036, 0x6225 },
{ 0x3037, 0xf800 },
{ 0x3038, 0x0000 },
{ 0x3039, 0xf000 },
{ 0x303a, 0x0000 },
{ 0x303b, 0xf000 },
{ 0x303c, 0x0000 },
{ 0x303d, 0xf000 },
{ 0x303e, 0x0000 },
{ 0x303f, 0xf000 },
{ 0x3040, 0x2226 },
{ 0x3041, 0x3a03 },
{ 0x3042, 0x0226 },
{ 0x3043, 0x0801 },
{ 0x3044, 0x6249 },
{ 0x3045, 0x0c06 },
{ 0x3046, 0x0226 },
{ 0x3047, 0x5901 },
{ 0x3048, 0xe249 },
{ 0x3049, 0x030d },
{ 0x304a, 0x0249 },
{ 0x304b, 0x2c01 },
{ 0x304c, 0xe249 },
{ 0x304d, 0x4342 },
{ 0x304e, 0xe249 },
{ 0x304f, 0x73c0 },
{ 0x3050, 0x4249 },
{ 0x3051, 0x0c00 },
{ 0x3052, 0x0226 },
{ 0x3053, 0x1f01 },
{ 0x3054, 0x0226 },
{ 0x3055, 0x1e01 },
{ 0x3056, 0x0226 },
{ 0x3057, 0xfa00 },
{ 0x3058, 0x0000 },
{ 0x3059, 0xf000 },
{ 0x305a, 0x0000 },
{ 0x305b, 0xf000 },
{ 0x305c, 0x0000 },
{ 0x305d, 0xf000 },
{ 0x305e, 0x0000 },
{ 0x305f, 0xf000 },
{ 0x3060, 0x0000 },
{ 0x3061, 0xf000 },
{ 0x3062, 0x0000 },
{ 0x3063, 0xf000 },
{ 0x3064, 0x0000 },
{ 0x3065, 0xf000 },
{ 0x3066, 0x0000 },
{ 0x3067, 0xf000 },
{ 0x3068, 0x0000 },
{ 0x3069, 0xf000 },
{ 0x306a, 0x0000 },
{ 0x306b, 0xf000 },
{ 0x306c, 0x0000 },
{ 0x306d, 0xf000 },
{ 0x306e, 0x0000 },
{ 0x306f, 0xf000 },
{ 0x3070, 0x0226 },
{ 0x3071, 0x1a01 },
{ 0x3072, 0x0226 },
{ 0x3073, 0x1e00 },
{ 0x3074, 0x0226 },
{ 0x3075, 0x1f00 },
{ 0x3076, 0x6226 },
{ 0x3077, 0xf800 },
{ 0x3078, 0x0000 },
{ 0x3079, 0xf000 },
{ 0x307a, 0x0000 },
{ 0x307b, 0xf000 },
{ 0x307c, 0x0000 },
{ 0x307d, 0xf000 },
{ 0x307e, 0x0000 },
{ 0x307f, 0xf000 },
{ 0x3080, 0x2227 },
{ 0x3081, 0x3a03 },
{ 0x3082, 0x0227 },
{ 0x3083, 0x0801 },
{ 0x3084, 0x6255 },
{ 0x3085, 0x0c04 },
{ 0x3086, 0x0227 },
{ 0x3087, 0x5901 },
{ 0x3088, 0xe255 },
{ 0x3089, 0x030d },
{ 0x308a, 0x0255 },
{ 0x308b, 0x2c01 },
{ 0x308c, 0xe255 },
{ 0x308d, 0x4342 },
{ 0x308e, 0xe255 },
{ 0x308f, 0x73c0 },
{ 0x3090, 0x4255 },
{ 0x3091, 0x0c00 },
{ 0x3092, 0x0227 },
{ 0x3093, 0x1f01 },
{ 0x3094, 0x0227 },
{ 0x3095, 0x1e01 },
{ 0x3096, 0x0227 },
{ 0x3097, 0xfa00 },
{ 0x3098, 0x0000 },
{ 0x3099, 0xf000 },
{ 0x309a, 0x0000 },
{ 0x309b, 0xf000 },
{ 0x309c, 0x0000 },
{ 0x309d, 0xf000 },
{ 0x309e, 0x0000 },
{ 0x309f, 0xf000 },
{ 0x30a0, 0x0000 },
{ 0x30a1, 0xf000 },
{ 0x30a2, 0x0000 },
{ 0x30a3, 0xf000 },
{ 0x30a4, 0x0000 },
{ 0x30a5, 0xf000 },
{ 0x30a6, 0x0000 },
{ 0x30a7, 0xf000 },
{ 0x30a8, 0x0000 },
{ 0x30a9, 0xf000 },
{ 0x30aa, 0x0000 },
{ 0x30ab, 0xf000 },
{ 0x30ac, 0x0000 },
{ 0x30ad, 0xf000 },
{ 0x30ae, 0x0000 },
{ 0x30af, 0xf000 },
{ 0x30b0, 0x0227 },
{ 0x30b1, 0x1a01 },
{ 0x30b2, 0x0227 },
{ 0x30b3, 0x1e00 },
{ 0x30b4, 0x0227 },
{ 0x30b5, 0x1f00 },
{ 0x30b6, 0x6227 },
{ 0x30b7, 0xf800 },
{ 0x30b8, 0x0000 },
{ 0x30b9, 0xf000 },
{ 0x30ba, 0x0000 },
{ 0x30bb, 0xf000 },
{ 0x30bc, 0x0000 },
{ 0x30bd, 0xf000 },
{ 0x30be, 0x0000 },
{ 0x30bf, 0xf000 },
{ 0x30c0, 0x2228 },
{ 0x30c1, 0x3a03 },
{ 0x30c2, 0x0228 },
{ 0x30c3, 0x0801 },
{ 0x30c4, 0x6255 },
{ 0x30c5, 0x0c06 },
{ 0x30c6, 0x0228 },
{ 0x30c7, 0x5901 },
{ 0x30c8, 0xe255 },
{ 0x30c9, 0x030d },
{ 0x30ca, 0x0255 },
{ 0x30cb, 0x2c01 },
{ 0x30cc, 0xe255 },
{ 0x30cd, 0x4342 },
{ 0x30ce, 0xe255 },
{ 0x30cf, 0x73c0 },
{ 0x30d0, 0x4255 },
{ 0x30d1, 0x0c00 },
{ 0x30d2, 0x0228 },
{ 0x30d3, 0x1f01 },
{ 0x30d4, 0x0228 },
{ 0x30d5, 0x1e01 },
{ 0x30d6, 0x0228 },
{ 0x30d7, 0xfa00 },
{ 0x30d8, 0x0000 },
{ 0x30d9, 0xf000 },
{ 0x30da, 0x0000 },
{ 0x30db, 0xf000 },
{ 0x30dc, 0x0000 },
{ 0x30dd, 0xf000 },
{ 0x30de, 0x0000 },
{ 0x30df, 0xf000 },
{ 0x30e0, 0x0000 },
{ 0x30e1, 0xf000 },
{ 0x30e2, 0x0000 },
{ 0x30e3, 0xf000 },
{ 0x30e4, 0x0000 },
{ 0x30e5, 0xf000 },
{ 0x30e6, 0x0000 },
{ 0x30e7, 0xf000 },
{ 0x30e8, 0x0000 },
{ 0x30e9, 0xf000 },
{ 0x30ea, 0x0000 },
{ 0x30eb, 0xf000 },
{ 0x30ec, 0x0000 },
{ 0x30ed, 0xf000 },
{ 0x30ee, 0x0000 },
{ 0x30ef, 0xf000 },
{ 0x30f0, 0x0228 },
{ 0x30f1, 0x1a01 },
{ 0x30f2, 0x0228 },
{ 0x30f3, 0x1e00 },
{ 0x30f4, 0x0228 },
{ 0x30f5, 0x1f00 },
{ 0x30f6, 0x6228 },
{ 0x30f7, 0xf800 },
{ 0x30f8, 0x0000 },
{ 0x30f9, 0xf000 },
{ 0x30fa, 0x0000 },
{ 0x30fb, 0xf000 },
{ 0x30fc, 0x0000 },
{ 0x30fd, 0xf000 },
{ 0x30fe, 0x0000 },
{ 0x30ff, 0xf000 },
{ 0x3100, 0x222b },
{ 0x3101, 0x3a03 },
{ 0x3102, 0x222b },
{ 0x3103, 0x5803 },
{ 0x3104, 0xe26f },
{ 0x3105, 0x030d },
{ 0x3106, 0x626f },
{ 0x3107, 0x2c01 },
{ 0x3108, 0xe26f },
{ 0x3109, 0x4342 },
{ 0x310a, 0xe26f },
{ 0x310b, 0x73c0 },
{ 0x310c, 0x026f },
{ 0x310d, 0x0c00 },
{ 0x310e, 0x022b },
{ 0x310f, 0x1f01 },
{ 0x3110, 0x022b },
{ 0x3111, 0x1e01 },
{ 0x3112, 0x022b },
{ 0x3113, 0xfa00 },
{ 0x3114, 0x0000 },
{ 0x3115, 0xf000 },
{ 0x3116, 0x0000 },
{ 0x3117, 0xf000 },
{ 0x3118, 0x0000 },
{ 0x3119, 0xf000 },
{ 0x311a, 0x0000 },
{ 0x311b, 0xf000 },
{ 0x311c, 0x0000 },
{ 0x311d, 0xf000 },
{ 0x311e, 0x0000 },
{ 0x311f, 0xf000 },
{ 0x3120, 0x022b },
{ 0x3121, 0x0a01 },
{ 0x3122, 0x022b },
{ 0x3123, 0x1e00 },
{ 0x3124, 0x022b },
{ 0x3125, 0x1f00 },
{ 0x3126, 0x622b },
{ 0x3127, 0xf800 },
{ 0x3128, 0x0000 },
{ 0x3129, 0xf000 },
{ 0x312a, 0x0000 },
{ 0x312b, 0xf000 },
{ 0x312c, 0x0000 },
{ 0x312d, 0xf000 },
{ 0x312e, 0x0000 },
{ 0x312f, 0xf000 },
{ 0x3130, 0x0000 },
{ 0x3131, 0xf000 },
{ 0x3132, 0x0000 },
{ 0x3133, 0xf000 },
{ 0x3134, 0x0000 },
{ 0x3135, 0xf000 },
{ 0x3136, 0x0000 },
{ 0x3137, 0xf000 },
{ 0x3138, 0x0000 },
{ 0x3139, 0xf000 },
{ 0x313a, 0x0000 },
{ 0x313b, 0xf000 },
{ 0x313c, 0x0000 },
{ 0x313d, 0xf000 },
{ 0x313e, 0x0000 },
{ 0x313f, 0xf000 },
{ 0x3140, 0x0000 },
{ 0x3141, 0xf000 },
{ 0x3142, 0x0000 },
{ 0x3143, 0xf000 },
{ 0x3144, 0x0000 },
{ 0x3145, 0xf000 },
{ 0x3146, 0x0000 },
{ 0x3147, 0xf000 },
{ 0x3148, 0x0000 },
{ 0x3149, 0xf000 },
{ 0x314a, 0x0000 },
{ 0x314b, 0xf000 },
{ 0x314c, 0x0000 },
{ 0x314d, 0xf000 },
{ 0x314e, 0x0000 },
{ 0x314f, 0xf000 },
{ 0x3150, 0x0000 },
{ 0x3151, 0xf000 },
{ 0x3152, 0x0000 },
{ 0x3153, 0xf000 },
{ 0x3154, 0x0000 },
{ 0x3155, 0xf000 },
{ 0x3156, 0x0000 },
{ 0x3157, 0xf000 },
{ 0x3158, 0x0000 },
{ 0x3159, 0xf000 },
{ 0x315a, 0x0000 },
{ 0x315b, 0xf000 },
{ 0x315c, 0x0000 },
{ 0x315d, 0xf000 },
{ 0x315e, 0x0000 },
{ 0x315f, 0xf000 },
{ 0x3160, 0x0000 },
{ 0x3161, 0xf000 },
{ 0x3162, 0x0000 },
{ 0x3163, 0xf000 },
{ 0x3164, 0x0000 },
{ 0x3165, 0xf000 },
{ 0x3166, 0x0000 },
{ 0x3167, 0xf000 },
{ 0x3168, 0x0000 },
{ 0x3169, 0xf000 },
{ 0x316a, 0x0000 },
{ 0x316b, 0xf000 },
{ 0x316c, 0x0000 },
{ 0x316d, 0xf000 },
{ 0x316e, 0x0000 },
{ 0x316f, 0xf000 },
{ 0x3170, 0x0000 },
{ 0x3171, 0xf000 },
{ 0x3172, 0x0000 },
{ 0x3173, 0xf000 },
{ 0x3174, 0x0000 },
{ 0x3175, 0xf000 },
{ 0x3176, 0x0000 },
{ 0x3177, 0xf000 },
{ 0x3178, 0x0000 },
{ 0x3179, 0xf000 },
{ 0x317a, 0x0000 },
{ 0x317b, 0xf000 },
{ 0x317c, 0x0000 },
{ 0x317d, 0xf000 },
{ 0x317e, 0x0000 },
{ 0x317f, 0xf000 },
{ 0x3180, 0x2001 },
{ 0x3181, 0xf101 },
{ 0x3182, 0x0000 },
{ 0x3183, 0xf000 },
{ 0x3184, 0x0000 },
{ 0x3185, 0xf000 },
{ 0x3186, 0x0000 },
{ 0x3187, 0xf000 },
{ 0x3188, 0x0000 },
{ 0x3189, 0xf000 },
{ 0x318a, 0x0000 },
{ 0x318b, 0xf000 },
{ 0x318c, 0x0000 },
{ 0x318d, 0xf000 },
{ 0x318e, 0x0000 },
{ 0x318f, 0xf000 },
{ 0x3190, 0x0000 },
{ 0x3191, 0xf000 },
{ 0x3192, 0x0000 },
{ 0x3193, 0xf000 },
{ 0x3194, 0x0000 },
{ 0x3195, 0xf000 },
{ 0x3196, 0x0000 },
{ 0x3197, 0xf000 },
{ 0x3198, 0x0000 },
{ 0x3199, 0xf000 },
{ 0x319a, 0x0000 },
{ 0x319b, 0xf000 },
{ 0x319c, 0x0000 },
{ 0x319d, 0xf000 },
{ 0x319e, 0x0000 },
{ 0x319f, 0xf000 },
{ 0x31a0, 0x0000 },
{ 0x31a1, 0xf000 },
{ 0x31a2, 0x0000 },
{ 0x31a3, 0xf000 },
{ 0x31a4, 0x0000 },
{ 0x31a5, 0xf000 },
{ 0x31a6, 0x0000 },
{ 0x31a7, 0xf000 },
{ 0x31a8, 0x0000 },
{ 0x31a9, 0xf000 },
{ 0x31aa, 0x0000 },
{ 0x31ab, 0xf000 },
{ 0x31ac, 0x0000 },
{ 0x31ad, 0xf000 },
{ 0x31ae, 0x0000 },
{ 0x31af, 0xf000 },
{ 0x31b0, 0x0000 },
{ 0x31b1, 0xf000 },
{ 0x31b2, 0x0000 },
{ 0x31b3, 0xf000 },
{ 0x31b4, 0x0000 },
{ 0x31b5, 0xf000 },
{ 0x31b6, 0x0000 },
{ 0x31b7, 0xf000 },
{ 0x31b8, 0x0000 },
{ 0x31b9, 0xf000 },
{ 0x31ba, 0x0000 },
{ 0x31bb, 0xf000 },
{ 0x31bc, 0x0000 },
{ 0x31bd, 0xf000 },
{ 0x31be, 0x0000 },
{ 0x31bf, 0xf000 },
{ 0x31c0, 0x0000 },
{ 0x31c1, 0xf000 },
{ 0x31c2, 0x0000 },
{ 0x31c3, 0xf000 },
{ 0x31c4, 0x0000 },
{ 0x31c5, 0xf000 },
{ 0x31c6, 0x0000 },
{ 0x31c7, 0xf000 },
{ 0x31c8, 0x0000 },
{ 0x31c9, 0xf000 },
{ 0x31ca, 0x0000 },
{ 0x31cb, 0xf000 },
{ 0x31cc, 0x0000 },
{ 0x31cd, 0xf000 },
{ 0x31ce, 0x0000 },
{ 0x31cf, 0xf000 },
{ 0x31d0, 0x0000 },
{ 0x31d1, 0xf000 },
{ 0x31d2, 0x0000 },
{ 0x31d3, 0xf000 },
{ 0x31d4, 0x0000 },
{ 0x31d5, 0xf000 },
{ 0x31d6, 0x0000 },
{ 0x31d7, 0xf000 },
{ 0x31d8, 0x0000 },
{ 0x31d9, 0xf000 },
{ 0x31da, 0x0000 },
{ 0x31db, 0xf000 },
{ 0x31dc, 0x0000 },
{ 0x31dd, 0xf000 },
{ 0x31de, 0x0000 },
{ 0x31df, 0xf000 },
{ 0x31e0, 0x0000 },
{ 0x31e1, 0xf000 },
{ 0x31e2, 0x0000 },
{ 0x31e3, 0xf000 },
{ 0x31e4, 0x0000 },
{ 0x31e5, 0xf000 },
{ 0x31e6, 0x0000 },
{ 0x31e7, 0xf000 },
{ 0x31e8, 0x0000 },
{ 0x31e9, 0xf000 },
{ 0x31ea, 0x0000 },
{ 0x31eb, 0xf000 },
{ 0x31ec, 0x0000 },
{ 0x31ed, 0xf000 },
{ 0x31ee, 0x0000 },
{ 0x31ef, 0xf000 },
{ 0x31f0, 0x0000 },
{ 0x31f1, 0xf000 },
{ 0x31f2, 0x0000 },
{ 0x31f3, 0xf000 },
{ 0x31f4, 0x0000 },
{ 0x31f5, 0xf000 },
{ 0x31f6, 0x0000 },
{ 0x31f7, 0xf000 },
{ 0x31f8, 0x0000 },
{ 0x31f9, 0xf000 },
{ 0x31fa, 0x0000 },
{ 0x31fb, 0xf000 },
{ 0x31fc, 0x0000 },
{ 0x31fd, 0xf000 },
{ 0x31fe, 0x0000 },
{ 0x31ff, 0xf000 },
{ 0x024d, 0xff50 },
{ 0x0252, 0xff50 },
{ 0x0259, 0x0112 },
{ 0x025e, 0x0112 },
};
static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_codec *codec = w->codec;
struct arizona *arizona = dev_get_drvdata(codec->dev);
struct regmap *regmap = codec->control_data;
const struct reg_default *patch = NULL;
int i, patch_size;
switch (arizona->rev) {
case 0:
patch = wm5102_sysclk_reva_patch;
patch_size = ARRAY_SIZE(wm5102_sysclk_reva_patch);
break;
}
switch (event) {
case SND_SOC_DAPM_POST_PMU:
if (patch)
for (i = 0; i < patch_size; i++)
regmap_write(regmap, patch[i].reg,
patch[i].def);
break;
default:
break;
}
return 0;
}
static const struct snd_kcontrol_new wm5102_snd_controls[] = {
SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL,
ARIZONA_IN1_OSR_SHIFT, 1, 0),
@ -297,7 +847,7 @@ static const struct snd_kcontrol_new wm5102_aec_loopback_mux =
static const struct snd_soc_dapm_widget wm5102_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
0, NULL, 0),
0, wm5102_sysclk_ev, SND_SOC_DAPM_POST_PMU),
SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,