Commit 631657c6 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/sh', 'asoc/topic/sigmadsp',...

Merge remote-tracking branches 'asoc/topic/sh', 'asoc/topic/sigmadsp', 'asoc/topic/simple', 'asoc/topic/sirf' and 'asoc/topic/sn95031' into asoc-next
Renesas FSI
Required properties:
- compatible : "renesas,sh_fsi2" or "renesas,sh_fsi"
- compatible : "renesas,fsi2-<soctype>",
"renesas,sh_fsi2" or "renesas,sh_fsi" as
fallback.
Examples with soctypes are:
- "renesas,fsi2-r8a7740" (R-Mobile A1)
- "renesas,fsi2-sh73a0" (SH-Mobile AG5)
- reg : Should contain the register physical address and length
- interrupts : Should contain FSI interrupt
- fsia,spdif-connection : FSI is connected by S/PDFI
- fsia,spdif-connection : FSI is connected by S/PDIF
- fsia,stream-mode-support : FSI supports 16bit stream mode.
- fsia,use-internal-clock : FSI uses internal clock when master mode.
......
......@@ -22,9 +22,14 @@
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <asm/unaligned.h>
#include "sigmadsp.h"
#include "adau1701.h"
#define ADAU1701_SAFELOAD_DATA(i) (0x0810 + (i))
#define ADAU1701_SAFELOAD_ADDR(i) (0x0815 + (i))
#define ADAU1701_DSPCTRL 0x081c
#define ADAU1701_SEROCTL 0x081e
#define ADAU1701_SERICTL 0x081f
......@@ -42,6 +47,7 @@
#define ADAU1701_DSPCTRL_CR (1 << 2)
#define ADAU1701_DSPCTRL_DAM (1 << 3)
#define ADAU1701_DSPCTRL_ADM (1 << 4)
#define ADAU1701_DSPCTRL_IST (1 << 5)
#define ADAU1701_DSPCTRL_SR_48 0x00
#define ADAU1701_DSPCTRL_SR_96 0x01
#define ADAU1701_DSPCTRL_SR_192 0x02
......@@ -102,7 +108,10 @@ struct adau1701 {
unsigned int pll_clkdiv;
unsigned int sysclk;
struct regmap *regmap;
struct i2c_client *client;
u8 pin_config[12];
struct sigmadsp *sigmadsp;
};
static const struct snd_kcontrol_new adau1701_controls[] = {
......@@ -159,6 +168,7 @@ static bool adau1701_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case ADAU1701_DACSET:
case ADAU1701_DSPCTRL:
return true;
default:
return false;
......@@ -238,12 +248,58 @@ static int adau1701_reg_read(void *context, unsigned int reg,
return 0;
}
static int adau1701_reset(struct snd_soc_codec *codec, unsigned int clkdiv)
static int adau1701_safeload(struct sigmadsp *sigmadsp, unsigned int addr,
const uint8_t bytes[], size_t len)
{
struct i2c_client *client = to_i2c_client(sigmadsp->dev);
struct adau1701 *adau1701 = i2c_get_clientdata(client);
unsigned int val;
unsigned int i;
uint8_t buf[10];
int ret;
ret = regmap_read(adau1701->regmap, ADAU1701_DSPCTRL, &val);
if (ret)
return ret;
if (val & ADAU1701_DSPCTRL_IST)
msleep(50);
for (i = 0; i < len / 4; i++) {
put_unaligned_le16(ADAU1701_SAFELOAD_DATA(i), buf);
buf[2] = 0x00;
memcpy(buf + 3, bytes + i * 4, 4);
ret = i2c_master_send(client, buf, 7);
if (ret < 0)
return ret;
else if (ret != 7)
return -EIO;
put_unaligned_le16(ADAU1701_SAFELOAD_ADDR(i), buf);
put_unaligned_le16(addr + i, buf + 2);
ret = i2c_master_send(client, buf, 4);
if (ret < 0)
return ret;
else if (ret != 4)
return -EIO;
}
return regmap_update_bits(adau1701->regmap, ADAU1701_DSPCTRL,
ADAU1701_DSPCTRL_IST, ADAU1701_DSPCTRL_IST);
}
static const struct sigmadsp_ops adau1701_sigmadsp_ops = {
.safeload = adau1701_safeload,
};
static int adau1701_reset(struct snd_soc_codec *codec, unsigned int clkdiv,
unsigned int rate)
{
struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec);
struct i2c_client *client = to_i2c_client(codec->dev);
int ret;
sigmadsp_reset(adau1701->sigmadsp);
if (clkdiv != ADAU1707_CLKDIV_UNSET &&
gpio_is_valid(adau1701->gpio_pll_mode[0]) &&
gpio_is_valid(adau1701->gpio_pll_mode[1])) {
......@@ -284,7 +340,7 @@ static int adau1701_reset(struct snd_soc_codec *codec, unsigned int clkdiv)
* know the correct PLL setup
*/
if (clkdiv != ADAU1707_CLKDIV_UNSET) {
ret = process_sigma_firmware(client, ADAU1701_FIRMWARE);
ret = sigmadsp_setup(adau1701->sigmadsp, rate);
if (ret) {
dev_warn(codec->dev, "Failed to load firmware\n");
return ret;
......@@ -385,7 +441,7 @@ static int adau1701_hw_params(struct snd_pcm_substream *substream,
* firmware upload.
*/
if (clkdiv != adau1701->pll_clkdiv) {
ret = adau1701_reset(codec, clkdiv);
ret = adau1701_reset(codec, clkdiv, params_rate(params));
if (ret < 0)
return ret;
}
......@@ -554,6 +610,14 @@ static int adau1701_set_sysclk(struct snd_soc_codec *codec, int clk_id,
return 0;
}
static int adau1701_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(dai->codec);
return sigmadsp_restrict_params(adau1701->sigmadsp, substream);
}
#define ADAU1701_RATES (SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 | \
SNDRV_PCM_RATE_192000)
......@@ -564,6 +628,7 @@ static const struct snd_soc_dai_ops adau1701_dai_ops = {
.set_fmt = adau1701_set_dai_fmt,
.hw_params = adau1701_hw_params,
.digital_mute = adau1701_digital_mute,
.startup = adau1701_startup,
};
static struct snd_soc_dai_driver adau1701_dai = {
......@@ -600,6 +665,10 @@ static int adau1701_probe(struct snd_soc_codec *codec)
unsigned int val;
struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec);
ret = sigmadsp_attach(adau1701->sigmadsp, &codec->component);
if (ret)
return ret;
/*
* Let the pll_clkdiv variable default to something that won't happen
* at runtime. That way, we can postpone the firmware download from
......@@ -609,7 +678,7 @@ static int adau1701_probe(struct snd_soc_codec *codec)
adau1701->pll_clkdiv = ADAU1707_CLKDIV_UNSET;
/* initalize with pre-configured pll mode settings */
ret = adau1701_reset(codec, adau1701->pll_clkdiv);
ret = adau1701_reset(codec, adau1701->pll_clkdiv, 0);
if (ret < 0)
return ret;
......@@ -667,6 +736,7 @@ static int adau1701_i2c_probe(struct i2c_client *client,
if (!adau1701)
return -ENOMEM;
adau1701->client = client;
adau1701->regmap = devm_regmap_init(dev, NULL, client,
&adau1701_regmap);
if (IS_ERR(adau1701->regmap))
......@@ -722,6 +792,12 @@ static int adau1701_i2c_probe(struct i2c_client *client,
adau1701->gpio_pll_mode[1] = gpio_pll_mode[1];
i2c_set_clientdata(client, adau1701);
adau1701->sigmadsp = devm_sigmadsp_init_i2c(client,
&adau1701_sigmadsp_ops, ADAU1701_FIRMWARE);
if (IS_ERR(adau1701->sigmadsp))
return PTR_ERR(adau1701->sigmadsp);
ret = snd_soc_register_codec(&client->dev, &adau1701_codec_drv,
&adau1701_dai, 1);
return ret;
......
......@@ -703,11 +703,6 @@ static int adau1761_codec_probe(struct snd_soc_codec *codec)
ARRAY_SIZE(adau1761_dapm_routes));
if (ret)
return ret;
ret = adau17x1_load_firmware(adau, codec->dev,
ADAU1761_FIRMWARE);
if (ret)
dev_warn(codec->dev, "Failed to firmware\n");
}
ret = adau17x1_add_routes(codec);
......@@ -776,16 +771,20 @@ int adau1761_probe(struct device *dev, struct regmap *regmap,
enum adau17x1_type type, void (*switch_mode)(struct device *dev))
{
struct snd_soc_dai_driver *dai_drv;
const char *firmware_name;
int ret;
ret = adau17x1_probe(dev, regmap, type, switch_mode);
if (ret)
return ret;
if (type == ADAU1361)
if (type == ADAU1361) {
dai_drv = &adau1361_dai_driver;
else
firmware_name = NULL;
} else {
dai_drv = &adau1761_dai_driver;
firmware_name = ADAU1761_FIRMWARE;
}
ret = adau17x1_probe(dev, regmap, type, switch_mode, firmware_name);
if (ret)
return ret;
return snd_soc_register_codec(dev, &adau1761_codec_driver, dai_drv, 1);
}
......@@ -799,6 +798,7 @@ const struct regmap_config adau1761_regmap_config = {
.num_reg_defaults = ARRAY_SIZE(adau1761_reg_defaults),
.readable_reg = adau1761_readable_register,
.volatile_reg = adau17x1_volatile_register,
.precious_reg = adau17x1_precious_register,
.cache_type = REGCACHE_RBTREE,
};
EXPORT_SYMBOL_GPL(adau1761_regmap_config);
......
......@@ -385,7 +385,6 @@ static int adau1781_codec_probe(struct snd_soc_codec *codec)
{
struct adau1781_platform_data *pdata = dev_get_platdata(codec->dev);
struct adau *adau = snd_soc_codec_get_drvdata(codec);
const char *firmware;
int ret;
ret = adau17x1_add_widgets(codec);
......@@ -422,25 +421,10 @@ static int adau1781_codec_probe(struct snd_soc_codec *codec)
return ret;
}
switch (adau->type) {
case ADAU1381:
firmware = ADAU1381_FIRMWARE;
break;
case ADAU1781:
firmware = ADAU1781_FIRMWARE;
break;
default:
return -EINVAL;
}
ret = adau17x1_add_routes(codec);
if (ret < 0)
return ret;
ret = adau17x1_load_firmware(adau, codec->dev, firmware);
if (ret)
dev_warn(codec->dev, "Failed to load firmware\n");
return 0;
}
......@@ -488,6 +472,7 @@ const struct regmap_config adau1781_regmap_config = {
.num_reg_defaults = ARRAY_SIZE(adau1781_reg_defaults),
.readable_reg = adau1781_readable_register,
.volatile_reg = adau17x1_volatile_register,
.precious_reg = adau17x1_precious_register,
.cache_type = REGCACHE_RBTREE,
};
EXPORT_SYMBOL_GPL(adau1781_regmap_config);
......@@ -495,9 +480,21 @@ EXPORT_SYMBOL_GPL(adau1781_regmap_config);
int adau1781_probe(struct device *dev, struct regmap *regmap,
enum adau17x1_type type, void (*switch_mode)(struct device *dev))
{
const char *firmware_name;
int ret;
ret = adau17x1_probe(dev, regmap, type, switch_mode);
switch (type) {
case ADAU1381:
firmware_name = ADAU1381_FIRMWARE;
break;
case ADAU1781:
firmware_name = ADAU1781_FIRMWARE;
break;
default:
return -EINVAL;
}
ret = adau17x1_probe(dev, regmap, type, switch_mode, firmware_name);
if (ret)
return ret;
......
......@@ -308,6 +308,7 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream,
struct adau *adau = snd_soc_codec_get_drvdata(codec);
unsigned int val, div, dsp_div;
unsigned int freq;
int ret;
if (adau->clk_src == ADAU17X1_CLK_SRC_PLL)
freq = adau->pll_freq;
......@@ -357,6 +358,12 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream,
regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dsp_div);
}
if (adau->sigmadsp) {
ret = adau17x1_setup_firmware(adau, params_rate(params));
if (ret < 0)
return ret;
}
if (adau->dai_fmt != SND_SOC_DAIFMT_RIGHT_J)
return 0;
......@@ -662,12 +669,24 @@ static int adau17x1_set_dai_tdm_slot(struct snd_soc_dai *dai,
return 0;
}
static int adau17x1_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct adau *adau = snd_soc_codec_get_drvdata(dai->codec);
if (adau->sigmadsp)
return sigmadsp_restrict_params(adau->sigmadsp, substream);
return 0;
}
const struct snd_soc_dai_ops adau17x1_dai_ops = {
.hw_params = adau17x1_hw_params,
.set_sysclk = adau17x1_set_dai_sysclk,
.set_fmt = adau17x1_set_dai_fmt,
.set_pll = adau17x1_set_dai_pll,
.set_tdm_slot = adau17x1_set_dai_tdm_slot,
.startup = adau17x1_startup,
};
EXPORT_SYMBOL_GPL(adau17x1_dai_ops);
......@@ -688,8 +707,22 @@ int adau17x1_set_micbias_voltage(struct snd_soc_codec *codec,
}
EXPORT_SYMBOL_GPL(adau17x1_set_micbias_voltage);
bool adau17x1_precious_register(struct device *dev, unsigned int reg)
{
/* SigmaDSP parameter memory */
if (reg < 0x400)
return true;
return false;
}
EXPORT_SYMBOL_GPL(adau17x1_precious_register);
bool adau17x1_readable_register(struct device *dev, unsigned int reg)
{
/* SigmaDSP parameter memory */
if (reg < 0x400)
return true;
switch (reg) {
case ADAU17X1_CLOCK_CONTROL:
case ADAU17X1_PLL_CONTROL:
......@@ -746,8 +779,7 @@ bool adau17x1_volatile_register(struct device *dev, unsigned int reg)
}
EXPORT_SYMBOL_GPL(adau17x1_volatile_register);
int adau17x1_load_firmware(struct adau *adau, struct device *dev,
const char *firmware)
int adau17x1_setup_firmware(struct adau *adau, unsigned int rate)
{
int ret;
int dspsr;
......@@ -759,7 +791,7 @@ int adau17x1_load_firmware(struct adau *adau, struct device *dev,
regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1);
regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf);
ret = process_sigma_firmware_regmap(dev, adau->regmap, firmware);
ret = sigmadsp_setup(adau->sigmadsp, rate);
if (ret) {
regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0);
return ret;
......@@ -768,7 +800,7 @@ int adau17x1_load_firmware(struct adau *adau, struct device *dev,
return 0;
}
EXPORT_SYMBOL_GPL(adau17x1_load_firmware);
EXPORT_SYMBOL_GPL(adau17x1_setup_firmware);
int adau17x1_add_widgets(struct snd_soc_codec *codec)
{
......@@ -788,8 +820,21 @@ int adau17x1_add_widgets(struct snd_soc_codec *codec)
ret = snd_soc_dapm_new_controls(&codec->dapm,
adau17x1_dsp_dapm_widgets,
ARRAY_SIZE(adau17x1_dsp_dapm_widgets));
if (ret)
return ret;
if (!adau->sigmadsp)
return 0;
ret = sigmadsp_attach(adau->sigmadsp, &codec->component);
if (ret) {
dev_err(codec->dev, "Failed to attach firmware: %d\n",
ret);
return ret;
}
}
return ret;
return 0;
}
EXPORT_SYMBOL_GPL(adau17x1_add_widgets);
......@@ -830,7 +875,8 @@ int adau17x1_resume(struct snd_soc_codec *codec)
EXPORT_SYMBOL_GPL(adau17x1_resume);
int adau17x1_probe(struct device *dev, struct regmap *regmap,
enum adau17x1_type type, void (*switch_mode)(struct device *dev))
enum adau17x1_type type, void (*switch_mode)(struct device *dev),
const char *firmware_name)
{
struct adau *adau;
......@@ -847,6 +893,16 @@ int adau17x1_probe(struct device *dev, struct regmap *regmap,
dev_set_drvdata(dev, adau);
if (firmware_name) {
adau->sigmadsp = devm_sigmadsp_init_regmap(dev, regmap, NULL,
firmware_name);
if (IS_ERR(adau->sigmadsp)) {
dev_warn(dev, "Could not find firmware file: %ld\n",
PTR_ERR(adau->sigmadsp));
adau->sigmadsp = NULL;
}
}
if (switch_mode)
switch_mode(dev);
......
......@@ -4,6 +4,8 @@
#include <linux/regmap.h>
#include <linux/platform_data/adau17x1.h>
#include "sigmadsp.h"
enum adau17x1_type {
ADAU1361,
ADAU1761,
......@@ -42,22 +44,24 @@ struct adau {
bool dsp_bypass[2];
struct regmap *regmap;
struct sigmadsp *sigmadsp;
};
int adau17x1_add_widgets(struct snd_soc_codec *codec);
int adau17x1_add_routes(struct snd_soc_codec *codec);
int adau17x1_probe(struct device *dev, struct regmap *regmap,
enum adau17x1_type type, void (*switch_mode)(struct device *dev));
enum adau17x1_type type, void (*switch_mode)(struct device *dev),
const char *firmware_name);
int adau17x1_set_micbias_voltage(struct snd_soc_codec *codec,
enum adau17x1_micbias_voltage micbias);
bool adau17x1_readable_register(struct device *dev, unsigned int reg);
bool adau17x1_volatile_register(struct device *dev, unsigned int reg);
bool adau17x1_precious_register(struct device *dev, unsigned int reg);
int adau17x1_resume(struct snd_soc_codec *codec);
extern const struct snd_soc_dai_ops adau17x1_dai_ops;
int adau17x1_load_firmware(struct adau *adau, struct device *dev,
const char *firmware);
int adau17x1_setup_firmware(struct adau *adau, unsigned int rate);
bool adau17x1_has_dsp(struct adau *adau);
#define ADAU17X1_CLOCK_CONTROL 0x4000
......
......@@ -6,29 +6,88 @@
* Licensed under the GPL-2 or later.
*/
#include <linux/i2c.h>
#include <linux/export.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <asm/unaligned.h>
#include "sigmadsp.h"
static int sigma_action_write_i2c(void *control_data,
const struct sigma_action *sa, size_t len)
static int sigmadsp_write_i2c(void *control_data,
unsigned int addr, const uint8_t data[], size_t len)
{
uint8_t *buf;
int ret;
buf = kzalloc(2 + len, GFP_KERNEL | GFP_DMA);
if (!buf)
return -ENOMEM;
put_unaligned_be16(addr, buf);
memcpy(buf + 2, data, len);
ret = i2c_master_send(control_data, buf, len + 2);
kfree(buf);
return ret;
}
static int sigmadsp_read_i2c(void *control_data,
unsigned int addr, uint8_t data[], size_t len)
{
return i2c_master_send(control_data, (const unsigned char *)&sa->addr,
len);
struct i2c_client *client = control_data;
struct i2c_msg msgs[2];
uint8_t buf[2];
int ret;
put_unaligned_be16(addr, buf);
msgs[0].addr = client->addr;
msgs[0].len = sizeof(buf);
msgs[0].buf = buf;
msgs[0].flags = 0;
msgs[1].addr = client->addr;
msgs[1].len = len;
msgs[1].buf = data;
msgs[1].flags = I2C_M_RD;
ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
if (ret < 0)
return ret;
else if (ret != ARRAY_SIZE(msgs))
return -EIO;
return 0;
}
int process_sigma_firmware(struct i2c_client *client, const char *name)
/**
* devm_sigmadsp_init_i2c() - Initialize SigmaDSP instance
* @client: The parent I2C device
* @ops: The sigmadsp_ops to use for this instance
* @firmware_name: Name of the firmware file to load
*
* Allocates a SigmaDSP instance and loads the specified firmware file.
*
* Returns a pointer to a struct sigmadsp on success, or a PTR_ERR() on error.
*/
struct sigmadsp *devm_sigmadsp_init_i2c(struct i2c_client *client,
const struct sigmadsp_ops *ops, const char *firmware_name)
{
struct sigma_firmware ssfw;
struct sigmadsp *sigmadsp;
sigmadsp = devm_sigmadsp_init(&client->dev, ops, firmware_name);
if (IS_ERR(sigmadsp))
return sigmadsp;
ssfw.control_data = client;
ssfw.write = sigma_action_write_i2c;
sigmadsp->control_data = client;
sigmadsp->write = sigmadsp_write_i2c;
sigmadsp->read = sigmadsp_read_i2c;
return _process_sigma_firmware(&client->dev, &ssfw, name);
return sigmadsp;
}
EXPORT_SYMBOL(process_sigma_firmware);
EXPORT_SYMBOL_GPL(devm_sigmadsp_init_i2c);
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
MODULE_DESCRIPTION("SigmaDSP I2C firmware loader");
......
......@@ -12,24 +12,48 @@
#include "sigmadsp.h"
static int sigma_action_write_regmap(void *control_data,
const struct sigma_action *sa, size_t len)
static int sigmadsp_write_regmap(void *control_data,
unsigned int addr, const uint8_t data[], size_t len)
{
return regmap_raw_write(control_data, be16_to_cpu(sa->addr),
sa->payload, len - 2);
return regmap_raw_write(control_data, addr,
data, len);
}
int process_sigma_firmware_regmap(struct device *dev, struct regmap *regmap,
const char *name)
static int sigmadsp_read_regmap(void *control_data,
unsigned int addr, uint8_t data[], size_t len)
{
struct sigma_firmware ssfw;
return regmap_raw_read(control_data, addr,
data, len);
}
/**
* devm_sigmadsp_init_i2c() - Initialize SigmaDSP instance
* @dev: The parent device
* @regmap: Regmap instance to use
* @ops: The sigmadsp_ops to use for this instance
* @firmware_name: Name of the firmware file to load
*
* Allocates a SigmaDSP instance and loads the specified firmware file.
*
* Returns a pointer to a struct sigmadsp on success, or a PTR_ERR() on error.
*/
struct sigmadsp *devm_sigmadsp_init_regmap(struct device *dev,
struct regmap *regmap, const struct sigmadsp_ops *ops,
const char *firmware_name)
{
struct sigmadsp *sigmadsp;
sigmadsp = devm_sigmadsp_init(dev, ops, firmware_name);
if (IS_ERR(sigmadsp))
return sigmadsp;
ssfw.control_data = regmap;
ssfw.write = sigma_action_write_regmap;
sigmadsp->control_data = regmap;
sigmadsp->write = sigmadsp_write_regmap;
sigmadsp->read = sigmadsp_read_regmap;
return _process_sigma_firmware(dev, &ssfw, name);
return sigmadsp;
}
EXPORT_SYMBOL(process_sigma_firmware_regmap);
EXPORT_SYMBOL_GPL(devm_sigmadsp_init_regmap);
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
MODULE_DESCRIPTION("SigmaDSP regmap firmware loader");
......
This diff is collapsed.
......@@ -11,31 +11,56 @@
#include <linux/device.h>
#include <linux/regmap.h>
#include <linux/list.h>
struct sigma_action {
u8 instr;
u8 len_hi;
__le16 len;
__be16 addr;
unsigned char payload[];
} __packed;
#include <sound/pcm.h>
struct sigma_firmware {
const struct firmware *fw;
size_t pos;
struct sigmadsp;
struct snd_soc_component;
struct snd_pcm_substream;
struct sigmadsp_ops {
int (*safeload)(struct sigmadsp *sigmadsp, unsigned int addr,
const uint8_t *data, size_t len);
};
struct sigmadsp {
const struct sigmadsp_ops *ops;
struct list_head ctrl_list;
struct list_head data_list;
struct snd_pcm_hw_constraint_list rate_constraints;
unsigned int current_samplerate;
struct snd_soc_component *component;
struct device *dev;
struct mutex lock;
void *control_data;
int (*write)(void *control_data, const struct sigma_action *sa,
size_t len);
int (*write)(void *, unsigned int, const uint8_t *, size_t);
int (*read)(void *, unsigned int, uint8_t *, size_t);
};
int _process_sigma_firmware(struct device *dev,
struct sigma_firmware *ssfw, const char *name);
struct sigmadsp *devm_sigmadsp_init(struct device *dev,
const struct sigmadsp_ops *ops, const char *firmware_name);
void sigmadsp_reset(struct sigmadsp *sigmadsp);
int sigmadsp_restrict_params(struct sigmadsp *sigmadsp,
struct snd_pcm_substream *substream);
struct i2c_client;
extern int process_sigma_firmware(struct i2c_client *client, const char *name);
extern int process_sigma_firmware_regmap(struct device *dev,
struct regmap *regmap, const char *name);
struct sigmadsp *devm_sigmadsp_init_regmap(struct device *dev,
struct regmap *regmap, const struct sigmadsp_ops *ops,
const char *firmware_name);
struct sigmadsp *devm_sigmadsp_init_i2c(struct i2c_client *client,
const struct sigmadsp_ops *ops, const char *firmware_name);
int sigmadsp_attach(struct sigmadsp *sigmadsp,
struct snd_soc_component *component);
int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int rate);
void sigmadsp_reset(struct sigmadsp *sigmadsp);
#endif
......@@ -120,7 +120,8 @@ static int atlas6_codec_enable_and_reset_event(struct snd_soc_dapm_widget *w,
{
#define ATLAS6_CODEC_ENABLE_BITS (1 << 29)
#define ATLAS6_CODEC_RESET_BITS (1 << 28)
struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(w->codec->dev);
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
struct sirf_audio_codec *sirf_audio_codec = snd_soc_codec_get_drvdata(codec);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
enable_and_reset_codec(sirf_audio_codec->regmap,
......@@ -142,7 +143,8 @@ static int prima2_codec_enable_and_reset_event(struct snd_soc_dapm_widget *w,
{
#define PRIMA2_CODEC_ENABLE_BITS (1 << 27)
#define PRIMA2_CODEC_RESET_BITS (1 << 26)
struct sirf_audio_codec *sirf_audio_codec = dev_get_drvdata(w->codec->dev);
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
struct sirf_audio_codec *sirf_audio_codec = snd_soc_codec_get_drvdata(codec);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
enable_and_reset_codec(sirf_audio_codec->regmap,
......
......@@ -867,25 +867,16 @@ static int sn95031_codec_probe(struct snd_soc_codec *codec)
snd_soc_write(codec, SN95031_SSR2, 0x10);
snd_soc_write(codec, SN95031_SSR3, 0x40);
snd_soc_add_codec_controls(codec, sn95031_snd_controls,
ARRAY_SIZE(sn95031_snd_controls));
return 0;
}
static int sn95031_codec_remove(struct snd_soc_codec *codec)
{
pr_debug("codec_remove called\n");
sn95031_set_vaud_bias(codec, SND_SOC_BIAS_OFF);
return 0;
}
static struct snd_soc_codec_driver sn95031_codec = {
.probe = sn95031_codec_probe,
.remove = sn95031_codec_remove,
.set_bias_level = sn95031_set_vaud_bias,
.idle_bias_off = true,
.controls = sn95031_snd_controls,
.num_controls = ARRAY_SIZE(sn95031_snd_controls),
.dapm_widgets = sn95031_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(sn95031_dapm_widgets),
.dapm_routes = sn95031_audio_map,
......
......@@ -232,7 +232,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
static int asoc_simple_card_parse_daifmt(struct device_node *node,
struct simple_card_data *priv,
struct device_node *cpu,
struct device_node *codec,
char *prefix, int idx)
{
......@@ -309,7 +308,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
}
ret = asoc_simple_card_parse_daifmt(node, priv,
cpu, codec, prefix, idx);
codec, prefix, idx);
if (ret < 0)
goto dai_link_of_err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment