Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions sound/soc/codecs/aw87xxx/aw87xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,44 @@ static void aw87xxx_i2c_shutdown(struct i2c_client *client)
aw87xxx_update_profile(aw87xxx, aw87xxx->prof_off_name);
}


static int aw87xxx_runtime_suspend(struct device *dev)
{
struct aw87xxx *aw87xxx = dev_get_drvdata(dev);

AW_DEV_LOGI(aw87xxx->dev, "Suspending...");

// soft and hw power off
aw87xxx_update_profile(aw87xxx, aw87xxx->prof_off_name);

return 0;
}

static int aw87xxx_runtime_resume(struct device *dev)
{
struct list_head *pos = NULL;
struct aw87xxx *aw87xxx = dev_get_drvdata(dev);

// Power on PA
if (aw87xxx->dev_index == 1)
aw87xxx_dev_hw_pwr_ctrl(&aw87xxx->aw_dev, true);

// Set profile to Music
list_for_each_prev(pos, &g_aw87xxx_list) {
aw87xxx = list_entry(pos, struct aw87xxx, list);
AW_DEV_LOGI(aw87xxx->dev, "Resuming...");

mutex_lock(&aw87xxx->reg_lock);
aw87xxx_power_on(aw87xxx, AW87XXX_PROF_MUSIC);
mutex_unlock(&aw87xxx->reg_lock);

}

return 0;
}

static SIMPLE_DEV_PM_OPS(aw87xxx_pm_ops, aw87xxx_runtime_suspend, aw87xxx_runtime_resume);

static const struct acpi_device_id aw87xxx_acpi_match[] = {
{ "AWDZ8830", 0 },
{ }
Expand All @@ -1488,6 +1526,7 @@ static struct i2c_driver aw87xxx_i2c_driver = {
.owner = THIS_MODULE,
.name = AW87XXX_I2C_NAME,
.acpi_match_table = aw87xxx_acpi_match,
.pm = &aw87xxx_pm_ops,
},
.probe = aw87xxx_i2c_probe,
.remove = aw87xxx_i2c_remove,
Expand Down