From patchwork Sat May 25 13:28:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674026 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 9A77C481A6; Sat, 25 May 2024 13:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643691; cv=none; b=SSW553iLJ15b402irpIl0E+a1/X29FGCLxw2vexy96+TM75iH8WVIKj913Lw/vA5KqoqbS+bQwOrwc35UCFaoUbFHZMZjBnEKui0S31mst9XrdDxM3duNebY/5N4XJEw+T7hkuIuWLOIdK/d3raaQSB+dVbSZv9WXKcmrlcKNjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643691; c=relaxed/simple; bh=KcCxSAxMvDkXt904XYa6/SbZmduZSxVRxErNI/Om7zM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jsJ77Le5R2ppqBpLYQkt/1dJYExQw50T2OYGRqzb+80R6mnXhMu3lBHF2abRz9wky/hGT1PRQWTAqyIhaDqyRrYo0oFbryhFq/J1lt3f1GeZ+2RQrl0McM+PIu+4gKaOtfKozjp4HL19JBaiggzMlOmZ/LY9+lyIG/qYD7cyLv0= 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=GJrITZHT; arc=none smtp.client-ip=209.85.218.44 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="GJrITZHT" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a6267639e86so204499866b.2; Sat, 25 May 2024 06:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643688; x=1717248488; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=aMTEq8/81TXzUfHAT3yRUVR+6g/j7Gm/Znm9RLjIAhg=; b=GJrITZHT3als54VOdIN4M53n7iUBDwmkoyi0TtKiMa4mOihfsRoqslxqaYy8K9rCk8 pTIdArpXzu7TE8zWho8arn+LUdR/ZqSAIreh7CqOHVwx7xIzksLJSK8kpHPwgQFSj1Cv RoMYAbTYH2HNRkIUYp+feA5J8Ey+8Nw0FLwzxZUsL51VPY8TZKT1C+jHtccq+p8glIZQ +qUnmdP++VXlbZzW1nukZWAnKyhwOTYScKB8Vr4xuIIgW/Jt+cv5QeOLn8lmbCVrv6Zc gK9Wtsz4BuOfzMkUzEQEIY9Y6GO+j1vVMKJGlidxjYOYbQ8uaAMu86B+0mMT+loeCSpz 3Ftw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643688; x=1717248488; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aMTEq8/81TXzUfHAT3yRUVR+6g/j7Gm/Znm9RLjIAhg=; b=dWrpTrmOTFlBmz1cd2/g7b1Hy9t7lxGuKlToYZAOmVNmUNt1I/7JtWxPA2pC03ydm/ Pc6gVREgroHRCp6hHWu/+UAUCZc0fdVjL6lPXBmfBNd55yMKwxKtJcglIFRUlGU6XPRF C1lNwC6iXn9CKkbdFmFV4FIbRwZrw5TXzwVnWC54RoWoopu9rl60tcF+rywUt5Z6clZa 7YN7L8WR4dhalsZ37sfBRYlqmIT7LcfecDCLfhVKDsYMr6DsUytQe9h6caR+E0RmiNmt 6Zr57A57a1+DcTMktMZf+jeZOjRz0mg0Q/GI8HPx46AHZrLugnJ+hi+bgaCBsRoGI9nw ZR0Q== X-Forwarded-Encrypted: i=1; AJvYcCURQ6NykPvzoZFHUD6V7/P1MAvuNuTYAFW4Q9JZ479iNJFPPBrC27nb+pbXMxIaVZCL46kqon584gF+m6hcQ6/O5cuagi179aNkAg1MSFg8ylKWQCWras/u3K9PlLXD4N/ChmyXHPLydT7jPZYykFwTT8+n39yZ32i5QVMjyI8BO5NAqicgiRHEir6nuG7hSRGADR1lHTYqt1O72Vw583/okTjTKIq2mkU= X-Gm-Message-State: AOJu0Yy8JGACjKRj66anPRtZ5Xj4ge1rrLg5XVARScMCLXG+vtrrdYoj UUKBeyVxhdIKfJOu3sjW6jWogrVnmjZ7peJnsnSVOx3B78RBz0PR X-Google-Smtp-Source: AGHT+IFnN0alOg81y3ApkSMx/NppMuYvffZFNlVbN94bNUUJGBOlukHxGi7dQOIDZEZnNR+iOrPy4g== X-Received: by 2002:a17:906:e2d9:b0:a5a:c194:b53d with SMTP id a640c23a62f3a-a62645d6c0dmr338273766b.20.1716643687998; Sat, 25 May 2024 06:28:07 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:07 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:05 +0200 Subject: [PATCH v4 1/9] ASoC: dt-bindings: samsung,midas-audio: Add headset mic bias supply Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-1-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=1024; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=KcCxSAxMvDkXt904XYa6/SbZmduZSxVRxErNI/Om7zM=; b=a8ffLr0BQKc3Mzr1ZH8qlfYzy+cz2DGscrTaCLSE6p59apseaVUutkgI3r1MbdZ60rLEp+h4Q zzO93Snks1kAD9Ic+jkeVqx657Cohmx+VeeSF36c4iKWSsDOm9PaIBY X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= Some devices use a separate mic bias supply (also referred to as "ear mic bias") to enable/disable the headset mic. Add the DT property headset-mic-bias-supply to allow for specifying this supply. Signed-off-by: Artur Weber Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml b/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml index 6ec80f529d84..6ed53dd0bb53 100644 --- a/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml +++ b/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml @@ -53,6 +53,9 @@ properties: submic-bias-supply: description: Supply for the micbias on the Sub microphone + headset-mic-bias-supply: + description: Supply for the micbias on the Headset microphone + fm-sel-gpios: maxItems: 1 description: GPIO pin for FM selection From patchwork Sat May 25 13:28:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674027 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.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 2DEF24BAA6; Sat, 25 May 2024 13:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643692; cv=none; b=XevwapaEi5UMzEp1TrOQoC4TSb6kYQnWhgybayOzwmk1JcIMD82yhjMncPWZG7zstMKNqKeGxj8TAjrspX+jwBNW6f/lPlrogbYEAnwuny8CTKiwX9yMbSap522tFyMmCOCQ5G/tj0jXqaOOhAuoiTEotrPWRaoyA81nStI3qjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643692; c=relaxed/simple; bh=Rsl4K9dB39cIJFWh12QWC6byH17AfCNyG1AGcEHy56E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XhrIXtMtPKlWd9n0X/NujQRtZvmvUs9jRGAn85FT3FICubTc/1LTAvb8RqoWF6rkTKKi3SxuE30Z2ZHVze7dDMD2X73o9fSYnADKyuJ/KSh9JfV6POQFDsHI/c3k6ShprHmSAIsnl6vad48p0dWWDJ4/XsiEPEas+v8DaGAki9c= 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=b5NEcIbP; arc=none smtp.client-ip=209.85.218.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="b5NEcIbP" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a626ac4d299so179788666b.3; Sat, 25 May 2024 06:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643689; x=1717248489; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GaBTo72FFPQQpv6Vx/c6UOAp3vgYZvaAb8kpzvmiOq4=; b=b5NEcIbPAfGUb7WNNEVekhn0Um20jspQh7g+49S964xhNI/2fcEgv95l6uXhbxbWkB Bnlt8nN0sj0WfsJIv6Y+u08PR884GFCBVdwgxeJ75bGHahfDGSPMR3Ic/B/aueFiTkQd aWNFOhb1jWqW55uGOc0DEYxHMJbKE/y8XPbmP0IQ+xJXdiJk8skNqoBoVhiZSOEIMsmX ggErQ13BAanr25VJe0FZPl+htiOxa2yNMEHyQgbvGFAVoJwdmhRiH1KdSuQvHLKAgv3v 7PcLnArkyhnnCLpP5EghZ04K3WDDY88dED/yUYXV5rn6meKmVQN67x62KOfGzF40Ttup qnsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643689; x=1717248489; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GaBTo72FFPQQpv6Vx/c6UOAp3vgYZvaAb8kpzvmiOq4=; b=j7zHNet9nK5ZHp1piC0/4mFXqTcl54RQgyfdeVXQZFfjU1pL71LWK4Ola0MhaNqXOb khMik8C3MTOpyZ1fjxF2FETfGe5XzZUtN1Xoosi/RuKm8D8qsqk6h7WXiIeL6eLakIBk uTxL8zPjE0LAdanaXy9evfO8ZE4NM8V7TOm31huqhk7LXNqYg7Y3ZWHv1DLiDBf+iYH3 HzXCPAsq5/8s0PZP8Jr4AVL1UURScT4vekqLOS10FMH8oGDL0gutviZp+37nR9MvY6K3 v9H9UpntZGxhbQ9Hmc/8rQtUUZ30tpSuFUxd7T8K5/aB/01Wm9+VVS25RinoVBlcB6k9 4y2A== X-Forwarded-Encrypted: i=1; AJvYcCUjBrRHXBQ7IIY/S64vsEGah89YwAbdyxybOAdhyZCFa4gWUdu7yRdQzszHqGFfatd71qWS2/K0pi2cPvjkpqxk5vy6pyDpxzTd99Ao61jGwWmj4PPym8TpFiUF094ELBwCgxcCt0sazy4jyWHAIUm539iVB1tm3VbRWPcDXQX7SzxkNoYNBv02za3jqkzamixdXuEfjwM3Jl3fQPyN7luV/lDpzOaClsU= X-Gm-Message-State: AOJu0Yyum6BMe8HmR5kLf6xKcyDdh3+bKGhE8vMLGJxyxA22lYOIVIai SCPzKq/CE8tA3JpuYr9/y6jD2smcA9uLEhzMWuFW8HvilXXPyTWI X-Google-Smtp-Source: AGHT+IF4bGIOqG3W34z32lSukG6Ef5s1FlI9dkGFnxyKECa3N/yURT+cuvpIZ9OZEntCd4Ld2UdhcA== X-Received: by 2002:a17:906:a0a:b0:a5a:4683:e961 with SMTP id a640c23a62f3a-a6264f0eeaemr311160366b.52.1716643689383; Sat, 25 May 2024 06:28:09 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:08 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:06 +0200 Subject: [PATCH v4 2/9] ASoC: dt-bindings: samsung,midas-audio: Add GPIO-based headset jack detection Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-2-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=2328; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=Rsl4K9dB39cIJFWh12QWC6byH17AfCNyG1AGcEHy56E=; b=VNuxPjI5euL5nPUvXQhYTV/hpQPtChvapioTHtcSQs/+z/mENYr3KDtB+9gBSeEivCEerZK5p 9DGuSbFHIJZAbOQ2gV7eXkUb/2PKxPzwrTr3VdIZIAQlJ3PaqU92shJ X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= Some Samsung devices that share the midas-audio driver use a GPIO-based approach to headset jack detection, as opposed to using the built-in jack detection provided by the wm8994 driver. This setup uses two GPIOs (one for jack detection and another for key detection) and an ADC channel for determining the jack type or button pressed. Add DT configuration values that allow for describing these setups. Signed-off-by: Artur Weber Reviewed-by: Krzysztof Kozlowski --- Changes in v3: - Re-added pipe (|) to description of samsung,headset-button-threshold- microvolt to prevent syntax error (otherwise the "in order: ..." part is interpreted as a list) Changes in v2: - Added vendor prefix to threshold properties - Dropped pipe (|) character from description: field --- .../bindings/sound/samsung,midas-audio.yaml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml b/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml index 6ed53dd0bb53..69ddfd4afdcd 100644 --- a/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml +++ b/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml @@ -64,6 +64,36 @@ properties: maxItems: 1 description: GPIO pin for line out selection + headset-detect-gpios: + maxItems: 1 + description: GPIO for detection of headset insertion + + headset-key-gpios: + maxItems: 1 + description: GPIO for detection of headset key press + + io-channels: + maxItems: 1 + description: IO channel to read micbias voltage for headset detection + + io-channel-names: + const: headset-detect + + samsung,headset-4pole-threshold-microvolt: + minItems: 2 + maxItems: 2 + description: + Array containing minimum and maximum IO channel value for 4-pole + (with microphone/button) headsets. If the IO channel value is + outside of this range, a 3-pole headset is assumed. + + samsung,headset-button-threshold-microvolt: + minItems: 3 + maxItems: 3 + description: | + Array of minimum (inclusive) IO channel values for headset button + detection, in order: "Media", "Volume Up" and "Volume Down". + required: - compatible - cpu From patchwork Sat May 25 13:28:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674028 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 6D6564F1F8; Sat, 25 May 2024 13:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643694; cv=none; b=stpmdaALL/tOv88gJBwfl8zZD/PEaINNATdy5jbdGnC2KfKphvptxMA4QYeM7+A1qSIa0JVy5+n0hlzUw6K4vr0qvNL9mzIb86bDMlD4qJ95iWY8X9m8iJZP3kWz3PhK//ejgnZ7fVs95Kb5st6djjoMMeYh4GwRrs1k5kou7Pw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643694; c=relaxed/simple; bh=2vAqa2DIEcQwtApC4VQYYpht9ERjbrcStYfppA44U0Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dcdL38xS60WccI48tGb+FpjdAOLSufHQrJ6MahE4EAsgcUvg8i9XlYHoXkn6aUhiyr04awpm4IDQXcUU1s6If43JBNiKB9P9whZf4rQd6KOtGnKtRIox5ZIoY3nOfeEte0HcGGlOhv5mp2fxUO1XtyP7M11mnF2LrDCZDYt74L0= 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=feMFvn57; arc=none smtp.client-ip=209.85.218.51 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="feMFvn57" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a626919d19dso281166766b.0; Sat, 25 May 2024 06:28:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643691; x=1717248491; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cyhcJDHjI0opVSCgJiHt0Zs5JH59m1ORkw4OcBCxAuU=; b=feMFvn57VXf0Ks5wUp31oSgNhnt6qOH60/tfIpn5gWIOgfVS9tA37CTM1Cm/hM+Jon V9WkuqA4sxv6nIGJu5QHp/o0AriWP9sGS3fGyrRVt+jcybAeY/QvEHR1NuSramAnwznE i7nPrV2fr9mtEhca2KkZktZVFAwv6aBeyIlnSUHKjnxMqSMRF2bv2XTrB5aOsfD61ZLb ZbNxoR9lSx1/57+pM5pVH7owQZqFjtaWPn+5LTW8wXrl/IJL+jrQLX/lnQC/VfEZGWhU dR3Hc5VG4pzqjxkfMhJYiz893+uBld6NzFT6g/oxejvVtG+LUlE85ZvjdIpZ6aMaWuLW ludQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643691; x=1717248491; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cyhcJDHjI0opVSCgJiHt0Zs5JH59m1ORkw4OcBCxAuU=; b=FDJ/hkxAZc5lz+KAiwyV9xg9PKaz3DNGsi8Zw6cMIAhmgfn05hiNbRaYLTVfizhs3t zSfslHm1Uwt1jMHax/lQD8lUwXwE9AOmF2LXML0W4sZds2hYIP0TYzS1fsgqYMXY+S+9 Vq6fL2/8Y40503Q866VHTxG01+hqYQWv175s7/7vSihOY6dg4pjZ0OhL0hMP4j5kH0zF TXkaiQXXPQAKYy+3iYAVgYwoy5gZKLTboQCnJ4gFxMhr/bfsNn2dIJ9NNYeRmrkMO73O PeFW04wzvStP6Tf1F7CV8xGkLilVdC7w0aSEawKSSP5CVGxkG9iRikhaFmnX4ZqANeTe KTIA== X-Forwarded-Encrypted: i=1; AJvYcCXvHh0PLHxc/jFRqvlC6mcg9idRGIEQK/eEIkFl4z/B7f4BzbOx+TL4vwwxuoMDGysJbVEwiPgp4DmkFjWxnL6is+7MjVNf7pdIldMg+0tQnJDx6N1s3xt40+n0wEzNQYqcDhWKXpQCBb4sJ7lu9f8WcyvkcfXWRML+RbhAOXLFxULALO0Qn33InaevSad4eZ575hoqoiIE0TIOdblT8OIoy1kB7s8wiiY= X-Gm-Message-State: AOJu0YwUWvhIWxrgk0jCPfgs2B6d+yvBKxb6GyST7HeAs7/4OluFntrl Cn4O9DYY7V/Y547f46IOzXGu+qrJJn0ClYKu6iRiV5AHmJpHD4KF X-Google-Smtp-Source: AGHT+IEPpi36yJB2n9ipEwdR4D1zjMs1IzS01+2Vzze66vzbl5+wC4+jiyDQmWyXGxZdTp2Ak5ZhWA== X-Received: by 2002:a17:906:8443:b0:a61:7f85:e31c with SMTP id a640c23a62f3a-a6261f91a42mr367814466b.12.1716643690633; Sat, 25 May 2024 06:28:10 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:10 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:07 +0200 Subject: [PATCH v4 3/9] ASoC: samsung: midas_wm1811: Use SND_SOC_DAPM_REGULATOR_SUPPLY for bias regulators Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-3-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=4146; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=2vAqa2DIEcQwtApC4VQYYpht9ERjbrcStYfppA44U0Y=; b=aPD49g9qEDnvFgYpa5MvgqUaV0Ias6Acg1pgU8JR9ggAbockzhyIz4uoEhAXWApuS8Qs+03bm 7D7hw3nfGozDATDmsFZ8F3NJgXmuf/Xt38YOWi7jNvh2bMfPkTYpKDb X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= Instead of using a custom function with the SND_SOC_DAPM_MIC widget, split out the main mic/sub mic bias regulators into a separate widget using SND_SOC_DAPM_REGULATOR_SUPPLY, and connect them via a routing. Signed-off-by: Artur Weber --- Changes in v4: - Added this commit --- sound/soc/samsung/midas_wm1811.c | 62 +++++++++------------------------------- 1 file changed, 13 insertions(+), 49 deletions(-) diff --git a/sound/soc/samsung/midas_wm1811.c b/sound/soc/samsung/midas_wm1811.c index f31244156ff6..20b274734487 100644 --- a/sound/soc/samsung/midas_wm1811.c +++ b/sound/soc/samsung/midas_wm1811.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -27,8 +26,6 @@ #define DEFAULT_FLL1_RATE 11289600U struct midas_priv { - struct regulator *reg_mic_bias; - struct regulator *reg_submic_bias; struct gpio_desc *gpio_fm_sel; struct gpio_desc *gpio_lineout_sel; unsigned int fll1_rate; @@ -169,38 +166,6 @@ static int midas_ext_spkmode(struct snd_soc_dapm_widget *w, return ret; } -static int midas_mic_bias(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, int event) -{ - struct snd_soc_card *card = w->dapm->card; - struct midas_priv *priv = snd_soc_card_get_drvdata(card); - - switch (event) { - case SND_SOC_DAPM_PRE_PMU: - return regulator_enable(priv->reg_mic_bias); - case SND_SOC_DAPM_POST_PMD: - return regulator_disable(priv->reg_mic_bias); - } - - return 0; -} - -static int midas_submic_bias(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, int event) -{ - struct snd_soc_card *card = w->dapm->card; - struct midas_priv *priv = snd_soc_card_get_drvdata(card); - - switch (event) { - case SND_SOC_DAPM_PRE_PMU: - return regulator_enable(priv->reg_submic_bias); - case SND_SOC_DAPM_POST_PMD: - return regulator_disable(priv->reg_submic_bias); - } - - return 0; -} - static int midas_fm_set(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { @@ -272,8 +237,17 @@ static const struct snd_soc_dapm_widget midas_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), - SND_SOC_DAPM_MIC("Main Mic", midas_mic_bias), - SND_SOC_DAPM_MIC("Sub Mic", midas_submic_bias), + SND_SOC_DAPM_MIC("Main Mic", NULL), + SND_SOC_DAPM_REGULATOR_SUPPLY("mic-bias", 0, 0), + SND_SOC_DAPM_MIC("Sub Mic", NULL), + SND_SOC_DAPM_REGULATOR_SUPPLY("submic-bias", 0, 0), +}; + +/* Default routing; supplemented by audio-routing DT property */ +static const struct snd_soc_dapm_route midas_dapm_routes[] = { + /* Bind microphones with their respective regulator supplies */ + {"Main Mic", NULL, "mic-bias"}, + {"Sub Mic", NULL, "submic-bias"}, }; static int midas_set_bias_level(struct snd_soc_card *card, @@ -421,6 +395,8 @@ static struct snd_soc_card midas_card = { .num_controls = ARRAY_SIZE(midas_controls), .dapm_widgets = midas_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(midas_dapm_widgets), + .dapm_routes = midas_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(midas_dapm_routes), .set_bias_level = midas_set_bias_level, .late_probe = midas_late_probe, @@ -443,18 +419,6 @@ static int midas_probe(struct platform_device *pdev) snd_soc_card_set_drvdata(card, priv); card->dev = dev; - priv->reg_mic_bias = devm_regulator_get(dev, "mic-bias"); - if (IS_ERR(priv->reg_mic_bias)) { - dev_err(dev, "Failed to get mic bias regulator\n"); - return PTR_ERR(priv->reg_mic_bias); - } - - priv->reg_submic_bias = devm_regulator_get(dev, "submic-bias"); - if (IS_ERR(priv->reg_submic_bias)) { - dev_err(dev, "Failed to get submic bias regulator\n"); - return PTR_ERR(priv->reg_submic_bias); - } - priv->gpio_fm_sel = devm_gpiod_get_optional(dev, "fm-sel", GPIOD_OUT_HIGH); if (IS_ERR(priv->gpio_fm_sel)) { dev_err(dev, "Failed to get FM selection GPIO\n"); From patchwork Sat May 25 13:28:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674029 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 9405C57CBB; Sat, 25 May 2024 13:28:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643695; cv=none; b=AJWgkH2ogg+C30ZmPctHVNZa4U8oj5gmiH8CmUEuJWLCQYaaKEELjkuPWM3xBODUouuNlt0qfLyNXr9BUS/a8BDvSArR6SUO/2x1PkDkYI/oQsO+2pOCk93ofRafwJsDzp4pfNUsXQxC1O2CZNFi80O2xqsc8VMEaTPb3irJKy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643695; c=relaxed/simple; bh=SrwrcA8EO/kpCKyL39XjnsPTrNdBE58a73YIeAazdTE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q2ozANAmJXcUPq4uGjkn2+PphU4aRSTcljdkJvMqqW5hgsCo+5Vd0mLmXpKdyawcfXwOR4WLTE0GBeAbvwsh3Z86n11KQywDMfB74XSYjBDhFQKL0BGst3AkgBeGeutH1UbpMwsE98P0Ydyb+GFkxytWOmILwN4ghXVod4gRLMU= 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=Fnz+uVOl; arc=none smtp.client-ip=209.85.218.43 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="Fnz+uVOl" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a5a5cce2ce6so1245053966b.3; Sat, 25 May 2024 06:28:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643692; x=1717248492; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BndYTHAhfTKZPUuhsQObxrH+e5h7zSrDvT6UBM9kSxU=; b=Fnz+uVOlu/QH2r9MLwhqCNOzzNtxCR2dAmDlQHgLiV8SiKvDZZWKJIoQUlv+YhgqyA 1pZuFgVZa0yNmDu7LOG2G8uMx4snnEWUuY/oCeK5i3tkaXLtKhH9Q3v0gxdIcLt9AAqm WKtcEWsQhEs0tGKHanBAkmnUmzkUWYglVlpmVedx3ZG1148ZC2AG6wDsYQ/eVYAsp0Lc LCIZPBOC653bmuVVjkA5dExlXCel2eUmkVNL1NFQmNE+m3fg9Iu2VA5HQnE9FvXedjbC O1U40AKSuKiYhLQV1VptVCy8iYWkzjVdv6LfjOmakAiJFV6Nz8AA1/bPGkFrxqrMzE+m XjUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643692; x=1717248492; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BndYTHAhfTKZPUuhsQObxrH+e5h7zSrDvT6UBM9kSxU=; b=LdWiD25TF7lQzK+OB8kSIPj1DZvWsHxfqswEky8858/RTr6Q1A6XoAkLeRwy2dd3uW yuy/MVkmBLuT6tBGMPwBq0GzwVnNn31d+I0n8haGso6b2fQTKqBGqdZe2YmuPrZb7YxX 7jf1dzABK5AkYrJokWlcGpe9jCG1mpPp7BNATnH7swNEbCzy9EIwCC4NMsRUhJaJ961F 53H8G0SHF0lfAwTh+09vpy/wGPoq3Vu7y0Haphzt/SV2zoeEZvpd8bKsBUAzGoledJkE D4w7IkLqDcHvMTNpIyDs5wQYGKIgfxyPCnyjGL/nmLqeVFhzA6m42b3jn1KXsiiINR/9 Qidg== X-Forwarded-Encrypted: i=1; AJvYcCW2wzMZ3V0oi5XEPnrIpsWyPjkZERExAwN8ydzH96ir02ALGg+BOvy628yqT1iTjewIhlAl/+9HszBr+a7aq0erTjyffL9eMQtM+1ihacNQo8Gk1NWkPi+xRT3JoOCFB/mUwhY1GfNn6NfhTBHIxyLSxWqLX/+OTEXgDgvNjNKfOa+USOnm56CzX26A3iBpkrZNTNuucdoVLjN9F7Eslj557HIFqQS1dJI= X-Gm-Message-State: AOJu0YzUFx8slT1ERJ8YVolzH8/Bu1D4Bn/Ju9p3d9tFEpRtfA5tN02J SBc7AGn2F9L9x+w50dKs3dNcL4XFKNIGS4wLrLdhoYAAUvaTbjcY X-Google-Smtp-Source: AGHT+IGnZd7WsivKWQF4T7VRJoyzWWWhjF8m2C3S/hvrEcSGj7gVML/vaSsvg/m9ubAfv5dSHplv5A== X-Received: by 2002:a17:906:34c4:b0:a5d:1079:ae43 with SMTP id a640c23a62f3a-a62646cff2bmr303714966b.46.1716643691879; Sat, 25 May 2024 06:28:11 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:11 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:08 +0200 Subject: [PATCH v4 4/9] ASoC: samsung: midas_wm1811: Add headset mic bias supply support Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-4-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=1496; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=SrwrcA8EO/kpCKyL39XjnsPTrNdBE58a73YIeAazdTE=; b=aOb+rU2suanKpvf9j7yJWCC8tRfhD79vM2VGE9vwAf3aAdab1HBw88AGPfMZzkzES4TSFtHuM 6DZtzJEPYveCOX4cpcoNbmRXsBVqaoVegYq+563CTSs9fB2kR85Cl6t X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= Some devices use a headset mic bias supply (sometimes referred to as "ear mic bias") to enable/disable the headset mic. Add a REGULATOR_SUPPLY widget for this supply which gets the headset- mic-bias supply and is routed to the Headset Mic switch similar to how it's done for the other mic bias regulators. Signed-off-by: Artur Weber --- Changes in v4: - Completely changed to adapt to SND_SOC_DAPM_REGULATOR_SUPPLY switch Changes in v2: - Added this commit --- sound/soc/samsung/midas_wm1811.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/samsung/midas_wm1811.c b/sound/soc/samsung/midas_wm1811.c index 20b274734487..96cec8e9de98 100644 --- a/sound/soc/samsung/midas_wm1811.c +++ b/sound/soc/samsung/midas_wm1811.c @@ -237,6 +237,7 @@ static const struct snd_soc_dapm_widget midas_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_REGULATOR_SUPPLY("headset-mic-bias", 0, 0), SND_SOC_DAPM_MIC("Main Mic", NULL), SND_SOC_DAPM_REGULATOR_SUPPLY("mic-bias", 0, 0), SND_SOC_DAPM_MIC("Sub Mic", NULL), @@ -248,6 +249,7 @@ static const struct snd_soc_dapm_route midas_dapm_routes[] = { /* Bind microphones with their respective regulator supplies */ {"Main Mic", NULL, "mic-bias"}, {"Sub Mic", NULL, "submic-bias"}, + {"Headset Mic", NULL, "headset-mic-bias"}, }; static int midas_set_bias_level(struct snd_soc_card *card, From patchwork Sat May 25 13:28:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674030 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 DE0FE5A7AA; Sat, 25 May 2024 13:28:14 +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=1716643696; cv=none; b=rac7bjthRnhFUYdQFCg2kEmsSr4/g52ZaV7Z4xss1xXYKL2oyyvdPZyXLx9+VyUD5Ha5WMVtat3j+hFjsXuritoj6XmwrisGaUeDR2FBCRg10TVHH1WdGuRR48XdrELl7/X0H3+W5AOJ+39VqvQ3wzQWRG4UKvY2fAwLayXZs3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643696; c=relaxed/simple; bh=s6HoX2bIiyeFHVO8H4gwhbEs3zH4TzKxdBruCqDrxxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qFr3SiDY2bhVAvd2RdW37PVOYkGii29D4gvicgMonI7VIoashrdr0owtQ0W1YWaKMnMm6xbBUO6mXBxM8F1F2SnoNNOAhk3+c7YTg30hh1DbRWVTC7OEjaktS52CS2d49JRxcEQqFvS/jqKq0LyX0JHDmaUJZi0x9MkJHxvXHM8= 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=JAVCptoL; 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="JAVCptoL" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a62972c88a9so79487266b.1; Sat, 25 May 2024 06:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643693; x=1717248493; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TfSzPmCK68b0JNLz1J5pRMBlqdzsamJqc1HopdzeGIc=; b=JAVCptoLwY7KVfpPV1oaUGQ0LslexZdinbk2ovhIO8wY6N/TrSSMKfmMGxy9DFPMTb YqdS8Z0hBbKylRroWD3D6r4QiZL5jaRsFFUyL03FzDXG45tExkXvGHxBPL/kPbG/sf5Q BI0cGmfQQ2ATfYfKUhgWYd3qIX+ut7Arb5cTtRn1renUdQIPplkxftzzN7UmAEpfBccU k8+nQW7rK2ZkeyuLS2FJ3TsN5FIHFnvcfZAErKvGg/bsm22Ez4bzuJUOZo1B3MxzRHtV Vi9MIh+QxcXwFnebYI0EBefzjzbuknp6xwpoghYTOUpUizmZPF6lASTLtQ17cXmRs2GN ODnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643693; x=1717248493; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TfSzPmCK68b0JNLz1J5pRMBlqdzsamJqc1HopdzeGIc=; b=simY43QrImBXsMFP+hodwEHdAbJpPSeCWgaFmWy9sM8BDRK6QCcewVamPGq+lcUztS JpdBIX12dhdo1pPLfsYjKV8ppbVUrZLb4DcLmdJAn5np74iqdUp9HEBhVG6EbkCym5Vg rgA6DfOTMztHb0t8Ff5mnm1yzOC7y6sKJz/Oj1jQEYE9MccPOEcPt3+dhgoKUmOfoMhj uXmZ9jnLxa76Rb84etPhTF04zMXKNzvTv6JwEmR8n/7mIFuCjApZ3+Y+zOpp8lYxPLLQ hqYdAltykEwzIGioeh4dDVvkYq239X34/kKoMlPBjM///11EspcA99SwzgQfvKfDrm2g mw0Q== X-Forwarded-Encrypted: i=1; AJvYcCV9aV8wtSOuH2T4lN5WM6/z9nJfwydEMJD1ty7D4f+hZutlfyOIj4Zc/L6aK1qAevWH5EIb8Mzt6/vb8N3iLwVZjLp3RuKWUYgf2CVMgoYVL3N/W3JWoDgVOsENUAbOKcAssJGVPWPBTG1UbbcLFX0rFVW8cTBkdN2zkBAqca9CmktI0M7tAq5qcu2Uxim56rHuz7ll0Ttl0eO7O9NqmLhmHDM8BFMy+sg= X-Gm-Message-State: AOJu0YxCoALkylMz3y1pmaKqVezPcg9+YqOTJccdvs4BwPxY/3l4tqV3 9lbrgZBn6pSEG98t3vqrmcXMaFN+bqyzNkinq4icV5mAkgV7AX3u X-Google-Smtp-Source: AGHT+IFTulOMAAWAFYVawyA9CX1rwCDs913hmmjoXg2cqQVwzwHIm+Ktr45CM5qcWPO00OeYHrq0RQ== X-Received: by 2002:a17:907:170c:b0:a59:efd3:9d with SMTP id a640c23a62f3a-a628cd3826amr199259066b.58.1716643693213; Sat, 25 May 2024 06:28:13 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:12 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:09 +0200 Subject: [PATCH v4 5/9] ASoC: samsung: midas_wm1811: Add GPIO-based headset jack detection Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-5-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=11849; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=s6HoX2bIiyeFHVO8H4gwhbEs3zH4TzKxdBruCqDrxxM=; b=zR0eYWuT/ZjNmLwhSpdGpDL+Qf5ZIm9sfaJ+OWv+1VFmeFS6SxTlvW8SFabYIV3KHjdVH9jF+ pUJzZzuHu9oDpBEsXjSXMllbtpEGW7gnFGwPb3pD8yDxxTFScTCH0Sr X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= Some Samsung devices that use the midas_wm1811 driver use a GPIO-based method for detecting whether the headset jack is plugged in, as well as detecting which headset buttons are pressed. There are two GPIOs: a "headset detect" GPIO responsible for detecting jack insertion, and a "headset key" GPIO which triggers when a button on the headset is pressed. The plug type and the button pressed are determined based on information from an ADC channel. The headset mic is enabled by a headset mic bias regulator. Add support for the GPIO-based headset jack detection mechanism, and make it configurable from the device tree. This implementation borrows somewhat from the aries_wm8994.c driver, though there are a few changes to make the code cleaner, and to add support for DT-based configuration. Notably, a dependency on IIO is introduced, to accommodate the ADC reading requirement. Signed-off-by: Artur Weber --- Changes in v4: - Adapted to regulators being changed to use SND_SOC_DAPM_REGULATOR_SUPPLY Changes in v2: - Added separate headset mic bias regulator - Added samsung preset to threshold properties - Replaced dev_err+return with return dev_err_probe where needed --- sound/soc/samsung/Kconfig | 2 +- sound/soc/samsung/midas_wm1811.c | 272 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 263 insertions(+), 11 deletions(-) diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 93c2b1b08d0a..4b1ea7b2c796 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -140,7 +140,7 @@ config SND_SOC_SAMSUNG_ARIES_WM8994 config SND_SOC_SAMSUNG_MIDAS_WM1811 tristate "SoC I2S Audio support for Midas boards" - depends on SND_SOC_SAMSUNG + depends on SND_SOC_SAMSUNG && IIO select SND_SAMSUNG_I2S select SND_SOC_WM8994 help diff --git a/sound/soc/samsung/midas_wm1811.c b/sound/soc/samsung/midas_wm1811.c index 96cec8e9de98..88fa9e5bc093 100644 --- a/sound/soc/samsung/midas_wm1811.c +++ b/sound/soc/samsung/midas_wm1811.c @@ -7,7 +7,9 @@ #include #include +#include #include +#include #include #include #include @@ -28,6 +30,9 @@ struct midas_priv { struct gpio_desc *gpio_fm_sel; struct gpio_desc *gpio_lineout_sel; + struct gpio_desc *gpio_headset_detect; + struct gpio_desc *gpio_headset_key; + struct iio_channel *adc_headset_detect; unsigned int fll1_rate; struct snd_soc_jack headset_jack; @@ -44,6 +49,117 @@ static struct snd_soc_jack_pin headset_jack_pins[] = { }, }; +/* + * min_mv/max_mv values in this struct are set up based on DT values. + */ +static struct snd_soc_jack_zone headset_jack_zones[] = { + { .jack_type = SND_JACK_HEADPHONE, }, + { .jack_type = SND_JACK_HEADSET, }, + { .jack_type = SND_JACK_HEADPHONE, }, +}; + +/* + * This is used for manual detection in headset_key_check, we reuse the + * structure since it's convenient. + * + * min_mv/max_mv values in this struct are set up based on DT values. + */ +static struct snd_soc_jack_zone headset_key_zones[] = { + { .jack_type = SND_JACK_BTN_0, }, /* Media */ + { .jack_type = SND_JACK_BTN_1, }, /* Volume Up */ + { .jack_type = SND_JACK_BTN_2, }, /* Volume Down */ +}; + +static int headset_jack_check(void *data) +{ + struct snd_soc_component *codec = data; + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec); + struct midas_priv *priv = snd_soc_card_get_drvdata(codec->card); + int adc, ret; + int jack_type = 0; + + if (!gpiod_get_value_cansleep(priv->gpio_headset_detect)) + return 0; + + /* Enable headset mic bias regulator so that the ADC reading works */ + ret = snd_soc_dapm_force_enable_pin(dapm, "headset-mic-bias"); + if (ret < 0) { + pr_err("%s: Failed to enable headset mic bias regulator (%d), assuming headphones\n", + __func__, ret); + return SND_JACK_HEADPHONE; + } + snd_soc_dapm_sync(dapm); + + /* Sleep for a small amount of time to get the value to stabilize */ + msleep(20); + + ret = iio_read_channel_processed(priv->adc_headset_detect, &adc); + if (ret) { + pr_err("%s: Failed to read ADC (%d), assuming headphones\n", + __func__, ret); + jack_type = SND_JACK_HEADPHONE; + goto out; + } + pr_debug("%s: ADC value is %d\n", __func__, adc); + + jack_type = snd_soc_jack_get_type(&priv->headset_jack, adc); + +out: + ret = snd_soc_dapm_disable_pin(dapm, "headset-mic-bias"); + if (ret < 0) + pr_err("%s: Failed to disable headset mic bias regulator (%d)\n", + __func__, ret); + snd_soc_dapm_sync(dapm); + + return jack_type; +} + +static int headset_key_check(void *data) +{ + struct snd_soc_component *codec = data; + struct midas_priv *priv = snd_soc_card_get_drvdata(codec->card); + int adc, i, ret; + + if (!gpiod_get_value_cansleep(priv->gpio_headset_key)) + return 0; + + /* Filter out keypresses when 4 pole jack not detected */ + if (!(priv->headset_jack.status & SND_JACK_MICROPHONE)) + return 0; + + ret = iio_read_channel_processed(priv->adc_headset_detect, &adc); + if (ret) { + pr_err("%s: Failed to read ADC (%d), can't detect key type\n", + __func__, ret); + return 0; + } + pr_debug("%s: ADC value is %d\n", __func__, adc); + + for (i = 0; i < ARRAY_SIZE(headset_key_zones); i++) { + if (adc >= headset_key_zones[i].min_mv && + adc <= headset_key_zones[i].max_mv) { + return headset_key_zones[i].jack_type; + } + } + + return 0; +} + +static struct snd_soc_jack_gpio headset_gpio[] = { + { + .name = "Headset Jack", + .report = SND_JACK_HEADSET, + .debounce_time = 150, + .jack_status_check = headset_jack_check, + }, + { + .name = "Headset Key", + .report = SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2, + .debounce_time = 30, + .jack_status_check = headset_key_check, + }, +}; + static int midas_start_fll1(struct snd_soc_pcm_runtime *rtd, unsigned int rate) { struct snd_soc_card *card = rtd->card; @@ -291,18 +407,67 @@ static int midas_late_probe(struct snd_soc_card *card) return ret; } - ret = snd_soc_card_jack_new_pins(card, "Headset", - SND_JACK_HEADSET | SND_JACK_MECHANICAL | - SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | - SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5, - &priv->headset_jack, - headset_jack_pins, - ARRAY_SIZE(headset_jack_pins)); - if (ret) + if (!priv->gpio_headset_detect) { + ret = snd_soc_card_jack_new_pins(card, "Headset", + SND_JACK_HEADSET | SND_JACK_MECHANICAL | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3 | + SND_JACK_BTN_4 | SND_JACK_BTN_5, + &priv->headset_jack, + headset_jack_pins, + ARRAY_SIZE(headset_jack_pins)); + if (ret) + return ret; + + wm8958_mic_detect(aif1_dai->component, &priv->headset_jack, + NULL, NULL, NULL, NULL); + } else { + /* Some devices (n8000, t310) use a GPIO to detect the jack. */ + ret = snd_soc_card_jack_new_pins(card, "Headset", + SND_JACK_HEADSET | SND_JACK_BTN_0 | + SND_JACK_BTN_1 | SND_JACK_BTN_2, + &priv->headset_jack, + headset_jack_pins, + ARRAY_SIZE(headset_jack_pins)); + if (ret) { + dev_err(card->dev, + "Failed to set up headset pins: %d\n", ret); + return ret; + } + + ret = snd_soc_jack_add_zones(&priv->headset_jack, + ARRAY_SIZE(headset_jack_zones), + headset_jack_zones); + if (ret) { + dev_err(card->dev, + "Failed to set up headset zones: %d\n", ret); + return ret; + } + + headset_gpio[0].data = aif1_dai->component; + headset_gpio[0].desc = priv->gpio_headset_detect; + + headset_gpio[1].data = aif1_dai->component; + headset_gpio[1].desc = priv->gpio_headset_key; + + snd_jack_set_key(priv->headset_jack.jack, + SND_JACK_BTN_0, KEY_MEDIA); + snd_jack_set_key(priv->headset_jack.jack, + SND_JACK_BTN_1, KEY_VOLUMEUP); + snd_jack_set_key(priv->headset_jack.jack, + SND_JACK_BTN_2, KEY_VOLUMEDOWN); + + ret = snd_soc_jack_add_gpios(&priv->headset_jack, + ARRAY_SIZE(headset_gpio), + headset_gpio); + if (ret) + dev_err(card->dev, + "Failed to set up headset jack GPIOs: %d\n", + ret); + return ret; + } - wm8958_mic_detect(aif1_dai->component, &priv->headset_jack, - NULL, NULL, NULL, NULL); return 0; } @@ -411,6 +576,9 @@ static int midas_probe(struct platform_device *pdev) struct snd_soc_card *card = &midas_card; struct device *dev = &pdev->dev; static struct snd_soc_dai_link *dai_link; + enum iio_chan_type channel_type; + u32 fourpole_threshold[2]; + u32 button_threshold[3]; struct midas_priv *priv; int ret, i; @@ -434,6 +602,90 @@ static int midas_probe(struct platform_device *pdev) return PTR_ERR(priv->gpio_lineout_sel); } + priv->gpio_headset_detect = devm_gpiod_get_optional(dev, + "headset-detect", GPIOD_IN); + if (IS_ERR(priv->gpio_headset_detect)) + return dev_err_probe(dev, PTR_ERR(priv->gpio_headset_detect), + "Failed to get headset jack detect GPIO\n"); + + if (priv->gpio_headset_detect) { + priv->adc_headset_detect = devm_iio_channel_get(dev, + "headset-detect"); + if (IS_ERR(priv->adc_headset_detect)) + return dev_err_probe(dev, + PTR_ERR(priv->adc_headset_detect), + "Failed to get ADC channel\n"); + + ret = iio_get_channel_type(priv->adc_headset_detect, + &channel_type); + if (ret) { + dev_err(dev, "Failed to get ADC channel type\n"); + return ret; + } + + if (channel_type != IIO_VOLTAGE) { + dev_err(dev, "ADC channel is not voltage\n"); + return ret; + } + + priv->gpio_headset_key = devm_gpiod_get(dev, "headset-key", + GPIOD_IN); + if (IS_ERR(priv->gpio_headset_key)) + return dev_err_probe(dev, + PTR_ERR(priv->gpio_headset_key), + "Failed to get headset key GPIO\n"); + + ret = of_property_read_u32_array(dev->of_node, + "samsung,headset-4pole-threshold-microvolt", + fourpole_threshold, + ARRAY_SIZE(fourpole_threshold)); + if (ret) { + dev_err(dev, "Failed to get 4-pole jack detection threshold\n"); + return ret; + } + + if (fourpole_threshold[0] > fourpole_threshold[1]) { + dev_err(dev, "Invalid 4-pole jack detection threshold value\n"); + return -EINVAL; + } + + headset_jack_zones[0].max_mv = (fourpole_threshold[0]); + headset_jack_zones[1].min_mv = (fourpole_threshold[0] + 1); + + headset_jack_zones[1].max_mv = (fourpole_threshold[1]); + headset_jack_zones[2].min_mv = (fourpole_threshold[1] + 1); + + ret = of_property_read_u32_array(dev->of_node, + "samsung,headset-button-threshold-microvolt", + button_threshold, + ARRAY_SIZE(button_threshold)); + if (ret) { + dev_err(dev, "Failed to get headset button detection threshold\n"); + return ret; + } + + if (button_threshold[0] > button_threshold[1] || + button_threshold[1] > button_threshold[2]) { + dev_err(dev, "Invalid headset button detection threshold value\n"); + return -EINVAL; + } + + for (i = 0; i < 3; i++) { + if (i != 0 && button_threshold[i] <= 0) { + dev_err(dev, "Invalid headset button detection threshold value\n"); + return -EINVAL; + } + + headset_key_zones[i].min_mv = button_threshold[i]; + + if (i == 2) + headset_key_zones[i].max_mv = UINT_MAX; + else + headset_key_zones[i].max_mv = \ + (button_threshold[i+1] - 1); + } + } + ret = snd_soc_of_parse_card_name(card, "model"); if (ret < 0) { dev_err(dev, "Card name is not specified\n"); From patchwork Sat May 25 13:28:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674031 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 4A2D069944; Sat, 25 May 2024 13:28:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643697; cv=none; b=Zzvp+5kdZzHceadQ4ZkGtS+f/uzRO5iWEYAkmZctCNpXHvk3mZRMA8FPFsUiMor685GA9ARKtyHmP/gtyMMGOpd0zBEWtvYFzcNoh60TJI+MtLz3w/MwZA4dgITSWnb132S6Pdbt8JindCYdQlK8nbYHE0wIXi9ERMMdKkBvFq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643697; c=relaxed/simple; bh=7q1elFo7CAxZkZBweHbgmjBT8X4yHLYsePVZJR8HO/Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b6/n/c3ZX14yDYQ5JjTOrBYWNgI0I+Edvjy2WXHYwkkjiguieJ4WQD/2bF12rUMCaNHtMjoVjs3VdVVW0y/aq8WLhWgJ8sECY4Elqm/llJoFDev4ZceOTRc45JwK7qOA+rL5Ee6RrSrOs97QL+idxRrahU86H8CKwkzQsi48yeI= 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=JhELMDfQ; arc=none smtp.client-ip=209.85.208.46 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="JhELMDfQ" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5755fafa5a7so9240557a12.1; Sat, 25 May 2024 06:28:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643695; x=1717248495; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=aYm1aEjf0Zap75LycmMoJDPmBXZE+yZRaT5MJKObyzU=; b=JhELMDfQHPP5JIjvczdK5xT6BQZj+eZX8FxPGs5MXkS/XEYyAFxGLw4osZ5FQksqY1 cG5/+KJM12aF/LSAP/u9PxmO2bQ4Ud8fdjz9zu0I5dXHx0L5yF33Beu70y1czbKVpaI9 mtPQJnQSuwRpOkpXMl/Ozu19yoZZyfJdTOLvP8UtpHKqUjKrLdtdJsFHq/5yFolGPebJ mf1D9JDdraLyRjw5lRaotK/TK4veQQ/Sv1HnkZ2WxG6E+tPfZIBm6ZCDPB5oVZs736Xe 6Mt1XATcLz8bL+EenqXs4aFd/AdDY9bln5ukP9c6LLPVMjTxcggEJsUazWPU7Z8ACt5y BFqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643695; x=1717248495; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aYm1aEjf0Zap75LycmMoJDPmBXZE+yZRaT5MJKObyzU=; b=lmk6bcIJ0fj/Lr3zjjWTSfVgzS7GocNyUCI6vw+WAYOgNU9vO+l577nidSBRe27Klj s7UpQKOEGygu/EfIfZ02Nx2pTweT89M4wOxOqopzis/XX5GUIRyHeB0iaWS1wAcwf4Gt XJHbs/rilQsFnWbgnYWy4T/++nA6CaZ29pWmfXLfTFw/SvTwLdRiQkypo2x3ckLgCc9U cL5KgrVvl6VWTgNxM3I54KcZPhP3SoR1GdgTyU15QGPsnJ9ftOgLJA0N4g8ATXuD2acI bqtTdmLyCCK/PSajNwT73Fy547Q5+BjXFaAfjt2FuFF57TxW30jTaQavd9fp5qXTUE9B +WTg== X-Forwarded-Encrypted: i=1; AJvYcCW7C9DJHKdHG4/Q/fgsiidYevQh/AdiYNnIDhW3siv4lQKSWmlHEfQmfAuWYkIs/sk2fB2/JuV1nMmvRD0tKyZtOHJeKwkJTuEUnBahceQAXoaj4419lxxj2Ii6yra/gMCiwL8fRP+U75dQSrzFEll5HfXTOWHm67DiTXdEhoLrjjuV2kv6DJnK8gsZO0zgWbcLVUdN4uZv7zj8Gj2lLI1exKdX5Mp+4qs= X-Gm-Message-State: AOJu0YxCOoX197qPz4YChGnCNsQyiCZkmY1QexduvbbqEbwbX+X8R4Ng NQselzeANj4n25ffQM4x6p7uP8JM5zlcTo2TMGs7GFkKr5bcnmgN X-Google-Smtp-Source: AGHT+IHdx/tw9IhnGg8vGuaesdmmsPdkFnOGx7QFZnPi31e5dF3k4vigUZYqt0/oZwQjTd+tJOtmbQ== X-Received: by 2002:a17:906:1117:b0:a55:a895:46ae with SMTP id a640c23a62f3a-a6265259847mr314823766b.63.1716643694468; Sat, 25 May 2024 06:28:14 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:14 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:10 +0200 Subject: [PATCH v4 6/9] ASoC: samsung: midas_wm1811: Use dev_err_probe where appropriate Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-6-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=1631; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=7q1elFo7CAxZkZBweHbgmjBT8X4yHLYsePVZJR8HO/Y=; b=awYAMRq5ulLIglF1H1Y0PzqOS1+tuiQldsorqr7g2v3Tj2K+KBY61oddW8/uQHpyx94/xqJYL nI8BlGptFftDtpMEsYUXRbgdBe19G8yVyT0v6GPBo4T6+cC5eZMmRmk X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= Since we're already using it in the newly-added GPIO requests for jack detection, extend it to the previous checks as well. Signed-off-by: Artur Weber --- Changes in v4: - Adapted to regulator get functions being dropped in favor of SND_SOC_DAPM_REGULATOR_SUPPLY Changes in v2: - Added this commit --- sound/soc/samsung/midas_wm1811.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sound/soc/samsung/midas_wm1811.c b/sound/soc/samsung/midas_wm1811.c index 88fa9e5bc093..ad0283364081 100644 --- a/sound/soc/samsung/midas_wm1811.c +++ b/sound/soc/samsung/midas_wm1811.c @@ -590,17 +590,15 @@ static int midas_probe(struct platform_device *pdev) card->dev = dev; priv->gpio_fm_sel = devm_gpiod_get_optional(dev, "fm-sel", GPIOD_OUT_HIGH); - if (IS_ERR(priv->gpio_fm_sel)) { - dev_err(dev, "Failed to get FM selection GPIO\n"); - return PTR_ERR(priv->gpio_fm_sel); - } + if (IS_ERR(priv->gpio_fm_sel)) + return dev_err_probe(dev, PTR_ERR(priv->gpio_fm_sel), + "Failed to get FM selection GPIO\n"); priv->gpio_lineout_sel = devm_gpiod_get_optional(dev, "lineout-sel", GPIOD_OUT_HIGH); - if (IS_ERR(priv->gpio_lineout_sel)) { - dev_err(dev, "Failed to get line out selection GPIO\n"); - return PTR_ERR(priv->gpio_lineout_sel); - } + if (IS_ERR(priv->gpio_lineout_sel)) + return dev_err_probe(dev, PTR_ERR(priv->gpio_lineout_sel), + "Failed to get line out selection GPIO\n"); priv->gpio_headset_detect = devm_gpiod_get_optional(dev, "headset-detect", GPIOD_IN); From patchwork Sat May 25 13:28:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674032 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 6D40E4A99C; Sat, 25 May 2024 13:28:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643699; cv=none; b=Ry1x+JVAlumlxGPxnh/9B3OGc2JIzcpEJEJ/s2PyDNx+6o8Ucx/J9T0z4QzMSjfeT+6b4dubUqJa8VKvo8IimyIZI3dpzuaEFtmV/UQxZzP1xVU0MaHgeUpP/UN9A/jbHadTHFW+Ze/zHgUQeMFbw4eeILTssg1Rw+AWqZVgCu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643699; c=relaxed/simple; bh=hH25eTCdZC3BJgBa3AD+9InewcsW9rj0sd8f9BvAVfs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V2NI2dj2ENkdbSfeMpcG8aNvDDpQDjNv6Gjc4cOLVXUGq4gcwPXzQllYSsV9bb+qnzFAVcGK/HM2suGHrwulZ/rSmRtyHN9CM/iyaL4NOlWVXM3u0xMAf6wdAS0X9x6aK93/FBCS/Hn4sJJiyCiNwu2ypFsQdPCrA0A341LifOM= 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=XgszNLrU; arc=none smtp.client-ip=209.85.218.51 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="XgszNLrU" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a5a4bc9578cso1362985166b.2; Sat, 25 May 2024 06:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643696; x=1717248496; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cUjZKrfisu2MIRRIzFKLBIKTAToYLPq2V2E0DmuWK3M=; b=XgszNLrUYgu5rFIs2oCkNkVu7S3ZznMxu5E607WFRiTVfgk6oyir5UVKATHnc1uWU8 a8PIfSzouY7O/oaI3kRAxaJDw40adoiUXBHiMCOabPI7oDJHkNgz8V6ViiDEj97WvX00 8+AmU3QGF9390bnxO7oatfl0bDCgX4S679hx1QE69Ye1r1wHS7oAl2k+7gTBr/ZE4yv6 KFOk3i5SiCwgiNChFY77WcBhuf+rAQW/KRcNP+79tDcyTMtnMNxr6keoH7rzjOcdpzjr jA7kfQ2wc7K3+NVesiOlUmJQ1ofutU4IHFn8PQbuEEOIpldEG4ZIeRSatkj4NfgPI9EJ YU0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643696; x=1717248496; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cUjZKrfisu2MIRRIzFKLBIKTAToYLPq2V2E0DmuWK3M=; b=W/5sb1/uAQNA1v5vKtMZeXOB3dUBG7D34yn4uQ5ATjvbgbjpZo4qCw7K11Re0MmHE4 bCz3jAv2QEpIoMUwnGesAU6YnPnEgmIOA/gBu8kDpW+bY+RA3kv0qmiG0Vg6rn9YFHDa XtW3L8uXiUtsIe7aoxeIgeC0beWBPyaYxT2qjljkZHnd1QXtXG7AimoTB3pHXIL/cMCV CMH9W/YPnigqBlPKukbMsuyq0Q25Rro+xtGWcFRwB8WzEN96Scw34H6Peuhwyzwp5ATw pdnbbjL5qEUZkVBGfZVsl1rVFu0phJuqDp0pnmCS3Br3TzIkdOBHdey+06+iTq0ASFWl aaZw== X-Forwarded-Encrypted: i=1; AJvYcCUTmoXFZIi9BEKGMmkO++dBlsqZeL6VBKR0eE0GSmNTHhXXUo8daIZy5ARzn6CEDgGL/b2+IlLxpnKcQMBWEcmXBVE2VqPU48BrxYzfdVhkrOsz1ysLIPaMJmMfDAVgHO2kaa2Rk+faLg8tsOPjJl+bQEOQFxH2/4OdqEOoF06W7Dtddw5IMUUtUfAypRb43HgyJ9S/J3jY9UJUg9jgnKzq9CQTo5SXyTY= X-Gm-Message-State: AOJu0YwZdaz1FjpEoPcx48ONIWputVssULQdSi9Zdw1HvCM79+FTX5Qd TAeaKWCVHIX1GOBX0YOkhqHeKejH/JWvrxMSAYb0BqFI05F2sohQf3UTww== X-Google-Smtp-Source: AGHT+IHecgBLLiR2XNqDGoawDWaRaibToLWBukY8GFmV6rY0WCbDFPgUt5GIcLfdOSKMc8LBeMskbw== X-Received: by 2002:a17:907:9048:b0:a5a:5bc8:9fcd with SMTP id a640c23a62f3a-a62646d573amr341067966b.43.1716643695688; Sat, 25 May 2024 06:28:15 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:15 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:11 +0200 Subject: [PATCH v4 7/9] ARM: dts: samsung: exynos4212-tab3: Fix headset mic, add jack detection Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-7-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=1934; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=hH25eTCdZC3BJgBa3AD+9InewcsW9rj0sd8f9BvAVfs=; b=8suLwt6PYYGht/gjaVmfd4Bf9bOltHXD8x8FCQuaPn3LrrrQKrPEQ7bht7esAwrg3XIlV6ZH+ Wr93+pTNpjPBik9iZXR4UwXTlgPWDVB5/SEZCqWitcGOvGz9XZyaAEQ X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= Set up headset mic bias regulator and add the necessary properties to the samsung,midas-audio node to allow for headset jack detection. Signed-off-by: Artur Weber --- Changes in v2: - Added headset mic bias regulator - Added samsung prefix to threshold properties - Dropped wm1811 config changes --- arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi index e5254e32aa8f..8dc81112172c 100644 --- a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +++ b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi @@ -294,11 +294,30 @@ submic_bias_reg: voltage-regulator-5 { regulator-max-microvolt = <2800000>; }; + earmic_bias_reg: voltage-regulator-6 { + compatible = "regulator-fixed"; + regulator-name = "EAR_MICBIAS_LDO_2.8V"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + gpio = <&gpm0 0 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + sound: sound { compatible = "samsung,midas-audio"; model = "TAB3"; mic-bias-supply = <&mic_bias_reg>; submic-bias-supply = <&submic_bias_reg>; + headset-mic-bias-supply = <&earmic_bias_reg>; + + lineout-sel-gpios = <&gpj1 2 GPIO_ACTIVE_HIGH>; + + headset-detect-gpios = <&gpx0 4 GPIO_ACTIVE_LOW>; + headset-key-gpios = <&gpx3 6 GPIO_ACTIVE_LOW>; + samsung,headset-4pole-threshold-microvolt = <710 2000>; + samsung,headset-button-threshold-microvolt = <0 130 260>; + io-channel-names = "headset-detect"; + io-channels = <&adc 0>; audio-routing = "HP", "HPOUT1L", "HP", "HPOUT1R", @@ -345,6 +364,11 @@ wlan_pwrseq: sdhci3-pwrseq { }; }; +&adc { + vdd-supply = <&ldo3_reg>; + status = "okay"; +}; + &bus_acp { devfreq = <&bus_dmc>; status = "okay"; From patchwork Sat May 25 13:28:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674033 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.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 A731B4AEDD; Sat, 25 May 2024 13:28:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643700; cv=none; b=UtcnZsRYKp43Uj3CeNJ68vhkZ2R6tqyTGVR+2BUFDkxI3OmSCHJTzV9O+moczi3u+E9DFCrbuK5debNf2pZCH9KtoHMw2v0TXF//9SMEHe2P+daugRnZGK7lPZcoov1YbntKJyXmgu6i34fXrEYofb7+R6ABBQTu3kPMsuUHXyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643700; c=relaxed/simple; bh=9NhvL8rRJ4NpIlfmWPhGyv2x7+JR1l7yy4pYIQI11b4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IGNxDp2YO4NPvCk9g1ofLIXaT3ho4IzMJIDoLW9W3zb8blMNTee9YtzG2W2z+F/Du7UulpYoydK5OvE7lIoinPaZYixQ+1MiwtXMktVpVQXvIIm/GdspphblddlXhU9kE5T3UKAg9AvZL44xi4v6tpIXlM4z9P3A32es2AEVnV4= 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=cZ3YxhG3; arc=none smtp.client-ip=209.85.218.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="cZ3YxhG3" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a626ac4d299so179795366b.3; Sat, 25 May 2024 06:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643697; x=1717248497; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KVTf+ORIRGYRpXo2GEU5zQOEzBOgFtModBKMJI7KIkI=; b=cZ3YxhG3lJ7PmZAzO8yf/UX+0eCOiZojRrx69l5dfvrxPPdOun4bNim/pgjCxBT7UN FrQ22oivkfSwbh0P8jQr+ZTmcMJRu8a609Zd7A9NrRW3EnScIrN1kLJG1HqO0zJo8e0h /HZ4H4UeaoCUSrauRVlacEP+NnDp9pOzOWpa6oTTDfXNDcqfkIBAuXCz/CMWqiJofX0z d+jhbDVwYVdnDd9TujaK6Rhmac8s+7YElSBY/247+g7bKTpw9EpkHoCH/B3CY8sjoTRV 3gil2L2yVqGrLyCV+ROQ7hZDMrNB9kDH4BLySOmr0fCalBn58QSkz+2RKO/ByxF9nOfX w4cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643697; x=1717248497; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KVTf+ORIRGYRpXo2GEU5zQOEzBOgFtModBKMJI7KIkI=; b=i7WeUVWAg4eaQiJcaSEzDy4LalFMyhU6dzoDAlSpotkiNFCFY3w4CzZXRfCV802qZ9 kQfJsnXBaWtV8EA6Ofn0MewX933wdXt7mzxDToaqsl4z5cRbYXcLdDQQgKWGrToNlYhL pLrFDPUt7KBxuYCMzSCxatyw5Z+BUttNH7oGWDd+gNB3FGiee2hFadfUPVbn/FzFwYgh zobkqL4eQRgE8VQI11mZLTavALNP1oJH5VWELgl8lKTYl36Xxz635wz1pKXm8kyo+YiP Wy8XziudSH/3BfD8JMnMPv2xwb0aArNolBIRM+maQJLiAMhj5K4uOw1YS2M76yX1/H84 cteg== X-Forwarded-Encrypted: i=1; AJvYcCW2kiHy+e+abb59fxnKmRMyVkv/oFiLGLJeqQ4CsTp9JwVB8maVxDDy7RUAgD0a9IMPD2GjUbfOuP+myOWg8gJ3upFZDC8J45+HGt5MrXt5vP03xTGYw/AAZM+EkxQf0yUU6HBMPDTDHBg/EgKIO9wRp497Kb+vyBLW3aRLaZjJPFWGGRvqNoF8jaPmRqD0FH2M/86QYEFQHg94KLDq6WbwD4FZdrT2Wrw= X-Gm-Message-State: AOJu0YxzebLjjyhK4c0cDq77AJmDtxaD+aBg9YRl3I7aS2u5DQ16rzop Vqm51lQpiQ5gvDi/M2e71WTSJlrtlBUX9WSJaIsJorLva1qT8ffV X-Google-Smtp-Source: AGHT+IGKy/nfMumZ+piDk12ki5yLScoDlP3w4SoUDbj6/OPTWDEjPeyHUakIPs5ygv6O1U2HHNXMYg== X-Received: by 2002:a17:906:6d95:b0:a59:bbd6:bb39 with SMTP id a640c23a62f3a-a6264f0ebfamr326678866b.55.1716643697033; Sat, 25 May 2024 06:28:17 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:16 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:12 +0200 Subject: [PATCH v4 8/9] ARM: dts: samsung: exynos4212-tab3: Add MCLK2 clock to WM1811 codec config Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-8-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=1280; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=9NhvL8rRJ4NpIlfmWPhGyv2x7+JR1l7yy4pYIQI11b4=; b=C0ynPtHNYmis/xfQ/wB1ZfG8JHLYQUqSEjR4rYX7GYbMQmbw4YCAxg/2J5P30kp+52wjTF7+8 rsbM/TdIWdzB7cRXlBvMytyyjCrEOlBBw5psPJJ9C8szKVM66+8pWU4 X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= In the schematics, the MCLK2 pin is shown as connected to CODEC_CLK32K, which is derived from the same 32KHZ_PMIC clock as Bluetooth/WiFi and GPS clocks. 32KHZ_PMIC is connected to the BTCLK pin, represented in mainline as S2MPS11_CLK_BT. Add the MCLK2 clock to the WM1811 codec clock property to properly describe the hardware. Signed-off-by: Artur Weber --- Changes in v3: - Split out from "[PATCH v2 7/7] ARM: dts: samsung: exynos4212-tab3: Fix up wm1811 codec config" --- arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi index 8dc81112172c..47e9a230f2e8 100644 --- a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +++ b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi @@ -529,8 +529,9 @@ &i2c_4 { wm1811: audio-codec@1a { compatible = "wlf,wm1811"; reg = <0x1a>; - clocks = <&pmu_system_controller 0>; - clock-names = "MCLK1"; + clocks = <&pmu_system_controller 0>, + <&s5m8767_osc S2MPS11_CLK_BT>; + clock-names = "MCLK1", "MCLK2"; interrupt-controller; #interrupt-cells = <2>; interrupt-parent = <&gpx3>; From patchwork Sat May 25 13:28:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Weber X-Patchwork-Id: 13674034 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.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 0CC9D84FAF; Sat, 25 May 2024 13:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643701; cv=none; b=bLPKsX0ekAkufb/KKj0dXokpacTNFYsH3/d68rG0VnYNivTXX5g0p/+yNa5M1HHAVukGpUtNU1R8AmKKNvycP8qHaG6k0OnpRTIHuJDc8eupPfC0SeugWEoqScRQODYe9G6SVbD4x/NUGhM5PlXc54InhStCKZo0+3H7VgC8B1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716643701; c=relaxed/simple; bh=JqmBRm5p/y60vQho/QixG5OijJiMY4yvo8+3qIYS2Eg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SH8gdJuaqUT0qorFw+D3eKRszsXGhz3U36gQP0JCpuRsv3A5X+8lLGzZ6FAVXmcUNhUqce7O9f9khlj+BSOgSuYIQ59Bo9G9vN2Oj2+Ct+fjjJK9sviLfC5X2l/WqGXYRbdXo7Q9ov6d+Dkb3/69a6jEhE6AQIx/u8pgw/EK/Dk= 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=nFPOoWPZ; arc=none smtp.client-ip=209.85.218.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="nFPOoWPZ" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a5a5cce2ce6so1245061566b.3; Sat, 25 May 2024 06:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716643698; x=1717248498; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xAevoRwyHB/hjeggss8BgF1gg74yCzQU/uk4mIsOlV8=; b=nFPOoWPZz3CxJg744QldMKzU17p190cSKbnz6wr2xcV5zLZ6FLxZiJbsLmMfcDKzYd qOPuUQR0izmWaoPyHKiYqwrx3jcvKTtuY+Bi0Yg/PJYzomxv71gGLgTVdn+xf0eIU8yb crrtQejtqYS25X+Z17HBXNRv58OrwuDyS0ImQYe5hBQBKcoMgoahLskEkPvlcym8s6r8 0OCce3Neurk6p3GSlvqaQBoeD99DI5p4EMdPH+OajnZphhvbcl/31wv0ZQji3mg2hkBM O3+nM1QRTZrzButmAZrzU4plr7NMi0Q34V0bi9iuUvuCjD1G+fNRRGOKUIM4GbGYwJRA B0iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716643698; x=1717248498; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xAevoRwyHB/hjeggss8BgF1gg74yCzQU/uk4mIsOlV8=; b=qN5I02eBjaVVy31Oei3GBs5ZTbbqwnFeKiaagZhXEs3DwUI+RMtOxtxmqA68s5hS/1 eXH7y7eE1EswNUQKxfTMDA2wzfpfaNNzBsKrXFOCa5eP84cbS+VddrDP/0GofRBg4huQ PzZyY3SnnVQMteWHVXz+bMOFJpuhCgW757cvWZ7xgosLHWXOM5gzgy0ZXYM98iR55xoh 49xVlYKvgwxDRXuayNCjfqNEFCIj8IwDetxxFl3ZGNN69vGEd8vEcdi0MlCCi087R9ui Ie3sBU7xznTAu1HMHQOR3VM+T333676OQxgYJpxi8zOc/UQfEN8kH1mfzGF/9XrzObk3 tMEQ== X-Forwarded-Encrypted: i=1; AJvYcCW3YWvGMj2F/650tcx5o6MLxPjlynfO1EvcDkCufJyF2dt2YDz7a/jzJnIhbe3WqumVvgIWFwqpAQplo5dwkLlej0dshiDObnomZg3akM5Lw53g8mIdi91PInfQwfgoEDsKg2bCqZswRTHmX92M14iZfOEdn8T2ZBKeUz9c1sGQdqB2rKGU9Zn/5oaIA/dx8d2PXZ9qkkVZJgT1xZlvOM487sD0B3/xl3Y= X-Gm-Message-State: AOJu0Yzs72b2GKkCsVo2v0KWdbQKeQL9sq+/CTxMA8TDeXCuUmYV6mxq EE6S6KoM8GKPr0xkeHjXr2e6NOqlR0RogiOf3tp+ZYNyImGrpWC0 X-Google-Smtp-Source: AGHT+IHjDWw31Jpb0flKPT54OLT41uuXKaoyPQviyN3N7/UlfI6Rk1BZIMko/WbbCb3qjGua2q1M2w== X-Received: by 2002:a17:906:68c7:b0:a59:ab57:7413 with SMTP id a640c23a62f3a-a62651341ffmr304999866b.73.1716643698275; Sat, 25 May 2024 06:28:18 -0700 (PDT) Received: from hex.my.domain (83.8.128.191.ipv4.supernova.orange.pl. [83.8.128.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cda46e1sm251842566b.196.2024.05.25.06.28.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 06:28:17 -0700 (PDT) From: Artur Weber Date: Sat, 25 May 2024 15:28:13 +0200 Subject: [PATCH v4 9/9] ARM: dts: samsung: exynos4212-tab3: Drop interrupt from WM1811 codec Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240525-midas-wm1811-gpio-jack-v4-9-f488e03bd8c7@gmail.com> References: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> In-Reply-To: <20240525-midas-wm1811-gpio-jack-v4-0-f488e03bd8c7@gmail.com> To: Sylwester Nawrocki , Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Rob Herring , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Alim Akhtar , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Artur Weber X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716643685; l=1130; i=aweber.kernel@gmail.com; s=20231030; h=from:subject:message-id; bh=JqmBRm5p/y60vQho/QixG5OijJiMY4yvo8+3qIYS2Eg=; b=att6PI+S7xL/90ESu59NSz4LR4vIES/yJXLYib2LgY8EMPIGeok1wNdGajg7ym3EcfPb7CnFU Pwld1M2ToFDAxruK69JapsFnNIrDHO+vaCy7Kw72doBiWQPqda/rdnC X-Developer-Key: i=aweber.kernel@gmail.com; a=ed25519; pk=RhDBfWbJEHqDibXbhNEBAnc9FMkyznGxX/hwfhL8bv8= This was initially copied from the Midas DTSI, but there is no proof that the same interrupt is also used on the Tab 3. The pin listed as the interrupt here is GPIO_HDMI_CEC on the Midas, but for the Tab 3 it is the headset button GPIO - GPIO_EAR_SEND_END. Drop the interrupt, since there is no proof that it is used. Signed-off-by: Artur Weber --- Changes in v3: - Split out from "[PATCH v2 7/7] ARM: dts: samsung: exynos4212-tab3: Fix up wm1811 codec config" --- arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi index 47e9a230f2e8..20e5e7ba6b92 100644 --- a/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +++ b/arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi @@ -534,8 +534,6 @@ wm1811: audio-codec@1a { clock-names = "MCLK1", "MCLK2"; interrupt-controller; #interrupt-cells = <2>; - interrupt-parent = <&gpx3>; - interrupts = <6 IRQ_TYPE_LEVEL_HIGH>; gpio-controller; #gpio-cells = <2>;