blob: a580363a7d29723e6656cbed8d9d94b4b1801bea [file] [log] [blame]
Mark Brown3cc72982012-06-19 16:31:53 +01001/*
2 * Arizona MFD internals
3 *
4 * Copyright 2012 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _WM_ARIZONA_CORE_H
14#define _WM_ARIZONA_CORE_H
15
16#include <linux/interrupt.h>
17#include <linux/regmap.h>
18#include <linux/regulator/consumer.h>
19#include <linux/mfd/arizona/pdata.h>
20
21#define ARIZONA_MAX_CORE_SUPPLIES 3
22
23enum arizona_type {
24 WM5102 = 1,
Mark Browne102bef2012-07-10 12:37:58 +010025 WM5110 = 2,
Mark Brown3cc72982012-06-19 16:31:53 +010026};
27
28#define ARIZONA_IRQ_GP1 0
29#define ARIZONA_IRQ_GP2 1
30#define ARIZONA_IRQ_GP3 2
31#define ARIZONA_IRQ_GP4 3
32#define ARIZONA_IRQ_GP5_FALL 4
33#define ARIZONA_IRQ_GP5_RISE 5
34#define ARIZONA_IRQ_JD_FALL 6
35#define ARIZONA_IRQ_JD_RISE 7
36#define ARIZONA_IRQ_DSP1_RAM_RDY 8
Mark Browne102bef2012-07-10 12:37:58 +010037#define ARIZONA_IRQ_DSP2_RAM_RDY 9
38#define ARIZONA_IRQ_DSP3_RAM_RDY 10
39#define ARIZONA_IRQ_DSP4_RAM_RDY 11
40#define ARIZONA_IRQ_DSP_IRQ1 12
41#define ARIZONA_IRQ_DSP_IRQ2 13
42#define ARIZONA_IRQ_DSP_IRQ3 14
43#define ARIZONA_IRQ_DSP_IRQ4 15
44#define ARIZONA_IRQ_DSP_IRQ5 16
45#define ARIZONA_IRQ_DSP_IRQ6 17
46#define ARIZONA_IRQ_DSP_IRQ7 18
47#define ARIZONA_IRQ_DSP_IRQ8 19
48#define ARIZONA_IRQ_SPK_SHUTDOWN_WARN 20
49#define ARIZONA_IRQ_SPK_SHUTDOWN 21
50#define ARIZONA_IRQ_MICDET 22
51#define ARIZONA_IRQ_HPDET 23
52#define ARIZONA_IRQ_WSEQ_DONE 24
53#define ARIZONA_IRQ_DRC2_SIG_DET 25
54#define ARIZONA_IRQ_DRC1_SIG_DET 26
55#define ARIZONA_IRQ_ASRC2_LOCK 27
56#define ARIZONA_IRQ_ASRC1_LOCK 28
57#define ARIZONA_IRQ_UNDERCLOCKED 29
58#define ARIZONA_IRQ_OVERCLOCKED 30
59#define ARIZONA_IRQ_FLL2_LOCK 31
60#define ARIZONA_IRQ_FLL1_LOCK 32
61#define ARIZONA_IRQ_CLKGEN_ERR 33
62#define ARIZONA_IRQ_CLKGEN_ERR_ASYNC 34
63#define ARIZONA_IRQ_ASRC_CFG_ERR 35
64#define ARIZONA_IRQ_AIF3_ERR 36
65#define ARIZONA_IRQ_AIF2_ERR 37
66#define ARIZONA_IRQ_AIF1_ERR 38
67#define ARIZONA_IRQ_CTRLIF_ERR 39
68#define ARIZONA_IRQ_MIXER_DROPPED_SAMPLES 40
69#define ARIZONA_IRQ_ASYNC_CLK_ENA_LOW 41
70#define ARIZONA_IRQ_SYSCLK_ENA_LOW 42
71#define ARIZONA_IRQ_ISRC1_CFG_ERR 43
72#define ARIZONA_IRQ_ISRC2_CFG_ERR 44
73#define ARIZONA_IRQ_BOOT_DONE 45
74#define ARIZONA_IRQ_DCS_DAC_DONE 46
75#define ARIZONA_IRQ_DCS_HP_DONE 47
76#define ARIZONA_IRQ_FLL2_CLOCK_OK 48
77#define ARIZONA_IRQ_FLL1_CLOCK_OK 49
Mark Brown3cc72982012-06-19 16:31:53 +010078
Mark Browne102bef2012-07-10 12:37:58 +010079#define ARIZONA_NUM_IRQ 50
Mark Brown3cc72982012-06-19 16:31:53 +010080
Mark Brownb951b522012-11-26 21:11:10 +000081struct snd_soc_dapm_context;
82
Mark Brown3cc72982012-06-19 16:31:53 +010083struct arizona {
84 struct regmap *regmap;
85 struct device *dev;
86
87 enum arizona_type type;
88 unsigned int rev;
89
90 int num_core_supplies;
91 struct regulator_bulk_data core_supplies[ARIZONA_MAX_CORE_SUPPLIES];
Mark Brown59db9692012-07-09 00:31:36 +020092 struct regulator *dcvdd;
Mark Brown3cc72982012-06-19 16:31:53 +010093
94 struct arizona_pdata pdata;
95
96 int irq;
97 struct irq_domain *virq;
98 struct regmap_irq_chip_data *aod_irq_chip;
99 struct regmap_irq_chip_data *irq_chip;
100
101 struct mutex clk_lock;
102 int clk32k_ref;
Mark Brownb951b522012-11-26 21:11:10 +0000103
104 struct snd_soc_dapm_context *dapm;
Mark Brown3cc72982012-06-19 16:31:53 +0100105};
106
107int arizona_clk32k_enable(struct arizona *arizona);
108int arizona_clk32k_disable(struct arizona *arizona);
109
110int arizona_request_irq(struct arizona *arizona, int irq, char *name,
111 irq_handler_t handler, void *data);
112void arizona_free_irq(struct arizona *arizona, int irq, void *data);
113int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
114
115int wm5102_patch(struct arizona *arizona);
Mark Browne102bef2012-07-10 12:37:58 +0100116int wm5110_patch(struct arizona *arizona);
Mark Brown3cc72982012-06-19 16:31:53 +0100117
118#endif