| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef __DRIVERS_SOUNDWIRE_CS42L42_CHIP_H__ |
| 4 | #define __DRIVERS_SOUNDWIRE_CS42L42_CHIP_H__ |
| 5 | |
| 6 | #include <acpi/acpi.h> |
| 7 | #include<acpi/acpi_device.h> |
| 8 | |
| 9 | enum cs42l42_ts_dbnc_rise { |
| 10 | RISE_DEB_0_MS = 0, |
| 11 | RISE_DEB_125_MS = 1, |
| 12 | RISE_DEB_250_MS = 2, |
| 13 | RISE_DEB_500_MS = 3, |
| 14 | RISE_DEB_750_MS = 4, |
| 15 | RISE_DEB_1000_MS = 5, |
| 16 | RISE_DEB_1250_MS = 6, |
| 17 | RISE_DEB_1500_MS = 7, |
| 18 | }; |
| 19 | enum cs42l42_ts_dbnc_fall { |
| 20 | FALL_DEB_0_MS = 0, |
| 21 | FALL_DEB_125_MS = 1, |
| 22 | FALL_DEB_250_MS = 2, |
| 23 | FALL_DEB_500_MS = 3, |
| 24 | FALL_DEB_750_MS = 4, |
| 25 | FALL_DEB_1000_MS = 5, |
| 26 | FALL_DEB_1250_MS = 6, |
| 27 | FALL_DEB_1500_MS = 7, |
| 28 | }; |
| 29 | enum cs42l42_hs_bias_ramp_rate { |
| 30 | HSBIAS_RAMP_FAST_RISE_SLOW_FALL = 0, |
| 31 | HSBIAS_RAMP_FAST = 1, |
| 32 | HSBIAS_RAMP_SLOW = 2, |
| 33 | HSBIAS_RAMP_SLOWEST = 3, |
| 34 | }; |
| 35 | |
| 36 | struct drivers_soundwire_cs42l42_config { |
| 37 | char acpi_name[ACPI_NAME_BUFFER_SIZE]; /* Set by the acpi_name ops */ |
| 38 | const char *desc; |
| 39 | |
| 40 | /* Interrupt configuration */ |
| 41 | struct acpi_irq irq; |
| 42 | /* Use GPIO based interrupt instead of PIRQ */ |
| 43 | struct acpi_gpio irq_gpio; |
| 44 | /* Use GPIO based reset gpio */ |
| 45 | struct acpi_gpio reset_gpio; |
| 46 | /* Define cs42L42 parameters */ |
| 47 | /* |
| 48 | * cirrus,ts-inv : Boolean property. For jacks that invert the tip sense |
| 49 | * polarity. Normal jacks will short tip sense pin to HS1 when headphones are |
| 50 | * plugged in and leave tip sense floating when not plugged in. Inverting jacks |
| 51 | * short tip sense when unplugged and float when plugged in. |
| 52 | * false = Non-inverted |
| 53 | * true = Inverted |
| 54 | * Default = Non-inverted |
| 55 | */ |
| 56 | bool ts_inv; |
| 57 | /* |
| 58 | * cirrus,ts-dbnc-rise : Debounce the rising edge of TIP_SENSE_PLUG. With no |
| 59 | * debounce, the tip sense pin might be noisy on a plug event. |
| 60 | * Default = RISE_DEB_1000_MS |
| 61 | */ |
| 62 | enum cs42l42_ts_dbnc_rise ts_dbnc_rise; |
| 63 | /* |
| 64 | * cirrus,ts-dbnc-fall : Debounce the falling edge of TIP_SENSE_UNPLUG. |
| 65 | * With no debounce, the tip sense pin might be noisy on an unplug event. |
| 66 | * Default = FALL_DEB_1000_MS |
| 67 | */ |
| 68 | enum cs42l42_ts_dbnc_fall ts_dbnc_fall; |
| 69 | /* |
| 70 | * cirrus,btn-det-init-dbnce : This sets how long the driver sleeps after |
| 71 | * enabling button detection interrupts. After auto-detection and before |
| 72 | * servicing button interrupts, the HS bias needs time to settle. If you |
| 73 | * don't wait, there is possibility for erroneous button interrupt. |
| 74 | * Value in ms, 0 - 200. |
| 75 | * Default = 100ms |
| 76 | */ |
| 77 | unsigned int btn_det_init_dbnce; |
| 78 | /* |
| 79 | * cirrus,btn-det-event-dbnce : This sets how long the driver delays after |
| 80 | * receiving a button press interrupt. With level detect interrupts, you want |
| 81 | * to wait a small amount of time to make sure the button press is making a |
| 82 | * clean connection with the bias resistors. |
| 83 | * Value in ms, 0 - 20. |
| 84 | * Default = 10ms |
| 85 | */ |
| 86 | unsigned int btn_det_event_dbnce; |
| 87 | /* |
| 88 | * cirrus,bias-lvls : For a level-detect headset button scheme, each button |
| 89 | * will bias the mic pin to a certain voltage. To determine which button was |
| 90 | * pressed, the driver will compare this biased voltage to sequential, |
| 91 | * decreasing voltages and will stop when a comparator is tripped, |
| 92 | * indicating a comparator voltage < bias voltage. This value represents a |
| 93 | * percentage of the internally generated HS bias voltage. For different |
| 94 | * hardware setups, a designer might want to tweak this. This is an array of |
| 95 | * descending values for the comparator voltage. |
| 96 | * Array of 4 values |
| 97 | * Each 0-63 |
| 98 | * < x1 x2 x3 x4 > |
| 99 | * Default = < 15 8 4 1> |
| 100 | */ |
| 101 | uint64_t bias_lvls[4]; |
| 102 | /* headset bias ramp rate */ |
| 103 | enum cs42l42_hs_bias_ramp_rate hs_bias_ramp_rate; |
| 104 | /* |
| 105 | * cirrus,hs-bias-sense-disable: This is boolean property. If present the |
| 106 | * HSBIAS sense is disabled. Configures HSBIAS output current sense through |
| 107 | * the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce |
| 108 | * the potential pop noise during the headset plug out slowly. But on some |
| 109 | * platforms ESD voltage will affect it causing test to fail, especially |
| 110 | * with CTIA headset type. For different hardware setups, a designer might |
| 111 | * want to tweak default behavior. |
| 112 | */ |
| 113 | bool hs_bias_sense_disable; |
| 114 | }; |
| 115 | |
| 116 | #endif /* __DRIVERS_SOUNDWIRE_CS42L42_CHIP_H__ */ |