From patchwork Sat Mar 2 14:00:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 21256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp488749dyc; Sat, 2 Mar 2024 06:01:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWsQsExIERTacT3nDAvfiUhsAa5bcLPZf3jzafcBuCRsinpqpc8qrnlcWfwpkpYvRxdTbJXTLRzh93+dAaP3evq50+9wg== X-Google-Smtp-Source: AGHT+IFMxU9AmpzEqrhE9XP2VzV+ELfo+741u+ueNaRmKKbZ7tt+w20naH2+r9qFZsGOQ2FstPr9 X-Received: by 2002:a17:902:cec8:b0:1db:7195:5fca with SMTP id d8-20020a170902cec800b001db71955fcamr6214185plg.34.1709388087135; Sat, 02 Mar 2024 06:01:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709388087; cv=pass; d=google.com; s=arc-20160816; b=f09xDqpTLVX4IHh2zKEPMsbuvP+2NEyagay30EcZx60Mja496CyAVQlZ35iCB2oF3B 8OKSg5B1m7wHGww4aqBZvxTVjSVcoISYrGT9qIjitjyULTs9T/FiHxmOAqOnBk/VAhQE rvFKTNWbQO0YpJKEEJwq8w9Aer8iK3sSNznY60yI63a/2wTFu0zgZrdI/ey5f9m562N5 kd8ap5ZjYLduqs067sCxPsltU0DilUcuhhhB8Sipt5i/lNNUBGQl899AjeuzRITPfo/c Wab4Khf/u5eTszOvQ0VKsahYldc/BzVugnPnJ/Zt3dDozuQkRcntASNnoEiZdlac0BoU +VkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=AyD9exTQqfCEDDwgHQN4HGU1baMGTlyg80R6dAEUYOM=; fh=LyOUUyERizBut43yg2bQgiL8MyPFN7nnSRizOKM8oK8=; b=ccCU7iblO0nQe9tjfghcWMb7IxTVVvC++dcO8rvSFpBIy6kPJlTI5m5dPT3S3XlkbL ItRtGd5WQ4qTSWzhfRW8BfSe1tGNCXYfr8KO28JPduZDX0cgyyRJVdv3tvoqG3mXA8o+ 12UrmZi5bC8x2vlxseMtDUodp72vuOhh38G5NDGWtd0vyH4YA23RbpfnN1JcvUqfb+77 DG4BleQ9GWZU49CzeTm8NRfbACiCaT6AMTf4iDIfVIHoGMY9m9F5DhS/G76xdULMbfIW JmpbecF6SYGI7kdxeMIHZJYB9MKUqt86oql1IDGf5MhiieX5zCMrJLIYeRP3xgeR+GMm hUcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=XcOmshdW; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-89455-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89455-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v5-20020a170903238500b001dcd2ed9cb4si5387600plh.544.2024.03.02.06.01.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 06:01:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89455-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=XcOmshdW; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-89455-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89455-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0F1E7283C0C for ; Sat, 2 Mar 2024 14:01:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08ADF1B5B1; Sat, 2 Mar 2024 14:00:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="XcOmshdW" Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) (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 33348179B7; Sat, 2 Mar 2024 14:00:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.181.215.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709388051; cv=none; b=RVu98FeISx5eywYZhifWG/2gOeedBic9J2QY+IhuqEhuQ6OSPFXXmo4T8uIt7cgIdeOt3eCo5pyl1Z0/Nc+fNAB5J1XcxyUhZSeWNnoZ9TeJ0cHBrApyXqdwgDFwtCYIvtNfn8sRWCq7ylwXDunqxcR4O7xsEKxtqryRepyRIBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709388051; c=relaxed/simple; bh=uiQdKioW5Q8/qfRyAEscHhnKqRIHa/efSN+ljmC4lok=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=G6Fe/PBY7drqVOiNO8F37wnZs/AXmgTrsB2ejxcwiGCok1VwkUpiW1/+CClCXTdp16z3UnxRAIdagiwB2sa6wIITNqBqWR93CeRfT7eO6A15hjIE1Xna8a063KBUUbrFmB9t46iuFMdeRbUOqLB4t4QIoQXucFeTOQ1bDT09SNA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz; spf=pass smtp.mailfrom=xff.cz; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b=XcOmshdW; arc=none smtp.client-ip=195.181.215.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xff.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1709388045; bh=uiQdKioW5Q8/qfRyAEscHhnKqRIHa/efSN+ljmC4lok=; h=From:To:Cc:Subject:Date:From; b=XcOmshdWXvExDVy4K+zxIZF+CaaHhfMsi5Ewmy+e3mozM0igrri0ZlA0bSxdUbRga kjqGrvQnU6QfAwjWqHMtsW4HfwsWF1PRAi/Ao03SEhUo7JdrGlJsUBwtY4iIeE2FCs wv8bpWOwevP5sOG9hxs0c+3O4yvxbjl2a53t7/F8= From: =?utf-8?q?Ond=C5=99ej_Jirman?= To: linux-kernel@vger.kernel.org, Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Ondrej Jirman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Arnaud Ferraris , linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH v3 0/4] Add support for jack detection to codec present in A64 SoC Date: Sat, 2 Mar 2024 15:00:34 +0100 Message-ID: <20240302140042.1990256-1-megi@xff.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792423322881851450 X-GMAIL-MSGID: 1792423322881851450 From: Ondrej Jirman This series adds support for jack detection to this codec. I used and tested this on Pinephone. It works quite nicely. I tested it against Android headset mic button resistor specification. The patches are a rewritten and debugged version of the original ones from Arnaud Ferraris and Samuel Holland, improved to better handle headset button presses and with more robust plug-in/out event debouncing, and to use set_jack API instead of sniffing the sound card widget names, to detect the type of jack connector. Please take a look. :) v3: - removed all device-tree related code (it's not necessary for core functionality, it only helps make the jack detect functionality of the codec be usable from simple-sound-card driver, and I'll send it spearately, because it will apparently need several more rounds of review) v2: - use set_jack/get_jack_type - get rid of some custom poking inside card internals to figure out what kind of jack port we should setup the codec for - read jack-type from OF as suggested here: https://elixir.bootlin.com/linux/latest/source/sound/soc/soc-component.c#L288 - add DT bindings Thank you very much, Ondřej Jirman Arnaud Ferraris (2): ASoC: sun50i-codec-analog: Enable jack detection on startup ASoC: sun8i-codec: Implement jack and accessory detection Samuel Holland (2): ASoC: sun50i-codec-analog: Move suspend/resume to set_bias_level ASoC: sun8i-codec: Enable bus clock at STANDBY and higher bias sound/soc/sunxi/sun50i-codec-analog.c | 73 +++++- sound/soc/sunxi/sun8i-codec.c | 346 +++++++++++++++++++++++++- 2 files changed, 399 insertions(+), 20 deletions(-)