From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751570AbdK0JPj (ORCPT ); Mon, 27 Nov 2017 04:15:39 -0500 Received: from mga04.intel.com ([192.55.52.120]:39818 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751277AbdK0JPg (ORCPT ); Mon, 27 Nov 2017 04:15:36 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,464,1505804400"; d="scan'208";a="1248956357" Date: Mon, 27 Nov 2017 14:48:50 +0530 From: Vinod Koul To: Charles Keepax Cc: Sanyog Kale , Greg Kroah-Hartman , LKML , ALSA , Mark , Takashi , Pierre , Shreyas NC , patches.audio@intel.com, alan@linux.intel.com, Sagar Dharia , srinivas.kandagatla@linaro.org, plai@codeaurora.org, Sudheer Papothi Subject: Re: [PATCH v2 04/14] soundwire: Add MIPI DisCo property helpers Message-ID: <20171127091849.GS3187@localhost> References: <1510314556-13002-1-git-send-email-vinod.koul@intel.com> <1510314556-13002-5-git-send-email-vinod.koul@intel.com> <20171123143812.braw737aciq4qmb7@localhost.localdomain> <20171124160448.GB11781@buildpc-HP-Z230> <20171127075940.euvjgjf6t5rimltp@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171127075940.euvjgjf6t5rimltp@localhost.localdomain> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 27, 2017 at 07:59:40AM +0000, Charles Keepax wrote: > > > Apologies for the long and slightly vague comment, but I guess my > > > question is do you have a thought on how drivers should know when > > > it is safe to communicate with a SoundWire device? > > > > IMO it is safe to communicate with SoundWire device when the Slave > > status is ATTACHED. In any case bus will report error if it is not able > > to communicate with SoundWire device. > > Yeah I guess my point here is that there is currently no way in > this SoundWire framework for the slave driver to know if the > device is attached or not, unless I am missing something? There > are calls by which the master can inform the framework, but > nothing to pass that on to the slave driver. Nope, as Sanyog pointed out there are deterministic ways for Slave driver to find out. We can do that by: a) check the slave->status and communicate only if status is SDW_SLAVE_ATTACHED b) Implement sdw_slave_ops->update_status() which is invoked by Bus on any status changes. So to summarize, for a Slave driver during the probe, if the status is not SDW_SLAVE_ATTACHED it should not communicate and should implement sdw_slave_ops->update_status and attempt IO when this callback gets invoked with SDW_SLAVE_ATTACHED status. Does that clarify and solve the problem. -- ~Vinod