soc: ti: qmss: make acc queue support optional in the driver
authorMurali Karicheri <m-karicheri2@ti.com>
Tue, 13 Oct 2015 20:49:04 +0000 (13:49 -0700)
committerSantosh Shilimkar <ssantosh@kernel.org>
Tue, 13 Oct 2015 20:49:04 +0000 (13:49 -0700)
acc channels are available only if accumulator PDSP is loaded and
running in the SoC. As this requires firmware and user may not have
firmware in the file system, make the accumulator queue support
available in qmss driver optional. To use accumulator queus user needs
to add firmware to the file system and boot up kernel.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>
Documentation/arm/keystone/knav-qmss.txt
drivers/soc/ti/knav_qmss.h
drivers/soc/ti/knav_qmss_acc.c
drivers/soc/ti/knav_qmss_queue.c

index da34a5babfbe16bf3a01b5b397590f5bf460b920..fcdb9fd5f53afbf2038f64de0d5f6d2220b0e518 100644 (file)
@@ -48,3 +48,9 @@ in the file system and boot up the kernel. User would see
  "firmware file ks2_qmss_pdsp_acc48.bin downloaded for PDSP"
 
 in the boot up log if loading of firmware to PDSP is successful.
+
+Use of accumulated queues requires the firmware image to be present in the
+file system. The driver doesn't acc queues to the supported queue range if
+PDSP is not running in the SoC. The API call fails if there is a queue open
+request to an acc queue and PDSP is not running. So make sure to copy firmware
+to file system before using these queue types.
index c31b8d826794c570d1d26535f2d0cf4394346df8..6ff936cacb700e958dcbfa8086ce315d96a2d426 100644 (file)
@@ -137,6 +137,8 @@ struct knav_pdsp_info {
        u32 __iomem                                     *iram;
        u32                                             id;
        struct list_head                                list;
+       bool                                            loaded;
+       bool                                            started;
 };
 
 struct knav_qmgr_info {
index ef6f69db0bd04c06caa6c1b955e3dbbebc91677a..37c4aa95492d3e8ca75d019548660747ce17fcc4 100644 (file)
@@ -482,8 +482,8 @@ struct knav_range_ops knav_acc_range_ops = {
  * Return 0 on success or error
  */
 int knav_init_acc_range(struct knav_device *kdev,
-                               struct device_node *node,
-                               struct knav_range_info *range)
+                       struct device_node *node,
+                       struct knav_range_info *range)
 {
        struct knav_acc_channel *acc;
        struct knav_pdsp_info *pdsp;
@@ -526,6 +526,12 @@ int knav_init_acc_range(struct knav_device *kdev,
                return -EINVAL;
        }
 
+       if (!pdsp->started) {
+               dev_err(kdev->dev, "pdsp id %d not started for range %s\n",
+                       info->pdsp_id, range->name);
+               return -ENODEV;
+       }
+
        info->pdsp = pdsp;
        channels = range->num_queues;
        if (of_get_property(node, "multi-queue", NULL)) {
index 06d9de826758783feea2362117d452f8f800ca03..f3a0b6a4b54ef8093f2dbbabbcdd7c07de1cddbe 100644 (file)
@@ -1504,6 +1504,8 @@ static int knav_queue_stop_pdsp(struct knav_device *kdev,
                dev_err(kdev->dev, "timed out on pdsp %s stop\n", pdsp->name);
                return ret;
        }
+       pdsp->loaded = false;
+       pdsp->started = false;
        return 0;
 }
 
@@ -1592,16 +1594,24 @@ static int knav_queue_start_pdsps(struct knav_device *kdev)
        int ret;
 
        knav_queue_stop_pdsps(kdev);
-       /* now load them all */
+       /* now load them all. We return success even if pdsp
+        * is not loaded as acc channels are optional on having
+        * firmware availability in the system. We set the loaded
+        * and stated flag and when initialize the acc range, check
+        * it and init the range only if pdsp is started.
+        */
        for_each_pdsp(kdev, pdsp) {
                ret = knav_queue_load_pdsp(kdev, pdsp);
-               if (ret < 0)
-                       return ret;
+               if (!ret)
+                       pdsp->loaded = true;
        }
 
        for_each_pdsp(kdev, pdsp) {
-               ret = knav_queue_start_pdsp(kdev, pdsp);
-               WARN_ON(ret);
+               if (pdsp->loaded) {
+                       ret = knav_queue_start_pdsp(kdev, pdsp);
+                       if (!ret)
+                               pdsp->started = true;
+               }
        }
        return 0;
 }