2011-03-23 07:34:40 +08:00
|
|
|
/*
|
|
|
|
* Load firmware files from Analog Devices SigmaStudio
|
|
|
|
*
|
|
|
|
* Copyright 2009-2011 Analog Devices Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the GPL-2 or later.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SIGMA_FIRMWARE_H__
|
|
|
|
#define __SIGMA_FIRMWARE_H__
|
|
|
|
|
2011-11-28 16:44:20 +08:00
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/regmap.h>
|
2014-11-20 01:29:05 +08:00
|
|
|
#include <linux/list.h>
|
2011-11-28 16:44:20 +08:00
|
|
|
|
2014-11-20 01:29:05 +08:00
|
|
|
#include <sound/pcm.h>
|
2014-06-06 20:09:17 +08:00
|
|
|
|
2014-11-20 01:29:05 +08:00
|
|
|
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;
|
|
|
|
|
2014-11-20 01:29:06 +08:00
|
|
|
struct list_head ctrl_list;
|
2014-11-20 01:29:05 +08:00
|
|
|
struct list_head data_list;
|
|
|
|
|
2014-11-20 01:29:06 +08:00
|
|
|
struct snd_pcm_hw_constraint_list rate_constraints;
|
|
|
|
|
2014-11-20 01:29:05 +08:00
|
|
|
unsigned int current_samplerate;
|
|
|
|
struct snd_soc_component *component;
|
|
|
|
struct device *dev;
|
2014-06-06 20:09:17 +08:00
|
|
|
|
2014-11-20 01:29:06 +08:00
|
|
|
struct mutex lock;
|
|
|
|
|
2014-06-06 20:09:17 +08:00
|
|
|
void *control_data;
|
2014-11-20 01:29:05 +08:00
|
|
|
int (*write)(void *, unsigned int, const uint8_t *, size_t);
|
2014-11-20 01:29:06 +08:00
|
|
|
int (*read)(void *, unsigned int, uint8_t *, size_t);
|
2014-06-06 20:09:17 +08:00
|
|
|
};
|
|
|
|
|
2014-11-20 01:29:05 +08:00
|
|
|
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);
|
2014-06-06 20:09:17 +08:00
|
|
|
|
2011-03-23 07:34:40 +08:00
|
|
|
struct i2c_client;
|
|
|
|
|
2014-11-20 01:29:05 +08:00
|
|
|
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);
|
2011-03-23 07:34:40 +08:00
|
|
|
|
|
|
|
#endif
|