Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp380581imn; Fri, 29 Jul 2022 09:38:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uzwPl5A6yQN+neFFKg5qtvKFl/Pm8HSuKuooD+Nc6ge3tKGcu59CO1s7BWvgJQm6sz1qmd X-Received: by 2002:a05:6402:248d:b0:437:dd4c:e70e with SMTP id q13-20020a056402248d00b00437dd4ce70emr4251931eda.75.1659112687428; Fri, 29 Jul 2022 09:38:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659112687; cv=none; d=google.com; s=arc-20160816; b=nfeGUgmngj6yFo7nBMMg6gATkcDDIO3UXS9f7xWsszcqLuvR8dsBe4wDpoM6TnfWEl zWrLLCLd7wOwi5zZ4wBvnr+IQBH/eWNn786HWaSpK+q29tJl8/cYw7LT2SVA9XoWc8CW 76qa1SqHcztO+p5qBI40SMCoAiZkBSONjT8UfLDypOdYXFbA4z/Fvnq+P/gGf4tm8P6Y uPinNF1zCkTJshRY4pq2MNO90poJAYOx86+PS9+jlr2XvRWZh2GvoJJ1q7fbdSsbDTZR ft21EU/E7eYMn/Ztpg17BM2H/QQkdobBq1UEnb+OLbYS0kk+Db8O8k8yecPoZwU0RQ23 JcBA== 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=1ecC+R+ywsn3Dc/oEDqeUXU4a5hpugFXb0J4SK3oaIY=; b=k6cxkYd1rXpP+7OCFiUaDXcc4xxKPxYoKWHv6uQ7BVeoSEJOeN2fTL13OLuPH5qHFE V4007Kp9jK/t81sTGkIgNfH3UFJv5zP4Q9fv3jsKeO0MIFCbZKUlYgvix88TEIv5s6n7 ReBEDiV03EhZtANGXmO25sYBuRWSxYWuh8KI9oCkXJEx1Ann7pSTQVJ6p+4Z0vrKuV6k aiYARJulani3ZpKWf4zAauA08+hFmbYSrNLkfqB1b+SZg5gPTAtkXH8+lMc9wu0vMqV3 TbCFzn1MspzX5Th21bKe7x4kFcIW5NlpkVsSpl8EUwyESyj/n9IHKzpTTtbaobCWDfI0 lF7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ai+TTWjm; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs5-20020a170906d1c500b0072a84586c63si1830954ejb.564.2022.07.29.09.37.42; Fri, 29 Jul 2022 09:38:07 -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=@linuxfoundation.org header.s=korg header.b=Ai+TTWjm; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234120AbiG2Qfw (ORCPT + 99 others); Fri, 29 Jul 2022 12:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiG2Qfu (ORCPT ); Fri, 29 Jul 2022 12:35:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DD5B69F01 for ; Fri, 29 Jul 2022 09:35:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C487261DC9 for ; Fri, 29 Jul 2022 16:35:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89D7CC433B5; Fri, 29 Jul 2022 16:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659112549; bh=La2xENc04xNZ++CRjJjr81vraFM/tBTfKc0zkbxL07E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ai+TTWjmeaNevgg3tHuabKwJ/OUSPJeCf8KNC5FCR6S8p06ebHufJO7NlYqR5265M PJP0gKQsstwJcGiKpB9lVRRPlVnK4K7NHV+R67+kUus9Qk5pU91pq7Jcc6LxJbudru QtM957VOIZjIYsFu+h712QYiBdXv7S2XtaNbD3gs= Date: Fri, 29 Jul 2022 18:35:45 +0200 From: Greg Kroah-Hartman To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Vinod Koul , Sanyog Kale , Bard Liao Subject: Re: [PATCH 2/5] soundwire: sysfs: cleanup the logic for creating the dp0 sysfs attributes Message-ID: References: <20220729135041.2285908-1-gregkh@linuxfoundation.org> <20220729135041.2285908-2-gregkh@linuxfoundation.org> <9365e038-2146-98f8-f989-02827f221c34@linux.intel.com> <5caffe2a-f5a6-e312-a564-5fe29c4e2323@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5caffe2a-f5a6-e312-a564-5fe29c4e2323@linux.intel.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Fri, Jul 29, 2022 at 10:52:28AM -0500, Pierre-Louis Bossart wrote: > > >>>>> diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c > >>>>> index 83e3f6cc3250..3723333a5c2b 100644 > >>>>> --- a/drivers/soundwire/sysfs_slave.c > >>>>> +++ b/drivers/soundwire/sysfs_slave.c > >>>>> @@ -174,6 +174,16 @@ static ssize_t words_show(struct device *dev, > >>>>> } > >>>>> static DEVICE_ATTR_RO(words); > >>>>> > >>>>> +static umode_t dp0_is_visible(struct kobject *kobj, struct attribute *attr, > >>>>> + int n) > >>>>> +{ > >>>>> + struct sdw_slave *slave = dev_to_sdw_dev(kobj_to_dev(kobj)); > >>>>> + > >>>>> + if (slave->prop.dp0_prop) > >>>>> + return attr->mode; > >>>>> + return 0; > >>>>> +} > >>>> > >>>> This changes the results slightly by creating an empty 'dp0' directory > >>>> with no attributes inside. > >>>> > >>>> Before: > >>>> > >>>> [root@fedora ~]# cd /sys/bus/soundwire/devices/sdw:3:025d:0714:01 > >>>> [root@fedora sdw:3:025d:0714:01]# ls dp0 > >>>> ls: cannot access 'dp0': No such file or directory > >>>> > >>>> After: > >>>> [root@fedora sdw:3:025d:0714:01]# ls dp0 > >>> > >>> That should be fine, tools should just be looking for the attributes, > >>> not the existance of a directory, right? > >> > >> The idea what that we would only expose ports that actually exist. > >> That's helpful information anyone with a basic knowledge of the > >> SoundWire specification would understand. > > > > Is "dp0" a port? If so, why isn't it a real device? > > The SoundWire spec defines the concept of 'data port'. The valid ranges > are 1..14, but in all existing devices the number of data ports is way > smaller, typically 2 to 4. Data ports (DPn) are source or sink, and > there's no firm rule that data ports needs to be contiguous. > > DP0 is a 'special case' where the data transport is used for control > information, e.g. programming large set of registers or firmware > download. DP0 is completely optional in hardware, and not handled in > Linux for now. > > DP0 and DPn expose low-level transport registers, which define how the > contents of a FIFO will be written or read from the bus. Think of it as > a generalization of the concept of TDM slots, where instead of having a > fixed slot per frame the slot position/repetition/runlength can be > programmed. > > The data ports could be as simple as 1-bit PDM, or support 8ch PCM > 24-bits. That's the sort of information reported in attributes. Why not make them a real device like we do for USB endpoints? What uses these sysfs files today that would be confused about an empty directory? thanks, greg k-h