Add: compatible to linux-4.18 or higher
This commit is contained in:
parent
6c6b9ab7de
commit
b98fce84e0
7 changed files with 91 additions and 13 deletions
35
Makefile
35
Makefile
|
@ -1,3 +1,17 @@
|
|||
#
|
||||
# Peter Yang <turmary@126.com>
|
||||
# Copyright (c) 2019 Seeed Studio
|
||||
#
|
||||
# MIT License
|
||||
#
|
||||
|
||||
uname_r=$(shell uname -r)
|
||||
|
||||
# If KERNELRELEASE is defined, we've been invoked from the
|
||||
# kernel build system and can use its language
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
# $(warning KERNELVERSION=$(KERNELVERSION))
|
||||
|
||||
snd-soc-wm8960-objs := wm8960.o
|
||||
snd-soc-ac108-objs := ac108.o ac101.o
|
||||
snd-soc-seeed-voicecard-objs := seeed-voicecard.o
|
||||
|
@ -14,14 +28,25 @@ endif
|
|||
endif
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
DEST := /lib/modules/$(uname_r)/kernel
|
||||
|
||||
all:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||
make -C /lib/modules/$(uname_r)/build M=$(PWD) modules
|
||||
|
||||
clean:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
|
||||
make -C /lib/modules/$(uname_r)/build M=$(PWD) clean
|
||||
|
||||
install:
|
||||
sudo cp snd-soc-ac108.ko /lib/modules/$(shell uname -r)/kernel/sound/soc/codecs/
|
||||
sudo cp snd-soc-wm8960.ko /lib/modules/$(shell uname -r)/kernel/sound/soc/codecs/
|
||||
sudo cp snd-soc-seeed-voicecard.ko /lib/modules/$(shell uname -r)/kernel/sound/soc/bcm/
|
||||
sudo cp snd-soc-ac108.ko ${DEST}/sound/soc/codecs/
|
||||
sudo cp snd-soc-wm8960.ko ${DEST}/sound/soc/codecs/
|
||||
sudo cp snd-soc-seeed-voicecard.ko ${DEST}/sound/soc/bcm/
|
||||
sudo depmod -a
|
||||
|
||||
|
||||
.PHONY: all clean install
|
||||
|
||||
endif
|
||||
|
||||
|
|
6
ac101.c
6
ac101.c
|
@ -363,7 +363,7 @@ static irqreturn_t audio_hmic_irq(int irq, void *para)
|
|||
|
||||
static int ac101_switch_probe(struct ac10x_priv *ac10x) {
|
||||
struct i2c_client *i2c = ac10x->i2c101;
|
||||
int ret;
|
||||
long ret;
|
||||
|
||||
ac10x->gpiod_irq = devm_gpiod_get_optional(&i2c->dev, "switch-irq", GPIOD_IN);
|
||||
if (IS_ERR(ac10x->gpiod_irq)) {
|
||||
|
@ -376,7 +376,7 @@ static int ac101_switch_probe(struct ac10x_priv *ac10x) {
|
|||
|
||||
ac10x->irq = gpiod_to_irq(ac10x->gpiod_irq);
|
||||
if (IS_ERR_VALUE(ac10x->irq)) {
|
||||
pr_info("[ac101] map gpio to irq failed, errno = %d\n", ac10x->irq);
|
||||
pr_info("[ac101] map gpio to irq failed, errno = %ld\n", ac10x->irq);
|
||||
ac10x->irq = 0;
|
||||
goto _err_irq;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ static int ac101_switch_probe(struct ac10x_priv *ac10x) {
|
|||
/* request irq, set irq type to falling edge trigger */
|
||||
ret = devm_request_irq(ac10x->codec->dev, ac10x->irq, audio_hmic_irq, IRQF_TRIGGER_FALLING, "SWTICH_EINT", ac10x);
|
||||
if (IS_ERR_VALUE(ret)) {
|
||||
pr_info("[ac101] request virq %d failed, errno = %d\n", ac10x->irq, ret);
|
||||
pr_info("[ac101] request virq %ld failed, errno = %ld\n", ac10x->irq, ret);
|
||||
goto _err_irq;
|
||||
}
|
||||
|
||||
|
|
6
ac108.c
6
ac108.c
|
@ -1271,6 +1271,12 @@ int ac108_codec_remove(struct snd_soc_codec *codec) {
|
|||
}
|
||||
return ac101_codec_remove(codec);
|
||||
}
|
||||
#if __NO_SND_SOC_CODEC_DRV
|
||||
void ac108_codec_remove_void(struct snd_soc_codec *codec) {
|
||||
ac108_codec_remove(codec);
|
||||
}
|
||||
#define ac108_codec_remove ac108_codec_remove_void
|
||||
#endif
|
||||
|
||||
int ac108_codec_suspend(struct snd_soc_codec *codec) {
|
||||
struct ac10x_priv *ac10x = snd_soc_codec_get_drvdata(codec);
|
||||
|
|
4
ac10x.h
4
ac10x.h
|
@ -40,6 +40,8 @@
|
|||
#endif
|
||||
|
||||
|
||||
#include "sound-compatible-4.18.h"
|
||||
|
||||
#ifdef CONFIG_AC101_SWITCH_DETECT
|
||||
enum headphone_mode_u {
|
||||
HEADPHONE_IDLE,
|
||||
|
@ -78,7 +80,7 @@ struct ac10x_priv {
|
|||
|
||||
#ifdef CONFIG_AC101_SWITCH_DETECT
|
||||
struct gpio_desc* gpiod_irq;
|
||||
int irq;
|
||||
long irq;
|
||||
volatile int irq_cntr;
|
||||
volatile int pullout_cntr;
|
||||
volatile int state;
|
||||
|
|
|
@ -12,7 +12,7 @@ if [ "x${is_Raspberry}" != "xRaspberry" ] ; then
|
|||
fi
|
||||
|
||||
ver="0.3"
|
||||
|
||||
uname_r=$(uname -r)
|
||||
|
||||
# we create a dir with this version to ensure that 'dkms remove' won't delete
|
||||
# the sources during kernel updates
|
||||
|
@ -35,7 +35,6 @@ fi
|
|||
# locate currently installed kernels (may be different to running kernel if
|
||||
# it's just been updated)
|
||||
kernels=$(ls /lib/modules | sed "s/^/-k /")
|
||||
uname_r=$(uname -r)
|
||||
|
||||
function install_module {
|
||||
src=$1
|
||||
|
@ -67,7 +66,7 @@ cp seeed-8mic-voicecard.dtbo /boot/overlays
|
|||
|
||||
#install alsa plugins
|
||||
# no need this plugin now
|
||||
# install -D ac108_plugin/libasound_module_pcm_ac108.so /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_ac108.so
|
||||
# install -D ac108_plugin/libasound_module_pcm_ac108.so /usr/lib/arm-linux-gnueabihf/alsa-lib/
|
||||
rm -f /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_ac108.so
|
||||
|
||||
#set kernel moduels
|
||||
|
|
35
sound-compatible-4.18.h
Normal file
35
sound-compatible-4.18.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* (C) Copyright 2017-2018
|
||||
* Seeed Technology Co., Ltd. <www.seeedstudio.com>
|
||||
*
|
||||
* PeterYang <linsheng.yang@seeed.cc>
|
||||
*/
|
||||
#ifndef __SOUND_COMPATIBLE_4_18_H__
|
||||
#define __SOUND_COMPATIBLE_4_18_H__
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0)
|
||||
#define __NO_SND_SOC_CODEC_DRV 1
|
||||
#else
|
||||
#define __NO_SND_SOC_CODEC_DRV 0
|
||||
#endif
|
||||
|
||||
#if __NO_SND_SOC_CODEC_DRV
|
||||
#define codec component
|
||||
#define snd_soc_codec snd_soc_component
|
||||
#define snd_soc_codec_driver snd_soc_component_driver
|
||||
#define snd_soc_codec_get_drvdata snd_soc_component_get_drvdata
|
||||
#define snd_soc_codec_get_dapm snd_soc_component_get_dapm
|
||||
#define snd_soc_codec_get_bias_level snd_soc_component_get_bias_level
|
||||
#define snd_soc_kcontrol_codec snd_soc_kcontrol_component
|
||||
#define snd_soc_read snd_soc_component_read32
|
||||
#define snd_soc_register_codec snd_soc_register_component
|
||||
#define snd_soc_unregister_codec snd_soc_unregister_component
|
||||
#define snd_soc_update_bits snd_soc_component_update_bits
|
||||
#define snd_soc_write snd_soc_component_write
|
||||
#define snd_soc_add_codec_controls snd_soc_add_component_controls
|
||||
#endif
|
||||
|
||||
#endif//__SOUND_COMPATIBLE_4_18_H__
|
||||
|
11
wm8960.c
11
wm8960.c
|
@ -25,6 +25,7 @@
|
|||
#include <sound/initval.h>
|
||||
#include <sound/tlv.h>
|
||||
#include <sound/wm8960.h>
|
||||
#include "sound-compatible-4.18.h"
|
||||
|
||||
#include "wm8960.h"
|
||||
|
||||
|
@ -507,7 +508,11 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec)
|
|||
* list each time to find the desired power state do so now
|
||||
* and save the result.
|
||||
*/
|
||||
#if __NO_SND_SOC_CODEC_DRV
|
||||
list_for_each_entry(w, &codec->card->widgets, list) {
|
||||
#else
|
||||
list_for_each_entry(w, &codec->component.card->widgets, list) {
|
||||
#endif
|
||||
if (w->dapm != dapm)
|
||||
continue;
|
||||
if (strcmp(w->name, "LOUT1 PGA") == 0)
|
||||
|
@ -1276,6 +1281,12 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm8960 = {
|
|||
.probe = wm8960_probe,
|
||||
.set_bias_level = wm8960_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
#if __NO_SND_SOC_CODEC_DRV
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
#endif
|
||||
};
|
||||
|
||||
static const struct regmap_config wm8960_regmap = {
|
||||
|
|
Loading…
Reference in a new issue