From patchwork Thu Feb 27 12:07:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994281 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 9348F22CBC9; Thu, 27 Feb 2025 12:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658143; cv=none; b=fk9L+99fwO3FgBxoGRNPb97HKS0OXROI8mdh3rHF0uHQ96dw+0qkME3Yla19TfbHNWbOwYqPZjSbCvc0xubhqrdSWaNcyHEqc7QeIJPDss/pTzsn2UpHFG5b3x5RS9qE3mdogZpBXlw3vOpAOqJMwaSCDeX1ZksdHaZ3BbxPIz0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658143; c=relaxed/simple; bh=XHik9mYL+2R8oi63Ob2TqU9Gy251Jz/Rt2dJan9+2QU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bD26xZLJSx1HisOI73PFDFk6AtlKeuF94mmIwPdA3t8NP34MI7IqjVV+gU3lU+HKS2nRfi3XoOQZ/493p7YmaVb8g3DpW+9AtaNZHbRWc/tYjprl2fGkNF3EN/ISF/57e4L7BmJUWyXcQGSyZlroSS+wcs59LjDLRjIkXvX6bwQ= 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=gLAKsci8; arc=none smtp.client-ip=209.85.214.179 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="gLAKsci8" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2210d92292eso20199085ad.1; Thu, 27 Feb 2025 04:09:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658141; x=1741262941; 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=CM/hSNgGpTABnTd1mLn5ynew+5ys2Any/2l/ODxMfjU=; b=gLAKsci8HAEhSwp+3avoXx/1Ky6oSOiNcaXLS/uKsJ/29ZCBHv9ebkvEgbqk8afXap MPTTZvv5MIp1ro1jMLjOd65Ke1PVIcTcstcn7QRTh/8iK/LA5rky8Mj2LafW5ezydqHT hTn1qar/yvEaMYmjfDRxvfWy/p2TUGKxWxMUwjrjum3r8o7Z75ol+8c+JkQw+2XM7Gom nKcP2tNgYhXuXBHDngEcuWGjujv5JjmqA3U1xMDkBkVcmYGFW5Qj80iGwCnyAenYzZGt fEfdDBmeECFp1qRsxgPQPhVZbhFH5NDadR9dpJiMEskC32MVC2rETKAMU85+XnOQ85g7 23qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658141; x=1741262941; 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=CM/hSNgGpTABnTd1mLn5ynew+5ys2Any/2l/ODxMfjU=; b=a8lzSpTDfubedqxcbqeuR4GsFhveHezzjLtFkoGQoailboe5oeXnUjOlbLkQAMtiPy blU8fgM8Ck38EVI5pGkIdZW3mPIdeMFL40WwbTo3t3IYcuwLB7j1sYdRft4LK7zCDXNR dP87ygiMcCebZ3WTbCT3BEYZLv8I9AfSkpFcOblzY37VoY3BPWcPVIf0Q4LVZpVLgMuD 1QA1xu/JpB926BVg8LUHgQ0MRTLuwuTbfhsQvlvt8PKPJfW2/r3PR93rKWYw788sJ5B8 clkbZMoFKfBicqYcRNCMByw4oNrBw1cfJvivOi0F93lG+oG7NuoOXd8KwuwHva64V7Jf MrQA== X-Forwarded-Encrypted: i=1; AJvYcCVwFSSKxbYlGy+4ERTyOvK8ITMGwOSCBR0UcEG1xtnj4o1VKZ+1mWMeBvwexFII2Q/kRdOSj6isLRKAeDo=@vger.kernel.org, AJvYcCW/0kSVhEdNzn4NDFH5wKkuVdAGOf9FpRo/9xeuchPuJWyIonPWct0krudjwppc1yWbqMxRD1E2lKyTOwvw@vger.kernel.org, AJvYcCWjh072El4dvYHzlSTCGDrPW6Bk9oYb3YCc9N9dwUpq9iGWthuNr264i8KDLU8HJEgXgFwqj8qfdS0Z4/Q=@vger.kernel.org, AJvYcCXyKPCbOiHS0M5ayvUdFQZkseZpfrG9mbtT3fvbVNTb6ynEJag1pNjADhtqif/yt3P8Jvmtjtj7PDuT@vger.kernel.org X-Gm-Message-State: AOJu0YxIxSzAsgS+vnLVpgxx8KMsgAM0zBaOT1FCAfoO0nLSa42dQUyp mYG2QaGXI65ObODlha0mz6Nf59vGAjPb4xbjLf5/0MrI7j0dsWPk X-Gm-Gg: ASbGncvzNqYebKx+fS0l35Zr8cXuRBq/amE0zrQASN1vAi5Gu2FzpxH4WqgVwfJW73J 8jslg/B9M5q7H5avPUgfVjoaoXApOqpSdIF4MFMp/Fc6OE6b4hMSrjGIJ+F3U09S4J94URNirmj JfAHYy/4HEdL3+VGfmF1FL0soVn0oyMpH++XEkdVXOsGUUVwuHzEZrZ3mYdrVOIY3H046afDQEG SgX9zjXiMP59mviBx/pDbEk7bBQBp/h6sPzrrbxI2kzSpnDUuphvun2M0TP39EJYN0vbmRTVyGa oKD+QivO53xE043MouOxxIR9LJt+OP/lOzLnRBspMCY+94Y5ofHXLTCklkObzlvzHNEZNbfy1QU FW+KYsyXrOUXReOXpKibl X-Google-Smtp-Source: AGHT+IHkNwkeCz1bkgth7yqq5OPbVsiQcDfZ+qpp4u+IIzvYKUCHV3sJOsMaIADyE1zAtG/2sg/OZQ== X-Received: by 2002:a05:6a20:4305:b0:1e1:e2d9:7f0a with SMTP id adf61e73a8af0-1f10ae8e5dcmr13009072637.34.1740658139505; Thu, 27 Feb 2025 04:08:59 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:08:59 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:28 +1000 Subject: [PATCH v3 01/20] ASoC: dt-bindings: tas27xx: add compatible for SN012776 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-1-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=999; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=XHik9mYL+2R8oi63Ob2TqU9Gy251Jz/Rt2dJan9+2QU=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk++3N/P/ma/2cp+1imlUvwqe53lDsn8/LdXL3/Vv qIviUr3OkpZGMS4GGTFFFk2NAl5zDZiu9kvUrkXZg4rE8gQBi5OAZhIZj0jw5dHxaI/DtRX3pi0 TmL6stf9dRx5rlKNZ1rMJ8qHn1wV4cvIcJF/d7vuvYaGVLUzd75/CZVtK3y6MFdKjNvy2clmkfQ gZgA= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 The TI SN012776 is a variant of TAS2764 found in Apple Silicon Macs. It continues Apple's long-standing policy of getting vendors to spin out subtly incompatible and Apple-exclusive variants of their publicly available parts. Reviewed-by: Neal Gompa Acked-by: Rob Herring (Arm) Signed-off-by: James Calligeros --- .../bindings/sound/ti,tas27xx.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/ti,tas27xx.yaml b/Documentation/devicetree/bindings/sound/ti,tas27xx.yaml index 5447482179c14ee78885e5bee02f4549428694a6..fcaae848e78a1137e4d44f98258207bba68772b9 100644 --- a/Documentation/devicetree/bindings/sound/ti,tas27xx.yaml +++ b/Documentation/devicetree/bindings/sound/ti,tas27xx.yaml @@ -24,6 +24,7 @@ properties: enum: - ti,tas2764 - ti,tas2780 + - ti,sn012776 # Apple variant of TAS2764 reg: maxItems: 1 From patchwork Thu Feb 27 12:07:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994282 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 2AE7622D790; Thu, 27 Feb 2025 12:09:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658149; cv=none; b=siTpeFaCvwF317PNzP8OA3wVUytJfsZnJ1ESUBDV/YFBmI50J1nG5AGS375rkyMh6O90rBPfmW8XqsiKM7rrJrnueNjGuDJwmv2N0zCh9W738naLfIq63VIyjEXxvghImiC+IZqoqXzx982858CPam5J4IcKAHC/bnmwVBWgMBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658149; c=relaxed/simple; bh=6I6kevtGt5Xf+IFLuo9iZloEKxJU0BXvwM8XaAJw7vM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bRI9A3TTRCUofiLmVPYIFx9UysErxqYyzckfqXnQvfhv+O4xOxwTjocpIftm/hRnsZkkRtDc2La51Z9nGlGxZheJwud7N0zEbGPHEphWY9+/NdCTdeqb41ml2XitW8E1KlwiZ0muyFEOd0ytPkZq+/JaoQxyB+dpnUhAyV5pWFA= 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=Ys2A8S2U; arc=none smtp.client-ip=209.85.214.170 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="Ys2A8S2U" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-22334203781so26104175ad.0; Thu, 27 Feb 2025 04:09:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658147; x=1741262947; 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=DJObarpxJa//O5mByq2DhOQ2HixpCHNevhGqWbFtG6s=; b=Ys2A8S2UzTU7R86zr+Xv9Jv8U7KlzJ78O7+FVw4UIOFkmz6GR3mFM7unczihvf6XbP w+7n/jiYLaYb6z4S4sRrR49GW0Waen7YjVzIPrkPq6c5Jp6DnkxFKrSmMY09DUR++e/m SypiUVrgwtVYNGc12+LBo4Jonbv/EKfAta2uulaveRriM4e2eM9KYNSJLGyKIM0z9gIZ G6tnLwsDAaXvZrf7i+bcGXDkRSmVWbV5sjssvh7k0s6ZbvINrU2tU5F+XWwgdj+M5qAO cDXEA99V79q3A9O5CqQ5C8FaXz1lWhu1WwGevQ2K/fSmDBNmtj7S9znFQRT1DaCi0KJE O88A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658147; x=1741262947; 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=DJObarpxJa//O5mByq2DhOQ2HixpCHNevhGqWbFtG6s=; b=c5ybS9SyC5C2KNj9CMkcfzxQPag3g1BZBLfBzNUtbE0qFmOu8cZEHyP5cy4HgbcPe0 RJ+rI/VIjsCugI/HLyfvAjDfH8kq+O5S4aJMRKDqmb/PAVy0zWexkJoh7yM30UbuAbhG P5bw408qFaHr9aNt2kk+SKuix9Ffy9nUgODuGh7+4rQ6Q9mXQXbfSOhBdLju0kdN+eIt T03x0v4Y4A8Qpl4N8yS2hU7O09L/EjMQY8oeT41Ez7IJ34qtf9+ZWK8NGEzKs3rQUHCg b+QcxjPMAm+HDyz370twoHSAnHrQHpDWIprcx7WsFMUylDo4nv1r34wdRYeBP6Bunu7+ w3hA== X-Forwarded-Encrypted: i=1; AJvYcCV9EAJQk3qB9i1X4BOetJzE3z5/TNGqjiHebWW4VJkGRGv8ZOkkNHxjz2oG/BmQXI4Oc06ZGuxMxpccchM=@vger.kernel.org, AJvYcCVVOJnxx6vfubkB7gKpLGuxGaAAUQPJCEcKOCHxw2jPQia0NR6mEssql3PlFFpfkBcTBevY435WJ/dJ@vger.kernel.org, AJvYcCWf5zbzgoMoVIvocg9JMY1e/xBnQQ4fFGEhTR0fVTlLNgZ3UgSmDBcf5W8uEkhxG6HdU23/3+1XOB1iYkM7@vger.kernel.org, AJvYcCWwUvAfLWceDpDOyO8es9rMbWcMdASYvul76WgVsUDDFw4SZoqmph1Ir5KozXUFCynHw0glso2wC8tt3WU=@vger.kernel.org X-Gm-Message-State: AOJu0YxAe7Wet3GjeU1TPxjvJ9j3pbdplyjUlk/e14/4kRND/WYqINM/ xwtq/YJvG7SU2DaZNQEzMOeL8l9GO4I3uvsgtEdStiSM8Vde1IIT X-Gm-Gg: ASbGncuUWGIJ1y2h6YGWRUDrxMU+ag2wf7p6tLqU7y5PWUUrRsle6x20tY7m7dATygi tfOD/XNuRQAae9lNG1kty163xxgLlvMzRS5LrPCoNBIi/KLJEgLvtG8OvZBa+tf0twLvDjTqSHK uzdTWLhEDiEV2I/e0/TyzUzPd/PB+W93d6ViBfj+XQq8LUy8PJDwM4kwh8vNYWKHbmykywN0QoA 2TVxJZFtBguenmuwn3ERHMi3vnTZgYUNjt5zHxVWywUBabLtgR1FkHZvhVtaIVvapmMxIeZWn3y 5hrWDH6iXOZ2MAQk3oV0QuO8cpMnqRzPuUd+YzdY9mZscc+1R3gjSwU2tfS58MDqpMOXKMG/oAr jy4Av8TBPQQOc4Y9XoBYw X-Google-Smtp-Source: AGHT+IF5/22JZWa7rQmFG5HLtLWGAWukMonyo6ZnXXa9jydidl+I5GkF7eR1H3SEQLaPfx5JePYS1g== X-Received: by 2002:a05:6a21:3a83:b0:1ee:ab52:b8cc with SMTP id adf61e73a8af0-1f2e399e4acmr4948662637.21.1740658147355; Thu, 27 Feb 2025 04:09:07 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:09:07 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:29 +1000 Subject: [PATCH v3 02/20] ASoC: dt-bindings: tas2770: add compatible for TAS5770L Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-2-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=825; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=6I6kevtGt5Xf+IFLuo9iZloEKxJU0BXvwM8XaAJw7vM=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk/WfVbVsDlc+/Of8a3ExRNn9e9/5CR0KSRPXHhu8 wf/dVv2dpSyMIhxMciKKbJsaBLymG3EdrNfpHIvzBxWJpAhDFycAjAR00aG/+5rGuST7D8FS8n9 W3hH3cCZU/7ATIanD8Q/Z1z7NG9+1WVGhgMmT0TdyhbVnJnAz132XNBj9dWFBil+ysINe4pajt/ U4QcA X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 A variant of TAS2770 known as TAS5770L is found in Apple Silicon Macs. Reviewed-by: Neal Gompa Acked-by: Rob Herring (Arm) Signed-off-by: James Calligeros --- .../bindings/sound/ti,tas2770.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/ti,tas2770.yaml b/Documentation/devicetree/bindings/sound/ti,tas2770.yaml index 5e7aea43acedc0f7d8c22e36debfe805c7ebe74f..8eab98a0f7a25a9c87d2c56fd0635ff8ecee17d0 100644 --- a/Documentation/devicetree/bindings/sound/ti,tas2770.yaml +++ b/Documentation/devicetree/bindings/sound/ti,tas2770.yaml @@ -23,6 +23,7 @@ properties: compatible: enum: - ti,tas2770 + - ti,tas5770l # Apple variant reg: maxItems: 1 From patchwork Thu Feb 27 12:07:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994283 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 F28F422E004; Thu, 27 Feb 2025 12:09:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658157; cv=none; b=SACMLVKh0Gfy05jdfFZcG7S2g9DZYa7CVn6HL80V+aGwMbXqn2USa4IXs22Qjb0zcubLcmfk0ZEu5vFA3Ua8bVJOiaxnlliGfbHPeKRi3Wn4a5TsGsCu+cQw1dygtcvTvBbdnbwPSvUzbgXHMHc58RyHgcwNM3eIXMOCekaQrE4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658157; c=relaxed/simple; bh=F2DrIfGW2/9U4Q7MP0XR4JLpgNdMCG9EqZakypUdbbY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d4ClsHbDszfn1xVJyzmtcmB1aHg/14NvvuzvLIkNXYuOMDcLcwB9uONiqIjHUcC9qP8sUOtc8rk1y7r7xf1G6ieCN5FIEWWdiZhp4g/EOHdp3gVoW/sNsDBZ80eo+/RlZeBBqsOnVjBZtMRon05kM6pVn/coi5+QucCTkaoEbAQ= 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=fpjlYSPb; arc=none smtp.client-ip=209.85.214.182 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="fpjlYSPb" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-22128b7d587so14783165ad.3; Thu, 27 Feb 2025 04:09:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658155; x=1741262955; 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=++pOxyjV7NsBqQX8JUt+QgPYmuOaE7kjoGyFm9ECaww=; b=fpjlYSPbgODxxNp12BYq1W4WvYiHfZxE+hnYpZjppKhM/KmoQBzXWNct85zBjsdCBL 5RqiMsJT6BKcXLaEewHTCJeJYa/NXeAhw+KrJWu2wYQjeA0eQtBs4EQRVe7Qbc0JceAZ FeDxRSkd50ksMCwCZ9mmzfkQfz48DQtaOtSEq/er8BAeVW6/Qje++PSbCe6MRhRqQkrY p+kBslDwy52a+EirygHc3AJE1iXD4ZruNJfe+a9SBsthdF8bBD2bRl2sx1AwqSWoXdpp +dTp/jOW54CuX9czhpz1ICaz6V1Y5Sslz+1v+mlxhdMTnr5Gf5Mdw8wX+Z51fDKsjCOG ChNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658155; x=1741262955; 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=++pOxyjV7NsBqQX8JUt+QgPYmuOaE7kjoGyFm9ECaww=; b=SMaonzdEIs0b+WCzQ6n08wNZM24g3Fhc5Wr1+ouC6bNx6rw4j7gdhcMdFMk+fhloHT TsUVtKPfVW88CFoaUB1pIHSbTlN7h8TlTD/ekle8G+HY7qrmPAZz8ptR605/sYTndrXf npcUoPUxveAahig3QcT0zKfVbhtvhBdSjUAQKJPCEvNWMJK7zx292cXeOVGNoy38bLyg XWcgoAQ2XF2FZI3UEwI/ybUo/ahVtm5YF1FI4wYpnkXAjz+2+qg5+svAfmXEt3gqp5uG e5x6PEFPJkDKHjBNzAM7rkW5fFcLlAq3f27AXOHmPpuFfcctr2+QtmjP+2HQ6EWa8Gsc l7yQ== X-Forwarded-Encrypted: i=1; AJvYcCUUE8ChHyFAMSzHNnsbQYDnOL3vRikS70b1MDMZyVhTOhaL1CwvcZ3FNESIDiCObGPet6BUK/Qjpuqq8NY=@vger.kernel.org, AJvYcCUXce4v3LqBPOkInypm5kFH6ti9NIwes8DTuPI7OZHFuRRw5LBLEKewzMWlWZBUZPHATrnsTQNIvjEH6nE=@vger.kernel.org, AJvYcCUjBpujfhvy5aIMOf+0lM+30fnNQ3Odq5BSK7mV84A+AjDqdKkmQP6BHDLx8Lyx4y0I/TxBtScusj0v@vger.kernel.org, AJvYcCXVvIWX/PzzoYo6kBV4tXt75WvQVV06NBI0NrERkVTXrmLvVoRAwtGIx1LXd5cBCdZObbsLBaH04g57T+Bp@vger.kernel.org X-Gm-Message-State: AOJu0Yy9/iGhSyPjG3914fg0lDzqRzCPbcyBpO9yEDZ2PfIKa1jy7NZ+ 6Og66lK6tc/mfSrllD2loDZH4srUA7CvTIX5H9GgptP19I33jeKE X-Gm-Gg: ASbGncuYiwOoLHtHYUl7NajpTIZRUh4S9cyAAaqmTzBIlLbG6d+kLEud94onFN0ehac C9qqAjZ1cXntzQeAbcXLGC5dH7lOzgX5NwHCyAxd6BlpEj7BMQ4+5WrTX+CJQh7PbPtVbdTfdhx tmnKy+4kMEJ63wGMOQqKkhJhAoXA7r1DZHozboOkrICjwM/jPmceebXxAup+a4MU0tEU/HeAIxM o7XnLUCN0nGzj44xOHCTOcZ6u9QQanuCMCM2Z7tVbBA6y2xBPvDlpvFYhq2yogMU8QGpNXb9Pcz C0fzyDWSi0w3Z9CjuN748Ep0U50Tyzx3uZXsnE8VQ5R7Qm7wQVSb+YfblFWZ1b3OJSb4IE6z84J JEhNOMs5ul/JQX7N5DbLe X-Google-Smtp-Source: AGHT+IG8X0dhuBFQIzNUsv+4ZcqoLGmfAbMbOzcssF/1zKQwJNQCo9iVI1o5amOtj8awa3nUaRERBg== X-Received: by 2002:a05:6a20:7488:b0:1e1:a75a:c452 with SMTP id adf61e73a8af0-1f10ad33597mr12264774637.19.1740658155233; Thu, 27 Feb 2025 04:09:15 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:09:14 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:30 +1000 Subject: [PATCH v3 03/20] ASoC: tas2764: Extend driver to SN012776 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-3-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3988; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=nDjwUi7dJ2EmO3q2jQ+Aw3u//e8xOzpHKb8CsrpivsM=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk+GykqUSsgy7/2rP724+/zm2/7nsrQ6zN5Mu/JP9 +PcQFnWjlIWBjEuBlkxRZYNTUIes43YbvaLVO6FmcPKBDKEgYtTACay2IeR4dfMPc2/r/JeXHdX 9bddpApb7qSTixm71yV/fJEtlR720J6R4f352BtnGY6/tXKryrrX94JJNFl/u5nLteTtQemmvdr f2QE= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer SN012776 is a speaker amp chip found in Apple's 2021 laptops. It appears similar and more-or-less compatible to TAS2764. Extend the TAS2764 driver with some SN012776 specifics and configure the chip assuming it's in one of the Apple machines. Reviewed-by: Neal Gompa Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764.c | 43 +++++++++++++++++++++++-- sound/soc/codecs/tas2764.h | 3 ++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index c0a1d0c2a93890105a169717a7fb75ec05f93146..d9b4f898789fa9b59c94c97e3b130950b88c3a76 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -23,6 +24,11 @@ #include "tas2764.h" +enum tas2764_devid { + DEVID_TAS2764 = 0, + DEVID_SN012776 = 1 +}; + struct tas2764_priv { struct snd_soc_component *component; struct gpio_desc *reset_gpio; @@ -30,7 +36,8 @@ struct tas2764_priv { struct regmap *regmap; struct device *dev; int irq; - + enum tas2764_devid devid; + int v_sense_slot; int i_sense_slot; @@ -533,10 +540,16 @@ static struct snd_soc_dai_driver tas2764_dai_driver[] = { }, }; +static uint8_t sn012776_bop_presets[] = { + 0x01, 0x32, 0x02, 0x22, 0x83, 0x2d, 0x80, 0x02, 0x06, + 0x32, 0x46, 0x30, 0x02, 0x06, 0x38, 0x40, 0x30, 0x02, + 0x06, 0x3e, 0x37, 0x30, 0xff, 0xe6 +}; + static int tas2764_codec_probe(struct snd_soc_component *component) { struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); - int ret; + int ret, i; tas2764->component = component; @@ -585,6 +598,27 @@ static int tas2764_codec_probe(struct snd_soc_component *component) if (ret < 0) return ret; + switch (tas2764->devid) { + case DEVID_SN012776: + ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_BOP_SRC, + TAS2764_PWR_CTRL_BOP_SRC); + if (ret < 0) + return ret; + + for (i = 0; i < ARRAY_SIZE(sn012776_bop_presets); i++) { + ret = snd_soc_component_write(component, + TAS2764_BOP_CFG0 + i, + sn012776_bop_presets[i]); + + if (ret < 0) + return ret; + } + break; + default: + break; + } + return 0; } @@ -716,6 +750,8 @@ static int tas2764_i2c_probe(struct i2c_client *client) if (!tas2764) return -ENOMEM; + tas2764->devid = (enum tas2764_devid)of_device_get_match_data(&client->dev); + tas2764->dev = &client->dev; tas2764->irq = client->irq; i2c_set_clientdata(client, tas2764); @@ -752,7 +788,8 @@ MODULE_DEVICE_TABLE(i2c, tas2764_i2c_id); #if defined(CONFIG_OF) static const struct of_device_id tas2764_of_match[] = { - { .compatible = "ti,tas2764" }, + { .compatible = "ti,tas2764", .data = (void *)DEVID_TAS2764 }, + { .compatible = "ti,sn012776", .data = (void *)DEVID_SN012776 }, {}, }; MODULE_DEVICE_TABLE(of, tas2764_of_match); diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h index 9490f2686e38919a726e649884d9b6ad761493a2..69c0f91cb423986f7f0ded0b2160927f024d957d 100644 --- a/sound/soc/codecs/tas2764.h +++ b/sound/soc/codecs/tas2764.h @@ -29,6 +29,7 @@ #define TAS2764_PWR_CTRL_ACTIVE 0x0 #define TAS2764_PWR_CTRL_MUTE BIT(0) #define TAS2764_PWR_CTRL_SHUTDOWN BIT(1) +#define TAS2764_PWR_CTRL_BOP_SRC BIT(7) #define TAS2764_VSENSE_POWER_EN 3 #define TAS2764_ISENSE_POWER_EN 4 @@ -116,4 +117,6 @@ #define TAS2764_INT_CLK_CFG TAS2764_REG(0x0, 0x5c) #define TAS2764_INT_CLK_CFG_IRQZ_CLR BIT(2) +#define TAS2764_BOP_CFG0 TAS2764_REG(0X0, 0x1d) + #endif /* __TAS2764__ */ From patchwork Thu Feb 27 12:07:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994284 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 0104C22F145; Thu, 27 Feb 2025 12:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658165; cv=none; b=HttmhrqmGg8vdCESKNYhpQN1F8mQWkC8B5gaplli4d3MxWnrzjv+UeMeEVPtD0FOmIrn7pCfaaPVh7GKEM1+xNue0AdetFxPGzjkMmeB0MuG5eAqCAUUQmbnP3fw+C1ffWQOTt2hjqhz3QzS73XKULRYF5S6iZthDCICgkTfeX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658165; c=relaxed/simple; bh=Io6kDR2zBBh3aBpK4VSy+F5NUnkYFLQhjOt7NCyhIZ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UbHy41SZXdtBNW1xden2l2+bAuV6NsqfAema3oAJMn+sHzAJxnxZYASVEFOtsC0TUsVwsPyehy4DjsHxWIz2QSL3GjG9WGA2IbAbQOw9WsmO2wTmVnH1cIX33jiYXOByoFKc1Xa6+bPvBD3GuRspC22sYZsJEVeLPS3JyD7J46Q= 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=aGtFlery; arc=none smtp.client-ip=209.85.214.175 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="aGtFlery" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2234bec7192so20837555ad.2; Thu, 27 Feb 2025 04:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658163; x=1741262963; 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=dzpCBkvNFe+4cxCFesd8njDke2bm077RZxzjdl44kWk=; b=aGtFlery3pTEQm8VqULwCArnWJt7O8GOUNE2dF3tVoQAkZ5+knMVCYIQmXYLHsXWua AQqYsaFPTjT07OcraBQl+eotdM1GY+y/Sv4iml/BdjsUTAD5USa3O3U1lg1rTZJ7Tg8O S/JOR+SxaA4IsHCQ315kNt9eRQ7OsUb11vlQHCfdG1XgwkbEkobJNCqRUsu8HQqtDEhN exOJtpaV+iic4Vtk415uX1brNR+ndFKZ9XeYk+pZWO3TeU2JlB6PT/ZVlQfgKqeRx+mP P6usJkDDwfwfXB+2/4UOMGf0wjAiJd/BEIW+nefngV7ojUlcjNKsVteh8knUlMQtiYKQ xpzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658163; x=1741262963; 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=dzpCBkvNFe+4cxCFesd8njDke2bm077RZxzjdl44kWk=; b=KL9mGIVSmhLex3gXUEvhO58ITuXljN4T4IGTJ2wsEqQUN0i6aBPbXl/6o1KMHC7++z o+UZDtKpViCPlZ8zVKa3CsmbgGkC/JmTesXRhU8aWDfDfDDtCBYkMohdMlIT+PJKa4fj +WH5IDb0cI/3OwIYLIXlONNVRDrnUz7CfUKAVDaPFxPOU17vxNsYtmEPSWL3t+gnOVcX yTvAleRg4nx64ZDTtMQig/Aq4Bx0cwaf4w9YfrFoApenvEIXMFI88asti0rFGCK0saDn rgjhYuWstz6+Z30PgxM/DcKABId2W6ak8TDjcE857/iX1RBUbF4VatB17qIDkBM3kS50 HVEw== X-Forwarded-Encrypted: i=1; AJvYcCV8Zk5Xi/UyJkIn0jxv5XtVtnqp5VVFq/9sriVGfPyxx6crTJFm26gqXiSSuumrQQbL+t4LEJS4IvGBwrY=@vger.kernel.org, AJvYcCVSp2wy9Dh4p2dHMHzBNWXXRTpaPJhlJBwfJ9wN9IvfWMGDPTG66q7GR2VJk3JOpeXt+b86ZrO6FptaoJw=@vger.kernel.org, AJvYcCVrlipuJBHQ/YQ5ItlOm/A9I+dnzvqyMpc4lJM/bRRjvXh+/Liih3fQ4HfOGBGAYK9P870GyCmtfa0U@vger.kernel.org, AJvYcCXGB0KEtHGhrCerxkfxg9lRt280eeqAUjqQn6eh7jsuKB7YqjBNiD/fMpKA6N3R651tUkhbPNwksaBi5wz/@vger.kernel.org X-Gm-Message-State: AOJu0Yx57bOqq23ibKBW37YWK4a7DynNQu5UDeVAGbym0Inx9uJ1rn1N +VzmHJp/XYmmCA7Pw2l1gvHfRX3G4B54FTZg2SCF+hQwyBSCqwSI X-Gm-Gg: ASbGncusM9J8UvaQ1SogvLD5wlTvlTB5tr4uxsO2HgasNeWP7cec8gMJQskyhBye/8M fkzmaS/OEUSAt9nnYOImBpS1r5vYnlljyqzqegi3Mm86u5O1gVpDkrYeIcMw4ANDRSpwNUP279x s34syPsc8fYeegZpH7WRKWLdqHzG+WlJynb4kLK0IVNCbuValvVC/YxSP1Ug/01Y1FmZa8J8lhI 9Bs0Pwga0M9U4vNYavfHlYDr9Q+JXQjWc1vxDV/MjjO54UffZugX65punsJyRkeaNuyg36JyQRm 64y+K82/EBMWoMqsXVTACO5k7lJAumWhTfcA00Y2vQg8UKI1UPyeU40QOBH1CqdClHJ7QsGKAcV Qj3MKkW7x0EO4u7pSGktz X-Google-Smtp-Source: AGHT+IFmjn8gZmsAiVDDh0ytBwNsGDZKLbshMCoMfcZDZX53iA6NwZyLI9KPUoJ8hC8j1OBKRPgFng== X-Received: by 2002:a05:6a21:348b:b0:1ee:6d23:20ab with SMTP id adf61e73a8af0-1f10ad33426mr10797861637.10.1740658163129; Thu, 27 Feb 2025 04:09:23 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:09:22 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:31 +1000 Subject: [PATCH v3 04/20] ASoC: tas2764: Add control concerning overcurrent events Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-4-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2014; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=Edes/eOYgyHscimA5rczgRo/u/EfWQDXOVtLP4SmgoA=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk+eSplRlP06a+asbVk3RG4v45kS3HlD41piy4Ebv I/Ptl6Q7ihlYRDjYpAVU2TZ0CTkMduI7Wa/SOVemDmsTCBDGLg4BWAiM7IY/ify85+1OLTn+g61 jQ82TjrzaZNH0PSLXa2n89e6KNl35egxMryN8lyzreNViu5qp4aSt1GKu19OFN54eqtyg/Kyq5F HF7IAAA== X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer Add control to expose the option of autoretry behavior on overcurrent events in the codec. Reviewed-by: Neal Gompa Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764.c | 9 +++++++++ sound/soc/codecs/tas2764.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index d9b4f898789fa9b59c94c97e3b130950b88c3a76..08aa7ee34256896915f3ed6438b8b8827ce240c7 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -634,12 +634,21 @@ static SOC_ENUM_SINGLE_DECL( tas2764_hpf_enum, TAS2764_DC_BLK0, TAS2764_DC_BLK0_HPF_FREQ_PB_SHIFT, tas2764_hpf_texts); +static const char * const tas2764_oce_texts[] = { + "Disable", "Retry", +}; + +static SOC_ENUM_SINGLE_DECL( + tas2764_oce_enum, TAS2764_MISC_CFG1, + TAS2764_MISC_CFG1_OCE_RETRY_SHIFT, tas2764_oce_texts); + static const struct snd_kcontrol_new tas2764_snd_controls[] = { SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, TAS2764_DVC_MAX, 1, tas2764_playback_volume), SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 1, 0x14, 0, tas2764_digital_tlv), SOC_ENUM("HPF Corner Frequency", tas2764_hpf_enum), + SOC_ENUM("OCE Handling", tas2764_oce_enum), }; static const struct snd_soc_component_driver soc_component_driver_tas2764 = { diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h index 69c0f91cb423986f7f0ded0b2160927f024d957d..3251dc0106e07862dd69efd69fa0e40c3858ecb7 100644 --- a/sound/soc/codecs/tas2764.h +++ b/sound/soc/codecs/tas2764.h @@ -44,6 +44,10 @@ #define TAS2764_CHNL_0 TAS2764_REG(0X0, 0x03) +/* Miscellaneous */ +#define TAS2764_MISC_CFG1 TAS2764_REG(0x0, 0x06) +#define TAS2764_MISC_CFG1_OCE_RETRY_SHIFT 5 + /* TDM Configuration Reg0 */ #define TAS2764_TDM_CFG0 TAS2764_REG(0X0, 0x08) #define TAS2764_TDM_CFG0_SMP_MASK BIT(5) From patchwork Thu Feb 27 12:07:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994285 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 0640C22F145; Thu, 27 Feb 2025 12:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658173; cv=none; b=hSV/KvttDMrOs6Ew0nRp5BjfYgXB3sfgW3uZ0DroMUQUi7kk9bJZXgQHhN9410En4NdqJF462L7vUk78v7VTPu5jG5mROOGNQuVf5/dpsQW2bQtaP4xLt+Ox99k8QKrgTgCvn3D11hSIXIPGnV8EahhtkScMEPYNMr3Sck3sJuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658173; c=relaxed/simple; bh=y9R3gC4DcFYDFbAgeXOJCoKDJMqg1SlzEiGmhUycXwc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PCcjwzah84QuxPkG/IaEdqUb7RAR0I0Q+rrs2AXqGEE6GElkMTjG44MOGcuLErqK5KJKnW1P2rCmh+ub70o/n1vE4gu8RYX26n/7IgyjWIswtVD+zt4+OVCapW7i2CA8F1su0lLFSNiUy3sDbaZvw3ysskFpYWymRTb3kvYj+3k= 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=EU2fr45F; arc=none smtp.client-ip=209.85.214.181 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="EU2fr45F" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-22328dca22fso11797225ad.1; Thu, 27 Feb 2025 04:09:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658171; x=1741262971; 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=EeoXHbMNaZZnZxWSox36s26riivTYQEGCI8dhE09lK8=; b=EU2fr45Fgi4EMIGdRt5xgDGnbHBiIugqgpozhRMHgpnyerc1fvLB3DSkJuzq1k1aKK ZvAEOk6LZkCL+EiF6LivmclE59oQfRNwLph0OzXJUUvsKUmQZ8UljVCMYQL0mbrROpxy uuBRxu/DEyUjom9O1wxgV2/xuBdTs1WJeIOE7F0qS0Sl0vwjgs0XKP4gxmOUjY1WvNk6 6m9IIYTbnuhDwQkCsyCTkzohYnffrR6XEa4framViG5bwqgg8gjSWHUTLtg7iBgF/Y6P Xergo1hl48SA0dLh+Mpom4tYNDMGr39IhDWjjNVmh6GZS6C0sRc2hdtrH49SC6CYKJ1m bYhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658171; x=1741262971; 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=EeoXHbMNaZZnZxWSox36s26riivTYQEGCI8dhE09lK8=; b=dm53QJ3RgRjJwCTjFal/HphkvVIYsAn2jGtim3xbeyYP0mJJF0pGEVOLPjAr6bV96T Si99YImdRpdWK6pskXu86LMkngWl2cjnCBBqpEd3JVmvdAuD6Kd8VOsdnrepscTi+NYs WO+CdiuCoEG7GijhIdElYn+HZZzsjQ830EMRJ7CldjoosGvp0bNmvoiMqh6evQQcw1EB bg4t1Rh/dIr7D3xr8R9w9wupniT8EIorJ6wD+Vi62FPT+Sf1kjar4BZz0eJ+/vlg6TKq p+iRJAlm62qimZJD3CKYFSL7MOrpEEaCqciBazJKIaPWIA4dSsvIl489kNzwY3m+6Jo0 dDmA== X-Forwarded-Encrypted: i=1; AJvYcCU0GJBofJtTEMOXapNEjKBlSWv3K90jrYrbiRJi31hGD7yyPa7+OWVpmyILjO4kYtzqbD65t2JcaQg4Pu8=@vger.kernel.org, AJvYcCVpY63GFsVS47LPiv6mNU1HVPR1O5cIezMhSFteHT1ftCGMakVM0FTE97vA9XiF5KTwMwhXX8xc2hNJh4s=@vger.kernel.org, AJvYcCX+BaW8rFyUr42wNwrEXpQRJWZQd3caBA7pFBUKTCc0yidfGtbRiC2R78y1LBeHLU3NwHlNd/nrsmhk@vger.kernel.org, AJvYcCXJvGp0oG4lYtMBvIzcxy2lEmoLkgBY1nKVZLDOPUG74rt5tJJGawIMOhU0SLN36NZoJMf7k2CcyTdqltX9@vger.kernel.org X-Gm-Message-State: AOJu0Ywn5XE2d63y0j0U05JHcXM3Wnv4Fqe1w6dHdzcMZRnYPE8uUwZc hywXfRDcdS3cR0wbhPAIGVbNN1yw9rh2VxsRISi/jHgUTGdxC2+m X-Gm-Gg: ASbGncttLv0S7X11TWr1BvOD/d4Njf2jJQbrmHLbxTYgt4dXjEB2NfNQ+626YqyH4Cb kPj2fd6Fq4sPfki1CJTNwTieI1T62n1yfB3eiOfZlXBeljtfXfyGY5VWqvb4weFvi52iEV+s7i2 dCfw4GlSJwZITSVC5qI6NPseR6ixw0TohV9zANr60VPFL2x+Jtt+ivopiBsIYOP00lDN1uGwLrh Co4SRUQdRZP/4fihimplZZcDdnjNoHvVm0Tp6Nf2MuY+Bi+kjZP7Mki7649gx9QYmaeIlzsXtMb dzuRyU8GKLPixEMGfj6JaFDmuZm0ll9fcu6VdJJt7NTNuWgHCRd0GoZ/5RzyviJLND1iy8+lSGj bE2jcvZ16xKhojgyICF4T X-Google-Smtp-Source: AGHT+IGQyu6iPi0iwFfK9ojHPFOpbCezULBKbxEBCo5/jEYx233lkSxpnDwz+L55Flf/FLjGS3vkww== X-Received: by 2002:a05:6a20:840d:b0:1ee:c631:6057 with SMTP id adf61e73a8af0-1f0fc78fac2mr22023526637.34.1740658171206; Thu, 27 Feb 2025 04:09:31 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:09:30 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:32 +1000 Subject: [PATCH v3 05/20] ASoC: tas2770: Factor out set_ivsense_slots Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-5-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2333; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=2q7/AnA+S3zg5UY6950rlfHRPwEmvXdr4IHaVW0DiDY=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk9GbI52PlW/wYJpQ1Kqw3N9Q3uzmV4qBWX3j2Uxr jaufnO9o5SFQYyLQVZMkWVDk5DHbCO2m/0ilXth5rAygQxh4OIUgIlEfGZk+HHQ8qHWhOWFF6pe X03j3udy/d1byenfb6ptFj+Z0SO+dzkjw+HgpvtlrD+EUi0n+vw8vS98Sf26y0GJjsl3V3OsWL9 0LwsA X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer Add a new explicit function for the setting of I/V sense TDM slots. Reviewed-by: Neal Gompa Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2770.c | 40 +++++++++++++++++-------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index 863c3f672ba98dd74a5ba1b15d650a90f91176a1..4a86fcec0c1ecab45b9ebcdfc90c78f3290c6fa6 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -189,6 +189,31 @@ static int tas2770_mute(struct snd_soc_dai *dai, int mute, int direction) return tas2770_update_pwr_ctrl(tas2770); } +static int tas2770_set_ivsense_transmit(struct tas2770_priv *tas2770, + int i_slot, int v_slot) +{ + struct snd_soc_component *component = tas2770->component; + int ret; + + ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG5, + TAS2770_TDM_CFG_REG5_VSNS_MASK | + TAS2770_TDM_CFG_REG5_50_MASK, + TAS2770_TDM_CFG_REG5_VSNS_ENABLE | + v_slot); + if (ret < 0) + return ret; + + ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG6, + TAS2770_TDM_CFG_REG6_ISNS_MASK | + TAS2770_TDM_CFG_REG6_50_MASK, + TAS2770_TDM_CFG_REG6_ISNS_ENABLE | + i_slot); + if (ret < 0) + return ret; + + return 0; +} + static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth) { int ret; @@ -221,19 +246,8 @@ static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth) if (ret < 0) return ret; - ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG5, - TAS2770_TDM_CFG_REG5_VSNS_MASK | - TAS2770_TDM_CFG_REG5_50_MASK, - TAS2770_TDM_CFG_REG5_VSNS_ENABLE | - tas2770->v_sense_slot); - if (ret < 0) - return ret; - - ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG6, - TAS2770_TDM_CFG_REG6_ISNS_MASK | - TAS2770_TDM_CFG_REG6_50_MASK, - TAS2770_TDM_CFG_REG6_ISNS_ENABLE | - tas2770->i_sense_slot); + ret = tas2770_set_ivsense_transmit(tas2770, tas2770->i_sense_slot, + tas2770->v_sense_slot); if (ret < 0) return ret; From patchwork Thu Feb 27 12:07:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994286 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 AA83622F145; Thu, 27 Feb 2025 12:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658181; cv=none; b=eFCpKkugUouPCHFJgdSya/ka1DHpLKxelYkRdqCvt3f0dlkMEOlNzIjU0RrTciNvk6gajxEcJJxpiM98pfD77m0lWYsziBBLfogB10KWnnJkUsVufZ4oz3UpyuV85cOFkpNQRDgzVMEYO+MhDxCTs4fyh3y93c1qU8ywWnUGaWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658181; c=relaxed/simple; bh=kXVqm3Bcan36F2GLj/Gjs15SCdXWtkLPAjRDAFl/lgw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IhBdQ7wg/WHyiBiEZJ/NAFjA2fSjRj6OnS/kH2WQntdbSgXmdI33aXQLKNajDNGBtqbe1o+H4187sHsMKyyaG0p97TVhAVMQNz2pZj96ZZAQhOq3lueb0p2LzibDE3Cs4qjmz+poMIpr6qC16TnzuWrA3rhjVv62EPlLjVjjpSc= 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=e1ufvRbV; arc=none smtp.client-ip=209.85.214.171 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="e1ufvRbV" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2234bec7192so20843865ad.2; Thu, 27 Feb 2025 04:09:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658179; x=1741262979; 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=HAEDHeJBFJU8F7o0MW5ekN1Mf8cimeNpcsWtMaG5SxA=; b=e1ufvRbVmnelsv/r6/5vcIFk3r2J69ZwsGJbVqQqZ0BI85UsX0LM5CoyrP3xpjft2z IlOWbuPjDlzpkX/qvOgCcSFUsd58HEPDsYyM4OvDv7NXmpQqxd8WuERdz+zvTyE7MuaS E/aLwZyYba6HWDvb4vloQacqFAlKKptGgAgv5vM+aiB+rQYyIeWWUTqtKKBfqkzpNdpf zEOtLPM63rmDHg7hdWf8zqP6kI69GkVnBTL3e9yH+mGoN+ylTXNEJgfplCPUZMEaKaFW 2L+TUej8ueIDBNloumwaPrtnz8l0vRS4KwIpadUSN5urZ1AxOT2U08N/EwnABCsfNXl8 ozHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658179; x=1741262979; 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=HAEDHeJBFJU8F7o0MW5ekN1Mf8cimeNpcsWtMaG5SxA=; b=M3L1lx71GsPBFvEklbpTzsog+2LPYqOyisDK8ZZ3A6MrbQq/cStaeYmRswXIJ6gNgA 1ZIpUQOt8AyJX3NsmYgAr1BsWvzuSObkLRV/u8FvMnTu5In7UvYlo9b/SJvEp+COvarC FiNV9GAtZoExPDKNP1cqt7aOccH8vQNP9WzfhMkez3xAaD+mNdBnr6hDt+qz7bZo4W8m o2r53/fNO13MJ15W4D+D4esok4Y/SRcrVZVZvPEEYNsgfc4tB2bqcgBlmnVD+Q0YzP67 HVtXEKrxrNeN4ZskdeTbVbHgVdSNyVbMI7KHN1lOItrX2+YK6eNPI4uNkdVHg8DQnor3 k3Rg== X-Forwarded-Encrypted: i=1; AJvYcCUACQv/95EkSFMGYhh8VCznfaXIBPHgDr9ypfAcAV9YSPmzfYMMu4/Ou6tc5SJrpbQ6FnPg/hW2VP39/AU=@vger.kernel.org, AJvYcCUVlCTWC/vNIR7g6PzjXcjTy7OwTE04NK6Tkb22yk8QREvpFzMuNCc6iRAKHmrng9Mh54Lj9nnkc8SjDd4=@vger.kernel.org, AJvYcCWgkPbfDCWR8e2TLygIOi27svc0SOmlLt3JcG534I0GOo7UxiaAhrIeeKr5Otldkz5vjTowjbb/uYvEcZ5K@vger.kernel.org, AJvYcCXdr3dL3giOyxqD/hcB8T7yChOUzO3bIaaPphqTN4nJKuhR7tEN4ysdCYrSOQuG/DYlScDl28g87A6P@vger.kernel.org X-Gm-Message-State: AOJu0YyFbDE6URW6W3xv1uzzqvjpsc6Bqkow45VldyZ3JrEkgc/mMEPN CeBRCVPkpgU/WTToD02qVWZau3MXRVUn/7lXDQ/Bg2LPmGJcBfkg X-Gm-Gg: ASbGncukQFt66N9EMBSnXadx59tF4POHbJT9b9evLifzX9cREy338w0uwzYli+CQS2L NTJKuFMYwcsI2FRFq/vjIKdWfNVE793cqzVITOr1u+PmC/RSTgQZI/b3KdcElPR8xyeQfVQCFiA u1/Q+gcFvX+4RIvDyqsVSEboaYBx1VWMHg+/ekLBXSu1kGhhYfH7XXwj/vaBPH5y4cMfZ54y6RR tzrfLqXzDrZXHAnt0pYdrs46G77KQP5L3NoAlCPzmXiwXXFuV0yO95bTRFlZ4JjUuh/A1YON/d9 agJT4uNSaPO8eC8JiUb97sMP8Znm+PfxcYRkwuSvgm6e5FjktK13Hkw/QZfn+4WDkDLdx7lhKRe MUmhXfFcm+gUHH0RDss91 X-Google-Smtp-Source: AGHT+IFM2zqHEqQGdZD7CbNcSfwL1TPV/fIjrKD3F2p8of5kiMnTk4BKW+CwUOw2ypL6ib1URem66w== X-Received: by 2002:a05:6a21:e8e:b0:1ee:c89e:1db1 with SMTP id adf61e73a8af0-1f10ad7ed2emr12060212637.25.1740658179086; Thu, 27 Feb 2025 04:09:39 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:09:38 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:33 +1000 Subject: [PATCH v3 06/20] ASoC: tas2770: Fix and redo I/V sense TDM slot setting logic Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-6-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3887; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=9oD673IPZ5uFrCCPftVCE6wRdPUQVoC5LK9O/3Xdq78=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk9uZXY99WTvjf2ejjEHfHtKjj6XMdx5T7PB48EzG c6LcZM2dpSyMIhxMciKKbJsaBLymG3EdrNfpHIvzBxWJpAhDFycAjCRB3wM/0uS+y9XP/v1/fy7 be8dL8U2Cl7p5whouBG17NWB7uu1bd8Z/opE6f/a5Pb+evi8/knXb/96sj5r2jefxX6RYsE3jvQ dN2YHAA== X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer The former code sets the V slot from inside set_bitwidth according to the bitwidth of the PCM format. That's wrong, since: * It overrides the V slot parsed from DT binding. * The V slot is set shifted behind the I slot by the length of the PCM bitwidth, but the PCM bitwidth has no assured relation to the TDM slot width. Replace the former logic by setting up the I/V sense transmission only in case of both I/V slots being specified in devicetree, and never override those values. In case the slots are left unspecified, disable the transmission completely. There's an improbable case someone is relying on the old behavior, but if so, that's a setup that only works by accident, and cannot be sanely supported going forward. There's no indication anyone is consuming the I/V sense data up to today, so break the former behavior. Reviewed-by: Neal Gompa Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2770.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index 4a86fcec0c1ecab45b9ebcdfc90c78f3290c6fa6..7f219df8be7046912bf3ef452f75c17b5118bcf6 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -224,19 +224,16 @@ static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth) ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2, TAS2770_TDM_CFG_REG2_RXW_MASK, TAS2770_TDM_CFG_REG2_RXW_16BITS); - tas2770->v_sense_slot = tas2770->i_sense_slot + 2; break; case SNDRV_PCM_FORMAT_S24_LE: ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2, TAS2770_TDM_CFG_REG2_RXW_MASK, TAS2770_TDM_CFG_REG2_RXW_24BITS); - tas2770->v_sense_slot = tas2770->i_sense_slot + 4; break; case SNDRV_PCM_FORMAT_S32_LE: ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2, TAS2770_TDM_CFG_REG2_RXW_MASK, TAS2770_TDM_CFG_REG2_RXW_32BITS); - tas2770->v_sense_slot = tas2770->i_sense_slot + 4; break; default: @@ -246,11 +243,6 @@ static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth) if (ret < 0) return ret; - ret = tas2770_set_ivsense_transmit(tas2770, tas2770->i_sense_slot, - tas2770->v_sense_slot); - if (ret < 0) - return ret; - return 0; } @@ -505,6 +497,7 @@ static int tas2770_codec_probe(struct snd_soc_component *component) { struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component); + int ret; tas2770->component = component; @@ -516,6 +509,14 @@ static int tas2770_codec_probe(struct snd_soc_component *component) tas2770_reset(tas2770); regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); + if (tas2770->i_sense_slot != -1 && tas2770->v_sense_slot != -1) { + ret = tas2770_set_ivsense_transmit(tas2770, tas2770->i_sense_slot, + tas2770->v_sense_slot); + + if (ret < 0) + return ret; + } + return 0; } @@ -643,7 +644,7 @@ static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770) dev_info(tas2770->dev, "Property %s is missing setting default slot\n", "ti,imon-slot-no"); - tas2770->i_sense_slot = 0; + tas2770->i_sense_slot = -1; } rc = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", @@ -652,7 +653,7 @@ static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770) dev_info(tas2770->dev, "Property %s is missing setting default slot\n", "ti,vmon-slot-no"); - tas2770->v_sense_slot = 2; + tas2770->v_sense_slot = -1; } tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); From patchwork Thu Feb 27 12:07:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994287 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 9CF8E22FAF4; Thu, 27 Feb 2025 12:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658189; cv=none; b=cVJlUSuHTNRi+zlJcUrP2KFEEjCsc6eMt29+mFnl+Xy+CJNnWbnqlpUZl1a5BMOfTKrEZ1m98HuQlRnURa6317TWZRTcnkq68ddrdpxrz9dsFaXIdJua9OtKAYGAv8O1pu8gXTXHBMATiuLgwnwCpHB39NMfb94vTejoj7hfhTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658189; c=relaxed/simple; bh=C3fMl/nUTH2R9yPVtlYR97ew00Bt5b1HFMDjMdULqBo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PS6fcx6EBmXy93ROMuFOPoxqhBDYZagv0GnMbXDLMZwj1/tSx3c+8DU3o/A/je3lu4dmO4gL8FKRKcowSyOrMJclcSyyqg27e4PKy1Cb3As9WS1L/TUPv31QDyZZTDiDYTLr0BnOUps5UFV0vnoefRHzWxuotlClVMX01Mrfbmc= 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=QGzZc/xm; arc=none smtp.client-ip=209.85.214.181 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="QGzZc/xm" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-22334203781so26113395ad.0; Thu, 27 Feb 2025 04:09:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658187; x=1741262987; 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=xLr65VWy9RLy1Sl5qrWRNMygIqDSaNHv3m0GyUnsMQE=; b=QGzZc/xmOXVsNiEYBxu3KMQg078hfowWnceVBGGjypRdj0z/EJIPPJgbMWqTpd5q5o hZpsswfLoj8VvqUpgWH8ORmecj7Ah8j0zcMMWNBohVxbK2zhVW3BNeYkQNhKXf3Diy1G qALpvIMlDnkdWManhvgKE+XKuY/dLlRDzl3ojgRNuQIBSpYc3euAw4vwnCMqVA60WoCz 4Fki5NdqFvPzmUudQ6ESnkbrZ9ajmwb1A5d0h9Nw8LosiVus4H+ttcokUwEfTLDE8qoE +R/VV61g6wWOj4xBEs1O21HFFr6zCvF7EakXYkNY+Xkf7QdjG+bgob2PA+TqvWy0msqs Q7OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658187; x=1741262987; 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=xLr65VWy9RLy1Sl5qrWRNMygIqDSaNHv3m0GyUnsMQE=; b=EiZ61iXSfurrBqtdpJkR30wa6rc9HAcM/PvpW4pQYpkMNkyKD+Qf+XWTCj1pXFSABS EcHsIX4JttOioNAdIB14s2G09z3L7bCm9BWoNY1TDDzCbHc/w5Cvk1mvLxRkyEynLHAQ KnKbhQXlzM3/+zXal1zBiWEAkAao5Qx7Vs5n0iRTsx9bwPbRRdi0A7UofbBWo1v8EQTg vDMtE6+yCxb1G7Z3CMdYVQwjhczGYp9oW1dl9y0M1khGl/uwrOmqUpKt4puf1+d6JKwX fglYqa7UaoqaTg0LUrYlfIQPVp85HmnPUAJ+IRP/jrkurCc7sYVpBKS0uQXviJVCLG2J 867A== X-Forwarded-Encrypted: i=1; AJvYcCV64KtT18H38C1vuZAN6yZT+K3zqMM/E96QzMnWYvC7tDYfgbX5JZjHm5y8R74OapLYQUP5cdpQZ2X0@vger.kernel.org, AJvYcCX0egFZBEn6yZWBnzyeMsh1x1fTXNT61dWGIWAaWOsy31pyD8Eqd4mQUwMcOE4av4FFJKdOtuQEsI4elWs=@vger.kernel.org, AJvYcCX6bGx/rz5UGwFifOsQFueLJvv/bT9iNNe1nQEtKuoewpdKfYZeWUtRCmYhcPNtXeUWZgd+p0bYwnPblwY=@vger.kernel.org, AJvYcCXMB/lVqzYgBdBuPxuuuP+SMpr9YqRDGf1RLZlpSZK/XiZMItLOXLbVFHWssy/VCjp39gIXVeSau6A3ANDn@vger.kernel.org X-Gm-Message-State: AOJu0YxAan9aTOv6iadNpk7u4LLA8g7tZuKFyXBQx119ZcpTNL7yHVBj RVVwqM3GB4eVzR5yfXPvF5NwABNf0YnHrM1e6zfh29u5FGCqJGsj X-Gm-Gg: ASbGncuN/GKDazmGFzb0xvW6PEtNW5SEb/qGw6lBRafzLcHP7DgrCyRXTDG3rvFPJ82 3GGwwh+n4o9dlUMyvaRF7jj2dcYxgKjsZpNFxlW9yU/H0gpnIfSy5jV9A/eFVJF6w2Ky+G3C04E oguiatMXFZgT17uKUbP42Kf+kjCJnN9AgiU8ImfWl4W56VWI9IWv3eW8O009RKqbAyC03eruxjV U2pt+7AC23TRD2x7Ookk8UVzHgHUHuOoB6QnXpjG5e7fHfkkvk34Dge51guGgURckC5b2zVlilx nOwGZP3fIEScyPGU/7cu8/aNBVlT1Zx012BehmT9/ZnSFHtVHrvFWa/kZslSzXjgzWmZRGeMG44 JqTDme3O5plz/D4DC8A34 X-Google-Smtp-Source: AGHT+IFmC+LEvCK0DwNMDPIsYIpYRsaLbfyC+/trnMSlEmS0nxupiwJxRNOdosgj8DYEi0BBxHaIZQ== X-Received: by 2002:a05:6a20:914f:b0:1f0:e2d0:fb65 with SMTP id adf61e73a8af0-1f2e384f548mr5422538637.2.1740658186937; Thu, 27 Feb 2025 04:09:46 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:09:46 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:34 +1000 Subject: [PATCH v3 07/20] ASoC: tas2764: Reinit cache on part reset Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-7-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1447; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=1qRmdyEVykh3CldMGQqX5bd/Ea4U2G0jI3+vaQLHohk=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk+yS0S/WvaH8+BjfTeJCfkCNdwTm3TWz9qk2vO08 rOtg/+rjlIWBjEuBlkxRZYNTUIes43YbvaLVO6FmcPKBDKEgYtTACbC+5Thf9zHj4/fC5TM5/C4 HOHh/OGq7UWzWwlHVumvfvT6w6GrUu8Y/ocYHZhx7rRB/NS3XbcnLO5ffCZzfi1Ll3XAPyvzX1V /3TkB X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer When the part is reset in component_probe, do not forget to reinit the regcache, otherwise the cache can get out of sync with the part's actual state. This fix is similar to commit 0a0342ede303 ("ASoC: tas2770: Reinit regcache on reset") which concerned the tas2770 driver. Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Reviewed-by: Neal Gompa Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 08aa7ee34256896915f3ed6438b8b8827ce240c7..49b73b74b2d9dd6d09747cabc2b00519c549775d 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -546,6 +546,8 @@ static uint8_t sn012776_bop_presets[] = { 0x06, 0x3e, 0x37, 0x30, 0xff, 0xe6 }; +static const struct regmap_config tas2764_i2c_regmap; + static int tas2764_codec_probe(struct snd_soc_component *component) { struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); @@ -559,6 +561,7 @@ static int tas2764_codec_probe(struct snd_soc_component *component) } tas2764_reset(tas2764); + regmap_reinit_cache(tas2764->regmap, &tas2764_i2c_regmap); if (tas2764->irq) { ret = snd_soc_component_write(tas2764->component, TAS2764_INT_MASK0, 0xff); From patchwork Thu Feb 27 12:07:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994288 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 0BA5922FE02; Thu, 27 Feb 2025 12:09:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658196; cv=none; b=gN+805SE2ok65kHlshFngtYFgEk3sSxbQ1oocJLRoEbI/4/je2YC+LgNnBuBtdfoDtbJQKs4uCzoge6ouUOWvOSzvGUxJC9nALunX5NsKNg0eLTVb3XORYvK9RMVJISmehzl32P/aNc26w21cUeM/Wh+uwbL/b7vX1uzlkEBFEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658196; c=relaxed/simple; bh=HT+SDIfQlIRms8FxF8pg1Dd1jnfWIMjWKWXnYtBy3qs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ICHhVqrdhP5+nhtDsCvO9srq+4s4eLV8oBB5e+2zYxb8UCqJw8+upoxk2Zij3WYfl2+RHgxup8JdaJ5IDVMwjOY0jTvJDXS4HE8mTe3PzvDuCxVs/huTEvd1VnZWF/5uh7IiIRP0a9ybJqFNFuMm9UNaLR/2IAAQrEzdU3qNeB4= 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=CagpZrqH; arc=none smtp.client-ip=209.85.214.177 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="CagpZrqH" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-22185cddbffso33991755ad.1; Thu, 27 Feb 2025 04:09:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658194; x=1741262994; 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=0GY7dlVupIydN6arxqzciNDGAGAOkBdBUMtuBEAPCp4=; b=CagpZrqHA4XYYzAho2K/Bpwuw+bNhGjaSlobOTdgCZbknB+cT/f0FZd/Rz5OZPBMxA +jBODvaAeSm5TE9sYjwOcpV8SgU3xJHNwT/lSeSHUb1g41XmiC8r5f5A+wrmvULzaE84 xxLZR9lTkVsj59zF0ToYZTzJFm/igk294VeXPGAcpzr+qkDUxLYCFz/sGgblhJyFMZ7H IR1ywuWWdXFt8TcXe3AI3YWAQ1YWhOLOSUhUpn97fU2qf5LitlRuU7w44XANUqdN9SPU C+99Es4A19IVOL1dhEPMK6brsm+miKAQEynO89dWNP6POkxjGfh7OxuczczAXqHW5n3U /seA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658194; x=1741262994; 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=0GY7dlVupIydN6arxqzciNDGAGAOkBdBUMtuBEAPCp4=; b=aqNfKgGos5zujCtUDWM9zXMAp+jsYOskMd0i/h7J/sTBscDxKxQEAfCcadTRAUFr9H /D7l7PuN6QLMIVDH1KLaDHI8PIF5aP5OVoLRV5J4TEFqVZYN9vPUYu7ieWz4FuOHstow LXwkoTgudh92g9gTeg15DHYnUYQmeNDyKM4uc1mY6BA+b7MNDzFvtIOZYz5yQuiTqV4n N6tH8OA4eO7uKWkgHdN6/pR5SrGuk631xj6O+n0qMw/wVsIYskDSJK4JJhULZLqNRYJf xkZV0JQEC0XQR7YedocprDE5Puqm54FmQbC38mw/U6XxqCyf2rKpEl9JmU9L2JiRiEBn USZA== X-Forwarded-Encrypted: i=1; AJvYcCV0qYQLyjO0WIZVlVAsJkj2qRvl52N+fz/ZSClbbf4SraC9t/geFJKxEP9VjgJH55wdzNeeFuBAD2Xn@vger.kernel.org, AJvYcCWvO/dsNK4iVQ3nyCOJXAOtfVxNta9CCx4rMDGe0EHbrRZpEnmxgpueYNjctrkuRxodoJW8NAAgorY3RKVu@vger.kernel.org, AJvYcCXDVrKoYcDbaPPCi4XkSp/KaC5crYkd9fHoSGdDSZSaKAkFxpZPuCGdN3lqxQrEwDhnjFV7aeOv7Xk4r4Y=@vger.kernel.org, AJvYcCXTIBRBUDPnwQR/Tai5ENLGS+VLQTXBg8+d9TJ7Ur+ng//S1GUfO5+V53jWIVERMSpkZA+TKhw/PMXmM+M=@vger.kernel.org X-Gm-Message-State: AOJu0YwH31Jyfva8YIreKoZMQlTah8aslhFlQ9DcljVmwnjUozNDtfLb xK0vLKrSNfSDjuHOTT71oB2G+RbdK6LcZ1qzzJIseOwaz+t/EFQ5LDTtRjtJ X-Gm-Gg: ASbGncut+msn0/KV7qin7PkDeCWuhdYFc/8XkQQHmA/aV02SB3gh+cB1TrcPguVVR9+ lVoKMIN5FOJ7ABRCojQMPcobg5MBr7Tdtde0Lfr+r7A01K2I99u1FmKlYxisRXlL/Ka4YQxtiIj eItyN3yAaYouoV1mXpwLMCqwC8f93iYe7pxrmTWKkoTz/WPZaFX7tz6/Uw8HaECzI4wM0xQAOPj ay9Yau/XBy2CGxrrEna+Cv125B2G5CMPj2pRldbKMMp9wrjMWhSqQCXyP2u15DAKmSoKdWhkGvV nJeggp5NTXIUXhAJwkrKRcAxMyBW7JnH0xb3EDZy45mCBYbnbAaNosVdaB2hKJ8GSAj2lINFtk9 ea3OUMWNOsJ9ckL3Nc5nY X-Google-Smtp-Source: AGHT+IEFQRcfJpHWiQLgG25ggWIxdqRMPSAyoARJI+dYR0aKvDD/rhtwtZPwoj9aqVqXC7GAjuuXuw== X-Received: by 2002:a05:6a21:7899:b0:1ee:d664:17a4 with SMTP id adf61e73a8af0-1f2e389ceddmr4438228637.10.1740658194534; Thu, 27 Feb 2025 04:09:54 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:09:54 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:35 +1000 Subject: [PATCH v3 08/20] ASoC: dt-bindings: tas27xx: document ti,sdout-force-zero-mask property Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-8-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1199; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=HT+SDIfQlIRms8FxF8pg1Dd1jnfWIMjWKWXnYtBy3qs=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk9ZPbvoOmHlxuaJDZfX8Trd8DLc4Bz8IH46h9P5+ vvrY5/qdZSyMIhxMciKKbJsaBLymG3EdrNfpHIvzBxWJpAhDFycAjCR+k6G/zUTQotfiQo+yQvm 5Hi5Y1p4ILN396dUp9dLj5aWKDDfCWD4HzZhlsL1snrfNYtM+x++1dF5LymzNXnbw7QF6Wrrpjz axwQA X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 TAS2764 can be programmed to zero-fill/ignore certain TDM slots on a shared I2S bus. Since this is a per-chip setting that is a consequence of how it is implemented on a specific board, express this as a Devicetree property. Signed-off-by: James Calligeros --- .../bindings/sound/ti,tas27xx.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/ti,tas27xx.yaml b/Documentation/devicetree/bindings/sound/ti,tas27xx.yaml index fcaae848e78a1137e4d44f98258207bba68772b9..d65a278c92873b00bf357fb26b430386e7860e54 100644 --- a/Documentation/devicetree/bindings/sound/ti,tas27xx.yaml +++ b/Documentation/devicetree/bindings/sound/ti,tas27xx.yaml @@ -50,6 +50,10 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 description: TDM TX voltage sense time slot. + ti,sdout-force-zero-mask: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Mask of TDM slots to zero-fill on a shared I2S bus. + '#sound-dai-cells': # The codec has a single DAI, the #sound-dai-cells=<1>; case is left in for backward # compatibility but is deprecated. From patchwork Thu Feb 27 12:07:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994289 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 4FAB422F38B; Thu, 27 Feb 2025 12:10:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658204; cv=none; b=PPdzsQjff57MsLT4BFIgI1/R2AhssHOZWhI2F+iDQyGR7m2nilFJLRpEYTpKxMMdn/PIFPQvgr0JBUaCCGAOLIyD143ISdZOtQRRtbasWcbXo+jmukfPdMKpt48sgvYjYJLfnel9TATF5yq3wV//Ix1tah7gin/3Ptj0dGn3EGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658204; c=relaxed/simple; bh=VAlMGbLBKi4xU+F696Y6zd+wEM/gtuswNpD/DqJM1CA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VV1EOFq6aPy9TJpkaRMyK6mC2GEOGhCX54cNqlXejjoTWFsjyyiy7mRLbJm7FXTNlvWpGo3LtxDNTcNLKfjEZ1oKKQAD3s8IBBIsI5aUI5gaA2Jb1dOALf6uQfyCCME+PvADXtrQ/8tmJCuEV5yhdeDiqJdGM8d5BC6bUTBMRv8= 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=kHrKWDMH; arc=none smtp.client-ip=209.85.214.176 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="kHrKWDMH" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-22334203781so26117365ad.0; Thu, 27 Feb 2025 04:10:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658202; x=1741263002; 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=C5ry6J/NoVdSnpNYCNQjATClf2ygTLOYGGyh+loV86o=; b=kHrKWDMHY62MtyxPVRK7qd/MBML1tD5HNEZUaDN0lHk8BT6/72GVjBUsuON3knEFIb uDrAZaiQ+/+/q91w2uBWihbwZCL6C5vwers9NMmgfRv5FcsEblc+JN3TtYRT7hru/vCB A6h8xvlSuYP26SiLmKsfWPpKe6e6Z8I+FaXWPQuYMbxO9vINcdvcdkMWEomgUFBKRF3t xddNmDVyywew/VMflS9QYe5WR1DEpHU3oZ475G+T44xqcloDHI/Z1xdy+dak7HzqhoPf R6AlVHeCSzOz/lYnGShwLYQAnMlebRQ6HjghDjpgxytJJSVwM51FBJkIYhA0auvDajXz ikLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658202; x=1741263002; 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=C5ry6J/NoVdSnpNYCNQjATClf2ygTLOYGGyh+loV86o=; b=pCvHwRpg84HTn9hyh8Lwaz3fiVks9wlVGDA9E77rb7IGHUCCciR10TFGr7Lg9UW9Ll nIZUdrHa5MEMGyGvPixFIQv4RFaEAc7/NbOMduKMBxFEvap24E3T5ebwuVJ2Uer3MtH1 t+/RWEG6hWMJTBjutZPyu16euOwjyzo7l6suXvUeIR/zxshGjPzYk6nAD9GJH2CjsAB/ do4ZwAQ5W4EqtXUWGsp5eO9nQXAt/4gLEZvt+9IswGbiHcJQbQ3cR8y2IVMzKVMUtOQ9 uUJRcnlr721U8wAcqaRcXYURxo8wGD11cbHVhTRXCTLWps1HgYBykFxbQUujMojziri8 efVg== X-Forwarded-Encrypted: i=1; AJvYcCVHUFc5hBacay385PRwAJfTqTXIhssslaSgVzjJv8DiCZ6JTPmuRq3zkOQUFWZhBfPa9MXlPhyYXx0KDmg=@vger.kernel.org, AJvYcCVOsWXQtOxGJTdJc8Z/ul/vrwVz+yFd6v7tou1bvGyG2uHZAIbcfo9IXxInrhtc/wpHx64MPi666Ngr@vger.kernel.org, AJvYcCVoupGJhIDPxQWb4tD62py48InCRRkhtdGAPku7e9JtKOwBoGfSor5FyUuoVinu15sc+XsrY0vCoqRuXN8=@vger.kernel.org, AJvYcCVpLcpzkkmIv6ajDdrdNlIfDqEfPy1KE47sj6AweOGnY6c9hcCucVTXNCWYJZrYyWkiz6Z6CmKkrqYDBoOe@vger.kernel.org X-Gm-Message-State: AOJu0YxuDmTuqGRvlkEiF4EtYC08+GARHgB5rRrk+3zsYYqoKwxVRG+L mWTMj4307FrdR8KDHf//CsyHpj9pEutRitC96p7xaQxcoM32hfCo X-Gm-Gg: ASbGncs9QrR1jkvpg72UBkrXYy8qDtpQ3Ut/wnPS4vwwR7STL3E2C02ITbRPq7oggn5 1nrL3QLlXNHN0YVzSc8YfNdZWYQRjyoiyY44IvKjFVIcrN5CCuE2hfT+aVmKgMA+njrAZlRRYtH uT3iIW1NRLJ7i8oiuoIRnNN+sPd9Q3+1xtRf4Z9QK5qsB+knW8uF4AoD6Xn7GuH7whx3uPCeukp i6caVyi0uO9d1BZIDBSPMvsjDXLrFTPuk8BC4p6HUpQEqM1UyamL76mdp9BDxVCLiNzUsaa6tip 6XHLS+Z/dggeAk/Tddv2K3w/lgng3/gAMEU7KQ/Wf3zj75YNzqY7rDDfnSnSvGHiiEZkJXpandT 4z+H4iHCkwkbNATTTxssB X-Google-Smtp-Source: AGHT+IELA2MVEJT24EW2bxG3k6ZlSSpQ5TmMYRzmcOjW8RmSRjowq6jcIcch4pPSi6eG4EqbV3bfRg== X-Received: by 2002:a05:6a20:8402:b0:1ee:b5f4:b1d7 with SMTP id adf61e73a8af0-1f2e387ef46mr4574714637.7.1740658202396; Thu, 27 Feb 2025 04:10:02 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:10:02 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:36 +1000 Subject: [PATCH v3 09/20] ASoC: tas2764: Configure zeroing of SDOUT slots Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-9-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2998; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=tMEwKfdUcN1GIbtYuD0/lRExutgObIXbnosPkubAYYI=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk91JD2dOGkue/LVHa91VHiZt06qVls9aaqbZ73MP //+LZsjO0pZGMS4GGTFFFk2NAl5zDZiu9kvUrkXZg4rE8gQBi5OAZjI9hxGhua/CRt//fpdmu7u N/nek1tPplZciP4VuknN+dqShJW/Aw4w/LOxSu5c9p7jUVWk1azr3Zd/PM+f1ZDL83mD4Z+Uw5m 7pVkB X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer The codec has an option to zero out certain TDM slots on its SDOUT output according to a preconfigured mask (otherwise the output is, for the duration of unused slots, in a Hi-Z state). Since the programmed value is dependent on how the chip is implemented on a given board, configure this feature based on a mask read from the specific codec's Devicetree node. Reviewed-by: Neal Gompa Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764.c | 23 +++++++++++++++++++++++ sound/soc/codecs/tas2764.h | 11 +++++++++++ 2 files changed, 34 insertions(+) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 49b73b74b2d9dd6d09747cabc2b00519c549775d..f33ac89ffc598c39f3a7e0d620724098ca5bc3d3 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -40,6 +40,7 @@ struct tas2764_priv { int v_sense_slot; int i_sense_slot; + u32 sdout_zero_mask; bool dac_powered; bool unmuted; @@ -601,6 +602,23 @@ static int tas2764_codec_probe(struct snd_soc_component *component) if (ret < 0) return ret; + if (tas2764->sdout_zero_mask) { + for (i = 0; i < 4; i++) { + ret = snd_soc_component_write(component, TAS2764_SDOUT_HIZ_1 + i, + (tas2764->sdout_zero_mask >> (i * 8)) & 0xff); + + if (ret < 0) + return ret; + } + + ret = snd_soc_component_update_bits(component, TAS2764_SDOUT_HIZ_9, + TAS2764_SDOUT_HIZ_9_FORCE_0_EN, + TAS2764_SDOUT_HIZ_9_FORCE_0_EN); + + if (ret < 0) + return ret; + } + switch (tas2764->devid) { case DEVID_SN012776: ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, @@ -749,6 +767,11 @@ static int tas2764_parse_dt(struct device *dev, struct tas2764_priv *tas2764) if (ret) tas2764->v_sense_slot = 2; + ret = fwnode_property_read_u32(dev->fwnode, "ti,sdout-force-zero-mask", + &tas2764->sdout_zero_mask); + if (ret) + tas2764->sdout_zero_mask = 0; + return 0; } diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h index 3251dc0106e07862dd69efd69fa0e40c3858ecb7..4cf0f7f112d6c3002203fa32e900efd640ef3f22 100644 --- a/sound/soc/codecs/tas2764.h +++ b/sound/soc/codecs/tas2764.h @@ -123,4 +123,15 @@ #define TAS2764_BOP_CFG0 TAS2764_REG(0X0, 0x1d) +#define TAS2764_SDOUT_HIZ_1 TAS2764_REG(0x1, 0x3d) +#define TAS2764_SDOUT_HIZ_2 TAS2764_REG(0x1, 0x3e) +#define TAS2764_SDOUT_HIZ_3 TAS2764_REG(0x1, 0x3f) +#define TAS2764_SDOUT_HIZ_4 TAS2764_REG(0x1, 0x40) +#define TAS2764_SDOUT_HIZ_5 TAS2764_REG(0x1, 0x41) +#define TAS2764_SDOUT_HIZ_6 TAS2764_REG(0x1, 0x42) +#define TAS2764_SDOUT_HIZ_7 TAS2764_REG(0x1, 0x43) +#define TAS2764_SDOUT_HIZ_8 TAS2764_REG(0x1, 0x44) +#define TAS2764_SDOUT_HIZ_9 TAS2764_REG(0x1, 0x45) +#define TAS2764_SDOUT_HIZ_9_FORCE_0_EN BIT(7) + #endif /* __TAS2764__ */ From patchwork Thu Feb 27 12:07:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994290 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 5371D22FE02; Thu, 27 Feb 2025 12:10:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658214; cv=none; b=UaUT6MHyQL9WrfpWF20CbEC236hpu+HTqtxgBw1sGsS08a3D2kWGkKst9mOptEn9jUeHirTUMCx/i2JXRd6rScUVFJ6JMwS2OOjT7BBrfQJsflW8aM75CWB8SDBEdNftqP4PKqbzOTmR0WuI5C9z4r/7JC2r5FXpFx6+oOqzmHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658214; c=relaxed/simple; bh=78BNV0f9IzhfH/Dc6whrKtxYgFEU2FpYtAI/jNtQlE4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jzgec95PugPJybf5L+qXD8N4LvC0TWnB0RejLhL0cEwg+RQh/DkM1p+whmecbKF4CYVJ7OvKs9Y/D5rfLS73NYtySYGyp+3Ly681Pk/LdkKhtYO9ovfVoiVQ+kLiaaFwsjaeAeizG0llLykJoumHtW2VULBwZeYZxoEZmb0L18E= 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=Y90WqTOz; arc=none smtp.client-ip=209.85.214.178 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="Y90WqTOz" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-22128b7d587so14802735ad.3; Thu, 27 Feb 2025 04:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658210; x=1741263010; 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=ICXy0Q69y/l3myEFhe6ajODlrNN6CYKAQCNynbpj8d8=; b=Y90WqTOzuIHYCZfBYN87KmHt3QhwI0Y/nVB0Dykl0YpNusfoBxNw50kUZJhcEBN+Xd t6QlUcM6VuKm3L9A99+ayB1uHlXQCbkDoYFEyLT5QYY4IAHnVEFmqv09eh5aSI3GDyas R5eNLr0mEIPJ3UM7d/GSSsL2iSuj11OymZOM4Ttx0A/NXtfuedJDTjir53AMfDNDCJWH XDgwzLsrwJu32SxSqj5K4cQLFEmg0A9KMnFf/NDGLO7xqxbm2wNdKsvGm00LQILXaV8a Br2NeI0qpg0e1tF6RRDDEgBeUaB8C/f1kA8PA53D0/5cBlZzAbZ1+aIYAJ8vtKY9WJFq zL/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658210; x=1741263010; 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=ICXy0Q69y/l3myEFhe6ajODlrNN6CYKAQCNynbpj8d8=; b=r09nQIstNvEd56tZuUqQDTXVjuLg3E7XSu1NiOfbQB0mO/SDO3JD/sIWnLZKnjr9Su fbJVoKo11r6LhQIBvotYX1Mh3SUTV7JtUVlWL5vZImwdwvsLQXNLIqDyRkrc7KWNtLQ7 0MOW7BkssI7j75K1beM/gkyl58gQ+MkHb92jwRNF3dxZIPhoBwGS3P0kZXK0NBnbwS2C Zgby925Z8CuEMb2paBDtRYc9DT4tpCk2PhFfgKNG4LZritS4Ozra0Xw11NtCBt/JkNwQ Z+p9d/cyExkoK3Er/uhYmcsSR5hHC0Xg/njc60rVOUPEazMsuIzb2dd98pjbx1QsBbqA UDJA== X-Forwarded-Encrypted: i=1; AJvYcCV8SDdwBXG49Ve/v8raIlrYzjPGiZoMHCpvkRpe3+jvICS64gwUVo+Ema1CutcGzwx58y72ycvDTAw3@vger.kernel.org, AJvYcCWS3uHFuLGlfW0op3vHJI9ZjGYlRuykMC9WBuHlMqn5dVFXIBuAiojOnjrjiWELhE3ZshL89Jn8/T5DWRU=@vger.kernel.org, AJvYcCXkQCOUPZSSwOp3x5e3MF9WWjfUkwahJjr6VDYc/hHg31uP+PPEnoLuAMpgO984QInVjY1tht3z/8ZIH/c=@vger.kernel.org, AJvYcCXqNXf9lS3RMcOIRNCfJneYBF+oYo5l4nGZRnnsAyIcCJvta49d33iqbwqXSVM83vhHbAkwwOrXXie6gjaH@vger.kernel.org X-Gm-Message-State: AOJu0YzVRajLbpU6B0a8Yf30Vaq+FoxIY1kLl5wQXoTGG3C2+phyXWiu FdrnqGkdvvUtal3j4jdOhPpPenHmbh5cltKbGft0yLynHyidY5Kv X-Gm-Gg: ASbGncuSuK79lWEWD9oiR0ssSrW9sTXsj7rGOTIVpnLPZ7z1X8wTjCw95h/gy73tUwH Ad6wOTK8mqLV1P87fzBxdfdWjQC9SxCUD9gpJYE7X6FNyVACai/Fx7nyhMcAZdoK3m7Fi6RjClt KhEP8bjpLSjsX22/9NlEAePBH2Tqiy1JkaMeSz+latpBuDDP6GQ15njJo6/RxM6sRVVbplPvaBj wvVmY+d79DWugeOVT3GOVdHulRkF7Y2JZ6WOM07MDxf/IrfyrO4835tTJhjbc59hplEX1ITAcS/ p7m75A58EIMFdImKWd4FMiOBAoWClTRfDOGWk/1weN9GO9ZMiusAl3sC0/uliSAFBrm0lixoDeJ Y83HcAJs0rjxA+r3eVCd3 X-Google-Smtp-Source: AGHT+IE7Z4TG7vI2cULV+y/ZR7KpFzVeU0xvIMbKRX3PTbA3lPGbPZu1mJPNJgb7SKL8owgHdIKK6w== X-Received: by 2002:a05:6a20:7488:b0:1e1:a75a:c452 with SMTP id adf61e73a8af0-1f10ad33597mr12269606637.19.1740658210329; Thu, 27 Feb 2025 04:10:10 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:10:10 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:37 +1000 Subject: [PATCH v3 10/20] ASoC: tas2764: Apply Apple quirks Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-10-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=9009; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=bJ0MmPOyTgu2RgCg5PxNjdhOAIiVqXj/vIODjE8vMfU=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk/x3GLLO3FrY1PgvRu1Cw4KMTUfjHLY/UmyTn/bX lWXhX3TO0pZGMS4GGTFFFk2NAl5zDZiu9kvUrkXZg4rE8gQBi5OAZjIKl9GhlMvg1eIZK6bclS+ 49Munw5bcdHVLH8O6ugVdd+M99rK/5ThJ+P2klg9tUdKiSZTzVucrZ8lJnWIWfSr9QtpsHJYm2i yAAA= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer Apple's SN012776 driver has some peculiar aspects to its behavior that are suspected to work around issues in the codec part. Add a module parameter for enabling individual quirks that should be imitated after the Apple driver. Setting some of these by default seems to be required. For example, setting 0xf fixes an issue with transient overcurrent errors which can crash the chip until the next system reboot. To be safe, let's enable all of them by default. Reviewed-by: Neal Gompa Co-developed-by: Hector Martin Signed-off-by: Hector Martin Signed-off-by: Martin Povišer Co-developed-by: James Calligeros Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764-quirks.h | 180 +++++++++++++++++++++++++ sound/soc/codecs/tas2764.c | 39 ++++++ 2 files changed, 219 insertions(+) diff --git a/sound/soc/codecs/tas2764-quirks.h b/sound/soc/codecs/tas2764-quirks.h new file mode 100644 index 0000000000000000000000000000000000000000..7a62b3ba5b40b3f06fc1ebeb590d9c32b1b2c7d3 --- /dev/null +++ b/sound/soc/codecs/tas2764-quirks.h @@ -0,0 +1,180 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __TAS2764_QUIRKS__ +#define __TAS2764_QUIRKS__ + +#include + +#include "tas2764.h" + +/* Bitmask of enabled Apple quirks */ +#define ENABLED_APPLE_QUIRKS 0x3f + +/* + * Disable noise gate and flip down reserved bit in NS_CFG0 + */ +#define TAS2764_NOISE_GATE_DISABLE BIT(0) + +static const struct reg_sequence tas2764_noise_gate_dis_seq[] = { + REG_SEQ0(TAS2764_REG(0x0, 0x35), 0xb0) +}; + +/* + * CONV_VBAT_PVDD_MODE=1 + */ +#define TAS2764_CONV_VBAT_PVDD_MODE BIT(1) + +static const struct reg_sequence tas2764_conv_vbat_pvdd_mode_seq[] = { + REG_SEQ0(TAS2764_REG(0x0, 0x6b), 0x41) +}; + +/* + * Reset of DAC modulator when DSP is OFF + */ +#define TAS2764_DMOD_RST BIT(2) + +static const struct reg_sequence tas2764_dmod_rst_seq[] = { + REG_SEQ0(TAS2764_REG(0x0, 0x76), 0x0) +}; + +/* + * Unknown 0x133/0x137 writes (maybe TDM related) + */ +#define TAS2764_UNK_SEQ0 BIT(3) + +static const struct reg_sequence tas2764_unk_seq0[] = { + REG_SEQ0(TAS2764_REG(0x1, 0x33), 0x80), + REG_SEQ0(TAS2764_REG(0x1, 0x37), 0x3a), +}; + +/* + * Unknown 0x614 - 0x61f writes + */ +#define TAS2764_APPLE_UNK_SEQ1 BIT(4) + +static const struct reg_sequence tas2764_unk_seq1[] = { + REG_SEQ0(TAS2764_REG(0x6, 0x14), 0x0), + REG_SEQ0(TAS2764_REG(0x6, 0x15), 0x13), + REG_SEQ0(TAS2764_REG(0x6, 0x16), 0x52), + REG_SEQ0(TAS2764_REG(0x6, 0x17), 0x0), + REG_SEQ0(TAS2764_REG(0x6, 0x18), 0xe4), + REG_SEQ0(TAS2764_REG(0x6, 0x19), 0xc), + REG_SEQ0(TAS2764_REG(0x6, 0x16), 0xaa), + REG_SEQ0(TAS2764_REG(0x6, 0x1b), 0x0), + REG_SEQ0(TAS2764_REG(0x6, 0x1c), 0x12), + REG_SEQ0(TAS2764_REG(0x6, 0x1d), 0xa0), + REG_SEQ0(TAS2764_REG(0x6, 0x1e), 0xd8), + REG_SEQ0(TAS2764_REG(0x6, 0x1f), 0x0), +}; + +/* + * Unknown writes in the 0xfd page (with secondary paging inside) + */ +#define TAS2764_APPLE_UNK_SEQ2 BIT(5) + +static const struct reg_sequence tas2764_unk_seq2[] = { + REG_SEQ0(TAS2764_REG(0xfd, 0x0d), 0xd), + REG_SEQ0(TAS2764_REG(0xfd, 0x6c), 0x2), + REG_SEQ0(TAS2764_REG(0xfd, 0x6d), 0xf), + REG_SEQ0(TAS2764_REG(0xfd, 0x0d), 0x0), +}; + +/* + * Disable 'Thermal Threshold 1' + */ +#define TAS2764_THERMAL_TH1_DISABLE BIT(6) + +static const struct reg_sequence tas2764_thermal_th1_dis_seq[] = { + REG_SEQ0(TAS2764_REG(0x1, 0x47), 0x2), +}; + +/* + * Imitate Apple's shutdown dance + */ +#define TAS2764_SHUTDOWN_DANCE BIT(7) + +static const struct reg_sequence tas2764_shutdown_dance_init_seq[] = { + /* + * SDZ_MODE=01 (immediate) + * + * We want the shutdown to happen under the influence of + * the magic writes in the 0xfdXX region, so make sure + * the shutdown is immediate and there's no grace period + * followed by the codec part. + */ + REG_SEQ0(TAS2764_REG(0x0, 0x7), 0x60), +}; + +static const struct reg_sequence tas2764_pre_shutdown_seq[] = { + REG_SEQ0(TAS2764_REG(0xfd, 0x0d), 0xd), /* switch hidden page */ + REG_SEQ0(TAS2764_REG(0xfd, 0x64), 0x4), /* do write (unknown semantics) */ + REG_SEQ0(TAS2764_REG(0xfd, 0x0d), 0x0), /* switch hidden page back */ +}; + +static const struct reg_sequence tas2764_post_shutdown_seq[] = { + REG_SEQ0(TAS2764_REG(0xfd, 0x0d), 0xd), + REG_SEQ0(TAS2764_REG(0xfd, 0x64), 0x0), /* revert write from pre sequence */ + REG_SEQ0(TAS2764_REG(0xfd, 0x0d), 0x0), +}; + +static int tas2764_do_quirky_pwr_ctrl_change(struct tas2764_priv *tas2764, + unsigned int target) +{ + unsigned int curr; + int ret; + + curr = snd_soc_component_read_field(tas2764->component, + TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_MASK); + + if (target == curr) + return 0; + + /* Handle power state transition to shutdown */ + if (target == TAS2764_PWR_CTRL_SHUTDOWN && + (curr == TAS2764_PWR_CTRL_MUTE || curr == TAS2764_PWR_CTRL_ACTIVE)) { + ret = regmap_multi_reg_write(tas2764->regmap, tas2764_pre_shutdown_seq, + ARRAY_SIZE(tas2764_pre_shutdown_seq)); + if (!ret) + ret = snd_soc_component_update_bits(tas2764->component, + TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_MASK, + TAS2764_PWR_CTRL_SHUTDOWN); + if (!ret) + ret = regmap_multi_reg_write(tas2764->regmap, + tas2764_post_shutdown_seq, + ARRAY_SIZE(tas2764_post_shutdown_seq)); + } + + ret = snd_soc_component_update_bits(tas2764->component, TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_MASK, target); + + return ret; +} + +/* + * Via devicetree (TODO): + * - switch from spread spectrum to class-D switching + * - disable edge control + * - set BOP settings (the BOP config bits *and* BOP_SRC) + */ + +/* + * Other setup TODOs: + * - DVC ramp rate + */ + +static const struct tas2764_quirk_init_sequence { + const struct reg_sequence *seq; + int len; +} tas2764_quirk_init_sequences[] = { + { tas2764_noise_gate_dis_seq, ARRAY_SIZE(tas2764_noise_gate_dis_seq) }, + { tas2764_dmod_rst_seq, ARRAY_SIZE(tas2764_dmod_rst_seq) }, + { tas2764_conv_vbat_pvdd_mode_seq, ARRAY_SIZE(tas2764_conv_vbat_pvdd_mode_seq) }, + { tas2764_unk_seq0, ARRAY_SIZE(tas2764_unk_seq0) }, + { tas2764_unk_seq1, ARRAY_SIZE(tas2764_unk_seq1) }, + { tas2764_unk_seq2, ARRAY_SIZE(tas2764_unk_seq2) }, + { tas2764_thermal_th1_dis_seq, ARRAY_SIZE(tas2764_thermal_th1_dis_seq) }, + { tas2764_shutdown_dance_init_seq, ARRAY_SIZE(tas2764_shutdown_dance_init_seq) }, +}; + +#endif /* __TAS2764_QUIRKS__ */ diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index f33ac89ffc598c39f3a7e0d620724098ca5bc3d3..d21ad23f59ee1b393a27014d403dab1d99836012 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -46,6 +46,8 @@ struct tas2764_priv { bool unmuted; }; +#include "tas2764-quirks.h" + static const char *tas2764_int_ltch0_msgs[8] = { "fault: over temperature", /* INT_LTCH0 & BIT(0) */ "fault: over current", @@ -123,6 +125,9 @@ static int tas2764_update_pwr_ctrl(struct tas2764_priv *tas2764) else val = TAS2764_PWR_CTRL_SHUTDOWN; + if (ENABLED_APPLE_QUIRKS & TAS2764_SHUTDOWN_DANCE) + return tas2764_do_quirky_pwr_ctrl_change(tas2764, val); + ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, TAS2764_PWR_CTRL_MASK, val); if (ret < 0) @@ -549,6 +554,30 @@ static uint8_t sn012776_bop_presets[] = { static const struct regmap_config tas2764_i2c_regmap; +static int tas2764_apply_init_quirks(struct tas2764_priv *tas2764) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(tas2764_quirk_init_sequences); i++) { + const struct tas2764_quirk_init_sequence *init_seq = + &tas2764_quirk_init_sequences[i]; + + if (!init_seq->seq) + continue; + + if (!(BIT(i) & ENABLED_APPLE_QUIRKS)) + continue; + + ret = regmap_multi_reg_write(tas2764->regmap, init_seq->seq, + init_seq->len); + + if (ret < 0) + return ret; + } + + return 0; +} + static int tas2764_codec_probe(struct snd_soc_component *component) { struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); @@ -635,6 +664,13 @@ static int tas2764_codec_probe(struct snd_soc_component *component) if (ret < 0) return ret; } + + /* Apply all enabled Apple quirks */ + ret = tas2764_apply_init_quirks(tas2764); + + if (ret < 0) + return ret; + break; default: break; @@ -719,6 +755,9 @@ static bool tas2764_volatile_register(struct device *dev, unsigned int reg) case TAS2764_INT_LTCH0 ... TAS2764_INT_LTCH4: case TAS2764_INT_CLK_CFG: return true; + case TAS2764_REG(0xf0, 0x0) ... TAS2764_REG(0xff, 0x0): + /* TI's undocumented registers for the application of quirks */ + return true; default: return false; } From patchwork Thu Feb 27 12:07:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994291 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 D49D02356B7; Thu, 27 Feb 2025 12:10:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658220; cv=none; b=ZB6XezA+5peetxSmIYFoErjJimqYDb8i4LSRgQJmzVOY2DhOIPAvBGrSKQHsvQbXjTbhZAS+nOsXL53f+5ddZTqgOinVoEDUOayXaG5s3VXsl8e0TQ9Eaq9F1jhLjeLHBW2HSuq8DdNvQZ0z0O4VjqJQjL4pHjzciyNz6Iabkew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658220; c=relaxed/simple; bh=7xShCpFQdJUb4D7S2QF+bNsOJUNFCjq4IHatgwNnvKU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n6++9Y1GftfjaWwPQgyzIqMpUg9tds7y77hRLmBwViHoxVQCbzNwbakIFRmR9F+SPelCk/gmkFTT5zWXjvo3uflPjdEz1Yd9lUBa09r/U2qnA4mi0Re2Q4jDEg8oJw8LSzS24WDzEljOs4/yxVtbnkchAj1Eo2bp/nMklaIbqAk= 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=NxX+lXIS; arc=none smtp.client-ip=209.85.214.176 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="NxX+lXIS" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-220f4dd756eso15506945ad.3; Thu, 27 Feb 2025 04:10:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658218; x=1741263018; 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=lGdcVF1u/KwGvbpKlJDcqGwRXZF3lOCOPum24pRSoFs=; b=NxX+lXISp/knMe6uvGLtjD2ZFg9T2euil2C3JcRTvel6y+Io7vf80nszh5ZxsCkCIK aSVf5P7C2/g5AQyiTS8p9wtMd4j4MEiMFec6BkUKefRyG75b9sdqJ8bbefSIpQg3UMox XW4UXP4pHqfRoDtpzSB3SnbtCZ6GAmQKavFl4M8herGknuIXLVvDaiROLWvS+yx/8VP6 gD/zJwWjD3VFCnTGaSkS2FchawARGGeatmo1sioxVJMIRf/zq+MGeS/2q3JXg843hEHr hICLv/RwpqO7Isbkf0uwMWVPxVBRpZo4hubDTPwDLMTV3WzZE/t8iXFB3wPEWzTnDosO nvsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658218; x=1741263018; 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=lGdcVF1u/KwGvbpKlJDcqGwRXZF3lOCOPum24pRSoFs=; b=TVw+nnuxLn+IiKvsE+QVnYQrCx6ivJHHRqaI6l1xrLuqn7p2Yg5K+TZgSH5OU13xTU aIQxlehlIzcZBitl6IC2kkapndVbMOnoJ0nwIoXF0qG1kKWqUBkwrKR1+7vGE30Td0md N5J2+C34dHc2PI1yycorClqbRhP79GKDUuuwkvD2cs/f8goCwaP5i2it1YWKRF6dZY1p heGBZ9HptXeyRh4WbtFMkCrU15CcLPM5pD1KrQdL4HaIs2rthJMC+DgrSPvQnbJ5RImz /J8qFiMjavUAkSes2URVJn5qnw2pV3npjBpp4p7NwjgWNDrmxU19VW2LAeLFkbAbLUUL nGWQ== X-Forwarded-Encrypted: i=1; AJvYcCUH2I9cq/o83IPG6ea5FP31Gch5UNX5ZeTchQ0voxbLCfBhrSjCp7bxcf5phBHm7O5f3vPEHVaSbOXrPKU=@vger.kernel.org, AJvYcCUkc5GLL7X7tctGMP1aUySqCro98bHujzuWZuWz/QgeAxxOwBwAZJa5FMrUAfaIK7TWizLM5WUAZm8M@vger.kernel.org, AJvYcCXBkhjNTxYL+5KD0Ib7JfGz+wFwwe+kOE2FSYNbuDGVQDZN4+640Oh4UrfoEkYwOjJ91KwIvGIacMqefLzK@vger.kernel.org, AJvYcCXDEq6r9sq83cx8JvBixNTCnKefNElKM+VSzhnXcnV7v/JNPXB7Wd2ODM2e0k56svzUxaeuVNF4MRMRXzM=@vger.kernel.org X-Gm-Message-State: AOJu0YxknihfdD/baKlB0n34gXJIKUtbGCAt3XQBX6N7JpiNQatuYQKJ uMTMeAJNUziLeIN5O2peVjB+ekQ8Y8b/TwU59xxBZL5so8g5RiKz X-Gm-Gg: ASbGnculmOhFKNilVh+RnYKJHv+hTA4cTidz2MALyaq8nYWOMVtadzYPtMT/IfpQfE6 y/pyV4o5eu9H1BTdGXSKLdlWDD4g3U2hZxDkdbq9hqAtPNEsdRt6bgzCwyapZWdKxHY84GuZQ3H oFvj3Xb6lI+eXogPAEYS/okHkMcJ9hhpf3a4dLLFRk161apEYVcpEWOZFjjkf/lttC+JOXpA4CM voKpJZ/8VYmsYiMktHt/sSEFbPMATR+hvLUTdqueJZQMihQjnsm32CmhGtuPMr9cbLrhqTF0Ph2 vgaZbqTDkUVsuRPv0lfDr6nFwbZo2d71Cq04A86nhXsi70WGIuWfmVpqkwHBHpoGeX4apca+0hQ 8Q4OZl56Tw4yLYH2YTeQD X-Google-Smtp-Source: AGHT+IGaBznkzCiy9+ZSp/fE8RNqDYHrZCwjqbYYIAhATUT6oQrn/URzvxi0fsxxWKWSl1lxT66lTg== X-Received: by 2002:a05:6a20:6a0d:b0:1ee:e808:732c with SMTP id adf61e73a8af0-1f0fc1394c6mr17968725637.14.1740658218202; Thu, 27 Feb 2025 04:10:18 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:10:17 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:38 +1000 Subject: [PATCH v3 11/20] ASoC: tas2764: Raise regmap range maximum Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-11-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1379; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=xW12XaRnHT2CTg6ocY0zQAjiDxm2L8AJgzbe75kjokE=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk8l7RVX/dEQfX/+Y9l8nU//U5k26mpeWejeWvv2x xQlN+8lHaUsDGJcDLJiiiwbmoQ8Zhux3ewXqdwLM4eVCWQIAxenAEzk+ypGhr6CfgPVD5t2V5ZI mk+ydfol7qlgK/HsDq/vVia1t4Zh6xn+2X05fjBSYeGf6qTsKSYTWXZIqu+taSr+WPeGUVbK4Lk MEwA= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer TAS2764 has a number of undocumented registers between page 0xf0 and 0xff. These are used to apply in-silicon quirks and workarounds at runtime. Raise the regmap max register to 0xffff to cover any quirks registers. Reviewed-by: Neal Gompa Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index d21ad23f59ee1b393a27014d403dab1d99836012..0234a41deecd62e860c9d54a7a3206abc0bdac54 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -739,7 +739,7 @@ static const struct reg_default tas2764_reg_defaults[] = { static const struct regmap_range_cfg tas2764_regmap_ranges[] = { { .range_min = 0, - .range_max = 1 * 128, + .range_max = 0xffff, .selector_reg = TAS2764_PAGE, .selector_mask = 0xff, .selector_shift = 0, @@ -772,7 +772,7 @@ static const struct regmap_config tas2764_i2c_regmap = { .cache_type = REGCACHE_RBTREE, .ranges = tas2764_regmap_ranges, .num_ranges = ARRAY_SIZE(tas2764_regmap_ranges), - .max_register = 1 * 128, + .max_register = 0xffff, }; static int tas2764_parse_dt(struct device *dev, struct tas2764_priv *tas2764) From patchwork Thu Feb 27 12:07:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994292 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 72EEF22C35E; Thu, 27 Feb 2025 12:10:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658228; cv=none; b=DyozKl/9IPRFnQPV/l3hs82xzvmR3aVNmcagyrJ6ONw4BdwjWVyt4bqEVmmqFcyakwV4xhlX9e47CHz89i03zEUk5NLztlHt1VcvkfcsJ9o6aZUy9G4gGhnGTAp2hCXxnS5tfueQKDKSMdCyewZpa517WtPgdTFkDIJSwjoymOw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658228; c=relaxed/simple; bh=ls6nJr6c5xyRlqW0wE9UzbvVJV/9x1W6y7H0wIut1z0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HcQ0t+vMviCOFb4wfpag/EXr9q8kqRqg/WCJahheZ09PnuUjYJMxHMQX+xLJXFfxaWSYlVsJZ/unNOUHrVCD0TUsaYxpTayeXzbrDBOm0ueQrpqnrouiolCpnJobHbLauCKnB3EBC7iugub+5cVHyfKypMnSEvSK159f8RYWAfA= 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=jk18tsEP; arc=none smtp.client-ip=209.85.214.182 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="jk18tsEP" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2212a930001so20774455ad.0; Thu, 27 Feb 2025 04:10:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658226; x=1741263026; 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=G2G8IntqVZ/p0yVip5R832K06lAhv6smk3QugjfMN1I=; b=jk18tsEPzbtX0DFkdSa5IUsi9zrXuRjbU12PT/aS/DoGm228ZC3BjAUjVQkzsu3gyg apkhYSlhf8AruHugnPLGCwkFLlWNWOKyG+33NE18/UMGuUvYwCd1+Hbkul3VS8RePr5I Gh70hCCChcpSVLDd4kNZzYA0OD7kiZp9R0wozPMHSQi0nVnc8BnfUkfbG+7F7ZuImfeR ufuPrY1VJLjjL3q1OR2OLOq/jRbtJk/KrqH3f8tpv/VbsGjb2EAnWVR8mSoYhx03ylna vOTn7wFbZnb+3BDk4Nf167hoMCwxdBHjGFQsXOewu3jZvfvYDudAxHzaD6m+SEuybd96 jGGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658226; x=1741263026; 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=G2G8IntqVZ/p0yVip5R832K06lAhv6smk3QugjfMN1I=; b=oKBWtU7dHOGnO7ok4yZwcBMGyR4dzJMI8CLW3l0wNwPnTaN/6exOknfgJ+6OUb6Cur vaGDao5Bpo7cWGn35nnVclGG0vWKF2hDavsyh9cK/2clMJNOYZ037ZfDNeGNavf8l67n SgZZMxIZUZ82dGf1oYSX0rNW2F1jjY8s+guB2t/8EJrwro7cV500eGbOGfqUiKQvv/ob xqzDApHqHqUEzp4csoIZZgdaBIAYg11asjv1SWcZQ/JJibPRv/yZbGZaaJWrjXnKEPtp TtVAtHlK0SXdEwXPt49naduqCd78gfX1F2pri/If7ufgotUmVZcCnim0oRrNjLvlxLm4 77rg== X-Forwarded-Encrypted: i=1; AJvYcCUvU5Uxw5u9jxD2Z9PFi10Q5+YRFhXGbJDL/9OUCali9g4uul3ivGL6hUsvgHmFBa9+nAVAOkWrwcuOipY=@vger.kernel.org, AJvYcCWkX4beJRbFD6uYas+pBmAD5BbHZQxIXhMZjTANyzUBFVebBMNYQiSAY6NLva1MgKDVOaIAObEcQUK7HS8=@vger.kernel.org, AJvYcCXZpi52OWfDb1Famn1uxjon3t1+BuHT+qwXhGpcjKxAzcZOzZjkjxw7T30NhPTh9fBW7ydRyVL1YJaJ@vger.kernel.org, AJvYcCXrTYw/ieBzoRh6tD0jhv+uRJRTn6xGEMMGD39B2l6Whz0kzQxxOFr8VF2HFXf0SEuXw8NABywIwXBu4re5@vger.kernel.org X-Gm-Message-State: AOJu0Yy8t3CadJ819oeeIu0hI4LgMPVjAc95l5cB2MkbES5bQpeqG4u8 bTbh/+WprcrxCoqCKG+mq8mQNvSIRbizJZ0hp5FU64CfBAXX/j+Q X-Gm-Gg: ASbGncvoLiAtIGKWYf8BjqwfFsazl4zJGyNWbDHezvFj5W8MiiK1buq3yx5gq1aaJux NRq/2F2BTkQyyg5JN0Hm2irWgk7FvSjT4iN4kgWxTPdWS+zkozAV3Oz9sF+vcYwnl5UgdZC4woF SzT12aMa0kBXZ7Cv4EpbbM76y4YhdNesr0RR4JwF2J0JqlIkosEwePmPXpDnFMe77Met2Zk9jLr 68SSTcQZcwxEMcAVUFZpuwelHna5/e3Iv8/o2g7tUkX0yxnp7wluoleDUX0CHi3JIEfB3G9CA+R oLTVMPyA64WFQ8eqSR6lR+rWQSZEnJ04d3aqdUYg8Wgc6Cw/zSu3FhiDfH6fAvt48yicFopKKqX Zc6miMVuaGuYZWZyzSmU3 X-Google-Smtp-Source: AGHT+IHSehyHYral5B9z7Uch5+OLoMeAHPJP+5CJ8NgoDW0Kj3SM8FYMoiHIT0RPXZr/7cRUWgoEeg== X-Received: by 2002:a05:6a21:3d82:b0:1ee:ced0:f093 with SMTP id adf61e73a8af0-1eef55b57b0mr40384076637.36.1740658225781; Thu, 27 Feb 2025 04:10:25 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:10:25 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:39 +1000 Subject: [PATCH v3 12/20] ASoC: tas2770: expose die temp to hwmon Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-12-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4581; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=ls6nJr6c5xyRlqW0wE9UzbvVJV/9x1W6y7H0wIut1z0=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk+17PVqvTWXM3RNyNUaG7/jnrsye/94Pm/puZnU2 X67d0twRykLgxgXg6yYIsuGJiGP2UZsN/tFKvfCzGFlAhnCwMUpABPxWc/IsCBAyeaT1ZXDBmL5 SbOMJy8JiO43SDn+Rts4unNLlHjeZ0aGT3f3z9h+9+HnJR6bL242fV10ZEdn0/XXE83f75/2x2r DezYA X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 TAS2770 includes an ADC which reports the chip's die temperature. As per the datasheet, the temperature in degrees Celsius is derived ny taking the raw value stored in the ADC's registers, dividing by 16, then subtracting 93. Create and register a hwmon device to expose the chip's die temperature to the hwmon interface. The ADC is shut down during software shutdown mode, and its registers are initialised to 0 on reset. This means that the die temperature will read -93 *C until the chip has been fully powered up at least once (e.g. the PCM its attached to is opened). Once the chip is put into software shutdown again, the ADC will also shut down. The last value sampled before this happens will persist in the ADC's registers. Co-developed-by: Martin Povišer Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2770.c | 102 +++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index 7f219df8be7046912bf3ef452f75c17b5118bcf6..9cdd3470e9a04d5a5f801c3690d40f8fd131cd94 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -491,6 +492,94 @@ static struct snd_soc_dai_driver tas2770_dai_driver[] = { }, }; +static int tas2770_read_die_temp(struct tas2770_priv *tas2770, long *result) +{ + int ret, reading; + + /* + * component could be uninitialised if the codec is not + * attached to a machine driver + */ + if (!tas2770->component) + return -EINVAL; + + ret = snd_soc_component_read(tas2770->component, TAS2770_TEMP_MSB); + if (ret < 0) + return ret; + reading = ret << 4; + + ret = snd_soc_component_read(tas2770->component, TAS2770_TEMP_LSB); + if (ret < 0) + return ret; + reading |= ret >> 4; + + /* + * As per datasheet: divide register by 16 and subtract 93 to get + * degrees Celsius. hwmon requires millidegrees. Let's avoid rounding + * errors by subtracting 93 * 16 then multiplying by 1000 / 16. + * + * NOTE: The ADC registers are initialised to 0 on reset. This means + * that the temperature will read -93 *C until the chip is brought out + * of software shutdown (e.g. the PCM it's attached to is opened). The + * ADC is also shut down in software shutdown/low-power mode, so the + * value read back from its registers will be the last value sampled + * before entering software shutdown. + */ + *result = (reading - (93 * 16)) * (1000 / 16); + return 0; +} + +static umode_t tas2770_hwmon_is_visible(const void *data, + enum hwmon_sensor_types type, u32 attr, + int channel) +{ + if (type != hwmon_temp) + return 0; + + switch (attr) { + case hwmon_temp_input: + return 0444; + default: + break; + } + + return 0; +} + +static int tas2770_hwmon_read(struct device *dev, + enum hwmon_sensor_types type, + u32 attr, int channel, long *val) +{ + struct tas2770_priv *tas2770 = dev_get_drvdata(dev); + int ret; + + switch (attr) { + case hwmon_temp_input: + ret = tas2770_read_die_temp(tas2770, val); + break; + default: + ret = -EOPNOTSUPP; + break; + } + + return ret; +} + +static const struct hwmon_channel_info *const tas2770_hwmon_info[] = { + HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT), + NULL +}; + +static const struct hwmon_ops tas2770_hwmon_ops = { + .is_visible = tas2770_hwmon_is_visible, + .read = tas2770_hwmon_read, +}; + +static const struct hwmon_chip_info tas2770_hwmon_chip_info = { + .ops = &tas2770_hwmon_ops, + .info = tas2770_hwmon_info, +}; + static const struct regmap_config tas2770_i2c_regmap; static int tas2770_codec_probe(struct snd_soc_component *component) @@ -707,6 +796,19 @@ static int tas2770_i2c_probe(struct i2c_client *client) } } + if (IS_REACHABLE(CONFIG_HWMON)) { + struct device *hwmon; + + hwmon = devm_hwmon_device_register_with_info(&client->dev, "tas2770", + tas2770, + &tas2770_hwmon_chip_info, + NULL); + if (IS_ERR(hwmon)) { + return dev_err_probe(&client->dev, PTR_ERR(hwmon), + "Failed to register temp sensor\n"); + } + } + result = tas2770_register_codec(tas2770); if (result) dev_err(tas2770->dev, "Register codec failed.\n"); From patchwork Thu Feb 27 12:07:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994293 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 2C1FC22C35E; Thu, 27 Feb 2025 12:10:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658235; cv=none; b=KlZYwHIHtbTpEJe8OYhJv8WuWniBSRZHH96Cdr0SIVOuwDHzXOqlj2vaS+oCiWOQ6/F4nuzW9vP0TlLnvwlpgSGPNnGSWXAthkky3WiP38IuUB4OUNwiCmXXJJzto9X+lr20zyvDlBQUxaYTOUu0bRjBDkJ3aSRZhIVzncnTuxg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658235; c=relaxed/simple; bh=qHvfUmN1R+D3X/0kel7hIGI1UTjzGT/2lxJjDvieRlA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NsrBGSRL7zgwNYlOPNRB8xJzorTyhBMX+9QeI5Wc8ebpYR4dqYadAv2W8BFKe67QNr54ZG9LfWPD0mxRcixtZF1/li+VqYS4W65nZ8mObXkCf4AjGSQmNKbAkznvRem0OmsHtg6LlrsohheeDLeiw0bwwArxPwfswpoC998LXa8= 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=gQOsJTd5; arc=none smtp.client-ip=209.85.214.170 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="gQOsJTd5" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-22334203781so26125945ad.0; Thu, 27 Feb 2025 04:10:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658233; x=1741263033; 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=4XvdRl0ozFXSTGZyxyJz3ob8mwey7ewvJ2oCOTD5KBw=; b=gQOsJTd5khd/WzLikSSfhlX+oF3yK+yl0rUiES1n8fYTwytWCcEOZjeHmtXQCzGkji lbejXtJvQKFFE8gyqE7fGQ2SIJgvwnX9KJEz9gl4jzIjWbebZLAIr9k+zSjtLWsF0Htg /NjMvKeGp2DygqkRKFfutwtwubas4TiVZAl0z0SjSSeMmgj927ZsKS8x63o1S4RPgDGH pyTfqrePRgLAC6MUunDunENeJWg5MVmdEVvygtPuh69PIK1QJ/6SniCJKdTYLtCS5+E4 ru7bbghYIqiFbxSc6w1y8rTRWorzMthzNK/Raxsofg5q6kAvwUWHM09yPnP8mlOXoUDF +SNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658233; x=1741263033; 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=4XvdRl0ozFXSTGZyxyJz3ob8mwey7ewvJ2oCOTD5KBw=; b=qxdASI0qHF2Jrt40N1pmd58vEy/WPGl5TuSVFI/NrDrXI+qtC6b9y68XJKg3feWEXu Ojxf44x8S4X9pV7x2/Q8DSweM5+nGGCvgeKuPXGVkWhuPbAlPl7P81/qjkjoqMiEDzF4 Jmi2Aaswvjs56/xtytgwebBqNWIpgnP5rsrk0QST1T2xjjzP/cpakqAR6/IpDJNnWLhx zxvEkeRuoPrgJGX1XEPULHaPAYLp9b+uQtwBQvBI7BrF55dHg6PF7vs7shKKrRqBsZC0 /jlVQFaLyMHxWOx7a5b9u9KqHEHJ6u6P9OirtSozCNznhyNo98jHwBX/OCxQ9kEF8SGC Jt5Q== X-Forwarded-Encrypted: i=1; AJvYcCU/UsmVNfKJr/9Cq/Nt91NUsMKzKfIPikP/6NNYLkIIiK1korXhfeHs25JcR5u5oeAoZQa1wCjJtLyDEU5D@vger.kernel.org, AJvYcCV79kKXcbx2JFkZW9PCJy0VY/bPJPIqw2WwdtL64ADijdtfFKz6e44e9auY5dE9NdCWNIoNVuBuBxLaDXg=@vger.kernel.org, AJvYcCW3RXrVtyQMh6SuRdqR9oBJL+rS+mZP+jBLXJ27Dz4x30N1Fp05nCODWCVx/NOkHZJMaUOzZDTlxSxt@vger.kernel.org, AJvYcCWCYbHaYUAxcUVaxMNxhSj4uckbKTQiBn8xcUWs/9lf3FFqwcj3IAOCZjhI1x7mQVrmV/Tj0gsWTF3jQdQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yx59OR05ypTXQx8HUYC6YwmMLaZz3fDXYDk3epWxjD8E9BrS9LE Vcr9zQZZdRRbpwUo8j7M3WUQPF7wDxdVO7f+E2qYFNm//OGytzxp X-Gm-Gg: ASbGncuS8f1qE4e9y0ClRV3puVkpKwe6zJ/CHKJ1S9LK22o/7CM9NRilhLawypSa0ig nZoFZV7oZUDZuMWoDqy1+DIKAGsy1dXddDFzW+QsEXr9F/cUZbg1mcksqVwhy0UL4cTKR9SXnM9 BEQYNP9KJqQhRdciaR+kjhTS/0nuzrOCzGMdGjOXZaFFfVdoF9mFcm3X1dO+YTulrchv1JZe59R JircTeSL0S0DLMD5ELepX8bPQop+ewfU4sk/N0UShHSuZjOpSgUv48l2s6zILpL8zaAB0TjdnlV /8YoyqxRHnfJZ4o3W8eKcpYRkAa3dhl8SHJ51oj3FLCjumS3fc1DQBx5nKUq7ab8egyLUOQKvep eD6+2OTyJ52b6M4qiBKpU X-Google-Smtp-Source: AGHT+IG1A7+2aRVuHKZ/d1JszoVfWOrdXpScsWQdnCG4oF1+hO3YTpEnAhE8uXpIffsTcWF0ln1teQ== X-Received: by 2002:a05:6a20:8402:b0:1ee:b5f4:b1d7 with SMTP id adf61e73a8af0-1f2e387ef46mr4577116637.7.1740658233356; Thu, 27 Feb 2025 04:10:33 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:10:33 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:40 +1000 Subject: [PATCH v3 13/20] ASoC: tas2764: expose die temp to hwmon Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-13-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4898; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=qHvfUmN1R+D3X/0kel7hIGI1UTjzGT/2lxJjDvieRlA=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk8t2cbyPE5qxrTuhu0bDHv+flROcNqiGCwtyXVX8 vcpg6VOHaUsDGJcDLJiiiwbmoQ8Zhux3ewXqdwLM4eVCWQIAxenAEzE2YWR4VPsljXee0+eOSMz 7dC+hZt2O62QK9H/d5ZlTe6KmRLrONcx/OEQcu2cw3HA8UKfckT5vej5oT6TEyMZ7nlsXPXnasu yci4A X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 TAS2764 contains an ADC that reports the chip's die temperature. The temperature in degrees Celsius is yielded by subtracting 93 from the raw value reported by the ADC. Expose the codec die temperature to the hwmon interface. The chip will initialise the temperature register to 2.6 *C to avoid triggering over temp protection. As the ADC is powered down during software shutdown, this value will persist until the chip is fully powered up (e.g. when the PCM it's attached to is opened). When the chip is powered back down, the last value sampled will persist in the register. Co-developed-by: Martin Povišer Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764.c | 96 +++++++++++++++++++++++++ sound/soc/codecs/tas2764.h | 3 + 2 files changed, 99 insertions(+) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 0234a41deecd62e860c9d54a7a3206abc0bdac54..b42bd5a50ee566ee83755d4ed7e2071b60951457 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -578,6 +579,87 @@ static int tas2764_apply_init_quirks(struct tas2764_priv *tas2764) return 0; } +static int tas2764_read_die_temp(struct tas2764_priv *tas2764, long *result) +{ + int ret; + + /* + * component could be uninitialised if the codec is not + * attached to a machine driver + */ + if (!tas2764->component) + return -EINVAL; + + ret = snd_soc_component_read(tas2764->component, TAS2764_TEMP); + if (ret < 0) + return ret; + /* + * As per datasheet, subtract 93 from raw value to get degrees + * Celsius. hwmon wants millidegrees. + * + * NOTE: The chip will initialise the TAS2764_TEMP register to + * 2.6 *C to avoid triggering temperature protection. Since the + * ADC is powered down during software shutdown, this value will + * persist until the chip is fully powered up (e.g. the PCM it's + * attached to is opened). The ADC will power down again when + * the chip is put back into software shutdown, with the last + * value sampled persisting in the ADC's register. + */ + *result = (ret - 93) * 1000; + return 0; +} + +static umode_t tas2764_hwmon_is_visible(const void *data, + enum hwmon_sensor_types type, u32 attr, + int channel) +{ + if (type != hwmon_temp) + return 0; + + switch (attr) { + case hwmon_temp_input: + return 0444; + default: + break; + } + + return 0; +} + +static int tas2764_hwmon_read(struct device *dev, + enum hwmon_sensor_types type, + u32 attr, int channel, long *val) +{ + struct tas2764_priv *tas2764 = dev_get_drvdata(dev); + int ret; + + switch (attr) { + case hwmon_temp_input: + ret = tas2764_read_die_temp(tas2764, val); + break; + default: + ret = -EOPNOTSUPP; + break; + } + + return ret; +} + +static const struct hwmon_channel_info *const tas2764_hwmon_info[] = { + HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT), + NULL +}; + +static const struct hwmon_ops tas2764_hwmon_ops = { + .is_visible = tas2764_hwmon_is_visible, + .read = tas2764_hwmon_read, +}; + +static const struct hwmon_chip_info tas2764_hwmon_chip_info = { + .ops = &tas2764_hwmon_ops, + .info = tas2764_hwmon_info, +}; + static int tas2764_codec_probe(struct snd_soc_component *component) { struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); @@ -848,6 +930,20 @@ static int tas2764_i2c_probe(struct i2c_client *client) } } + if (IS_REACHABLE(CONFIG_HWMON)) { + struct device *hwmon; + + hwmon = devm_hwmon_device_register_with_info(&client->dev, "tas2764", + tas2764, + &tas2764_hwmon_chip_info, + NULL); + if (IS_ERR(hwmon)) { + return dev_err_probe(&client->dev, PTR_ERR(hwmon), + "Failed to register temp sensor\n"); + } + } + + return devm_snd_soc_register_component(tas2764->dev, &soc_component_driver_tas2764, tas2764_dai_driver, diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h index 4cf0f7f112d6c3002203fa32e900efd640ef3f22..4a419c11d4b08eebb915762db00af5c06ff3dd42 100644 --- a/sound/soc/codecs/tas2764.h +++ b/sound/soc/codecs/tas2764.h @@ -117,6 +117,9 @@ #define TAS2764_INT_LTCH3 TAS2764_REG(0x0, 0x50) #define TAS2764_INT_LTCH4 TAS2764_REG(0x0, 0x51) +/* Readout Registers */ +#define TAS2764_TEMP TAS2764_REG(0x0, 0x56) + /* Clock/IRQ Settings */ #define TAS2764_INT_CLK_CFG TAS2764_REG(0x0, 0x5c) #define TAS2764_INT_CLK_CFG_IRQZ_CLR BIT(2) From patchwork Thu Feb 27 12:07:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994311 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 0183922D783; Thu, 27 Feb 2025 12:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658243; cv=none; b=EEvkfY2xoDfVvkWvzgTnzRvhaCgUOlnL8+SysS2HQuGX0r9nFmwYyubBaCQHFIUUZq5qtOD203X5chxXQ2pWeSKxpH8EZaSYL4BRQND0CTbUHGOegICwL4Bv790VnDblBVv29TfSsGjXVattu/JfHrOXdPX+irlW3DewWvXck+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658243; c=relaxed/simple; bh=BFI0z9ztuM8NgUtm2zrZ0APxtSUaayFxbNwUmSkAGdo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m6DsD1rJZCmxpdeSTsBCSmNfzt85uZSIjUWHFEGbWjzJFdM3T4fZLZqsuxoXWnGOXAQtgd8uFiIPLHhrgt+bxZ0p5YpdoqikHcAQe6KVnGpG6PFObGXnoaOOwYkl4206k1nk/wRb3UTBeK7vyOLaexGg46bC0tmwbuRBMEXmOpA= 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=lMsMAh9p; arc=none smtp.client-ip=209.85.214.174 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="lMsMAh9p" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-220f4dd756eso15514975ad.3; Thu, 27 Feb 2025 04:10:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658241; x=1741263041; 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=Y0QY69BHYfqhQl9VSrO9JG2JgXmRpNHQh/P+Lu952WQ=; b=lMsMAh9pm+2jX1UgeGwIMqP9Jq/K009aBzvfzt199pzPYo7AL1Bdh9FdmEv2PxAJ+D pcSj7+kPJp2car26B0J3OX5EJ7laIe0n6KaWJEGHYStZkz92gJVFS6pR7F3o4ap2DLdK s5I/euBKHH8ylHYQW2Jh+6Wj35fdKB+BXVpdNpw4eFhN24nxi4fnatmqY1KdKZNayKXG +BXLZ3Hit3Zr/9S5nxJvubI5moM698SFjqQcMNADs5WXS8q6FSW9XT+LopIj5/8FoWjV 3c3B2aM6CI+ixNEdAV46qkwJVBAPhurWpbhD8QY00FJ43VnM+hTrBmd6bZH97/metttr nNrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658241; x=1741263041; 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=Y0QY69BHYfqhQl9VSrO9JG2JgXmRpNHQh/P+Lu952WQ=; b=Kctyp4YUI9fym8ZAKdEAODWROIDlhUMmeF5Cn9U/Ye2suHwsmmnsH4hCupAMSzzUJe iqdks4ok0DukAamv3tiWgCY9BTtvXRrnSgGVhN4w2IbVrIwpRSWtepHDgh/narDmJoWi c11+fXW0dGTxD4+OxEFhVvzbrR+cQgmwtXfhMe380VWPiWB4WjPAOyq59mAQPyYsNXBp dhcMcmAKZsaRk8qtyaNX+4f4P5kdlVvdiZxP+jYEjUld9P8lJxu7QhCzajQjZ4spGCUR 9r7103lqFUufg9T6KNun+Y0b5MFL2gT1Tl/crqKomtQNnWgmV6OgwwOTBMxtyEnPmHFk g/kg== X-Forwarded-Encrypted: i=1; AJvYcCVYqGp97YlAd8eGFJwcX319Mdo+841F6DcTTG5HIRucBFyqpkzdKJTCZKRboo46+axih/q3AFJihC1/NGY=@vger.kernel.org, AJvYcCVqelkjDAc6tGwn9P6uQ4bKHYA00EhTk4F3dMMy2m9omHbpZMocy4AmfXFAnsPGhld1dYRZQ+pPk01wMYo=@vger.kernel.org, AJvYcCW3Gi2Z36mE/5cE3pcQZWSwYSUbi/wHLWnLoSKt3cA9TKVVQ8N5GRLAdfpBwBCmmu8uNLzDSxPP2/v/@vger.kernel.org, AJvYcCWcue8F3xe7f7gRdeHKNOhMdYvQvv8IubMPcvPbh+yck2kwNzA9Z7EeEAGX+SYY+fd4k1vD7gIeugQCJagd@vger.kernel.org X-Gm-Message-State: AOJu0Yxj4IW77DpVl/WnMrW7l/Y5g/wBVpIA8RTd50uuddBsHYLUf9n2 4tnhW+sIETlcXriypl3rwPIUmNjg9B4KEnpzfwTurLyrsyYKBl1G X-Gm-Gg: ASbGncuvEsQvWHIIJ8yRYvi81zs4pk+fN6gwT8BVvQCY0u3rlCaLWnINAnPbexpKLOk 1FZ4pZfoRiz7iXK+HIMtsamAF/H+6+Jnt2CKRHF08kgteBZJP2M5QJA+JS6A1lK7LKAGqt326xm rMrWw55hizU6/biRHkAKw7T+zyf4XQFYQnlc5N9IA7bnCUlyjaQf1+RgD5cHXqsEZeDz8N+aKIZ BxILNP0Cy4ZYDziF1/LdlFlZbszIGkSze/djvXcxRG4U6iZTA72syRUqXihhcUdt3EWWnXtrMWg Lcezy28FN6jAXjqcdP1yM+k5MWeEMxipbTONN2iN4DRQj3Ga3WKv/3w1x9z68DKCv2zAs6lsU64 XkrSth09icULqfDQmVOcM X-Google-Smtp-Source: AGHT+IGZTvBMjPdbxJa384Mb2cBWuad7YJyZy5010Lq0PTkXQwxsWk7/O8DSuEOsr5dODlA/SMx4cA== X-Received: by 2002:a05:6a21:6daa:b0:1ee:c8e7:203a with SMTP id adf61e73a8af0-1f0fc99ca0cmr18970116637.40.1740658241174; Thu, 27 Feb 2025 04:10:41 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:10:40 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:41 +1000 Subject: [PATCH v3 14/20] ASoC: tas2764: Crop SDOUT zero-out mask based on BCLK ratio Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-14-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2333; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=vGfDkW4Egl/oMYM5+yihBufFvY7DijByBLP6WRUag7M=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk8ftGIt7J7RuFWzwDR8s/37IGvbprRv295dZhOKN jkt+XJbRykLgxgXg6yYIsuGJiGP2UZsN/tFKvfCzGFlAhnCwMUpABOZvYjhf6HefcMnE7T5k7dN XOgnWXx9wvyaPZ5lHxcJ7+uLLNxjYs7IsPDBvrbMBVtssi3ebNv6+Irw0vl7TfSPctU9P/Pq59q jQlwA X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Martin Povišer As per the datasheet, SDOUT bits must be zeroed out if the corresponding TDM slot is invalid for a given clock ratio. Reviewed-by: Neal Gompa Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764.c | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index b42bd5a50ee566ee83755d4ed7e2071b60951457..2a787baaff5342e09cdfbf7939b0d635433f27ac 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -374,6 +374,44 @@ static int tas2764_hw_params(struct snd_pcm_substream *substream, return tas2764_set_samplerate(tas2764, params_rate(params)); } +static int tas2764_write_sdout_zero_mask(struct tas2764_priv *tas2764, int bclk_ratio) +{ + struct snd_soc_component *component = tas2764->component; + int nsense_slots = bclk_ratio / 8; + u32 cropped_mask; + int i, ret; + + if (!tas2764->sdout_zero_mask) + return 0; + + cropped_mask = tas2764->sdout_zero_mask & GENMASK(nsense_slots - 1, 0); + + for (i = 0; i < 4; i++) { + ret = snd_soc_component_write(component, TAS2764_SDOUT_HIZ_1 + i, + (cropped_mask >> (i * 8)) & 0xff); + + if (ret < 0) + return ret; + } + + ret = snd_soc_component_update_bits(component, TAS2764_SDOUT_HIZ_9, + TAS2764_SDOUT_HIZ_9_FORCE_0_EN, + TAS2764_SDOUT_HIZ_9_FORCE_0_EN); + + if (ret < 0) + return ret; + + return 0; +} + +static int tas2764_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) +{ + struct snd_soc_component *component = dai->component; + struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); + + return tas2764_write_sdout_zero_mask(tas2764, ratio); +} + static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { struct snd_soc_component *component = dai->component; @@ -513,6 +551,7 @@ static int tas2764_set_dai_tdm_slot(struct snd_soc_dai *dai, static const struct snd_soc_dai_ops tas2764_dai_ops = { .mute_stream = tas2764_mute, .hw_params = tas2764_hw_params, + .set_bclk_ratio = tas2764_set_bclk_ratio, .set_fmt = tas2764_set_fmt, .set_tdm_slot = tas2764_set_dai_tdm_slot, .no_capture_mute = 1, From patchwork Thu Feb 27 12:07:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994312 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 A975D22D7A3; Thu, 27 Feb 2025 12:10:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658251; cv=none; b=oQCGzpwP/Ef9LCUE2OTJrYI4XlwgoiubJ57hJETzNnPKuk1Guv3QycHVTrB4AuIWbpPQZXtxDF9ce/GIGO4dnstM8u1cWhHrU2pRP3SwTuuxvtk36JzS3hJV8OV3mC9k8HxAQ5AC5drcNr0rNy3Bop/ZhNjzcPfBD6rsXU5GVK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658251; c=relaxed/simple; bh=Jn5R4wK+F5vTNEW4NRnrP+z7OqQNNC1+xuztTWGPtZM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fdOOoYGZ1mRjigSV+8qIatCT/7LbQgFSRUt2hVldwS+bSZPmfoa7pC4nImWDCkx9RuPOGoO66YvwxTB0yE7wvQnbCZ3ciFPxDRLkX9UJUAagTAgc1XGTmMMROlCun6cAkmw1DJuqu/mTxWRnCJuoQNP0KJvRWzV+CQzmN0OTHtA= 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=dLohwEpr; arc=none smtp.client-ip=209.85.214.181 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="dLohwEpr" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-220f4dd756eso15517325ad.3; Thu, 27 Feb 2025 04:10:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658249; x=1741263049; 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=dKXxnscjJywE284s2zzqhnlPvX8qOMFroJHl0KF7p7w=; b=dLohwEprlCMjWqA9GMyZcqLM4ZY9E8r3TF6KwZlmO44IvbIDA7Aau0UF0tL1kyudM+ v0wFD9Ohokl+BZlpbpaFCFcGvs2fObmLvfJYbPJAS5u4iHgw+9WuKQW9v2QSvxVwWEJe 7zfUjU3cGf0konC9ueX7L6G6suWxE9oW64fpcImrlSnGckyFt9AXJEQMc+p7BqHS8QjJ fQFO/lRyCXYRNO1jt6XEhsBQYIa0VwvuX/TglolBPj4x+ov8nTZzQP59aDl4sml8t9Xy VwvxkKtrLUwIbiJ6IhQT8ieUpf563KOsbbjJ2uyX3w98UH5TQZ/8nYeL/841iSvZnjiD xx6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658249; x=1741263049; 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=dKXxnscjJywE284s2zzqhnlPvX8qOMFroJHl0KF7p7w=; b=U+i0WZ0hY5H8vmGB29GYKkWjd9cLZk2jXwXz+rLTW0lezqYISfPK8YcsLAu1uzQZbZ A4GegeUKLPtKJSA/BoP1TFNpc/N12yd6eaOtVchr8zB48bnzRQ1b4v8qRlXeMLWuI6Tu CJUDCiS5M1LrLW+SpdMOFCKwDAsRr9EpTzGh5+zNHFGjknzMuGedQ7lCMu6EgLTWq/gk 2s//nYKxnyHEoYQDOwDLrwQryzc3qE+zwe+gB1w4Lw61qar4Rw2pacCNuTFWDGeKHL3q DEmP1DFf2dLH0zlvBl+9CqJgO1LpYJeVeopVYp8Vu5NoYgUD39DRbP4VZA5KpK+DpT2C Renw== X-Forwarded-Encrypted: i=1; AJvYcCV4HU1JkjuT4Hxp9X17wcBVR5kFhnxekA2D5nVPNLQmNhlp0d3u6ePUEMeysKAZzebjN2uEuifDD7g2@vger.kernel.org, AJvYcCW7WWTMugCc99SLS9IDxu0e8njmcAWAclHFn+NYXVJVNf6su0gzaiW1jjoo42YzFpYRuoFhNkFBnzE/vWw=@vger.kernel.org, AJvYcCWuAPgbg2LvHOTFxHhrobDVG5R2EtNr27xoWk+KU7w73rI61n1g50Ec9HzesHaBm5R489DRiNa1S/Ka5jI=@vger.kernel.org, AJvYcCWwye3YK4BLcuVKAqn1dGGROSyBca4BEOEJR25nDUPX998D6NGrJR2mQHrxyiWVHuOmaqWBNvzY2v3BZ5iB@vger.kernel.org X-Gm-Message-State: AOJu0Yxcq7I6DeKBUe9+BRAaAsT25U9yZv2h92YOxWYnea2gN5DYsFp7 jLR6fp71g/DyxIp+0ScU5EjMJFK2QgKKOmdrJZwZGErtkiZd+ezW X-Gm-Gg: ASbGncvvXPOCvn/Aw36t5qEEZ4npJhIkKUVMuklkIyRoC9NMTfo/l/RVCFz7mtkDj1n Ksezuz3LExJMOqQ9h7cd0/Gnljt11YvtUwlkE5D4BJSL0vVbcCVK5E0PHm7ulzzMEue/vRDvgwM tWUt98q0YC+vEsP4/UOCqBO8U/DgONLNVblJyHjKTSp9F5beTL866RufMIAwc9cVUyirhXKhWDn BL+R0vmyMESMrMuWvpjl/i05CRx5ZuN4JuF27M3kWa4iEvHoYUbyefrSPjPRektjB5BKqbJzkvo WwkOVFSMGx53FEwQ1xz9c6A6KUj8zWegDTNYU3i69VIp0AAXWe6SHpza22jk8f7CiV/aZ1rIU+G sYCoQpHskUr6fK3NSIrf9 X-Google-Smtp-Source: AGHT+IECvK48B2XjM2PfdEU2bxSAhCxuahWqdNn1JQu7EMkKMyCFnXeFoQawqcQh0CvVJRZRbXvAfw== X-Received: by 2002:a05:6a20:158b:b0:1ee:e17c:9665 with SMTP id adf61e73a8af0-1f0fc139ae4mr20557009637.15.1740658249009; Thu, 27 Feb 2025 04:10:49 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:10:48 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:42 +1000 Subject: [PATCH v3 15/20] ASoC: tas2764: Enable main IRQs Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-15-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1141; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=vSm2lXVQsvIt/wZW3rb/DSoIEzBC+koDnVUdHg4V6Mg=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk83rJ0rGW32g3dpy6SdBo/Fb3Pv2dVaZmeuo/lVy 1987cXSjlIWBjEuBlkxRZYNTUIes43YbvaLVO6FmcPKBDKEgYtTACbScZGRYd+rX6lz9za//VN0 a+vS+t2yz0L3KyatPWkpdoqhV9fjbw7D/8IQnpMbK0QuSIlt8s46+fxkxcvFDtuF9v36/vye2oK GH5wA X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Hector Martin IRQ handling was added in commit dae191fb957f ("ASoC: tas2764: Add IRQ handling") however that same commit masks all interrupts coming from the chip. Unmask the "main" interrupts so that we can see and deal with a number of errors including clock, voltage, and current. Reviewed-by: Neal Gompa Signed-off-by: Hector Martin Signed-off-by: James Calligeros --- sound/soc/codecs/tas2764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 2a787baaff5342e09cdfbf7939b0d635433f27ac..c122c07e2483b9ed1e6011dd949f97f8b2d0897f 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -715,7 +715,7 @@ static int tas2764_codec_probe(struct snd_soc_component *component) regmap_reinit_cache(tas2764->regmap, &tas2764_i2c_regmap); if (tas2764->irq) { - ret = snd_soc_component_write(tas2764->component, TAS2764_INT_MASK0, 0xff); + ret = snd_soc_component_write(tas2764->component, TAS2764_INT_MASK0, 0x00); if (ret < 0) return ret; From patchwork Thu Feb 27 12:07:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994313 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 B3C162376E1; Thu, 27 Feb 2025 12:10:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658259; cv=none; b=XkfHd4Q3PDOwXi6MlhQLNwPhklNYsB6sS9bsGXpuudUsZOrNC6c//pe+b4zqV9tEunsShME9B0EYbx7hgn4vKkkl6+a44uhxfYxPbs+fEEQ1YjZ8CUf8bSYapmPD67VGaJ8ydWfFyqYd8cgY0emq2HfhAiUNhmVOLfaIUH7FTfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658259; c=relaxed/simple; bh=3lO7ERCwM2D7uu+YtrYmtRReUBaTmMpcEzl+3rC+jio=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pww5wwBtW9QOAr1RKoBrMl5mpejdxeyApE4zMPNksrhwwW5c/wtHrUdKAqZr7Qrt6hSQYttB74jrj9D2Ydhwewv1zjNG4TyKSypGS4DIM2VLfMBbFBuvE2xx/gCemuEqekE2Y9hmMmdagSkzMphAi24Wxhl1m0TjR3gdhdPySw8= 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=AZtDuAlC; arc=none smtp.client-ip=209.85.214.177 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="AZtDuAlC" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-221206dbd7eso14592515ad.2; Thu, 27 Feb 2025 04:10:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658257; x=1741263057; 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=KJTm6Cfm1kOySDY4DzJRdMnhEPIVa8nplOZzWQzwX04=; b=AZtDuAlChtrgaFM1dekz5OgPiLtod96KIM5FMJ6cFGKWuAg5DVxkgLQ+B8sWmDfnia FFhLnhkeM5yLdWaD55ocXYanGb1d3c6LHlcMiDrA1ZNOgLs2S6+bvIGMISWIvWmlEY8e EF/2WlUY58aSZezGqhYhIuP8k5zHcQjPrsLqPqm0WUubeWMCCmOrXN+qNQtzpUC6U2Td U/+1Da5RLEs8GKBPuKuuWIu2eq/w1//4I8asDKLjtu6ZdAZGd3y7i1dOdD+dRrZzIYxL G7c94zzJmsFXG6gJdZ6vNTDS9BIwc9beHsJNv7ZD/WO17+vnoG5vQGka9FbpYIE0vkFX gSqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658257; x=1741263057; 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=KJTm6Cfm1kOySDY4DzJRdMnhEPIVa8nplOZzWQzwX04=; b=foHS4IT7FJ/f0u86RYpKdsAyznvKbtHRU3BUW4ZbobkTGiZNLU5SvUoOO3KwTyBMHO 3vUXc5PzP2Ma7pW7ESoWLlIj54JTiFu9OGxR+Xf2in4LB9W0tA2tgfVzvORqNPvr2RHz VKuQPqjWUhKX/yeEz6AyYya0kplekCXrbhBQmNkgCH0Eju1bIVr7+xAEILuHg3Nq5cAQ /fZiMcipJqClyD5WRUrlDYAFAYI+w2ZojvDPeyyDf2Bofkiy6P82OWF5yeYFsARcAqkE owgNynM+KG1K4FBfiT5JJGihUtmKFHTbWS11BdNWCKA8AmFcDxI5zNGd77OU+gWtts3X WYAw== X-Forwarded-Encrypted: i=1; AJvYcCULjCQhgEscnl2KsIZmLamDkHLM3pveP0q9qPDf1Jmz1DeRZVmKlYmIIIfXwhPpLXTExLHHJHaWasuk@vger.kernel.org, AJvYcCUnYySXKO0zCCQtgny+xywJ9DqoDiGe04ZF+9iohd/ua1HrRXx5dyZNoBytcfKmDbf0ZmYdLz7dBGIakDc=@vger.kernel.org, AJvYcCVLaukmiNi1zZwwe5W5gbeA28D0pbssZt45SwbuoyYNIHydvob4J80QMTWKj1rtA79FF7KSUqswoQK+rZeQ@vger.kernel.org, AJvYcCX3BxQGyW2Ao6T05U+DPEY3mememOQVeqryfrS6mPT5U4qgC8jtiPU87sJitTYJp2dN3pXey1A6krxdSI0=@vger.kernel.org X-Gm-Message-State: AOJu0YzIXwFfgpbwf4EfK3C6pgxor99gGCKh53P8sVE2CkIMvTR0PRiy d3Eun1bq3n8kMQgKKR+aZKamxSP3CbeIsoyUvxuH46V1FuAfN3hP X-Gm-Gg: ASbGncvlWx8YodrrROQgen265qy0DRl5Xal1hv8/Kvq3vA9wsL8TgXKCmO/i3nARb4X xq0WmMjtVvTE9Utanqoi5/dg2vWk7BXiAHD1PE877iYmee1VNzLwoerUI5Q+xe2vgwc5+kLYBk+ Ts9LBk4jfHbiO4RyZPRTL2AFF04Hv+szSMH0WZOWJ5x96ZfsFjk8gLF3kRis+KtHXWq+LWoicJz naI0PBRm6VmfwpapJ6Bicc+Ktqp3HIJ0te5iRKzzOaCtkY+KSPcbzwQbhrHiw5yMLNW1RuqqVI/ 1bOD3tR+Mts7QJFjxrnQrqeQmsivMIdUtCNAw4GR+p3BREJPwMHNAAUM8sPJh4q6vk3nEyEY9BF lskjdqg/LmIDlcpS+2JxZ X-Google-Smtp-Source: AGHT+IFoh/t7q9w0OOWI5lPWhEYDWQjOP6fwyanC4umHXD3Z3ogI4emvms7MREgszU4VmoxeyK67ew== X-Received: by 2002:a05:6a00:3d0c:b0:730:9242:e68 with SMTP id d2e1a72fcca58-7348be7ee95mr10144318b3a.23.1740658256980; Thu, 27 Feb 2025 04:10:56 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:10:56 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:43 +1000 Subject: [PATCH v3 16/20] ASoC: tas2770: Power cycle amp on ISENSE/VSENSE change Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-16-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2687; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=er/NvEhNNS1LjFLGs7pKaGt0I/0LUg0k5iDGaFhFgS0=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk+X57cw6iW/6NlTlV684+CiqxUKnPEOv1/P+vBX5 v9shxflHaUsDGJcDLJiiiwbmoQ8Zhux3ewXqdwLM4eVCWQIAxenAEwkLp2R4c3pVSt/XItr794V zx6vtNQ4KPXTzLz1V6a+i1ebl68s+J+RYfX2XxU6h3IWZcqq1hU/UJ4e72fDdnpdeGzv1MB/trI svAA= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Hector Martin The ISENSE/VSENSE blocks are only powered up when the amplifier transitions from shutdown to active. This means that if those controls are flipped on while the amplifier is already playing back audio, they will have no effect. Fix this by forcing a power cycle around transitions in those controls. Reviewed-by: Neal Gompa Signed-off-by: Hector Martin Signed-off-by: James Calligeros --- sound/soc/codecs/tas2770.c | 30 +++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index 9cdd3470e9a04d5a5f801c3690d40f8fd131cd94..787356a4f4256627a55e35c851a9e78a1cf29771 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -157,11 +157,37 @@ static const struct snd_kcontrol_new isense_switch = static const struct snd_kcontrol_new vsense_switch = SOC_DAPM_SINGLE("Switch", TAS2770_PWR_CTRL, 2, 1, 1); +static int sense_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component); + + /* + * Powering up ISENSE/VSENSE requires a trip through the shutdown state. + * Do that here to ensure that our changes are applied properly, otherwise + * we might end up with non-functional IVSENSE if playback started earlier, + * which would break software speaker protection. + */ + switch (event) { + case SND_SOC_DAPM_PRE_REG: + return snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, + TAS2770_PWR_CTRL_MASK, + TAS2770_PWR_CTRL_SHUTDOWN); + case SND_SOC_DAPM_POST_REG: + return tas2770_update_pwr_ctrl(tas2770); + default: + return 0; + } +} + static const struct snd_soc_dapm_widget tas2770_dapm_widgets[] = { SND_SOC_DAPM_AIF_IN("ASI1", "ASI1 Playback", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_MUX("ASI1 Sel", SND_SOC_NOPM, 0, 0, &tas2770_asi1_mux), - SND_SOC_DAPM_SWITCH("ISENSE", TAS2770_PWR_CTRL, 3, 1, &isense_switch), - SND_SOC_DAPM_SWITCH("VSENSE", TAS2770_PWR_CTRL, 2, 1, &vsense_switch), + SND_SOC_DAPM_SWITCH_E("ISENSE", TAS2770_PWR_CTRL, 3, 1, &isense_switch, + sense_event, SND_SOC_DAPM_PRE_REG | SND_SOC_DAPM_POST_REG), + SND_SOC_DAPM_SWITCH_E("VSENSE", TAS2770_PWR_CTRL, 2, 1, &vsense_switch, + sense_event, SND_SOC_DAPM_PRE_REG | SND_SOC_DAPM_POST_REG), SND_SOC_DAPM_DAC_E("DAC", NULL, SND_SOC_NOPM, 0, 0, tas2770_dac_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), SND_SOC_DAPM_OUTPUT("OUT"), From patchwork Thu Feb 27 12:07:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994314 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 4A25A22E3F0; Thu, 27 Feb 2025 12:11:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658266; cv=none; b=IIIp4+/k5V2eo/PAADhYFx4v9fsxw+jqpmIF+ew+OaHf+yp3fuX+tRZx3pvZ5bsxhG/YIG3Ou/rlWq5UQtm8+fFHeCYemRldwqlP4cAwOXLzMeWCoAMVvHxYowexHQxYhSSJdEixshiG6KoF6PWlm19ZuvcFJpxYgoQ6pz99SVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658266; c=relaxed/simple; bh=/RBl/n6L6PnMSvwkD9NDOgKfGZgMZ6zIjb5wTfrd6qk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H4oaK+OfEllYQwgTyhcfST3Wa1ZjmsPfFz548SStVuU2alb2Hu6u9C1520McHZNhsMKKosyZqk/KaN+GOcpS29K/KZmuTtC8jHPIKNIzsQFPO03XlXyqVA0rkxEcjvihhkQApGLdDWtWo6ZLuNrp61sgqFmZ57G/K/rmhQYPW0Q= 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=jyFM+l00; arc=none smtp.client-ip=209.85.214.176 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="jyFM+l00" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-220e83d65e5so13893715ad.1; Thu, 27 Feb 2025 04:11:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658264; x=1741263064; 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=d0owHslE6nWanzH0GNiSDvqoqhw6dc3ByeCKi8kxRyA=; b=jyFM+l00iSjN6WHbV+UyROCkhFYZCJ20QxspOlh9KQji3lQ9nZx5d6ABdGG/AEKyyH zldUyownMN7SXngeghC1IZmdcnimB8YND6PuxbHmWX/ouHGxszYuZftygWAt9u7EctUX ZV/Tlfa+n7fp7lEsGanfBiuK/OshzvqPrCLWR6pAVGt0zRxdsFt5hbEDlydIIjWMcOAe bbSdQuIoMEdcDyYyW1+7bxXTX8XahEIbfqius/2+qqcbFKGGmhsT1ZBTbhfLXp4yfrks qXNh2exFp2EfmBup5j685RKKxjCfg0QLU7h10RYyvK+E6Y4lGNw44k8luCFOa4fGKI1k Zu4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658264; x=1741263064; 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=d0owHslE6nWanzH0GNiSDvqoqhw6dc3ByeCKi8kxRyA=; b=Iy5X25f9dXycJv0Puv8B58GlnVM8WY0fDBnnVRudxT5RjfQbeEBc0jIOYIcYiY+tlF Wnk9yNPB23WgwCacqZkWjvIZTNw6olHiYh0ayWQHE7aPQOYij7VQ19hfiidFkZLt3XWA ranjrnv4+enFUqAif9GJ5ejVo4fhUQG3TxQ7Nxh2P4VVv3fGFZFt9pncR+kN9d5yDbN0 +9O2veoA15oQB+kBHhdBbeKVR+lmBc1sWeMOMKvvAfP0BKY6KKvlwiFtFMU01p6Oodnk 2a+C4dq1ZJtZp1e9yU1n8T70CwK+DnrwV0TGLFYGZtgNhdReMoQh+pA9oTX9vuzg8Z5y tUpg== X-Forwarded-Encrypted: i=1; AJvYcCUQn7HZz1ysmqwxCxPuUT5uZQMJoBK4zaWQT/GSk4/bvixK+2yyRZsj4BuBJCWonSnmSTqFu1yVSO36b4k=@vger.kernel.org, AJvYcCUk2sNT8CJLTvJVWVeUbf6dhNWhGTdHmjmMt7cJHJe34dWTU8dxFOfC9/Wu0G0lBA+R3H4pMhNBuHFDTDA=@vger.kernel.org, AJvYcCV6O2yqHWi9HReR+IdJ3aRY0ih1ibFIMXGURMUWGUYWp24vf5L4MZoyqLYkM5GoHfOoCbB+naVOteJa5NAG@vger.kernel.org, AJvYcCVY4vHDsBUV9J0u0iEOFoKp4TyQ272qX1gYXvSQytlme+057fa5/oPswzcy5Cx8JJUrBaNoiEMgQDJq@vger.kernel.org X-Gm-Message-State: AOJu0Yz5UDfyfyIHttcxdGTCAWdLon8Ido2QGWub1lkWruGu5EGx9awS 21oVZZe/lMflhyUZ2lPkfv9eMQNHdw/jhpcQMRlFNysc0IpTtGGLuvieNPkF X-Gm-Gg: ASbGnctP81vM2WyDkMlR1gqK9aConK9etPcqZimPFDiTk3XQi60AYoiyGn2dfG7jjdN mMilq+HZCsGFOMEoovGyTosScVr/hdBCwTs5kCfuX/qYyQYwuk/SHLByU3kR/YvvXtOWtN6Otvz Y+l1al9K+FfHqplp3VwTsLOGu5M5Xl7T34NB8pqqMV/WP0+SitXm5xBfUrBoYKRsQmkPYSE12xQ p8zDRCn/CEpkb/p58z5Xfcpt4crBFyVoT77r3tfqzoUE/FWGaJR1vVCP/ay099eklGlfRa30arQ 8wBiCsmmhbMlV2KGsJCfGgNBepuFL+WMsM1XSIUSLtPfszhs9c50miVOQL44gGhcF+flQQDeu8+ gvUIywWD75ioh/TrYFdqq X-Google-Smtp-Source: AGHT+IG1QYwei29YHGRdLB2VD8ypHlNGKmJouxhIvqFkj+dv5HEWcDyDzQ8liiu1IfHNMqF+VKMzNg== X-Received: by 2002:a05:6a00:928a:b0:730:9204:f0c6 with SMTP id d2e1a72fcca58-7348be2cbbamr11394198b3a.16.1740658264560; Thu, 27 Feb 2025 04:11:04 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:11:04 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:44 +1000 Subject: [PATCH v3 17/20] ASoC: dt-bindings: tas2770: add flags for SDOUT pulldown and zero-fill Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-17-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1333; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=/RBl/n6L6PnMSvwkD9NDOgKfGZgMZ6zIjb5wTfrd6qk=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk9/DfJ+/pBN62LpLO0lSpqSr+M1O9MMgk3Upgrss Z57I/ZeRykLgxgXg6yYIsuGJiGP2UZsN/tFKvfCzGFlAhnCwMUpABMRjGdkOLj/tPffHnNVnkvH LzFOc9rz/8GTZWudZ1ueNq46G3oz9gjDH373B91r7Sb9aQ9frJ9QX7j5gpzphnJVq8drVrxU+3p RnQsA X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 TAS2770 can pull down and zero-fill SDOUT when not actively transmitting TDM slot data. Zero-fill is useful when there are no other amps on the bus. Pulldown is useful when the chip is attached to a shared bus. Signed-off-by: James Calligeros --- .../bindings/sound/ti,tas2770.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/ti,tas2770.yaml b/Documentation/devicetree/bindings/sound/ti,tas2770.yaml index 8eab98a0f7a25a9c87d2c56fd0635ff8ecee17d0..3eba9bb34a581526f68b6bf2e8437e1f1e03d26f 100644 --- a/Documentation/devicetree/bindings/sound/ti,tas2770.yaml +++ b/Documentation/devicetree/bindings/sound/ti,tas2770.yaml @@ -57,6 +57,18 @@ properties: - 0 # Rising edge - 1 # Falling edge + ti,sdout-pull-down: + $ref: /schemas/types.yaml#/definitions/flag + description: + If present, SDOUT will be pulled low when not + transmitting. + + ti,sdout-zero-fill: + $ref: /schemas/types.yaml#/definitions/flag + description: + If present, SDOUT will be zero-filled when not + transmitting. + '#sound-dai-cells': # The codec has a single DAI, the #sound-dai-cells=<1>; case is left in for backward # compatibility but is deprecated. From patchwork Thu Feb 27 12:07:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994315 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 365F822D7BE; Thu, 27 Feb 2025 12:11:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658274; cv=none; b=E+Etr1GYITCDb4Ta8EppUqRx4jxv8DRLi5N/xl8munVqDU/AEEp/IQGt9MnbUlo6i30A6+/J29aGf9VdndMcqoWmXBQU1PYCHZYDcjKMYOxoBK5eYeak2pBg7opLKV549iK3NJovX8bAk98nNECkoLownGwI4dfLiQAe0Kn/RcU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658274; c=relaxed/simple; bh=yZydHPNdGIYsVnf3K1xg5E1giRrWR5AHZC+gJLTWWDI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jXOB7kwLV8yJo2DJB1fCrcAKvWmIaYeod7JTxYGgDt/JooW0CH2zFKacWgARXlTW1JbjYKxoQfdLQWYEACY1XfiaIB1YwRkbaJOf5hHDCTdaPZHOSOAnobu0wA+bx9i0F9p0K+fCY3cMN9Ec1lPaTQZ0MzHuyrkblmdReQwSH3Q= 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=N2RSV8il; arc=none smtp.client-ip=209.85.214.171 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="N2RSV8il" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-220e83d65e5so13895995ad.1; Thu, 27 Feb 2025 04:11:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658272; x=1741263072; 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=6MIMx3In11Gk8ks7z3N/b37m0dqaRTkRDgguGpWwk9w=; b=N2RSV8ilvA+kTW2YdVUfVG7yWVAoSZ8YDioLJDhmFjpaRK0s8XN1Jk6VJf1js6zzdN UJRAbynf27GomPBIrmATai3+mSTazp0U8uvsimL8v6ohBmet4x9VZalxC7XAtW1HJWC6 a2KKgEzP/VNOM4yKfzZXNXFpaJFmWHHDMuia0HSzb/Eg9FsWiVBUczMURD21KdWqTVjk 9QjdXUZ+jJwnAJ921v84uVTcD1UdHYyZhlY56vUGp0IK+0wbJaXpp2Lu6Lbqc+/9DgAf tbSMplY3nfcsP6ex1S4Z93b81Me7uJkx7A4qjCN+BV954yEph3XfQTuHMfEyQjwd/Kn2 nY5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658272; x=1741263072; 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=6MIMx3In11Gk8ks7z3N/b37m0dqaRTkRDgguGpWwk9w=; b=CksCIX9fdgxnCdTOsnI1jO61pujqEXlpLMIRNIxt9VSe3VervLP5t6+e0Wbbr7dia1 eRsjgNwPX5wqqKGjeZRpA9KlqHQPWpl3rDqDfjZKkTzK0ywT33qgeoHGRPARI4Md3Xva C2LqLe8B9qYcuibdhtY0kiS+nNb1RlWVojMdSyO+s3cA8uPQ9CCIhha/LFRtXSUR9cLI Vwf/jIyi02qU83y3gw+1jZiu1hQ+y9ZFezpw+cjsAeoJ1AIUk+temoOGOAMsXAG1VOTL LSlVP08DdXg9g/G+aJ3u/YDMG8Mg0uPrIO4IgpXjwQOgL/aqyWQqpMOIt0AJpm0cLPY5 hOmg== X-Forwarded-Encrypted: i=1; AJvYcCUNCfErXQ3oMjtVmEB2MMv/xCO+DSpQ1+71EZXmnROCzK1NCl0J0OLOlCPSVSf7OdtNnQL57HVRcAvvLhU=@vger.kernel.org, AJvYcCUgX1zjOdWuzgXi3Kb7uz0C2ebuFKOieo1aVHY4yJZie8y7qsf7yjrXTzG+eK31t9meHmphcn8MMOKzS74=@vger.kernel.org, AJvYcCUojlDMWdhWh8Chs7avjf+kzVOP0MhieAlOxpW7U1LGslQBZT5oGZvJ2zZFSc4loshGaFhHMwyN4XjWDA5K@vger.kernel.org, AJvYcCWcF0WhH6y4/kuNrOfJp1lfv49AWVzxiUDhw0NFkGOxFlvC9OxvsXL0XrUE45b8ayvx/zGtq9NIaMRD@vger.kernel.org X-Gm-Message-State: AOJu0YyEa3t39jHWMbOMGV6TZMcBOxJzPke3D5xHgwohinHLUFrD/fJn M/oME6oSrQ9/S5CkaEfJt5oGJFMwbTc5J5e3qOJR52ZwtwtUJxHj X-Gm-Gg: ASbGncvSn1bodsX+nS38hqW9az5F+AW78zUc1zeSWpUTtKW4Zp8TCWqREMuYWz/35z/ 2lPNvPz7FaSxtBnVqnKoqXG7Mg49aM99uZgc9w+D4FaddTckcMbUKmZWr5NhT6fAduVuA6VDHCL 4gpuRLSmcc2eO7+hchEXp9GnhURRP2LYPfNRiUfvX3Zb7dq5MAHFnfyEz5sDKsZpxycpv4VW9CH kPE6GMrVzttmT8287dsc1U8Roq8kn66hmNWHr26CsZkURF0VF2deV0vneD/wEhVJJzIrXac6Y5+ A3omxyBoJBVsboadQUGZZ/PYSR4m7P6KsMkSm0/T3RpZq4vAceDt0r2SqTOQSWrkO3TtR+nHV7y BwhX/QTVrfhnsQjHyKk8m X-Google-Smtp-Source: AGHT+IF8lzuWjspI3rZZ0uV71kzeqQ26k28SoHirl/vgYdWn55Xm/H8mpRaOkg0dIY3LwKc5KspWVQ== X-Received: by 2002:a05:6a21:6d8a:b0:1ee:afa2:4e59 with SMTP id adf61e73a8af0-1f10ae73256mr14523491637.36.1740658272425; Thu, 27 Feb 2025 04:11:12 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:11:12 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:45 +1000 Subject: [PATCH v3 18/20] ASoC: tas2770: Add zero-fill and pull-down controls Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-18-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3560; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=4TvbG9xciteBIsrWMUMKaDHyIsLMWBeBIr/XFRJjgig=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk/v4eC12p1fJPXYbPYBnmZ3a76vRyZ+bFN65L29a u6rwHfMHaUsDGJcDLJiiiwbmoQ8Zhux3ewXqdwLM4eVCWQIAxenAEzkEQMjQ4dGQsCuPqZPbAvl bne9lptaPk9sb3NxOdsVE4fJG0wWfGJkOND2a4uuvM/RtVwHLAo/v2plbm27Ke4aLvtQrXfblw2 mvAA= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Hector Martin Expose the bits that control the behavior of the SDOUT pin when not actively transmitting slot data. Zero-fill is useful when there is a single amp on the SDOUT bus (e.g. Apple machines with mono speakers or a single stereo pair, where L/R are on separate buses). Pull-down is useful, though not perfect, when multiple amps share a bus. It typically takes around 2 bits for the line to transition from high to low after going Hi-Z, with the pull-down. Reviewed-by: Neal Gompa Signed-off-by: Hector Martin Signed-off-by: James Calligeros --- sound/soc/codecs/tas2770.c | 17 +++++++++++++++++ sound/soc/codecs/tas2770.h | 13 +++++++++++++ 2 files changed, 30 insertions(+) diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index 787356a4f4256627a55e35c851a9e78a1cf29771..252c65ae839a28fdaf7aaa39faf49891905741a0 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -632,6 +632,20 @@ static int tas2770_codec_probe(struct snd_soc_component *component) return ret; } + ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4, + TAS2770_TDM_CFG_REG4_TX_FILL, + tas2770->sdout_zfill ? 0 : + TAS2770_TDM_CFG_REG4_TX_FILL); + if (ret < 0) + return ret; + + ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD, + TAS2770_DIN_PD_SDOUT, + tas2770->sdout_pd ? + TAS2770_DIN_PD_SDOUT : 0); + if (ret < 0) + return ret; + return 0; } @@ -771,6 +785,9 @@ static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770) tas2770->v_sense_slot = -1; } + tas2770->sdout_pd = fwnode_property_read_bool(dev->fwnode, "ti,sdout-pull-down"); + tas2770->sdout_zfill = fwnode_property_read_bool(dev->fwnode, "ti,sdout-zero-fill"); + tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); if (IS_ERR(tas2770->sdz_gpio)) { if (PTR_ERR(tas2770->sdz_gpio) == -EPROBE_DEFER) diff --git a/sound/soc/codecs/tas2770.h b/sound/soc/codecs/tas2770.h index f75f40781ab136cccbe1c272f7129ddd3e4a22a3..7da60d2746e8b03faa9d17319c4c41cad7f8cdbd 100644 --- a/sound/soc/codecs/tas2770.h +++ b/sound/soc/codecs/tas2770.h @@ -67,6 +67,14 @@ #define TAS2770_TDM_CFG_REG3_RXS_SHIFT 0x4 #define TAS2770_TDM_CFG_REG3_30_MASK GENMASK(3, 0) #define TAS2770_TDM_CFG_REG3_30_SHIFT 0 + /* TDM Configuration Reg4 */ +#define TAS2770_TDM_CFG_REG4 TAS2770_REG(0X0, 0x0E) +#define TAS2770_TDM_CFG_REG4_TX_LSB_CFG BIT(7) +#define TAS2770_TDM_CFG_REG4_TX_KEEPER_CFG BIT(6) +#define TAS2770_TDM_CFG_REG4_TX_KEEPER BIT(5) +#define TAS2770_TDM_CFG_REG4_TX_FILL BIT(4) +#define TAS2770_TDM_CFG_REG4_TX_OFFSET_MASK GENMASK(3, 1) +#define TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING BIT(0) /* TDM Configuration Reg5 */ #define TAS2770_TDM_CFG_REG5 TAS2770_REG(0X0, 0x0F) #define TAS2770_TDM_CFG_REG5_VSNS_MASK BIT(6) @@ -110,6 +118,9 @@ #define TAS2770_TEMP_LSB TAS2770_REG(0X0, 0x2A) /* Interrupt Configuration */ #define TAS2770_INT_CFG TAS2770_REG(0X0, 0x30) + /* Data In Pull-Down */ +#define TAS2770_DIN_PD TAS2770_REG(0X0, 0x31) +#define TAS2770_DIN_PD_SDOUT BIT(7) /* Misc IRQ */ #define TAS2770_MISC_IRQ TAS2770_REG(0X0, 0x32) /* Clock Configuration */ @@ -138,6 +149,8 @@ struct tas2770_priv { struct device *dev; int v_sense_slot; int i_sense_slot; + bool sdout_pd; + bool sdout_zfill; bool dac_powered; bool unmuted; }; From patchwork Thu Feb 27 12:07:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994316 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.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 0C04422D4E4; Thu, 27 Feb 2025 12:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658282; cv=none; b=XGrFbxMivAXI5gn0r2WmBtoqa1otZ+sI3ZsBNg6JTDj1L6pxRzTuIdrWV3VWWlC40D4su4HlstljS66kgnvLBWXWofWI4sa6evym2UT7QdIYx5G94Wsdhj55OaGz8sl9YyNlGJyzFrWKwpyjdlXy0PBi/qX2zp2PTHsVXlcvDIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658282; c=relaxed/simple; bh=FmMYAaS0g9J/Y51FxpyJGJEmlvFEqGFqqETx+r/xGj8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P+xK7Yuaf0vsRltPX54BkwqcUTosAimTbqipx+fg5g4GCAlzb2NQQKmB5kgqYGejatzsWeoc7B7ZtdG/dHUjSJmxMLiPc4TlWWMnZOQ+050cUzKRP+qdCjdM1cy70WCW/0KNEfBDFDWHK2RVwwtUDBJuW8mkIUwpNT7brw8OS9g= 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=CV8zVQFB; arc=none smtp.client-ip=209.85.216.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="CV8zVQFB" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2fea47bcb51so1391672a91.2; Thu, 27 Feb 2025 04:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658280; x=1741263080; 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=dp1zmiq9Lyv1s5sJ8tXVmv/9N0Pmr+pQll2ckpeefQc=; b=CV8zVQFBAI+hCE4raRiT36trwGyFHg/P/PwVLxkIniIACz64Hof7c0sJ8E5us67hzG r9LggdBP4/h3WY3CygSSPPeVVIZsdZqqsdkgJT7HxkfZCCf3uVSdGI6YBAbhB9iiXElW o9Jx6zM3aUbMqieyDGntjJTaKkIOr+bFxJlduKv1ZbyDpGDr+0uBt8s1U41UYYBqDoUq ASMghk9vVwda3N7AcwkM+Jqb1j7kypB31K9bPMd1EPsTs+2jebBbl4r39tql5OTZ5SUW sMBbWv23Yr+gWHvCyMqSGa8FjpPq3gc9P6EO++auXEgXfVcWhpJi4WTwEXnJVhB8Y92u Vj7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658280; x=1741263080; 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=dp1zmiq9Lyv1s5sJ8tXVmv/9N0Pmr+pQll2ckpeefQc=; b=XoknqwfRaY9wmH/D6PlzZxwtkY8PbzFowodcQLUjeoi+GQ3QKtEdWLxexWuA3OY4da fXFyoZnFDGI6ropREi07xZ/XpOaET9VIvu5Zh2A/YZck5VTsCFXQx22BdPI//r990zgG nOo6BEm7zluBVmy7iVtdFN9xLDuBvj+Y3aDIDWe2IUx4/MSMA0nKrJoJi4pavhDJd9Zz 3YwxR9FGpD5ZhZbi4Zc3nBNthIi5m31QVL9LvuRl1B7HVyo8xlbzze3FYp8INbL6Rj73 VIvaiYbsU5v/hPfJP5/h4KUYoIPcTMr9jYqUopRWAahvJ9518ykWieBrRR5eYGVuxOeL 8YwQ== X-Forwarded-Encrypted: i=1; AJvYcCU+1b5NuI8vSoYKFS8/YxxB2tKPUy5DkIHBohrE2UT5gyv6KM+cd8CqFs6Sjl74No7Tp26OzH4q8O0DynQ=@vger.kernel.org, AJvYcCV1D5gLZtFEy1/t5t6/6alXeR5bjLlNvjxbP69CiVSZOlV9VsEAFbZ4jpbNScTNTBXq55IYTN96i5TQxRs=@vger.kernel.org, AJvYcCWXkWOEQ9QaXTNavVNcsuSnRHR7JZ7ZYYMy+YcW1SJmX/SR2xvhC6kOuOgh4eNPfERv941EJ+s5kNlAebfq@vger.kernel.org, AJvYcCWgBL8kiJ2UcQSSWXwIk/+fOWWHmaSNhEiL9JpsQyV9ilQhepgWK0vZU7GUXzx3jdbAhW4fOuJzIaI6@vger.kernel.org X-Gm-Message-State: AOJu0YzkOzyvtvZs5PdpMym5aAW9cHTpb39vBfmV74MS+X9thrOw9oBj 2uNiagPQn6J7wj/L+IgLjtHMFBZ/EWCKS7hn1km+zFAwfdVSIYPz X-Gm-Gg: ASbGncsZHbLIoJ3BpFWj+ZKWBodUvATMS4ClThkm19PDhNXWXVBvLBa3obxn8dfXUau HD2C6ZYFmIvDnI7IMwlvBdc2Cbr4hjwH6EOUL3VNgPAhfBySaDvcx5cZ4z6K4sqHI+iWsvyJ5yN fMP2uKUqzm1oGHRujpy4BQsPtbwhTKX3ZgCUNFhCkFH3PkDbkV+MmW/49wAxfkdhx0RY8zD8M79 v43MSXyIapIxBOmhzijYLDfTieTCI7CUWVOFdk62Nb/JXnrbesnEgl5MVixAGL0mkjwDr3OGqOC LSY7Aa2Kt01IlA6o7RVT417/auReVVmlSr+vGQC/HWkD02x9UX1dDgfw8MO64UV66V875zfXtBQ QvipL6BNTaVGLsBtu+gdA X-Google-Smtp-Source: AGHT+IGpceu1tOQHfCnl0k/McKg/rkJIBO+eKPlsv8uvLRXGOBMSYn6SVeyGkAGz/eHQjVjMJB/HMg== X-Received: by 2002:a05:6a20:6a1f:b0:1ee:db10:a4d3 with SMTP id adf61e73a8af0-1eef52cc902mr49320507637.6.1740658280280; Thu, 27 Feb 2025 04:11:20 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:11:20 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:46 +1000 Subject: [PATCH v3 19/20] ASoC: tas2770: Support setting the PDM TX slot Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-19-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5050; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=aDEXw+GguL10lbhJbopfCU5mJGnX7ZIfIEW40Bd3gCA=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk/XN9RO4nM1Wn+n5L+D/obNbm1Syw68yedUdnRZe c7AdVVXRykLgxgXg6yYIsuGJiGP2UZsN/tFKvfCzGFlAhnCwMUpABPR2sXI8FnO6HjCrgl/upP/ mr00mfN4/fziAFfZ40yXGfgsZax4zzL8U/2zRif2wZwpk/b073qa/0Ym2bEsvugex9OGyQt3Vfk HcAMA X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Hector Martin We don't actually support configuring the PDM input right now. Rather, this is useful as a hack. On Apple Silicon machines, amps are split between two I2S buses which are logically ANDed internally at the SoC. Odd and even slot groups are driven by amps on either bus respectively. Since the signals are ANDed, unused slot groups must be driven as zero to avoid corrupting the data from the other side. On most recent machines (TAS2764-based), this is accomplished using the "SDOUT zero mask" feature of that chip. Unfortunately, TAS2770 does not support this. It does support zeroing out *all* unused slots, which works well for machines with a single amp per I2S bus. That is all, except one. The 13" M1 MacBook Pro is the only machine using TAS2770 and two amps per I2S bus: L Bus: SPK0I SPK0V Hi-Z Hi-Z SPK2I SPK2V Hi-Z Hi-Z R Bus: Hi-Z Hi-Z SPK1I SPK2V Hi-Z Hi-Z SPK3I SPK3V To ensure uncorrupted data, we need to force all the Hi-Z periods to zero. We cannot use the "force all zero" feature, as that would cause a bus conflict between both amps. We can use the pull-down feature, but that leaves a few bits of garbage on the trailing edge of the speaker data, since the pull-down is weak. This is where the PDM transmit feature comes in. With PDM grounded and disabled (the default state), the PDM slot is transmitted as all zeroes. We can use that to force a zero 16-bit slot after the voltage data for each speaker, cleaning it up. Then the pull-down ensures the line stays low for the subsequent slot: L Bus: SPK0I SPK0V PDM0 PulDn SPK2I SPK2V PDM0 PulDn R Bus: PDM0 PulDn SPK1I SPK2V PDM0 PulDn SPK3I SPK3V Yes, this is a horrible hack, but it beats adding dummy slots that would be visible to the userspace capture side. There may be some other way to fix the logical AND behavior on the MCA side... that would make this unnecessary. ("How does Apple deal with this"? - they don't, macOS does not use IVSENSE on TAS2770 machines even though it's physically wired up, but we want to do so on Linux.) Reviewed-by: Neal Gompa Signed-off-by: Hector Martin Signed-off-by: James Calligeros --- sound/soc/codecs/tas2770.c | 25 +++++++++++++++++++++++++ sound/soc/codecs/tas2770.h | 6 ++++++ 2 files changed, 31 insertions(+) diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index 252c65ae839a28fdaf7aaa39faf49891905741a0..58f36cf471a6b7dd15c1b0600710396de4e2f61e 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -241,6 +241,19 @@ static int tas2770_set_ivsense_transmit(struct tas2770_priv *tas2770, return 0; } +static int tas2770_set_pdm_transmit(struct tas2770_priv *tas2770, int slot) +{ + struct snd_soc_component *component = tas2770->component; + int ret; + + ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG7, + TAS2770_TDM_CFG_REG7_PDM_MASK | + TAS2770_TDM_CFG_REG7_50_MASK, + TAS2770_TDM_CFG_REG7_PDM_ENABLE | + slot); + return ret; +} + static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth) { int ret; @@ -632,6 +645,13 @@ static int tas2770_codec_probe(struct snd_soc_component *component) return ret; } + if (tas2770->pdm_slot != -1) { + ret = tas2770_set_pdm_transmit(tas2770, tas2770->pdm_slot); + + if (ret < 0) + return ret; + } + ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4, TAS2770_TDM_CFG_REG4_TX_FILL, tas2770->sdout_zfill ? 0 : @@ -785,6 +805,11 @@ static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770) tas2770->v_sense_slot = -1; } + rc = fwnode_property_read_u32(dev->fwnode, "ti,pdm-slot-no", + &tas2770->pdm_slot); + if (rc) + tas2770->pdm_slot = -1; + tas2770->sdout_pd = fwnode_property_read_bool(dev->fwnode, "ti,sdout-pull-down"); tas2770->sdout_zfill = fwnode_property_read_bool(dev->fwnode, "ti,sdout-zero-fill"); diff --git a/sound/soc/codecs/tas2770.h b/sound/soc/codecs/tas2770.h index 7da60d2746e8b03faa9d17319c4c41cad7f8cdbd..8a208cee8712cb28422dd10cc5d80c460666728a 100644 --- a/sound/soc/codecs/tas2770.h +++ b/sound/soc/codecs/tas2770.h @@ -85,6 +85,11 @@ #define TAS2770_TDM_CFG_REG6_ISNS_MASK BIT(6) #define TAS2770_TDM_CFG_REG6_ISNS_ENABLE BIT(6) #define TAS2770_TDM_CFG_REG6_50_MASK GENMASK(5, 0) + /* TDM Configuration Reg10 */ +#define TAS2770_TDM_CFG_REG7 TAS2770_REG(0X0, 0x11) +#define TAS2770_TDM_CFG_REG7_PDM_MASK BIT(6) +#define TAS2770_TDM_CFG_REG7_PDM_ENABLE BIT(6) +#define TAS2770_TDM_CFG_REG7_50_MASK GENMASK(5, 0) /* Brown Out Prevention Reg0 */ #define TAS2770_BO_PRV_REG0 TAS2770_REG(0X0, 0x1B) /* Interrupt MASK Reg0 */ @@ -149,6 +154,7 @@ struct tas2770_priv { struct device *dev; int v_sense_slot; int i_sense_slot; + int pdm_slot; bool sdout_pd; bool sdout_zfill; bool dac_powered; From patchwork Thu Feb 27 12:07:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Calligeros X-Patchwork-Id: 13994317 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 CF16622D4E4; Thu, 27 Feb 2025 12:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658290; cv=none; b=RiABzV6uMyUiHKGvR1dQf0+svqTU9+ysxGaIPEg3kfQr7a1A5wsJcRN/smNgKjb21WO3iuQKM8sQNEfp61ZIDOAkc4iJeX96LEfIhChJLGKlnL4UC0tbxdYRfhdj6W+o1xdN7CGpu/AFgFlxer9ZsuJm2lN17MdZRYgNpLcVc1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658290; c=relaxed/simple; bh=Sd3QdDEgr83Fg6PxxgYQ9P4zyv6jCRBeVjY/d6AX3g8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hf9Mb1ZPE81pjpeUAtK2lUOx8JOki5HwoDJeiRLqGEhgQjfsIrcUFLEsTF5IanHgIR+M9RkXXxFm1omZO4FIWTsVkoP+QHvpHvSX1roW4LMfHMvL8EIK7FgGe6vY+OFl+QZ4Mm5YPYkrPQAIWdFic0hi3W8tbxbD51Nh/peYLWo= 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=efDdgJM1; arc=none smtp.client-ip=209.85.214.174 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="efDdgJM1" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-223594b3c6dso6584245ad.2; Thu, 27 Feb 2025 04:11:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740658288; x=1741263088; 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=iEzzB9qVJ3Iw6yE+IGNZV4gwcPeMNS9a9nupNaDYjZA=; b=efDdgJM1euJwjUZWrcB0NkFb0bK1NyU4e0BZ5P/0s/wE2oQCTixA4gHziRHZSdyprP 5o3G/SwZO806px4ZQP63w9VYfF52DyAT6ZIQKJwObVTSH/PttnIorlvfzZ3AJfKr+2Ig pyMRkb7ZmIys598u/WaEbenztjAnbpPcL+i3BYud+i/CpWkvSqYB7QIQN0TwHSm2vkWC q18wkJSnwC+ethHtyttncKesAduQVLUvM9gKmqNhO0ak4O1rVT7X8FqhpmVU+O5OYkNz qWyH4F43HaRNMQ9n5zwlwEnIWzmIRLZD4Mo1oFl1fItqFAeOpK4j0jUDawhrsbLZKipj niAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740658288; x=1741263088; 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=iEzzB9qVJ3Iw6yE+IGNZV4gwcPeMNS9a9nupNaDYjZA=; b=TYCcGhO4sFl+qD5MejjVIOFUFP6NpBT152mkFK1G89ExVi4OiLhF4xq/EDTS34ps0a fSkPiIgiyykLg1VEugZEgyKc5R+6iB5pTmPOQKlhu+788Hm4Wisedmuh8wQaX0j9eIHh s4uUjPgKI6vqO74e8eVEgPdtdWcNnyN8Bxyg/NhD0pU37ymL1CVbfR1HWqdbEiT3jOu0 pgxQPIlLeLO+hpQGYG+bf/IrfVdO51RBUKDwtZ+OTGSiMYCuAsErSoGCvv0MMYWU5jJP 9MpkFnmgrS37pV7geYuHdDMI2c/VoQwYUMsDNF/glAAop1fpjblPlCKkKJXMdKyJXky0 LErg== X-Forwarded-Encrypted: i=1; AJvYcCU8RcXz5ki5LC8dTeCFrEqzi9AaAoPpOhVCZIICQD4jiUkNbuMCiEKkvc+yTcmg1FO7d3IK0s5iYCaJ8rg=@vger.kernel.org, AJvYcCUCfhQ3N6deV9T09zpZXIG2Qe+9fPY7yMYpHKj8vbpeTQ2HK2usGrCd6S++PhThoI4bGkJY/3YjnIUlfjo=@vger.kernel.org, AJvYcCUfi3KBI2zmcuolGu24P9ALNDhbQ8lHFMxeJfJC77k+0W29TgCyF9nMqSSIQ8R2VuwDiRVZiJfuSzkk@vger.kernel.org, AJvYcCXYKMMcIX2eod68nD9bBIM0Z8K7NP7iCfm6HCSJWhviFbhnWGw/1BvP60qRmLSZhTMPnC5TOdy8+kHPkDey@vger.kernel.org X-Gm-Message-State: AOJu0Yy4r3mHTEkF2F55MNGsSSJWR//sPGCrbzN/VlZKoTaazXtAAKkE wigNpFswspe328B6maQzh3lhhyDa3US0qI3FM9OQZ1iC5VFZEfXZ X-Gm-Gg: ASbGnct5wlMJJyVzj0OQy3v+Prb2yJyiVdEMhNqJ/lh1PjO3AcUL3A/V88Cn9pjcMxT agHwJWSPxuZhRBNVMDincjxImzd1RShxny5w7vn3PN42r06tlubh2Df4iQS7qP44h6Htk4GtD1g BqTRbZDdpCbZY/SzGvzncV4gvwSXApEwKv7t26il2Eh+HrCnpNlqp1c8gt2K22fsO3Q24wvadYC /t/WVXkOTFNEFiPM51SxltW8iadNAvd0FJcXgcEnpQexMuXvvLkiS4QZoCysDh1o9hcim9xKTpP ERM31UO5LWLvtXVc8OhL3jJnzyY4Mpi/bS7fkRYDbdrcUUjWysgP/psegCI3AWZP0UIqQOXOp/G f+AYBPtNAUqaoyzacDOb9 X-Google-Smtp-Source: AGHT+IHdFPiIjso+jHQ5pYM1l26QNU+l3tZa6s8ZU6RVChKuKqgbn5vVYB+/pxo5sqBJaVfMPpIGhQ== X-Received: by 2002:a05:6a00:8c3:b0:730:9752:d034 with SMTP id d2e1a72fcca58-734790a07bemr16311476b3a.1.1740658288101; Thu, 27 Feb 2025 04:11:28 -0800 (PST) Received: from [192.168.2.3] (2403-580a-80ed-0-4835-5a07-49e7-f115.ip6.aussiebb.net. [2403:580a:80ed:0:4835:5a07:49e7:f115]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-aee7de19cdasm1074217a12.24.2025.02.27.04.11.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 04:11:27 -0800 (PST) From: James Calligeros Date: Thu, 27 Feb 2025 22:07:47 +1000 Subject: [PATCH v3 20/20] ASoC: tas2770: Set the SDOUT polarity correctly Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250227-apple-codec-changes-v3-20-cbb130030acf@gmail.com> References: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> In-Reply-To: <20250227-apple-codec-changes-v3-0-cbb130030acf@gmail.com> To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shenghao Ding , Kevin Lu , Baojun Xu , Dan Murphy , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shi Fu , Jean Delvare , Guenter Roeck Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , Hector Martin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, asahi@lists.linux.dev, linux-hwmon@vger.kernel.org, Neal Gompa , James Calligeros X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1794; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=IJKMt2MOzo4HqAlNbvJllezc8HVauxLaZQPm/TY6YwA=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDOkHQk8XTzVteJa9zyGteXNIKOu9izN3CS9kSJYwaitYF 5tnsaKto5SFQYyLQVZMkWVDk5DHbCO2m/0ilXth5rAygQxh4OIUgIlESjAyNP66avXB65vk3+X/ tyf5R1ur/1rWzGh3ZPl1gQXhTIKpSxkZWs9cP6RixZIod15C8rDMsqc3e3P8u3/dXGnXUcHfd2s 1FwA= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 From: Hector Martin TX launch polarity needs to be the opposite of RX capture polarity, to generate the right bit slot alignment. Reviewed-by: Neal Gompa Signed-off-by: Hector Martin Signed-off-by: James Calligeros --- sound/soc/codecs/tas2770.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index 58f36cf471a6b7dd15c1b0600710396de4e2f61e..b68ae6236d69b43cfb1cf28cabf73b1f729191ab 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -352,7 +352,7 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) struct snd_soc_component *component = dai->component; struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component); - u8 tdm_rx_start_slot = 0, invert_fpol = 0, fpol_preinv = 0, asi_cfg_1 = 0; + u8 tdm_rx_start_slot = 0, invert_fpol = 0, fpol_preinv = 0, asi_cfg_1 = 0, asi_cfg_4 = 0; int ret; switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { @@ -369,6 +369,7 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) fallthrough; case SND_SOC_DAIFMT_NB_NF: asi_cfg_1 |= TAS2770_TDM_CFG_REG1_RX_RSING; + asi_cfg_4 |= TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING; break; case SND_SOC_DAIFMT_IB_IF: invert_fpol = 1; @@ -387,6 +388,12 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) if (ret < 0) return ret; + ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4, + TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING, + asi_cfg_4); + if (ret < 0) + return ret; + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: tdm_rx_start_slot = 1;