Commit 37b4346e authored by Mark Brown's avatar Mark Brown

ASoC: codecs: Add aw87390 amplifier driver

Merge series from wangweidong.a@awinic.com:

The awinic aw87390 is a new high efficiency, low noise,
constant large volume, 6th Smart K audio amplifier.
parents 54ac5120 4717636f
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/awinic,aw87390.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Awinic Aw87390 Audio Amplifier
maintainers:
- Weidong Wang <wangweidong.a@awinic.com>
description:
The awinic aw87390 is specifically designed to improve
the musical output dynamic range, enhance the overall
sound quallity, which is a new high efficiency, low
noise, constant large volume, 6th Smart K audio amplifier.
allOf:
- $ref: dai-common.yaml#
properties:
compatible:
const: awinic,aw87390
reg:
maxItems: 1
"#sound-dai-cells":
const: 0
awinic,audio-channel:
description:
It is used to distinguish multiple PA devices, so that different
configurations can be loaded to different PA devices
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 7
required:
- compatible
- reg
- "#sound-dai-cells"
- awinic,audio-channel
unevaluatedProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
audio-codec@58 {
compatible = "awinic,aw87390";
reg = <0x58>;
#sound-dai-cells = <0>;
awinic,audio-channel = <0>;
};
};
...@@ -32,11 +32,25 @@ properties: ...@@ -32,11 +32,25 @@ properties:
reset-gpios: reset-gpios:
maxItems: 1 maxItems: 1
awinic,audio-channel:
description:
It is used to distinguish multiple PA devices, so that different
configurations can be loaded to different PA devices
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 7
awinic,sync-flag:
description:
Flag bit used to keep the phase synchronized in the case of multiple PA
$ref: /schemas/types.yaml#/definitions/flag
required: required:
- compatible - compatible
- reg - reg
- '#sound-dai-cells' - '#sound-dai-cells'
- reset-gpios - reset-gpios
- awinic,audio-channel
unevaluatedProperties: false unevaluatedProperties: false
...@@ -51,5 +65,7 @@ examples: ...@@ -51,5 +65,7 @@ examples:
reg = <0x34>; reg = <0x34>;
#sound-dai-cells = <0>; #sound-dai-cells = <0>;
reset-gpios = <&gpio 10 GPIO_ACTIVE_LOW>; reset-gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
awinic,audio-channel = <0>;
awinic,sync-flag;
}; };
}; };
...@@ -54,6 +54,7 @@ config SND_SOC_ALL_CODECS ...@@ -54,6 +54,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_ALC5632 imply SND_SOC_ALC5632
imply SND_SOC_AUDIO_IIO_AUX imply SND_SOC_AUDIO_IIO_AUX
imply SND_SOC_AW8738 imply SND_SOC_AW8738
imply SND_SOC_AW87390
imply SND_SOC_AW88395 imply SND_SOC_AW88395
imply SND_SOC_AW88261 imply SND_SOC_AW88261
imply SND_SOC_BT_SCO imply SND_SOC_BT_SCO
...@@ -639,12 +640,12 @@ config SND_SOC_AW8738 ...@@ -639,12 +640,12 @@ config SND_SOC_AW8738
operation mode using the Awinic-specific one-wire pulse control. operation mode using the Awinic-specific one-wire pulse control.
config SND_SOC_AW88395_LIB config SND_SOC_AW88395_LIB
select CRC8
tristate tristate
config SND_SOC_AW88395 config SND_SOC_AW88395
tristate "Soc Audio for awinic aw88395" tristate "Soc Audio for awinic aw88395"
depends on I2C depends on I2C
select CRC8
select CRC32 select CRC32
select REGMAP_I2C select REGMAP_I2C
select GPIOLIB select GPIOLIB
...@@ -658,7 +659,6 @@ config SND_SOC_AW88395 ...@@ -658,7 +659,6 @@ config SND_SOC_AW88395
config SND_SOC_AW88261 config SND_SOC_AW88261
tristate "Soc Audio for awinic aw88261" tristate "Soc Audio for awinic aw88261"
depends on I2C depends on I2C
select CRC8
select REGMAP_I2C select REGMAP_I2C
select GPIOLIB select GPIOLIB
select SND_SOC_AW88395_LIB select SND_SOC_AW88395_LIB
...@@ -669,6 +669,17 @@ config SND_SOC_AW88261 ...@@ -669,6 +669,17 @@ config SND_SOC_AW88261
boost converter can be adjusted smartly according to boost converter can be adjusted smartly according to
the input amplitude. the input amplitude.
config SND_SOC_AW87390
tristate "Soc Audio for awinic aw87390"
depends on I2C
select REGMAP_I2C
select SND_SOC_AW88395_LIB
help
The awinic aw87390 is specifically designed to improve
the musical output dynamic range, enhance the overall
sound quality, which is a new high efficiency, low
noise, constant large volume, 6th Smart K audio amplifier.
config SND_SOC_BD28623 config SND_SOC_BD28623
tristate "ROHM BD28623 CODEC" tristate "ROHM BD28623 CODEC"
help help
......
...@@ -47,6 +47,7 @@ snd-soc-ak5558-objs := ak5558.o ...@@ -47,6 +47,7 @@ snd-soc-ak5558-objs := ak5558.o
snd-soc-arizona-objs := arizona.o arizona-jack.o snd-soc-arizona-objs := arizona.o arizona-jack.o
snd-soc-audio-iio-aux-objs := audio-iio-aux.o snd-soc-audio-iio-aux-objs := audio-iio-aux.o
snd-soc-aw8738-objs := aw8738.o snd-soc-aw8738-objs := aw8738.o
snd-soc-aw87390-objs := aw87390.o
snd-soc-aw88395-lib-objs := aw88395/aw88395_lib.o snd-soc-aw88395-lib-objs := aw88395/aw88395_lib.o
snd-soc-aw88395-objs := aw88395/aw88395.o \ snd-soc-aw88395-objs := aw88395/aw88395.o \
aw88395/aw88395_device.o aw88395/aw88395_device.o
...@@ -435,6 +436,7 @@ obj-$(CONFIG_SND_SOC_ALC5632) += snd-soc-alc5632.o ...@@ -435,6 +436,7 @@ obj-$(CONFIG_SND_SOC_ALC5632) += snd-soc-alc5632.o
obj-$(CONFIG_SND_SOC_ARIZONA) += snd-soc-arizona.o obj-$(CONFIG_SND_SOC_ARIZONA) += snd-soc-arizona.o
obj-$(CONFIG_SND_SOC_AUDIO_IIO_AUX) += snd-soc-audio-iio-aux.o obj-$(CONFIG_SND_SOC_AUDIO_IIO_AUX) += snd-soc-audio-iio-aux.o
obj-$(CONFIG_SND_SOC_AW8738) += snd-soc-aw8738.o obj-$(CONFIG_SND_SOC_AW8738) += snd-soc-aw8738.o
obj-$(CONFIG_SND_SOC_AW87390) += snd-soc-aw87390.o
obj-$(CONFIG_SND_SOC_AW88395_LIB) += snd-soc-aw88395-lib.o obj-$(CONFIG_SND_SOC_AW88395_LIB) += snd-soc-aw88395-lib.o
obj-$(CONFIG_SND_SOC_AW88395) +=snd-soc-aw88395.o obj-$(CONFIG_SND_SOC_AW88395) +=snd-soc-aw88395.o
obj-$(CONFIG_SND_SOC_AW88261) +=snd-soc-aw88261.o obj-$(CONFIG_SND_SOC_AW88261) +=snd-soc-aw88261.o
......
This diff is collapsed.
// SPDX-License-Identifier: GPL-2.0-only
//
// aw87390.h -- aw87390 ALSA SoC Audio driver
//
// Copyright (c) 2023 awinic Technology CO., LTD
//
// Author: Weidong Wang <wangweidong.a@awinic.com>
//
#ifndef __AW87390_H__
#define __AW87390_H__
#define AW87390_ID_REG (0x00)
#define AW87390_SYSCTRL_REG (0x01)
#define AW87390_MDCTRL_REG (0x02)
#define AW87390_CPOVP_REG (0x03)
#define AW87390_CPP_REG (0x04)
#define AW87390_PAG_REG (0x05)
#define AW87390_AGC3P_REG (0x06)
#define AW87390_AGC3PA_REG (0x07)
#define AW87390_AGC2P_REG (0x08)
#define AW87390_AGC2PA_REG (0x09)
#define AW87390_AGC1PA_REG (0x0A)
#define AW87390_SYSST_REG (0x59)
#define AW87390_SYSINT_REG (0x60)
#define AW87390_DFT_SYSCTRL_REG (0x61)
#define AW87390_DFT_MDCTRL_REG (0x62)
#define AW87390_DFT_CPADP_REG (0x63)
#define AW87390_DFT_AGCPA_REG (0x64)
#define AW87390_DFT_POFR_REG (0x65)
#define AW87390_DFT_OC_REG (0x66)
#define AW87390_DFT_ADP1_REG (0x67)
#define AW87390_DFT_REF_REG (0x68)
#define AW87390_DFT_LDO_REG (0x69)
#define AW87390_ADP1_REG (0x70)
#define AW87390_ADP2_REG (0x71)
#define AW87390_NG1_REG (0x72)
#define AW87390_NG2_REG (0x73)
#define AW87390_NG3_REG (0x74)
#define AW87390_CP_REG (0x75)
#define AW87390_AB_REG (0x76)
#define AW87390_TEST_REG (0x77)
#define AW87390_ENCR_REG (0x78)
#define AW87390_DELAY_REG_ADDR (0xFE)
#define AW87390_SOFT_RESET_VALUE (0xAA)
#define AW87390_POWER_DOWN_VALUE (0x00)
#define AW87390_REG_MAX (0xFF)
#define AW87390_DEV_DEFAULT_CH (0)
#define AW87390_INIT_PROFILE (0)
#define AW87390_REG_DELAY_TIME (1000)
#define AW87390_I2C_NAME "aw87390"
#define AW87390_ACF_FILE "aw87390_acf.bin"
#define AW87390_PROFILE_EXT(xname, profile_info, profile_get, profile_set) \
{ \
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
.name = xname, \
.info = profile_info, \
.get = profile_get, \
.put = profile_set, \
}
enum aw87390_id {
AW87390_CHIP_ID = 0x76,
};
enum {
AW87390_DEV_FW_FAILED = 0,
AW87390_DEV_FW_OK,
};
enum {
AW87390_DEV_PW_OFF = 0,
AW87390_DEV_PW_ON,
};
struct aw87390 {
struct aw_device *aw_pa;
struct mutex lock;
struct regmap *regmap;
struct aw_container *aw_cfg;
};
#endif
...@@ -477,7 +477,7 @@ static int aw88261_dev_reg_update(struct aw88261 *aw88261, ...@@ -477,7 +477,7 @@ static int aw88261_dev_reg_update(struct aw88261 *aw88261,
return ret; return ret;
} }
static char *aw88261_dev_get_prof_name(struct aw_device *aw_dev, int index) static int aw88261_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name)
{ {
struct aw_prof_info *prof_info = &aw_dev->prof_info; struct aw_prof_info *prof_info = &aw_dev->prof_info;
struct aw_prof_desc *prof_desc; struct aw_prof_desc *prof_desc;
...@@ -485,12 +485,14 @@ static char *aw88261_dev_get_prof_name(struct aw_device *aw_dev, int index) ...@@ -485,12 +485,14 @@ static char *aw88261_dev_get_prof_name(struct aw_device *aw_dev, int index)
if ((index >= aw_dev->prof_info.count) || (index < 0)) { if ((index >= aw_dev->prof_info.count) || (index < 0)) {
dev_err(aw_dev->dev, "index[%d] overflow count[%d]", dev_err(aw_dev->dev, "index[%d] overflow count[%d]",
index, aw_dev->prof_info.count); index, aw_dev->prof_info.count);
return NULL; return -EINVAL;
} }
prof_desc = &aw_dev->prof_info.prof_desc[index]; prof_desc = &aw_dev->prof_info.prof_desc[index];
return prof_info->prof_name_list[prof_desc->id]; *prof_name = prof_info->prof_name_list[prof_desc->id];
return 0;
} }
static int aw88261_dev_get_prof_data(struct aw_device *aw_dev, int index, static int aw88261_dev_get_prof_data(struct aw_device *aw_dev, int index,
...@@ -515,8 +517,8 @@ static int aw88261_dev_fw_update(struct aw88261 *aw88261) ...@@ -515,8 +517,8 @@ static int aw88261_dev_fw_update(struct aw88261 *aw88261)
char *prof_name; char *prof_name;
int ret; int ret;
prof_name = aw88261_dev_get_prof_name(aw_dev, aw_dev->prof_index); ret = aw88261_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name);
if (!prof_name) { if (ret) {
dev_err(aw_dev->dev, "get prof name failed"); dev_err(aw_dev->dev, "get prof name failed");
return -EINVAL; return -EINVAL;
} }
...@@ -818,9 +820,8 @@ static int aw88261_profile_info(struct snd_kcontrol *kcontrol, ...@@ -818,9 +820,8 @@ static int aw88261_profile_info(struct snd_kcontrol *kcontrol,
{ {
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec);
const char *prof_name; char *prof_name, *name;
char *name; int count, ret;
int count;
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1; uinfo->count = 1;
...@@ -839,8 +840,8 @@ static int aw88261_profile_info(struct snd_kcontrol *kcontrol, ...@@ -839,8 +840,8 @@ static int aw88261_profile_info(struct snd_kcontrol *kcontrol,
name = uinfo->value.enumerated.name; name = uinfo->value.enumerated.name;
count = uinfo->value.enumerated.item; count = uinfo->value.enumerated.item;
prof_name = aw88261_dev_get_prof_name(aw88261->aw_pa, count); ret = aw88261_dev_get_prof_name(aw88261->aw_pa, count, &prof_name);
if (!prof_name) { if (ret) {
strscpy(uinfo->value.enumerated.name, "null", strscpy(uinfo->value.enumerated.name, "null",
strlen("null") + 1); strlen("null") + 1);
return 0; return 0;
...@@ -1187,13 +1188,11 @@ static void aw88261_parse_channel_dt(struct aw88261 *aw88261) ...@@ -1187,13 +1188,11 @@ static void aw88261_parse_channel_dt(struct aw88261 *aw88261)
struct aw_device *aw_dev = aw88261->aw_pa; struct aw_device *aw_dev = aw88261->aw_pa;
struct device_node *np = aw_dev->dev->of_node; struct device_node *np = aw_dev->dev->of_node;
u32 channel_value = AW88261_DEV_DEFAULT_CH; u32 channel_value = AW88261_DEV_DEFAULT_CH;
u32 sync_enable = false;
of_property_read_u32(np, "sound-channel", &channel_value); of_property_read_u32(np, "awinic,audio-channel", &channel_value);
of_property_read_u32(np, "sync-flag", &sync_enable); aw88261->phase_sync = of_property_read_bool(np, "awinic,sync-flag");
aw_dev->channel = channel_value; aw_dev->channel = channel_value;
aw88261->phase_sync = sync_enable;
} }
static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct regmap *regmap) static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct regmap *regmap)
......
...@@ -370,7 +370,7 @@ ...@@ -370,7 +370,7 @@
#define AW88261_START_RETRIES (5) #define AW88261_START_RETRIES (5)
#define AW88261_START_WORK_DELAY_MS (0) #define AW88261_START_WORK_DELAY_MS (0)
#define AW88261_I2C_NAME "aw88261_smartpa" #define AW88261_I2C_NAME "aw88261"
#define AW88261_RATES (SNDRV_PCM_RATE_8000_48000 | \ #define AW88261_RATES (SNDRV_PCM_RATE_8000_48000 | \
SNDRV_PCM_RATE_96000) SNDRV_PCM_RATE_96000)
...@@ -453,7 +453,7 @@ struct aw88261 { ...@@ -453,7 +453,7 @@ struct aw88261 {
unsigned int mute_st; unsigned int mute_st;
unsigned int amppd_st; unsigned int amppd_st;
unsigned char phase_sync; bool phase_sync;
}; };
#endif #endif
...@@ -175,9 +175,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol, ...@@ -175,9 +175,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol,
{ {
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec);
const char *prof_name; char *prof_name, *name;
char *name; int count, ret;
int count;
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1; uinfo->count = 1;
...@@ -196,8 +195,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol, ...@@ -196,8 +195,8 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol,
name = uinfo->value.enumerated.name; name = uinfo->value.enumerated.name;
count = uinfo->value.enumerated.item; count = uinfo->value.enumerated.item;
prof_name = aw88395_dev_get_prof_name(aw88395->aw_pa, count); ret = aw88395_dev_get_prof_name(aw88395->aw_pa, count, &prof_name);
if (!prof_name) { if (ret) {
strscpy(uinfo->value.enumerated.name, "null", strscpy(uinfo->value.enumerated.name, "null",
strlen("null") + 1); strlen("null") + 1);
return 0; return 0;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define AW88395_DSP_16_DATA_MASK (0x0000ffff) #define AW88395_DSP_16_DATA_MASK (0x0000ffff)
#define AW88395_I2C_NAME "aw88395_smartpa" #define AW88395_I2C_NAME "aw88395"
#define AW88395_RATES (SNDRV_PCM_RATE_8000_48000 | \ #define AW88395_RATES (SNDRV_PCM_RATE_8000_48000 | \
SNDRV_PCM_RATE_96000) SNDRV_PCM_RATE_96000)
......
...@@ -297,9 +297,6 @@ static void aw_dev_fade_in(struct aw_device *aw_dev) ...@@ -297,9 +297,6 @@ static void aw_dev_fade_in(struct aw_device *aw_dev)
int fade_step = aw_dev->fade_step; int fade_step = aw_dev->fade_step;
int i; int i;
if (!aw_dev->fade_en)
return;
if (fade_step == 0 || aw_dev->fade_in_time == 0) { if (fade_step == 0 || aw_dev->fade_in_time == 0) {
aw_dev_set_volume(aw_dev, fade_in_vol); aw_dev_set_volume(aw_dev, fade_in_vol);
return; return;
...@@ -320,9 +317,6 @@ static void aw_dev_fade_out(struct aw_device *aw_dev) ...@@ -320,9 +317,6 @@ static void aw_dev_fade_out(struct aw_device *aw_dev)
int fade_step = aw_dev->fade_step; int fade_step = aw_dev->fade_step;
int i; int i;
if (!aw_dev->fade_en)
return;
if (fade_step == 0 || aw_dev->fade_out_time == 0) { if (fade_step == 0 || aw_dev->fade_out_time == 0) {
aw_dev_set_volume(aw_dev, AW88395_MUTE_VOL); aw_dev_set_volume(aw_dev, AW88395_MUTE_VOL);
return; return;
...@@ -1062,10 +1056,6 @@ static int aw_dev_update_reg_container(struct aw_device *aw_dev, ...@@ -1062,10 +1056,6 @@ static int aw_dev_update_reg_container(struct aw_device *aw_dev,
aw_dev_set_volume(aw_dev, vol_desc->ctl_volume); aw_dev_set_volume(aw_dev, vol_desc->ctl_volume);
} }
/* keep min volume */
if (aw_dev->fade_en)
aw_dev_set_volume(aw_dev, AW88395_MUTE_VOL);
aw_dev_get_dsp_config(aw_dev, &aw_dev->dsp_cfg); aw_dev_get_dsp_config(aw_dev, &aw_dev->dsp_cfg);
return ret; return ret;
...@@ -1306,7 +1296,9 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool forc ...@@ -1306,7 +1296,9 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool forc
return -EPERM; return -EPERM;
} }
prof_name = aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index); ret = aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name);
if (ret)
return ret;
dev_dbg(aw_dev->dev, "start update %s", prof_name); dev_dbg(aw_dev->dev, "start update %s", prof_name);
...@@ -1594,37 +1586,19 @@ static void aw88395_parse_channel_dt(struct aw_device *aw_dev) ...@@ -1594,37 +1586,19 @@ static void aw88395_parse_channel_dt(struct aw_device *aw_dev)
u32 channel_value; u32 channel_value;
int ret; int ret;
ret = of_property_read_u32(np, "sound-channel", &channel_value); ret = of_property_read_u32(np, "awinic,audio-channel", &channel_value);
if (ret) { if (ret) {
dev_dbg(aw_dev->dev, dev_dbg(aw_dev->dev,
"read sound-channel failed,use default 0"); "read audio-channel failed,use default 0");
aw_dev->channel = AW88395_DEV_DEFAULT_CH; aw_dev->channel = AW88395_DEV_DEFAULT_CH;
return; return;
} }
dev_dbg(aw_dev->dev, "read sound-channel value is: %d", dev_dbg(aw_dev->dev, "read audio-channel value is: %d",
channel_value); channel_value);
aw_dev->channel = channel_value; aw_dev->channel = channel_value;
} }
static void aw88395_parse_fade_enable_dt(struct aw_device *aw_dev)
{
struct device_node *np = aw_dev->dev->of_node;
u32 fade_en;
int ret;
ret = of_property_read_u32(np, "fade-enable", &fade_en);
if (ret) {
dev_dbg(aw_dev->dev,
"read fade-enable failed, close fade_in_out");
fade_en = AW88395_FADE_IN_OUT_DEFAULT;
}
dev_dbg(aw_dev->dev, "read fade-enable value is: %d", fade_en);
aw_dev->fade_en = fade_en;
}
static int aw_dev_init(struct aw_device *aw_dev) static int aw_dev_init(struct aw_device *aw_dev)
{ {
aw_dev->chip_id = AW88395_CHIP_ID; aw_dev->chip_id = AW88395_CHIP_ID;
...@@ -1639,7 +1613,6 @@ static int aw_dev_init(struct aw_device *aw_dev) ...@@ -1639,7 +1613,6 @@ static int aw_dev_init(struct aw_device *aw_dev)
aw_dev->fade_step = AW88395_VOLUME_STEP_DB; aw_dev->fade_step = AW88395_VOLUME_STEP_DB;
aw_dev->volume_desc.ctl_volume = AW88395_VOL_DEFAULT_VALUE; aw_dev->volume_desc.ctl_volume = AW88395_VOL_DEFAULT_VALUE;
aw88395_parse_channel_dt(aw_dev); aw88395_parse_channel_dt(aw_dev);
aw88395_parse_fade_enable_dt(aw_dev);
return 0; return 0;
} }
...@@ -1673,7 +1646,7 @@ int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index) ...@@ -1673,7 +1646,7 @@ int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index)
} }
EXPORT_SYMBOL_GPL(aw88395_dev_set_profile_index); EXPORT_SYMBOL_GPL(aw88395_dev_set_profile_index);
char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index) int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name)
{ {
struct aw_prof_info *prof_info = &aw_dev->prof_info; struct aw_prof_info *prof_info = &aw_dev->prof_info;
struct aw_prof_desc *prof_desc; struct aw_prof_desc *prof_desc;
...@@ -1681,12 +1654,14 @@ char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index) ...@@ -1681,12 +1654,14 @@ char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index)
if ((index >= aw_dev->prof_info.count) || (index < 0)) { if ((index >= aw_dev->prof_info.count) || (index < 0)) {
dev_err(aw_dev->dev, "index[%d] overflow count[%d]", dev_err(aw_dev->dev, "index[%d] overflow count[%d]",
index, aw_dev->prof_info.count); index, aw_dev->prof_info.count);
return NULL; return -EINVAL;
} }
prof_desc = &aw_dev->prof_info.prof_desc[index]; prof_desc = &aw_dev->prof_info.prof_desc[index];
return prof_info->prof_name_list[prof_desc->id]; *prof_name = prof_info->prof_name_list[prof_desc->id];
return 0;
} }
EXPORT_SYMBOL_GPL(aw88395_dev_get_prof_name); EXPORT_SYMBOL_GPL(aw88395_dev_get_prof_name);
......
...@@ -141,6 +141,7 @@ struct aw_device { ...@@ -141,6 +141,7 @@ struct aw_device {
unsigned char prof_cur; unsigned char prof_cur;
unsigned char prof_index; unsigned char prof_index;
unsigned char dsp_crc_st; unsigned char dsp_crc_st;
unsigned char dsp_cfg;
u16 chip_id; u16 chip_id;
unsigned int channel; unsigned int channel;
...@@ -151,9 +152,6 @@ struct aw_device { ...@@ -151,9 +152,6 @@ struct aw_device {
struct regmap *regmap; struct regmap *regmap;
char *acf; char *acf;
u32 fade_en;
unsigned char dsp_cfg;
u32 dsp_fw_len; u32 dsp_fw_len;
u32 dsp_cfg_len; u32 dsp_cfg_len;
u8 platform; u8 platform;
...@@ -183,7 +181,7 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool forc ...@@ -183,7 +181,7 @@ int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool forc
void aw88395_dev_set_volume(struct aw_device *aw_dev, unsigned short set_vol); void aw88395_dev_set_volume(struct aw_device *aw_dev, unsigned short set_vol);
int aw88395_dev_get_prof_data(struct aw_device *aw_dev, int index, int aw88395_dev_get_prof_data(struct aw_device *aw_dev, int index,
struct aw_prof_desc **prof_desc); struct aw_prof_desc **prof_desc);
char *aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index); int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name);
int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index); int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index);
int aw88395_dev_get_profile_index(struct aw_device *aw_dev); int aw88395_dev_get_profile_index(struct aw_device *aw_dev);
int aw88395_dev_get_profile_count(struct aw_device *aw_dev); int aw88395_dev_get_profile_count(struct aw_device *aw_dev);
......
...@@ -456,10 +456,12 @@ static int aw_dev_parse_reg_bin_with_hdr(struct aw_device *aw_dev, ...@@ -456,10 +456,12 @@ static int aw_dev_parse_reg_bin_with_hdr(struct aw_device *aw_dev,
goto parse_bin_failed; goto parse_bin_failed;
} }
if (aw_bin->header_info[0].valid_data_len % 4) { if (aw_dev->chip_id == AW88261_CHIP_ID) {
dev_err(aw_dev->dev, "bin data len get error!"); if (aw_bin->header_info[0].valid_data_len % 4) {
ret = -EINVAL; dev_err(aw_dev->dev, "bin data len get error!");
goto parse_bin_failed; ret = -EINVAL;
goto parse_bin_failed;
}
} }
prof_desc->sec_desc[AW88395_DATA_TYPE_REG].data = prof_desc->sec_desc[AW88395_DATA_TYPE_REG].data =
...@@ -581,9 +583,9 @@ static int aw_dev_parse_dev_default_type(struct aw_device *aw_dev, ...@@ -581,9 +583,9 @@ static int aw_dev_parse_dev_default_type(struct aw_device *aw_dev,
} }
static int aw88261_dev_cfg_get_valid_prof(struct aw_device *aw_dev, static int aw88261_dev_cfg_get_valid_prof(struct aw_device *aw_dev,
struct aw_all_prof_info all_prof_info) struct aw_all_prof_info *all_prof_info)
{ {
struct aw_prof_desc *prof_desc = all_prof_info.prof_desc; struct aw_prof_desc *prof_desc = all_prof_info->prof_desc;
struct aw_prof_info *prof_info = &aw_dev->prof_info; struct aw_prof_info *prof_info = &aw_dev->prof_info;
int num = 0; int num = 0;
int i; int i;
...@@ -623,9 +625,9 @@ static int aw88261_dev_cfg_get_valid_prof(struct aw_device *aw_dev, ...@@ -623,9 +625,9 @@ static int aw88261_dev_cfg_get_valid_prof(struct aw_device *aw_dev,
} }
static int aw88395_dev_cfg_get_valid_prof(struct aw_device *aw_dev, static int aw88395_dev_cfg_get_valid_prof(struct aw_device *aw_dev,
struct aw_all_prof_info all_prof_info) struct aw_all_prof_info *all_prof_info)
{ {
struct aw_prof_desc *prof_desc = all_prof_info.prof_desc; struct aw_prof_desc *prof_desc = all_prof_info->prof_desc;
struct aw_prof_info *prof_info = &aw_dev->prof_info; struct aw_prof_info *prof_info = &aw_dev->prof_info;
struct aw_sec_data_desc *sec_desc; struct aw_sec_data_desc *sec_desc;
int num = 0; int num = 0;
...@@ -703,12 +705,13 @@ static int aw_dev_load_cfg_by_hdr(struct aw_device *aw_dev, ...@@ -703,12 +705,13 @@ static int aw_dev_load_cfg_by_hdr(struct aw_device *aw_dev,
switch (aw_dev->chip_id) { switch (aw_dev->chip_id) {
case AW88395_CHIP_ID: case AW88395_CHIP_ID:
ret = aw88395_dev_cfg_get_valid_prof(aw_dev, *all_prof_info); ret = aw88395_dev_cfg_get_valid_prof(aw_dev, all_prof_info);
if (ret < 0) if (ret < 0)
goto exit; goto exit;
break; break;
case AW88261_CHIP_ID: case AW88261_CHIP_ID:
ret = aw88261_dev_cfg_get_valid_prof(aw_dev, *all_prof_info); case AW87390_CHIP_ID:
ret = aw88261_dev_cfg_get_valid_prof(aw_dev, all_prof_info);
if (ret < 0) if (ret < 0)
goto exit; goto exit;
break; break;
...@@ -801,6 +804,7 @@ static int aw_get_dev_scene_count_v1(struct aw_device *aw_dev, struct aw_contain ...@@ -801,6 +804,7 @@ static int aw_get_dev_scene_count_v1(struct aw_device *aw_dev, struct aw_contain
ret = 0; ret = 0;
break; break;
case AW88261_CHIP_ID: case AW88261_CHIP_ID:
case AW87390_CHIP_ID:
for (i = 0; i < cfg_hdr->ddt_num; ++i) { for (i = 0; i < cfg_hdr->ddt_num; ++i) {
if (((cfg_dde[i].data_type == ACF_SEC_TYPE_REG) || if (((cfg_dde[i].data_type == ACF_SEC_TYPE_REG) ||
(cfg_dde[i].data_type == ACF_SEC_TYPE_HDR_REG)) && (cfg_dde[i].data_type == ACF_SEC_TYPE_HDR_REG)) &&
...@@ -841,6 +845,7 @@ static int aw_get_default_scene_count_v1(struct aw_device *aw_dev, ...@@ -841,6 +845,7 @@ static int aw_get_default_scene_count_v1(struct aw_device *aw_dev,
ret = 0; ret = 0;
break; break;
case AW88261_CHIP_ID: case AW88261_CHIP_ID:
case AW87390_CHIP_ID:
for (i = 0; i < cfg_hdr->ddt_num; ++i) { for (i = 0; i < cfg_hdr->ddt_num; ++i) {
if (((cfg_dde[i].data_type == ACF_SEC_TYPE_REG) || if (((cfg_dde[i].data_type == ACF_SEC_TYPE_REG) ||
(cfg_dde[i].data_type == ACF_SEC_TYPE_HDR_REG)) && (cfg_dde[i].data_type == ACF_SEC_TYPE_HDR_REG)) &&
......
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
enum aw88395_id { enum aw88395_id {
AW88395_CHIP_ID = 0x2049, AW88395_CHIP_ID = 0x2049,
AW88261_CHIP_ID = 0x2113, AW88261_CHIP_ID = 0x2113,
AW87390_CHIP_ID = 0x76,
}; };
#define AW88395_REG_MAX (0x7D) #define AW88395_REG_MAX (0x7D)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment