mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
ASoC: wsa881x: add the mclk enable hook in wsa analog
To provide more flexibility to userspace, add the mclk enable hook in wsa analog driver. So that when wsa starts up individually, it still can get the mclk via the hook. Change-Id: I5f4f8ff018de59b002f7ba30ca002509057734ef CRs-Fixed: 878177 Signed-off-by: Walter Yang <yandongy@codeaurora.org>
This commit is contained in:
parent
e829071efc
commit
eeccb922b1
2 changed files with 37 additions and 0 deletions
|
@ -57,6 +57,7 @@ struct wsa881x_pdata {
|
|||
bool regmap_flag;
|
||||
bool wsa_active;
|
||||
int index;
|
||||
int (*enable_mclk)(struct snd_soc_card *, bool);
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -666,9 +667,19 @@ static const struct snd_soc_dapm_route wsa881x_audio_map[] = {
|
|||
static int wsa881x_startup(struct wsa881x_pdata *pdata)
|
||||
{
|
||||
int ret = 0;
|
||||
struct snd_soc_codec *codec = pdata->codec;
|
||||
|
||||
pr_debug("%s(): wsa startup\n", __func__);
|
||||
|
||||
if (pdata->enable_mclk) {
|
||||
ret = pdata->enable_mclk(codec->card, true);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: mclk enable failed %d\n",
|
||||
__func__, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = msm_gpioset_activate(CLIENT_WSA_BONGO_1, "wsa_clk");
|
||||
if (ret) {
|
||||
pr_err("%s: gpio set cannot be activated %s\n",
|
||||
|
@ -682,6 +693,7 @@ static int wsa881x_startup(struct wsa881x_pdata *pdata)
|
|||
static int wsa881x_shutdown(struct wsa881x_pdata *pdata)
|
||||
{
|
||||
int ret = 0, reg;
|
||||
struct snd_soc_codec *codec = pdata->codec;
|
||||
|
||||
pr_debug("%s(): wsa shutdown\n", __func__);
|
||||
ret = wsa881x_reset(pdata, false);
|
||||
|
@ -691,6 +703,15 @@ static int wsa881x_shutdown(struct wsa881x_pdata *pdata)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (pdata->enable_mclk) {
|
||||
ret = pdata->enable_mclk(codec->card, false);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: mclk disable failed %d\n",
|
||||
__func__, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = msm_gpioset_suspend(CLIENT_WSA_BONGO_1, "wsa_clk");
|
||||
if (ret) {
|
||||
pr_err("%s: gpio set cannot be suspended %s\n",
|
||||
|
@ -840,6 +861,19 @@ int wsa881x_get_presence_count(void)
|
|||
}
|
||||
EXPORT_SYMBOL(wsa881x_get_presence_count);
|
||||
|
||||
int wsa881x_set_mclk_callback(
|
||||
int (*enable_mclk_callback)(struct snd_soc_card *, bool))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_WSA881X_DEVICE; i++) {
|
||||
if (wsa_pdata[i].status == WSA881X_STATUS_I2C)
|
||||
wsa_pdata[i].enable_mclk = enable_mclk_callback;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(wsa881x_set_mclk_callback);
|
||||
|
||||
static int check_wsa881x_presence(struct i2c_client *client)
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <linux/regmap.h>
|
||||
#include "wsa881x-registers-analog.h"
|
||||
#include <sound/soc.h>
|
||||
|
||||
#define WSA881X_I2C_SPK0_SLAVE0_ADDR 0x0E
|
||||
#define WSA881X_I2C_SPK0_SLAVE1_ADDR 0x44
|
||||
|
@ -33,5 +34,7 @@ extern struct regmap_config wsa881x_ana_regmap_config[2];
|
|||
int wsa881x_get_client_index(void);
|
||||
int wsa881x_get_probing_count(void);
|
||||
int wsa881x_get_presence_count(void);
|
||||
int wsa881x_set_mclk_callback(
|
||||
int (*enable_mclk_callback)(struct snd_soc_card *, bool));
|
||||
|
||||
#endif /* _WSA881X_H */
|
||||
|
|
Loading…
Reference in a new issue