From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 B6710212D97; Tue, 18 Mar 2025 17:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.152.168 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742318114; cv=none; b=D1n16yc5axst1PA3lHP4zMT/afSAgJ/R0WJLojqtTnESoYlNIL53KvpVt4fIJgH0/iGGQY45Clpu+k5i4uTdf3+ogUGWuHXf7zoq9RjJiZhV8V+ePCEqIY+Y2riVWOKanbRADaopSwlNKhBchFyakH4qAy0rTHqLJyQ+StGRYsg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742318114; c=relaxed/simple; bh=gBvREq43h+d8ri5lUrPjWbsYpqwaS5jKBWCTUI+kpYQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LKZB79g+boPpcMO+pth9v3Hex+WcUo11MhwqSsDc2cGnERXuDUpRKwEQ2ylH8j8pqUytON3nDnUHKnJutlokZXhmvzt+J9zPxnZUQcXW++p907c5MYhYkluZ4KqRA9QNsyC7WalZ2QZgnTSLWpGVX5RcGHHcb9Z2HOg7UPLcVyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=q7LAeVht; arc=none smtp.client-ip=67.231.152.168 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="q7LAeVht" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52I5qiuK018522; Tue, 18 Mar 2025 12:15:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= PODMain02222019; bh=vZLoj8BzCsEIfXnkHhWeN6v3RfZwA+6OiHbRsVlD5Vc=; b= q7LAeVhtMLkVrDB21D/AhMEq74XEqsAVCDClawGceQYQ5cggOtH2v2niBKh+TSOx O6sAXAw3DVffl+cExgfjPLO/X8Z0O4iz5SXuq24HST+woO11Qu9B3/jgyXD6z/Is 8rN+YvsCQ7hN2/Zk7JU0d6Wot3CNbXG1nJfk1TGoxBFi/Q2iDviy6X0tMxGqIvq4 nhnDyI4l/a/N3zk0RGV/B5XRl3RO6zVmCADjfxLqIUR3A5hx/xOaFu1Jd4P2yXIX 0i4wN0PtEFXxVj8HLZyreHtcuR2U3BHbfYUcHeQXuy7yTc3m8fhjc7oFUBRz+NQS gZy+49q/agByOvACNKJqfw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 45d5yh879v-10 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Mar 2025 12:15:06 -0500 (CDT) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Tue, 18 Mar 2025 17:15:00 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Tue, 18 Mar 2025 17:15:00 +0000 Received: from ediswws07.ad.cirrus.com (ediswws07.ad.cirrus.com [198.90.208.14]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 2A44A82255C; Tue, 18 Mar 2025 17:15:00 +0000 (UTC) From: Charles Keepax To: CC: , , , , , , Subject: [PATCH 15/15] ASoC: ops: Apply platform_max after deciding control type Date: Tue, 18 Mar 2025 17:14:59 +0000 Message-ID: <20250318171459.3203730-16-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250318171459.3203730-1-ckeepax@opensource.cirrus.com> References: <20250318171459.3203730-1-ckeepax@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Authority-Analysis: v=2.4 cv=GrhC+l1C c=1 sm=1 tr=0 ts=67d9aa1a cx=c_pps a=uGhh+3tQvKmCLpEUO+DX4w==:117 a=uGhh+3tQvKmCLpEUO+DX4w==:17 a=Vs1iUdzkB0EA:10 a=w1d2syhTAAAA:8 a=NfW0dt3s_OP-V94RNuMA:9 X-Proofpoint-GUID: zcGncDXP9cSo4uVzoVyUvyEi1kB9HDBT X-Proofpoint-ORIG-GUID: zcGncDXP9cSo4uVzoVyUvyEi1kB9HDBT X-Proofpoint-Spam-Reason: safe It doesn't really make sense for the type of a control to change based on the platform_max field. platform_max allows a specific system to limit values of a control for safety but it seems reasonable the control type should remain the same between different systems, even if it is restricted down to just two values. Move the application of platform_max to after control type determination in soc_info_volsw(). Signed-off-by: Charles Keepax --- sound/soc/soc-ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 3ac5b3a62c812..8d4dd11c9aef1 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -172,9 +172,6 @@ static int soc_info_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo, struct soc_mixer_control *mc, int max) { - if (mc->platform_max && mc->platform_max < max) - max = mc->platform_max; - uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; if (max == 1) { @@ -185,6 +182,9 @@ static int soc_info_volsw(struct snd_kcontrol *kcontrol, uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; } + if (mc->platform_max && mc->platform_max < max) + max = mc->platform_max; + uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1; uinfo->value.integer.min = 0; uinfo->value.integer.max = max; -- 2.39.5