mirror of
https://github.com/armbian/build.git
synced 2025-08-11 05:36:57 +02:00
- materialized overwrites: - `add-board-helios64.patch` - `add-board-orangepi-r1-plus.patch` - `add-driver-for-Motorcomm-YT85xx+PHYs.patch` - `add-board-rk3328-roc-pc.patch` - not touched: wifi patches, those still require work before rebase is consistent. - `wifi-4003-uwe5622-adjust-for-rockchip.patch` - this patch is done on top of the wifi drivers patches exclusively, and fails to apply out of tree. - we should probably consider moving this into the wifi drivers patch harness, not in the rockchip tree.
460 lines
20 KiB
Diff
460 lines
20 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: ashthespy <ashthespy@gmail.com>
|
|
Date: Mon, 3 Feb 2020 19:35:42 +0100
|
|
Subject: 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..b6862fc5a3da 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
|
|
|
|
--
|
|
Armbian
|
|
|