From patchwork Wed Jan 22 16:41:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13947512 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 78394149E17; Wed, 22 Jan 2025 16:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564103; cv=none; b=exV5qdTjIfQzNxLnzTckOy+4mnqtGco1AbRIX2hgd5ivIiKve7bZeGEWC9V3FDeCiIMU0Cdk1rMjhSrJJgObSJdA53vRPLUF8SdTNBXtPeIKwWZ2CokYUO2KeoIja4+RCbA2ZbhcLN2FfrTRplsgqQ42zxlc5lsCsz4FdmduiF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564103; c=relaxed/simple; bh=d6UyrRejsmAfm96ju9NgqEy2wiiUs0ECRS5QBVZv7yk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cJhzvrlqESU1ZeBZ3s2Je8VD50pzuYwf+RXYyC2hlin8DDAfzoW4m2AklL1aKOlZqD3vLeChiCYS/HmE1tf97beqOzEM7LI5r70srg7G2sUIvAaNtIlGDS1O1MmJHYY5XleYcmzUL4bIJMmEAw9OW8y20mvvDxV9DazEdllqWGw= 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=I9R+lkrY; arc=none smtp.client-ip=209.85.208.47 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="I9R+lkrY" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5d647d5df90so12002580a12.2; Wed, 22 Jan 2025 08:41:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737564100; x=1738168900; 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=I9R+lkrYfDDGZzXIJ6tHWhOACWBAs94mepPHV4GoumZ1m3PwtVrtKxzq1LfYmD/6mk Csk5WvQFkBMTOAZXhXUwSpia+mb634X5etPXp7cJIoko5X09A54op8qrUh1IMSuweI1p atI/mvXEDVBHziBTP4mhBVXM3liE0T6JR8GW2aAHwJ2t6lYkcewpaYd6wGlfmmgZ2kAQ PK9o7rerpHtAaHBai6FuJyFylD091LN75cJPPBmfU9kROS6X6qfeN+Frd/Gqvayrcx8+ d2RYIPZc0bgnm/wYi65cFegvmi3SOHr4Z6MgbqO3n8LmXjQbyTnD83bMxAelO4YsYRq7 Tr8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737564100; x=1738168900; 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=FXG0CeDnAemBAzvJQwCKFVnAbCia8hQ5xpNTbs75nJiz9O36IkCX5HNEhHGgojDTVt gZrX8oDO/jCpYht4+0pRruoO7ej+SWH8WBUr1mKw0b9uBU8h6uTwLAVXbrS7NRzoULOb BRQ43E+5KqDyjP4ECYRi2tNLbTX5N02A5o4CEj0VNyjkMOhOvr4Nk7O7mlUEgzTP5L2U POal5VfjaCSynMuUyPKTEodsqm8qJD/deJEngkukMgl3z2MZeOgsC2Jihu8AyaaEW8TH OMuLAUHL1ZVcEWX1oXk555xfnMiTnh/TGyn/xW/0NOEcKplW1e8zTNcjBEoK9WBkOvAF 83Zg== X-Forwarded-Encrypted: i=1; AJvYcCUkzjVmBYcDnFsxjZeosTRle2Z/VHCIYNvcNW25NJwgo1fp7zT8TRLwk5ynasl4RMb/Zcz4LTQ0AZvd3gU=@vger.kernel.org, AJvYcCUrfSCc9gEJquF6XYdesNyV0/lS3T+5zoeWtj43i1te0rfvaysr607ujb1G/ek8BkG/Gkzsg22HTqhBg1Q=@vger.kernel.org, AJvYcCWOmEMJCQz79hhATX8zU0LWiJZ4GOHv8FCOOj3gFMYdpC0q80HBDSUytAcqinBgnDcegN7t4v9GiD2Z1w==@vger.kernel.org X-Gm-Message-State: AOJu0Yw6Amkwsb35qGwINdLcmYlpkw97fwwgOxIVRjqvc3dQjg4r7h1J ePPbxjIuZMHgswn3GosWC5zxVJQ/JHOmBrAF3aORmv+guNna3/YJ X-Gm-Gg: ASbGncvy8OkaqEr7L2T2TrryK1+UtCgxJ2vjamrpWV3OYKtvXBwtQtjqgVVYKMTIt3e R8JAFDLjemcpmPDNG/qoHdpLHdQK2VIJDh/nTW/KlPG9HuZHSsm/RhX5SMQiTTQfUe5M4kuIbQE ZFEMTOXXt0566LYr5+6YAgRRiNDcYxnhkNClpj+Lb1wj4ktez+MwNF3oFLxWIHmoENvmKm6nZJi fBPpbHH5YpQC6ofZ4bW0Sutt4FgI1dGIAt52hn3zR9WWJettTq5xhPSxLa79QTfOa1Kfpq9zGWm wpbstGpCls3Ip7yk X-Google-Smtp-Source: AGHT+IGaWl3R5pzSePJ7g2SzWHz4DTyvSZyHn6h9j0/sOvWSrrQzELuFoFAw7+BqtmWVRdZu0TrxYw== X-Received: by 2002:a05:6402:42c2:b0:5d3:baa3:29f with SMTP id 4fb4d7f45d1cf-5db7d2f85a3mr20888051a12.9.1737564099491; Wed, 22 Jan 2025 08:41:39 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5db73642580sm8647061a12.15.2025.01.22.08.41.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 08:41: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 v2 1/5] arch: arm: dts: cpcap-mapphone: Set VAUDIO regulator always-on Date: Wed, 22 Jan 2025 18:41:25 +0200 Message-Id: <20250122164129.807247-2-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122164129.807247-1-ivo.g.dimitrov.75@gmail.com> References: <20250122164129.807247-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 Wed Jan 22 16:41:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13947513 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 D4DD0215188; Wed, 22 Jan 2025 16:41:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564104; cv=none; b=mL2lr0YUIlBPs18q4lu+kAZbn29tOhy3qCrQOo8ca23UdvJiicWF0//qcVhkyAiE3NQtyLJbZg8d6uCG0bCgI4to9v57LXsDo/1+6tNmEZj3VKSMmcH6soO9G29v0aAgjK+75k8siwPMQ9mJHq7tKUroyNdPaT46BOGEyRTb9uU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564104; c=relaxed/simple; bh=NzRExqpkK2k3V1BJ5+RA3LQYtctyC4tI2jnse+BOts0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gHq0aJgMoghpbkPqOeTl2XuCBev2ZeVVD/+p8cc4KP4d8KB01J6UbWnIVJi0vsPajqY2SxxX0WtuqZnQkWsm0wg1EPjcp2PF2oC2TrX8JKAAsCYWgSVK4YHz/SSgvA+jJnYRbLnBdXRUcFlHEgG4dpwqd9axOxZ9cRb8EfAx4OE= 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=VNUbR3v2; arc=none smtp.client-ip=209.85.208.49 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="VNUbR3v2" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5d3f57582a2so2355759a12.1; Wed, 22 Jan 2025 08:41:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737564101; x=1738168901; 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=VNUbR3v28EpVcvzMxIDLlNgZJ3pA6eNtfQOh/LcxiJdYIz9x39q+sVIdB404BPdq8Z bUyL/li1/fF4Cy3fS5uiPCe4qNZmeEPv/4jn1JmcgbS1O0Q6dC0RnjZkN0Ko9XbPpu+2 phRMFqBBrafRRdXEiyYE0emOmVmhU0OTOdr6k+E1ZXOZOH9mF0iAymT1GN0hzXT4w2S0 +KRdQXfiPbEmk1YJssSUZQQUjNgy79QpCKPAu3ZkJQfy1dEj6eq0RAPR7f/URt5wq85h IG5+Z7Ku4LtJPsibYGDTmS01ga6zVBcuk7D28C7VTaEs3DjBfIGcfMT3qooLYeVO8CqR xjmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737564101; x=1738168901; 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=Unac0bfB2b0F/06utIYwcfxcnJY5AjRMdPoXhjJCWjCCtSmUvU7EVs5A2jzKXW12+u YU7bK+e6Vs7a2fIErDSajjwszzh1AVRI01PK8D2KqdwQa1DOYLQjOVcYu7PlCNwI5Lpn CXtEVK0hqofvBfw+Wf6qdJZXvmiVguBAD+pzraXABwJXozps6z+ka9orxeMderS5Jt29 /1ivSiwSOzleZALWRpafgQkwXJgvhrZMuR8R5FaLq7y08FqK4fIDCIALaUoeBupQl180 9WFwYZKRUYdbQhsy8LP7KBn1ss8jit/UlNonthFybz6ebb0NbWUditlp6AAfEfvRMMSR qaUQ== X-Forwarded-Encrypted: i=1; AJvYcCU9cNH61yQhO2cc+dXLBjhyzKLWOQayN5cxcnvbw49D+bu65O4wcMt7uWE7ADS/OkNM3R7LSSZOfykNZK8=@vger.kernel.org, AJvYcCUSPhjQTMxsCs88mj5VdTeMZFivp26pfrc6WSDuVBeBRv2sNRLfWmEaMccxboLEBjjqlRCCcUlWk7ahbQ==@vger.kernel.org, AJvYcCUl9TPOYBb8trZwdQ01sZ2IZhJubofdewwJqs8DswxpmXN4q4YhsIm38//pQEZ8KoGR9GSVENlZlw378TA=@vger.kernel.org X-Gm-Message-State: AOJu0YwAwldWMJ6Cu/lam2500joxuA8EN5B/fbJdT9fsilBZIuswEAU7 yL6d0k1MnMXEfCZrbdRRzn/tbk+JbJEUpxOssszbaf6f4ZnNl+JQ X-Gm-Gg: ASbGncsRQKgaqfE94dE1hTGn8ZzjKagXInn8jfo63ozP2hfjjgysrL2khEZQQScYuYJ T9nhhpQBCMOEfmZKT4lMpXSXwQ/WP1liKHNWaz9bibuMt1iiBN6HIO08m+UWaL3k/8KTURfR3E5 JhuEUgiGdjUUDd1rrtTx7ZtDokRsGEyrlS40r4c2onTOw42YaXrq6nT4LdmIgZ3o5MGZ4P1GhQr WgqkjhCFoPypPute76ANw1I0sAd2O/RxpQZJIHLCZLLP9WPKts8OakDgg6UWS70+D1CsAW01NRB oUmlbN4oDUbUXxoL X-Google-Smtp-Source: AGHT+IFtaUrnZAFORdIcwIO23BW3nt8ER23QIneXVCJ2omKzoifty/XjhqXVBZ2P+L2DCBpUIsYlSA== X-Received: by 2002:a05:6402:2105:b0:5d8:8292:5674 with SMTP id 4fb4d7f45d1cf-5db7dc69528mr19561635a12.7.1737564100639; Wed, 22 Jan 2025 08:41:40 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5db73642580sm8647061a12.15.2025.01.22.08.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 08:41: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 v2 2/5] ASoC: cpcap: Implement .set_bias_level Date: Wed, 22 Jan 2025 18:41:26 +0200 Message-Id: <20250122164129.807247-3-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122164129.807247-1-ivo.g.dimitrov.75@gmail.com> References: <20250122164129.807247-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 Wed Jan 22 16:41:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13947514 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 04A3E2153D0; Wed, 22 Jan 2025 16:41:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564105; cv=none; b=A7PMOM/k9VJMJDnbhGP/EsbOKIVu8d3oug50Z4Y/+0yP0i0cMLjv3G/JmqpLhIGNSxIr9glQ0kD8Mg+OOQojaNx4fR8O8VjaBH7cQfBqLPUiMbpGmVMnhzGDQDjFdkDCsG/7BSiMjthcQZddfCxpN3Dr+Gwe32qRmEqAeFojjOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564105; c=relaxed/simple; bh=g8NMn0hLHVMBtvTbXlh21awyVS2jHYWL19EOOVOENnU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hFvrpk8H3fAuBK+SKH9BuQnb5HuWX0pO3SDF/OHjKaqY8GGaYBDwtYiQwc2FChVrLuJSriGRGk8Lzm4Spnl6T8OjBM2T+yyzi7Oeu4nFgePFLnz9n3sHbDEiyoZxMJTxNRDRDxmX2LlRmd335oyh9STuF2sGnRFOkFl7hXCfuEk= 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=TFC3kF5g; arc=none smtp.client-ip=209.85.218.42 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="TFC3kF5g" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-ab65fca99b6so55603066b.0; Wed, 22 Jan 2025 08:41:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737564102; x=1738168902; 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=r3m7xaPUWwm9tKrVHWVOsPlcUqaEpE8/oiuxIl2jQkc=; b=TFC3kF5g1bGz/VRftmo7eZqxLLixA5RJskXTzCQ3QPo4nDy3U0TjYwHFLUjUErQ7dm +1okodxPwXUi0OlpDTHQ/obERBrJj7EZkzRnmhX1xipMBEgCJEGHAQv2qcQ6r5kjMVC+ 75fDtaJtEVfV8LznfY/BLP6ytQWaJr+Azg2lVwWKXr3Na1Dl99CP6h/Q/WGaKzB34Yf8 Wedl2sZfgwGkTnPCuckhSTPnvi/1Qgzfywl66Ad9geMUjEqVqWI/4F6uLjBaCW1Re6ro YjAjwIHZEFPYmrIP51eWyZKkn2SeU/VWCzZv7a5c6PMsvVC8rSuZfyxMjnabHqznrGtz maIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737564102; x=1738168902; 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=r3m7xaPUWwm9tKrVHWVOsPlcUqaEpE8/oiuxIl2jQkc=; b=b7BURu4mdAbEzdUK+BXlq6CM4LzFSs2yEGwsNeL1kGbIQhXUZvhyntB1UQNgf3ChZq Du4HXgzWAilzIZ71zp/rujzSjR73h+VtK/FM2bgSOLQMQQtFd5uIrTgK4Q4/SiKY2tgW 3NYqGQb84+8NlA4+hIN75spdORBDzfOMVjLf6jg1BebSS5rXZDWQmzLK2Rvgp7iGx/Mk 7ZuwW/fpJHb0UZmrD4ayp9+/uaszBa2tbqnscOCsbdBmyjIdMMSufd8SilNqbolH0m64 KvOjLlmvWEh+EjalX7loRArOukLqVsgwm2RjjDl/ccLCKRg1/krpqrpNjJpwpm17e84Z ULBg== X-Forwarded-Encrypted: i=1; AJvYcCUE0JKAUxNkbo6meMnweDXMJGA7l3fZpKaur3XUx2pIxlxJm53+x5tQhk9uuF9Co2+eNy9UD77kxOfF89U=@vger.kernel.org, AJvYcCUpt1APtA+ADTgExV4uyIniQNK+wbYYkga1yW6MzxjvH45VhpKd8J2gHzMYyBmgzb1cpHxNbPVIEIaxlg==@vger.kernel.org, AJvYcCXSlc7L9GDTSA6QEYrNfokvEaEexRan1j53esBqT5ZAHPgCPdzow/zAVTlOoQVrhdRBzJ4du9wiIv0LT6w=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4sgAevfEtCiVjT4ufKKPCX1z4Z8ZFjyzzXy0u73RK767W2Qvx UmeYIH0uXGsDAFz6JKNEiloWOFCtSq6y6INXsQT14M7yoYs3ZJiCOTVeLA== X-Gm-Gg: ASbGncsCmq/NmHeZg48IcKS24ptGHWKRfDbyzIim7ADvBr20klijFSOP9sU7hNSyozy 5Yh8Iz80tUNEf2bdPsHJomCYeof7QVksY6fYoYw9BTuDNqE27dsetPqnr0gTQD0hdop2wp3af5z mTgDkV8CSDgkUjVYimEPKZ1L17zM9h1QE8AKKb6GAA2vc+poRNVnE8DYaySHIY8w4ERkwdcGxdD OIUVgPiCLlRov3PH1b/2s0c/8jj78Gy3yLRh8K8vwhATtYZ+6A1hhNXkMQNmc88KzbPcWy4dDce zUMu6dsrM5SyPLCX X-Google-Smtp-Source: AGHT+IENnzFBqZyKsqA2ktcAu/q43qm9D2kIfJv3kLbA9I/ptXXE/Pkd9GhJSpQCDrIKoL52pQ8ofA== X-Received: by 2002:a17:907:7fa3:b0:aa6:707a:af59 with SMTP id a640c23a62f3a-ab38b4c6b1amr2188613666b.50.1737564101889; Wed, 22 Jan 2025 08:41:41 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5db73642580sm8647061a12.15.2025.01.22.08.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 08:41: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 v2 3/5] dt-bindings: mfd: motorola-cpcap: Document audio-codec interrupts Date: Wed, 22 Jan 2025 18:41:27 +0200 Message-Id: <20250122164129.807247-4-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122164129.807247-1-ivo.g.dimitrov.75@gmail.com> References: <20250122164129.807247-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 Add DT binding for the audio-codec headset detection interrupts. Signed-off-by: Ivaylo Dimitrov --- Documentation/devicetree/bindings/mfd/motorola-cpcap.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/motorola-cpcap.txt b/Documentation/devicetree/bindings/mfd/motorola-cpcap.txt index 190230216de8..f00827c9b67f 100644 --- a/Documentation/devicetree/bindings/mfd/motorola-cpcap.txt +++ b/Documentation/devicetree/bindings/mfd/motorola-cpcap.txt @@ -31,6 +31,10 @@ node must be named "audio-codec". Required properties for the audio-codec subnode: - #sound-dai-cells = <1>; +- interrupts : should contain jack detection interrupts, with headset + detect interrupt matching "hs" and microphone bias 2 + detect interrupt matching "mb2" in interrupt-names. +- interrupt-names : Contains "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. @@ -52,6 +56,8 @@ Example: audio-codec { #sound-dai-cells = <1>; + interrupts-extended = <&cpcap 9 0>, <&cpcap 10 0>; + interrupt-names = "hs", "mb2"; /* HiFi */ port@0 { From patchwork Wed Jan 22 16:41:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13947515 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 308AC2153F8; Wed, 22 Jan 2025 16:41:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564106; cv=none; b=uhdiKcmiXGxXHgQfPi7UYr5+0sNZAy6xKSZvfq8CpfEstsvAdO94YTCN/bs7Eb6Gvt3Wg4IMmwRniqtp7RGXSM0F0SunSrxKKmorMesrmvznBar/KUH4g6winrGTkuDNypfA+LDF2RVnTHDJUwQB3Z9LtnMtmsFm6vRS0H4x1sc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564106; c=relaxed/simple; bh=UJZR5eGX81EZ8QCacoVBr7T+dtwgTxWLrhCxR8MKSO4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=muLhJWCZpafHvk6kpT0wwSHqdJORaUIZvsHQQiFp6m97nyRKIjIbhoo3zjWWTPHU/t3NJ8bWMV+3X8eu9XU8IExP+0uzyAjaq6spa5ichnyKeQodyy7EItnwIQkU6mf1FPvk4GEigPkxPNn3XlS2Luh7ojkU9gMq+TJpQo6+dcI= 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=MLOKJOzy; arc=none smtp.client-ip=209.85.208.52 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="MLOKJOzy" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5d3cf094768so12663421a12.0; Wed, 22 Jan 2025 08:41:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737564103; x=1738168903; 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=NkrLNR1N8oTtp2ONm8zlCt9/U3KQIfyGfSRbXwsExTk=; b=MLOKJOzyOvDX/JpiphdE6MeR1/xHc88EVREMQNXKpf1tns5retuJLYoVdmrb7iKp3C qYGQJTWwSVV4EEKq5cMX0CAl9sfDJyN6j7KOMztTKheUjHYDctqeNroI6tKsgACLMeut Uhs1kZG5p+qUfyCqDcg6mVaheJr0C+2zjggr/A/L+MtvrP9pp5VNBRD0oOp2mroRiwUR L9nOaiFtz9pdQ03j965EdausSf8R67WVimu5F+FPz0Uu1HmDzhJxeXA7Bpja4XT92pdo pEu7TrX1xMOTV28z0KCPMmysSMqT6Z/BmWJ+eh8OTa9mrFlO2k5G2vcGFzIK7OCMqYrA im3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737564103; x=1738168903; 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=NkrLNR1N8oTtp2ONm8zlCt9/U3KQIfyGfSRbXwsExTk=; b=qOsWtXuvLjSahHxqHMC9USNbLKpgVlIaXqgh+HiZA5AXBmCEMlcjj4gwEm/cVqxi58 WE9vNKX8wRB3omNWOo1MhRaSgO0m2U6z/scoH9XkTl0SFB/wgEZOtoCjNYm01GVoLOIU AwWAlaaJrnl5CQ5+imE/jfgwbgZs/WhuUSAlmkFdVV6BhJr0dWROGxVrftQJrM9zI/QM 01Ubj5ZjRzbf4FndhQMIDMvi0cFuQCHFpNqG+UmnelJHuAEWQve+3jxTpPKiMMAjA7l2 pckat5fWlMqL6q8bgwCnb9i9G101G4j0IxRD5UJXiUbYmL2x5k7ioNBvh73kMGnMK+Er KaNQ== X-Forwarded-Encrypted: i=1; AJvYcCW0Il4chHoZswt8aMJta81KcUuVrHaHFi9XaEMYbwjHMtG1qZAqpK5yWc08kccqPDI4iqNh1VeGQBFJyN8=@vger.kernel.org, AJvYcCW305zSahmJvcCi15/IhP9CLWfLQqRUIE5vTkvkirAzZqfo5Ji0KkgsJOqQfDsYKPa2ZtbfAC6tpxq1gA==@vger.kernel.org, AJvYcCX4vnZEMdp2mbD0Fc5kHLhJmTBaVXY6O+0EIXO7UkSR/TCrjmyiXMubVn8zL2uAfOAbkR+cZn92bysmMXo=@vger.kernel.org X-Gm-Message-State: AOJu0YzDykdsPljZHEBXhLo2CvUFPugEZgYTrteHA0XyoUIvt/VSP30L 3cMzfksqm/Tel+8qhYAtpAH6tVwTT7h6DX5PMUz1Es1/pKjd8Y8+ X-Gm-Gg: ASbGncsmq9yQsFgkQ30N+qo/OS9QzSY60cY1kuiJ8Z/oYJBqVJH1poQYaIB2rWaVqLv y+6sk6FotyXlfJiDL0iY/htmqAWu2oyViF8wdxfQJR0guNEDVJPvjd1Yn9etde9B/lSfL/sbkXu RrLX88qJzI056aqPiBuv3/Ero8tiwT2s/NlpwGPRxgW8xiGd9ifSmxc1KM1MRTy3X0NXgGGoXdu vdczkz1T2VavsG5OvT1iHKBL75UKB6odU2QDZhI718AABlKNHccPnaOgSL6SGWe2AZg8wmTZ+19 h3wfQedVwnFTrBb6 X-Google-Smtp-Source: AGHT+IFnLn39emvG1lAhwg4us/Q0d17UC/eY9waKPuMcn5ZhI+bNXuDQqyXAi2J+PyGzepIIvg0aCA== X-Received: by 2002:a05:6402:254e:b0:5da:1544:7733 with SMTP id 4fb4d7f45d1cf-5db7d2facd0mr22094344a12.9.1737564103308; Wed, 22 Jan 2025 08:41:43 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5db73642580sm8647061a12.15.2025.01.22.08.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 08:41: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 v2 4/5] arch: arm: dts: cpcap-mapphone: Add audio-codec jack detection interrupts Date: Wed, 22 Jan 2025 18:41:28 +0200 Message-Id: <20250122164129.807247-5-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122164129.807247-1-ivo.g.dimitrov.75@gmail.com> References: <20250122164129.807247-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 | 2 ++ 1 file changed, 2 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..73e27b95105e 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,8 @@ 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 Wed Jan 22 16:41:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 13947516 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 6E423215780; Wed, 22 Jan 2025 16:41:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564108; cv=none; b=BT0jXngKbq5EzaCCG2D/cTAvhR23gLVR+gYif2zlLHtxYYqesTFusrnshn5MxTnr+RKTHUIrHxnWRGtoiDIPVgPqZAAmSpsBde+8jm+Go3LdLLXBgh/BTzorsEw/jhIPCjkZyWuPy8jGg1quGylu6NB7OJI7vvdXyij80WM15UM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737564108; c=relaxed/simple; bh=fyLy/vZjco4PRjdJG3nWihhqDObvGLzrPgQeIouYvVM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FWzF8M2ZnSC78xASptgVrrHGsI7p8jYNIuCKxbvlzPEAWJMKLVoGLeXjzivZGplk2kiNgcNCD1sYHWNDJ6dKUIfksboDhOOJPgHeOp00F2gfgfGiDxnI2UFh+rjzQpq0krYG3hj/tNJm4tr6qtU1NjVf9pxFvzD8oEFVPLb7lzg= 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=Ht36CnJx; arc=none smtp.client-ip=209.85.208.47 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="Ht36CnJx" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5d647d5df90so12002743a12.2; Wed, 22 Jan 2025 08:41:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737564105; x=1738168905; 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=B8KmBOGMVD87OSi+izI42gTXfv8egfKFz47YiWRpqDE=; b=Ht36CnJx3rC3USKYenhMY17UPEQR429Id7UiL71tMgyqxGeI84XJeUIB+TS/xZU9Gt YB/HWYydvil6pgk4rALIl1zUI2SAco5Pu7lLp+tGhBR1ELfaYYS4vXm8XmTvylR/N839 +ManW2KW1qRdBQNq/OR3305CgQIN5bErzRaVTHymb2hisnJ9XercttJUiQfsFEeTLJbk ceR0eQqZcuVCLr9iwuiO6gcIo3x2LHuHakMq1b5CF1BcLO8nEBZFM68qp2H5CkqmlYgm qU1LLYZI3XGKFao/quCT2bIgAAZdAnXLhLWgcXkFfKVKkqpeD5Ldva6/KdhWDj81qUlP g6zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737564105; x=1738168905; 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=B8KmBOGMVD87OSi+izI42gTXfv8egfKFz47YiWRpqDE=; b=GzlbwOSBL3FLk/WsBuW0rjBt+VDYh4TaOF8OtGZI+cBgMlw61ru8SK/TzG6fJ6sySB uAtqoZVDNnDnG87xLudnpl1m7ads+PxvbzdBJUV7N7iwmvemakiNTzrZdGqS/Thne5dQ WD+/f5TD362m17EmDYn6eJSJZGpHgakKYauU7ZX73w6bd9spqkpULivEXLIZiBrT6OEX 4lJIIkGI3wgTT1EVSYVdbXBW6SHNf6wfwGbksR4ZslqFHaYvCUNfhcxzw+Em510rqvSA A8q6JfJFZF/Q8zRt+n4L7CG0Bw+v4IWEqjwBmqj0w5zWYNghNelVyVyzjzVElw+pOj3p ldhQ== X-Forwarded-Encrypted: i=1; AJvYcCVP9/Pr+9t5sqdrR0oiBR4S/tXxH6VF2tSeOcYMhlcREjT4sy9rhr3zJFOVdSuXCgQuuIE8KPnkYN4zlg==@vger.kernel.org, AJvYcCW+kCF/tuy0ctopYWQfiddQLKGafJWbrlcEFAu/W4/Cuq7iGPJuVgHmmYOKpy8iUVT2K97LlGtC0p300fk=@vger.kernel.org, AJvYcCWB2sB7LMG0gmUPQ2S0XzyttjlD8KlmlNUf8FZMxLo7uyZWFM5L1SaFkbVg/nqJ3kGOlR3KzabA5MHt9yE=@vger.kernel.org X-Gm-Message-State: AOJu0YxcgTAUb8oEntmZN9YAb8g2CHkFujx6fzIOzD0Y9eLWPznElLp2 lrNostzND+1peDMBw1pKMDMThNwven3L9nAlx7aRK6rjVDUGHNmZ X-Gm-Gg: ASbGncuwfIoQTMaYmU5fHoNCAvPjRMWcw4DUIXMgYtBCxOAqXZicWWKu4ajZtPdWoWF M+Bk+sxSrxPYPxwN/tPB4y+peIOvOK8nTtBzwJ6rIa6c3F3GWASDkHg5Ik9icjeR22NDUmVij6p bKPJvKFuYJoHRg6U9fNlK9MXS6CV1z+zziKXvGRhrtXZaYfZg9rFywCDcO8KIo1RjuRJYc1rTyy 6n1GbIbVJNCdom2D8wTrs52EvJbDOsoI7+G3VLcTAiUSxESJ+4NikzdwuHZjw74OMJXfN8wyZIP LeXrxBVF/499QyX1 X-Google-Smtp-Source: AGHT+IF4YMq+hMP7AxAhdTzDXsLB4StAV6ZC+iG75qBfXBG3506kY7SGVBVmQNqH+ZSiGEujkwixSA== X-Received: by 2002:a05:6402:3550:b0:5d3:ce7f:abee with SMTP id 4fb4d7f45d1cf-5db7db08623mr20774711a12.25.1737564104481; Wed, 22 Jan 2025 08:41:44 -0800 (PST) Received: from localhost.localdomain ([95.43.220.235]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5db73642580sm8647061a12.15.2025.01.22.08.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 08:41:44 -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 v2 5/5] ASoC: cpcap: Implement jack detection Date: Wed, 22 Jan 2025 18:41:29 +0200 Message-Id: <20250122164129.807247-6-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250122164129.807247-1-ivo.g.dimitrov.75@gmail.com> References: <20250122164129.807247-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..3eb862643b53 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 2 */ +#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,