Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp405373ybk; Wed, 13 May 2020 03:19:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNjCMbGfx3DujivSJIvPYhhBvoriChOWwsTJ0LOhXKDlSCggKKOpTHJ+iZlZNU0iC95IFc X-Received: by 2002:a17:906:29d9:: with SMTP id y25mr9059917eje.198.1589365196864; Wed, 13 May 2020 03:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589365196; cv=none; d=google.com; s=arc-20160816; b=DK+G+f7i+gUAGFR3kpsyxR9FO0g569YQvXkHAaXKWLoNOWD8+z180u5PSx4rAJ4/6y 4WCwCyWgMr8NlAA9GYxiiPLYPtpYSwe5fQTUQDVa6qMLb7eX2SEu5v5e0ZB5B4h2Ytak /0e6x7KAEAtnYhx4XfCGYBImL7rceF/LXx9gj9GgR5vPLOXo8M70vw6Eknnny952yCfb Y3oAqydyvCQVP5fg6VrmtJx0rDv8A10Vo6ETrqTelCvOxa0PVFCIWckkQsJLMtNHH+Or h6E6P3VEBT+l33VWMsxS631dhGL0kCkPrO/2DQxbQ3T9ec/XIK78e1ni7bzU8HJMTw4t aM4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EbPtovEcUy1ixYBTYrlR0sn9b6dhzzXOG/gXVw7nI9w=; b=IqoFHUzNMRSwLW1ds/+WWH+g68yc1+fF/0WKSIpwYnu4JYNgSoPz5bF5bmGggRCJQr RjFEFGVh1SBSf2g9SgJK3KMw13DpHrV8j0BkM6LLXXn02WYAWpyJ1A2FeTJW9RKNAFon ab2sgvxPwR25KNIpK3ssOyg2GTZuwwjRtY7qDvV8BBkP1eKS/aJRlFRNLIyWxsNn3AuY 3ffgenred2ZDAEg9K4xrgU7pM2VLuqJXy4VCPpbsQ0iOrAgO1vlmTSpXvYDDWvUoqa/q DlsMxwpcBMTskbj2mYki/BNsNmVXZZeYFOEBt9HdogdJcJgHMtYAHDJ3lWUh9oHt+Ari 7jLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y9Az8Mqj; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o14si5807908eja.223.2020.05.13.03.19.34; Wed, 13 May 2020 03:19:56 -0700 (PDT) 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=@kernel.org header.s=default header.b=y9Az8Mqj; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733192AbgEMKQw (ORCPT + 99 others); Wed, 13 May 2020 06:16:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:46622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732579AbgEMKQw (ORCPT ); Wed, 13 May 2020 06:16:52 -0400 Received: from localhost (unknown [106.200.233.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 54E2B205ED; Wed, 13 May 2020 10:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589365011; bh=3vuvhwtAZpnS66RSuG8LddV1to4ZKi+d7n0imn7UJ8s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=y9Az8Mqjykr3Mhl7wM309gFo2qfAjdPDU03RauVflr7mQkhW9Ko8eerqxCst0CnUs c8ku8Nch4qUA2Q+oiyz2IzxqcU/f1Oc96tyhG2Cz66g5d6inR81Dur7d3pj/sYHcmO qerEBvI2kgWjPFORlIOrec/oiIoSDVR/9Ap6UHJ0= Date: Wed, 13 May 2020 15:46:42 +0530 From: Vinod Koul To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, ranjani.sridharan@linux.intel.com, hui.wang@canonical.com, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, mengdong.lin@intel.com, slawomir.blauciak@intel.com, sanyog.r.kale@intel.com, Bard Liao , rander.wang@linux.intel.com, bard.liao@intel.com Subject: Re: [PATCH 3/3] soundwire: bus_type: add sdw_master_device support Message-ID: <20200513101642.GC14092@vkoul-mobl> References: <20200429185145.12891-1-yung-chuan.liao@linux.intel.com> <20200429185145.12891-4-yung-chuan.liao@linux.intel.com> <20200511063227.GS1375924@vkoul-mobl> <20200512033035.GV1375924@vkoul-mobl> <84f09843-3245-5fa4-530f-c915b28e9bc5@linux.intel.com> <20200512155927.GA4297@vkoul-mobl> <79ee2b4a-c2e3-aba7-8b67-b1a01922d089@linux.intel.com> <86d45af8-93db-d284-64d4-efa22ccc0908@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86d45af8-93db-d284-64d4-efa22ccc0908@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12-05-20, 12:01, Pierre-Louis Bossart wrote: > > > > > > > > > > > > There isn't any known implementation with more than one controller. > > > > > > > > > > But then it can come in "future" right. So lets try to make it future > > > > > proof by not using the link_id (we can expose that as a sysfs if people > > > > > want to know). So a global unique id needs to allocated (hint: idr or > > > > > equivalent) and used as master_id > > > > > > > > Can you clarify if you are asking for a global ID for Intel/ACPI > > > > platforms, > > > > or for DT as well? I can't figure out from the soundwire-controller.yaml > > > > definitions if there is already a notion of unique ID. > > > > > > If ACPI was unique, then I was planning to update the definition below > > > to include that. Given that it is not the case, let's make it agnostic to > > > underlying firmware. > > > > I am not sure I understand how this would be done. > > > > The call sequence is > > > > sdw_bus_master_add(bus) > > ??? sdw_master_device_add(bus, parent, fw_node) > > > > At the bus level, we don't have any information on which controller the > > bus is related to. This should be done inside the sdw_bus. controller should not care about this IMO. > > We'd need to add an argument to sdw_bus_master_add() and have the > > controller unique ID be allocated outside of the SoundWire core, hence > > my question on whether the DT definition should not be extended. > > And btw I don't think it makes sense to add a new definition for Intel. We > already have a notion of HDaudio bus->idx that's set to zero since we don't > have a case for multiple HDaudio controllers. > > if we ever do have more than once controller, then we should rely on HDaudio > bus->idx as the identifier and not create one specifically for SoundWire - > which means as I mentioned above passing an argument and not defining a > controller ID in the SoundWire core. I was thinking of following code in bus.c static DEFINE_IDA(sdw_ida); static sdw_get_id(struct sdw_bus *bus) { int rc = ida_alloc(&sdw_ida, GFP_KERNEL); if (rc < 0) return rc; bus->id = rc; return 0; } int sdw_add_bus_master(struct sdw_bus *bus) { ... ret = sdw_get_id(bus); ... } void sdw_delete_bus_master(struct sdw_bus *bus) { da_free(&sdw_ida, bus->id); } This way you get a unique master number across all devices and this has nothing to do with link/of ids and is used for numbering masters in sysfs uniquely. HTH -- ~Vinod