Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9928859pxu; Tue, 29 Dec 2020 08:46:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwb4kl3TO3n7vC6mSFTdsohjdvmf0GPwUsgBs8SZqYrAOx7CektmgOwxt/UoBwSbPjxlFVU X-Received: by 2002:a17:906:158c:: with SMTP id k12mr28727972ejd.119.1609260403242; Tue, 29 Dec 2020 08:46:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609260403; cv=none; d=google.com; s=arc-20160816; b=WCIDirXfc2A80U3icNZl1TLZ+4QoiEGz3cRTNTsUTYia6r2SpAiMQd6sxlSM3gAENL v//MHjteN9oguZ4f0c4NgxdOsqUnFUvIoql7dLY4Net0d6/EsGoyL4Azrpyg9EXaTLNU JqaSTKGhvRP6ncMdDRFKgXzqVaEn7LMGiGeewlcNpAsM8tNETRidTMrsBFrVb7gUuaQu o4+TIICq0o2r2sHjWPU+xzxh/SwQCDLYOvI+6UAFWf5zxuAXYm9t6MUWob5jjgcxpQZi If4OFGuBY+GKul+QW7a+Vo7aqipMAO/b+WfNJLJ0A7TXfsD+v9ow+YQd47j6WcbpPCcT Qa5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=HNEJqDx1uGzTbYnhzcdCDawRhXCn21gHMiqEZZvsCY8=; b=ZiZziYohMV76jBXbM5S188Ij7dxAqxMnBkqSQiA3/0PkTmsaLJD4QFpKeAqQsQ4w+B DXk/3uw12TttDoBjS5IquBC8a0qwxOw22i+7Z7Jz4piLBPe/e55FWU8VsD6hFwhoMhQ6 5fszuJoxWQZSjK9zV2o8F3MbdSW3gcjp5gjbMhHQ2etoaXm6nWB80SQlHsfOtB0BkquM +b0johwdVnKna9Jn1oHzRQJayIZDMiNoKCb3Kln5RF0oMqmXw1ac7Qz3ikbqP24ChVTJ iAU9/zYPS2Ia2FBVq180FUdnFUn+Wf7514QSVPF2XjKYdAS9QAwXAyCZb7Ja9q+3f88v wWcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=gsfwEgeW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si22904319edf.510.2020.12.29.08.46.20; Tue, 29 Dec 2020 08:46:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=gsfwEgeW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726263AbgL2Qov (ORCPT + 99 others); Tue, 29 Dec 2020 11:44:51 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:18990 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbgL2Qov (ORCPT ); Tue, 29 Dec 2020 11:44:51 -0500 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 0BTGepGZ011369; Tue, 29 Dec 2020 10:43:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=PODMain02222019; bh=HNEJqDx1uGzTbYnhzcdCDawRhXCn21gHMiqEZZvsCY8=; b=gsfwEgeWT3LkvHqnk0uZS2qtdYh1cIYqaL0nel/4FA7afKHFYaJAoujKk5G7qeV3Kc5t d1Zk6Sm84/EfkC3a9I6qVWMAANGkH3lPInKBs2VLr5WD0UIV5omMTEvhJ/p1sXMlqXxX nxd8VUIHltqYutMxIyTlO/yDuw0wHbyhBcMq1MoBj3ojRX0+NUJMQlHJCCVF8QnADsKT zTLwmTMLcPO4eGWIRJ5aiIVvQYMwbszVcxgHHg2R3HBS9Kl17zQJGNG9gd6BxA1ha9sd qziGJm1/X0z2RA6zAb7lagFTmrjcmpYcbtZy7D9oyvQUCCzxVmxD0U5DXItHql3q3Be+ HQ== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 35p2fs2gy0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 29 Dec 2020 10:43:55 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Tue, 29 Dec 2020 16:43:53 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Tue, 29 Dec 2020 16:43:53 +0000 Received: from [10.0.2.15] (AUSNPC0LSNW1.ad.cirrus.com [198.61.64.77]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 4972345; Tue, 29 Dec 2020 16:43:47 +0000 (UTC) Subject: Re: [PATCH 01/14] mfd: arizona: Add jack pointer to struct arizona To: Charles Keepax , Hans de Goede CC: Mark Brown , Lee Jones , MyungJoo Ham , Chanwoo Choi , Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Jie Yang , , , References: <20201227211232.117801-1-hdegoede@redhat.com> <20201227211232.117801-2-hdegoede@redhat.com> <20201228122138.GA5352@sirena.org.uk> <44f84485-8efc-39f9-d0a7-cb8db2ea3faa@redhat.com> <20201228162807.GE5352@sirena.org.uk> <20201229130657.GN9673@ediswmail.ad.cirrus.com> <19c2d056-4f71-2c4c-c243-cdcc0115876c@redhat.com> <20201229150635.GP9673@ediswmail.ad.cirrus.com> From: Richard Fitzgerald Message-ID: <938c2a83-8224-60a7-18d2-6a4db6516254@opensource.cirrus.com> Date: Tue, 29 Dec 2020 16:43:46 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20201229150635.GP9673@ediswmail.ad.cirrus.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 impostorscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 clxscore=1011 mlxlogscore=999 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012290105 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/12/2020 15:06, Charles Keepax wrote: > On Tue, Dec 29, 2020 at 02:57:38PM +0100, Hans de Goede wrote: >> On 12/29/20 2:06 PM, Charles Keepax wrote: >>> On Mon, Dec 28, 2020 at 04:28:07PM +0000, Mark Brown wrote: >>>> On Mon, Dec 28, 2020 at 02:16:04PM +0100, Hans de Goede wrote: >>>> >>>>> And more in general AFAIK extcon is sort of deprecated and it is >>>>> not advised to use it for new code. I would esp. not expect it to >>>>> be used for new jack-detection code since we already have standard >>>>> uAPI support for that through sound/core/jack.c . >>>> >>>> Has Android been fixed to use the ALSA/input layer interfaces? That's >>>> why that code is there, long term the goal was to have ALSA generate >>>> extcon events too so userspace could fall over to using that. The basic >>>> thing at the time was that nobody liked any of the existing interfaces >>>> (the input layer thing is a total bodge stemming from it having been >>>> easy to hack in a key for GPIO detection and using ALSA controls means >>>> having to link against alsa-lib which is an awful faff for system level >>>> UI stuff) and there were three separate userspace interfaces used by >>>> different software stacks which needed to be joined together, extcon was >>>> felt to be a bit more designed and is a superset so that was the >>>> direction we were heading in. >>> >>> Android has been updated to have the option to catch input events >>> for jack detection now. >>> >>> I have always been slightly confused between extcon and the ALSA >>> jack reporting and have been unsure as to what is the longer term >>> plan here. I vaguely thought there was a gentle plan to move to >>> extcon, it is interesting to see Hans basically saying the >>> opposite that extcon is intended to be paritially deprecated. I >>> assume you just mean with respect to audio jacks, not other >>> connector types? >> >> No I mean that afaik extcon is being deprecated in general. Extcon >> is mostly meant for kernel internal use, to allow things like >> charger-type-detection done by e.g. a fsa micro-usb mux or a >> Type-C PD controller to be hooked up to the actual charger chip >> and set the input-current-limit based on this. >> > > Fascinating thanks for taking the time to write such detailed > answers. I thought it was mostly intended for user-space usage, > but I guess I never really thought through that most of this > stuff you don't really need to know from user-space. > >>> I would agree with Mark though that if extcon exists for external >>> connectors it seems odd that audio jacks would have their own >>> special way rather than just using the connector stuff. >> >> Well as I said above in me experience the extcon code is (was) mostly >> meant for kernel internal use. The sysfs API is more of a debugging >> tool then anything else (IMHO). >> >> Also the kernel has support for a lot of sound devices, including >> many with jack-detection support. Yet a grep for EXTCON_JACK_HEADPHONE >> over the entire mainline kernel tree shows that only extcon-arizona.c >> is using it. So given that we have dozens of drivers providing jack >> functionality through the sound/core/jack.c core and only 1 driver >> using the extcon interface I believe that the ship on how to export >> this to userspace has long sailed, since most userspace code will >> clearly expect the sound/core/jack.c way of doing things to be used. >> The majority of customers for these codecs + Linux were building Android devices. So compatibility with Android was the most important goal. At the time this code was written Android used a custom kernel subsystem called "switch" to report jack events. extcon is basically a cleaner version of "switch" and the advantage is that they are almost identical so it was easy to port a mainline extcon driver back into an Android "switch" driver. Android didn't use input events or ALSA jack events so one of those drivers would be no use to the majority of users of this codec at that time. And as Android's "switch" was so similar to extcon, surely Android would just convert to supporting extcon...? The arizona extcon driver is a legacy of the way Android did jack detection. >> Arguably we should/could maybe even drop the extcon part of extcon-arizona.c >> but I did not do that as I did not want to regress existing userspace >> code which may depend on this (on specific embedded/android devices). >> > > All reasonable arguments, with Android now supporting input > events for jacks I guess there would be no need for us to use > extcon for future devices. > > There is maybe more argument for porting the Arizona code across > anyways, since for a long time Android didn't properly support extcon > either. It supported the earlier out of tree switch stuff, extcon > had a switch compatibility mode, but that didn't actually work I > think due to android hard coding some sysfs naming or something > (memory is a little fuzzy on the details was a while ago now). > > I think extcon support was fixed in Android at about the same time > the support for input events was added. So it might be harmless but > someone probably needs to go and check the timeline before we go > changing stuff. > > Thanks, > Charles >