mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
restore RK3308 audio mistakenly removed by 588c2ec17e
This commit is contained in:
committed by
Ricardo Pardini
parent
3d2575639d
commit
ddfdf75a17
@@ -0,0 +1,77 @@
|
||||
From 498c9f200325f0397fd03163a98e053430b80aa4 Mon Sep 17 00:00:00 2001
|
||||
From: ashthespy <ashthespy@users.noreply.github.com>
|
||||
Date: Fri, 17 Jan 2020 15:58:20 +0100
|
||||
Subject: [PATCH 08/23] thermal: rockchip: add tsadc support for rk3308
|
||||
|
||||
From a231e9c68e5f5e6cf5a82a40828cfd1df4ad1f3e Mon Sep 17 00:00:00 2001
|
||||
From: Rocky Hao <rocky.hao@rock-chips.com>
|
||||
Date: Fri, 9 Mar 2018 17:36:39 +0800
|
||||
Subject: [PATCH] thermal: rockchip: add tsadc support for rk3308
|
||||
|
||||
Change-Id: Ibf1782ca471c8ad4b14d6fd64eeb123181903adc
|
||||
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
|
||||
---
|
||||
.../bindings/thermal/rockchip-thermal.yaml | 1 +
|
||||
drivers/thermal/rockchip_thermal.c | 28 +++++++++++++++++++
|
||||
2 files changed, 29 insertions(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
|
||||
index c6aac9bcacf1..3a0a9556680e 100644
|
||||
--- a/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
|
||||
+++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.yaml
|
||||
@@ -15,6 +15,7 @@
|
||||
- rockchip,px30-tsadc
|
||||
- rockchip,rk3228-tsadc
|
||||
- rockchip,rk3288-tsadc
|
||||
+ - rockchip,rk3308-tsadc
|
||||
- rockchip,rk3328-tsadc
|
||||
- rockchip,rk3368-tsadc
|
||||
- rockchip,rk3399-tsadc
|
||||
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
|
||||
index 343c2f5c5a25..d4d66724535a 100644
|
||||
--- a/drivers/thermal/rockchip_thermal.c
|
||||
+++ b/drivers/thermal/rockchip_thermal.c
|
||||
@@ -821,6 +821,30 @@ static void rk_tsadcv2_tshut_mode(int chn, void __iomem *regs,
|
||||
writel_relaxed(val, regs + TSADCV2_INT_EN);
|
||||
}
|
||||
|
||||
+static const struct rockchip_tsadc_chip rk3308_tsadc_data = {
|
||||
+ .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
|
||||
+ .chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
|
||||
+ .chn_num = 2, /* 2 channels for tsadc */
|
||||
+
|
||||
+ .tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
|
||||
+ .tshut_temp = 95000,
|
||||
+
|
||||
+ .initialize = rk_tsadcv4_initialize,
|
||||
+ .irq_ack = rk_tsadcv3_irq_ack,
|
||||
+ .control = rk_tsadcv3_control,
|
||||
+ .get_temp = rk_tsadcv2_get_temp,
|
||||
+ .set_alarm_temp = rk_tsadcv2_alarm_temp,
|
||||
+ .set_tshut_temp = rk_tsadcv2_tshut_temp,
|
||||
+ .set_tshut_mode = rk_tsadcv2_tshut_mode,
|
||||
+
|
||||
+ .table = {
|
||||
+ .id = rk3328_code_table,
|
||||
+ .length = ARRAY_SIZE(rk3328_code_table),
|
||||
+ .data_mask = TSADCV2_DATA_MASK,
|
||||
+ .mode = ADC_INCREMENT,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
static const struct rockchip_tsadc_chip px30_tsadc_data = {
|
||||
.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
|
||||
.chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
|
||||
@@ -1032,6 +1056,10 @@ static const struct of_device_id of_rockchip_thermal_match[] = {
|
||||
.compatible = "rockchip,rk3288-tsadc",
|
||||
.data = (void *)&rk3288_tsadc_data,
|
||||
},
|
||||
+ {
|
||||
+ .compatible = "rockchip,rk3308-tsadc",
|
||||
+ .data = (void *)&rk3308_tsadc_data,
|
||||
+ },
|
||||
{
|
||||
.compatible = "rockchip,rk3328-tsadc",
|
||||
.data = (void *)&rk3328_tsadc_data,
|
||||
--
|
||||
2.25.1
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,459 @@
|
||||
From b882c2185ab561ec88c2540623cfa49e2cb56956 Mon Sep 17 00:00:00 2001
|
||||
From: ashthespy <ashthespy@gmail.com>
|
||||
Date: Mon, 3 Feb 2020 19:35:42 +0100
|
||||
Subject: [PATCH 22/23] ASoC: rk3308_codec: replace codec to component
|
||||
|
||||
---
|
||||
sound/soc/codecs/rk3308_codec.c | 159 ++++++++++++-----------
|
||||
sound/soc/codecs/rk3308_codec_provider.h | 2 +-
|
||||
2 files changed, 84 insertions(+), 77 deletions(-)
|
||||
|
||||
diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c
|
||||
index 815e22fc346c..16bfb215586e 100644
|
||||
--- a/sound/soc/codecs/rk3308_codec.c
|
||||
+++ b/sound/soc/codecs/rk3308_codec.c
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/reset.h>
|
||||
-#include <linux/rockchip/grf.h>
|
||||
+// #include <linux/rockchip/grf.h>
|
||||
#include <linux/version.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/dmaengine_pcm.h>
|
||||
@@ -156,7 +156,7 @@ struct rk3308_codec_priv {
|
||||
struct gpio_desc *hp_ctl_gpio;
|
||||
struct gpio_desc *spk_ctl_gpio;
|
||||
struct gpio_desc *pa_drv_gpio;
|
||||
- struct snd_soc_codec *codec;
|
||||
+ struct snd_soc_component *component;
|
||||
struct snd_soc_jack *hpdet_jack;
|
||||
struct regulator *vcc_micbias;
|
||||
u32 codec_ver;
|
||||
@@ -883,8 +883,8 @@ static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = {
|
||||
static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
|
||||
if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) {
|
||||
@@ -904,8 +904,8 @@ static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value = ucontrol->value.integer.value[0];
|
||||
int grp = e->reg;
|
||||
@@ -970,8 +970,8 @@ static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
int grp = e->reg;
|
||||
@@ -998,8 +998,8 @@ static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
int grp = e->reg;
|
||||
@@ -1032,8 +1032,8 @@ static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
int grp = e->reg;
|
||||
@@ -1064,8 +1064,8 @@ static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
int grp = e->reg;
|
||||
@@ -1098,8 +1098,8 @@ static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = rk3308->micbias_volt;
|
||||
|
||||
@@ -1109,8 +1109,8 @@ static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int volt = ucontrol->value.integer.value[0];
|
||||
int ret;
|
||||
|
||||
@@ -1133,8 +1133,8 @@ static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = rk3308->enable_micbias;
|
||||
|
||||
@@ -1144,8 +1144,8 @@ static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int on = ucontrol->value.integer.value[0];
|
||||
|
||||
if (on) {
|
||||
@@ -1168,8 +1168,8 @@ static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int gain = ucontrol->value.integer.value[0];
|
||||
|
||||
if (gain > RK3308_ADC_CH1_MIC_GAIN_MAX) {
|
||||
@@ -1197,8 +1197,8 @@ static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
|
||||
@@ -1222,8 +1222,8 @@ static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_hpf_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value = ucontrol->value.integer.value[0];
|
||||
|
||||
@@ -1259,8 +1259,8 @@ static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int dgain = ucontrol->value.integer.value[0];
|
||||
|
||||
if (dgain > RK3308_DAC_L_HPOUT_GAIN_MAX) {
|
||||
@@ -1283,8 +1283,8 @@ static int rk3308_codec_hpout_r_get_tlv(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_hpout_r_put_tlv(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int dgain = ucontrol->value.integer.value[0];
|
||||
|
||||
if (dgain > RK3308_DAC_R_HPOUT_GAIN_MAX) {
|
||||
@@ -1408,9 +1408,9 @@ static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on)
|
||||
}
|
||||
}
|
||||
|
||||
-static int rk3308_codec_reset(struct snd_soc_codec *codec)
|
||||
+static int rk3308_codec_reset(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
reset_control_assert(rk3308->reset);
|
||||
usleep_range(2000, 2500); /* estimated value */
|
||||
@@ -1452,10 +1452,10 @@ static int rk3308_codec_dac_dig_reset(struct rk3308_codec_priv *rk3308)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_set_bias_level(struct snd_soc_codec *codec,
|
||||
+static int rk3308_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
@@ -1473,11 +1473,11 @@ static int rk3308_set_bias_level(struct snd_soc_codec *codec,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
+static int rk3308_set_dai_fmt(struct snd_soc_dai *dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
- struct snd_soc_codec *codec = codec_dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0;
|
||||
int idx, grp, is_master;
|
||||
int type = ADC_TYPE_ALL;
|
||||
@@ -1721,8 +1721,8 @@ static int rk3308_codec_update_adc_grps(struct rk3308_codec_priv *rk3308,
|
||||
|
||||
static int rk3308_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
|
||||
{
|
||||
- struct snd_soc_codec *codec = dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
int dgain;
|
||||
@@ -3630,8 +3630,8 @@ static int rk3308_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
- struct snd_soc_codec *codec = dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct snd_pcm_str *playback_str =
|
||||
&substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK];
|
||||
int type = ADC_TYPE_LOOPBACK;
|
||||
@@ -3705,8 +3705,8 @@ static int rk3308_hw_params(struct snd_pcm_substream *substream,
|
||||
static int rk3308_pcm_trigger(struct snd_pcm_substream *substream,
|
||||
int cmd, struct snd_soc_dai *dai)
|
||||
{
|
||||
- struct snd_soc_codec *codec = dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
int type = ADC_TYPE_LOOPBACK;
|
||||
int idx, grp;
|
||||
|
||||
@@ -3749,8 +3749,8 @@ static int rk3308_pcm_trigger(struct snd_pcm_substream *substream,
|
||||
static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
- struct snd_soc_codec *codec = dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
rk3308_codec_close_playback(rk3308);
|
||||
@@ -3809,9 +3809,9 @@ static struct snd_soc_dai_driver rk3308_dai[] = {
|
||||
},
|
||||
};
|
||||
|
||||
-static int rk3308_suspend(struct snd_soc_codec *codec)
|
||||
+static int rk3308_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (rk3308->no_deep_low_power)
|
||||
goto out;
|
||||
@@ -3822,13 +3822,13 @@ static int rk3308_suspend(struct snd_soc_codec *codec)
|
||||
clk_disable_unprepare(rk3308->pclk);
|
||||
|
||||
out:
|
||||
- rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF);
|
||||
+ rk3308_set_bias_level(component, SND_SOC_BIAS_OFF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_resume(struct snd_soc_codec *codec)
|
||||
+static int rk3308_resume(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0;
|
||||
|
||||
if (rk3308->no_deep_low_power)
|
||||
@@ -3857,7 +3857,7 @@ static int rk3308_resume(struct snd_soc_codec *codec)
|
||||
|
||||
rk3308_codec_dlp_up(rk3308);
|
||||
out:
|
||||
- rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
|
||||
+ rk3308_set_bias_level(component, SND_SOC_BIAS_STANDBY);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3972,7 +3972,7 @@ static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308)
|
||||
int ret;
|
||||
|
||||
if (rk3308->codec_ver == ACODEC_VERSION_B) {
|
||||
- ret = snd_soc_add_codec_controls(rk3308->codec,
|
||||
+ ret = snd_soc_add_component_controls(rk3308->component,
|
||||
mic_gains_b,
|
||||
ARRAY_SIZE(mic_gains_b));
|
||||
if (ret) {
|
||||
@@ -3982,7 +3982,7 @@ static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308)
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
- ret = snd_soc_add_codec_controls(rk3308->codec,
|
||||
+ ret = snd_soc_add_component_controls(rk3308->component,
|
||||
mic_gains_a,
|
||||
ARRAY_SIZE(mic_gains_a));
|
||||
if (ret) {
|
||||
@@ -4081,15 +4081,15 @@ static int rk3308_codec_prepare(struct rk3308_codec_priv *rk3308)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_probe(struct snd_soc_codec *codec)
|
||||
+static int rk3308_probe(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
int ext_micbias;
|
||||
|
||||
- rk3308->codec = codec;
|
||||
+ rk3308->component = component;
|
||||
rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE);
|
||||
|
||||
- rk3308_codec_reset(codec);
|
||||
+ rk3308_codec_reset(component);
|
||||
rk3308_codec_power_on(rk3308);
|
||||
|
||||
/* From vendor recommend, disable micbias at first. */
|
||||
@@ -4108,9 +4108,9 @@ static int rk3308_probe(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_remove(struct snd_soc_codec *codec)
|
||||
+static void rk3308_remove(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
rk3308_headphone_ctl(rk3308, 0);
|
||||
rk3308_speaker_ctl(rk3308, 0);
|
||||
@@ -4124,17 +4124,25 @@ static int rk3308_remove(struct snd_soc_codec *codec)
|
||||
regcache_cache_only(rk3308->regmap, false);
|
||||
regcache_sync(rk3308->regmap);
|
||||
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static struct snd_soc_codec_driver soc_codec_dev_rk3308 = {
|
||||
- .probe = rk3308_probe,
|
||||
- .remove = rk3308_remove,
|
||||
- .suspend = rk3308_suspend,
|
||||
- .resume = rk3308_resume,
|
||||
- .set_bias_level = rk3308_set_bias_level,
|
||||
- .controls = rk3308_codec_dapm_controls,
|
||||
- .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls),
|
||||
+static const struct snd_soc_component_driver soc_codec_dev_rk3308_component = {
|
||||
+ .probe = rk3308_probe,
|
||||
+ .remove = rk3308_remove,
|
||||
+ .resume = rk3308_resume,
|
||||
+ .suspend = rk3308_suspend,
|
||||
+ .set_bias_level = rk3308_set_bias_level,
|
||||
+ .controls = rk3308_codec_dapm_controls,
|
||||
+ .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls),
|
||||
+ // .dapm_widgets = rk3308_dapm_widgets,
|
||||
+ // .num_dapm_widgets = ARRAY_SIZE(rk3308_dapm_widgets),
|
||||
+ // .dapm_routes = rk3308_dapm_routes,
|
||||
+ // .num_dapm_routes = ARRAY_SIZE(rk3308_dapm_routes),
|
||||
+ // .suspend_bias_off = 1,
|
||||
+ // .idle_bias_on = 1,
|
||||
+ // .use_pmdown_time = 1,
|
||||
+ .endianness = 1,
|
||||
+ .legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct reg_default rk3308_codec_reg_defaults[] = {
|
||||
@@ -4299,14 +4307,14 @@ static irqreturn_t rk3308_codec_hpdet_isr(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
-void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec,
|
||||
+void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *hpdet_jack);
|
||||
EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect_cb);
|
||||
|
||||
-static void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
|
||||
+static void rk3308_codec_set_jack_detect(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *hpdet_jack)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
rk3308->hpdet_jack = hpdet_jack;
|
||||
|
||||
@@ -5114,10 +5122,10 @@ static int rk3308_platform_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, rk3308);
|
||||
|
||||
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_rk3308,
|
||||
+ ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk3308_component,
|
||||
rk3308_dai, ARRAY_SIZE(rk3308_dai));
|
||||
if (ret < 0) {
|
||||
- dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
|
||||
+ dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@@ -5140,7 +5148,6 @@ static int rk3308_platform_remove(struct platform_device *pdev)
|
||||
clk_disable_unprepare(rk3308->mclk_rx);
|
||||
clk_disable_unprepare(rk3308->mclk_tx);
|
||||
clk_disable_unprepare(rk3308->pclk);
|
||||
- snd_soc_unregister_codec(&pdev->dev);
|
||||
device_unregister(&rk3308->dev);
|
||||
|
||||
return 0;
|
||||
diff --git a/sound/soc/codecs/rk3308_codec_provider.h b/sound/soc/codecs/rk3308_codec_provider.h
|
||||
index 68042b1328dc..34c1ef86a507 100644
|
||||
--- a/sound/soc/codecs/rk3308_codec_provider.h
|
||||
+++ b/sound/soc/codecs/rk3308_codec_provider.h
|
||||
@@ -21,7 +21,7 @@
|
||||
#define __RK3308_CODEC_PROVIDER_H__
|
||||
|
||||
#ifdef CONFIG_SND_SOC_RK3308
|
||||
-extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec,
|
||||
+extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *hpdet_jack);
|
||||
#endif
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Reference in New Issue
Block a user