Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5436427imw; Wed, 20 Jul 2022 05:53:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sF5ZvPdS/VCLqIBXVeCTU/a4S2LunifXIoqs4fHxm1nmo0ekvWR3lD7VBIfvmJoUCxxh9/ X-Received: by 2002:a17:902:d491:b0:16c:509a:ac3b with SMTP id c17-20020a170902d49100b0016c509aac3bmr39738057plg.103.1658321594348; Wed, 20 Jul 2022 05:53:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658321594; cv=none; d=google.com; s=arc-20160816; b=yE27cx0XhWNeGj/awxbLQ4UMoFmGs0kZK8trUifsufkN7sNyvINUUEB0s0ojjYpwkD CnwNtIHY8za94kC8Aiiv2mWoHY7s5BUUElHlMT3fXkP7WWtOzLpyR0xBctY360s0sczm intJm6dqrcSouEyDqY/qMVwySdeV3FK2NRdJISwUq5CdjhILKJYND54hvxxTCbgJtkJS uiAmzlgZDoW0X9T39qKfYaWnnmrhr5L4buUloEXD+XenuHEPmKW9IGf/0hEZWuU/6Ksm j3ou5bJKraFxSw4hEZTDj8HQP1PirUsr3MixIbGYT/2Y3ckewVFqPC0jgz0Zg1hy3b2M HAjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=RnfcxwjD5VEqdAApN8ZMGAAkgvJHjWCm9p0n29wZyrM=; b=WYinr90MQhbjGUUULDQ2Qt5xSDCpmR+4f6DX9FvsHg68wKjXRUCsh4AZRDnot0oazF +wmvK5/sVeInEavp9zFHHRFa8TuvQ/EhnSxvFH9roKdwaJrwZh48UawGDwVEESa3kvc7 +nMhJ4Gq8iQvrapIXUui4CUdEIB+feLLDuqyRyitwEd/RfynKpDT4aeWpr4GQOjs4bCo CNOttUlgMSjdXGiaYYtaUAgmDL3/zg22oySi58oWUY0aQUpVTuBIQrajg+u6vSbglKVR MJFOGaH3SbtByHsthy/Lh9ZxAsIq8oX6hbUJ1ys9203e4eyAFm2rELiWGSEo+eW7DBPq zvFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=BfHJXcPl; 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=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb16-20020a17090b35d000b001ea9218215bsi2727602pjb.67.2022.07.20.05.53.00; Wed, 20 Jul 2022 05:53:14 -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=@crapouillou.net header.s=mail header.b=BfHJXcPl; 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=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235913AbiGTMEQ (ORCPT + 99 others); Wed, 20 Jul 2022 08:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232187AbiGTMEP (ORCPT ); Wed, 20 Jul 2022 08:04:15 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 793456B241; Wed, 20 Jul 2022 05:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1658318652; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RnfcxwjD5VEqdAApN8ZMGAAkgvJHjWCm9p0n29wZyrM=; b=BfHJXcPl0gTqQpDrY09cVTdgChK8nlMPusOWuVwRkxOdgl3gPDJiEk39+/L/vctWhsB/9g aCx/QmdduNUuDfR6YmIXqok2/foWS6RpP88WwvPja6pTjk/qeP4blL2pCLloi6H9ucXxpt 9oBSxvVdZRNcM+pCfFT2pnJbNPrS3/o= Date: Wed, 20 Jul 2022 13:04:00 +0100 From: Paul Cercueil Subject: Re: [PATCH v4 11/11] ASoC: jz4740-i2s: Refactor DAI probe/remove ops as component ops To: Aidan MacDonald Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, linux-mips@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Message-Id: In-Reply-To: <20220708160244.21933-12-aidanmacdonald.0x0@gmail.com> References: <20220708160244.21933-1-aidanmacdonald.0x0@gmail.com> <20220708160244.21933-12-aidanmacdonald.0x0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 Hi Aidan, Le ven., juil. 8 2022 at 17:02:44 +0100, Aidan MacDonald=20 a =E9crit : > Move most of the DAI probe/remove logic into component ops. > This makes things more consistent because the AIC clock is > now managed solely from the component side. And it makes it > easier to add codec switching support later on. >=20 > Signed-off-by: Aidan MacDonald Reviewed-by: Paul Cercueil Cheers, -Paul > --- > sound/soc/jz4740/jz4740-i2s.c | 54=20 > +++++++++++++++++++---------------- > 1 file changed, 30 insertions(+), 24 deletions(-) >=20 > diff --git a/sound/soc/jz4740/jz4740-i2s.c=20 > b/sound/soc/jz4740/jz4740-i2s.c > index 5db73f12efcf..d99a19bc5166 100644 > --- a/sound/soc/jz4740/jz4740-i2s.c > +++ b/sound/soc/jz4740/jz4740-i2s.c > @@ -306,32 +306,10 @@ static int jz4740_i2s_set_sysclk(struct=20 > snd_soc_dai *dai, int clk_id, > static int jz4740_i2s_dai_probe(struct snd_soc_dai *dai) > { > struct jz4740_i2s *i2s =3D snd_soc_dai_get_drvdata(dai); > - int ret; > - > - ret =3D clk_prepare_enable(i2s->clk_aic); > - if (ret) > - return ret; >=20 > snd_soc_dai_init_dma_data(dai, &i2s->playback_dma_data, > &i2s->capture_dma_data); >=20 > - regmap_write(i2s->regmap, JZ_REG_AIC_CONF, JZ_AIC_CONF_RESET); > - > - regmap_write(i2s->regmap, JZ_REG_AIC_CONF, > - JZ_AIC_CONF_OVERFLOW_PLAY_LAST | > - JZ_AIC_CONF_I2S | JZ_AIC_CONF_INTERNAL_CODEC); > - > - regmap_field_write(i2s->field_rx_fifo_thresh, 7); > - regmap_field_write(i2s->field_tx_fifo_thresh, 8); > - > - return 0; > -} > - > -static int jz4740_i2s_dai_remove(struct snd_soc_dai *dai) > -{ > - struct jz4740_i2s *i2s =3D snd_soc_dai_get_drvdata(dai); > - > - clk_disable_unprepare(i2s->clk_aic); > return 0; > } >=20 > @@ -351,7 +329,6 @@ static const struct snd_soc_dai_ops=20 > jz4740_i2s_dai_ops =3D { >=20 > static struct snd_soc_dai_driver jz4740_i2s_dai =3D { > .probe =3D jz4740_i2s_dai_probe, > - .remove =3D jz4740_i2s_dai_remove, > .playback =3D { > .channels_min =3D 1, > .channels_max =3D 2, > @@ -389,7 +366,6 @@ static const struct i2s_soc_info=20 > jz4760_i2s_soc_info =3D { >=20 > static struct snd_soc_dai_driver jz4770_i2s_dai =3D { > .probe =3D jz4740_i2s_dai_probe, > - .remove =3D jz4740_i2s_dai_remove, > .playback =3D { > .channels_min =3D 1, > .channels_max =3D 2, > @@ -459,8 +435,38 @@ static int jz4740_i2s_resume(struct=20 > snd_soc_component *component) > return 0; > } >=20 > +static int jz4740_i2s_probe(struct snd_soc_component *component) > +{ > + struct jz4740_i2s *i2s =3D snd_soc_component_get_drvdata(component); > + int ret; > + > + ret =3D clk_prepare_enable(i2s->clk_aic); > + if (ret) > + return ret; > + > + regmap_write(i2s->regmap, JZ_REG_AIC_CONF, JZ_AIC_CONF_RESET); > + > + regmap_write(i2s->regmap, JZ_REG_AIC_CONF, > + JZ_AIC_CONF_OVERFLOW_PLAY_LAST | > + JZ_AIC_CONF_I2S | JZ_AIC_CONF_INTERNAL_CODEC); > + > + regmap_field_write(i2s->field_rx_fifo_thresh, 7); > + regmap_field_write(i2s->field_tx_fifo_thresh, 8); > + > + return 0; > +} > + > +static void jz4740_i2s_remove(struct snd_soc_component *component) > +{ > + struct jz4740_i2s *i2s =3D snd_soc_component_get_drvdata(component); > + > + clk_disable_unprepare(i2s->clk_aic); > +} > + > static const struct snd_soc_component_driver jz4740_i2s_component =3D { > .name =3D "jz4740-i2s", > + .probe =3D jz4740_i2s_probe, > + .remove =3D jz4740_i2s_remove, > .suspend =3D jz4740_i2s_suspend, > .resume =3D jz4740_i2s_resume, > .legacy_dai_naming =3D 1, > -- > 2.35.1 >=20