1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * CS42L43 core driver external data 4 * 5 * Copyright (C) 2022-2023 Cirrus Logic, Inc. and 6 * Cirrus Logic International Semiconductor Ltd. 7 */ 8 9 #include <linux/completion.h> 10 #include <linux/device.h> 11 #include <linux/gpio/consumer.h> 12 #include <linux/mutex.h> 13 #include <linux/regmap.h> 14 #include <linux/regulator/consumer.h> 15 #include <linux/soundwire/sdw.h> 16 #include <linux/workqueue.h> 17 18 #ifndef CS42L43_CORE_EXT_H 19 #define CS42L43_CORE_EXT_H 20 21 #define CS42L43_N_SUPPLIES 3 22 23 enum cs42l43_irq_numbers { 24 CS42L43_PLL_LOST_LOCK, 25 CS42L43_PLL_READY, 26 27 CS42L43_HP_STARTUP_DONE, 28 CS42L43_HP_SHUTDOWN_DONE, 29 CS42L43_HSDET_DONE, 30 CS42L43_TIPSENSE_UNPLUG_DB, 31 CS42L43_TIPSENSE_PLUG_DB, 32 CS42L43_RINGSENSE_UNPLUG_DB, 33 CS42L43_RINGSENSE_PLUG_DB, 34 CS42L43_TIPSENSE_UNPLUG_PDET, 35 CS42L43_TIPSENSE_PLUG_PDET, 36 CS42L43_RINGSENSE_UNPLUG_PDET, 37 CS42L43_RINGSENSE_PLUG_PDET, 38 39 CS42L43_HS2_BIAS_SENSE, 40 CS42L43_HS1_BIAS_SENSE, 41 CS42L43_DC_DETECT1_FALSE, 42 CS42L43_DC_DETECT1_TRUE, 43 CS42L43_HSBIAS_CLAMPED, 44 CS42L43_HS3_4_BIAS_SENSE, 45 46 CS42L43_AMP2_CLK_STOP_FAULT, 47 CS42L43_AMP1_CLK_STOP_FAULT, 48 CS42L43_AMP2_VDDSPK_FAULT, 49 CS42L43_AMP1_VDDSPK_FAULT, 50 CS42L43_AMP2_SHUTDOWN_DONE, 51 CS42L43_AMP1_SHUTDOWN_DONE, 52 CS42L43_AMP2_STARTUP_DONE, 53 CS42L43_AMP1_STARTUP_DONE, 54 CS42L43_AMP2_THERM_SHDN, 55 CS42L43_AMP1_THERM_SHDN, 56 CS42L43_AMP2_THERM_WARN, 57 CS42L43_AMP1_THERM_WARN, 58 CS42L43_AMP2_SCDET, 59 CS42L43_AMP1_SCDET, 60 61 CS42L43_GPIO3_FALL, 62 CS42L43_GPIO3_RISE, 63 CS42L43_GPIO2_FALL, 64 CS42L43_GPIO2_RISE, 65 CS42L43_GPIO1_FALL, 66 CS42L43_GPIO1_RISE, 67 68 CS42L43_HP_ILIMIT, 69 CS42L43_HP_LOADDET_DONE, 70 }; 71 72 struct cs42l43 { 73 struct device *dev; 74 struct regmap *regmap; 75 struct sdw_slave *sdw; 76 77 struct regulator *vdd_p; 78 struct regulator *vdd_d; 79 struct regulator_bulk_data core_supplies[CS42L43_N_SUPPLIES]; 80 81 struct gpio_desc *reset; 82 83 int irq; 84 struct regmap_irq_chip irq_chip; 85 struct regmap_irq_chip_data *irq_data; 86 87 struct work_struct boot_work; 88 struct completion device_attach; 89 struct completion device_detach; 90 struct completion firmware_download; 91 int firmware_error; 92 93 unsigned int sdw_freq; 94 /* Lock to gate control of the PLL and its sources. */ 95 struct mutex pll_lock; 96 97 bool sdw_pll_active; 98 bool attached; 99 bool hw_lock; 100 }; 101 102 #endif /* CS42L43_CORE_EXT_H */ 103