Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15831174rwd; Mon, 26 Jun 2023 01:48:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5SHxGjmcCNUXSme3FSLN9Xgmfepxhu8jSHgEbjpY8bU0bT5WRdOtDvj86C988OdwiNqK/Q X-Received: by 2002:a05:6358:c6a5:b0:12b:dce7:f428 with SMTP id fe37-20020a056358c6a500b0012bdce7f428mr20314067rwb.1.1687769313505; Mon, 26 Jun 2023 01:48:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687769313; cv=none; d=google.com; s=arc-20160816; b=g4ns1NjXxphcHJFpZ+FdWeHQbDQ13SJoFyiro+2zlBCryidZ5iFHPsdx3X0qg0OGMN Upow+MDMhfvxaxTBh7NQ815PSdP6XfYJG5sH0yDNEwExQ+df26GnfylkCBVLgliD6LWT CIsVAXIOwjkhAMte1H/sUwyVrBuwgrfSL02wKVAPbmHqD9xXqsFE5Ald/aG92+8j/D5f TdY64PSASF0s0Z32dh04n8eclIP7m39w55/9144u3raBn6htpIfCEy8i8DgMx8fXx1cR h6qYfg0mGRSVmhW6/v8uzK2sJdZi0jyYFs/YEOBnW1ng9xQcosOOs432mVvwo+OSpv78 KyWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=A0MjCpCE0B9i/ZMW43AEhmtdiA/HOgsBDjDC5xz+4oM=; fh=yYfYgV5z6Q8FScAJwAgvZXq/djDJ+jMllrnoglWksfw=; b=cne9N+QTVbiSm5JfK1kCj8WijzNE1OrBIrv4oKc3rOs0ifXOlMn+n0aGCfh3H3Prlp JuEh028mKLPIEgsxdxwjTtG20yh6ooi+/Z21+kAOOqT3OC5zwtMMxVd2s8FmHCph6tLR pFZAU8g4z6muowsU6CTJ9kE3cqhc3czoaVfxOmI3gAS2NWsFzChjqp4p3hxQKmStgMmT 1qUUCUtH6athhAgNfBZC2kFHLxEC3dxq0Li0qhHfXmMkyHF/YDV9T1U3bdn8z4vZJH2j 5ZaI2U1To+aQq9l7GDl8Af78NEJdA2JrBBEGaW32PKmNBTRHKWLpcJ/yKUiipgtY/Sed jeBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fVNR43gF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a631c08000000b005348fd7cb66si4596673pgc.873.2023.06.26.01.48.21; Mon, 26 Jun 2023 01:48:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fVNR43gF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbjFZIcm (ORCPT + 99 others); Mon, 26 Jun 2023 04:32:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjFZIck (ORCPT ); Mon, 26 Jun 2023 04:32:40 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7AFA135; Mon, 26 Jun 2023 01:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687768359; x=1719304359; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=grxXtT68EdlEfB3RgfyL5Y0y3IkvhqXegQFjIRACSPU=; b=fVNR43gFM/WdmBwaTd5v1hsw/d3XJYgUqdbdkHgoY7okduH2CI8nlxip fGQG7/+1Lvn6Sbe/Cp7ryCbxadlnERdqhoPR1NN7c/Zhvo/EwAUsQ7wUR hWgDm1TpdVgrgUt6VkatuJ20Y09/jt0RlsQinR17YydtS7EsN231CUokC qVKfXN2zyBTIELl9+VKINPDaZmxYIopjxyGjN+1sftWoYKWd5SIQNYnVy wBahcAWC8ziV59e6rsySV5GM8KkY5BObz2YwPPtJPD09V0+q8bdfAryZ0 vFK5qQ05qlADuzHspUjmrkFFSANV3wO1emkUEY8wdKMzi57CyrgPWAc5g g==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="447595480" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="447595480" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 01:32:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="860605760" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="860605760" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 26 Jun 2023 01:32:36 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 26 Jun 2023 11:32:36 +0300 Date: Mon, 26 Jun 2023 11:32:36 +0300 From: Heikki Krogerus To: Neil Armstrong Cc: Greg Kroah-Hartman , Krzysztof Kozlowski , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 3/3] usb: typec: fsa4480: add support for Audio Accessory Mode Message-ID: References: <20230614-topic-sm8550-upstream-type-c-audio-v1-0-15a92565146b@linaro.org> <20230614-topic-sm8550-upstream-type-c-audio-v1-3-15a92565146b@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230614-topic-sm8550-upstream-type-c-audio-v1-3-15a92565146b@linaro.org> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 14, 2023 at 03:10:41PM +0200, Neil Armstrong wrote: > The FSA4480 Type-C switch supports switching the Audio R/L, > AGND and MIC signals to the USB-C DP/DM and SBU1/2 to support > the Audio Accessory Mode. > > The FSA4480 has an integrated Audio jack detection mechanism > to automatically mux the AGND, MIX and Sense to the correct > SBU lines to support 3 pole and both 4 pole TRRS pinouts. > > Signed-off-by: Neil Armstrong Acked-by: Heikki Krogerus > --- > drivers/usb/typec/mux/fsa4480.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c > index b2913594a58f..45f5683b7d81 100644 > --- a/drivers/usb/typec/mux/fsa4480.c > +++ b/drivers/usb/typec/mux/fsa4480.c > @@ -25,15 +25,24 @@ > #define FSA4480_DELAY_L_MIC 0x0e > #define FSA4480_DELAY_L_SENSE 0x0f > #define FSA4480_DELAY_L_AGND 0x10 > +#define FSA4480_FUNCTION_ENABLE 0x12 > #define FSA4480_RESET 0x1e > #define FSA4480_MAX_REGISTER 0x1f > > #define FSA4480_ENABLE_DEVICE BIT(7) > #define FSA4480_ENABLE_SBU GENMASK(6, 5) > #define FSA4480_ENABLE_USB GENMASK(4, 3) > +#define FSA4480_ENABLE_SENSE BIT(2) > +#define FSA4480_ENABLE_MIC BIT(1) > +#define FSA4480_ENABLE_AGND BIT(0) > > #define FSA4480_SEL_SBU_REVERSE GENMASK(6, 5) > #define FSA4480_SEL_USB GENMASK(4, 3) > +#define FSA4480_SEL_SENSE BIT(2) > +#define FSA4480_SEL_MIC BIT(1) > +#define FSA4480_SEL_AGND BIT(0) > + > +#define FSA4480_ENABLE_AUTO_JACK_DETECT BIT(0) > > struct fsa4480 { > struct i2c_client *client; > @@ -95,6 +104,9 @@ static int fsa4480_set(struct fsa4480 *fsa) > default: > return -EOPNOTSUPP; > } > + } else if (fsa->mode == TYPEC_MODE_AUDIO) { > + /* Audio Accessory Mode, setup to auto Jack Detection */ > + enable |= FSA4480_ENABLE_USB | FSA4480_ENABLE_AGND; > } else > return -EOPNOTSUPP; > > @@ -110,6 +122,11 @@ static int fsa4480_set(struct fsa4480 *fsa) > regmap_write(fsa->regmap, FSA4480_SWITCH_SELECT, sel); > regmap_write(fsa->regmap, FSA4480_SWITCH_ENABLE, enable); > > + /* Start AUDIO JACK DETECTION to setup MIC, AGND & Sense muxes */ > + if (enable & FSA4480_ENABLE_AGND) > + regmap_write(fsa->regmap, FSA4480_FUNCTION_ENABLE, > + FSA4480_ENABLE_AUTO_JACK_DETECT); > + > if (enable & FSA4480_ENABLE_SBU) { > /* 15us to allow the SBU switch to turn on again */ > usleep_range(15, 1000); thanks, -- heikki