-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ported CTAG Face 2|4 drivers for BBB and BBAI
- Loading branch information
1 parent
9b75b93
commit 0c40a4f
Showing
7 changed files
with
415 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,9 @@ | |
#include <linux/device.h> | ||
#include <linux/regmap.h> | ||
#include <linux/slab.h> | ||
#include <linux/of.h> | ||
#include <linux/of_device.h> | ||
#include <linux/of_gpio.h> | ||
#include <sound/core.h> | ||
#include <sound/pcm.h> | ||
#include <sound/pcm_params.h> | ||
|
@@ -20,13 +23,6 @@ | |
|
||
#include "ad193x.h" | ||
|
||
/* codec private data */ | ||
struct ad193x_priv { | ||
struct regmap *regmap; | ||
enum ad193x_type type; | ||
int sysclk; | ||
}; | ||
|
||
/* | ||
* AD193X volume/mute/de-emphasis etc. controls | ||
*/ | ||
|
@@ -351,12 +347,29 @@ static struct snd_soc_dai_driver ad193x_dai = { | |
.ops = &ad193x_dai_ops, | ||
}; | ||
|
||
static int ad193x_reset(struct snd_soc_component *component) | ||
{ | ||
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component); | ||
|
||
if (gpio_is_valid(ad193x->reset_gpio)) { | ||
gpio_direction_output(ad193x->reset_gpio, 0); | ||
mdelay(1); | ||
gpio_set_value(ad193x->reset_gpio, 1); | ||
mdelay(1); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
static int ad193x_component_probe(struct snd_soc_component *component) | ||
{ | ||
struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component); | ||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | ||
int num, ret; | ||
|
||
|
||
/* Reset codec */ | ||
ad193x_reset(component); | ||
|
||
/* default setting for ad193x */ | ||
|
||
/* unmute dac channels */ | ||
|
@@ -427,17 +440,36 @@ const struct regmap_config ad193x_regmap_config = { | |
}; | ||
EXPORT_SYMBOL_GPL(ad193x_regmap_config); | ||
|
||
|
||
static const struct of_device_id ad193x_spi_dt_ids[] = { | ||
{ .compatible = "analog,ad1938", }, | ||
{/*sentinel*/}, | ||
}; | ||
MODULE_DEVICE_TABLE(of, ad193x_spi_dt_ids); | ||
|
||
int ad193x_probe(struct device *dev, struct regmap *regmap, | ||
enum ad193x_type type) | ||
{ | ||
struct ad193x_priv *ad193x; | ||
int ret = 0; | ||
|
||
if (IS_ERR(regmap)) | ||
return PTR_ERR(regmap); | ||
|
||
ad193x = devm_kzalloc(dev, sizeof(*ad193x), GFP_KERNEL); | ||
if (ad193x == NULL) | ||
return -ENOMEM; | ||
|
||
if (of_match_device(ad193x_spi_dt_ids, dev)) | ||
ad193x->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpio", 0); | ||
|
||
if (gpio_is_valid(ad193x->reset_gpio)) { | ||
ret = devm_gpio_request(dev, ad193x->reset_gpio, | ||
"AD193x Reset"); | ||
if (ret < 0) | ||
return ret; | ||
} | ||
|
||
|
||
ad193x->regmap = regmap; | ||
ad193x->type = type; | ||
|
@@ -451,4 +483,4 @@ EXPORT_SYMBOL_GPL(ad193x_probe); | |
|
||
MODULE_DESCRIPTION("ASoC ad193x driver"); | ||
MODULE_AUTHOR("Barry Song <[email protected]>"); | ||
MODULE_LICENSE("GPL"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
config SND_DAVINCI_SOC_CTAG_FACE_2_4 | ||
tristate "SoC Audio Support for CTAG face-2-4 Audio Card (AD1938)" | ||
depends on SND_SOC_DAVINCI_MCASP | ||
select SND_SOC_AD193X_SPI | ||
help | ||
Say Y if you want to add support for CTAG face-2-4 Audio Card |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
snd-soc-davinci-ctag-face-2-4-objs := davinci-ctag-face-2-4.o | ||
|
||
obj-$(CONFIG_SND_DAVINCI_SOC_CTAG_FACE_2_4) += snd-soc-davinci-ctag-face-2-4.o |
Oops, something went wrong.