From patchwork Thu Jul 4 08:17:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Rafi Shaik X-Patchwork-Id: 13723392 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8890240BF2; Thu, 4 Jul 2024 08:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720081169; cv=none; b=IKG9GCe7tcEbq0aE6Pfy7OWgIb8vmkdhbsbt5pkxR6CB9gSM90UsaagC8usRNJSJCatEg3k9GTTaUfU0DBgXxWzGQl55EkMHH37ZinNX8s8hb+3yJI1StWGCOQX8+wIX7R/2VCieBVA+RlMy6t00/K6kl1rrWm+FTKrz9rklsH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720081169; c=relaxed/simple; bh=e/K5DLqwZF68Cf9NR8aDxrmhZ3pI2bNegpaOGpFjPG4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=te561ZXlIVQoTgF+WKsSZp1GpGhVtGup4CDzqslPBV/roTnewshywPowGcs1JA/KZs9CM2rl/T9B9pBUzZNsPu+FkMnJTlve0SPGlv+Q9ELWBaDTtbRLwnZXdJwOsVkHBEvkEtEVZwVnoyeoxvATXI93TlguECxVXwJNP5veNBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=ANbFcxP0; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ANbFcxP0" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4645TRcg010965; Thu, 4 Jul 2024 08:19:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= jUdu0OXWdnMlFo2C/icf7Grfb2WaYTs3izYGeOnqbx8=; b=ANbFcxP0jiD7maAz fbKziqrXij3osmy44qbn5T+6nyKv5wJ7DzJotZpW5c4kBpxsnBK2G3UNGDwzvx8R Kb2DH+ge2ROk8ZfPVhkgj6JByxx3GWtOfNLUDRd2YUvbBVc+U1pyoiRjrXWGmPMy 0/MnJzoK2n2qZFzrzYjCKMKJUYVeOvf9ZBkCzrQTlpFMOo0QyGDb0BOQVdA5FR0E nMp/PPYZi6ChxR9OHAhK7mht7aDHqY8bQUCCpvf4kmXsY3Rfh+q1rwTe4BW/DAto GhRj7SDVrO2D/q8tnB2BfOc8rTLUsqZcTeP/cP71Bm+PW//8rYL9YWXTbX+AE7t6 IcykGQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 404yr9b4p4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:19:03 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4648J2iL030497 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 4 Jul 2024 08:19:02 GMT Received: from hu-mohs-hyd.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 4 Jul 2024 01:18:59 -0700 From: Mohammad Rafi Shaik To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , "Mohammad Rafi Shaik" , Prasad Kumpatla CC: , , Subject: [PATCH v2 1/3] ASoC: codecs: wcd937x-sdw: Fix Unbalanced pm_runtime_enable Date: Thu, 4 Jul 2024 13:47:21 +0530 Message-ID: <20240704081723.3394153-2-quic_mohs@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240704081723.3394153-1-quic_mohs@quicinc.com> References: <20240704081723.3394153-1-quic_mohs@quicinc.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: vAon90bplkqtoKtvqpa064uLKmakboak X-Proofpoint-ORIG-GUID: vAon90bplkqtoKtvqpa064uLKmakboak X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-03_18,2024-07-03_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1011 bulkscore=0 impostorscore=0 malwarescore=0 spamscore=0 mlxscore=0 mlxlogscore=858 adultscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407040057 Fix the unbalanced pm_runtime_enable! in wcd937x-sdw soundwire slave. Fixes: c99a515ff153 ("ASoC: codecs: wcd937x-sdw: add SoundWire driver") Signed-off-by: Mohammad Rafi Shaik --- sound/soc/codecs/wcd937x-sdw.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/wcd937x-sdw.c b/sound/soc/codecs/wcd937x-sdw.c index a24d6c620dba..3abc8041406a 100644 --- a/sound/soc/codecs/wcd937x-sdw.c +++ b/sound/soc/codecs/wcd937x-sdw.c @@ -1067,13 +1067,15 @@ static int wcd9370_probe(struct sdw_slave *pdev, wcd->ch_info = &wcd937x_sdw_rx_ch_info[0]; } - pm_runtime_set_autosuspend_delay(dev, 3000); - pm_runtime_use_autosuspend(dev); - pm_runtime_mark_last_busy(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - return component_add(dev, &wcd937x_sdw_component_ops); + ret = component_add(dev, &wcd937x_sdw_component_ops); + if (ret) + return ret; + + /* Set suspended until aggregate device is bind */ + pm_runtime_set_suspended(dev); + + return 0; } static int wcd9370_remove(struct sdw_slave *pdev) @@ -1082,10 +1084,6 @@ static int wcd9370_remove(struct sdw_slave *pdev) component_del(dev, &wcd937x_sdw_component_ops); - pm_runtime_disable(dev); - pm_runtime_set_suspended(dev); - pm_runtime_dont_use_autosuspend(dev); - return 0; } From patchwork Thu Jul 4 08:17:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Rafi Shaik X-Patchwork-Id: 13723393 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AFFD40BF2; Thu, 4 Jul 2024 08:19:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720081175; cv=none; b=RoTQhtAZ65bR/vvIR/dA3NMBjtVuE4qZKa02vV90OAPzAT8XnNKXjvXSHjUqDJteNupAaOJ7hPj3EVkENRUU3MDQP7RMV6geuijY58guKeAdLyWTV6EvfbVUnxlhIIiFDrm2rKGLCMiWLxjmXIll6aOAnlQPm8hvlQZAGDFcEwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720081175; c=relaxed/simple; bh=uXYIvJJjOHeyOGKww0AYWtM3SVrVRKDmiNBpovYRsqk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MURbYohZheZzUB49FaZqlRn/FVNBvVXlIOXcGHqxh5cXUZflBy+nFN8ZP1mvwBSuaQHq8dhVuQIAr7+vULBoeUE0OTQKsyLtD4PGX/bNuJ+jW/QW+Pd0tsD32Uf0UrqINdT8noLPnfltPnjgx+DuOdWu9sTgMXw3Hppw4EmbJNA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=eGdSMvTU; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="eGdSMvTU" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 463J4vNB003645; Thu, 4 Jul 2024 08:19:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= bY6cwzD4iAZ6uGFeNzw7OsIgw4CYUJ5dshXMiNSRHMM=; b=eGdSMvTU2GNPw5jz Rk9QVhZmSW8wFFCepN38QKjzetaGZ5Rc7zDftrsBmytMOPkJVtG55FjlBfVSHnXI tn/FHwcGqGwIXwzvUt8lMolDUXXIbQjjYKa/E41wQA0JRTDe90DIQPY5amRaPCn9 J6f20e8j7nMSjZwFep9Ik971xjc+O2mYngPHqOT1zQ7kuW2D/jq/pIcWQs5viO5/ 1TYmwmBRE0vjFwrRzgqf92ydg8Lp2LqHJYPbydfVRpRJUrd1in3pLqltaNkAljrB EyEkRYt2CSyh1Bj0wNi7HiE/u8afCG/V4Z7uJ67RpXTgRKasY4YXRmwgdE6nXBcm mpbtJA== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 405cg297sa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:19:13 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4648JC5S017941 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 4 Jul 2024 08:19:12 GMT Received: from hu-mohs-hyd.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 4 Jul 2024 01:19:09 -0700 From: Mohammad Rafi Shaik To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , "Mohammad Rafi Shaik" , Prasad Kumpatla CC: , , , Srinivas Kandagatla Subject: [PATCH v2 2/3] ASoC: codecs: wcd937x: Remove the string compare in MIC BIAS widget settings Date: Thu, 4 Jul 2024 13:47:22 +0530 Message-ID: <20240704081723.3394153-3-quic_mohs@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240704081723.3394153-1-quic_mohs@quicinc.com> References: <20240704081723.3394153-1-quic_mohs@quicinc.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: aMlt3GTNd1ppehrB-mwWfz4WAOcc-K2_ X-Proofpoint-ORIG-GUID: aMlt3GTNd1ppehrB-mwWfz4WAOcc-K2_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-03_18,2024-07-03_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 spamscore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 impostorscore=0 suspectscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407040057 Remove the string compare with widget name in MIC BIAS settings, instead of string compare use the MIC BIAS id's. Reported-by: Srinivas Kandagatla Closes: https://lore.kernel.org/linux-sound/ba911ebd-aef5-46af-ace1-84d13bee6876@linaro.org/ Signed-off-by: Mohammad Rafi Shaik --- sound/soc/codecs/wcd937x.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c index 4beb70bc4d8c..94282499fa33 100644 --- a/sound/soc/codecs/wcd937x.c +++ b/sound/soc/codecs/wcd937x.c @@ -1164,16 +1164,7 @@ static int __wcd937x_codec_enable_micbias(struct snd_soc_dapm_widget *w, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - int micb_num; - - if (strnstr(w->name, "MIC BIAS1", sizeof("MIC BIAS1"))) - micb_num = MIC_BIAS_1; - else if (strnstr(w->name, "MIC BIAS2", sizeof("MIC BIAS2"))) - micb_num = MIC_BIAS_2; - else if (strnstr(w->name, "MIC BIAS3", sizeof("MIC BIAS3"))) - micb_num = MIC_BIAS_3; - else - return -EINVAL; + int micb_num = w->shift; switch (event) { case SND_SOC_DAPM_PRE_PMU: @@ -1203,16 +1194,7 @@ static int __wcd937x_codec_enable_micbias_pullup(struct snd_soc_dapm_widget *w, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - int micb_num; - - if (strnstr(w->name, "VA MIC BIAS1", sizeof("VA MIC BIAS1"))) - micb_num = MIC_BIAS_1; - else if (strnstr(w->name, "VA MIC BIAS2", sizeof("VA MIC BIAS2"))) - micb_num = MIC_BIAS_2; - else if (strnstr(w->name, "VA MIC BIAS3", sizeof("VA MIC BIAS3"))) - micb_num = MIC_BIAS_3; - else - return -EINVAL; + int micb_num = w->shift; switch (event) { case SND_SOC_DAPM_PRE_PMU: @@ -2231,15 +2213,15 @@ static const struct snd_soc_dapm_widget wcd937x_dapm_widgets[] = { SND_SOC_DAPM_POST_PMD), /* MIC_BIAS widgets */ - SND_SOC_DAPM_SUPPLY("MIC BIAS1", SND_SOC_NOPM, 0, 0, + SND_SOC_DAPM_SUPPLY("MIC BIAS1", SND_SOC_NOPM, MIC_BIAS_1, 0, wcd937x_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_SUPPLY("MIC BIAS2", SND_SOC_NOPM, 0, 0, + SND_SOC_DAPM_SUPPLY("MIC BIAS2", SND_SOC_NOPM, MIC_BIAS_2, 0, wcd937x_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_SUPPLY("MIC BIAS3", SND_SOC_NOPM, 0, 0, + SND_SOC_DAPM_SUPPLY("MIC BIAS3", SND_SOC_NOPM, MIC_BIAS_3, 0, wcd937x_codec_enable_micbias, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), @@ -2320,15 +2302,15 @@ static const struct snd_soc_dapm_widget wcd937x_dapm_widgets[] = { SND_SOC_DAPM_OUTPUT("HPHR"), /* MIC_BIAS pull up widgets */ - SND_SOC_DAPM_SUPPLY("VA MIC BIAS1", SND_SOC_NOPM, 0, 0, + SND_SOC_DAPM_SUPPLY("VA MIC BIAS1", SND_SOC_NOPM, MIC_BIAS_1, 0, wcd937x_codec_enable_micbias_pullup, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_SUPPLY("VA MIC BIAS2", SND_SOC_NOPM, 0, 0, + SND_SOC_DAPM_SUPPLY("VA MIC BIAS2", SND_SOC_NOPM, MIC_BIAS_2, 0, wcd937x_codec_enable_micbias_pullup, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_SUPPLY("VA MIC BIAS3", SND_SOC_NOPM, 0, 0, + SND_SOC_DAPM_SUPPLY("VA MIC BIAS3", SND_SOC_NOPM, MIC_BIAS_3, 0, wcd937x_codec_enable_micbias_pullup, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), From patchwork Thu Jul 4 08:17:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Rafi Shaik X-Patchwork-Id: 13723394 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22BB91A4F32; Thu, 4 Jul 2024 08:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720081179; cv=none; b=cZGefHG13oNcVv+r/zfr9D0V9sxl5XQRBzhMdHNCjZPeDnQyjCewuJTqjNpzW1px68t5W5tXf/Q89Y5ACSQKr7d3zSb1QCFrJGwLia8CTne/O6XrxueWmSb0xD9Qkn7u0MWpjNqopwc8TbrPjOZ/MkQ6VXmjuuzxepftltVm6Lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720081179; c=relaxed/simple; bh=upmZAW8dn69PnkO8E8xNmjChTgJpfXDrhWbIGwNqiFI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QXfrJRvmUNUjF8AP6z4oCc4BimYKRs/3/eq1FiTml0W/m8+yZSa9LZ3EpqmF/hygAPQPkvTmT643sIfU98+p0NV+1fI94Zk1ofhnvldit8LqwjPAVk6gV9JJTb7wgCydyhl8ycx4Djid7SKovmTXMdw43yOoeBI4v9QB13BFtJk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=EApAlsOb; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="EApAlsOb" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 463JgnbU015287; Thu, 4 Jul 2024 08:19:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= o22hio7VyV4ycaCVCMQlLHB5tAzv6dao/1poTjxR9NU=; b=EApAlsObfCuurAqW voTM/ZT2WDaAJf4o9oGTJbxkh/Ph4mwbyizGaGF9kIShKzKvgkbMKZsJGlfvpp+S IeRRsrsoFxb6+2FzuktHDy2tbb2hUNMtzxdnRI8Ifcw7w/9973Q6c7w642LoaggY JxO9+BEI0UMVgcenoqRthpHssahwoEEhPqlIFKtySZMhzmwgFa/7Ifzm6VSbvPk2 Ru6KFWzKfLFP2s3zKN111StLS3FSHvf/mbaefVjyOz4SR/o1vgI5xL2bFjug+Nq5 E5bYKXLDvVqgZkN+SznNWalt5bI35MSgKmbbXPNkG2Z3DapdLPqLiCIOO+5b1vEP ta+nVw== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4052yhjmxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 04 Jul 2024 08:19:19 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4648JIkn031119 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 4 Jul 2024 08:19:18 GMT Received: from hu-mohs-hyd.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 4 Jul 2024 01:19:15 -0700 From: Mohammad Rafi Shaik To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , "Mohammad Rafi Shaik" , Prasad Kumpatla CC: , , , Christophe JAILLET Subject: [PATCH v2 3/3] ASoC: codecs: wcd937x: Remove separate handling for vdd-buck supply Date: Thu, 4 Jul 2024 13:47:23 +0530 Message-ID: <20240704081723.3394153-4-quic_mohs@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240704081723.3394153-1-quic_mohs@quicinc.com> References: <20240704081723.3394153-1-quic_mohs@quicinc.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 9eHRJvyNRn9UwheURdooeFR7trTVYoav X-Proofpoint-GUID: 9eHRJvyNRn9UwheURdooeFR7trTVYoav X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-03_18,2024-07-03_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 clxscore=1015 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407040057 Remove separate handling for vdd-buck regulator supply which is not required. The vdd-buck regulator supply enabled using bulk enable. Add the error handling in wcd937x_probe() and disable the regulators in error case. Reported-by: Christophe JAILLET Closes: https://lore.kernel.org/linux-sound/834d31cc-f4bc-4db7-a25b-f9869e550eb6@wanadoo.fr/ Signed-off-by: Mohammad Rafi Shaik --- sound/soc/codecs/wcd937x.c | 61 ++++++++------------------------------ sound/soc/codecs/wcd937x.h | 2 +- 2 files changed, 14 insertions(+), 49 deletions(-) diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c index 94282499fa33..13926f4b0d9f 100644 --- a/sound/soc/codecs/wcd937x.c +++ b/sound/soc/codecs/wcd937x.c @@ -869,37 +869,6 @@ static int wcd937x_enable_rx3(struct snd_soc_dapm_widget *w, return 0; } -static int wcd937x_codec_enable_vdd_buck(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, - int event) -{ - struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); - int ret = 0; - - switch (event) { - case SND_SOC_DAPM_PRE_PMU: - if (test_bit(ALLOW_BUCK_DISABLE, &wcd937x->status_mask)) { - dev_err(component->dev, "buck already in enabled state\n"); - clear_bit(ALLOW_BUCK_DISABLE, &wcd937x->status_mask); - return 0; - } - ret = regulator_enable(wcd937x->buck_supply); - if (ret) { - dev_err(component->dev, "VDD_BUCK is not enabled\n"); - return ret; - } - clear_bit(ALLOW_BUCK_DISABLE, &wcd937x->status_mask); - usleep_range(200, 250); - break; - case SND_SOC_DAPM_POST_PMD: - set_bit(ALLOW_BUCK_DISABLE, &wcd937x->status_mask); - break; - } - - return 0; -} - static int wcd937x_get_micb_vout_ctl_val(u32 micb_mv) { if (micb_mv < 1000 || micb_mv > 2850) { @@ -2226,10 +2195,7 @@ static const struct snd_soc_dapm_widget wcd937x_dapm_widgets[] = { SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_SUPPLY("VDD_BUCK", SND_SOC_NOPM, 0, 0, - wcd937x_codec_enable_vdd_buck, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), - + SND_SOC_DAPM_SUPPLY("VDD_BUCK", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_SUPPLY_S("CLS_H_PORT", 1, SND_SOC_NOPM, 0, 0, NULL, 0), /* RX widgets */ @@ -2915,24 +2881,17 @@ static int wcd937x_probe(struct platform_device *pdev) wcd937x->supplies[0].supply = "vdd-rxtx"; wcd937x->supplies[1].supply = "vdd-px"; wcd937x->supplies[2].supply = "vdd-mic-bias"; + wcd937x->supplies[3].supply = "vdd-buck"; ret = devm_regulator_bulk_get(dev, WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); if (ret) return dev_err_probe(dev, ret, "Failed to get supplies\n"); ret = regulator_bulk_enable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); - if (ret) + if (ret) { + regulator_bulk_free(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); return dev_err_probe(dev, ret, "Failed to enable supplies\n"); - - /* Get the buck separately, as it needs special handling */ - wcd937x->buck_supply = devm_regulator_get(dev, "vdd-buck"); - if (IS_ERR(wcd937x->buck_supply)) - return dev_err_probe(dev, PTR_ERR(wcd937x->buck_supply), - "Failed to get buck supply\n"); - - ret = regulator_enable(wcd937x->buck_supply); - if (ret) - return dev_err_probe(dev, ret, "Failed to enable buck supply\n"); + } wcd937x_dt_parse_micbias_info(dev, wcd937x); @@ -2949,13 +2908,13 @@ static int wcd937x_probe(struct platform_device *pdev) ret = wcd937x_add_slave_components(wcd937x, dev, &match); if (ret) - return ret; + goto err_disable_regulators; wcd937x_reset(wcd937x); ret = component_master_add_with_match(dev, &wcd937x_comp_ops, match); if (ret) - return ret; + goto err_disable_regulators; pm_runtime_set_autosuspend_delay(dev, 1000); pm_runtime_use_autosuspend(dev); @@ -2964,6 +2923,12 @@ static int wcd937x_probe(struct platform_device *pdev) pm_runtime_enable(dev); pm_runtime_idle(dev); + return 0; + +err_disable_regulators: + regulator_bulk_disable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); + regulator_bulk_free(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); + return ret; } diff --git a/sound/soc/codecs/wcd937x.h b/sound/soc/codecs/wcd937x.h index f267c66ca959..37bff16e88dd 100644 --- a/sound/soc/codecs/wcd937x.h +++ b/sound/soc/codecs/wcd937x.h @@ -483,7 +483,7 @@ #define WCD937X_MAX_REGISTER (WCD937X_DIGITAL_EFUSE_REG_31) #define WCD937X_MAX_MICBIAS 3 -#define WCD937X_MAX_BULK_SUPPLY 3 +#define WCD937X_MAX_BULK_SUPPLY 4 #define WCD937X_MAX_TX_SWR_PORTS 4 #define WCD937X_MAX_SWR_PORTS 5 #define WCD937X_MAX_SWR_CH_IDS 15