| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef __DRIVERS_I2C_CS35L53_CHIP_H__ |
| 4 | #define __DRIVERS_I2C_CS35L53_CHIP_H__ |
| 5 | |
| 6 | #include <acpi/acpi_device.h> |
| 7 | |
| 8 | #define CS35L53_MAX_GPIOS 2 |
| 9 | |
| 10 | enum cs35l53_boost_type { |
| 11 | INTERNAL_BOOST = 0, |
| 12 | EXTERNAL_BOOST = 1, |
| 13 | }; |
| 14 | |
| 15 | enum cs35l53_boost_ind_nanohenrys { |
| 16 | BOOST_IND_1000_NH = 1000, |
| 17 | BOOST_IND_1200_NH = 1200, |
| 18 | BOOST_IND_1500_NH = 1500, |
| 19 | BOOST_IND_2200_NH = 2200, |
| 20 | }; |
| 21 | |
| 22 | enum cs35l53_asp_sdout_hiz { |
| 23 | ASP_SDOUT_LOGIC0_UNUSED_LOGIC0_DISABLED = 0, |
| 24 | ASP_SDOUT_HIZ_UNUSED_LOGIC0_DISABLED = 1, |
| 25 | ASP_SDOUT_LOGIC0_UNUSED_HIZ_DISABLED = 2, |
| 26 | ASP_SDOUT_HIZ_UNUSED_HIZ_DISABLED = 3, |
| 27 | }; |
| 28 | |
| 29 | enum cs35l53_gpio1_src { |
| 30 | GPIO1_SRC_HIGH_IMPEDANCE = 0, |
| 31 | GPIO1_SRC_GPIO = 1, |
| 32 | GPIO1_SRC_SYNC = 2, |
| 33 | GPIO1_SRC_MCLK_INPUT = 3, |
| 34 | }; |
| 35 | |
| 36 | enum cs35l53_gpio2_src { |
| 37 | GPIO2_SRC_HIGH_IMPEDANCE = 0, |
| 38 | GPIO2_SRC_GPIO = 1, |
| 39 | GPIO2_SRC_OPEN_DRAIN = 2, |
| 40 | GPIO2_SRC_MCLK_INPUT = 3, |
| 41 | GPIO2_SRC_PUSH_PULL_INTB = 4, |
| 42 | GPIO2_SRC_PUSH_PULL_INT = 5, |
| 43 | }; |
| 44 | |
| 45 | /* |
| 46 | * Cirrus Logic CS35L53 Audio Codec devicetree bindings |
| 47 | * linux/Documentation/devicetree/bindings/sound/cirrus,cs35l53.yaml |
| 48 | */ |
| 49 | struct drivers_i2c_cs35l53_config { |
| 50 | const char *name; /* ACPI Device Name */ |
| 51 | |
| 52 | const char *sub; /* SUB ID to uniquely identify system */ |
| 53 | |
| 54 | /* Device Description */ |
| 55 | const char *desc; |
| 56 | |
| 57 | /* Identifier for chips */ |
| 58 | uint32_t uid; |
| 59 | |
| 60 | /* Interrupt configuration */ |
| 61 | struct acpi_irq irq; |
| 62 | |
| 63 | /* Use GPIO based interrupt instead of PIRQ */ |
| 64 | struct acpi_gpio irq_gpio; |
| 65 | |
| 66 | /* Use GPIO based reset gpio */ |
| 67 | struct acpi_gpio reset_gpio; |
| 68 | |
| 69 | /* I2C Bus Frequency in Hertz (default 400kHz) */ |
| 70 | unsigned int bus_speed; |
| 71 | |
| 72 | /* Define cs35l53 parameters */ |
| 73 | /* |
| 74 | * cirrus,boost-type : Configures the type of Boost being used. |
| 75 | * Internal boost requires boost-peak-milliamp, boost-ind-nanohenry and |
| 76 | * boost-cap-microfarad. |
| 77 | * External Boost must have GPIO1 as GPIO output. GPIO1 will be set high to |
| 78 | * enable boost voltage. |
| 79 | */ |
| 80 | enum cs35l53_boost_type boost_type; |
| 81 | |
| 82 | /* |
| 83 | * cirrus,boost-peak-milliamp : Boost-converter peak current limit in mA. |
| 84 | * Configures the peak current by monitoring the current through the boost FET. |
| 85 | * Range starts at 1600 mA and goes to a maximum of 4500 mA with increments |
| 86 | * of 50 mA. See section 4.3.6 of the datasheet for details. |
| 87 | */ |
| 88 | unsigned int boost_peak_milliamp; |
| 89 | |
| 90 | /* |
| 91 | * cirrus,boost-ind-nanohenry : Boost inductor value, expressed in nH. Valid |
| 92 | * values include 1000, 1200, 1500 and 2200. |
| 93 | */ |
| 94 | enum cs35l53_boost_ind_nanohenrys boost_ind_nanohenry; |
| 95 | |
| 96 | /* |
| 97 | * cirrus,boost-cap-microfarad : Total equivalent boost capacitance on the VBST |
| 98 | * and VAMP pins, derated at 11 volts DC. The value must be rounded to the |
| 99 | * nearest integer and expressed in uF. |
| 100 | */ |
| 101 | unsigned int boost_cap_microfarad; |
| 102 | |
| 103 | /* |
| 104 | * cirrus,asp-sdout-hiz : Audio serial port SDOUT Hi-Z control. Sets the Hi-Z |
| 105 | * configuration for SDOUT pin of amplifier. |
| 106 | * 0 = Logic 0 during unused slots, and while all transmit channels disabled |
| 107 | * 1 = Hi-Z during unused slots but logic 0 while all transmit channels disabled |
| 108 | * 2 = Logic 0 during unused slots, but Hi-Z while all transmit channels disabled |
| 109 | * 3 = Hi-Z during unused slots and while all transmit channels disabled |
| 110 | */ |
| 111 | enum cs35l53_asp_sdout_hiz asp_sdout_hiz; |
| 112 | |
| 113 | /* |
| 114 | * cirrus,gpio1-polarity-invert : Boolean which specifies whether the GPIO1 |
| 115 | * level is inverted. |
| 116 | */ |
| 117 | bool gpio1_polarity_invert; |
| 118 | |
| 119 | /* |
| 120 | * cirrus,gpio2-polarity-invert : Boolean which specifies whether the GPIO2 |
| 121 | * level is inverted. |
| 122 | */ |
| 123 | bool gpio2_polarity_invert; |
| 124 | |
| 125 | /* |
| 126 | * cirrus,gpio1-output-enable : Boolean which specifies whether the GPIO1 pin |
| 127 | * is configured as an output. |
| 128 | */ |
| 129 | bool gpio1_output_enable; |
| 130 | |
| 131 | /* |
| 132 | * cirrus,gpio2-output-enable : Boolean which specifies whether the GPIO2 pin |
| 133 | * is configured as an output. |
| 134 | */ |
| 135 | bool gpio2_output_enable; |
| 136 | |
| 137 | /* |
| 138 | * cirrus,gpio1-src-select : Configures the function of the GPIO1 pin. |
| 139 | * GPIO1: |
| 140 | * 0 = High Impedance (Default) |
| 141 | * 1 = GPIO |
| 142 | * 2 = Sync |
| 143 | * 3 = MCLK input |
| 144 | */ |
| 145 | enum cs35l53_gpio1_src gpio1_src_select; |
| 146 | |
| 147 | /* |
| 148 | * cirrus,gpio2-src-select : Configures the function of the GPIO2 pin. |
| 149 | * GPIO2: |
| 150 | * 0 = High Impedance (Default) |
| 151 | * 1 = GPIO |
| 152 | * 2 = Open Drain INTB |
| 153 | * 3 = MCLK input |
| 154 | * 4 = Push-pull INTB (active low) |
| 155 | * 5 = Push-pull INT (active high) |
| 156 | */ |
| 157 | enum cs35l53_gpio2_src gpio2_src_select; |
| 158 | }; |
| 159 | |
| 160 | #endif /* __DRIVERS_I2C_CS35L53_CHIP_H__ */ |