mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	ASoC: rt5682: add rt5682 codec driver
This is the initial codec driver for rt5682. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
		
							parent
							
								
									53af408cd9
								
							
						
					
					
						commit
						0ddce71c21
					
				
					 6 changed files with 4104 additions and 0 deletions
				
			
		
							
								
								
									
										50
									
								
								Documentation/devicetree/bindings/sound/rt5682.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Documentation/devicetree/bindings/sound/rt5682.txt
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
RT5682 audio CODEC
 | 
			
		||||
 | 
			
		||||
This device supports I2C only.
 | 
			
		||||
 | 
			
		||||
Required properties:
 | 
			
		||||
 | 
			
		||||
- compatible : "realtek,rt5682" or "realtek,rt5682i"
 | 
			
		||||
 | 
			
		||||
- reg : The I2C address of the device.
 | 
			
		||||
 | 
			
		||||
Optional properties:
 | 
			
		||||
 | 
			
		||||
- interrupts : The CODEC's interrupt output.
 | 
			
		||||
 | 
			
		||||
- realtek,dmic1-data-pin
 | 
			
		||||
  0: dmic1 is not used
 | 
			
		||||
  1: using GPIO2 pin as dmic1 data pin
 | 
			
		||||
  2: using GPIO5 pin as dmic1 data pin
 | 
			
		||||
 | 
			
		||||
- realtek,dmic1-clk-pin
 | 
			
		||||
  0: using GPIO1 pin as dmic1 clock pin
 | 
			
		||||
  1: using GPIO3 pin as dmic1 clock pin
 | 
			
		||||
 | 
			
		||||
- realtek,jd-src
 | 
			
		||||
  0: No JD is used
 | 
			
		||||
  1: using JD1 as JD source
 | 
			
		||||
 | 
			
		||||
- realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
 | 
			
		||||
 | 
			
		||||
Pins on the device (for linking into audio routes) for RT5682:
 | 
			
		||||
 | 
			
		||||
  * DMIC L1
 | 
			
		||||
  * DMIC R1
 | 
			
		||||
  * IN1P
 | 
			
		||||
  * HPOL
 | 
			
		||||
  * HPOR
 | 
			
		||||
 | 
			
		||||
Example:
 | 
			
		||||
 | 
			
		||||
