xref: /linux/sound/soc/codecs/wm8731.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
240e0aa64SRichard Purdie /*
340e0aa64SRichard Purdie  * wm8731.h  --  WM8731 Soc Audio driver
440e0aa64SRichard Purdie  *
540e0aa64SRichard Purdie  * Copyright 2005 Openedhand Ltd.
640e0aa64SRichard Purdie  *
740e0aa64SRichard Purdie  * Author: Richard Purdie <richard@openedhand.com>
840e0aa64SRichard Purdie  *
940e0aa64SRichard Purdie  * Based on wm8753.h
1040e0aa64SRichard Purdie  */
1140e0aa64SRichard Purdie 
1240e0aa64SRichard Purdie #ifndef _WM8731_H
1340e0aa64SRichard Purdie #define _WM8731_H
1440e0aa64SRichard Purdie 
15*9dc15f81SMark Brown #include <linux/mutex.h>
16*9dc15f81SMark Brown #include <linux/regmap.h>
17*9dc15f81SMark Brown #include <linux/regulator/consumer.h>
18*9dc15f81SMark Brown 
19*9dc15f81SMark Brown struct clk;
20*9dc15f81SMark Brown struct snd_pcm_hw_constraint_list;
21*9dc15f81SMark Brown 
2240e0aa64SRichard Purdie /* WM8731 register space */
2340e0aa64SRichard Purdie 
2440e0aa64SRichard Purdie #define WM8731_LINVOL   0x00
2540e0aa64SRichard Purdie #define WM8731_RINVOL   0x01
2640e0aa64SRichard Purdie #define WM8731_LOUT1V   0x02
2740e0aa64SRichard Purdie #define WM8731_ROUT1V   0x03
2840e0aa64SRichard Purdie #define WM8731_APANA    0x04
2940e0aa64SRichard Purdie #define WM8731_APDIGI   0x05
3040e0aa64SRichard Purdie #define WM8731_PWR      0x06
3140e0aa64SRichard Purdie #define WM8731_IFACE    0x07
3240e0aa64SRichard Purdie #define WM8731_SRATE    0x08
3340e0aa64SRichard Purdie #define WM8731_ACTIVE   0x09
3440e0aa64SRichard Purdie #define WM8731_RESET	0x0f
3540e0aa64SRichard Purdie 
3640e0aa64SRichard Purdie #define WM8731_CACHEREGNUM 	10
3740e0aa64SRichard Purdie 
38dfa5def5SJörg Krause #define WM8731_SYSCLK_MCLK 0
399745e824SMark Brown #define WM8731_SYSCLK_XTAL 1
409745e824SMark Brown 
41b36d61d4SFrank Mandarino #define WM8731_DAI		0
42b36d61d4SFrank Mandarino 
43*9dc15f81SMark Brown #define WM8731_NUM_SUPPLIES 4
44*9dc15f81SMark Brown 
45*9dc15f81SMark Brown /* codec private data */
46*9dc15f81SMark Brown struct wm8731_priv {
47*9dc15f81SMark Brown 	struct regmap *regmap;
48*9dc15f81SMark Brown 	struct clk *mclk;
49*9dc15f81SMark Brown 	struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
50*9dc15f81SMark Brown 	const struct snd_pcm_hw_constraint_list *constraints;
51*9dc15f81SMark Brown 	unsigned int sysclk;
52*9dc15f81SMark Brown 	int sysclk_type;
53*9dc15f81SMark Brown 	int playback_fs;
54*9dc15f81SMark Brown 	bool deemph;
55*9dc15f81SMark Brown 
56*9dc15f81SMark Brown 	struct mutex lock;
57*9dc15f81SMark Brown };
58*9dc15f81SMark Brown 
59*9dc15f81SMark Brown extern const struct regmap_config wm8731_regmap;
60*9dc15f81SMark Brown 
61*9dc15f81SMark Brown int wm8731_init(struct device *dev, struct wm8731_priv *wm8731);
62*9dc15f81SMark Brown 
6340e0aa64SRichard Purdie #endif
64