16450ef55SDavid Rhodes /* SPDX-License-Identifier: GPL-2.0 26450ef55SDavid Rhodes * 36450ef55SDavid Rhodes * cs35l41.h -- CS35L41 ALSA SoC audio driver 46450ef55SDavid Rhodes * 56450ef55SDavid Rhodes * Copyright 2017-2021 Cirrus Logic, Inc. 66450ef55SDavid Rhodes * 76450ef55SDavid Rhodes * Author: David Rhodes <david.rhodes@cirrus.com> 86450ef55SDavid Rhodes */ 96450ef55SDavid Rhodes 106450ef55SDavid Rhodes #ifndef __CS35L41_H__ 116450ef55SDavid Rhodes #define __CS35L41_H__ 126450ef55SDavid Rhodes 136450ef55SDavid Rhodes #include <linux/gpio/consumer.h> 146450ef55SDavid Rhodes #include <linux/regulator/consumer.h> 15bae9e13fSDavid Rhodes #include <linux/firmware.h> 166450ef55SDavid Rhodes #include <sound/core.h> 176450ef55SDavid Rhodes #include <sound/cs35l41.h> 186450ef55SDavid Rhodes 19bae9e13fSDavid Rhodes #include "wm_adsp.h" 20bae9e13fSDavid Rhodes 216450ef55SDavid Rhodes #define CS35L41_RX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) 226450ef55SDavid Rhodes #define CS35L41_TX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) 236450ef55SDavid Rhodes 24f517ba49SCharles Keepax extern const struct dev_pm_ops cs35l41_pm_ops; 25f517ba49SCharles Keepax 26bae9e13fSDavid Rhodes enum cs35l41_cspl_mbox_status { 27bae9e13fSDavid Rhodes CSPL_MBOX_STS_RUNNING = 0, 28bae9e13fSDavid Rhodes CSPL_MBOX_STS_PAUSED = 1, 29bae9e13fSDavid Rhodes CSPL_MBOX_STS_RDY_FOR_REINIT = 2, 30bae9e13fSDavid Rhodes }; 31bae9e13fSDavid Rhodes 32bae9e13fSDavid Rhodes enum cs35l41_cspl_mbox_cmd { 33bae9e13fSDavid Rhodes CSPL_MBOX_CMD_NONE = 0, 34bae9e13fSDavid Rhodes CSPL_MBOX_CMD_PAUSE = 1, 35bae9e13fSDavid Rhodes CSPL_MBOX_CMD_RESUME = 2, 36bae9e13fSDavid Rhodes CSPL_MBOX_CMD_REINIT = 3, 37bae9e13fSDavid Rhodes CSPL_MBOX_CMD_STOP_PRE_REINIT = 4, 38f517ba49SCharles Keepax CSPL_MBOX_CMD_HIBERNATE = 5, 39f517ba49SCharles Keepax CSPL_MBOX_CMD_OUT_OF_HIBERNATE = 6, 40bae9e13fSDavid Rhodes CSPL_MBOX_CMD_UNKNOWN_CMD = -1, 41bae9e13fSDavid Rhodes CSPL_MBOX_CMD_INVALID_SEQUENCE = -2, 42bae9e13fSDavid Rhodes }; 43bae9e13fSDavid Rhodes 446450ef55SDavid Rhodes struct cs35l41_private { 45bae9e13fSDavid Rhodes struct wm_adsp dsp; /* needs to be first member */ 466450ef55SDavid Rhodes struct snd_soc_codec *codec; 47*f7f20737SLucas Tanure struct cs35l41_hw_cfg hw_cfg; 486450ef55SDavid Rhodes struct device *dev; 496450ef55SDavid Rhodes struct regmap *regmap; 506450ef55SDavid Rhodes struct regulator_bulk_data supplies[CS35L41_NUM_SUPPLIES]; 516450ef55SDavid Rhodes int irq; 526450ef55SDavid Rhodes /* GPIO for /RST */ 536450ef55SDavid Rhodes struct gpio_desc *reset_gpio; 546450ef55SDavid Rhodes }; 556450ef55SDavid Rhodes 56*f7f20737SLucas Tanure int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *hw_cfg); 57ca7270a7SUwe Kleine-König void cs35l41_remove(struct cs35l41_private *cs35l41); 586450ef55SDavid Rhodes 596450ef55SDavid Rhodes #endif /*__CS35L41_H__*/ 60