rt5682 {
 | 
			
		||||
	compatible = "realtek,rt5682i";
 | 
			
		||||
	reg = <0x1a>;
 | 
			
		||||
	interrupt-parent = <&gpio>;
 | 
			
		||||
	interrupts = <TEGRA_GPIO(U, 6) GPIO_ACTIVE_HIGH>;
 | 
			
		||||
	realtek,ldo1-en-gpios =
 | 
			
		||||
		<&gpio TEGRA_GPIO(R, 2) GPIO_ACTIVE_HIGH>;
 | 
			
		||||
	realtek,dmic1-data-pin = <1>;
 | 
			
		||||
	realtek,dmic1-clk-pin = <1>;
 | 
			
		||||
	realtek,jd-src = <1>;
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										40
									
								
								include/sound/rt5682.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								include/sound/rt5682.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
/*
 | 
			
		||||
 * linux/sound/rt5682.h -- Platform data for RT5682
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2018 Realtek Microelectronics
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License version 2 as
 | 
			
		||||
 * published by the Free Software Foundation.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __LINUX_SND_RT5682_H
 | 
			
		||||
#define __LINUX_SND_RT5682_H
 | 
			
		||||
 | 
			
		||||
enum rt5682_dmic1_data_pin {
 | 
			
		||||
	RT5682_DMIC1_NULL,
 | 
			
		||||
	RT5682_DMIC1_DATA_GPIO2,
 | 
			
		||||
	RT5682_DMIC1_DATA_GPIO5,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum rt5682_dmic1_clk_pin {
 | 
			
		||||
	RT5682_DMIC1_CLK_GPIO1,
 | 
			
		||||
	RT5682_DMIC1_CLK_GPIO3,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum rt5682_jd_src {
 | 
			
		||||
	RT5682_JD_NULL,
 | 
			
		||||
	RT5682_JD1,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct rt5682_platform_data {
 | 
			
		||||
 | 
			
		||||
	int ldo1_en; /* GPIO for LDO1_EN */
 | 
			
		||||
 | 
			
		||||
	enum rt5682_dmic1_data_pin dmic1_data_pin;
 | 
			
		||||
	enum rt5682_dmic1_clk_pin dmic1_clk_pin;
 | 
			
		||||
	enum rt5682_jd_src jd_src;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -141,6 +141,7 @@ config SND_SOC_ALL_CODECS
 | 
			
		|||
	select SND_SOC_RT5668 if I2C
 | 
			
		||||
	select SND_SOC_RT5670 if I2C
 | 
			
		||||
	select SND_SOC_RT5677 if I2C && SPI_MASTER
 | 
			
		||||
	select SND_SOC_RT5682 if I2C
 | 
			
		||||
	select SND_SOC_SGTL5000 if I2C
 | 
			
		||||
	select SND_SOC_SI476X if MFD_SI476X_CORE
 | 
			
		||||
	select SND_SOC_SIRF_AUDIO_CODEC
 | 
			
		||||
| 
						 | 
				
			
			@ -778,6 +779,7 @@ config SND_SOC_RL6231
 | 
			
		|||
	default y if SND_SOC_RT5668=y
 | 
			
		||||
	default y if SND_SOC_RT5670=y
 | 
			
		||||
	default y if SND_SOC_RT5677=y
 | 
			
		||||
	default y if SND_SOC_RT5682=y
 | 
			
		||||
	default y if SND_SOC_RT1305=y
 | 
			
		||||
	default m if SND_SOC_RT5514=m
 | 
			
		||||
	default m if SND_SOC_RT5616=m
 | 
			
		||||
| 
						 | 
				
			
			@ -791,6 +793,7 @@ config SND_SOC_RL6231
 | 
			
		|||
	default m if SND_SOC_RT5668=m
 | 
			
		||||
	default m if SND_SOC_RT5670=m
 | 
			
		||||
	default m if SND_SOC_RT5677=m
 | 
			
		||||
	default m if SND_SOC_RT5682=m
 | 
			
		||||
	default m if SND_SOC_RT1305=m
 | 
			
		||||
 | 
			
		||||
config SND_SOC_RL6347A
 | 
			
		||||
| 
						 | 
				
			
			@ -871,6 +874,9 @@ config SND_SOC_RT5677_SPI
 | 
			
		|||
	tristate
 | 
			
		||||
	default SND_SOC_RT5677 && SPI
 | 
			
		||||
 | 
			
		||||
config SND_SOC_RT5682
 | 
			
		||||
	tristate
 | 
			
		||||
 | 
			
		||||
#Freescale sgtl5000 codec
 | 
			
		||||
config SND_SOC_SGTL5000
 | 
			
		||||
	tristate "Freescale SGTL5000 CODEC"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -146,6 +146,7 @@ snd-soc-rt5668-objs := rt5668.o
 | 
			
		|||
snd-soc-rt5670-objs := rt5670.o
 | 
			
		||||
snd-soc-rt5677-objs := rt5677.o
 | 
			
		||||
snd-soc-rt5677-spi-objs := rt5677-spi.o
 | 
			
		||||
snd-soc-rt5682-objs := rt5682.o
 | 
			
		||||
snd-soc-sgtl5000-objs := sgtl5000.o
 | 
			
		||||
snd-soc-alc5623-objs := alc5623.o
 | 
			
		||||
snd-soc-alc5632-objs := alc5632.o
 | 
			
		||||
| 
						 | 
				
			
			@ -405,6 +406,7 @@ obj-$(CONFIG_SND_SOC_RT5668)	+= snd-soc-rt5668.o
 | 
			
		|||
obj-$(CONFIG_SND_SOC_RT5670)	+= snd-soc-rt5670.o
 | 
			
		||||
obj-$(CONFIG_SND_SOC_RT5677)	+= snd-soc-rt5677.o
 | 
			
		||||
obj-$(CONFIG_SND_SOC_RT5677_SPI)	+= snd-soc-rt5677-spi.o
 | 
			
		||||
obj-$(CONFIG_SND_SOC_RT5682)	+= snd-soc-rt5682.o
 | 
			
		||||
obj-$(CONFIG_SND_SOC_SGTL5000)  += snd-soc-sgtl5000.o
 | 
			
		||||
obj-$(CONFIG_SND_SOC_SIGMADSP)	+= snd-soc-sigmadsp.o
 | 
			
		||||
obj-$(CONFIG_SND_SOC_SIGMADSP_I2C)	+= snd-soc-sigmadsp-i2c.o
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2682
									
								
								sound/soc/codecs/rt5682.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2682
									
								
								sound/soc/codecs/rt5682.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1324
									
								
								sound/soc/codecs/rt5682.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1324
									
								
								sound/soc/codecs/rt5682.h
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
		Reference in a new issue