You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'asoc-v3.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Final updates for v3.16 A few more updates from the last week of development, nothing too exciting. Highlights include: - GPIO descriptor support for jacks - More updates and fixes to the Freescale SSI, Intel and rsnd drivers. - New drivers for Analog Devices ADAU1361, ADAU1381, ADAU1761 and ADAU1781, and Realtek RT5677.
This commit is contained in:
@@ -10,6 +10,12 @@ Required properties:
|
||||
|
||||
- interrupts : The CODEC's interrupt output.
|
||||
|
||||
Optional properties:
|
||||
|
||||
- clocks: The phandle of the master clock to the CODEC
|
||||
|
||||
- clock-names: Should be "mclk"
|
||||
|
||||
Pins on the device (for linking into audio routes):
|
||||
|
||||
* MIC1
|
||||
|
||||
@@ -8,6 +8,12 @@ Required properties:
|
||||
|
||||
- reg : The I2C address of the device.
|
||||
|
||||
Optional properties:
|
||||
|
||||
- clocks: The phandle of the master clock to the CODEC
|
||||
|
||||
- clock-names: Should be "mclk"
|
||||
|
||||
Example:
|
||||
|
||||
max98095: codec@11 {
|
||||
|
||||
@@ -20,6 +20,7 @@ Required properties:
|
||||
SSI subnode properties:
|
||||
- interrupts : Should contain SSI interrupt for PIO transfer
|
||||
- shared-pin : if shared clock pin
|
||||
- pio-transfer : use PIO transfer mode
|
||||
|
||||
SRC subnode properties:
|
||||
no properties at this point
|
||||
|
||||
@@ -15,6 +15,9 @@ Optional properties:
|
||||
Each entry is a pair of strings, the first being the
|
||||
connection's sink, the second being the connection's
|
||||
source.
|
||||
- simple-audio-card,mclk-fs : Multiplication factor between stream rate and codec
|
||||
mclk.
|
||||
|
||||
Optional subnodes:
|
||||
|
||||
- simple-audio-card,dai-link : Container for dai-link level
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961/ADAU1781/ADAU1781 codecs
|
||||
*
|
||||
* Copyright 2011-2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2 or later.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_PLATFORM_DATA_ADAU17X1_H__
|
||||
#define __LINUX_PLATFORM_DATA_ADAU17X1_H__
|
||||
|
||||
/**
|
||||
* enum adau17x1_micbias_voltage - Microphone bias voltage
|
||||
* @ADAU17X1_MICBIAS_0_90_AVDD: 0.9 * AVDD
|
||||
* @ADAU17X1_MICBIAS_0_65_AVDD: 0.65 * AVDD
|
||||
*/
|
||||
enum adau17x1_micbias_voltage {
|
||||
ADAU17X1_MICBIAS_0_90_AVDD = 0,
|
||||
ADAU17X1_MICBIAS_0_65_AVDD = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum adau1761_digmic_jackdet_pin_mode - Configuration of the JACKDET/MICIN pin
|
||||
* @ADAU1761_DIGMIC_JACKDET_PIN_MODE_NONE: Disable the pin
|
||||
* @ADAU1761_DIGMIC_JACKDET_PIN_MODE_DIGMIC: Configure the pin for usage as
|
||||
* digital microphone input.
|
||||
* @ADAU1761_DIGMIC_JACKDET_PIN_MODE_JACKDETECT: Configure the pin for jack
|
||||
* insertion detection.
|
||||
*/
|
||||
enum adau1761_digmic_jackdet_pin_mode {
|
||||
ADAU1761_DIGMIC_JACKDET_PIN_MODE_NONE,
|
||||
ADAU1761_DIGMIC_JACKDET_PIN_MODE_DIGMIC,
|
||||
ADAU1761_DIGMIC_JACKDET_PIN_MODE_JACKDETECT,
|
||||
};
|
||||
|
||||
/**
|
||||
* adau1761_jackdetect_debounce_time - Jack insertion detection debounce time
|
||||
* @ADAU1761_JACKDETECT_DEBOUNCE_5MS: 5 milliseconds
|
||||
* @ADAU1761_JACKDETECT_DEBOUNCE_10MS: 10 milliseconds
|
||||
* @ADAU1761_JACKDETECT_DEBOUNCE_20MS: 20 milliseconds
|
||||
* @ADAU1761_JACKDETECT_DEBOUNCE_40MS: 40 milliseconds
|
||||
*/
|
||||
enum adau1761_jackdetect_debounce_time {
|
||||
ADAU1761_JACKDETECT_DEBOUNCE_5MS = 0,
|
||||
ADAU1761_JACKDETECT_DEBOUNCE_10MS = 1,
|
||||
ADAU1761_JACKDETECT_DEBOUNCE_20MS = 2,
|
||||
ADAU1761_JACKDETECT_DEBOUNCE_40MS = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum adau1761_output_mode - Output mode configuration
|
||||
* @ADAU1761_OUTPUT_MODE_HEADPHONE: Headphone output
|
||||
* @ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS: Capless headphone output
|
||||
* @ADAU1761_OUTPUT_MODE_LINE: Line output
|
||||
*/
|
||||
enum adau1761_output_mode {
|
||||
ADAU1761_OUTPUT_MODE_HEADPHONE,
|
||||
ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
|
||||
ADAU1761_OUTPUT_MODE_LINE,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct adau1761_platform_data - ADAU1761 Codec driver platform data
|
||||
* @input_differential: If true the input pins will be configured in
|
||||
* differential mode.
|
||||
* @lineout_mode: Output mode for the LOUT/ROUT pins
|
||||
* @headphone_mode: Output mode for the LHP/RHP pins
|
||||
* @digmic_jackdetect_pin_mode: JACKDET/MICIN pin configuration
|
||||
* @jackdetect_debounce_time: Jack insertion detection debounce time.
|
||||
* Note: This value will only be used, if the JACKDET/MICIN pin is configured
|
||||
* for jack insertion detection.
|
||||
* @jackdetect_active_low: If true the jack insertion detection is active low.
|
||||
* Othwise it will be active high.
|
||||
* @micbias_voltage: Microphone voltage bias
|
||||
*/
|
||||
struct adau1761_platform_data {
|
||||
bool input_differential;
|
||||
enum adau1761_output_mode lineout_mode;
|
||||
enum adau1761_output_mode headphone_mode;
|
||||
|
||||
enum adau1761_digmic_jackdet_pin_mode digmic_jackdetect_pin_mode;
|
||||
|
||||
enum adau1761_jackdetect_debounce_time jackdetect_debounce_time;
|
||||
bool jackdetect_active_low;
|
||||
|
||||
enum adau17x1_micbias_voltage micbias_voltage;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct adau1781_platform_data - ADAU1781 Codec driver platform data
|
||||
* @left_input_differential: If true configure the left input as
|
||||
* differential input.
|
||||
* @right_input_differential: If true configure the right input as differntial
|
||||
* input.
|
||||
* @use_dmic: If true configure the MIC pins as digital microphone pins instead
|
||||
* of analog microphone pins.
|
||||
* @micbias_voltage: Microphone voltage bias
|
||||
*/
|
||||
struct adau1781_platform_data {
|
||||
bool left_input_differential;
|
||||
bool right_input_differential;
|
||||
|
||||
bool use_dmic;
|
||||
|
||||
enum adau17x1_micbias_voltage micbias_voltage;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* linux/sound/rt5677.h -- Platform data for RT5677
|
||||
*
|
||||
* Copyright 2013 Realtek Semiconductor Corp.
|
||||
* Author: Oder Chiou <oder_chiou@realtek.com>
|
||||
*
|
||||
* 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 __LINUX_SND_RT5677_H
|
||||
#define __LINUX_SND_RT5677_H
|
||||
|
||||
struct rt5677_platform_data {
|
||||
/* IN1 IN2 can optionally be differential */
|
||||
bool in1_diff;
|
||||
bool in2_diff;
|
||||
};
|
||||
|
||||
#endif
|
||||
+47
-2
@@ -452,6 +452,9 @@ int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
|
||||
#ifdef CONFIG_GPIOLIB
|
||||
int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
|
||||
struct snd_soc_jack_gpio *gpios);
|
||||
int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
|
||||
struct snd_soc_jack *jack,
|
||||
int count, struct snd_soc_jack_gpio *gpios);
|
||||
void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
|
||||
struct snd_soc_jack_gpio *gpios);
|
||||
#else
|
||||
@@ -461,6 +464,14 @@ static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
|
||||
struct snd_soc_jack *jack,
|
||||
int count,
|
||||
struct snd_soc_jack_gpio *gpios)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
|
||||
struct snd_soc_jack_gpio *gpios)
|
||||
{
|
||||
@@ -587,8 +598,12 @@ struct snd_soc_jack_zone {
|
||||
/**
|
||||
* struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
|
||||
*
|
||||
* @gpio: gpio number
|
||||
* @name: gpio name
|
||||
* @gpio: legacy gpio number
|
||||
* @idx: gpio descriptor index within the function of the GPIO
|
||||
* consumer device
|
||||
* @gpiod_dev GPIO consumer device
|
||||
* @name: gpio name. Also as connection ID for the GPIO consumer
|
||||
* device function name lookup
|
||||
* @report: value to report when jack detected
|
||||
* @invert: report presence in low state
|
||||
* @debouce_time: debouce time in ms
|
||||
@@ -599,6 +614,8 @@ struct snd_soc_jack_zone {
|
||||
*/
|
||||
struct snd_soc_jack_gpio {
|
||||
unsigned int gpio;
|
||||
unsigned int idx;
|
||||
struct device *gpiod_dev;
|
||||
const char *name;
|
||||
int report;
|
||||
int invert;
|
||||
@@ -607,6 +624,7 @@ struct snd_soc_jack_gpio {
|
||||
|
||||
struct snd_soc_jack *jack;
|
||||
struct delayed_work work;
|
||||
struct gpio_desc *desc;
|
||||
|
||||
void *data;
|
||||
int (*jack_status_check)(void *data);
|
||||
@@ -1146,6 +1164,33 @@ static inline struct snd_soc_platform *snd_soc_component_to_platform(
|
||||
return container_of(component, struct snd_soc_platform, component);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in
|
||||
* @dapm: The DAPM context to cast to the CODEC
|
||||
*
|
||||
* This function must only be used on DAPM contexts that are known to be part of
|
||||
* a CODEC (e.g. in a CODEC driver). Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
|
||||
struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
return container_of(dapm, struct snd_soc_codec, dapm);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_to_platform() - Casts a DAPM context to the platform it is
|
||||
* embedded in
|
||||
* @dapm: The DAPM context to cast to the platform.
|
||||
*
|
||||
* This function must only be used on DAPM contexts that are known to be part of
|
||||
* a platform (e.g. in a platform driver). Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
|
||||
struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
return container_of(dapm, struct snd_soc_platform, dapm);
|
||||
}
|
||||
|
||||
/* codec IO */
|
||||
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
|
||||
int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
|
||||
@@ -43,6 +43,32 @@ config SND_SOC_BFIN_EVAL_ADAU1373
|
||||
Note: This driver assumes that first ADAU1373 DAI is connected to the
|
||||
first SPORT port on the BF5XX board.
|
||||
|
||||
config SND_SOC_BFIN_EVAL_ADAU1X61
|
||||
tristate "Support for the EVAL-ADAU1X61 board on Blackfin eval boards"
|
||||
depends on SND_BF5XX_I2S && I2C
|
||||
select SND_BF5XX_SOC_I2S
|
||||
select SND_SOC_ADAU1761_I2C
|
||||
help
|
||||
Say Y if you want to add support for the Analog Devices EVAL-ADAU1X61
|
||||
board connected to one of the Blackfin evaluation boards like the
|
||||
BF5XX-STAMP or BF5XX-EZKIT.
|
||||
|
||||
Note: This driver assumes that the ADAU1X61 is connected to the
|
||||
first SPORT port on the BF5XX board.
|
||||
|
||||
config SND_SOC_BFIN_EVAL_ADAU1X81
|
||||
tristate "Support for the EVAL-ADAU1X81 boards on Blackfin eval boards"
|
||||
depends on SND_BF5XX_I2S && I2C
|
||||
select SND_BF5XX_SOC_I2S
|
||||
select SND_SOC_ADAU1781_I2C
|
||||
help
|
||||
Say Y if you want to add support for the Analog Devices EVAL-ADAU1X81
|
||||
board connected to one of the Blackfin evaluation boards like the
|
||||
BF5XX-STAMP or BF5XX-EZKIT.
|
||||
|
||||
Note: This driver assumes that the ADAU1X81 is connected to the
|
||||
first SPORT port on the BF5XX board.
|
||||
|
||||
config SND_SOC_BFIN_EVAL_ADAV80X
|
||||
tristate "Support for the EVAL-ADAV80X boards on Blackfin eval boards"
|
||||
depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI
|
||||
|
||||
@@ -22,6 +22,8 @@ snd-ssm2602-objs := bf5xx-ssm2602.o
|
||||
snd-ad73311-objs := bf5xx-ad73311.o
|
||||
snd-ad193x-objs := bf5xx-ad193x.o
|
||||
snd-soc-bfin-eval-adau1373-objs := bfin-eval-adau1373.o
|
||||
snd-soc-bfin-eval-adau1x61-objs := bfin-eval-adau1x61.o
|
||||
snd-soc-bfin-eval-adau1x81-objs := bfin-eval-adau1x81.o
|
||||
snd-soc-bfin-eval-adau1701-objs := bfin-eval-adau1701.o
|
||||
snd-soc-bfin-eval-adav80x-objs := bfin-eval-adav80x.o
|
||||
|
||||
@@ -31,5 +33,7 @@ obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o
|
||||
obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
|
||||
obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o
|
||||
obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1373) += snd-soc-bfin-eval-adau1373.o
|
||||
obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) += snd-soc-bfin-eval-adau1x61.o
|
||||
obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X81) += snd-soc-bfin-eval-adau1x81.o
|
||||
obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701) += snd-soc-bfin-eval-adau1701.o
|
||||
obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X) += snd-soc-bfin-eval-adav80x.o
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Machine driver for EVAL-ADAU1x61MINIZ on Analog Devices bfin
|
||||
* evaluation boards.
|
||||
*
|
||||
* Copyright 2011-2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2 or later.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/pcm_params.h>
|
||||
|
||||
#include "../codecs/adau17x1.h"
|
||||
|
||||
static const struct snd_soc_dapm_widget bfin_eval_adau1x61_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_LINE("In 1", NULL),
|
||||
SND_SOC_DAPM_LINE("In 2", NULL),
|
||||
SND_SOC_DAPM_LINE("In 3-4", NULL),
|
||||
|
||||
SND_SOC_DAPM_LINE("Diff Out L", NULL),
|
||||
SND_SOC_DAPM_LINE("Diff Out R", NULL),
|
||||
SND_SOC_DAPM_LINE("Stereo Out", NULL),
|
||||
SND_SOC_DAPM_HP("Capless HP Out", NULL),
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_route bfin_eval_adau1x61_dapm_routes[] = {
|
||||
{ "LAUX", NULL, "In 3-4" },
|
||||
{ "RAUX", NULL, "In 3-4" },
|
||||
{ "LINP", NULL, "In 1" },
|
||||
{ "LINN", NULL, "In 1"},
|
||||
{ "RINP", NULL, "In 2" },
|
||||
{ "RINN", NULL, "In 2" },
|
||||
|
||||
{ "In 1", NULL, "MICBIAS" },
|
||||
{ "In 2", NULL, "MICBIAS" },
|
||||
|
||||
{ "Capless HP Out", NULL, "LHP" },
|
||||
{ "Capless HP Out", NULL, "RHP" },
|
||||
{ "Diff Out L", NULL, "LOUT" },
|
||||
{ "Diff Out R", NULL, "ROUT" },
|
||||
{ "Stereo Out", NULL, "LOUT" },
|
||||
{ "Stereo Out", NULL, "ROUT" },
|
||||
};
|
||||
|
||||
static int bfin_eval_adau1x61_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
int pll_rate;
|
||||
int ret;
|
||||
|
||||
switch (params_rate(params)) {
|
||||
case 48000:
|
||||
case 8000:
|
||||
case 12000:
|
||||
case 16000:
|
||||
case 24000:
|
||||
case 32000:
|
||||
case 96000:
|
||||
pll_rate = 48000 * 1024;
|
||||
break;
|
||||
case 44100:
|
||||
case 7350:
|
||||
case 11025:
|
||||
case 14700:
|
||||
case 22050:
|
||||
case 29400:
|
||||
case 88200:
|
||||
pll_rate = 44100 * 1024;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_pll(codec_dai, ADAU17X1_PLL,
|
||||
ADAU17X1_PLL_SRC_MCLK, 12288000, pll_rate);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, ADAU17X1_CLK_SRC_PLL, pll_rate,
|
||||
SND_SOC_CLOCK_IN);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_ops bfin_eval_adau1x61_ops = {
|
||||
.hw_params = bfin_eval_adau1x61_hw_params,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_link bfin_eval_adau1x61_dai = {
|
||||
.name = "adau1x61",
|
||||
.stream_name = "adau1x61",
|
||||
.cpu_dai_name = "bfin-i2s.0",
|
||||
.codec_dai_name = "adau-hifi",
|
||||
.platform_name = "bfin-i2s-pcm-audio",
|
||||
.codec_name = "adau1761.0-0038",
|
||||
.ops = &bfin_eval_adau1x61_ops,
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
};
|
||||
|
||||
static struct snd_soc_card bfin_eval_adau1x61 = {
|
||||
.name = "bfin-eval-adau1x61",
|
||||
.driver_name = "eval-adau1x61",
|
||||
.dai_link = &bfin_eval_adau1x61_dai,
|
||||
.num_links = 1,
|
||||
|
||||
.dapm_widgets = bfin_eval_adau1x61_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(bfin_eval_adau1x61_dapm_widgets),
|
||||
.dapm_routes = bfin_eval_adau1x61_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(bfin_eval_adau1x61_dapm_routes),
|
||||
.fully_routed = true,
|
||||
};
|
||||
|
||||
static int bfin_eval_adau1x61_probe(struct platform_device *pdev)
|
||||
{
|
||||
bfin_eval_adau1x61.dev = &pdev->dev;
|
||||
|
||||
return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adau1x61);
|
||||
}
|
||||
|
||||
static struct platform_driver bfin_eval_adau1x61_driver = {
|
||||
.driver = {
|
||||
.name = "bfin-eval-adau1x61",
|
||||
.owner = THIS_MODULE,
|
||||
.pm = &snd_soc_pm_ops,
|
||||
},
|
||||
.probe = bfin_eval_adau1x61_probe,
|
||||
};
|
||||
module_platform_driver(bfin_eval_adau1x61_driver);
|
||||
|
||||
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
MODULE_DESCRIPTION("ALSA SoC bfin adau1x61 driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("platform:bfin-eval-adau1x61");
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Machine driver for EVAL-ADAU1x81 on Analog Devices bfin
|
||||
* evaluation boards.
|
||||
*
|
||||
* Copyright 2011-2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2 or later.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/pcm_params.h>
|
||||
|
||||
#include "../codecs/adau17x1.h"
|
||||
|
||||
static const struct snd_soc_dapm_widget bfin_eval_adau1x81_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_LINE("Stereo In", NULL),
|
||||
SND_SOC_DAPM_LINE("Beep", NULL),
|
||||
|
||||
SND_SOC_DAPM_SPK("Speaker", NULL),
|
||||
SND_SOC_DAPM_HP("Headphone", NULL),
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_route bfin_eval_adau1x81_dapm_routes[] = {
|
||||
{ "BEEP", NULL, "Beep" },
|
||||
{ "LMIC", NULL, "Stereo In" },
|
||||
{ "LMIC", NULL, "Stereo In" },
|
||||
|
||||
{ "Headphone", NULL, "AOUTL" },
|
||||
{ "Headphone", NULL, "AOUTR" },
|
||||
{ "Speaker", NULL, "SP" },
|
||||
};
|
||||
|
||||
static int bfin_eval_adau1x81_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
int pll_rate;
|
||||
int ret;
|
||||
|
||||
switch (params_rate(params)) {
|
||||
case 48000:
|
||||
case 8000:
|
||||
case 12000:
|
||||
case 16000:
|
||||
case 24000:
|
||||
case 32000:
|
||||
case 96000:
|
||||
pll_rate = 48000 * 1024;
|
||||
break;
|
||||
case 44100:
|
||||
case 7350:
|
||||
case 11025:
|
||||
case 14700:
|
||||
case 22050:
|
||||
case 29400:
|
||||
case 88200:
|
||||
pll_rate = 44100 * 1024;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = snd_soc_dai_set_pll(codec_dai, ADAU17X1_PLL,
|
||||
ADAU17X1_PLL_SRC_MCLK, 12288000, pll_rate);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, ADAU17X1_CLK_SRC_PLL, pll_rate,
|
||||
SND_SOC_CLOCK_IN);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_ops bfin_eval_adau1x81_ops = {
|
||||
.hw_params = bfin_eval_adau1x81_hw_params,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_link bfin_eval_adau1x81_dai = {
|
||||
.name = "adau1x81",
|
||||
.stream_name = "adau1x81",
|
||||
.cpu_dai_name = "bfin-i2s.0",
|
||||
.codec_dai_name = "adau-hifi",
|
||||
.platform_name = "bfin-i2s-pcm-audio",
|
||||
.codec_name = "adau1781.0-0038",
|
||||
.ops = &bfin_eval_adau1x81_ops,
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
||||
SND_SOC_DAIFMT_CBM_CFM,
|
||||
};
|
||||
|
||||
static struct snd_soc_card bfin_eval_adau1x81 = {
|
||||
.name = "bfin-eval-adau1x81",
|
||||
.driver_name = "eval-adau1x81",
|
||||
.dai_link = &bfin_eval_adau1x81_dai,
|
||||
.num_links = 1,
|
||||
|
||||
.dapm_widgets = bfin_eval_adau1x81_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(bfin_eval_adau1x81_dapm_widgets),
|
||||
.dapm_routes = bfin_eval_adau1x81_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(bfin_eval_adau1x81_dapm_routes),
|
||||
.fully_routed = true,
|
||||
};
|
||||
|
||||
static int bfin_eval_adau1x81_probe(struct platform_device *pdev)
|
||||
{
|
||||
bfin_eval_adau1x81.dev = &pdev->dev;
|
||||
|
||||
return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adau1x81);
|
||||
}
|
||||
|
||||
static struct platform_driver bfin_eval_adau1x81_driver = {
|
||||
.driver = {
|
||||
.name = "bfin-eval-adau1x81",
|
||||
.owner = THIS_MODULE,
|
||||
.pm = &snd_soc_pm_ops,
|
||||
},
|
||||
.probe = bfin_eval_adau1x81_probe,
|
||||
};
|
||||
module_platform_driver(bfin_eval_adau1x81_driver);
|
||||
|
||||
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
MODULE_DESCRIPTION("ALSA SoC bfin adau1x81 driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("platform:bfin-eval-adau1x81");
|
||||
@@ -23,6 +23,10 @@ config SND_SOC_ALL_CODECS
|
||||
select SND_SOC_AD1980 if SND_SOC_AC97_BUS
|
||||
select SND_SOC_AD73311
|
||||
select SND_SOC_ADAU1373 if I2C
|
||||
select SND_SOC_ADAU1761_I2C if I2C
|
||||
select SND_SOC_ADAU1761_SPI if SPI
|
||||
select SND_SOC_ADAU1781_I2C if I2C
|
||||
select SND_SOC_ADAU1781_SPI if SPI
|
||||
select SND_SOC_ADAV801 if SPI_MASTER
|
||||
select SND_SOC_ADAV803 if I2C
|
||||
select SND_SOC_ADAU1977_SPI if SPI_MASTER
|
||||
@@ -74,6 +78,7 @@ config SND_SOC_ALL_CODECS
|
||||
select SND_SOC_RT5640 if I2C
|
||||
select SND_SOC_RT5645 if I2C
|
||||
select SND_SOC_RT5651 if I2C
|
||||
select SND_SOC_RT5677 if I2C
|
||||
select SND_SOC_SGTL5000 if I2C
|
||||
select SND_SOC_SI476X if MFD_SI476X_CORE
|
||||
select SND_SOC_SIRF_AUDIO_CODEC
|
||||
@@ -214,13 +219,45 @@ config SND_SOC_AD1980
|
||||
config SND_SOC_AD73311
|
||||
tristate
|
||||
|
||||
config SND_SOC_ADAU1373
|
||||
tristate
|
||||
|
||||
config SND_SOC_ADAU1701
|
||||
tristate "Analog Devices ADAU1701 CODEC"
|
||||
depends on I2C
|
||||
select SND_SOC_SIGMADSP
|
||||
|
||||
config SND_SOC_ADAU1373
|
||||
config SND_SOC_ADAU17X1
|
||||
tristate
|
||||
select SND_SOC_SIGMADSP
|
||||
|
||||
config SND_SOC_ADAU1761
|
||||
tristate
|
||||
select SND_SOC_ADAU17X1
|
||||
|
||||
config SND_SOC_ADAU1761_I2C
|
||||
tristate
|
||||
select SND_SOC_ADAU1761
|
||||
select REGMAP_I2C
|
||||
|
||||
config SND_SOC_ADAU1761_SPI
|
||||
tristate
|
||||
select SND_SOC_ADAU1761
|
||||
select REGMAP_SPI
|
||||
|
||||
config SND_SOC_ADAU1781
|
||||
select SND_SOC_ADAU17X1
|
||||
tristate
|
||||
|
||||
config SND_SOC_ADAU1781_I2C
|
||||
tristate
|
||||
select SND_SOC_ADAU1781
|
||||
select REGMAP_I2C
|
||||
|
||||
config SND_SOC_ADAU1781_SPI
|
||||
tristate
|
||||
select SND_SOC_ADAU1781
|
||||
select REGMAP_SPI
|
||||
|
||||
config SND_SOC_ADAU1977
|
||||
tristate
|
||||
@@ -274,6 +311,7 @@ config SND_SOC_AK5386
|
||||
|
||||
config SND_SOC_ALC5623
|
||||
tristate "Realtek ALC5623 CODEC"
|
||||
depends on I2C
|
||||
|
||||
config SND_SOC_ALC5632
|
||||
tristate
|
||||
@@ -402,6 +440,15 @@ config SND_SOC_PCM512x_SPI
|
||||
select SND_SOC_PCM512x
|
||||
select REGMAP_SPI
|
||||
|
||||
config SND_SOC_RL6231
|
||||
tristate
|
||||
default y if SND_SOC_RT5640=y
|
||||
default y if SND_SOC_RT5645=y
|
||||
default y if SND_SOC_RT5651=y
|
||||
default m if SND_SOC_RT5640=m
|
||||
default m if SND_SOC_RT5645=m
|
||||
default m if SND_SOC_RT5651=m
|
||||
|
||||
config SND_SOC_RT5631
|
||||
tristate
|
||||
|
||||
@@ -414,6 +461,9 @@ config SND_SOC_RT5645
|
||||
config SND_SOC_RT5651
|
||||
tristate
|
||||
|
||||
config SND_SOC_RT5677
|
||||
tristate
|
||||
|
||||
#Freescale sgtl5000 codec
|
||||
config SND_SOC_SGTL5000
|
||||
tristate "Freescale SGTL5000 CODEC"
|
||||
|
||||
@@ -7,8 +7,15 @@ snd-soc-ad193x-spi-objs := ad193x-spi.o
|
||||
snd-soc-ad193x-i2c-objs := ad193x-i2c.o
|
||||
snd-soc-ad1980-objs := ad1980.o
|
||||
snd-soc-ad73311-objs := ad73311.o
|
||||
snd-soc-adau1701-objs := adau1701.o
|
||||
snd-soc-adau1373-objs := adau1373.o
|
||||
snd-soc-adau1701-objs := adau1701.o
|
||||
snd-soc-adau17x1-objs := adau17x1.o
|
||||
snd-soc-adau1761-objs := adau1761.o
|
||||
snd-soc-adau1761-i2c-objs := adau1761-i2c.o
|
||||
snd-soc-adau1761-spi-objs := adau1761-spi.o
|
||||
snd-soc-adau1781-objs := adau1781.o
|
||||
snd-soc-adau1781-i2c-objs := adau1781-i2c.o
|
||||
snd-soc-adau1781-spi-objs := adau1781-spi.o
|
||||
snd-soc-adau1977-objs := adau1977.o
|
||||
snd-soc-adau1977-spi-objs := adau1977-spi.o
|
||||
snd-soc-adau1977-i2c-objs := adau1977-i2c.o
|
||||
@@ -60,10 +67,12 @@ snd-soc-pcm3008-objs := pcm3008.o
|
||||
snd-soc-pcm512x-objs := pcm512x.o
|
||||
snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
|
||||
snd-soc-pcm512x-spi-objs := pcm512x-spi.o
|
||||
snd-soc-rl6231-objs := rl6231.o
|
||||
snd-soc-rt5631-objs := rt5631.o
|
||||
snd-soc-rt5640-objs := rt5640.o
|
||||
snd-soc-rt5645-objs := rt5645.o
|
||||
snd-soc-rt5651-objs := rt5651.o
|
||||
snd-soc-rt5677-objs := rt5677.o
|
||||
snd-soc-sgtl5000-objs := sgtl5000.o
|
||||
snd-soc-alc5623-objs := alc5623.o
|
||||
snd-soc-alc5632-objs := alc5632.o
|
||||
@@ -162,10 +171,17 @@ obj-$(CONFIG_SND_SOC_AD193X_I2C) += snd-soc-ad193x-i2c.o
|
||||
obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o
|
||||
obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1373) += snd-soc-adau1373.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1701) += snd-soc-adau1701.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU17X1) += snd-soc-adau17x1.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1761) += snd-soc-adau1761.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1761_I2C) += snd-soc-adau1761-i2c.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1761_SPI) += snd-soc-adau1761-spi.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1781) += snd-soc-adau1781.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1781_I2C) += snd-soc-adau1781-i2c.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1781_SPI) += snd-soc-adau1781-spi.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1977) += snd-soc-adau1977.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1977_SPI) += snd-soc-adau1977-spi.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1977_I2C) += snd-soc-adau1977-i2c.o
|
||||
obj-$(CONFIG_SND_SOC_ADAU1701) += snd-soc-adau1701.o
|
||||
obj-$(CONFIG_SND_SOC_ADAV80X) += snd-soc-adav80x.o
|
||||
obj-$(CONFIG_SND_SOC_ADAV801) += snd-soc-adav801.o
|
||||
obj-$(CONFIG_SND_SOC_ADAV803) += snd-soc-adav803.o
|
||||
@@ -216,10 +232,12 @@ obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
|
||||
obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o
|
||||
obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
|
||||
obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
|
||||
obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o
|
||||
obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
|
||||
obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o
|
||||
obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o
|
||||
obj-$(CONFIG_SND_SOC_RT5651) += snd-soc-rt5651.o
|
||||
obj-$(CONFIG_SND_SOC_RT5677) += snd-soc-rt5677.o
|
||||
obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o
|
||||
obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o
|
||||
obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961 codec
|
||||
*
|
||||
* Copyright 2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2.
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
#include "adau1761.h"
|
||||
|
||||
static int adau1761_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct regmap_config config;
|
||||
|
||||
config = adau1761_regmap_config;
|
||||
config.val_bits = 8;
|
||||
config.reg_bits = 16;
|
||||
|
||||
return adau1761_probe(&client->dev,
|
||||
devm_regmap_init_i2c(client, &config),
|
||||
id->driver_data, NULL);
|
||||
}
|
||||
|
||||
static int adau1761_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id adau1761_i2c_ids[] = {
|
||||
{ "adau1361", ADAU1361 },
|
||||
{ "adau1461", ADAU1761 },
|
||||
{ "adau1761", ADAU1761 },
|
||||
{ "adau1961", ADAU1361 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, adau1761_i2c_ids);
|
||||
|
||||
static struct i2c_driver adau1761_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "adau1761",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = adau1761_i2c_probe,
|
||||
.remove = adau1761_i2c_remove,
|
||||
.id_table = adau1761_i2c_ids,
|
||||
};
|
||||
module_i2c_driver(adau1761_i2c_driver);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC ADAU1361/ADAU1461/ADAU1761/ADAU1961 CODEC I2C driver");
|
||||
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961 codec
|
||||
*
|
||||
* Copyright 2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2.
|
||||
*/
|
||||
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
#include "adau1761.h"
|
||||
|
||||
static void adau1761_spi_switch_mode(struct device *dev)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
|
||||
/*
|
||||
* To get the device into SPI mode CLATCH has to be pulled low three
|
||||
* times. Do this by issuing three dummy reads.
|
||||
*/
|
||||
spi_w8r8(spi, 0x00);
|
||||
spi_w8r8(spi, 0x00);
|
||||
spi_w8r8(spi, 0x00);
|
||||
}
|
||||
|
||||
static int adau1761_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
struct regmap_config config;
|
||||
|
||||
if (!id)
|
||||
return -EINVAL;
|
||||
|
||||
config = adau1761_regmap_config;
|
||||
config.val_bits = 8;
|
||||
config.reg_bits = 24;
|
||||
config.read_flag_mask = 0x1;
|
||||
|
||||
return adau1761_probe(&spi->dev,
|
||||
devm_regmap_init_spi(spi, &config),
|
||||
id->driver_data, adau1761_spi_switch_mode);
|
||||
}
|
||||
|
||||
static int adau1761_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spi_device_id adau1761_spi_id[] = {
|
||||
{ "adau1361", ADAU1361 },
|
||||
{ "adau1461", ADAU1761 },
|
||||
{ "adau1761", ADAU1761 },
|
||||
{ "adau1961", ADAU1361 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, adau1761_spi_id);
|
||||
|
||||
static struct spi_driver adau1761_spi_driver = {
|
||||
.driver = {
|
||||
.name = "adau1761",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = adau1761_spi_probe,
|
||||
.remove = adau1761_spi_remove,
|
||||
.id_table = adau1761_spi_id,
|
||||
};
|
||||
module_spi_driver(adau1761_spi_driver);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC ADAU1361/ADAU1461/ADAU1761/ADAU1961 CODEC SPI driver");
|
||||
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* ADAU1361/ADAU1461/ADAU1761/ADAU1961 driver
|
||||
*
|
||||
* Copyright 2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2.
|
||||
*/
|
||||
|
||||
#ifndef __SOUND_SOC_CODECS_ADAU1761_H__
|
||||
#define __SOUND_SOC_CODECS_ADAU1761_H__
|
||||
|
||||
#include <linux/regmap.h>
|
||||
#include "adau17x1.h"
|
||||
|
||||
struct device;
|
||||
|
||||
int adau1761_probe(struct device *dev, struct regmap *regmap,
|
||||
enum adau17x1_type type, void (*switch_mode)(struct device *dev));
|
||||
|
||||
extern const struct regmap_config adau1761_regmap_config;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Driver for ADAU1381/ADAU1781 CODEC
|
||||
*
|
||||
* Copyright 2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2.
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
#include "adau1781.h"
|
||||
|
||||
static int adau1781_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct regmap_config config;
|
||||
|
||||
config = adau1781_regmap_config;
|
||||
config.val_bits = 8;
|
||||
config.reg_bits = 16;
|
||||
|
||||
return adau1781_probe(&client->dev,
|
||||
devm_regmap_init_i2c(client, &config),
|
||||
id->driver_data, NULL);
|
||||
}
|
||||
|
||||
static int adau1781_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id adau1781_i2c_ids[] = {
|
||||
{ "adau1381", ADAU1381 },
|
||||
{ "adau1781", ADAU1781 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, adau1781_i2c_ids);
|
||||
|
||||
static struct i2c_driver adau1781_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "adau1781",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = adau1781_i2c_probe,
|
||||
.remove = adau1781_i2c_remove,
|
||||
.id_table = adau1781_i2c_ids,
|
||||
};
|
||||
module_i2c_driver(adau1781_i2c_driver);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC ADAU1381/ADAU1781 CODEC I2C driver");
|
||||
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Driver for ADAU1381/ADAU1781 CODEC
|
||||
*
|
||||
* Copyright 2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2.
|
||||
*/
|
||||
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
#include "adau1781.h"
|
||||
|
||||
static void adau1781_spi_switch_mode(struct device *dev)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(dev);
|
||||
|
||||
/*
|
||||
* To get the device into SPI mode CLATCH has to be pulled low three
|
||||
* times. Do this by issuing three dummy reads.
|
||||
*/
|
||||
spi_w8r8(spi, 0x00);
|
||||
spi_w8r8(spi, 0x00);
|
||||
spi_w8r8(spi, 0x00);
|
||||
}
|
||||
|
||||
static int adau1781_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
struct regmap_config config;
|
||||
|
||||
if (!id)
|
||||
return -EINVAL;
|
||||
|
||||
config = adau1781_regmap_config;
|
||||
config.val_bits = 8;
|
||||
config.reg_bits = 24;
|
||||
config.read_flag_mask = 0x1;
|
||||
|
||||
return adau1781_probe(&spi->dev,
|
||||
devm_regmap_init_spi(spi, &config),
|
||||
id->driver_data, adau1781_spi_switch_mode);
|
||||
}
|
||||
|
||||
static int adau1781_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spi_device_id adau1781_spi_id[] = {
|
||||
{ "adau1381", ADAU1381 },
|
||||
{ "adau1781", ADAU1781 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, adau1781_spi_id);
|
||||
|
||||
static struct spi_driver adau1781_spi_driver = {
|
||||
.driver = {
|
||||
.name = "adau1781",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = adau1781_spi_probe,
|
||||
.remove = adau1781_spi_remove,
|
||||
.id_table = adau1781_spi_id,
|
||||
};
|
||||
module_spi_driver(adau1781_spi_driver);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC ADAU1381/ADAU1781 CODEC SPI driver");
|
||||
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
MODULE_LICENSE("GPL");
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user