staging: most: dim2: remove clock speed processing from the HDM
authorChristian Gromm <christian.gromm@microchip.com>
Tue, 8 May 2018 09:44:50 +0000 (11:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 May 2018 11:41:48 +0000 (13:41 +0200)
This removes the module parameter clock_speed from the HDM code.

Instead, the platform-dependent clock speed must be delivered by the
platform driver with the help of the dim2_platform_data.clk_speed.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/dim2/dim2.c
drivers/staging/most/dim2/dim2.h

index f9bc7dea75b8039279c67b742fb14d91d2437fda..fa4559b8f536ea97dc9d6979e6ba0b224cfa9c16 100644 (file)
 #define MAX_BUF_SIZE_PACKET     2048
 #define MAX_BUF_SIZE_STREAMING  (8 * 1024)
 
-/* command line parameter to select clock speed */
-static char *clock_speed;
-module_param(clock_speed, charp, 0000);
-MODULE_PARM_DESC(clock_speed, "MediaLB Clock Speed");
-
 /*
  * The parameter representing the number of frames per sub-buffer for
  * synchronous channels.  Valid values: [0 .. 6].
@@ -78,7 +73,6 @@ struct hdm_channel {
  * @most_iface: most interface structure
  * @capabilities: an array of channel capability data
  * @io_base: I/O register base address
- * @clk_speed: user selectable (through command line parameter) clock speed
  * @netinfo_task: thread to deliver network status
  * @netinfo_waitq: waitq for the thread to sleep
  * @deliver_netinfo: to identify whether network status received
@@ -93,7 +87,6 @@ struct dim2_hdm {
        struct most_interface most_iface;
        char name[16 + sizeof "dim2-"];
        void __iomem *io_base;
-       int clk_speed;
        struct task_struct *netinfo_task;
        wait_queue_head_t netinfo_waitq;
        int deliver_netinfo;
@@ -158,52 +151,25 @@ void dimcb_on_error(u8 error_id, const char *error_message)
 /**
  * startup_dim - initialize the dim2 interface
  * @pdev: platform device
- *
- * Get the value of command line parameter "clock_speed" if given or use the
- * default value, enable the clock and PLL, and initialize the dim2 interface.
  */
 static int startup_dim(struct platform_device *pdev)
 {
        struct dim2_hdm *dev = platform_get_drvdata(pdev);
        struct dim2_platform_data *pdata = pdev->dev.platform_data;
        u8 hal_ret;
+       int ret;
 
-       dev->clk_speed = -1;
-
-       if (clock_speed) {
-               if (!strcmp(clock_speed, "256fs"))
-                       dev->clk_speed = CLK_256FS;
-               else if (!strcmp(clock_speed, "512fs"))
-                       dev->clk_speed = CLK_512FS;
-               else if (!strcmp(clock_speed, "1024fs"))
-                       dev->clk_speed = CLK_1024FS;
-               else if (!strcmp(clock_speed, "2048fs"))
-                       dev->clk_speed = CLK_2048FS;
-               else if (!strcmp(clock_speed, "3072fs"))
-                       dev->clk_speed = CLK_3072FS;
-               else if (!strcmp(clock_speed, "4096fs"))
-                       dev->clk_speed = CLK_4096FS;
-               else if (!strcmp(clock_speed, "6144fs"))
-                       dev->clk_speed = CLK_6144FS;
-               else if (!strcmp(clock_speed, "8192fs"))
-                       dev->clk_speed = CLK_8192FS;
-       }
-
-       if (dev->clk_speed == -1) {
-               pr_info("Bad or missing clock speed parameter, using default value: 3072fs\n");
-               dev->clk_speed = CLK_3072FS;
-       } else {
-               pr_info("Selected clock speed: %s\n", clock_speed);
+       if (!pdata) {
+               pr_err("missing platform data\n");
+               return -EINVAL;
        }
-       if (pdata && pdata->init) {
-               int ret = pdata->init(pdata, dev->io_base, dev->clk_speed);
 
-               if (ret)
-                       return ret;
-       }
+       ret = pdata->init ? pdata->init(pdata, dev->io_base) : 0;
+       if (ret)
+               return ret;
 
        pr_info("sync: num of frames per sub-buffer: %u\n", fcnt);
-       hal_ret = dim_startup(dev->io_base, dev->clk_speed, fcnt);
+       hal_ret = dim_startup(dev->io_base, pdata->clk_speed, fcnt);
        if (hal_ret != DIM_NO_ERROR) {
                pr_err("dim_startup failed: %d\n", hal_ret);
                if (pdata && pdata->destroy)
index 6a9fc51a2eb4ad884136c8248a43bc02cd554593..999d4d4a2ba09f3a4422e54129aa91c34f2459c4 100644 (file)
@@ -8,14 +8,15 @@
 #ifndef DIM2_HDM_H
 #define        DIM2_HDM_H
 
+#include <linux/types.h>
+
 struct device;
 
 /* platform dependent data for dim2 interface */
 struct dim2_platform_data {
-       int (*init)(struct dim2_platform_data *pd, void __iomem *io_base,
-                   int clk_speed);
+       int (*init)(struct dim2_platform_data *pd, void __iomem *io_base);
        void (*destroy)(struct dim2_platform_data *pd);
-       void *priv;
+       u8 clk_speed;
 };
 
 #endif /* DIM2_HDM_H */