mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
ASoC: rk3308_codec: set hpdet_jack from machine driver
The hpdet_jack should be set from external machine driver. Change-Id: I5f7e154c084434fa730c2a9ff505bfaa4e404a5f Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <sound/tlv.h>
|
||||
|
||||
#include "rk3308_codec.h"
|
||||
#include "rk3308_codec_provider.h"
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
#include <linux/fs.h>
|
||||
@@ -83,6 +84,7 @@ struct rk3308_codec_priv {
|
||||
struct clk *mclk_tx;
|
||||
struct gpio_desc *hp_ctl_gpio;
|
||||
struct gpio_desc *spk_ctl_gpio;
|
||||
struct snd_soc_jack *hpdet_jack;
|
||||
int irq;
|
||||
/*
|
||||
* To select ADCs for groups:
|
||||
@@ -2345,9 +2347,11 @@ static void rk3308_codec_hpdetect_work(struct work_struct *work)
|
||||
dac_output = DAC_HPOUT;
|
||||
|
||||
rk3308_codec_dac_switch(rk3308, dac_output);
|
||||
snd_soc_jack_report(asoc_simple_card_get_hp_jack(),
|
||||
report_type,
|
||||
SND_JACK_HEADPHONE);
|
||||
|
||||
if (rk3308->hpdet_jack)
|
||||
snd_soc_jack_report(rk3308->hpdet_jack,
|
||||
report_type,
|
||||
SND_JACK_HEADPHONE);
|
||||
}
|
||||
|
||||
if (need_irq)
|
||||
@@ -2369,6 +2373,15 @@ static irqreturn_t rk3308_codec_hpdet_isr(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
|
||||
struct snd_soc_jack *hpdet_jack)
|
||||
{
|
||||
struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
rk3308->hpdet_jack = hpdet_jack;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect);
|
||||
|
||||
static const struct regmap_config rk3308_codec_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.reg_stride = 4,
|
||||
|
||||
33
sound/soc/codecs/rk3308_codec_provider.h
Normal file
33
sound/soc/codecs/rk3308_codec_provider.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* rk3308_codec_provider.h -- RK3308 ALSA Soc Audio Driver
|
||||
*
|
||||
* Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __RK3308_CODEC_PROVIDER_H__
|
||||
#define __RK3308_CODEC_PROVIDER_H__
|
||||
|
||||
#ifdef CONFIG_SND_SOC_RK3308
|
||||
void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
|
||||
struct snd_soc_jack *hpdet_jack);
|
||||
#else
|
||||
static inline void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
|
||||
struct snd_soc_jack *hpdet_jack)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RK3308_CODEC_PROVIDER_H__ */
|
||||
Reference in New Issue
Block a user