linux/sound/soc/codecs/sigmadsp.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-or-later */
   2/*
   3 * Load firmware files from Analog Devices SigmaStudio
   4 *
   5 * Copyright 2009-2011 Analog Devices Inc.
   6 */
   7
   8#ifndef __SIGMA_FIRMWARE_H__
   9#define __SIGMA_FIRMWARE_H__
  10
  11#include <linux/device.h>
  12#include <linux/regmap.h>
  13#include <linux/list.h>
  14
  15#include <sound/pcm.h>
  16
  17struct sigmadsp;
  18struct snd_soc_component;
  19struct snd_pcm_substream;
  20
  21struct sigmadsp_ops {
  22        int (*safeload)(struct sigmadsp *sigmadsp, unsigned int addr,
  23                        const uint8_t *data, size_t len);
  24};
  25
  26struct sigmadsp {
  27        const struct sigmadsp_ops *ops;
  28
  29        struct list_head ctrl_list;
  30        struct list_head data_list;
  31
  32        struct snd_pcm_hw_constraint_list rate_constraints;
  33
  34        unsigned int current_samplerate;
  35        struct snd_soc_component *component;
  36        struct device *dev;
  37
  38        struct mutex lock;
  39
  40        void *control_data;
  41        int (*write)(void *, unsigned int, const uint8_t *, size_t);
  42        int (*read)(void *, unsigned int, uint8_t *, size_t);
  43};
  44
  45struct sigmadsp *devm_sigmadsp_init(struct device *dev,
  46        const struct sigmadsp_ops *ops, const char *firmware_name);
  47void sigmadsp_reset(struct sigmadsp *sigmadsp);
  48
  49int sigmadsp_restrict_params(struct sigmadsp *sigmadsp,
  50        struct snd_pcm_substream *substream);
  51
  52struct i2c_client;
  53
  54struct sigmadsp *devm_sigmadsp_init_regmap(struct device *dev,
  55        struct regmap *regmap, const struct sigmadsp_ops *ops,
  56        const char *firmware_name);
  57struct sigmadsp *devm_sigmadsp_init_i2c(struct i2c_client *client,
  58        const struct sigmadsp_ops *ops, const char *firmware_name);
  59
  60int sigmadsp_attach(struct sigmadsp *sigmadsp,
  61        struct snd_soc_component *component);
  62int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int rate);
  63void sigmadsp_reset(struct sigmadsp *sigmadsp);
  64
  65#endif
  66