Skip to content

Commit a319cb3

Browse files
Fabio Estevambroonie
authored andcommitted
ASoC: cs4265: Add a remove() function
When the reset_gpio GPIO is used, it is better to put the codec back into reset state when the driver unbinds. Add a remove() function to accomplish that. Suggested-by: Charles Keepax <[email protected]> Signed-off-by: Fabio Estevam <[email protected]> Acked-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 9f3d453 commit a319cb3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sound/soc/codecs/cs4265.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,16 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client,
626626
ARRAY_SIZE(cs4265_dai));
627627
}
628628

629+
static int cs4265_i2c_remove(struct i2c_client *i2c)
630+
{
631+
struct cs4265_private *cs4265 = i2c_get_clientdata(i2c);
632+
633+
if (cs4265->reset_gpio)
634+
gpiod_set_value_cansleep(cs4265->reset_gpio, 0);
635+
636+
return 0;
637+
}
638+
629639
static const struct of_device_id cs4265_of_match[] = {
630640
{ .compatible = "cirrus,cs4265", },
631641
{ }
@@ -645,6 +655,7 @@ static struct i2c_driver cs4265_i2c_driver = {
645655
},
646656
.id_table = cs4265_id,
647657
.probe = cs4265_i2c_probe,
658+
.remove = cs4265_i2c_remove,
648659
};
649660

650661
module_i2c_driver(cs4265_i2c_driver);

0 commit comments

Comments
 (0)