Commit 69c58eb6 authored by Hans de Goede's avatar Hans de Goede Committed by Mark Brown

ASoC: arizona-jack: Cleanup logging

Cleanup the use of dev_foo functions used for logging:

1. Many of these are unnecessarily split over multiple lines
2. Use dev_err_probe() in cases where we might get a -EPROBE_DEFER
   return value
Suggested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210307151807.35201-12-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 236b7285
...@@ -123,9 +123,8 @@ static void arizona_extcon_hp_clamp(struct arizona_priv *info, ...@@ -123,9 +123,8 @@ static void arizona_extcon_hp_clamp(struct arizona_priv *info,
ARIZONA_HP_TEST_CTRL_1, ARIZONA_HP_TEST_CTRL_1,
ARIZONA_HP1_TST_CAP_SEL_MASK, ARIZONA_HP1_TST_CAP_SEL_MASK,
cap_sel); cap_sel);
if (ret != 0) if (ret)
dev_warn(arizona->dev, dev_warn(arizona->dev, "Failed to set TST_CAP_SEL: %d\n", ret);
"Failed to set TST_CAP_SEL: %d\n", ret);
break; break;
default: default:
mask = ARIZONA_RMV_SHRT_HP1L; mask = ARIZONA_RMV_SHRT_HP1L;
...@@ -144,24 +143,20 @@ static void arizona_extcon_hp_clamp(struct arizona_priv *info, ...@@ -144,24 +143,20 @@ static void arizona_extcon_hp_clamp(struct arizona_priv *info,
ARIZONA_OUTPUT_ENABLES_1, ARIZONA_OUTPUT_ENABLES_1,
ARIZONA_OUT1L_ENA | ARIZONA_OUT1L_ENA |
ARIZONA_OUT1R_ENA, 0); ARIZONA_OUT1R_ENA, 0);
if (ret != 0) if (ret)
dev_warn(arizona->dev, dev_warn(arizona->dev, "Failed to disable headphone outputs: %d\n", ret);
"Failed to disable headphone outputs: %d\n",
ret);
} }
if (mask) { if (mask) {
ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L, ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L,
mask, val); mask, val);
if (ret != 0) if (ret)
dev_warn(arizona->dev, "Failed to do clamp: %d\n", dev_warn(arizona->dev, "Failed to do clamp: %d\n", ret);
ret);
ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1R, ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1R,
mask, val); mask, val);
if (ret != 0) if (ret)
dev_warn(arizona->dev, "Failed to do clamp: %d\n", dev_warn(arizona->dev, "Failed to do clamp: %d\n", ret);
ret);
} }
/* Restore the desired state while not doing the clamp */ /* Restore the desired state while not doing the clamp */
...@@ -170,10 +165,8 @@ static void arizona_extcon_hp_clamp(struct arizona_priv *info, ...@@ -170,10 +165,8 @@ static void arizona_extcon_hp_clamp(struct arizona_priv *info,
ARIZONA_OUTPUT_ENABLES_1, ARIZONA_OUTPUT_ENABLES_1,
ARIZONA_OUT1L_ENA | ARIZONA_OUT1L_ENA |
ARIZONA_OUT1R_ENA, arizona->hp_ena); ARIZONA_OUT1R_ENA, arizona->hp_ena);
if (ret != 0) if (ret)
dev_warn(arizona->dev, dev_warn(arizona->dev, "Failed to restore headphone outputs: %d\n", ret);
"Failed to restore headphone outputs: %d\n",
ret);
} }
snd_soc_dapm_mutex_unlock(arizona->dapm); snd_soc_dapm_mutex_unlock(arizona->dapm);
...@@ -223,17 +216,15 @@ static void arizona_extcon_pulse_micbias(struct arizona_priv *info) ...@@ -223,17 +216,15 @@ static void arizona_extcon_pulse_micbias(struct arizona_priv *info)
int ret; int ret;
ret = snd_soc_component_force_enable_pin(component, widget); ret = snd_soc_component_force_enable_pin(component, widget);
if (ret != 0) if (ret)
dev_warn(arizona->dev, "Failed to enable %s: %d\n", dev_warn(arizona->dev, "Failed to enable %s: %d\n", widget, ret);
widget, ret);
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
if (!arizona->pdata.micd_force_micbias) { if (!arizona->pdata.micd_force_micbias) {
ret = snd_soc_component_disable_pin(component, widget); ret = snd_soc_component_disable_pin(component, widget);
if (ret != 0) if (ret)
dev_warn(arizona->dev, "Failed to disable %s: %d\n", dev_warn(arizona->dev, "Failed to disable %s: %d\n", widget, ret);
widget, ret);
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
} }
...@@ -251,18 +242,13 @@ static void arizona_start_mic(struct arizona_priv *info) ...@@ -251,18 +242,13 @@ static void arizona_start_mic(struct arizona_priv *info)
if (info->detecting) { if (info->detecting) {
ret = regulator_allow_bypass(info->micvdd, false); ret = regulator_allow_bypass(info->micvdd, false);
if (ret != 0) { if (ret)
dev_err(arizona->dev, dev_err(arizona->dev, "Failed to regulate MICVDD: %d\n", ret);
"Failed to regulate MICVDD: %d\n",
ret);
}
} }
ret = regulator_enable(info->micvdd); ret = regulator_enable(info->micvdd);
if (ret != 0) { if (ret)
dev_err(arizona->dev, "Failed to enable MICVDD: %d\n", dev_err(arizona->dev, "Failed to enable MICVDD: %d\n", ret);
ret);
}
if (info->micd_reva) { if (info->micd_reva) {
const struct reg_sequence reva[] = { const struct reg_sequence reva[] = {
...@@ -312,10 +298,8 @@ static void arizona_stop_mic(struct arizona_priv *info) ...@@ -312,10 +298,8 @@ static void arizona_stop_mic(struct arizona_priv *info)
dev_err(arizona->dev, "Failed to disable micd: %d\n", ret); dev_err(arizona->dev, "Failed to disable micd: %d\n", ret);
ret = snd_soc_component_disable_pin(component, widget); ret = snd_soc_component_disable_pin(component, widget);
if (ret != 0) if (ret)
dev_warn(arizona->dev, dev_warn(arizona->dev, "Failed to disable %s: %d\n", widget, ret);
"Failed to disable %s: %d\n",
widget, ret);
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
...@@ -330,10 +314,8 @@ static void arizona_stop_mic(struct arizona_priv *info) ...@@ -330,10 +314,8 @@ static void arizona_stop_mic(struct arizona_priv *info)
} }
ret = regulator_allow_bypass(info->micvdd, true); ret = regulator_allow_bypass(info->micvdd, true);
if (ret != 0) { if (ret)
dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n", dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n", ret);
ret);
}
if (change) { if (change) {
regulator_disable(info->micvdd); regulator_disable(info->micvdd);
...@@ -371,17 +353,15 @@ static int arizona_hpdet_read(struct arizona_priv *info) ...@@ -371,17 +353,15 @@ static int arizona_hpdet_read(struct arizona_priv *info)
int ret; int ret;
ret = regmap_read(arizona->regmap, ARIZONA_HEADPHONE_DETECT_2, &val); ret = regmap_read(arizona->regmap, ARIZONA_HEADPHONE_DETECT_2, &val);
if (ret != 0) { if (ret) {
dev_err(arizona->dev, "Failed to read HPDET status: %d\n", dev_err(arizona->dev, "Failed to read HPDET status: %d\n", ret);
ret);
return ret; return ret;
} }
switch (info->hpdet_ip_version) { switch (info->hpdet_ip_version) {
case 0: case 0:
if (!(val & ARIZONA_HP_DONE)) { if (!(val & ARIZONA_HP_DONE)) {
dev_err(arizona->dev, "HPDET did not complete: %x\n", dev_err(arizona->dev, "HPDET did not complete: %x\n", val);
val);
return -EAGAIN; return -EAGAIN;
} }
...@@ -390,15 +370,13 @@ static int arizona_hpdet_read(struct arizona_priv *info) ...@@ -390,15 +370,13 @@ static int arizona_hpdet_read(struct arizona_priv *info)
case 1: case 1:
if (!(val & ARIZONA_HP_DONE_B)) { if (!(val & ARIZONA_HP_DONE_B)) {
dev_err(arizona->dev, "HPDET did not complete: %x\n", dev_err(arizona->dev, "HPDET did not complete: %x\n", val);
val);
return -EAGAIN; return -EAGAIN;
} }
ret = regmap_read(arizona->regmap, ARIZONA_HP_DACVAL, &val); ret = regmap_read(arizona->regmap, ARIZONA_HP_DACVAL, &val);
if (ret != 0) { if (ret) {
dev_err(arizona->dev, "Failed to read HP value: %d\n", dev_err(arizona->dev, "Failed to read HP value: %d\n", ret);
ret);
return -EAGAIN; return -EAGAIN;
} }
...@@ -411,8 +389,7 @@ static int arizona_hpdet_read(struct arizona_priv *info) ...@@ -411,8 +389,7 @@ static int arizona_hpdet_read(struct arizona_priv *info)
(val < arizona_hpdet_b_ranges[range].threshold || (val < arizona_hpdet_b_ranges[range].threshold ||
val >= ARIZONA_HPDET_B_RANGE_MAX)) { val >= ARIZONA_HPDET_B_RANGE_MAX)) {
range++; range++;
dev_dbg(arizona->dev, "Moving to HPDET range %d\n", dev_dbg(arizona->dev, "Moving to HPDET range %d\n", range);
range);
regmap_update_bits(arizona->regmap, regmap_update_bits(arizona->regmap,
ARIZONA_HEADPHONE_DETECT_1, ARIZONA_HEADPHONE_DETECT_1,
ARIZONA_HP_IMPEDANCE_RANGE_MASK, ARIZONA_HP_IMPEDANCE_RANGE_MASK,
...@@ -428,8 +405,7 @@ static int arizona_hpdet_read(struct arizona_priv *info) ...@@ -428,8 +405,7 @@ static int arizona_hpdet_read(struct arizona_priv *info)
return ARIZONA_HPDET_MAX; return ARIZONA_HPDET_MAX;
} }
dev_dbg(arizona->dev, "HPDET read %d in range %d\n", dev_dbg(arizona->dev, "HPDET read %d in range %d\n", val, range);
val, range);
val = arizona_hpdet_b_ranges[range].factor_b val = arizona_hpdet_b_ranges[range].factor_b
/ ((val * 100) - / ((val * 100) -
...@@ -438,8 +414,7 @@ static int arizona_hpdet_read(struct arizona_priv *info) ...@@ -438,8 +414,7 @@ static int arizona_hpdet_read(struct arizona_priv *info)
case 2: case 2:
if (!(val & ARIZONA_HP_DONE_B)) { if (!(val & ARIZONA_HP_DONE_B)) {
dev_err(arizona->dev, "HPDET did not complete: %x\n", dev_err(arizona->dev, "HPDET did not complete: %x\n", val);
val);
return -EAGAIN; return -EAGAIN;
} }
...@@ -475,8 +450,7 @@ static int arizona_hpdet_read(struct arizona_priv *info) ...@@ -475,8 +450,7 @@ static int arizona_hpdet_read(struct arizona_priv *info)
break; break;
default: default:
dev_warn(arizona->dev, "Unknown HPDET IP revision %d\n", dev_warn(arizona->dev, "Unknown HPDET IP revision %d\n", info->hpdet_ip_version);
info->hpdet_ip_version);
return -EINVAL; return -EINVAL;
} }
...@@ -664,9 +638,8 @@ static void arizona_identify_headphone(struct arizona_priv *info) ...@@ -664,9 +638,8 @@ static void arizona_identify_headphone(struct arizona_priv *info)
ret = regmap_update_bits(arizona->regmap, ARIZONA_HEADPHONE_DETECT_1, ret = regmap_update_bits(arizona->regmap, ARIZONA_HEADPHONE_DETECT_1,
ARIZONA_HP_POLL, ARIZONA_HP_POLL); ARIZONA_HP_POLL, ARIZONA_HP_POLL);
if (ret != 0) { if (ret) {
dev_err(arizona->dev, "Can't start HPDETL measurement: %d\n", dev_err(arizona->dev, "Can't start HPDETL measurement: %d\n", ret);
ret);
goto err; goto err;
} }
...@@ -716,10 +689,8 @@ static void arizona_start_hpdet_acc_id(struct arizona_priv *info) ...@@ -716,10 +689,8 @@ static void arizona_start_hpdet_acc_id(struct arizona_priv *info)
ret = regmap_update_bits(arizona->regmap, ret = regmap_update_bits(arizona->regmap,
ARIZONA_HEADPHONE_DETECT_1, ARIZONA_HEADPHONE_DETECT_1,
ARIZONA_HP_POLL, ARIZONA_HP_POLL); ARIZONA_HP_POLL, ARIZONA_HP_POLL);
if (ret != 0) { if (ret) {
dev_err(arizona->dev, dev_err(arizona->dev, "Can't start HPDETL measurement: %d\n", ret);
"Can't start HPDETL measurement: %d\n",
ret);
goto err; goto err;
} }
} else { } else {
...@@ -764,9 +735,8 @@ static int arizona_micd_adc_read(struct arizona_priv *info) ...@@ -764,9 +735,8 @@ static int arizona_micd_adc_read(struct arizona_priv *info)
ARIZONA_MICD_ENA, 0); ARIZONA_MICD_ENA, 0);
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_4, &val); ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_4, &val);
if (ret != 0) { if (ret) {
dev_err(arizona->dev, dev_err(arizona->dev, "Failed to read MICDET_ADCVAL: %d\n", ret);
"Failed to read MICDET_ADCVAL: %d\n", ret);
return ret; return ret;
} }
...@@ -798,17 +768,15 @@ static int arizona_micd_read(struct arizona_priv *info) ...@@ -798,17 +768,15 @@ static int arizona_micd_read(struct arizona_priv *info)
for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) { for (i = 0; i < 10 && !(val & MICD_LVL_0_TO_8); i++) {
ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val); ret = regmap_read(arizona->regmap, ARIZONA_MIC_DETECT_3, &val);
if (ret != 0) { if (ret) {
dev_err(arizona->dev, dev_err(arizona->dev, "Failed to read MICDET: %d\n", ret);
"Failed to read MICDET: %d\n", ret);
return ret; return ret;
} }
dev_dbg(arizona->dev, "MICDET: %x\n", val); dev_dbg(arizona->dev, "MICDET: %x\n", val);
if (!(val & ARIZONA_MICD_VALID)) { if (!(val & ARIZONA_MICD_VALID)) {
dev_warn(arizona->dev, dev_warn(arizona->dev, "Microphone detection state invalid\n");
"Microphone detection state invalid\n");
return -EINVAL; return -EINVAL;
} }
} }
...@@ -856,10 +824,8 @@ static int arizona_micdet_reading(void *priv) ...@@ -856,10 +824,8 @@ static int arizona_micdet_reading(void *priv)
/* Don't need to regulate for button detection */ /* Don't need to regulate for button detection */
ret = regulator_allow_bypass(info->micvdd, true); ret = regulator_allow_bypass(info->micvdd, true);
if (ret != 0) { if (ret)
dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n", dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n", ret);
ret);
}
return 0; return 0;
} }
...@@ -941,8 +907,7 @@ static int arizona_button_reading(void *priv) ...@@ -941,8 +907,7 @@ static int arizona_button_reading(void *priv)
dev_err(arizona->dev, "Button out of range\n"); dev_err(arizona->dev, "Button out of range\n");
} }
} else { } else {
dev_warn(arizona->dev, "Button with no mic: %x\n", dev_warn(arizona->dev, "Button with no mic: %x\n", val);
val);
} }
} else { } else {
dev_dbg(arizona->dev, "Mic button released\n"); dev_dbg(arizona->dev, "Mic button released\n");
...@@ -1025,8 +990,7 @@ static int arizona_hpdet_wait(struct arizona_priv *info) ...@@ -1025,8 +990,7 @@ static int arizona_hpdet_wait(struct arizona_priv *info)
ret = regmap_read(arizona->regmap, ARIZONA_HEADPHONE_DETECT_2, ret = regmap_read(arizona->regmap, ARIZONA_HEADPHONE_DETECT_2,
&val); &val);
if (ret) { if (ret) {
dev_err(arizona->dev, dev_err(arizona->dev, "Failed to read HPDET state: %d\n", ret);
"Failed to read HPDET state: %d\n", ret);
return ret; return ret;
} }
...@@ -1076,9 +1040,8 @@ static irqreturn_t arizona_jackdet(int irq, void *data) ...@@ -1076,9 +1040,8 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
} }
ret = regmap_read(arizona->regmap, ARIZONA_AOD_IRQ_RAW_STATUS, &val); ret = regmap_read(arizona->regmap, ARIZONA_AOD_IRQ_RAW_STATUS, &val);
if (ret != 0) { if (ret) {
dev_err(arizona->dev, "Failed to read jackdet status: %d\n", dev_err(arizona->dev, "Failed to read jackdet status: %d\n", ret);
ret);
mutex_unlock(&info->lock); mutex_unlock(&info->lock);
pm_runtime_put_autosuspend(arizona->dev); pm_runtime_put_autosuspend(arizona->dev);
return IRQ_NONE; return IRQ_NONE;
...@@ -1248,8 +1211,7 @@ static int arizona_extcon_device_get_pdata(struct device *dev, ...@@ -1248,8 +1211,7 @@ static int arizona_extcon_device_get_pdata(struct device *dev,
pdata->hpdet_channel = val; pdata->hpdet_channel = val;
break; break;
default: default:
dev_err(arizona->dev, dev_err(arizona->dev, "Wrong wlf,hpdet-channel DT value %d\n", val);
"Wrong wlf,hpdet-channel DT value %d\n", val);
pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL; pdata->hpdet_channel = ARIZONA_ACCDET_MODE_HPL;
} }
...@@ -1301,11 +1263,8 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev) ...@@ -1301,11 +1263,8 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
arizona_extcon_device_get_pdata(dev, arizona); arizona_extcon_device_get_pdata(dev, arizona);
info->micvdd = devm_regulator_get(dev, "MICVDD"); info->micvdd = devm_regulator_get(dev, "MICVDD");
if (IS_ERR(info->micvdd)) { if (IS_ERR(info->micvdd))
ret = PTR_ERR(info->micvdd); return dev_err_probe(arizona->dev, PTR_ERR(info->micvdd), "getting MICVDD\n");
dev_err(arizona->dev, "Failed to get MICVDD: %d\n", ret);
return ret;
}
mutex_init(&info->lock); mutex_init(&info->lock);
info->last_jackdet = ~(ARIZONA_MICD_CLAMP_STS | ARIZONA_JD1_STS); info->last_jackdet = ~(ARIZONA_MICD_CLAMP_STS | ARIZONA_JD1_STS);
...@@ -1391,9 +1350,7 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev) ...@@ -1391,9 +1350,7 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
mode); mode);
if (IS_ERR(info->micd_pol_gpio)) { if (IS_ERR(info->micd_pol_gpio)) {
ret = PTR_ERR(info->micd_pol_gpio); ret = PTR_ERR(info->micd_pol_gpio);
dev_err(arizona->dev, dev_err_probe(arizona->dev, ret, "getting microphone polarity GPIO\n");
"Failed to get microphone polarity GPIO: %d\n",
ret);
return ret; return ret;
} }
} }
......
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