From patchwork Sat Dec 28 11:45:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13922287 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39DDE158DC6; Sat, 28 Dec 2024 11:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386341; cv=none; b=WYWwpL6jj7jAJnbpLoVBaNNvRQQIW445nHGEMe4m+sNxRpeaj4TIftJ0ccevMMuCfq/nlamPuFgBpw+h1AM+pglX8iS+UpXcqnwYLDe7SMAhVygXcvbIL2tSGhZyN9fKwl+CtkYPcfSclsLU+wZdB7SQWcIQu+OHMwx8GNcWBPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386341; c=relaxed/simple; bh=d6UyrRejsmAfm96ju9NgqEy2wiiUs0ECRS5QBVZv7yk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NNLgu4LWJHYs2zJaHPIGBW91rqyaM3NC6QSyuhAu3BDWEzMfB4ggq9W7c5HwJ6u0kCG/e9t5b15sLBx8UF+uAWiLzGLp9XW4H8Q3dT6QM1yRGcIk8XaaQKNg5jNvUBTIii105pIqmVwOkMAwgHLWKb8rnmw28rb1o2pdoLgAFm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k0q6X+py; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k0q6X+py" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso78938035e9.0; Sat, 28 Dec 2024 03:45:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735386338; x=1735991138; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GFopIDpO+r6tipeoCoOKjYN5R3LZIo87O8iXRWy2xZo=; b=k0q6X+pyZsOXtSpjp6s10FqNrD5XzZmzAQcvtvAHOFUeLriLQqPrPSiqP7harCAHrc 5LreHtlawE2LJY8CRM6agjVn23xGo5+VYL3TgvvOBsb15YDxSh8VucySQ2p/QKraitk9 A5GXU71c/ndOZO3jIH0/4eYcXSVf2Wzt66xkjZlbMUazbUguLeDQcMnh9QOwj4ZqEJZc 1bTK06GeAr4FGpre0r9LKD/NL3fGRW073zZRHzPBUmcLi6lz3nY3edDYh9254NqrD3DR BsjvA2Yvb8YELeVqo3/viXGvOvGZ2cdOLKjlZCsbvB+hjldbAKndp/XNG4JiqXV721XX 8wEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735386338; x=1735991138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GFopIDpO+r6tipeoCoOKjYN5R3LZIo87O8iXRWy2xZo=; b=vF5r0QwHbW9Wr37xyByu4VxvfHqIxxQgky71CB+PgCd9517pbrMCVeN5UL6DiWJ5ve w1zizVoAIMBhncQB7SIQXcUGDyyJlCLXAmxoexlosS2AxSsFDOwwHLOofNrMuSekBKTl c5sYo00rnw1Ixsrsn617RgUDRIOymU4p9xiOv9LkeJCxGom7cZPWO2vt+WyECOvhpZ3S C4ad98tDjsgdpY8x3Rb0cgvvzQ4rw9c477k/SJWQs/E5/tdqnJusE2afvqzABELIpHBR F6H0B37/pHHDjy3VKfeXSMHgM4h9wstUrM8RWMjOHRhfD8uAii5JduIRaJWsZR4F7ww8 iYCQ== X-Forwarded-Encrypted: i=1; AJvYcCUT5b0CNRsjq+EOC4Cpa8iiCaKFzjmfcC8LcPcpJ+/nZ41vxv5pGZqVb9JwjkYvm6IR30R2WmNPaoEvM9M=@vger.kernel.org, AJvYcCWH7v2a0XIzK0AQv+uMg475IlwLmFPhuC5mTJy92LXFUP2sHhsS28umKDCzD0stOevIpVUc2t2vDx2TMeA=@vger.kernel.org, AJvYcCWiRjad28GP/PP1sA0+DZqWuCqODMKqsCd7thlSU14PQ70VvJqSBa/Is9eT8jTOj+KTenqF1VYRgc7DzA==@vger.kernel.org X-Gm-Message-State: AOJu0YwTmtdX8CHwsXsFsNz1RgdnUr7dhP8PwOMJATH7l16OQ0eXoEnq NBjCfiPVWK7P0D1BogmDHpo1qjkvQxA+jou+xvk9gxd/5G3wv+NlawZ7wg== X-Gm-Gg: ASbGncuGWY/mMNlH0CnSNxCNC8qaKw74NBoGAqPLAg+n7PbfISJ+izGkcmKvElCDOMy nbZCSlr6ARwiUdBYn9qydwF9OrGmSKeGz1ec0dPW1M+edBkxaVBFMr1MOHdU9yVmJ/3LkHvhfRY /M8JVb+2xf1/B1dhVGnIoY9KWw+Rba1D87dPhlhwO4cnBVbqrcunHrSlqIOd1cgJJtxuXJKtY5d n7JmRkxlvBumRMNB96ZTYNj6/Ddmmdk/hhFC9+eBl3tMngRjS9Tgj96V/vQqONKzfNeD/toHJLH IuA= X-Google-Smtp-Source: AGHT+IFHEAJ5xGTydhruVrlDtkHtKRh4GSthe6tGTbUqhPFVUcQdVtILaaGTux8S+FCIHdMgz2zzXg== X-Received: by 2002:a5d:64a8:0:b0:38a:418e:f3f with SMTP id ffacd0b85a97d-38a418e1085mr10220236f8f.3.1735386338214; Sat, 28 Dec 2024 03:45:38 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436604e9c2csm295344975e9.43.2024.12.28.03.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 03:45:37 -0800 (PST) From: Ivaylo Dimitrov To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tony Lindgren , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Javier Carrasco Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Ivaylo Dimitrov Subject: [PATCH 1/5] arch: arm: dts: cpcap-mapphone: Set VAUDIO regulator always-on Date: Sat, 28 Dec 2024 13:45:10 +0200 Message-Id: <20241228114514.91594-2-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> References: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 VAUDIO regulator is used by cpcap codec and currently is enabled/disabled by dapm logic, however, when regulator is turned off, various cpcap functions (like jack detection) do not work. Configure VAUDIO regulator-allowed-modes property while at it to enable low-power regulator mode being set. Signed-off-by: Ivaylo Dimitrov --- arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi index ea02fd403a9b..83fd58157579 100644 --- a/arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi @@ -267,6 +267,8 @@ vaudio: VAUDIO { regulator-min-microvolt = <2775000>; regulator-max-microvolt = <2775000>; regulator-enable-ramp-delay = <1000>; - regulator-initial-mode = <0x00>; /* NORMAL */ + regulator-allowed-modes = <0x00>, <0x40>; /* ON, LOW_PWR */ + regulator-initial-mode = <0x00>; /* ON */ + regulator-always-on; }; }; From patchwork Sat Dec 28 11:45:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13922289 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2596515A86A; Sat, 28 Dec 2024 11:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386344; cv=none; b=UzNaHlWkWmeDvRKQjsf2EHG5+RV4K1nD/Q8ItrOixv85QLcbNPjvaGxukfZHjREv2bmCtLEIzqUHulHUSfYi8JKZ/YC7jsIV38BwVucy6Vle31IF89kafdnav3bK8toSzKos+gQbzEvgZQmsKQJKBSv/5grU0zh485to5l7UyQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386344; c=relaxed/simple; bh=NzRExqpkK2k3V1BJ5+RA3LQYtctyC4tI2jnse+BOts0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aOzUVcctW0F+JShsZx9PyndqxB/E8Eh+X2xcVRHBWuZfjKSy7k/s49gxBCZoNMeW5hS+1r+ckuLg9cdZU3ppV9b/DrxRIYvCU3GnOUlgk1rBdg1qJbhL5r1BkFddWzaRXPw5CZ9pdJ017yeJKDP/PvgYBHihQSl3gMCX/iWp7oI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D3WFk4kx; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D3WFk4kx" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43621d27adeso54384535e9.2; Sat, 28 Dec 2024 03:45:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735386339; x=1735991139; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sK+HJ7pKNRleFOF1/JHbnEYu3ZqRo0XiGD0AOm+5j54=; b=D3WFk4kxuXbZJwLH71vnu6Qmp2pKGPpvkAYS1KjyXvsSuqBjR8/x/ZIOhZe+7WIIAf ODbF60VMFAQr7YdsuNTDm2DerKBby6uAP4JPCKCYyjqXwiXuCKieXqQcj6D39jqSOFDJ FtWkUIGxuW0pyg+Wgc/cuyphVx0Tj1pRL3+4aG+cI9Qz4QtMxxBOhehMmFMw1NiMxAr1 lM/LQl3nMQkVwgOdhcj6Esk53kXXyGcQcbdnzLr3jg0FFDQtKt2s2r860k7UaCaGWZ5v L0+7pqGw4TwNRhusHV8Q9xeOfUMiX99QCiNMFNOyOFEbmmeFz++4RDLIHBO5hN2rGhe1 D42A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735386339; x=1735991139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sK+HJ7pKNRleFOF1/JHbnEYu3ZqRo0XiGD0AOm+5j54=; b=legeVGxUcuX+1QYVw3i0KnpOq8/SgI+xT+RZiQvGyl23V5xzdW1HLNy0bmQuSAwWh2 ObzchnkZBWoXHOF3AHIO1tBU3eB242MgwnH6mK0dHOIa/4b1KLP+yGiGv+99Fn8xAVdW IW1GTXDO9GPMPwzwamjpPWFDpc5LML/JmYW1/hqyth+13/Ihx1f3CNn1SpSgKAoWYB65 H71RR9ETOTlR4rZ+yVgfgjV7kMOhDui6nwbnKxMbFLnhurLfN/ZVluppYFZosUcGunBy VU8TYaxBEYdkurx4q58ogkh0KVp0YvXItl5lJ69CMvanB4a2igWT6/Lqk4tfC+K13ozO 6NAA== X-Forwarded-Encrypted: i=1; AJvYcCUP836/1FGL9txqfRbD9lzEAwO0Xmh+IOhuJBIDejrp3NdM0/LvFkxknxv5cSY4vJd4S5E4DcvvF4GGIg==@vger.kernel.org, AJvYcCUSoR2CJMaReZxt+63vAhpZQbrpaDMlOqP35qfJAyS9EOsYGi80qrLhgwYFXBeu3i6hSgQQEInXFnuST4s=@vger.kernel.org, AJvYcCX6bTt/xmBrT/2thQDAnTavz5VIc6rW11EUbaDx8YfKxf4EXIhiL9nAb0GXpoC4or2BUfk6TMF+nDHHyFc=@vger.kernel.org X-Gm-Message-State: AOJu0YxnNx+8j+8u8ivImhkmBM/EyAX/4eHqtt7lAXAira+maxbls464 Q5OD1X7yxk6JRZk8RoUwCyDXh0TSVU1HpvBt5keVvc5+Nju9FhQ1 X-Gm-Gg: ASbGncvUhpT+ESEkg9ZR2CQV6Wsq1cEG0WKr76znJgfkpnjISbw0hS3UvsbIY3qCKMI ejCmTwvqPAhn0xzNz4T4vrTiC3jfHtNiwPwWmyRZOnHsu24cdITNp+0DRT3jD9ZL88+nCBP1ObL Q3wFLKn78hwh3xMGGj1a1A+8GFLvkeCoE121geJA+UXr72xtinxid36t4ndgI0Vz4zEAGzxsQt/ COMnXERfkXu9f+QzO/6b+gYEpSGXRY29z9BxIu28DXNj4Qjnq+lpRM7BPJu0KgcAQ42PAYs6xDr cu0= X-Google-Smtp-Source: AGHT+IFq98uSaqZeHXs3HN51svibaMg0jD14Q06JIIubPHUOyYQ7RJvCZUtyN00T/MouHjbER294oQ== X-Received: by 2002:a05:600c:138d:b0:434:a852:ba6d with SMTP id 5b1f17b1804b1-43668642fa8mr259919855e9.9.1735386339393; Sat, 28 Dec 2024 03:45:39 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436604e9c2csm295344975e9.43.2024.12.28.03.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 03:45:39 -0800 (PST) From: Ivaylo Dimitrov To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tony Lindgren , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Javier Carrasco Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Ivaylo Dimitrov Subject: [PATCH 2/5] ASoC: cpcap: Implement .set_bias_level Date: Sat, 28 Dec 2024 13:45:11 +0200 Message-Id: <20241228114514.91594-3-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> References: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 With VAUDIO regulator being always on, we have to put it in low-power mode when codec is not in use to decrease power usage. Do so by implementing driver .set_bias_level callback. Signed-off-by: Ivaylo Dimitrov --- sound/soc/codecs/cpcap.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c index 04304a7ad915..53f549ede6a6 100644 --- a/sound/soc/codecs/cpcap.c +++ b/sound/soc/codecs/cpcap.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -260,6 +261,7 @@ struct cpcap_audio { int codec_clk_id; int codec_freq; int codec_format; + struct regulator *vaudio; }; static int cpcap_st_workaround(struct snd_soc_dapm_widget *w, @@ -1637,6 +1639,11 @@ static int cpcap_soc_probe(struct snd_soc_component *component) snd_soc_component_set_drvdata(component, cpcap); cpcap->component = component; + cpcap->vaudio = devm_regulator_get(component->dev, "VAUDIO"); + if (IS_ERR(cpcap->vaudio)) + return dev_err_probe(component->dev, PTR_ERR(cpcap->vaudio), + "Cannot get VAUDIO regulator\n"); + cpcap->regmap = dev_get_regmap(component->dev->parent, NULL); if (!cpcap->regmap) return -ENODEV; @@ -1649,6 +1656,27 @@ static int cpcap_soc_probe(struct snd_soc_component *component) return cpcap_audio_reset(component, false); } +static int cpcap_set_bias_level(struct snd_soc_component *component, + enum snd_soc_bias_level level) +{ + struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); + + switch (level) { + case SND_SOC_BIAS_OFF: + break; + case SND_SOC_BIAS_PREPARE: + regulator_set_mode(cpcap->vaudio, REGULATOR_MODE_NORMAL); + break; + case SND_SOC_BIAS_STANDBY: + regulator_set_mode(cpcap->vaudio, REGULATOR_MODE_STANDBY); + break; + case SND_SOC_BIAS_ON: + break; + } + + return 0; +} + static const struct snd_soc_component_driver soc_codec_dev_cpcap = { .probe = cpcap_soc_probe, .controls = cpcap_snd_controls, @@ -1657,6 +1685,7 @@ static const struct snd_soc_component_driver soc_codec_dev_cpcap = { .num_dapm_widgets = ARRAY_SIZE(cpcap_dapm_widgets), .dapm_routes = intercon, .num_dapm_routes = ARRAY_SIZE(intercon), + .set_bias_level = cpcap_set_bias_level, .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, From patchwork Sat Dec 28 11:45:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13922288 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B877615B547; Sat, 28 Dec 2024 11:45:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386344; cv=none; b=GVtBa8AGdUCNNGrzA5khDKsIcD8MiHI1QE5q/9/gxt58+NhNJNxtp0tHCvWfpDswPZ30VdsjT5xPcM2uSAwoK5TgvBxikvbQ10Ao/eiPffsdqVU0Js/WeC6jsNIndxEXOjkfo/K8M28K270FuyQqYENfG8TpP5woWZxxWqgkB8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386344; c=relaxed/simple; bh=DUAc9HZSl9erguOlLaChUT/uhGpliQdM4qk4Qx6t8V0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KtHmloMsu2pz3CqB8nnvBncJkTneoYoTgsD8y05xO2PR77mrY0K1RyV0l4ZKHTAxQgwe/Mz0vkl7GB9+L+uYnk8nHEgkmN9IsqGNn6b24QxaxwBZX5OtxEQ9NIdIf+UZGy/GTnBHNqeehpPcWM7g4BrkrCUTXDjF9iu5+7d32bs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LEThKUpK; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LEThKUpK" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4368a293339so36352865e9.3; Sat, 28 Dec 2024 03:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735386341; x=1735991141; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kSgsXD4iYArLNZe0DXDvxbYGmey8AYc/G5vzDfo3ins=; b=LEThKUpK1TEEBf+V55o6pTprrFVtzSnh7zjbl6nt/RjwQiNiEsZ4LIMOb1s6AffN1o PZSFBv0JQPm0DaPIh7NXZE5+Wm5+cmZwhpHpRDuc0B2as615FzOAEiVSQ4wBkGyAR6QI b6S+XjE/RryHlj1bow8YwkVCSpnh8D8xbfgwyUsLzjE8lzKJfGVQIkn/7HCq4IAFlHz0 HA15n4b9Wtp/RIdzoHPmsDz5+McLccFE6c3+riDKVXjYc26nLpV4nu17esfNcpyp+/S6 gAGeu+DI02xJ+8D20Lb9OCfz2SO872UeOyY0NHL6vTBqFxDnk0vBjVyIJoJ8RxsPQYP8 brlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735386341; x=1735991141; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kSgsXD4iYArLNZe0DXDvxbYGmey8AYc/G5vzDfo3ins=; b=nTD4l8PPWwtLGVTo/c8bYpFsul3/waUrduLIvT04AjOBLyFhReakMQxvNFfm3FqmdQ yFlH1rOlhwjgHrtn9Fo77TiHAX4u93C52Q4440hBEixBxcYXwuD5j3L4Y0FyLPDd0mFn o/NLIMNvttaJin1Dx0KrzVBPhPNC9bV4uRsyQ0LP2J6uf00bKwxpsEwe+O7Iez+EvGBk vfnSEG8rwNgsZ/Y9WnfVMhkHSZUbhjWb83rHuGw6cYl6PbeLiJ5NCewD/OOooYw+v5rA 3l2AU9iAceP+oSTZb1z5zRRSF4E5z9c3oZPo4Ue/bXADx++MZS0eKczHkm2UMUI04JGY cKNQ== X-Forwarded-Encrypted: i=1; AJvYcCVCRmYnenSB0tZNiig+/BSG8Ei96RHA+lb1KeWwOlZNPStWCtyqpkfOm9TzWTQa86eH7apY2es4x1IrDlg=@vger.kernel.org, AJvYcCW1TVZaZVKW6D5mlNc1ZP00q7QsfxwfeeAjvy09IAa31dxYO5D6mNhYDVU6uWu4kVat5HuXKikE4Sfl2g==@vger.kernel.org, AJvYcCXBUOFgmkFQYckPV5StAD+fLrC/tt/omjpuQQBXeZE2PaKkXBcQrxQKK5ZfmWCMbj87CZwq3HizM82MJyo=@vger.kernel.org X-Gm-Message-State: AOJu0YwDBl9tgULnEtHSeVVFuHBcLEZwCk6pZkDBeeHYqSWH6hF8OMZU hd2Dhwb/LjpmA4Vj6/r1EYUwoR9+w+pgMUA3KT8FlaY3/xUahz2G X-Gm-Gg: ASbGncsveaGOMlSW4LrIOyhop7E5EPXdX/1rNy+YJS+9dddpmRC9f+7ZUW6HcUbjBrc aEcJbrak0hqJxqhoNSLXnDcuCUjmBQKH9UDiKO8fd35td3bx59ls5VY8NSlL7sBmibededJRJhx ct2mGdkc4c/pNCgRHPzOnj6QQF2ayelyyQVRbf7gxkKKExuYe+lMHE/DI+3EA51vKranVDO1Y5M 1lvgCQ4+YX+bO33KR59ZQBTo2vrJ8+llXa3GBT4EkqbyU1WCibO8LSPjdAX96BcXLPxNZ0TsDIq BGI= X-Google-Smtp-Source: AGHT+IF7Lks9Lexc76wTSzCJF5qkL/G7cfx0Zj9NJeSQXXuoF9AodjKIhLMsIy76RoPf27o5yrdaxA== X-Received: by 2002:a05:600c:3ca4:b0:436:6460:e680 with SMTP id 5b1f17b1804b1-43668646b20mr265094505e9.16.1735386340726; Sat, 28 Dec 2024 03:45:40 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436604e9c2csm295344975e9.43.2024.12.28.03.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 03:45:40 -0800 (PST) From: Ivaylo Dimitrov To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tony Lindgren , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Javier Carrasco Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Ivaylo Dimitrov Subject: [PATCH 3/5] dt-bindings: mfd: motorola-cpcap: Document audio-codec interrupts Date: Sat, 28 Dec 2024 13:45:12 +0200 Message-Id: <20241228114514.91594-4-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> References: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds the DT binding for the audio-codec headset detection interrupts Signed-off-by: Ivaylo Dimitrov --- Documentation/devicetree/bindings/mfd/motorola-cpcap.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/motorola-cpcap.txt b/Documentation/devicetree/bindings/mfd/motorola-cpcap.txt index 190230216de8..3ad809e119ff 100644 --- a/Documentation/devicetree/bindings/mfd/motorola-cpcap.txt +++ b/Documentation/devicetree/bindings/mfd/motorola-cpcap.txt @@ -31,10 +31,15 @@ node must be named "audio-codec". Required properties for the audio-codec subnode: - #sound-dai-cells = <1>; +- interrupts-extended = <&cpcap 9 0>, <&cpcap 10 0>; +- interrupt-names = "hs", "mb2"; The audio-codec provides two DAIs. The first one is connected to the Stereo HiFi DAC and the second one is connected to the Voice DAC. +audio-codec interrupts are required for jack detection, "hs" one is headset +detect and "mb2" is microphone bias 2 detect. + Example: &mcspi1 { @@ -52,6 +57,10 @@ Example: audio-codec { #sound-dai-cells = <1>; + interrupts-extended = + <&cpcap 9 0>, + <&cpcap 10 0>; + interrupt-names = "hs", "mb2"; /* HiFi */ port@0 { From patchwork Sat Dec 28 11:45:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13922290 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5429F158D96; Sat, 28 Dec 2024 11:45:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386346; cv=none; b=uRt+2Uu823uWQZQyW3KL875txYlWXu5VbLQlp4f11Kas5M4N3HKWdgp0egHOvZVT7XJTTT9ynFyYQMjsTRBf2tfd5WRRMqFb7nqoCjrb7cga/VH6oe0/MY+xH76Z/DxM+4MHh+cUgOB5/gkcFwrC/Yw/n5Jp6WyV6gW3/fNqBxE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386346; c=relaxed/simple; bh=oomA8INCiujbHuhJQLZolEAhwKc/GJDmeFlk6rCiPS0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UDx4BhqX/FZ6zVkCtRzhdjrNB42J65m9C7uStltoF6RRWY8QNrUmRT4RMThWLXXDiSElZIDMNzHdkkEdJjmkYnZDONsgiC45TS7oFRrlHlDUzNdtxbby1QaXq9q5WHQ0EpKGxkuY2VNEV/DXZD7rR0CIEJHW/67p14Vxa/LgeyE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Jl1Fvm35; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Jl1Fvm35" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4361fe642ddso83229535e9.2; Sat, 28 Dec 2024 03:45:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735386343; x=1735991143; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fi8MyNB6ujYSDg0t/ugq0Xxj9SCvYo0uG2JlKHQdqSg=; b=Jl1Fvm35xZ51gOYgav9PcA/iWsoEJn9loBzd2yP+OYMA3fiP/zVgCGl1Yg7fJn829R rkhUOIVxEn1Z+LN2x22XNrwJUwLgGciGBZr0uAHsMMZPhsrjTknRsiXFfuMZ3yDK+tyA 143rfLdtDGiyDU7usgJuNl+1XQPxR8Us5g9KHV2OfdFdSjVCApmY3uHr+ECTxCpRrle0 lj5+km6MKCOjJPyUnzodoV9IrdZuT8/+5p3KCScRU0fy06UogYb8m0I8y71I7NFLopN9 sl+IcK/orEI6yQ5ucLpPBy+z5wNu8jsh2NBfbOt4whAXRnq6QUma2TzgGkRMrqS6GtM2 y41w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735386343; x=1735991143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fi8MyNB6ujYSDg0t/ugq0Xxj9SCvYo0uG2JlKHQdqSg=; b=TY93NZW2WY4A74t1au5zS9ojbde2S08fmAWQvBz59vxlVsjOgryhU0O9t9UP2XVZJe tyRi6HXfW6DQJXk2sVMpkkKvP+XFulaMT6RjSjwTYuyCcsZ2IOkHlKeyeN77OK//1jA+ AHUgvO1hrifEvhwzmbjJ1ZMf4PcCv5yrqau24vwMhEDm5j6dy3rIVI2c2WXo/KxVYFlm dQkIB6YAc8tNxcOKF6wCbHWJe/SfPDeOzBJe6SsNMPsOPsnhUGkfqgUHXMS8o65mJfPk 8m7AnLHj0ng/kp627piLJ7VKFxTBZkX0TydKQVsrL7WAgxN31CiV/h8sbGzUAoIrhL7E Pe8g== X-Forwarded-Encrypted: i=1; AJvYcCVWtG7OixV4dWL6pP+1wLrjnOPbN4BSh4IanhAr0kN9TS7g4hN91ufEnry1QS0khxg8G96RlQfiIGkttA==@vger.kernel.org, AJvYcCWjlG2zvc3IhZm9edHXEpXZY5sbRTrATGfIrHdy1PPX7QEP67CYNO0gpNrdGAia8OCvvIiEkzMsU4oukLI=@vger.kernel.org, AJvYcCXCr/ga9xzfGcIKbYVAFcRS1+67YJwK+5/b0Chn1eA7HhrsGi9R5fA1bunvZM0SEJqrtZ5h58GV9UkNC/8=@vger.kernel.org X-Gm-Message-State: AOJu0YwfppKgunCrEXXD9IlLvfbpHnTRZ/urGO7m7uf0bM0lgRH1xeET A813v3tfLaPNGfWJ9R9j0bdQBLYvc3OzxPAmxrvsVUJvwAieySbT X-Gm-Gg: ASbGncsW6gihNYYR5NM1+zfBsObOnK73ucWLouEqJ/jHSLtq6e+2Vx46wo07ZKIqTMB lbUiy9g3QtL1MYVBH/U3fuFqw4APhBUAjro1WSTNLZzoGq2l+4QDXSwZIUVpX0w7ndPR2e4+I6Z CePZidvJLJWYWJXBa9kXpZ1H8EcX6FRqtFqYhYLMKzUAT4HZREwIcnvzOmAN8qVijYa1WasNFGY b08C7322YWoaKytlQbt52UwELkvUpaOPvNAgWNVNlKdEq15Rlsh5zy5G/1fbeSUNFjb5A0UkC88 ppo= X-Google-Smtp-Source: AGHT+IHcn/4WR+oIOgHXJC7u+v6co6Dcjmi09V0bWJXrbnB1Kr2WyIBrUf0umZZc+Gpw0VKEs6RmwQ== X-Received: by 2002:a05:600c:1c12:b0:431:58cd:b259 with SMTP id 5b1f17b1804b1-4366d356dfcmr267543035e9.31.1735386342450; Sat, 28 Dec 2024 03:45:42 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436604e9c2csm295344975e9.43.2024.12.28.03.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 03:45:41 -0800 (PST) From: Ivaylo Dimitrov To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tony Lindgren , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Javier Carrasco Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Ivaylo Dimitrov Subject: [PATCH 4/5] arch: arm: dts: cpcap-mapphone: Add audio-codec jack detection interrupts Date: Sat, 28 Dec 2024 13:45:13 +0200 Message-Id: <20241228114514.91594-5-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> References: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 cpcap audio-codec supports headset/micrphone detect interrupts, configure them. Signed-off-by: Ivaylo Dimitrov --- arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi index 83fd58157579..f51de4f7bc11 100644 --- a/arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/ti/omap/motorola-cpcap-mapphone.dtsi @@ -69,6 +69,10 @@ cpcap_regulators: regulators { cpcap_audio: audio-codec { #sound-dai-cells = <1>; + interrupts-extended = + <&cpcap 9 0>, + <&cpcap 10 0>; + interrupt-names = "hs", "mb2"; port@0 { cpcap_audio_codec0: endpoint { From patchwork Sat Dec 28 11:45:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13922291 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7080E16A92E; Sat, 28 Dec 2024 11:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386347; cv=none; b=P45VNMh96HTRw5mGawYZWUimhTBiGsxso/w6alq64jIaf2IyWTOLg5Gu4Ur2IkkD13aduRVqweMxIwNddp3FfhrcdUaB5Dpgz8wWhfbUEIIxPaOSlSf7Ur7ogj3iF1FodLK2z3wYZQKPwSF4s55vp2nMaMuaVpcEpzyn/pinU0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735386347; c=relaxed/simple; bh=I+XbE+O1GMpNXKOjk7mDvRYZZ5SHkdDbzIw7sXcb4cg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U2vXHtNufjM0bQWiBFZ46g4UDQaz+zR7CTT8KjzOHCOfJNh0C5KCv9aHZeR+8nQXtQkxWkrGdxDy/jW4NxqLbN2IDP0mzCl9vGaLIi56kDLM6HPIQBzKTlTMp+nDP09XuGdKCCpLi/vQPbdoSNtkgOHbQTSpYjq0i+/xnK1FcOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a5CWRcPI; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a5CWRcPI" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4363dc916ceso52456195e9.0; Sat, 28 Dec 2024 03:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735386344; x=1735991144; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MBw8BVSD11OXwlS6ruYnSHe7nASCCdh0cfHlL7Ue7jw=; b=a5CWRcPIjhbsBCgkpJf43Vv6+EzHNsvL1qNy0GLdregabGejGt8qJkAdjeTbqWjQr6 T6gfnUFcfX8YwjI/ySIrz0ufP2kIuTGyD8kSy2HHfV2GUviLACA4dH0KnQvV/qIv/EHd YaZcKFDJkX1KdIeWrejO1MClRNatEGML7SrrG4wMMas7McAyFvdPPPn653sLMTtSTvQL zv7W/u9EdEQmXd2hc3SZG7ZFTOm93QWeSkby9hsbYYI7Z5So43TUaVnhSpedXS9XB06I 7O/2JTiT5VYFSyHK3Cqi/8B1XriNG8xbKoazdDeoVw0i2wPNr1pv7kyj9tkh+Fv358EW WDXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735386344; x=1735991144; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MBw8BVSD11OXwlS6ruYnSHe7nASCCdh0cfHlL7Ue7jw=; b=U5I4gmqFkmC9gXNf2VJXCYfknH9Z8Rgo1y/pdBmcsu6IM1Lr4WMLP5iGURCNufxD1a llZNLXKVoLBvErkJnmxuHgHanWSCTV+V5IHY4R7YmmxbV96RgL0uAr0IMGN+o1dheobf E1cqMXjULSqGGhlgpB/uICz/016ZzrzRiRJKGAjrf8rExknbtT7SuX9G0Ts908ZErOjx mfhVMIFEsHgnCEyQzFgWdblWXeLlGe6P0y+5YFFr7DLssfs4JhiT+rDT51nHC828UcVF 0/qOnxy88LWIm2+y0lu9++QGNrDhijFdFTg0FMhMypjXGr97c/yDYxQ33IFwQgXj3011 tPcw== X-Forwarded-Encrypted: i=1; AJvYcCVKI3GJ5AfyDECbXj6r/w+QYCBJDI64mhKdT4wihRqOM3MrhJAdhmYJN/C+A8bG3C7hm5s+1stqCnurqCA=@vger.kernel.org, AJvYcCWCZ+OEJLFTmCkA36Ocw5q2p1m65SEmo1zBLwcnqah6267myARV7OTBLxDDoqnLdB05M3R6H+ntBu58inU=@vger.kernel.org, AJvYcCWTE74cPxywlc9+gSPYiZYu5bC8FdgGVgxegATh46HkVKoZOhJ3GL3hYzznUsTvxqZFIlrBlOQRuYLOOg==@vger.kernel.org X-Gm-Message-State: AOJu0YwbrgOyUNgec1Lehtvt/YbBeFMtpnhpVgc0+PxE7a1V/HYZKjBX mDFygzcSAe/0nLoasT7K5jgBNNrpXSJgdOmLaWzlSdaKcqza70Q3 X-Gm-Gg: ASbGncuvvd7sPAzo4Z2N2U4Lh35DbAJgievDK47iw8I8WUttxhpB5dyltyfvbmmO9gn ZHSO5wD3DLCO72ilWNmP0bb8NPQksEG5miyPfkYShiDcE8u2AKGrPNtFfVA4PeG8QtX4Dwie5g+ igmibyIMP9AluaShsPxZKyqJ9YAIOEK1EpAWfc7HMrdlGRRVTWgVrN2Hkzr5KLDIYpvHc3m5uOb ZiQjrmQOS6DitYWy7t+EwA1Hw6KqZzDNKZveXH4EvH3jzo4mE1LHM547MNru4Hp0yM9O5+tdnqT c8E= X-Google-Smtp-Source: AGHT+IEX4aaEt5f72x3lb7XK5hUpQgAUH/yAKwqBjzghvpNV66dC3oP6NufsGD6tFeTfXcW3P/Ejlg== X-Received: by 2002:a05:600c:3596:b0:434:f1bd:1e40 with SMTP id 5b1f17b1804b1-436697f917fmr248830325e9.6.1735386343639; Sat, 28 Dec 2024 03:45:43 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436604e9c2csm295344975e9.43.2024.12.28.03.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 03:45:43 -0800 (PST) From: Ivaylo Dimitrov To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tony Lindgren , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Javier Carrasco Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-sound@vger.kernel.org, Ivaylo Dimitrov Subject: [PATCH 5/5] ASoC: cpcap: Implement jack detection Date: Sat, 28 Dec 2024 13:45:14 +0200 Message-Id: <20241228114514.91594-6-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> References: <20241228114514.91594-1-ivo.g.dimitrov.75@gmail.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 cpcap has headphones/microphone and PTT button detection logic, implement code to support it. Signed-off-by: Ivaylo Dimitrov --- sound/soc/codecs/cpcap.c | 171 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 170 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c index 53f549ede6a6..82c14ba6e8bc 100644 --- a/sound/soc/codecs/cpcap.c +++ b/sound/soc/codecs/cpcap.c @@ -14,9 +14,18 @@ #include #include #include +#include +#include #include #include +/* Register 8 - CPCAP_REG_INTS1 --- Interrupt Sense 1 */ +#define CPCAP_BIT_HS_S 9 /* Headset */ +#define CPCAP_BIT_MB2_S 10 /* Mic Bias2 */ + +/* Register 9 - CPCAP_REG_INTS2 --- Interrupt Sense 1 */ +#define CPCAP_BIT_PTT_S 11 /* Push To Talk */ + /* Register 512 CPCAP_REG_VAUDIOC --- Audio Regulator and Bias Voltage */ #define CPCAP_BIT_AUDIO_LOW_PWR 6 #define CPCAP_BIT_AUD_LOWPWR_SPEED 5 @@ -262,6 +271,9 @@ struct cpcap_audio { int codec_freq; int codec_format; struct regulator *vaudio; + int hsirq; + int mb2irq; + struct snd_soc_jack jack; }; static int cpcap_st_workaround(struct snd_soc_dapm_widget *w, @@ -1628,14 +1640,105 @@ static int cpcap_audio_reset(struct snd_soc_component *component, return 0; } +static irqreturn_t cpcap_hs_irq_thread(int irq, void *data) +{ + struct snd_soc_component *component = data; + struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); + struct regmap *regmap = cpcap->regmap; + int status = 0; + int mask = SND_JACK_HEADSET; + int val; + + if (!regmap_test_bits(regmap, CPCAP_REG_INTS1, BIT(CPCAP_BIT_HS_S))) { + val = BIT(CPCAP_BIT_MB_ON2) | BIT(CPCAP_BIT_PTT_CMP_EN); + regmap_update_bits(regmap, CPCAP_REG_TXI, val, val); + + val = BIT(CPCAP_BIT_ST_HS_CP_EN); + regmap_update_bits(regmap, CPCAP_REG_RXOA, val, val); + + regulator_set_mode(cpcap->vaudio, REGULATOR_MODE_NORMAL); + + /* Give PTTS time to settle */ + msleep(20); + + if (!regmap_test_bits(regmap, CPCAP_REG_INTS2, + BIT(CPCAP_BIT_PTT_S))) { + /* Headphones detected. (May also be a headset with the + * MFB pressed.) + */ + status = SND_JACK_HEADPHONE; + dev_info(component->dev, "HP plugged in\n"); + } else if (regmap_test_bits(regmap, CPCAP_REG_INTS1, + BIT(CPCAP_BIT_MB2_S)) == 1) { + status = SND_JACK_HEADSET; + dev_info(component->dev, "HS plugged in\n"); + } else + dev_info(component->dev, "Unsupported HS plugged in\n"); + } else { + bool mic = cpcap->jack.status & SND_JACK_MICROPHONE; + + dev_info(component->dev, "H%s disconnect\n", mic ? "S" : "P"); + val = BIT(CPCAP_BIT_MB_ON2) | BIT(CPCAP_BIT_PTT_CMP_EN); + regmap_update_bits(cpcap->regmap, CPCAP_REG_TXI, val, 0); + + val = BIT(CPCAP_BIT_ST_HS_CP_EN); + regmap_update_bits(cpcap->regmap, CPCAP_REG_RXOA, val, 0); + + regulator_set_mode(cpcap->vaudio, REGULATOR_MODE_STANDBY); + + mask |= SND_JACK_BTN_0; + } + + snd_soc_jack_report(&cpcap->jack, status, mask); + + return IRQ_HANDLED; +} + +static irqreturn_t cpcap_mb2_irq_thread(int irq, void *data) +{ + struct snd_soc_component *component = data; + struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); + struct regmap *regmap = cpcap->regmap; + int status = 0; + int mb2; + int ptt; + + if (regmap_test_bits(regmap, CPCAP_REG_INTS1, BIT(CPCAP_BIT_HS_S)) == 1) + return IRQ_HANDLED; + + mb2 = regmap_test_bits(regmap, CPCAP_REG_INTS1, BIT(CPCAP_BIT_MB2_S)); + ptt = regmap_test_bits(regmap, CPCAP_REG_INTS2, BIT(CPCAP_BIT_PTT_S)); + + /* Initial detection might have been with MFB pressed */ + if (!(cpcap->jack.status & SND_JACK_MICROPHONE)) { + if (ptt == 1 && mb2 == 1) { + dev_info(component->dev, "MIC plugged in\n"); + snd_soc_jack_report(&cpcap->jack, SND_JACK_MICROPHONE, + SND_JACK_MICROPHONE); + } + + return IRQ_HANDLED; + } + + if (!mb2 || !ptt) + status = SND_JACK_BTN_0; + + snd_soc_jack_report(&cpcap->jack, status, SND_JACK_BTN_0); + + return IRQ_HANDLED; +} + static int cpcap_soc_probe(struct snd_soc_component *component) { + struct platform_device *pdev = to_platform_device(component->dev); + struct snd_soc_card *card = component->card; struct cpcap_audio *cpcap; int err; cpcap = devm_kzalloc(component->dev, sizeof(*cpcap), GFP_KERNEL); if (!cpcap) return -ENOMEM; + snd_soc_component_set_drvdata(component, cpcap); cpcap->component = component; @@ -1644,6 +1747,16 @@ static int cpcap_soc_probe(struct snd_soc_component *component) return dev_err_probe(component->dev, PTR_ERR(cpcap->vaudio), "Cannot get VAUDIO regulator\n"); + err = snd_soc_card_jack_new(card, "Headphones", + SND_JACK_HEADSET | SND_JACK_BTN_0, + &cpcap->jack); + if (err < 0) { + dev_err(component->dev, "Cannot create HS jack: %i\n", err); + return err; + } + + snd_jack_set_key(cpcap->jack.jack, SND_JACK_BTN_0, KEY_MEDIA); + cpcap->regmap = dev_get_regmap(component->dev->parent, NULL); if (!cpcap->regmap) return -ENODEV; @@ -1653,7 +1766,58 @@ static int cpcap_soc_probe(struct snd_soc_component *component) if (err) return err; - return cpcap_audio_reset(component, false); + cpcap->hsirq = platform_get_irq_byname(pdev, "hs"); + if (cpcap->hsirq < 0) + return cpcap->hsirq; + + err = devm_request_threaded_irq(component->dev, cpcap->hsirq, NULL, + cpcap_hs_irq_thread, + IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, + "cpcap-codec-hs", + component); + if (err) { + dev_warn(component->dev, "no HS irq%i: %i\n", + cpcap->hsirq, err); + return err; + } + + cpcap->mb2irq = platform_get_irq_byname(pdev, "mb2"); + if (cpcap->mb2irq < 0) + return cpcap->mb2irq; + + err = devm_request_threaded_irq(component->dev, cpcap->mb2irq, NULL, + cpcap_mb2_irq_thread, + IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING | + IRQF_ONESHOT, + "cpcap-codec-mb2", + component); + if (err) { + dev_warn(component->dev, "no MB2 irq%i: %i\n", + cpcap->mb2irq, err); + return err; + } + + err = cpcap_audio_reset(component, false); + if (err) + return err; + + cpcap_hs_irq_thread(cpcap->hsirq, component); + + enable_irq_wake(cpcap->hsirq); + enable_irq_wake(cpcap->mb2irq); + + return 0; +} + +static void cpcap_soc_remove(struct snd_soc_component *component) +{ + struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); + + disable_irq_wake(cpcap->hsirq); + disable_irq_wake(cpcap->mb2irq); } static int cpcap_set_bias_level(struct snd_soc_component *component, @@ -1661,6 +1825,10 @@ static int cpcap_set_bias_level(struct snd_soc_component *component, { struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); + /* VAIDIO should be kept in normal mode in order MIC/PTT to work */ + if (cpcap->jack.status & SND_JACK_MICROPHONE) + return 0; + switch (level) { case SND_SOC_BIAS_OFF: break; @@ -1679,6 +1847,7 @@ static int cpcap_set_bias_level(struct snd_soc_component *component, static const struct snd_soc_component_driver soc_codec_dev_cpcap = { .probe = cpcap_soc_probe, + .remove = cpcap_soc_remove, .controls = cpcap_snd_controls, .num_controls = ARRAY_SIZE(cpcap_snd_controls), .dapm_widgets = cpcap_dapm_widgets,