Add i2c shutdown function to prevent the pop sound of the headphone while the system is rebooting or shutdowning
Signed-off-by: Oder Chiou oder_chiou@realtek.com --- sound/soc/codecs/rt5645.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index e5fef8f..4189d5a 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3490,13 +3490,23 @@ static int rt5645_i2c_remove(struct i2c_client *i2c) return 0; }
+static void rt5645_i2c_shutdown(struct i2c_client *i2c) +{ + struct rt5645_priv *rt5645 = i2c_get_clientdata(i2c); + + regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3, 0x0020, 0x0020); + regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 0x1000, 0x1000); + regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1, 0x0004, 0x0000); +} + static struct i2c_driver rt5645_i2c_driver = { .driver = { .name = "rt5645", .acpi_match_table = ACPI_PTR(rt5645_acpi_match), }, .probe = rt5645_i2c_probe, - .remove = rt5645_i2c_remove, + .remove = rt5645_i2c_remove, + .shutdown = rt5645_i2c_shutdown, .id_table = rt5645_i2c_id, }; module_i2c_driver(rt5645_i2c_driver);