extcon: madera: Add tuning for cs47l15 based on HP impedance
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Thu, 1 Mar 2018 15:25:36 +0000 (15:25 +0000)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:29 +0000 (20:22 +0300)
Change-Id: I022127c124da8c84237a14dfeb17980e405afb50
Signed-off-by: Jaswinder Jassal <jjassal@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
drivers/extcon/extcon-madera.c

index e554f034dc95490a5ae8b15e777940e8a44c5dca..c8d5fb3db5c28ce41451c914ee1c419725bbd344 100644 (file)
@@ -146,6 +146,126 @@ struct madera_hp_tuning {
        int patch_len;
 };
 
+static const struct reg_sequence cs47l15_low_impedance_patch[] = {
+       { 0x460, 0x0C00 },
+       { 0x461, 0xCB59 },
+       { 0x462, 0x0C00 },
+       { 0x463, 0x6037 },
+       { 0x464, 0x0C01 },
+       { 0x465, 0x2D86 },
+       { 0x466, 0x0801 },
+       { 0x467, 0x264E },
+       { 0x468, 0x0801 },
+       { 0x469, 0x1E6D },
+       { 0x46A, 0x0802 },
+       { 0x46B, 0x199A },
+       { 0x46C, 0x0802 },
+       { 0x46D, 0x1220 },
+       { 0x46E, 0x0802 },
+       { 0x46F, 0x0E65 },
+       { 0x470, 0x0806 },
+       { 0x471, 0x0A31 },
+       { 0x472, 0x080E },
+       { 0x473, 0x040F },
+       { 0x474, 0x080E },
+       { 0x475, 0x0339 },
+       { 0x476, 0x080E },
+       { 0x477, 0x028F },
+       { 0x478, 0x080E },
+       { 0x479, 0x0209 },
+       { 0x47A, 0x080E },
+       { 0x47B, 0x00CF },
+       { 0x47C, 0x080E },
+       { 0x47D, 0x0001 },
+       { 0x47E, 0x081F },
+};
+
+static const struct reg_sequence cs47l15_normal_impedance_patch[] = {
+       { 0x460, 0x0C00 },
+       { 0x461, 0xCB59 },
+       { 0x462, 0x0C00 },
+       { 0x463, 0xB53C },
+       { 0x464, 0x0C01 },
+       { 0x465, 0x4827 },
+       { 0x466, 0x0801 },
+       { 0x467, 0x3950 },
+       { 0x468, 0x0801 },
+       { 0x469, 0x264E },
+       { 0x46A, 0x0802 },
+       { 0x46B, 0x1E6D },
+       { 0x46C, 0x0802 },
+       { 0x46D, 0x199A },
+       { 0x46E, 0x0802 },
+       { 0x46F, 0x1456 },
+       { 0x470, 0x0806 },
+       { 0x471, 0x1220 },
+       { 0x472, 0x080E },
+       { 0x473, 0x040F },
+       { 0x474, 0x080E },
+       { 0x475, 0x0339 },
+       { 0x476, 0x080E },
+       { 0x477, 0x028F },
+       { 0x478, 0x080E },
+       { 0x479, 0x0209 },
+       { 0x47A, 0x080E },
+       { 0x47B, 0x00CF },
+       { 0x47C, 0x080E },
+       { 0x47D, 0x0001 },
+       { 0x47E, 0x081F },
+};
+
+static const struct reg_sequence cs47l15_high_impedance_patch[] = {
+       { 0x460, 0x0C00 },
+       { 0x461, 0xCB59 },
+       { 0x462, 0x0C00 },
+       { 0x463, 0xB53C },
+       { 0x464, 0x0C01 },
+       { 0x465, 0x6037 },
+       { 0x466, 0x0801 },
+       { 0x467, 0x4827 },
+       { 0x468, 0x0801 },
+       { 0x469, 0x3950 },
+       { 0x46A, 0x0802 },
+       { 0x46B, 0x264E },
+       { 0x46C, 0x0802 },
+       { 0x46D, 0x1E6D },
+       { 0x46E, 0x0802 },
+       { 0x46F, 0x199A },
+       { 0x470, 0x0806 },
+       { 0x471, 0x1220 },
+       { 0x472, 0x080E },
+       { 0x473, 0x040F },
+       { 0x474, 0x080E },
+       { 0x475, 0x0339 },
+       { 0x476, 0x080E },
+       { 0x477, 0x028F },
+       { 0x478, 0x080E },
+       { 0x479, 0x0209 },
+       { 0x47A, 0x080E },
+       { 0x47B, 0x00CF },
+       { 0x47C, 0x080E },
+       { 0x47D, 0x0001 },
+       { 0x47E, 0x081F },
+};
+
+static const struct madera_hp_tuning cs47l15_hp_tuning[] = {
+       {
+               1600,
+               cs47l15_low_impedance_patch,
+               ARRAY_SIZE(cs47l15_low_impedance_patch),
+       },
+       {
+               3200,
+               cs47l15_normal_impedance_patch,
+               ARRAY_SIZE(cs47l15_normal_impedance_patch),
+       },
+       {
+               MADERA_HPDET_MAX_HOHM,
+               cs47l15_high_impedance_patch,
+               ARRAY_SIZE(cs47l15_high_impedance_patch),
+       },
+};
+
 static const struct reg_sequence cs47l35_low_impedance_patch[] = {
        { 0x460, 0x0C40 },
        { 0x461, 0xCD1A },
@@ -1382,6 +1502,10 @@ static int madera_tune_headphone(struct madera_extcon *info, int reading)
        int i, ret;
 
        switch (madera->type) {
+       case CS47L15:
+               tuning = cs47l15_hp_tuning;
+               n_tunings = ARRAY_SIZE(cs47l15_hp_tuning);
+               break;
        case CS47L35:
                tuning = cs47l35_hp_tuning;
                n_tunings = ARRAY_SIZE(cs47l35_hp_tuning);