mirror of https://gitee.com/openkylin/linux.git
ASoC: rt5645: add inv_hp_det flag
The ECS EF20EA laptop use gpio for jack detection instead of rt5645 rt5645 JD. However, the GPIO polarity is inverse for hp-detect based on the _DSD property of the RTK2 device. Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () {"hp-detect-gpio", Package() {^RTK2, 0, 0, 1 }}, } }) This flag will invert the hp-detect gpio polarity. Signed-off-by: Chris Chiu <chiu@endlessos.org> Link: https://lore.kernel.org/r/20210111054141.4668-4-chiu@endlessos.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
a4dae468cf
commit
28c988492c
|
@ -22,6 +22,8 @@ struct rt5645_platform_data {
|
|||
bool level_trigger_irq;
|
||||
/* Invert JD1_1 status polarity */
|
||||
bool inv_jd1_1;
|
||||
/* Invert HP detect status polarity */
|
||||
bool inv_hp_pol;
|
||||
|
||||
/* Value to asign to snd_soc_card.long_name */
|
||||
const char *long_name;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#define QUIRK_INV_JD1_1(q) ((q) & 1)
|
||||
#define QUIRK_LEVEL_IRQ(q) (((q) >> 1) & 1)
|
||||
#define QUIRK_IN2_DIFF(q) (((q) >> 2) & 1)
|
||||
#define QUIRK_INV_HP_POL(q) (((q) >> 3) & 1)
|
||||
#define QUIRK_JD_MODE(q) (((q) >> 4) & 7)
|
||||
#define QUIRK_DMIC1_DATA_PIN(q) (((q) >> 8) & 3)
|
||||
#define QUIRK_DMIC2_DATA_PIN(q) (((q) >> 12) & 3)
|
||||
|
@ -3246,6 +3247,8 @@ static void rt5645_jack_detect_work(struct work_struct *work)
|
|||
case 0: /* Not using rt5645 JD */
|
||||
if (rt5645->gpiod_hp_det) {
|
||||
gpio_state = gpiod_get_value(rt5645->gpiod_hp_det);
|
||||
if (rt5645->pdata.inv_hp_pol)
|
||||
gpio_state ^= 1;
|
||||
dev_dbg(rt5645->component->dev, "gpio_state = %d\n",
|
||||
gpio_state);
|
||||
report = rt5645_jack_detect(rt5645->component, gpio_state);
|
||||
|
@ -3855,6 +3858,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
|
|||
rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk);
|
||||
rt5645->pdata.level_trigger_irq = QUIRK_LEVEL_IRQ(quirk);
|
||||
rt5645->pdata.inv_jd1_1 = QUIRK_INV_JD1_1(quirk);
|
||||
rt5645->pdata.inv_hp_pol = QUIRK_INV_HP_POL(quirk);
|
||||
rt5645->pdata.jd_mode = QUIRK_JD_MODE(quirk);
|
||||
rt5645->pdata.dmic1_data_pin = QUIRK_DMIC1_DATA_PIN(quirk);
|
||||
rt5645->pdata.dmic2_data_pin = QUIRK_DMIC2_DATA_PIN(quirk);
|
||||
|
|
Loading…
Reference in New Issue