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