ASoC: meson: remove snd_pcm_ops
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 2 Oct 2019 05:33:55 +0000 (14:33 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 8 Oct 2019 12:47:40 +0000 (13:47 +0100)
snd_pcm_ops is no longer needed.
Let's use component driver callback.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87muej90e4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/meson/axg-fifo.c
sound/soc/meson/axg-fifo.h
sound/soc/meson/axg-frddr.c
sound/soc/meson/axg-toddr.c

index 5a3749938900fa7f1bbb33169f8d8c8847524d52..d6f3eefb8f097d88d36bda544837deb6a81f9a94 100644 (file)
@@ -70,7 +70,8 @@ static void __dma_enable(struct axg_fifo *fifo,  bool enable)
                           enable ? CTRL0_DMA_EN : 0);
 }
 
-static int axg_fifo_pcm_trigger(struct snd_pcm_substream *ss, int cmd)
+int axg_fifo_pcm_trigger(struct snd_soc_component *component,
+                        struct snd_pcm_substream *ss, int cmd)
 {
        struct axg_fifo *fifo = axg_fifo_data(ss);
 
@@ -91,8 +92,10 @@ static int axg_fifo_pcm_trigger(struct snd_pcm_substream *ss, int cmd)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(axg_fifo_pcm_trigger);
 
-static snd_pcm_uframes_t axg_fifo_pcm_pointer(struct snd_pcm_substream *ss)
+snd_pcm_uframes_t axg_fifo_pcm_pointer(struct snd_soc_component *component,
+                                      struct snd_pcm_substream *ss)
 {
        struct axg_fifo *fifo = axg_fifo_data(ss);
        struct snd_pcm_runtime *runtime = ss->runtime;
@@ -102,9 +105,11 @@ static snd_pcm_uframes_t axg_fifo_pcm_pointer(struct snd_pcm_substream *ss)
 
        return bytes_to_frames(runtime, addr - (unsigned int)runtime->dma_addr);
 }
+EXPORT_SYMBOL_GPL(axg_fifo_pcm_pointer);
 
-static int axg_fifo_pcm_hw_params(struct snd_pcm_substream *ss,
-                                 struct snd_pcm_hw_params *params)
+int axg_fifo_pcm_hw_params(struct snd_soc_component *component,
+                          struct snd_pcm_substream *ss,
+                          struct snd_pcm_hw_params *params)
 {
        struct snd_pcm_runtime *runtime = ss->runtime;
        struct axg_fifo *fifo = axg_fifo_data(ss);
@@ -132,15 +137,17 @@ static int axg_fifo_pcm_hw_params(struct snd_pcm_substream *ss,
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(axg_fifo_pcm_hw_params);
 
-static int g12a_fifo_pcm_hw_params(struct snd_pcm_substream *ss,
-                                  struct snd_pcm_hw_params *params)
+int g12a_fifo_pcm_hw_params(struct snd_soc_component *component,
+                           struct snd_pcm_substream *ss,
+                           struct snd_pcm_hw_params *params)
 {
        struct axg_fifo *fifo = axg_fifo_data(ss);
        struct snd_pcm_runtime *runtime = ss->runtime;
        int ret;
 
-       ret = axg_fifo_pcm_hw_params(ss, params);
+       ret = axg_fifo_pcm_hw_params(component, ss, params);
        if (ret)
                return ret;
 
@@ -149,8 +156,10 @@ static int g12a_fifo_pcm_hw_params(struct snd_pcm_substream *ss,
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(g12a_fifo_pcm_hw_params);
 
-static int axg_fifo_pcm_hw_free(struct snd_pcm_substream *ss)
+int axg_fifo_pcm_hw_free(struct snd_soc_component *component,
+                        struct snd_pcm_substream *ss)
 {
        struct axg_fifo *fifo = axg_fifo_data(ss);
 
@@ -160,6 +169,7 @@ static int axg_fifo_pcm_hw_free(struct snd_pcm_substream *ss)
 
        return snd_pcm_lib_free_pages(ss);
 }
+EXPORT_SYMBOL_GPL(axg_fifo_pcm_hw_free);
 
 static void axg_fifo_ack_irq(struct axg_fifo *fifo, u8 mask)
 {
@@ -194,7 +204,8 @@ static irqreturn_t axg_fifo_pcm_irq_block(int irq, void *dev_id)
        return IRQ_RETVAL(status);
 }
 
-static int axg_fifo_pcm_open(struct snd_pcm_substream *ss)
+int axg_fifo_pcm_open(struct snd_soc_component *component,
+                     struct snd_pcm_substream *ss)
 {
        struct axg_fifo *fifo = axg_fifo_data(ss);
        struct device *dev = axg_fifo_dev(ss);
@@ -250,8 +261,10 @@ static int axg_fifo_pcm_open(struct snd_pcm_substream *ss)
 
        return ret;
 }
+EXPORT_SYMBOL_GPL(axg_fifo_pcm_open);
 
-static int axg_fifo_pcm_close(struct snd_pcm_substream *ss)
+int axg_fifo_pcm_close(struct snd_soc_component *component,
+                      struct snd_pcm_substream *ss)
 {
        struct axg_fifo *fifo = axg_fifo_data(ss);
        int ret;
@@ -267,28 +280,7 @@ static int axg_fifo_pcm_close(struct snd_pcm_substream *ss)
 
        return ret;
 }
-
-const struct snd_pcm_ops axg_fifo_pcm_ops = {
-       .open =         axg_fifo_pcm_open,
-       .close =        axg_fifo_pcm_close,
-       .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    axg_fifo_pcm_hw_params,
-       .hw_free =      axg_fifo_pcm_hw_free,
-       .pointer =      axg_fifo_pcm_pointer,
-       .trigger =      axg_fifo_pcm_trigger,
-};
-EXPORT_SYMBOL_GPL(axg_fifo_pcm_ops);
-
-const struct snd_pcm_ops g12a_fifo_pcm_ops = {
-       .open =         axg_fifo_pcm_open,
-       .close =        axg_fifo_pcm_close,
-       .ioctl =        snd_pcm_lib_ioctl,
-       .hw_params =    g12a_fifo_pcm_hw_params,
-       .hw_free =      axg_fifo_pcm_hw_free,
-       .pointer =      axg_fifo_pcm_pointer,
-       .trigger =      axg_fifo_pcm_trigger,
-};
-EXPORT_SYMBOL_GPL(g12a_fifo_pcm_ops);
+EXPORT_SYMBOL_GPL(axg_fifo_pcm_close);
 
 int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type)
 {
index bb1e2ce50256719de70d55f6fa716ba825a9424e..cf928d43b558026b53da8d59c5653e309ff1661c 100644 (file)
@@ -15,7 +15,7 @@ struct reset_control;
 struct snd_soc_component_driver;
 struct snd_soc_dai;
 struct snd_soc_dai_driver;
-struct snd_pcm_ops;
+
 struct snd_soc_pcm_runtime;
 
 #define AXG_FIFO_CH_MAX                        128
@@ -75,8 +75,22 @@ struct axg_fifo_match_data {
        struct snd_soc_dai_driver *dai_drv;
 };
 
-extern const struct snd_pcm_ops axg_fifo_pcm_ops;
-extern const struct snd_pcm_ops g12a_fifo_pcm_ops;
+int axg_fifo_pcm_open(struct snd_soc_component *component,
+                     struct snd_pcm_substream *ss);
+int axg_fifo_pcm_close(struct snd_soc_component *component,
+                      struct snd_pcm_substream *ss);
+int axg_fifo_pcm_hw_params(struct snd_soc_component *component,
+                          struct snd_pcm_substream *ss,
+                          struct snd_pcm_hw_params *params);
+int g12a_fifo_pcm_hw_params(struct snd_soc_component *component,
+                           struct snd_pcm_substream *ss,
+                           struct snd_pcm_hw_params *params);
+int axg_fifo_pcm_hw_free(struct snd_soc_component *component,
+                        struct snd_pcm_substream *ss);
+snd_pcm_uframes_t axg_fifo_pcm_pointer(struct snd_soc_component *component,
+                                      struct snd_pcm_substream *ss);
+int axg_fifo_pcm_trigger(struct snd_soc_component *component,
+                        struct snd_pcm_substream *ss, int cmd);
 
 int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type);
 int axg_fifo_probe(struct platform_device *pdev);
index 6ab111c31b284419906710d490eda04cf6a2917a..665d75d49d7b6295cafa2b004bac2d8bdb0105fe 100644 (file)
@@ -149,7 +149,13 @@ static const struct snd_soc_component_driver axg_frddr_component_drv = {
        .num_dapm_widgets       = ARRAY_SIZE(axg_frddr_dapm_widgets),
        .dapm_routes            = axg_frddr_dapm_routes,
        .num_dapm_routes        = ARRAY_SIZE(axg_frddr_dapm_routes),
-       .ops                    = &axg_fifo_pcm_ops
+       .open                   = axg_fifo_pcm_open,
+       .close                  = axg_fifo_pcm_close,
+       .ioctl                  = snd_soc_pcm_lib_ioctl,
+       .hw_params              = axg_fifo_pcm_hw_params,
+       .hw_free                = axg_fifo_pcm_hw_free,
+       .pointer                = axg_fifo_pcm_pointer,
+       .trigger                = axg_fifo_pcm_trigger,
 };
 
 static const struct axg_fifo_match_data axg_frddr_match_data = {
@@ -267,7 +273,13 @@ static const struct snd_soc_component_driver g12a_frddr_component_drv = {
        .num_dapm_widgets       = ARRAY_SIZE(g12a_frddr_dapm_widgets),
        .dapm_routes            = g12a_frddr_dapm_routes,
        .num_dapm_routes        = ARRAY_SIZE(g12a_frddr_dapm_routes),
-       .ops                    = &g12a_fifo_pcm_ops
+       .open                   = axg_fifo_pcm_open,
+       .close                  = axg_fifo_pcm_close,
+       .ioctl                  = snd_soc_pcm_lib_ioctl,
+       .hw_params              = g12a_fifo_pcm_hw_params,
+       .hw_free                = axg_fifo_pcm_hw_free,
+       .pointer                = axg_fifo_pcm_pointer,
+       .trigger                = axg_fifo_pcm_trigger,
 };
 
 static const struct axg_fifo_match_data g12a_frddr_match_data = {
@@ -331,7 +343,13 @@ static const struct snd_soc_component_driver sm1_frddr_component_drv = {
        .num_dapm_widgets       = ARRAY_SIZE(sm1_frddr_dapm_widgets),
        .dapm_routes            = g12a_frddr_dapm_routes,
        .num_dapm_routes        = ARRAY_SIZE(g12a_frddr_dapm_routes),
-       .ops                    = &g12a_fifo_pcm_ops
+       .open                   = axg_fifo_pcm_open,
+       .close                  = axg_fifo_pcm_close,
+       .ioctl                  = snd_soc_pcm_lib_ioctl,
+       .hw_params              = g12a_fifo_pcm_hw_params,
+       .hw_free                = axg_fifo_pcm_hw_free,
+       .pointer                = axg_fifo_pcm_pointer,
+       .trigger                = axg_fifo_pcm_trigger,
 };
 
 static const struct axg_fifo_match_data sm1_frddr_match_data = {
index c8ea2145f576c641dd76c147c1a5317b65d1cb1b..7fef0b96149680c44c195383bf2273db4fb25322 100644 (file)
@@ -181,7 +181,13 @@ static const struct snd_soc_component_driver axg_toddr_component_drv = {
        .num_dapm_widgets       = ARRAY_SIZE(axg_toddr_dapm_widgets),
        .dapm_routes            = axg_toddr_dapm_routes,
        .num_dapm_routes        = ARRAY_SIZE(axg_toddr_dapm_routes),
-       .ops                    = &axg_fifo_pcm_ops
+       .open                   = axg_fifo_pcm_open,
+       .close                  = axg_fifo_pcm_close,
+       .ioctl                  = snd_soc_pcm_lib_ioctl,
+       .hw_params              = axg_fifo_pcm_hw_params,
+       .hw_free                = axg_fifo_pcm_hw_free,
+       .pointer                = axg_fifo_pcm_pointer,
+       .trigger                = axg_fifo_pcm_trigger,
 };
 
 static const struct axg_fifo_match_data axg_toddr_match_data = {
@@ -214,7 +220,13 @@ static const struct snd_soc_component_driver g12a_toddr_component_drv = {
        .num_dapm_widgets       = ARRAY_SIZE(axg_toddr_dapm_widgets),
        .dapm_routes            = axg_toddr_dapm_routes,
        .num_dapm_routes        = ARRAY_SIZE(axg_toddr_dapm_routes),
-       .ops                    = &g12a_fifo_pcm_ops
+       .open                   = axg_fifo_pcm_open,
+       .close                  = axg_fifo_pcm_close,
+       .ioctl                  = snd_soc_pcm_lib_ioctl,
+       .hw_params              = g12a_fifo_pcm_hw_params,
+       .hw_free                = axg_fifo_pcm_hw_free,
+       .pointer                = axg_fifo_pcm_pointer,
+       .trigger                = axg_fifo_pcm_trigger,
 };
 
 static const struct axg_fifo_match_data g12a_toddr_match_data = {
@@ -278,7 +290,13 @@ static const struct snd_soc_component_driver sm1_toddr_component_drv = {
        .num_dapm_widgets       = ARRAY_SIZE(sm1_toddr_dapm_widgets),
        .dapm_routes            = sm1_toddr_dapm_routes,
        .num_dapm_routes        = ARRAY_SIZE(sm1_toddr_dapm_routes),
-       .ops                    = &g12a_fifo_pcm_ops
+       .open                   = axg_fifo_pcm_open,
+       .close                  = axg_fifo_pcm_close,
+       .ioctl                  = snd_soc_pcm_lib_ioctl,
+       .hw_params              = g12a_fifo_pcm_hw_params,
+       .hw_free                = axg_fifo_pcm_hw_free,
+       .pointer                = axg_fifo_pcm_pointer,
+       .trigger                = axg_fifo_pcm_trigger,
 };
 
 static const struct axg_fifo_match_data sm1_toddr_match_data = {