From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA4BE126C17 for ; Tue, 7 Apr 2026 19:57:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775591860; cv=none; b=SOET3sRQ8IivFkTQXddRwBeof15IukTZrLRiS1LLzmMk0Du4q/2bRNaJ2pWm8jocPt2XE7ZrkuI5B/vsluSs+ECmtGtuF7DA32qRcM9naC+Pkxw+9eF7Z5mClbs/Uk0YCjhhpiq37uOLk95yiJb0LxdQ/52Ipjq4nYQsrDDgjxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775591860; c=relaxed/simple; bh=YaMK1wa3MMIxrwEsDAo/lFZHK1vAA8Ru5RJohvf2o18=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ihyiy7yA2g5BVDR3+5fMvQkl78C9UaFwF3Vua4qLkffIQc/Ig/xJqW86+/xe9i8xmKFI08ridVyd7HBrL3Ltuc7jq9OVCZ9z7pImiVr3+h2AUJyndgr9G7BzX7N1f3siRNarobqCci1k+KoiVv9ZtKAI/gPmffgQUsYx0hh4dlo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FVW+CNqv; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=D9t7lNKf; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FVW+CNqv"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="D9t7lNKf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775591857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=afqKvOBY6UcokwbofYX7GYTJbiVKQVdFWAEZ5QM/NjE=; b=FVW+CNqvlanbq43JF0V2OeRQg+W5AzEIu8dgHnuKiw2uxEEv8K4aqPsRZWmOMpMV7wNVH2 WLT7hiOy+v2eoLlrFzx4jL5q9dltIe0JzCCA66m4whSEScgP8FvVw1qc8iXX32K4YcvGLW R1aSlQO+q4c0ZIgyMca8B+de4KSOtNI= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-543-1H1HqRd2PQyf1FFFcJ7B5g-1; Tue, 07 Apr 2026 15:57:34 -0400 X-MC-Unique: 1H1HqRd2PQyf1FFFcJ7B5g-1 X-Mimecast-MFC-AGG-ID: 1H1HqRd2PQyf1FFFcJ7B5g_1775591854 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-50b31cff27fso52211151cf.3 for ; Tue, 07 Apr 2026 12:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1775591854; x=1776196654; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=afqKvOBY6UcokwbofYX7GYTJbiVKQVdFWAEZ5QM/NjE=; b=D9t7lNKfmj0NZLfVhnO7KrCgFzVeFSN/0B9x37Y72vjePWg3DnRAgCSqTr8LfJEdgd Ewb/pFkEvbhCRBwNI8frYDISv5HmNv16MECdJC4SUbi0VC/1qmU69szN43/bhElLiZFC aZJg6cZdkS4P+p5SDN5NE6eKXrpppcAeELrugtCGwGENkWuJ/H4XjxQih0Dj0NdxBwT0 QusgxssjrW7roRD/gjJH5FE+G6whwIWlezH53qhz5nBfxrIlGFX2KSsW6WFueYoXLR9P BieJVLgfhqtqkA2dbnSDCtwDGOGZVPoor6rDGt2TMckhl3tHc3b+Fan8ApOJfeoP0v5V quog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775591854; x=1776196654; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=afqKvOBY6UcokwbofYX7GYTJbiVKQVdFWAEZ5QM/NjE=; b=CA7Glse2NRsXDzSQJEONlD2PvGh98shCWeyHCeOHHKqZMlzCRURed8iFmBjVlF/4J1 YKvBXW4HtRZffgdJhp5urgJuR92eQU/OMLb+AnNOCynYMRRhulVXUVr1oqYpITRekmUB SRJ9RUqDvneJSBZKqc9+3ex6mg/jlWzBuOJ4CtdDVfFE9/yq3pv/kZjQ4WYyWdSVtUPN I2B0Mdw6qM2CJ8MVKxP6e/nNxUXUtd/XPaSSPMmXJ+TAnnhsXwJ7BdbCDsPaFzekU17F KQ4OEMHyP/G+HYkOzwJ8fXY4CmlDjshl62W5dHSfeWnwgyE0zqV/FW/nckPHieT98wsB ZwXA== X-Forwarded-Encrypted: i=1; AJvYcCWl0kYkdM3lkKS6NVYMjznw3swbNsd449lKm1djpCuMkTAdXcE9EYx5jINZ7gSvrdCAXRMHFK2eQyKxecc=@vger.kernel.org X-Gm-Message-State: AOJu0Ywl7KPJE2qnTsvo4O+Ko7LhYhAY4Dkd0oZtNErDuhKdNv42fWCM cRiud/bzKuJj6yYKqJ88sytK9RUnj+rF188yJsXjj/EJdkmm0MvDbWxuT7zLtpPSaImDY7/84Ra w5qxsdSwVQy3L+Dvl6HuavaeLxMKjGREcKuruQ3uRxTN0bb6S2hHFzHvCtyfBsNx6DQ== X-Gm-Gg: AeBDiev9ujObVG/oYKIVymduA66kE8+1n9XRSUstxqswumJTI1APzg+cZTTPuNdB1b/ wfNL/AgqFvZQLi8cSOm3PgaKcFFQpGiXjvdJyQl2/PwZwvpJOntMh0GmjZ3hWP/xKAuL3jdVyWo a/8DAuLBABFdr3uqeTLWDbQKHx/yMXU5vZob+Aw3mb0n8qM/nIpT0WowPMrU81zAE1xFaUvbP6T iYUQq5N6QFukK0h93sYYsPZKwZy+FT8evmQwFOGb019WDVYcdlAn083Jrtn8ZGHHn+KW5YG5x2I eKjJCOSYOk/tWpBSweFnLnjEICFm+p/VDYVBis6Am29Zx6qoDLCDI6olu4/5lx5Cp1/uqQLcRVh f821mviwjmDB+tukTqWE= X-Received: by 2002:a05:622a:13d4:b0:50d:83a4:2995 with SMTP id d75a77b69052e-50d83a42dbdmr187698241cf.21.1775591853759; Tue, 07 Apr 2026 12:57:33 -0700 (PDT) X-Received: by 2002:a05:622a:13d4:b0:50d:83a4:2995 with SMTP id d75a77b69052e-50d83a42dbdmr187697771cf.21.1775591853165; Tue, 07 Apr 2026 12:57:33 -0700 (PDT) Received: from redhat.com ([2600:382:772d:3619:ed0:4a9c:acd6:3fc9]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-50d4aed181asm164262931cf.0.2026.04.07.12.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 12:57:32 -0700 (PDT) Date: Tue, 7 Apr 2026 15:57:30 -0400 From: Brian Masney To: Marek Vasut Cc: linux-clk@vger.kernel.org, Michael Walle , Conor Dooley , Krzysztof Kozlowski , Michael Turquette , Michael Walle , Rob Herring , Stephen Boyd , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 6/6] clk: fsl-sai: Add MCLK generation support Message-ID: References: <20260406215150.176599-1-marex@nabladev.com> <20260406215150.176599-6-marex@nabladev.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260406215150.176599-6-marex@nabladev.com> User-Agent: Mutt/2.3.0 (2026-01-25) Hi Marek, On Mon, Apr 06, 2026 at 11:49:46PM +0200, Marek Vasut wrote: > The driver currently supports generating BCLK. There are systems which > require generation of MCLK instead. Register new MCLK clock and handle > clock-cells = <1> to differentiate between BCLK and MCLK. In case of a > legacy system with clock-cells = <0>, the driver behaves as before, i.e. > always returns BCLK. > > Note that it is not possible re-use the current SAI audio driver to > generate MCLK and correctly enable and disable the MCLK. > > If SAI (audio driver) is used to control the MCLK enablement, then MCLK > clock is not always enabled, and it is not necessarily enabled when the > codec may need the clock to be enabled. There is also no way for the > codec node to specify phandle to clock provider in DT, because the SAI > (audio driver) is not clock provider. > > If SAI (clock driver) is used to control the MCLK enablement, then MCLK > clock is enabled when the codec needs the clock enabled, because the > codec is the clock consumer and the SAI (clock driver) is the clock > provider, and the codec driver can request the clock to be enabled when > needed. There is also the usual phandle to clock provider in DT, because > the SAI (clock driver) is clock provider. > > Acked-by: Michael Walle > Signed-off-by: Marek Vasut > --- > Cc: Brian Masney > Cc: Conor Dooley > Cc: Krzysztof Kozlowski > Cc: Michael Turquette > Cc: Michael Walle > Cc: Rob Herring > Cc: Stephen Boyd > Cc: devicetree@vger.kernel.org > Cc: linux-clk@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > V2: No change > V3: - Rebase on current next, update mail address > - Update commit message according to clarify the difference between > SAI audio and SAI clock driver > - Pick ancient AB from Michael, although this may be outdated > https://patchwork.kernel.org/project/alsa-devel/patch/20241226162234.40141-4-marex@denx.de/ > V4: Use the fsl_sai_clk_register() helper. > --- > drivers/clk/clk-fsl-sai.c | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > > diff --git a/drivers/clk/clk-fsl-sai.c b/drivers/clk/clk-fsl-sai.c > index 7ec9a4f22735c..386ee5f77a986 100644 > --- a/drivers/clk/clk-fsl-sai.c > +++ b/drivers/clk/clk-fsl-sai.c > @@ -6,6 +6,7 @@ > */ > > #include > +#include This include needs to be moved earlier into the series to keep bisectability. It looks like on patch 2. I'll also comment there. > #include > #include > #include > @@ -15,22 +16,37 @@ > > #define I2S_CSR 0x00 > #define I2S_CR2 0x08 > +#define I2S_MCR 0x100 > #define CSR_BCE_BIT 28 > +#define CSR_TE_BIT 31 > #define CR2_BCD BIT(24) > #define CR2_DIV_SHIFT 0 > #define CR2_DIV_WIDTH 8 > +#define MCR_MOE BIT(30) > > struct fsl_sai_clk { > struct clk_divider bclk_div; > + struct clk_divider mclk_div; > struct clk_gate bclk_gate; > + struct clk_gate mclk_gate; > struct clk_hw *bclk_hw; > + struct clk_hw *mclk_hw; > spinlock_t lock; > }; > > struct fsl_sai_data { > unsigned int offset; /* Register offset */ > + bool have_mclk; /* Have MCLK control */ > }; > > +static struct clk_hw * > +fsl_sai_of_clk_get(struct of_phandle_args *clkspec, void *data) > +{ > + struct fsl_sai_clk *sai_clk = data; > + > + return clkspec->args[0] ? sai_clk->mclk_hw : sai_clk->bclk_hw; For the case when clock-cells is 0, should this check: clkspec->args_count == 0 || return clkspec->args[0] Brian