18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * cs35l32.h -- CS35L32 ALSA SoC audio driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2014 CirrusLogic, Inc.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Author: Brian Austin <brian.austin@cirrus.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef __CS35L32_H__
118c2ecf20Sopenharmony_ci#define __CS35L32_H__
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct cs35l32_platform_data {
148c2ecf20Sopenharmony_ci	/* Low Battery Threshold */
158c2ecf20Sopenharmony_ci	unsigned int batt_thresh;
168c2ecf20Sopenharmony_ci	/* Low Battery Recovery */
178c2ecf20Sopenharmony_ci	unsigned int batt_recov;
188c2ecf20Sopenharmony_ci	/* LED Current Management*/
198c2ecf20Sopenharmony_ci	unsigned int led_mng;
208c2ecf20Sopenharmony_ci	/* Audio Gain w/ LED */
218c2ecf20Sopenharmony_ci	unsigned int audiogain_mng;
228c2ecf20Sopenharmony_ci	/* Boost Management */
238c2ecf20Sopenharmony_ci	unsigned int boost_mng;
248c2ecf20Sopenharmony_ci	/* Data CFG for DUAL device */
258c2ecf20Sopenharmony_ci	unsigned int sdout_datacfg;
268c2ecf20Sopenharmony_ci	/* SDOUT Sharing */
278c2ecf20Sopenharmony_ci	unsigned int sdout_share;
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define CS35L32_CHIP_ID		0x00035A32
318c2ecf20Sopenharmony_ci#define CS35L32_DEVID_AB	0x01	/* Device ID A & B [RO] */
328c2ecf20Sopenharmony_ci#define CS35L32_DEVID_CD	0x02    /* Device ID C & D [RO] */
338c2ecf20Sopenharmony_ci#define CS35L32_DEVID_E		0x03    /* Device ID E [RO] */
348c2ecf20Sopenharmony_ci#define CS35L32_FAB_ID		0x04	/* Fab ID [RO] */
358c2ecf20Sopenharmony_ci#define CS35L32_REV_ID		0x05	/* Revision ID [RO] */
368c2ecf20Sopenharmony_ci#define CS35L32_PWRCTL1		0x06    /* Power Ctl 1 */
378c2ecf20Sopenharmony_ci#define CS35L32_PWRCTL2		0x07    /* Power Ctl 2 */
388c2ecf20Sopenharmony_ci#define CS35L32_CLK_CTL		0x08	/* Clock Ctl */
398c2ecf20Sopenharmony_ci#define CS35L32_BATT_THRESHOLD	0x09	/* Low Battery Threshold */
408c2ecf20Sopenharmony_ci#define CS35L32_VMON		0x0A	/* Voltage Monitor [RO] */
418c2ecf20Sopenharmony_ci#define CS35L32_BST_CPCP_CTL	0x0B	/* Conv Peak Curr Protection CTL */
428c2ecf20Sopenharmony_ci#define CS35L32_IMON_SCALING	0x0C	/* IMON Scaling */
438c2ecf20Sopenharmony_ci#define CS35L32_AUDIO_LED_MNGR	0x0D	/* Audio/LED Pwr Manager */
448c2ecf20Sopenharmony_ci#define CS35L32_ADSP_CTL	0x0F	/* Serial Port Control */
458c2ecf20Sopenharmony_ci#define CS35L32_CLASSD_CTL	0x10	/* Class D Amp CTL */
468c2ecf20Sopenharmony_ci#define CS35L32_PROTECT_CTL	0x11	/* Protection Release CTL */
478c2ecf20Sopenharmony_ci#define CS35L32_INT_MASK_1	0x12	/* Interrupt Mask 1 */
488c2ecf20Sopenharmony_ci#define CS35L32_INT_MASK_2	0x13	/* Interrupt Mask 2 */
498c2ecf20Sopenharmony_ci#define CS35L32_INT_MASK_3	0x14	/* Interrupt Mask 3 */
508c2ecf20Sopenharmony_ci#define CS35L32_INT_STATUS_1	0x15	/* Interrupt Status 1 [RO] */
518c2ecf20Sopenharmony_ci#define CS35L32_INT_STATUS_2	0x16	/* Interrupt Status 2 [RO] */
528c2ecf20Sopenharmony_ci#define CS35L32_INT_STATUS_3	0x17	/* Interrupt Status 3 [RO] */
538c2ecf20Sopenharmony_ci#define CS35L32_LED_STATUS	0x18	/* LED Lighting Status [RO] */
548c2ecf20Sopenharmony_ci#define CS35L32_FLASH_MODE	0x19	/* LED Flash Mode Current */
558c2ecf20Sopenharmony_ci#define CS35L32_MOVIE_MODE	0x1A	/* LED Movie Mode Current */
568c2ecf20Sopenharmony_ci#define CS35L32_FLASH_TIMER	0x1B	/* LED Flash Timer */
578c2ecf20Sopenharmony_ci#define CS35L32_FLASH_INHIBIT	0x1C	/* LED Flash Inhibit Current */
588c2ecf20Sopenharmony_ci#define CS35L32_MAX_REGISTER	0x1C
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define CS35L32_MCLK_DIV2	0x01
618c2ecf20Sopenharmony_ci#define CS35L32_MCLK_RATIO	0x01
628c2ecf20Sopenharmony_ci#define CS35L32_MCLKDIS		0x80
638c2ecf20Sopenharmony_ci#define CS35L32_PDN_ALL		0x01
648c2ecf20Sopenharmony_ci#define CS35L32_PDN_AMP		0x80
658c2ecf20Sopenharmony_ci#define CS35L32_PDN_BOOST	0x04
668c2ecf20Sopenharmony_ci#define CS35L32_PDN_IMON	0x40
678c2ecf20Sopenharmony_ci#define CS35L32_PDN_VMON	0x80
688c2ecf20Sopenharmony_ci#define CS35L32_PDN_VPMON	0x20
698c2ecf20Sopenharmony_ci#define CS35L32_PDN_ADSP	0x08
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define CS35L32_MCLK_DIV2_MASK		0x40
728c2ecf20Sopenharmony_ci#define CS35L32_MCLK_RATIO_MASK		0x01
738c2ecf20Sopenharmony_ci#define CS35L32_MCLK_MASK		0x41
748c2ecf20Sopenharmony_ci#define CS35L32_ADSP_MASTER_MASK	0x40
758c2ecf20Sopenharmony_ci#define CS35L32_BOOST_MASK		0x03
768c2ecf20Sopenharmony_ci#define CS35L32_GAIN_MGR_MASK		0x08
778c2ecf20Sopenharmony_ci#define CS35L32_ADSP_SHARE_MASK		0x08
788c2ecf20Sopenharmony_ci#define CS35L32_ADSP_DATACFG_MASK	0x30
798c2ecf20Sopenharmony_ci#define CS35L32_SDOUT_3ST		0x08
808c2ecf20Sopenharmony_ci#define CS35L32_BATT_REC_MASK		0x0E
818c2ecf20Sopenharmony_ci#define CS35L32_BATT_THRESH_MASK	0x30
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define CS35L32_RATES (SNDRV_PCM_RATE_48000)
848c2ecf20Sopenharmony_ci#define CS35L32_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
858c2ecf20Sopenharmony_ci			SNDRV_PCM_FMTBIT_S24_LE | \
868c2ecf20Sopenharmony_ci			SNDRV_PCM_FMTBIT_S32_LE)
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#endif
90