Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * SoC audio for HTC Magician
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (c) 2006 Philipp Zabel <philipp.zabel@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * based on spitz.c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Authors: Liam Girdwood <lrg@slimlogic.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *          Richard Purdie <richard@openedhand.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <sound/pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <sound/pcm_params.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <sound/soc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <sound/uda1380.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <mach/magician.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include "../codecs/uda1380.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include "pxa2xx-i2s.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include "pxa-ssp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define MAGICIAN_MIC       0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define MAGICIAN_MIC_EXT   1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) static int magician_hp_switch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) static int magician_spk_switch = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) static int magician_in_sel = MAGICIAN_MIC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) static void magician_ext_control(struct snd_soc_dapm_context *dapm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	snd_soc_dapm_mutex_lock(dapm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	if (magician_spk_switch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		snd_soc_dapm_enable_pin_unlocked(dapm, "Speaker");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		snd_soc_dapm_disable_pin_unlocked(dapm, "Speaker");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	if (magician_hp_switch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		snd_soc_dapm_enable_pin_unlocked(dapm, "Headphone Jack");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		snd_soc_dapm_disable_pin_unlocked(dapm, "Headphone Jack");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	switch (magician_in_sel) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	case MAGICIAN_MIC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		snd_soc_dapm_disable_pin_unlocked(dapm, "Headset Mic");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		snd_soc_dapm_enable_pin_unlocked(dapm, "Call Mic");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	case MAGICIAN_MIC_EXT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		snd_soc_dapm_disable_pin_unlocked(dapm, "Call Mic");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		snd_soc_dapm_enable_pin_unlocked(dapm, "Headset Mic");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	snd_soc_dapm_sync_unlocked(dapm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	snd_soc_dapm_mutex_unlock(dapm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) static int magician_startup(struct snd_pcm_substream *substream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	/* check the jack status at stream startup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	magician_ext_control(&rtd->card->dapm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * Magician uses SSP port for playback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) static int magician_playback_hw_params(struct snd_pcm_substream *substream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 				       struct snd_pcm_hw_params *params)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	unsigned int width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	/* set codec DAI configuration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_MSB |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	/* set cpu DAI configuration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_A |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 			SND_SOC_DAIFMT_NB_IF | SND_SOC_DAIFMT_CBS_CFS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	width = snd_pcm_format_physical_width(params_format(params));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	ret = snd_soc_dai_set_tdm_slot(cpu_dai, 1, 0, 1, width);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	/* set audio clock as clock source */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	ret = snd_soc_dai_set_sysclk(cpu_dai, PXA_SSP_CLK_AUDIO, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			SND_SOC_CLOCK_OUT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  * Magician uses I2S for capture.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static int magician_capture_hw_params(struct snd_pcm_substream *substream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 				      struct snd_pcm_hw_params *params)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	/* set codec DAI configuration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	ret = snd_soc_dai_set_fmt(codec_dai,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 			SND_SOC_DAIFMT_MSB | SND_SOC_DAIFMT_NB_NF |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 			SND_SOC_DAIFMT_CBS_CFS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	/* set cpu DAI configuration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	ret = snd_soc_dai_set_fmt(cpu_dai,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			SND_SOC_DAIFMT_MSB | SND_SOC_DAIFMT_NB_NF |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 			SND_SOC_DAIFMT_CBS_CFS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	/* set the I2S system clock as output */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	ret = snd_soc_dai_set_sysclk(cpu_dai, PXA2XX_I2S_SYSCLK, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 			SND_SOC_CLOCK_OUT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static const struct snd_soc_ops magician_capture_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.startup = magician_startup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.hw_params = magician_capture_hw_params,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static const struct snd_soc_ops magician_playback_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	.startup = magician_startup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	.hw_params = magician_playback_hw_params,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static int magician_get_hp(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 			     struct snd_ctl_elem_value *ucontrol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	ucontrol->value.integer.value[0] = magician_hp_switch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) static int magician_set_hp(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 			     struct snd_ctl_elem_value *ucontrol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	if (magician_hp_switch == ucontrol->value.integer.value[0])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	magician_hp_switch = ucontrol->value.integer.value[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	magician_ext_control(&card->dapm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) static int magician_get_spk(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 			    struct snd_ctl_elem_value *ucontrol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	ucontrol->value.integer.value[0] = magician_spk_switch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static int magician_set_spk(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 			    struct snd_ctl_elem_value *ucontrol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	if (magician_spk_switch == ucontrol->value.integer.value[0])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	magician_spk_switch = ucontrol->value.integer.value[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	magician_ext_control(&card->dapm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) static int magician_get_input(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 			      struct snd_ctl_elem_value *ucontrol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	ucontrol->value.enumerated.item[0] = magician_in_sel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static int magician_set_input(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 			      struct snd_ctl_elem_value *ucontrol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	if (magician_in_sel == ucontrol->value.enumerated.item[0])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	magician_in_sel = ucontrol->value.enumerated.item[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	switch (magician_in_sel) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	case MAGICIAN_MIC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		gpio_set_value(EGPIO_MAGICIAN_IN_SEL1, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	case MAGICIAN_MIC_EXT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		gpio_set_value(EGPIO_MAGICIAN_IN_SEL1, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) static int magician_spk_power(struct snd_soc_dapm_widget *w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 				struct snd_kcontrol *k, int event)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	gpio_set_value(EGPIO_MAGICIAN_SPK_POWER, SND_SOC_DAPM_EVENT_ON(event));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static int magician_hp_power(struct snd_soc_dapm_widget *w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 				struct snd_kcontrol *k, int event)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	gpio_set_value(EGPIO_MAGICIAN_EP_POWER, SND_SOC_DAPM_EVENT_ON(event));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static int magician_mic_bias(struct snd_soc_dapm_widget *w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 				struct snd_kcontrol *k, int event)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	gpio_set_value(EGPIO_MAGICIAN_MIC_POWER, SND_SOC_DAPM_EVENT_ON(event));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) /* magician machine dapm widgets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) static const struct snd_soc_dapm_widget uda1380_dapm_widgets[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	SND_SOC_DAPM_HP("Headphone Jack", magician_hp_power),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	SND_SOC_DAPM_SPK("Speaker", magician_spk_power),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	SND_SOC_DAPM_MIC("Call Mic", magician_mic_bias),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	SND_SOC_DAPM_MIC("Headset Mic", magician_mic_bias),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /* magician machine audio_map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) static const struct snd_soc_dapm_route audio_map[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	/* Headphone connected to VOUTL, VOUTR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	{"Headphone Jack", NULL, "VOUTL"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	{"Headphone Jack", NULL, "VOUTR"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	/* Speaker connected to VOUTL, VOUTR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	{"Speaker", NULL, "VOUTL"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	{"Speaker", NULL, "VOUTR"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	/* Mics are connected to VINM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	{"VINM", NULL, "Headset Mic"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	{"VINM", NULL, "Call Mic"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) static const char * const input_select[] = {"Call Mic", "Headset Mic"};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) static const struct soc_enum magician_in_sel_enum =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	SOC_ENUM_SINGLE_EXT(2, input_select);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) static const struct snd_kcontrol_new uda1380_magician_controls[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	SOC_SINGLE_BOOL_EXT("Headphone Switch",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 			(unsigned long)&magician_hp_switch,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 			magician_get_hp, magician_set_hp),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	SOC_SINGLE_BOOL_EXT("Speaker Switch",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 			(unsigned long)&magician_spk_switch,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 			magician_get_spk, magician_set_spk),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	SOC_ENUM_EXT("Input Select", magician_in_sel_enum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 			magician_get_input, magician_set_input),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) /* magician digital audio interface glue - connects codec <--> CPU */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) SND_SOC_DAILINK_DEFS(playback,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	DAILINK_COMP_ARRAY(COMP_CPU("pxa-ssp-dai.0")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	DAILINK_COMP_ARRAY(COMP_CODEC("uda1380-codec.0-0018",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 				      "uda1380-hifi-playback")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) SND_SOC_DAILINK_DEFS(capture,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-i2s")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	DAILINK_COMP_ARRAY(COMP_CODEC("uda1380-codec.0-0018",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 				      "uda1380-hifi-capture")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) static struct snd_soc_dai_link magician_dai[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	.name = "uda1380",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	.stream_name = "UDA1380 Playback",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	.ops = &magician_playback_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	SND_SOC_DAILINK_REG(playback),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	.name = "uda1380",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	.stream_name = "UDA1380 Capture",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	.ops = &magician_capture_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	SND_SOC_DAILINK_REG(capture),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) /* magician audio machine driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) static struct snd_soc_card snd_soc_card_magician = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	.name = "Magician",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	.owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	.dai_link = magician_dai,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	.num_links = ARRAY_SIZE(magician_dai),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	.controls = uda1380_magician_controls,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	.num_controls = ARRAY_SIZE(uda1380_magician_controls),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	.dapm_widgets = uda1380_dapm_widgets,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	.num_dapm_widgets = ARRAY_SIZE(uda1380_dapm_widgets),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	.dapm_routes = audio_map,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	.num_dapm_routes = ARRAY_SIZE(audio_map),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	.fully_routed = true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) static struct platform_device *magician_snd_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)  * FIXME: move into magician board file once merged into the pxa tree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) static struct uda1380_platform_data uda1380_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	.gpio_power = EGPIO_MAGICIAN_CODEC_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	.gpio_reset = EGPIO_MAGICIAN_CODEC_RESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	.dac_clk    = UDA1380_DAC_CLK_WSPLL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) static struct i2c_board_info i2c_board_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 		I2C_BOARD_INFO("uda1380", 0x18),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		.platform_data = &uda1380_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) static int __init magician_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	struct i2c_adapter *adapter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	struct i2c_client *client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	if (!machine_is_magician())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	adapter = i2c_get_adapter(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	if (!adapter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	client = i2c_new_client_device(adapter, i2c_board_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	i2c_put_adapter(adapter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 	if (IS_ERR(client))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 		return PTR_ERR(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	ret = gpio_request(EGPIO_MAGICIAN_SPK_POWER, "SPK_POWER");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 		goto err_request_spk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	ret = gpio_request(EGPIO_MAGICIAN_EP_POWER, "EP_POWER");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		goto err_request_ep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	ret = gpio_request(EGPIO_MAGICIAN_MIC_POWER, "MIC_POWER");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 		goto err_request_mic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	ret = gpio_request(EGPIO_MAGICIAN_IN_SEL0, "IN_SEL0");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 		goto err_request_in_sel0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	ret = gpio_request(EGPIO_MAGICIAN_IN_SEL1, "IN_SEL1");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 		goto err_request_in_sel1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	gpio_set_value(EGPIO_MAGICIAN_IN_SEL0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	magician_snd_device = platform_device_alloc("soc-audio", -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	if (!magician_snd_device) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 		ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 		goto err_pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	platform_set_drvdata(magician_snd_device, &snd_soc_card_magician);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	ret = platform_device_add(magician_snd_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 		platform_device_put(magician_snd_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 		goto err_pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) err_pdev:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	gpio_free(EGPIO_MAGICIAN_IN_SEL1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) err_request_in_sel1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	gpio_free(EGPIO_MAGICIAN_IN_SEL0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) err_request_in_sel0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	gpio_free(EGPIO_MAGICIAN_MIC_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) err_request_mic:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	gpio_free(EGPIO_MAGICIAN_EP_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) err_request_ep:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	gpio_free(EGPIO_MAGICIAN_SPK_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) err_request_spk:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) static void __exit magician_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	platform_device_unregister(magician_snd_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	gpio_set_value(EGPIO_MAGICIAN_SPK_POWER, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	gpio_set_value(EGPIO_MAGICIAN_EP_POWER, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	gpio_set_value(EGPIO_MAGICIAN_MIC_POWER, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	gpio_free(EGPIO_MAGICIAN_IN_SEL1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	gpio_free(EGPIO_MAGICIAN_IN_SEL0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	gpio_free(EGPIO_MAGICIAN_MIC_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	gpio_free(EGPIO_MAGICIAN_EP_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	gpio_free(EGPIO_MAGICIAN_SPK_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) module_init(magician_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) module_exit(magician_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) MODULE_AUTHOR("Philipp Zabel");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) MODULE_DESCRIPTION("ALSA SoC Magician");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) MODULE_LICENSE("GPL");