Commit b06a584c authored by Vinod Koul's avatar Vinod Koul Committed by Greg Kroah-Hartman

intel_sst: MSIC codec power optimisation

This patch adds power optimization for the msic codec and ensure
codec is completely powered off when codec is idle.
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarRamesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6c550053
...@@ -103,8 +103,8 @@ struct snd_pmic_ops { ...@@ -103,8 +103,8 @@ struct snd_pmic_ops {
int (*power_up_pmic_pb) (unsigned int port); int (*power_up_pmic_pb) (unsigned int port);
int (*power_up_pmic_cp) (unsigned int port); int (*power_up_pmic_cp) (unsigned int port);
int (*power_down_pmic_pb) (void); int (*power_down_pmic_pb) (unsigned int device);
int (*power_down_pmic_cp) (void); int (*power_down_pmic_cp) (unsigned int device);
int (*power_down_pmic) (void); int (*power_down_pmic) (void);
}; };
......
...@@ -105,21 +105,23 @@ void free_stream_context(unsigned int str_id) ...@@ -105,21 +105,23 @@ void free_stream_context(unsigned int str_id)
if (!sst_validate_strid(str_id)) { if (!sst_validate_strid(str_id)) {
/* str_id is valid, so stream is alloacted */ /* str_id is valid, so stream is alloacted */
stream = &sst_drv_ctx->streams[str_id]; stream = &sst_drv_ctx->streams[str_id];
if (sst_free_stream(str_id))
sst_clean_stream(&sst_drv_ctx->streams[str_id]);
if (stream->ops == STREAM_OPS_PLAYBACK || if (stream->ops == STREAM_OPS_PLAYBACK ||
stream->ops == STREAM_OPS_PLAYBACK_DRM) { stream->ops == STREAM_OPS_PLAYBACK_DRM) {
sst_drv_ctx->pb_streams--; sst_drv_ctx->pb_streams--;
if (sst_drv_ctx->pb_streams == 0) if (sst_drv_ctx->pb_streams == 0)
sst_drv_ctx->scard_ops->power_down_pmic_pb(); sst_drv_ctx->scard_ops->power_down_pmic_pb(
stream->device);
} else if (stream->ops == STREAM_OPS_CAPTURE) { } else if (stream->ops == STREAM_OPS_CAPTURE) {
sst_drv_ctx->cp_streams--; sst_drv_ctx->cp_streams--;
if (sst_drv_ctx->cp_streams == 0) if (sst_drv_ctx->cp_streams == 0)
sst_drv_ctx->scard_ops->power_down_pmic_cp(); sst_drv_ctx->scard_ops->power_down_pmic_cp(
stream->device);
} }
if (sst_drv_ctx->pb_streams == 0 if (sst_drv_ctx->pb_streams == 0
&& sst_drv_ctx->cp_streams == 0) && sst_drv_ctx->cp_streams == 0)
sst_drv_ctx->scard_ops->power_down_pmic(); sst_drv_ctx->scard_ops->power_down_pmic();
if (sst_free_stream(str_id))
sst_clean_stream(&sst_drv_ctx->streams[str_id]);
} }
} }
......
...@@ -157,7 +157,7 @@ static int fs_power_up_pb(unsigned int port) ...@@ -157,7 +157,7 @@ static int fs_power_up_pb(unsigned int port)
return fs_enable_audiodac(UNMUTE); return fs_enable_audiodac(UNMUTE);
} }
static int fs_power_down_pb(void) static int fs_power_down_pb(unsigned int device)
{ {
struct sc_reg_access sc_access[] = { struct sc_reg_access sc_access[] = {
{POWERCTRL1, 0x00, 0xC6}, {POWERCTRL1, 0x00, 0xC6},
...@@ -195,7 +195,7 @@ static int fs_power_up_cp(unsigned int port) ...@@ -195,7 +195,7 @@ static int fs_power_up_cp(unsigned int port)
return sst_sc_reg_access(sc_access, PMIC_READ_MODIFY, 2); return sst_sc_reg_access(sc_access, PMIC_READ_MODIFY, 2);
} }
static int fs_power_down_cp(void) static int fs_power_down_cp(unsigned int device)
{ {
struct sc_reg_access sc_access[] = { struct sc_reg_access sc_access[] = {
{POWERCTRL2, 0x00, 0x03}, {POWERCTRL2, 0x00, 0x03},
......
...@@ -211,7 +211,7 @@ static int mx_power_up_pb(unsigned int port) ...@@ -211,7 +211,7 @@ static int mx_power_up_pb(unsigned int port)
return mx_enable_audiodac(UNMUTE); return mx_enable_audiodac(UNMUTE);
} }
static int mx_power_down_pb(void) static int mx_power_down_pb(unsigned int device)
{ {
struct sc_reg_access sc_access[3]; struct sc_reg_access sc_access[3];
int retval = 0; int retval = 0;
...@@ -254,7 +254,7 @@ static int mx_power_up_cp(unsigned int port) ...@@ -254,7 +254,7 @@ static int mx_power_up_cp(unsigned int port)
return sst_sc_reg_access(sc_access, PMIC_READ_MODIFY, 2); return sst_sc_reg_access(sc_access, PMIC_READ_MODIFY, 2);
} }
static int mx_power_down_cp(void) static int mx_power_down_cp(unsigned int device)
{ {
struct sc_reg_access sc_access[] = { struct sc_reg_access sc_access[] = {
{ENABLE_OPDEV_CTRL, 0x00, MASK1|MASK0}, {ENABLE_OPDEV_CTRL, 0x00, MASK1|MASK0},
......
...@@ -315,7 +315,7 @@ static int nc_power_down(void) ...@@ -315,7 +315,7 @@ static int nc_power_down(void)
return nc_enable_audiodac(UNMUTE); return nc_enable_audiodac(UNMUTE);
} }
static int nc_power_down_pb(void) static int nc_power_down_pb(unsigned int device)
{ {
int retval = 0; int retval = 0;
...@@ -359,7 +359,7 @@ static int nc_power_down_pb(void) ...@@ -359,7 +359,7 @@ static int nc_power_down_pb(void)
} }
static int nc_power_down_cp(void) static int nc_power_down_cp(unsigned int device)
{ {
struct sc_reg_access sc_access[] = { struct sc_reg_access sc_access[] = {
{POWERCTRL1, 0x00, 0xBE}, {POWERCTRL1, 0x00, 0xBE},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment