summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/es8323.h
diff options
context:
space:
mode:
authorKees Cook <kees+treewide@kernel.org>2026-09-02 15:31:14 -0700
committerKees Cook <kees@kernel.org>2026-09-04 21:37:00 -0700
commit3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d (patch)
treec65086f9bdcd48c6360fb7cb4598bca084da1f32 /sound/soc/codecs/es8323.h
downloadlinux-stable-3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d.tar.gz
linux-stable-3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d.zip
treewide: refresh kmalloc_obj() conversionsgrafted
This is another run of the Coccinelle script for converting kmalloc() family of allocations to kmalloc_obj() via the existing rules in scripts/coccinelle/api/kmalloc_objs.cocci This catches both the set of kmalloc() uses added since the first kmalloc_obj() conversions in v7.0 and adds a large group missed in the first pass due to Coccinelle not interacting well with the cleanup.h scoped_...() family of macros[1]. I worked around this with spatch's "--macro-file" argument to a file with all the scoped_...() macros mapped to Coccinelle's YACFE_ITERATOR[2] as that was the closest viable control flow indicator I could find. Build tested allmodconfig on x86, arm64, arm, loongarch, mips, powerpc, riscv, and s390 with no new warnings. Link: https://lore.kernel.org/lkml/202609021314.8A9C0B8@keescook/ [1] Link: https://github.com/coccinelle/coccinelle/blob/master/standard.h [2] Signed-off-by: Kees Cook <kees+treewide@kernel.org>
Diffstat (limited to 'sound/soc/codecs/es8323.h')
-rw-r--r--sound/soc/codecs/es8323.h171
1 files changed, 171 insertions, 0 deletions
diff --git a/sound/soc/codecs/es8323.h b/sound/soc/codecs/es8323.h
new file mode 100644
index 000000000..6e37e0480
--- /dev/null
+++ b/sound/soc/codecs/es8323.h
@@ -0,0 +1,171 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright Openedhand Ltd.
+ *
+ * Author: Richard Purdie <richard@openedhand.com>
+ * Binbin Zhou <zhoubinbin@loongson.cn>
+ *
+ */
+
+#ifndef _ES8323_H
+#define _ES8323_H
+
+/* ES8323 register space */
+
+/* Chip Control and Power Management */
+#define ES8323_CONTROL1 0x00
+#define ES8323_CONTROL2 0x01
+#define ES8323_CHIPPOWER 0x02
+
+#define ES8323_CHIPPOWER_DACVREF_OFF 0
+#define ES8323_CHIPPOWER_ADCVREF_OFF 1
+#define ES8323_CHIPPOWER_DACDLL_OFF 2
+#define ES8323_CHIPPOWER_ADCDLL_OFF 3
+#define ES8323_CHIPPOWER_DACSTM_RESET 4
+#define ES8323_CHIPPOWER_ADCSTM_RESET 5
+#define ES8323_CHIPPOWER_DACDIG_OFF 6
+#define ES8323_CHIPPOWER_ADCDIG_OFF 7
+
+#define ES8323_ADCPOWER 0x03
+
+#define ES8323_ADCPOWER_INT1LP BIT(0)
+#define ES8323_ADCPOWER_FLASHLP BIT(1)
+#define ES8323_ADCPOWER_PDNADCBIS BIT(2)
+#define ES8323_ADCPOWER_PDNMICB BIT(3)
+
+#define ES8323_ADCPOWER_PDNADCBIS_OFF 2
+#define ES8323_ADCPOWER_PDNMICB_OFF 3
+#define ES8323_ADCPOWER_PDNADCR_OFF 4
+#define ES8323_ADCPOWER_PDNADCL_OFF 5
+#define ES8323_ADCPOWER_PDNAINR_OFF 6
+#define ES8323_ADCPOWER_PDNAINL_OFF 7
+
+#define ES8323_DACPOWER 0x04
+
+#define ES8323_DACPOWER_ROUT2_OFF 2
+#define ES8323_DACPOWER_LOUT2_OFF 3
+#define ES8323_DACPOWER_ROUT1_OFF 4
+#define ES8323_DACPOWER_LOUT1_OFF 5
+#define ES8323_DACPOWER_PDNDACR_OFF 6
+#define ES8323_DACPOWER_PDNDACL_OFF 7
+
+#define ES8323_CHIPLOPOW1 0x05
+#define ES8323_CHIPLOPOW2 0x06
+#define ES8323_ANAVOLMANAG 0x07
+#define ES8323_MASTERMODE 0x08
+
+#define ES8323_MASTERMODE_BCLKDIV GENMASK(4, 0)
+#define ES8323_MASTERMODE_BCLKINV BIT(5)
+#define ES8323_MASTERMODE_MCLKDIV2 BIT(6)
+#define ES8323_MASTERMODE_MSC BIT(7)
+
+/* ADC Control */
+#define ES8323_ADCCONTROL1 0x09
+
+#define ES8323_ADCCONTROL1_MICAMPR_OFF 0
+#define ES8323_ADCCONTROL1_MICAMPL_OFF 4
+
+#define ES8323_ADCCONTROL2 0x0a
+#define ES8323_ADCCONTROL3 0x0b
+#define ES8323_ADCCONTROL4 0x0c
+
+#define ES8323_ADCCONTROL4_ADCFORMAT GENMASK(1, 0)
+#define ES8323_FMT_I2S 0x0
+#define ES8323_FMT_LEFT_J 0x1
+#define ES8323_FMT_RIGHT_J 0x2
+#define ES8323_FMT_DSP 0x3
+#define ES8323_ADCCONTROL4_ADCWL GENMASK(4, 2)
+#define ES8323_S24_LE 0x0
+#define ES8323_S20_LE 0x1
+#define ES8323_S18_LE 0x2
+#define ES8323_S16_LE 0x3
+#define ES8323_S32_LE 0x4
+#define ES8323_ADCCONTROL4_ADCLRP BIT(5)
+#define ES8323_ADCCONTROL4_DATSEL GENMASK(7, 6)
+
+#define ES8323_ADCCONTROL5 0x0d
+
+#define ES8323_ADCCONTROL5_ADCFSRATIO GENMASK(4, 0)
+#define ES8323_ADCCONTROL5_ADCFSMODE BIT(5)
+#define ES8323_ADCCONTROL5_ADCFS_MASK (ES8323_ADCCONTROL5_ADCFSRATIO |\
+ ES8323_ADCCONTROL5_ADCFSMODE)
+
+#define ES8323_ADCCONTROL6 0x0e
+#define ES8323_ADCCONTROL7 0x0f
+
+#define ES8323_ADCCONTROL7_ADCMUTE_OFF 2
+
+#define ES8323_LADC_VOL 0x10
+#define ES8323_RADC_VOL 0x11
+#define ES8323_ADCCONTROL10 0x12
+#define ES8323_ADCCONTROL11 0x13
+#define ES8323_ADCCONTROL12 0x14
+
+#define ES8323_ADCCONTROL12_ALCATK_OFF 0
+#define ES8323_ADCCONTROL12_ALCDCY_OFF 4
+
+#define ES8323_ADCCONTROL13 0x15
+
+#define ES8323_ADCCONTROL13_TIMEOUT_OFF 5
+#define ES8323_ADCCONTROL13_ALCZC_OFF 6
+
+#define ES8323_ADCCONTROL14 0x16
+
+#define ES8323_ADCCONTROL14_NGAT_OFF 0
+#define ES8323_ADCCONTROL14_NGG_OFF 1
+#define ES8323_ADCCONTROL14_NGTH_OFF 3
+
+/* DAC Control */
+#define ES8323_DACCONTROL1 0x17
+
+#define ES8323_DACCONTROL1_DACFORMAT GENMASK(1, 0)
+#define ES8323_DACCONTROL1_DACWL GENMASK(5, 3)
+#define ES8323_DACCONTROL1_DACLRP BIT(6)
+#define ES8323_DACCONTROL1_DACLRSWAP BIT(7)
+
+#define ES8323_DACCONTROL2 0x18
+
+#define ES8323_DACCONTROL2_DACFSRATIO GENMASK(4, 0)
+#define ES8323_DACCONTROL2_DACFSMODE BIT(5)
+#define ES8323_DACCONTROL2_DACFS_MASK (ES8323_DACCONTROL2_DACFSRATIO |\
+ ES8323_DACCONTROL2_DACFSMODE)
+
+#define ES8323_DACCONTROL3 0x19
+
+#define ES8323_DACCONTROL3_DACMUTE BIT(2)
+
+#define ES8323_LDAC_VOL 0x1a
+#define ES8323_RDAC_VOL 0x1b
+#define ES8323_DACCONTROL6 0x1c
+#define ES8323_DACCONTROL7 0x1d
+#define ES8323_DACCONTROL8 0x1e
+#define ES8323_DACCONTROL9 0x1f
+#define ES8323_DACCONTROL10 0x20
+#define ES8323_DACCONTROL11 0x21
+#define ES8323_DACCONTROL12 0x22
+#define ES8323_DACCONTROL13 0x23
+#define ES8323_DACCONTROL14 0x24
+#define ES8323_DACCONTROL15 0x25
+#define ES8323_DACCONTROL16 0x26
+#define ES8323_DACCONTROL17 0x27
+
+#define ES8323_DACCONTROL17_LI2LOVOL_OFF 3
+
+#define ES8323_DACCONTROL18 0x28
+#define ES8323_DACCONTROL19 0x29
+#define ES8323_DACCONTROL20 0x2a
+
+#define ES8323_DACCONTROL20_RI2ROVOL_OFF 3
+
+#define ES8323_DACCONTROL21 0x2b
+#define ES8323_DACCONTROL22 0x2c
+#define ES8323_DACCONTROL23 0x2d
+#define ES8323_LOUT1_VOL 0x2e
+#define ES8323_ROUT1_VOL 0x2f
+#define ES8323_LOUT2_VOL 0x30
+#define ES8323_ROUT2_VOL 0x31
+#define ES8323_DACCONTROL28 0x32
+#define ES8323_DACCONTROL29 0x33
+#define ES8323_DACCONTROL30 0x34
+
+#endif