2021-12-17 11:57:05 +00:00
/* SPDX-License-Identifier: GPL-2.0
*
2022-01-17 16:08:30 +00:00
* CS35L41 ALSA HDA audio driver
2021-12-17 11:57:05 +00:00
*
* Copyright 2021 Cirrus Logic , Inc .
*
* Author : Lucas Tanure < tanureal @ opensource . cirrus . com >
*/
# ifndef __CS35L41_HDA_H__
# define __CS35L41_HDA_H__
2022-06-30 01:23:31 +01:00
# include <linux/efi.h>
2021-12-17 11:57:05 +00:00
# include <linux/regulator/consumer.h>
# include <linux/gpio/consumer.h>
# include <linux/device.h>
# include <sound/cs35l41.h>
2022-06-30 01:23:25 +01:00
# include <linux/firmware/cirrus/cs_dsp.h>
# include <linux/firmware/cirrus/wmfw.h>
2022-06-30 01:23:31 +01:00
struct cs35l41_amp_cal_data {
u32 calTarget [ 2 ] ;
u32 calTime [ 2 ] ;
s8 calAmbient ;
u8 calStatus ;
u16 calR ;
} __packed ;
struct cs35l41_amp_efi_data {
u32 size ;
u32 count ;
struct cs35l41_amp_cal_data data [ ] ;
} __packed ;
2021-12-17 11:57:05 +00:00
enum cs35l41_hda_spk_pos {
CS35l41_LEFT ,
CS35l41_RIGHT ,
} ;
enum cs35l41_hda_gpio_function {
CS35L41_NOT_USED ,
CS35l41_VSPK_SWITCH ,
CS35L41_INTERRUPT ,
CS35l41_SYNC ,
} ;
struct cs35l41_hda {
struct device * dev ;
struct regmap * regmap ;
struct gpio_desc * reset_gpio ;
2022-04-13 09:37:13 +01:00
struct cs35l41_hw_cfg hw_cfg ;
2022-06-30 01:23:24 +01:00
struct hda_codec * codec ;
2021-12-17 11:57:05 +00:00
int irq ;
int index ;
2022-05-09 22:46:46 +01:00
int channel_index ;
2022-05-09 22:46:41 +01:00
unsigned volatile long irq_errors ;
2022-05-09 22:46:46 +01:00
const char * amp_name ;
2022-06-30 01:23:26 +01:00
const char * acpi_subsystem_id ;
2022-06-30 01:23:34 +01:00
int firmware_type ;
2022-06-30 01:23:29 +01:00
int speaker_id ;
2022-06-30 01:23:25 +01:00
struct mutex fw_mutex ;
2022-06-30 01:23:34 +01:00
struct work_struct fw_load_work ;
2022-05-09 22:46:41 +01:00
struct regmap_irq_chip_data * irq_data ;
2022-06-30 01:23:25 +01:00
bool firmware_running ;
2022-06-30 01:23:34 +01:00
bool request_fw_load ;
bool fw_request_ongoing ;
2022-06-30 01:23:25 +01:00
bool halo_initialized ;
2022-06-30 01:23:34 +01:00
bool playback_started ;
2022-06-30 01:23:25 +01:00
struct cs_dsp cs_dsp ;
} ;
enum halo_state {
HALO_STATE_CODE_INIT_DOWNLOAD = 0 ,
HALO_STATE_CODE_START ,
HALO_STATE_CODE_RUN
2021-12-17 11:57:05 +00:00
} ;
2022-06-30 01:23:30 +01:00
extern const struct dev_pm_ops cs35l41_hda_pm_ops ;
2021-12-17 11:57:05 +00:00
int cs35l41_hda_probe ( struct device * dev , const char * device_name , int id , int irq ,
struct regmap * regmap ) ;
2022-01-17 23:00:55 +01:00
void cs35l41_hda_remove ( struct device * dev ) ;
2021-12-17 11:57:05 +00:00
# endif /*__CS35L41_HDA_H__*/