ASoC: codecs: wsa88xx: Few cleanups

Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:

A few cleanups around wsa88xx codecs.
This commit is contained in:
Mark Brown 2024-07-29 17:03:00 +01:00
commit d0296adb0d
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
3 changed files with 20 additions and 20 deletions

View File

@ -680,7 +680,6 @@ struct wsa881x_priv {
* For backwards compatibility.
*/
unsigned int sd_n_val;
int version;
int active_ports;
bool port_prepared[WSA881X_MAX_SWR_PORTS];
bool port_enable[WSA881X_MAX_SWR_PORTS];
@ -691,7 +690,6 @@ static void wsa881x_init(struct wsa881x_priv *wsa881x)
struct regmap *rm = wsa881x->regmap;
unsigned int val = 0;
regmap_read(rm, WSA881X_CHIP_ID1, &wsa881x->version);
regmap_register_patch(wsa881x->regmap, wsa881x_rev_2_0,
ARRAY_SIZE(wsa881x_rev_2_0));

View File

@ -438,8 +438,6 @@ struct wsa883x_priv {
struct gpio_desc *sd_n;
bool port_prepared[WSA883X_MAX_SWR_PORTS];
bool port_enable[WSA883X_MAX_SWR_PORTS];
int version;
int variant;
int active_ports;
int dev_mode;
int comp_offset;
@ -997,33 +995,36 @@ static const struct reg_sequence reg_init[] = {
{WSA883X_GMAMP_SUP1, 0xE2},
};
static void wsa883x_init(struct wsa883x_priv *wsa883x)
static int wsa883x_init(struct wsa883x_priv *wsa883x)
{
struct regmap *regmap = wsa883x->regmap;
int variant, version;
int variant, version, ret;
regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
wsa883x->variant = variant & WSA883X_ID_MASK;
ret = regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
if (ret)
return ret;
variant = variant & WSA883X_ID_MASK;
regmap_read(regmap, WSA883X_CHIP_ID0, &version);
wsa883x->version = version;
ret = regmap_read(regmap, WSA883X_CHIP_ID0, &version);
if (ret)
return ret;
switch (wsa883x->variant) {
switch (variant) {
case WSA8830:
dev_info(wsa883x->dev, "WSA883X Version 1_%d, Variant: WSA8830\n",
wsa883x->version);
version);
break;
case WSA8835:
dev_info(wsa883x->dev, "WSA883X Version 1_%d, Variant: WSA8835\n",
wsa883x->version);
version);
break;
case WSA8832:
dev_info(wsa883x->dev, "WSA883X Version 1_%d, Variant: WSA8832\n",
wsa883x->version);
version);
break;
case WSA8835_V2:
dev_info(wsa883x->dev, "WSA883X Version 1_%d, Variant: WSA8835_V2\n",
wsa883x->version);
version);
break;
default:
break;
@ -1034,12 +1035,14 @@ static void wsa883x_init(struct wsa883x_priv *wsa883x)
/* Initial settings */
regmap_multi_reg_write(regmap, reg_init, ARRAY_SIZE(reg_init));
if (wsa883x->variant == WSA8830 || wsa883x->variant == WSA8832) {
if (variant == WSA8830 || variant == WSA8832) {
wsa883x->comp_offset = COMP_OFFSET3;
regmap_update_bits(regmap, WSA883X_DRE_CTL_0,
WSA883X_DRE_OFFSET_MASK,
wsa883x->comp_offset);
}
return 0;
}
static int wsa883x_update_status(struct sdw_slave *slave,
@ -1048,7 +1051,7 @@ static int wsa883x_update_status(struct sdw_slave *slave,
struct wsa883x_priv *wsa883x = dev_get_drvdata(&slave->dev);
if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0)
wsa883x_init(wsa883x);
return wsa883x_init(wsa883x);
return 0;
}

View File

@ -703,7 +703,6 @@ struct wsa884x_priv {
struct reset_control *sd_reset;
bool port_prepared[WSA884X_MAX_SWR_PORTS];
bool port_enable[WSA884X_MAX_SWR_PORTS];
unsigned int variant;
int active_ports;
int dev_mode;
bool hw_init;
@ -1465,7 +1464,7 @@ static void wsa884x_init(struct wsa884x_priv *wsa884x)
unsigned int variant = 0;
if (!regmap_read(wsa884x->regmap, WSA884X_OTP_REG_0, &variant))
wsa884x->variant = variant & WSA884X_OTP_REG_0_ID_MASK;
variant = variant & WSA884X_OTP_REG_0_ID_MASK;
regmap_multi_reg_write(wsa884x->regmap, wsa884x_reg_init,
ARRAY_SIZE(wsa884x_reg_init));
@ -1474,7 +1473,7 @@ static void wsa884x_init(struct wsa884x_priv *wsa884x)
wo_ctl_0 |= FIELD_PREP(WSA884X_ANA_WO_CTL_0_DAC_CM_CLAMP_EN_MASK,
WSA884X_ANA_WO_CTL_0_DAC_CM_CLAMP_EN_MODE_SPEAKER);
/* Assume that compander is enabled by default unless it is haptics sku */
if (wsa884x->variant == WSA884X_OTP_ID_WSA8845H)
if (variant == WSA884X_OTP_ID_WSA8845H)
wo_ctl_0 |= FIELD_PREP(WSA884X_ANA_WO_CTL_0_PA_AUX_GAIN_MASK,
WSA884X_ANA_WO_CTL_0_PA_AUX_18_DB);
else