mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-04 18:27:36 +00:00
ASoC: hifiberry_digi: change codec to component
Signed-off-by: popcornmix <popcornmix@gmail.com>
This commit is contained in:
@@ -61,10 +61,10 @@ static uint32_t snd_rpi_hifiberry_digi_enable_clock(int sample_rate)
|
||||
|
||||
static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct snd_soc_component *component = rtd->codec_dai->component;
|
||||
|
||||
/* enable TX output */
|
||||
snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0);
|
||||
snd_soc_component_update_bits(component, WM8804_PWRDN, 0x4, 0x0);
|
||||
|
||||
/* Initialize Digi+ Pro hardware */
|
||||
if (snd_rpi_hifiberry_is_digipro) {
|
||||
@@ -80,8 +80,8 @@ static int snd_rpi_hifiberry_digi_init(struct snd_soc_pcm_runtime *rtd)
|
||||
static int snd_rpi_hifiberry_digi_startup(struct snd_pcm_substream *substream) {
|
||||
/* turn on digital output */
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00);
|
||||
struct snd_soc_component *component = rtd->codec_dai->component;
|
||||
snd_soc_component_update_bits(component, WM8804_PWRDN, 0x3c, 0x00);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ static void snd_rpi_hifiberry_digi_shutdown(struct snd_pcm_substream *substream)
|
||||
if (auto_shutdown_output) {
|
||||
/* turn off output */
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c);
|
||||
struct snd_soc_component *component = rtd->codec_dai->component;
|
||||
snd_soc_component_update_bits(component, WM8804_PWRDN, 0x3c, 0x3c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream,
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
|
||||
int sysclk = 27000000; /* This is fixed on this board */
|
||||
@@ -148,7 +148,7 @@ static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream,
|
||||
sampling_freq=0x0e;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev,
|
||||
dev_err(rtd->card->dev,
|
||||
"Failed to set WM8804 SYSCLK, unsupported samplerate %d\n",
|
||||
samplerate);
|
||||
}
|
||||
@@ -160,19 +160,19 @@ static int snd_rpi_hifiberry_digi_hw_params(struct snd_pcm_substream *substream,
|
||||
sysclk, SND_SOC_CLOCK_OUT);
|
||||
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(rtd->card->dev,
|
||||
"Failed to set WM8804 SYSCLK: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Enable TX output */
|
||||
snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0);
|
||||
snd_soc_component_update_bits(component, WM8804_PWRDN, 0x4, 0x0);
|
||||
|
||||
/* Power on */
|
||||
snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0);
|
||||
snd_soc_component_update_bits(component, WM8804_PWRDN, 0x9, 0);
|
||||
|
||||
/* set sampling frequency status bits */
|
||||
snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq);
|
||||
snd_soc_component_update_bits(component, WM8804_SPDTX4, 0x0f, sampling_freq);
|
||||
|
||||
return snd_soc_dai_set_bclk_ratio(cpu_dai,64);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user