ASoC: mchp-pdmc: use FIELD_PREP() where possible
authorClaudiu Beznea <claudiu.beznea@microchip.com>
Wed, 1 Mar 2023 11:38:03 +0000 (13:38 +0200)
committerMark Brown <broonie@kernel.org>
Sun, 5 Mar 2023 23:37:43 +0000 (23:37 +0000)
Use FIELD_PREP() macro where possible instead of driver local defined
macros.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230301113807.24036-5-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/atmel/mchp-pdmc.c

index 1aed3baa9369708336378c760f6a2a3e6bec5373..6ec5324fd65ecb3b80b18e8f1ba14f480d334266 100644 (file)
@@ -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,