Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11560864ybi; Thu, 25 Jul 2019 19:15:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCoa/8nlnJWZ91y/KfrhBzHw0FPZIamUZCLRymC8x/ltu0GtV4mFFblYos1c+A7ZYjW854 X-Received: by 2002:a63:1018:: with SMTP id f24mr2749391pgl.343.1564107300213; Thu, 25 Jul 2019 19:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564107300; cv=none; d=google.com; s=arc-20160816; b=XcPGGMIk1FjqmpovalU1QoD8FxeCMgLkIWR2W430uNyZONWOt+S+NBGtHsy8mMy7XL P2BGIg+i7pvXc36lbWOkocNa5sqwI1wBEZqawEipjFOFC1h6IgCBiEurod6GbX+EA2YJ sL0vIdW/GXSkufuIO2oKNsLmbeD+jyP1nMX/GV2Sf+TxTTsNpSavvNxpWj03jgj3lxdh SpnOv9OJv8nI5LeqK4H9UUJLTQwamIPFURCzuxsK+pu5zEqlqzFtaR5DoR493jSmT9bN p/9ijABHsyMv2HqRZ500ns3ouZvs+HOOEV0YkOJcyzktnhYQdXW+f9yvecXFyBIWdrGu CwpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=gxep3o4CQkz6M3L7Ey1PLP62cJSLtiRdX/UW3u/qIXQ=; b=DnkUPpiUB6kRBn3A26Dxhz4StFd7YT9+UmYyJKitV1x9+ZiQ5rbjlqHsVJMKvBVNi4 StNlyDNt6yjT60eTJGgt5hpwqLlrzsE6/5qy/GfnkEY4nsbmSM+a77sQRUWTc5MpVDrs 9Z8MNVcqF3sHG1uIo2l7zuTpsQZxI+h0+AnFxjb/sAdcF5WBxdD2k5rfMTw9h33PEwN0 sg5sVuvcwIEeHViY/RuX0+CBU4/Ce/my0rtKtu8nWhkG83Y1O2ExEOtU9xxyR0AWtyAQ GM1+qFVx5aaIsPSXx3rG+NLBH4M1p0WhHIdNQrH8Kd/OsA6moQvry+3HQlMLArgqmIXW DEqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 6si8411986pgb.201.2019.07.25.19.14.45; Thu, 25 Jul 2019 19:15:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726323AbfGZCME (ORCPT + 99 others); Thu, 25 Jul 2019 22:12:04 -0400 Received: from mga12.intel.com ([192.55.52.136]:25299 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726043AbfGZCME (ORCPT ); Thu, 25 Jul 2019 22:12:04 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 19:12:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,308,1559545200"; d="scan'208";a="254179356" Received: from yungchua-mobl.ccr.corp.intel.com (HELO [10.252.184.27]) ([10.252.184.27]) by orsmga001.jf.intel.com with ESMTP; 25 Jul 2019 19:12:00 -0700 Subject: Re: [alsa-devel] [RFC PATCH 09/40] soundwire: cadence_master: fix usage of CONFIG_UPDATE To: Pierre-Louis Bossart , alsa-devel@alsa-project.org Cc: tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Sanyog Kale References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-10-pierre-louis.bossart@linux.intel.com> From: Bard liao Message-ID: <3aa182a9-4b8e-96dd-e8f8-f2f5a90401cb@linux.intel.com> Date: Fri, 26 Jul 2019 10:11:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190725234032.21152-10-pierre-louis.bossart@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/26/2019 7:40 AM, Pierre-Louis Bossart wrote: > Per the hardware documentation, all changes to MCP_CONFIG, > MCP_CONTROL, MCP_CMDCTRL and MCP_PHYCTRL need to be validated with a > self-clearing write to MCP_CONFIG_UPDATE. > > For some reason, the existing code only does this write to > CONFIG_UPDATE when enabling interrupts. Add a helper and do the update > when the CONFIG is changed. > > Signed-off-by: Pierre-Louis Bossart > --- > drivers/soundwire/cadence_master.c | 29 +++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) > > diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c > index 9f611a1fff0a..eb46cf651d62 100644 > --- a/drivers/soundwire/cadence_master.c > +++ b/drivers/soundwire/cadence_master.c > @@ -224,6 +224,22 @@ static int cdns_clear_bit(struct sdw_cdns *cdns, int offset, u32 value) > return -EAGAIN; > } > > +/* > + * all changes to the MCP_CONFIG, MCP_CONTROL, MCP_CMDCTRL and MCP_PHYCTRL > + * need to be confirmed with a write to MCP_CONFIG_UPDATE > + */ > +static int cdns_update_config(struct sdw_cdns *cdns) > +{ > + int ret; > + > + ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, > + CDNS_MCP_CONFIG_UPDATE_BIT); > + if (ret < 0) > + dev_err(cdns->dev, "Config update timedout\n"); > + > + return ret; > +} > + > /* > * debugfs > */ > @@ -758,15 +774,9 @@ static int _cdns_enable_interrupt(struct sdw_cdns *cdns) > */ > int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns) > { > - int ret; > - > _cdns_enable_interrupt(cdns); > - ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, > - CDNS_MCP_CONFIG_UPDATE_BIT); > - if (ret < 0) > - dev_err(cdns->dev, "Config update timedout\n"); > > - return ret; Should we add cdns_update_config() here? > + return 0; > } > EXPORT_SYMBOL(sdw_cdns_enable_interrupt); > > @@ -943,7 +953,10 @@ int sdw_cdns_init(struct sdw_cdns *cdns) > > cdns_writel(cdns, CDNS_MCP_CONFIG, val); > > - return 0; > + /* commit changes */ > + ret = cdns_update_config(cdns); > + > + return ret; > } > EXPORT_SYMBOL(sdw_cdns_init); >