Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Load firmware files from Analog Devices SigmaStudio
0004  *
0005  * Copyright 2009-2011 Analog Devices Inc.
0006  */
0007 
0008 #ifndef __SIGMA_FIRMWARE_H__
0009 #define __SIGMA_FIRMWARE_H__
0010 
0011 #include <linux/device.h>
0012 #include <linux/regmap.h>
0013 #include <linux/list.h>
0014 
0015 #include <sound/pcm.h>
0016 
0017 struct sigmadsp;
0018 struct snd_soc_component;
0019 struct snd_pcm_substream;
0020 
0021 struct sigmadsp_ops {
0022     int (*safeload)(struct sigmadsp *sigmadsp, unsigned int addr,
0023             const uint8_t *data, size_t len);
0024 };
0025 
0026 struct sigmadsp {
0027     const struct sigmadsp_ops *ops;
0028 
0029     struct list_head ctrl_list;
0030     struct list_head data_list;
0031 
0032     struct snd_pcm_hw_constraint_list rate_constraints;
0033 
0034     unsigned int current_samplerate;
0035     struct snd_soc_component *component;
0036     struct device *dev;
0037 
0038     struct mutex lock;
0039 
0040     void *control_data;
0041     int (*write)(void *, unsigned int, const uint8_t *, size_t);
0042     int (*read)(void *, unsigned int, uint8_t *, size_t);
0043 };
0044 
0045 struct sigmadsp *devm_sigmadsp_init(struct device *dev,
0046     const struct sigmadsp_ops *ops, const char *firmware_name);
0047 
0048 int sigmadsp_restrict_params(struct sigmadsp *sigmadsp,
0049     struct snd_pcm_substream *substream);
0050 
0051 struct i2c_client;
0052 
0053 struct sigmadsp *devm_sigmadsp_init_regmap(struct device *dev,
0054     struct regmap *regmap, const struct sigmadsp_ops *ops,
0055     const char *firmware_name);
0056 struct sigmadsp *devm_sigmadsp_init_i2c(struct i2c_client *client,
0057     const struct sigmadsp_ops *ops, const char *firmware_name);
0058 
0059 int sigmadsp_attach(struct sigmadsp *sigmadsp,
0060     struct snd_soc_component *component);
0061 int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int samplerate);
0062 void sigmadsp_reset(struct sigmadsp *sigmadsp);
0063 
0064 #endif