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: 859324 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-omap@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: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: 859323 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-omap@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 {