Path: blob/master/sound/hda/codecs/side-codecs/cs35l41_hda.h
26481 views
/* SPDX-License-Identifier: GPL-2.01*2* CS35L41 ALSA HDA audio driver3*4* Copyright 2021 Cirrus Logic, Inc.5*6* Author: Lucas Tanure <[email protected]>7*/89#ifndef __CS35L41_HDA_H__10#define __CS35L41_HDA_H__1112#include <linux/acpi.h>13#include <linux/efi.h>14#include <linux/regulator/consumer.h>15#include <linux/gpio/consumer.h>16#include <linux/device.h>17#include <sound/cs35l41.h>18#include <sound/cs-amp-lib.h>1920#include <linux/firmware/cirrus/cs_dsp.h>21#include <linux/firmware/cirrus/wmfw.h>2223#define CS35L41_MAX_ACCEPTABLE_SPI_SPEED_HZ 100000024#define DEFAULT_AMP_GAIN_PCM 17 /* 17.5dB Gain */25#define DEFAULT_AMP_GAIN_PDM 19 /* 19.5dB Gain */2627struct cs35l41_amp_cal_data {28u32 calTarget[2];29u32 calTime[2];30s8 calAmbient;31u8 calStatus;32u16 calR;33} __packed;3435struct cs35l41_amp_efi_data {36u32 size;37u32 count;38struct cs35l41_amp_cal_data data[];39} __packed;4041enum cs35l41_hda_spk_pos {42CS35L41_LEFT,43CS35L41_RIGHT,44CS35L41_CENTER,45};4647enum cs35l41_hda_gpio_function {48CS35L41_NOT_USED,49CS35l41_VSPK_SWITCH,50CS35L41_INTERRUPT,51CS35l41_SYNC,52};5354enum control_bus {55I2C,56SPI57};5859struct cs35l41_hda {60struct device *dev;61struct regmap *regmap;62struct gpio_desc *reset_gpio;63struct gpio_desc *cs_gpio;64struct cs35l41_hw_cfg hw_cfg;65struct hda_codec *codec;6667int irq;68int index;69int channel_index;70unsigned volatile long irq_errors;71const char *amp_name;72const char *acpi_subsystem_id;73int firmware_type;74int speaker_id;75struct mutex fw_mutex;76struct work_struct fw_load_work;7778struct regmap_irq_chip_data *irq_data;79bool firmware_running;80bool request_fw_load;81bool fw_request_ongoing;82bool halo_initialized;83bool playback_started;84struct cs_dsp cs_dsp;85struct acpi_device *dacpi;86bool mute_override;87enum control_bus control_bus;88bool bypass_fw;89unsigned int tuning_gain;90struct cirrus_amp_cal_data cal_data;91bool cal_data_valid;9293};9495enum halo_state {96HALO_STATE_CODE_INIT_DOWNLOAD = 0,97HALO_STATE_CODE_START,98HALO_STATE_CODE_RUN99};100101extern const struct dev_pm_ops cs35l41_hda_pm_ops;102103int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,104struct regmap *regmap, enum control_bus control_bus);105void cs35l41_hda_remove(struct device *dev);106int cs35l41_get_speaker_id(struct device *dev, int amp_index, int num_amps, int fixed_gpio_id);107int cs35l41_hda_parse_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id);108109#endif /*__CS35L41_HDA_H__*/110111112