ASoC: rt5677: clear interrupts by polarity flip

The rt5677 jack detection function has a requirement that the polarity
of an interrupt be flipped after it fires in order to clear the
interrupt.

This patch implements an irq_chip with irq_domain directly instead of
using regmap-irq, so that interrupt source line polarities can be
flipped in the irq handler.

The reason that this patch does not add this feature within regmap-irq
is that future patches will add hotword detection support to this irq
handler. Those patches will require adding additional logic that would
not make sense to have in regmap-irq.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Fletcher Woodruff <fletcherw@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Ben Zhang
2019-06-18 17:45:54 -06:00
committed by Mark Brown
parent 16395ceee1
commit 4f7b018b55
2 changed files with 145 additions and 36 deletions

View File

@@ -1749,6 +1749,7 @@ enum {
RT5677_IRQ_JD1,
RT5677_IRQ_JD2,
RT5677_IRQ_JD3,
RT5677_IRQ_NUM,
};
enum rt5677_type {
@@ -1827,6 +1828,7 @@ struct rt5677_platform_data {
struct rt5677_priv {
struct snd_soc_component *component;
struct device *dev;
struct rt5677_platform_data pdata;
struct regmap *regmap, *regmap_physical;
const struct firmware *fw1, *fw2;
@@ -1847,9 +1849,13 @@ struct rt5677_priv {
struct gpio_chip gpio_chip;
#endif
bool dsp_vad_en;
struct regmap_irq_chip_data *irq_data;
bool is_dsp_mode;
bool is_vref_slow;
/* Interrupt handling */
struct irq_domain *domain;
struct mutex irq_lock;
unsigned int irq_en;
};
int rt5677_sel_asrc_clk_src(struct snd_soc_component *component,