ASoC: codecs: wsa883x: Simplify handling variant/version

Driver does not use detected variant/version variables past the init
function, so do not store them in the state container structure.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240710-asoc-wsa88xx-version-v1-3-f1c54966ccde@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Krzysztof Kozlowski 2024-07-10 15:52:32 +02:00 committed by Mark Brown
parent 2fbf16992e
commit cd15fded0e
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

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;
@ -1005,29 +1003,28 @@ static int wsa883x_init(struct wsa883x_priv *wsa883x)
ret = regmap_read(regmap, WSA883X_OTP_REG_0, &variant);
if (ret)
return ret;
wsa883x->variant = variant & WSA883X_ID_MASK;
variant = variant & WSA883X_ID_MASK;
ret = regmap_read(regmap, WSA883X_CHIP_ID0, &version);
if (ret)
return ret;
wsa883x->version = version;
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;
@ -1038,7 +1035,7 @@ static int 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,