summaryrefstree
path: root/kernel/include/linux/mfd/madera/pdata.h
blob: 4139e9b444a16a3be1f6cbebfd22b285fa200117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Platform data for Cirrus Logic Madera codecs
 *
 * Copyright 2015-2017 Cirrus Logic
 *
 * 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 MADERA_PDATA_H
#define MADERA_PDATA_H

#include <linux/kernel.h>
#include <linux/irqchip/irq-madera-pdata.h>
#include <linux/regulator/arizona-ldo1.h>
#include <linux/regulator/arizona-micsupp.h>
#include <linux/regulator/machine.h>
#include <sound/madera-pdata.h>
#include <linux/extcon/extcon-madera-pdata.h>

#define MADERA_MAX_MICBIAS		4
#define MADERA_MAX_CHILD_MICBIAS	4

#define MADERA_MAX_GPSW			2

struct pinctrl_map;
struct regulator_init_data;

/**
 * struct madera_micbias_pin_pdata - MICBIAS pin configuration
 *
 * @init_data: initialization data for the regulator
 */
struct madera_micbias_pin_pdata {
	struct regulator_init_data *init_data;
	u32 active_discharge;
};

/**
 * struct madera_micbias_pdata - Regulator configuration for an on-chip MICBIAS
 *
 * @init_data: initialization data for the regulator
 * @ext_cap:   set to true if an external capacitor is fitted
 * @pin:       Configuration for each output pin from this MICBIAS
 */
struct madera_micbias_pdata {
	struct regulator_init_data *init_data;
	u32 active_discharge;
	bool ext_cap;

	struct madera_micbias_pin_pdata pin[MADERA_MAX_CHILD_MICBIAS];
};

/**
 * struct madera_pdata - Configuration data for Madera devices
 *
 * @reset:	    GPIO controlling /RESET (0 = none)
 * @ldo1:	    Substruct of pdata for the LDO1 regulator
 * @micvdd:	    Substruct of pdata for the MICVDD regulator
 * @irqchip:	    Substruct of pdata for the irqchip driver
 * @gpio_base:	    Base GPIO number
 * @gpio_configs:   Array of GPIO configurations (See Documentation/pinctrl.txt)
 * @n_gpio_configs: Number of entries in gpio_configs
 * @codec:	    Substructure of pdata for the ASoC codec driver
 *		    See include/sound/madera-pdata.h
 * @gpsw:	    General purpose switch mode setting (See the SW1_MODE field
 *		    in the datasheet for the available values for your codec)
 */
struct madera_pdata {
	int reset;

	struct arizona_ldo1_pdata ldo1;
	struct arizona_micsupp_pdata micvdd;

	struct madera_irqchip_pdata irqchip;

	int gpio_base;

	const struct pinctrl_map *gpio_configs;
	int n_gpio_configs;

	/** MICBIAS configurations */
	struct madera_micbias_pdata micbias[MADERA_MAX_MICBIAS];

	struct madera_codec_pdata codec;

	u32 gpsw[MADERA_MAX_GPSW];

	/** Accessory detection configurations */
	struct madera_accdet_pdata accdet[MADERA_MAX_ACCESSORY];
};

#endif