Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp775551iog; Wed, 29 Jun 2022 09:57:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vMewctcFi7+hMvoe/cSbvf+6jlXYIsBa+MC3t+LSAI/DSAULO8+DcvUDwx1vm+82jSIar9 X-Received: by 2002:a17:90b:3596:b0:1ec:f563:d64c with SMTP id mm22-20020a17090b359600b001ecf563d64cmr6698975pjb.88.1656521824638; Wed, 29 Jun 2022 09:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656521824; cv=none; d=google.com; s=arc-20160816; b=G5+vVdojvHMfjdiAdHZAnL2fc45LLyFRpLP8vy00G75dgVhkgFgCTIiK017A26Y3K+ fybiDOmM2GcNKFgSKX8zxApZYYjt7pBZRybNzn6cXShtJBIxRG243t+dN3evqN8izDsM pZLmgUgw4F1jQeEjbnpqMp+/9qAwzhiQgRmjvndluFhvHx4u3HTguLoHJvaZXvguhNuV FwUW/KlUEtirXv0doZL9Yxq7Q7EEmDLveu+hSEa8+1M9KlzZatpOSMqtZvFltbG8tNFP mxLsj1YTLrPX1NMUX2PqHLoiBvP067hfiAz6pgZOqmYJLXAW7VPcrWdqFL9ZFErx1e+D VfkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=8I4xTuCAIj7p4jZTE7jxL30+O2A4Baj92YRuLJCD+2E=; b=FOXkLIoAOCSvUwlof19Kx7E7abghPrC9kHghjRg/fICl87+Mvx4/UAcatdeKu737EX H6SKkfVqUB7SZ2pWudN4Zh88jHn/xVGdfYAeIiEXCgbxTd9VwE46OUjikaF+Us4ygXjM OFcMnwjVr57d4bFwwY0iqup0YW+v79byQoOND26J8GL3a7p58IJ3J6aoJ5VQVtd12YdS e9YkZCZmWayy7/9ZHGZspxTnjPcmklJs8TLzP6CPiok+yP8zv+wD4b/IYwu8unw7ud3J +gnds1OKIcWo1x8IB4YtXbV0IMz+VGlVuyIllBeO73Dy3Ck4k0t1Umk9KhVkRmoMipiA E/Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="kws0GL/x"; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 131-20020a630089000000b0040dd290c38bsi14826956pga.797.2022.06.29.09.56.52; Wed, 29 Jun 2022 09:57:04 -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=@linaro.org header.s=google header.b="kws0GL/x"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232912AbiF2QJf (ORCPT + 99 others); Wed, 29 Jun 2022 12:09:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232027AbiF2QJd (ORCPT ); Wed, 29 Jun 2022 12:09:33 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0591E240B5 for ; Wed, 29 Jun 2022 09:09:32 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id i205-20020a1c3bd6000000b003a03567d5e9so497521wma.1 for ; Wed, 29 Jun 2022 09:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=8I4xTuCAIj7p4jZTE7jxL30+O2A4Baj92YRuLJCD+2E=; b=kws0GL/xKMY13kVKn2OsJYtYy4FcSDfeIzROdP+wdqZkq3V9xeg2Uo5us2nn0FSe8Y civ8MIuPYUDEnjtQtD4+196WxZDhMcubB8zE42ZeZ4ohhZO3EzQvmfEquY6K+hyeXQsx hlYM0vK8Vp5pHQC/RXWRLUqKWky4TNHBrUlBMc9ty8YkjdLq9bz3HmbJ80l9WzMW/c1Y fP8DO/xp73Ov60anXHeO8shQa9Jz3CSV33sd5bha+Dwjat1znxuivO/pDKKeP+AXR6yo 6HkErcYGeKZ2xjA0demS9oyMYHku3Rdj2QFhaTz70Arf80zeZ5qPYnIRLPr7mOCdlI4E HE4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=8I4xTuCAIj7p4jZTE7jxL30+O2A4Baj92YRuLJCD+2E=; b=GtzqiZ9/H0cAM9m/9sbLiiKaqu9VcG+90prgXSFuFFun2XGGylEVeYd+xQ1Ze6jyg1 T60zqY+1soHOhBXVMI9CTterer3z6Z3aWcJjo9hyGaJp00PDizhT1/HMKBE0YpcUS/Jc zpzbTylSXvhU9zUpsGhdEr1eFQhImCe9P8MTh/1wcd3aTcs20xfZJGi3ywBoHz2Rp5Hf VsGrjkgSYKsQZtwTfckQunUfudtAbhEQLQIQ8B/F3xyx1sPFgM/yudxaKVkExxfcC371 Sq2ZM16fZdhTR7cUPonogorcypUMgJhlp+9smqaine1Du411I9kDFt9bQNDgBus/gpcP vlXA== X-Gm-Message-State: AJIora8scu/R9xBI3rU6DLs5ssNdzV8F8OA8UtyZrB1V9BMu4mehZXP7 iRmWbVibiv1gLXWp9pQru/fWEQ== X-Received: by 2002:a7b:cc10:0:b0:3a0:7d75:b576 with SMTP id f16-20020a7bcc10000000b003a07d75b576mr4600543wmh.92.1656518970550; Wed, 29 Jun 2022 09:09:30 -0700 (PDT) Received: from [192.168.86.238] (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.googlemail.com with ESMTPSA id r185-20020a1c2bc2000000b003a0484c069bsm4067034wmr.41.2022.06.29.09.09.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Jun 2022 09:09:29 -0700 (PDT) Message-ID: Date: Wed, 29 Jun 2022 17:09:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 2/4] ASoC: codecs: add wsa883x amplifier support Content-Language: en-US To: Pierre-Louis Bossart , broonie@kernel.org Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, tiwai@suse.com References: <20220629090644.67982-1-srinivas.kandagatla@linaro.org> <20220629090644.67982-3-srinivas.kandagatla@linaro.org> <352fac7e-597c-84af-d33b-bdff0e2acdb6@linux.intel.com> From: Srinivas Kandagatla In-Reply-To: <352fac7e-597c-84af-d33b-bdff0e2acdb6@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Thanks Pierre, On 29/06/2022 16:03, Pierre-Louis Bossart wrote: > >> +/* 4 ports */ >> +static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA883X_MAX_SWR_PORTS] = { >> + { >> + /* DAC */ >> + .num = 1, >> + .type = SDW_DPN_SIMPLE, >> + .min_ch = 1, >> + .max_ch = 1, >> + .simple_ch_prep_sm = true, >> + .read_only_wordlength = true, >> + }, { > > nit-pick: it's unusual to see such opening brackets for structure > initialization, usually there are on a new line. > >> + /* COMP */ >> + .num = 2, >> + .type = SDW_DPN_SIMPLE, >> + .min_ch = 1, >> + .max_ch = 1, >> + .simple_ch_prep_sm = true, >> + .read_only_wordlength = true, >> + }, { >> + /* BOOST */ >> + .num = 3, >> + .type = SDW_DPN_SIMPLE, >> + .min_ch = 1, >> + .max_ch = 1, >> + .simple_ch_prep_sm = true, >> + .read_only_wordlength = true, >> + }, { >> + /* VISENSE */ >> + .num = 4, >> + .type = SDW_DPN_SIMPLE, >> + .min_ch = 1, >> + .max_ch = 1, >> + .simple_ch_prep_sm = true, >> + .read_only_wordlength = true, >> + } >> +}; > >> +static int wsa883x_update_status(struct sdw_slave *slave, >> + enum sdw_slave_status status) >> +{ >> + struct wsa883x_priv *wsa883x = dev_get_drvdata(&slave->dev); >> + >> + if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0) > > do you actually need to test if slave->dev_num is > 0? > Few years back I think it was you who asked me to add this check.. :-) https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2073074.html > if I look at drivers/soundwire/bus.c, update_status cannot really be > invoked with dev_num == 0. > >> + wsa883x_init(wsa883x); >> + >> + return 0; >> +} >> + > >> +static int __maybe_unused wsa883x_runtime_resume(struct device *dev) >> +{ >> + struct sdw_slave *slave = dev_to_sdw_dev(dev); >> + struct regmap *regmap = dev_get_regmap(dev, NULL); >> + struct wsa883x_priv *wsa883x = dev_get_drvdata(dev); >> + int ret; >> + >> + ret = regulator_enable(wsa883x->vdd); >> + if (ret) { >> + dev_err(dev, "Failed to enable vdd regulator (%d)\n", ret); >> + return ret; >> + } >> + >> + gpiod_direction_output(wsa883x->sd_n, 1); >> + >> + wait_for_completion_timeout(&slave->initialization_complete, >> + msecs_to_jiffies(WSA883X_PROBE_TIMEOUT)); > > check for success? You don't want to enable regmap sync below if the > device never successfully attached and initialized. Yes, that might be possible, I can spin a fix for this. thanks, --srini > >> + >> + usleep_range(20000, 20010); >> + regcache_cache_only(regmap, false); >> + regcache_sync(regmap); >> + >> + return 0; >> +} >