0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __CS35L41_HDA_H__
0011 #define __CS35L41_HDA_H__
0012
0013 #include <linux/efi.h>
0014 #include <linux/regulator/consumer.h>
0015 #include <linux/gpio/consumer.h>
0016 #include <linux/device.h>
0017 #include <sound/cs35l41.h>
0018
0019 #include <linux/firmware/cirrus/cs_dsp.h>
0020 #include <linux/firmware/cirrus/wmfw.h>
0021
0022 struct cs35l41_amp_cal_data {
0023 u32 calTarget[2];
0024 u32 calTime[2];
0025 s8 calAmbient;
0026 u8 calStatus;
0027 u16 calR;
0028 } __packed;
0029
0030 struct cs35l41_amp_efi_data {
0031 u32 size;
0032 u32 count;
0033 struct cs35l41_amp_cal_data data[];
0034 } __packed;
0035
0036 enum cs35l41_hda_spk_pos {
0037 CS35l41_LEFT,
0038 CS35l41_RIGHT,
0039 };
0040
0041 enum cs35l41_hda_gpio_function {
0042 CS35L41_NOT_USED,
0043 CS35l41_VSPK_SWITCH,
0044 CS35L41_INTERRUPT,
0045 CS35l41_SYNC,
0046 };
0047
0048 struct cs35l41_hda {
0049 struct device *dev;
0050 struct regmap *regmap;
0051 struct gpio_desc *reset_gpio;
0052 struct cs35l41_hw_cfg hw_cfg;
0053 struct hda_codec *codec;
0054
0055 int irq;
0056 int index;
0057 int channel_index;
0058 unsigned volatile long irq_errors;
0059 const char *amp_name;
0060 const char *acpi_subsystem_id;
0061 int firmware_type;
0062 int speaker_id;
0063 struct mutex fw_mutex;
0064 struct work_struct fw_load_work;
0065
0066 struct regmap_irq_chip_data *irq_data;
0067 bool firmware_running;
0068 bool request_fw_load;
0069 bool fw_request_ongoing;
0070 bool halo_initialized;
0071 bool playback_started;
0072 struct cs_dsp cs_dsp;
0073 };
0074
0075 enum halo_state {
0076 HALO_STATE_CODE_INIT_DOWNLOAD = 0,
0077 HALO_STATE_CODE_START,
0078 HALO_STATE_CODE_RUN
0079 };
0080
0081 extern const struct dev_pm_ops cs35l41_hda_pm_ops;
0082
0083 int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
0084 struct regmap *regmap);
0085 void cs35l41_hda_remove(struct device *dev);
0086
0087 #endif