Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp56461lqa; Fri, 26 Apr 2024 14:17:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8F8CAtVZC0ydW4AuAD4+8l062BJUb1pPpPxD9MKb/NhqZ7BfWmgDh5yVEkJGRuogeQL+pRh4yMTZZiZk8MuDZeIIx2TsfXkia0NfpEw== X-Google-Smtp-Source: AGHT+IEDSiL+q//etlT4kEX+tyy4v9EIUxzJBkpP2UcEId9UW8FREGeq1Y1kKVMZ0xPc+iDKhqfb X-Received: by 2002:a05:6a20:9693:b0:1ad:47c1:7a53 with SMTP id hp19-20020a056a20969300b001ad47c17a53mr4073812pzc.54.1714166273494; Fri, 26 Apr 2024 14:17:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714166273; cv=pass; d=google.com; s=arc-20160816; b=YBzBs6XoEpp3I+JrULfkxlqw2pHnKuBp+XLi5LrQ7mXV8HIIkwLw0IAbr3j74V4a94 okqgF6HLq5X4G6SHt8XOz7jnnznO1LXaL/Rd08G0r1P9nfa+yy/1wpJ3eFV7cipGe1jo Rk/Sz483D6ELwlI9DcRt0lBRv6g2BlZYClU8N5Lt/eO549Ajc0HakoebZlkIBI63hmya n3DugLJREztW4D5R0wVMFBUb6F3h7KC0bKgeiLtLR2zfP55A4M4npOvCLfLSj/ep7gcQ sFeROrQbDZpz7f6ZV/8ZZ9zZFaybyvpcizOSl0vNn8CnJBaJjxC7wBImy3K2wfYX5Nts Rv8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=xaB4hL+6dHskWMSxRO978lKop+T4meaVw+CVB/woyUs=; fh=JjpcQjLXGvGqgXaKY9O04qOpWehlfNvEz/aL381NUjU=; b=t4sOPgCR7SCUdAvId+cNw+758qzRRE28vIY7fbjy6ETPDe9n2uKyA0qhCskNFb0A3u EGpL6V7y+wUESu2ggmH42XPk8TPApiN4h95r73mvdVUcpCdmnb1/pI2yK9L88462yFiR tHmKu4jsj08cXZxinGy3uYiAHu6pqa+nEwp974V9tt0Z930tfIWt3ifmu0zVuk/Nbr9N TL2NrX5CA4xw0tIfC+qw8kSGYI6bWifUAKNFS2tjCuyByxQeR5iSXgbbLSYOMQthIQON IQ1oBniLgYaJ71PgKSSBgXWTQjrYZXl0SiAscrN1l9/bvKod36eNoL/uRO8sZN3ofurm MmBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AYKm5VGy; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-160054-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l15-20020a170902f68f00b001e7a1e6a616si15648021plg.221.2024.04.26.14.17.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 14:17:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160054-linux.lists.archive=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=@intel.com header.s=Intel header.b=AYKm5VGy; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-160054-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 1C099285FCB for ; Fri, 26 Apr 2024 13:27:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 146D4147C7D; Fri, 26 Apr 2024 13:26:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AYKm5VGy" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8DAC13E88A; Fri, 26 Apr 2024 13:26:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714138013; cv=none; b=iHoDYDco2c+AZ5Jy2TLGxAyhelAooKc/p3emTEHnZ8QMJASYYk20ZVnnHhEKRDKIx6M7PJB0b716o/aYM5N9qtY0ON7Rry3mQ365g+uYgtKJvX9t8PgwVwT/62Sq2FF3CjnK+LRB4+Hd8xcOyF1Ik8z7C0IgiTFX+0rqUuMN0EU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714138013; c=relaxed/simple; bh=+uYe9/x+IyHqzkvDA3Df7sQhXUVBGynf8X0Ns4EUF9E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=R+245hl3NU5Ov2ozekRyFJS1zzLmA9ZYKvV2Asp7qHzgGKVhm94mcaElE9NUWkdoArrxPqRG7oKhf8iD0vTJJIN6BWqpNz7J6tdCoYnpEUKYN1mTwHT6aIe+bAnfF4ZG6fBzjY46J9NTvVdCTRKLtrcy9GAyurM59OhOeCl2meE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AYKm5VGy; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714138011; x=1745674011; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=+uYe9/x+IyHqzkvDA3Df7sQhXUVBGynf8X0Ns4EUF9E=; b=AYKm5VGyZUfxcgTPHL8aKs/Kqd/0qNR8J//EXLpLbBsTr05z1vKML81w HzSqJpEgcY5e6CsqRDmJWMGiDSKOIMFousPczcbiRkzdI7y3KZXVRDsV4 FThvsw6675m+NnNJkup4HnVAr9qjRR5zRWSaUhwhSvwEsHQITNCqZacCG DJC3uYfFB40gRR3Si5WI5BcHgcwH5kt0lA5u+LGrJnftdonxr/wpkQmG3 7qU5F6Fma+dnCrq7pv3NahsxflnpXo0w/fIDfOP0AgYyChq/ZMNw5sFN/ yb/4wp1S23Z7MC1fVh03oW1ieJ7RTWtslxFLC3D+b+h80eX5rI8BDmR98 Q==; X-CSE-ConnectionGUID: sPgWN0GqQCyVsJz6FJb32Q== X-CSE-MsgGUID: /F2hEw2RQOWtGq4Qw/hjiQ== X-IronPort-AV: E=McAfee;i="6600,9927,11056"; a="27388608" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="27388608" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 06:26:50 -0700 X-CSE-ConnectionGUID: xwgeRoRqT4ugnI1Te21ZzA== X-CSE-MsgGUID: 7L/JNJSaTgeljesKbElbtg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="25302283" Received: from aslawinx-mobl.ger.corp.intel.com (HELO [10.94.0.53]) ([10.94.0.53]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 06:26:45 -0700 Message-ID: Date: Fri, 26 Apr 2024 15:26:44 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v20 33/41] ASoC: usb: Create SOC USB SND jack kcontrol Content-Language: en-US To: Wesley Cheng , srinivas.kandagatla@linaro.org, mathias.nyman@intel.com, perex@perex.cz, conor+dt@kernel.org, corbet@lwn.net, lgirdwood@gmail.com, andersson@kernel.org, krzysztof.kozlowski+dt@linaro.org, gregkh@linuxfoundation.org, Thinh.Nguyen@synopsys.com, broonie@kernel.org, bgoswami@quicinc.com, tiwai@suse.com, robh@kernel.org, konrad.dybcio@linaro.org Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-sound@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org, alsa-devel@alsa-project.org References: <20240425215125.29761-1-quic_wcheng@quicinc.com> <20240425215125.29761-34-quic_wcheng@quicinc.com> From: =?UTF-8?Q?Amadeusz_S=C5=82awi=C5=84ski?= In-Reply-To: <20240425215125.29761-34-quic_wcheng@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/25/2024 11:51 PM, Wesley Cheng wrote: > Expose API for creation of a jack control for notifying of available > devices that are plugged in/discovered, and that support offloading. This > allows for control names to be standardized across implementations of USB > audio offloading. > > Signed-off-by: Wesley Cheng > --- (...) > /* SOC USB sound kcontrols */ > +/** > + * snd_soc_usb_setup_offload_jack() - Create USB offloading jack > + * @component: USB DPCM backend DAI component > + * @jack: jack structure to create > + * > + * Creates a jack device for notifying userspace of the availability > + * of an offload capable device. > + * > + * Returns 0 on success, negative on error. > + * > + */ > +int snd_soc_usb_setup_offload_jack(struct snd_soc_component *component, > + struct snd_soc_jack *jack) > +{ > + int ret; > + > + ret = snd_soc_card_jack_new(component->card, "USB Offload Playback Jack", > + SND_JACK_HEADPHONE, jack); > + if (ret < 0) { > + dev_err(component->card->dev, "Unable to add USB offload jack\n"); > + return ret; > + } > + > + ret = snd_soc_component_set_jack(component, jack, NULL); > + if (ret) { > + dev_warn(component->card->dev, "Failed to set jack: %d\n", ret); > + return ret; > + } > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(snd_soc_usb_setup_offload_jack); > + > static int snd_soc_usb_get_offload_card_status(struct snd_kcontrol *kcontrol, > struct snd_ctl_elem_value *ucontrol) > { > I'm not sure if this should be handled in generic USB API, this feels like something that should be handled in specific device driver side, like all users currently do. Anyway I think there should also be some function that tears jack down, by calling: snd_soc_component_set_jack(component, NULL, NULL); so it can get cleaned up properly?