Unverified Commit 12974257 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Mark Brown
Browse files

ASoC: mchp-pdmc: use FIELD_PREP() where possible



Use FIELD_PREP() macro where possible instead of driver local defined
macros.

Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230301113807.24036-5-claudiu.beznea@microchip.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2d8dad4d
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@

#include <dt-bindings/sound/microchip,pdmc.h>

#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -49,8 +50,6 @@
#define MCHP_PDMC_MR_OSR256		(3 << 16)

#define MCHP_PDMC_MR_SINCORDER_MASK	GENMASK(23, 20)
#define MCHP_PDMC_MR_SINCORDER(order)	(((order) << 20) & \
					 MCHP_PDMC_MR_SINCORDER_MASK)

#define MCHP_PDMC_MR_SINC_OSR_MASK	GENMASK(27, 24)
#define MCHP_PDMC_MR_SINC_OSR_DIS	(0 << 24)
@@ -62,8 +61,6 @@
#define MCHP_PDMC_MR_SINC_OSR_256	(6 << 24)

#define MCHP_PDMC_MR_CHUNK_MASK		GENMASK(31, 28)
#define MCHP_PDMC_MR_CHUNK(chunk)	(((chunk) << 28) & \
					 MCHP_PDMC_MR_CHUNK_MASK)

/*
 * ---- Configuration Register (Read/Write) ----
@@ -617,10 +614,10 @@ static int mchp_pdmc_hw_params(struct snd_pcm_substream *substream,

	mr_val |= mchp_pdmc_mr_set_osr(dd->audio_filter_en, osr);

	mr_val |= MCHP_PDMC_MR_SINCORDER(dd->sinc_order);
	mr_val |= FIELD_PREP(MCHP_PDMC_MR_SINCORDER_MASK, dd->sinc_order);

	dd->addr.maxburst = mchp_pdmc_period_to_maxburst(snd_pcm_lib_period_bytes(substream));
	mr_val |= MCHP_PDMC_MR_CHUNK(dd->addr.maxburst);
	mr_val |= FIELD_PREP(MCHP_PDMC_MR_CHUNK_MASK, dd->addr.maxburst);
	dev_dbg(comp->dev, "maxburst set to %d\n", dd->addr.maxburst);

	snd_soc_component_update_bits(comp, MCHP_PDMC_MR,