适配新七寸屏和AW83791芯片
This commit is contained in:
+260
@@ -0,0 +1,260 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* JD9365 MIPI WXGA panel configuration
|
||||
*
|
||||
* Vendor initialization sequence, 800x1280, four DSI lanes.
|
||||
*/
|
||||
/ {
|
||||
fragment {
|
||||
target-path = "/";
|
||||
__overlay__ {
|
||||
lcds {
|
||||
lcd_jd9365_mipi_wxga: lcd_jd9365_mipi_wxga {
|
||||
sprd,dsi-work-mode = <1>;
|
||||
sprd,dsi-lane-number = <4>;
|
||||
sprd,dsi-color-format = "rgb888";
|
||||
|
||||
/* Vendor PLL_CLOCK: 407 Mbps per lane. */
|
||||
sprd,phy-bit-clock = <407000>;
|
||||
sprd,phy-escape-clock = <20000>;
|
||||
|
||||
sprd,width-mm = <68>;
|
||||
sprd,height-mm = <121>;
|
||||
sprd,esd-check-enable = <0>;
|
||||
sprd,mipi-port = <1>;
|
||||
|
||||
sprd,reset-on-sequence = <1 5>, <0 10>, <1 120>;
|
||||
sprd,reset-off-sequence = <0 20>;
|
||||
|
||||
sprd,use-dcs-write;
|
||||
sprd,initial-command = [
|
||||
23 00 00 02 E0 00
|
||||
23 00 00 02 E1 93
|
||||
23 00 00 02 E2 65
|
||||
23 00 00 02 E3 F8
|
||||
23 00 00 02 80 03
|
||||
23 00 00 02 E0 01
|
||||
23 00 00 02 00 00
|
||||
23 00 00 02 01 37
|
||||
23 00 00 02 03 00
|
||||
23 00 00 02 04 37
|
||||
23 00 00 02 17 00
|
||||
23 00 00 02 18 AF
|
||||
23 00 00 02 19 01
|
||||
23 00 00 02 1A 00
|
||||
23 00 00 02 1B AF
|
||||
23 00 00 02 1C 01
|
||||
23 00 00 02 24 FE
|
||||
23 00 00 02 35 28
|
||||
23 00 00 02 37 09
|
||||
23 00 00 02 38 04
|
||||
23 00 00 02 39 08
|
||||
23 00 00 02 3A 12
|
||||
23 00 00 02 3C 78
|
||||
23 00 00 02 3D FF
|
||||
23 00 00 02 3E FF
|
||||
23 00 00 02 3F FF
|
||||
23 00 00 02 40 06
|
||||
23 00 00 02 41 A0
|
||||
23 00 00 02 43 11
|
||||
23 00 00 02 44 0F
|
||||
23 00 00 02 45 28
|
||||
23 00 00 02 55 02
|
||||
23 00 00 02 57 89
|
||||
23 00 00 02 59 0A
|
||||
23 00 00 02 5A 29
|
||||
23 00 00 02 5B 15
|
||||
23 00 00 02 5D 7F
|
||||
23 00 00 02 5E 62
|
||||
23 00 00 02 5F 53
|
||||
23 00 00 02 60 46
|
||||
23 00 00 02 61 42
|
||||
23 00 00 02 62 34
|
||||
23 00 00 02 63 37
|
||||
23 00 00 02 64 21
|
||||
23 00 00 02 65 3B
|
||||
23 00 00 02 66 3A
|
||||
23 00 00 02 67 38
|
||||
23 00 00 02 68 54
|
||||
23 00 00 02 69 3E
|
||||
23 00 00 02 6A 41
|
||||
23 00 00 02 6B 33
|
||||
23 00 00 02 6C 2E
|
||||
23 00 00 02 6D 20
|
||||
23 00 00 02 6E 0F
|
||||
23 00 00 02 6F 02
|
||||
23 00 00 02 70 67
|
||||
23 00 00 02 71 62
|
||||
23 00 00 02 72 53
|
||||
23 00 00 02 73 46
|
||||
23 00 00 02 74 42
|
||||
23 00 00 02 75 34
|
||||
23 00 00 02 76 37
|
||||
23 00 00 02 77 21
|
||||
23 00 00 02 78 3B
|
||||
23 00 00 02 79 3A
|
||||
23 00 00 02 7A 38
|
||||
23 00 00 02 7B 54
|
||||
23 00 00 02 7C 3E
|
||||
23 00 00 02 7D 41
|
||||
23 00 00 02 7E 33
|
||||
23 00 00 02 7F 2E
|
||||
23 00 00 02 80 20
|
||||
23 00 00 02 81 0F
|
||||
23 00 00 02 82 02
|
||||
23 00 00 02 E0 02
|
||||
23 00 00 02 00 5F
|
||||
23 00 00 02 01 5F
|
||||
23 00 00 02 02 53
|
||||
23 00 00 02 03 51
|
||||
23 00 00 02 04 4B
|
||||
23 00 00 02 05 49
|
||||
23 00 00 02 06 47
|
||||
23 00 00 02 07 45
|
||||
23 00 00 02 08 41
|
||||
23 00 00 02 09 43
|
||||
23 00 00 02 0A 5F
|
||||
23 00 00 02 0B 5F
|
||||
23 00 00 02 0C 5F
|
||||
23 00 00 02 0D 5F
|
||||
23 00 00 02 0E 5F
|
||||
23 00 00 02 0F 5F
|
||||
23 00 00 02 10 5F
|
||||
23 00 00 02 11 5F
|
||||
23 00 00 02 12 5F
|
||||
23 00 00 02 13 5F
|
||||
23 00 00 02 14 5F
|
||||
23 00 00 02 15 5F
|
||||
23 00 00 02 16 5F
|
||||
23 00 00 02 17 5F
|
||||
23 00 00 02 18 52
|
||||
23 00 00 02 19 50
|
||||
23 00 00 02 1A 4A
|
||||
23 00 00 02 1B 48
|
||||
23 00 00 02 1C 46
|
||||
23 00 00 02 1D 44
|
||||
23 00 00 02 1E 40
|
||||
23 00 00 02 1F 42
|
||||
23 00 00 02 20 5F
|
||||
23 00 00 02 21 5F
|
||||
23 00 00 02 22 5F
|
||||
23 00 00 02 23 5F
|
||||
23 00 00 02 24 5F
|
||||
23 00 00 02 25 5F
|
||||
23 00 00 02 26 5F
|
||||
23 00 00 02 27 5F
|
||||
23 00 00 02 28 5F
|
||||
23 00 00 02 29 5F
|
||||
23 00 00 02 2A 5F
|
||||
23 00 00 02 2B 5F
|
||||
23 00 00 02 2C 5F
|
||||
23 00 00 02 2D 5F
|
||||
23 00 00 02 2E 00
|
||||
23 00 00 02 2F 02
|
||||
23 00 00 02 30 08
|
||||
23 00 00 02 31 0A
|
||||
23 00 00 02 32 04
|
||||
23 00 00 02 33 06
|
||||
23 00 00 02 34 12
|
||||
23 00 00 02 35 10
|
||||
23 00 00 02 36 1F
|
||||
23 00 00 02 37 1F
|
||||
23 00 00 02 38 1F
|
||||
23 00 00 02 39 1F
|
||||
23 00 00 02 3A 1F
|
||||
23 00 00 02 3B 1F
|
||||
23 00 00 02 3C 1F
|
||||
23 00 00 02 3D 1F
|
||||
23 00 00 02 3E 1F
|
||||
23 00 00 02 3F 1F
|
||||
23 00 00 02 40 1F
|
||||
23 00 00 02 41 1F
|
||||
23 00 00 02 42 5F
|
||||
23 00 00 02 43 5F
|
||||
23 00 00 02 44 01
|
||||
23 00 00 02 45 03
|
||||
23 00 00 02 46 09
|
||||
23 00 00 02 47 0B
|
||||
23 00 00 02 48 05
|
||||
23 00 00 02 49 07
|
||||
23 00 00 02 4A 13
|
||||
23 00 00 02 4B 11
|
||||
23 00 00 02 4C 1F
|
||||
23 00 00 02 4D 1F
|
||||
23 00 00 02 4E 1F
|
||||
23 00 00 02 4F 1F
|
||||
23 00 00 02 50 1F
|
||||
23 00 00 02 51 1F
|
||||
23 00 00 02 52 1F
|
||||
23 00 00 02 53 1F
|
||||
23 00 00 02 54 1F
|
||||
23 00 00 02 55 1F
|
||||
23 00 00 02 56 1F
|
||||
23 00 00 02 57 1F
|
||||
23 00 00 02 58 40
|
||||
23 00 00 02 5B 30
|
||||
23 00 00 02 5C 09
|
||||
23 00 00 02 5D 30
|
||||
23 00 00 02 5E 01
|
||||
23 00 00 02 5F 02
|
||||
23 00 00 02 60 30
|
||||
23 00 00 02 61 01
|
||||
23 00 00 02 62 02
|
||||
23 00 00 02 63 1C
|
||||
23 00 00 02 64 6A
|
||||
23 00 00 02 65 75
|
||||
23 00 00 02 66 0D
|
||||
23 00 00 02 67 72
|
||||
23 00 00 02 68 0C
|
||||
23 00 00 02 69 1C
|
||||
23 00 00 02 6A 6A
|
||||
23 00 00 02 6B 08
|
||||
23 00 00 02 6C 00
|
||||
23 00 00 02 6D 00
|
||||
23 00 00 02 6E 00
|
||||
23 00 00 02 6F 88
|
||||
23 00 00 02 75 BB
|
||||
23 00 00 02 76 01
|
||||
23 00 00 02 77 0D
|
||||
23 00 00 02 78 10
|
||||
23 00 00 02 E0 04
|
||||
23 00 00 02 00 0E
|
||||
23 00 00 02 02 B3
|
||||
23 00 00 02 09 60
|
||||
23 00 00 02 0E 48
|
||||
23 00 00 02 E0 00
|
||||
23 78 00 02 11 00
|
||||
23 05 00 02 29 00
|
||||
23 00 00 02 35 00
|
||||
];
|
||||
|
||||
sprd,sleep-in-command = [
|
||||
13 0A 00 01 28
|
||||
13 78 00 01 10
|
||||
];
|
||||
sprd,sleep-out-command = [
|
||||
13 78 00 01 11
|
||||
13 05 00 01 29
|
||||
];
|
||||
|
||||
display-timings {
|
||||
native-mode = <&jd9365_timing0>;
|
||||
|
||||
jd9365_timing0: timing0 {
|
||||
clock-frequency = <67750800>;
|
||||
hactive = <800>;
|
||||
vactive = <1280>;
|
||||
hback-porch = <20>;
|
||||
hfront-porch = <20>;
|
||||
vback-porch = <8>;
|
||||
vfront-porch = <17>;
|
||||
hsync-len = <20>;
|
||||
vsync-len = <8>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
+14
-1
@@ -1290,6 +1290,12 @@ static int aw87xxx_acf_bin_load(struct aw87xxx *aw87xxx)
|
||||
ret = request_firmware(&cont, aw87xxx->fw_name, aw87xxx->dev);
|
||||
if ((ret) || (!cont)) {
|
||||
AW_DEV_LOGD(aw87xxx->dev, "load [%s] failed!", aw87xxx->fw_name);
|
||||
if (aw87xxx->aw_dev.chipid == AW_DEV_CHIPID_C1) {
|
||||
AW_DEV_LOGI(aw87xxx->dev,
|
||||
"no ACF for AW87391, use safe built-in defaults");
|
||||
return aw87391_acf_load_builtin(aw87xxx->dev,
|
||||
&aw87xxx->acf_info);
|
||||
}
|
||||
if (acf_info->load_count == AW_READ_CHIPID_RETRIES) {
|
||||
acf_info->load_count = 0;
|
||||
} else {
|
||||
@@ -1319,7 +1325,14 @@ static int aw87xxx_acf_bin_load(struct aw87xxx *aw87xxx)
|
||||
|
||||
ret = aw87xxx_acf_parse(aw87xxx->dev, &aw87xxx->acf_info);
|
||||
if (ret < 0) {
|
||||
AW_DEV_LOGE(aw87xxx->dev, "fw_data parse failed");
|
||||
if (aw87xxx->aw_dev.chipid == AW_DEV_CHIPID_C1) {
|
||||
AW_DEV_LOGI(aw87xxx->dev,
|
||||
"ACF has no AW87391 profile, use safe built-in defaults");
|
||||
ret = aw87391_acf_load_builtin(aw87xxx->dev,
|
||||
&aw87xxx->acf_info);
|
||||
} else {
|
||||
AW_DEV_LOGE(aw87xxx->dev, "fw_data parse failed");
|
||||
}
|
||||
goto exit_acf_parse_failed;
|
||||
}
|
||||
|
||||
|
||||
+90
@@ -80,6 +80,55 @@ static char *g_profile_name[] = {"Music", "Voice", "Voip",
|
||||
|
||||
static char *g_power_off_name[] = {"Off", "OFF", "off", "oFF", "power_down"};
|
||||
|
||||
/*
|
||||
* Safe AW87391 fallback profiles derived from the public register definitions
|
||||
* in the AW87391 V1.2 data sheet. The board's legacy ACF contains AW87390
|
||||
* (chip-id 0x76) data only; those values must never be written to AW87391
|
||||
* (chip-id 0xc1), whose public register map is different.
|
||||
*
|
||||
* Keep EN_SW clear while programming and write it last when powering on.
|
||||
* Only public registers 0x00..0x05 are touched. Keep the board's legacy 8.0 V
|
||||
* charge-pump limit (0x06 on AW87391) and use the conservative default AGC2
|
||||
* limit of 1.2 W into 8 ohm. A product-specific ACF, when supplied, is still
|
||||
* preferred and bypasses this fallback entirely.
|
||||
*/
|
||||
static uint8_t g_aw87391_music_profile[] = {
|
||||
0x00, 0xaa,
|
||||
AW87XXX_DELAY_REG_ADDR, 0x01,
|
||||
0x02, 0x06,
|
||||
0x03, 0x02,
|
||||
0x04, 0x47,
|
||||
0x05, 0x4e,
|
||||
0x01, 0x3f,
|
||||
};
|
||||
|
||||
static uint8_t g_aw87391_off_profile[] = {
|
||||
0x01, 0x3e,
|
||||
};
|
||||
|
||||
static uint8_t g_aw87391_receiver_profile[] = {
|
||||
0x00, 0xaa,
|
||||
AW87XXX_DELAY_REG_ADDR, 0x01,
|
||||
0x02, 0x06,
|
||||
0x03, 0x00,
|
||||
0x04, 0x47,
|
||||
0x05, 0x4e,
|
||||
0x01, 0x37,
|
||||
};
|
||||
|
||||
struct aw87391_builtin_profile {
|
||||
const char *name;
|
||||
uint8_t *data;
|
||||
uint32_t len;
|
||||
};
|
||||
|
||||
static const struct aw87391_builtin_profile g_aw87391_builtin_profiles[] = {
|
||||
{ "Music", g_aw87391_music_profile, ARRAY_SIZE(g_aw87391_music_profile) },
|
||||
{ "Off", g_aw87391_off_profile, ARRAY_SIZE(g_aw87391_off_profile) },
|
||||
{ "Receiver", g_aw87391_receiver_profile,
|
||||
ARRAY_SIZE(g_aw87391_receiver_profile) },
|
||||
};
|
||||
|
||||
static char *aw_get_prof_name(int profile)
|
||||
{
|
||||
if (profile < 0 || profile >= AW_PROFILE_MAX)
|
||||
@@ -1464,6 +1513,47 @@ void aw87xxx_acf_profile_free(struct device *dev, struct acf_bin_info *acf_info)
|
||||
}
|
||||
}
|
||||
|
||||
int aw87391_acf_load_builtin(struct device *dev,
|
||||
struct acf_bin_info *acf_info)
|
||||
{
|
||||
struct aw_prof_info *prof_info = &acf_info->prof_info;
|
||||
int count = ARRAY_SIZE(g_aw87391_builtin_profiles);
|
||||
int i;
|
||||
|
||||
aw87xxx_acf_profile_free(dev, acf_info);
|
||||
|
||||
prof_info->prof_name_list = devm_kcalloc(dev, count,
|
||||
AW_PROFILE_STR_MAX, GFP_KERNEL);
|
||||
if (!prof_info->prof_name_list)
|
||||
return -ENOMEM;
|
||||
|
||||
prof_info->prof_desc = devm_kcalloc(dev, count,
|
||||
sizeof(*prof_info->prof_desc), GFP_KERNEL);
|
||||
if (!prof_info->prof_desc) {
|
||||
devm_kfree(dev, prof_info->prof_name_list);
|
||||
prof_info->prof_name_list = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
snprintf(prof_info->prof_name_list[i], AW_PROFILE_STR_MAX, "%s",
|
||||
g_aw87391_builtin_profiles[i].name);
|
||||
prof_info->prof_desc[i].prof_name = prof_info->prof_name_list[i];
|
||||
prof_info->prof_desc[i].prof_st = AW_PROFILE_OK;
|
||||
prof_info->prof_desc[i].data_container.data =
|
||||
g_aw87391_builtin_profiles[i].data;
|
||||
prof_info->prof_desc[i].data_container.len =
|
||||
g_aw87391_builtin_profiles[i].len;
|
||||
}
|
||||
|
||||
prof_info->count = count;
|
||||
prof_info->prof_type = AW_DDE_DEV_DEFAULT_TYPE_ID;
|
||||
prof_info->status = AW_ACF_UPDATE;
|
||||
AW_DEV_LOGI(dev, "loaded built-in AW87391 safe profiles");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aw_parse_single_bin(struct device *dev, struct acf_bin_info *acf_info,
|
||||
struct aw_data_container aw_fw_data, int prof_index)
|
||||
{
|
||||
|
||||
+2
@@ -193,6 +193,8 @@ char *aw87xxx_ctos_get_prof_name(int profile_id);
|
||||
void aw87xxx_acf_profile_free(struct device *dev,
|
||||
struct acf_bin_info *acf_info);
|
||||
int aw87xxx_acf_parse(struct device *dev, struct acf_bin_info *acf_info);
|
||||
int aw87391_acf_load_builtin(struct device *dev,
|
||||
struct acf_bin_info *acf_info);
|
||||
struct aw_prof_desc *aw87xxx_acf_get_prof_desc_form_name(struct device *dev,
|
||||
struct acf_bin_info *acf_info, char *profile_name);
|
||||
int aw87xxx_acf_get_prof_index_form_name(struct device *dev,
|
||||
|
||||
+4
-3
@@ -226,8 +226,9 @@ static struct sprd_headset *sprd_hdst;
|
||||
|
||||
static void sprd_enable_hmicbias_polling(bool enable, bool force_disable);
|
||||
/*
|
||||
* When remove headphone, disconnect the headphone
|
||||
* dapm DA path in codec driver.
|
||||
* Keep the UMP9620 "HP Virt" DAPM path in sync with jack state.
|
||||
* SND_SOC_DAPM_SWITCH_E("HP Virt", ...) exposes the mixer control as
|
||||
* "HP Virt Switch".
|
||||
*/
|
||||
static int dapm_jack_switch_control(struct snd_soc_component *codec, bool on)
|
||||
{
|
||||
@@ -235,7 +236,7 @@ static int dapm_jack_switch_control(struct snd_soc_component *codec, bool on)
|
||||
struct snd_soc_card *card = codec ? codec->card : NULL;
|
||||
struct snd_ctl_elem_id id = {
|
||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||
.name = "Virt HP Jack Switch",
|
||||
.name = "HP Virt Switch",
|
||||
};
|
||||
struct snd_ctl_elem_value ucontrol = {
|
||||
.value.integer.value[0] = on,
|
||||
|
||||
Reference in New Issue
Block a user