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 counters to ensure the existence of wsa881x chip
Add counters in wsa881x analog driver to store the actual number of wsa881x chips on hardware board. Machine driver can use these counters to match the device tree configuration. If the matching fails, we assume that there is no wsa881x on board. It will double ensure the wsa881x existence. CRs-Fixed: 841458 Change-Id: Ia438c7de836425a1bc1195742290751d526252ab Signed-off-by: Walter Yang <yandongy@codeaurora.org>
This commit is contained in:
parent
931faaad60
commit
5f6325e0e7
2 changed files with 19 additions and 0 deletions
|
@ -85,6 +85,8 @@ static int wsa881x_shutdown(struct wsa881x_pdata *pdata);
|
|||
static int delay_array_msec[] = {10, 20, 30, 40, 50};
|
||||
|
||||
static int wsa881x_i2c_addr = -1;
|
||||
static int wsa881x_probing_count;
|
||||
static int wsa881x_presence_count;
|
||||
|
||||
static const char * const wsa881x_spk_pa_gain_text[] = {
|
||||
"POS_13P5_DB", "POS_12_DB", "POS_10P5_DB", "POS_9_DB", "POS_7P5_DB",
|
||||
|
@ -828,6 +830,18 @@ int wsa881x_get_client_index(void)
|
|||
}
|
||||
EXPORT_SYMBOL(wsa881x_get_client_index);
|
||||
|
||||
int wsa881x_get_probing_count(void)
|
||||
{
|
||||
return wsa881x_probing_count;
|
||||
}
|
||||
EXPORT_SYMBOL(wsa881x_get_probing_count);
|
||||
|
||||
int wsa881x_get_presence_count(void)
|
||||
{
|
||||
return wsa881x_presence_count;
|
||||
}
|
||||
EXPORT_SYMBOL(wsa881x_get_presence_count);
|
||||
|
||||
static int check_wsa881x_presence(struct i2c_client *client)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -980,8 +994,11 @@ static int wsa881x_i2c_probe(struct i2c_client *client,
|
|||
dev_err(&client->dev,
|
||||
"failed to ping wsa with addr:%x, ret = %d\n",
|
||||
client->addr, ret);
|
||||
wsa881x_probing_count++;
|
||||
goto err1;
|
||||
}
|
||||
wsa881x_presence_count++;
|
||||
wsa881x_probing_count++;
|
||||
ret = snd_soc_register_codec(&client->dev,
|
||||
&soc_codec_dev_wsa881x,
|
||||
NULL, 0);
|
||||
|
|
|
@ -31,5 +31,7 @@ extern const u8 wsa881x_ana_reg_readable[WSA881X_CACHE_SIZE];
|
|||
extern const struct reg_default wsa881x_ana_reg_defaults[WSA881X_CACHE_SIZE];
|
||||
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);
|
||||
|
||||
#endif /* _WSA881X_H */
|
||||
|
|
Loading…
Reference in a new issue