]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: gb-audio: Set samples per message during init
authorMark A. Greer <mgreer@animalcreek.com>
Thu, 21 May 2015 22:57:04 +0000 (15:57 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 23 May 2015 23:26:41 +0000 (16:26 -0700)
A recent commit moved the I2S samples per message operation
to the PCM's 'hw_params' callback.  However, the 'hw_params'
callback is called numerous times while the samples per
message need only be done once (or seldom).  Eliminate the
unnecessary samples per message operations by doing it only
once at Greybus protocol init time.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/audio-gb-cmds.c
drivers/staging/greybus/audio.c

index 73f47d84f1aa3b344e121753ab1c514f47ee8b0f..9dbde0d07a49819563f43b09cc8c4524de889c09 100644 (file)
@@ -177,15 +177,8 @@ int gb_i2s_mgmt_set_cfg(struct gb_snd *snd_dev, int rate, int chans,
        set_cfg.config.ll_wclk_rx_edge = GB_I2S_MGMT_EDGE_FALLING;
 
        ret = gb_i2s_mgmt_set_configuration(snd_dev->mgmt_connection, &set_cfg);
-       if (ret) {
-               pr_err("set_configuration failed: %d\n", ret);
-               return ret;
-       }
-
-       ret = gb_i2s_mgmt_set_samples_per_message(snd_dev->mgmt_connection,
-                                                 CONFIG_SAMPLES_PER_MSG);
        if (ret)
-               pr_err("set_samples_per_msg failed: %d\n", ret);
+               pr_err("set_configuration failed: %d\n", ret);
 
        return ret;
 }
index a1acbb039777bfefd5a051b6e8989e0a98903eee..76b6bdc5984778263336670e14a79b2d3d5561a0 100644 (file)
@@ -292,6 +292,13 @@ static int gb_i2s_mgmt_connection_init(struct gb_connection *connection)
                goto err_free_snd_dev;
        }
 
+       ret = gb_i2s_mgmt_set_samples_per_message(snd_dev->mgmt_connection,
+                                                 CONFIG_SAMPLES_PER_MSG);
+       if (ret) {
+               pr_err("set_samples_per_msg failed: %d\n", ret);
+               goto err_free_i2s_configs;
+       }
+
        snd_dev->send_data_req_buf = kzalloc(SEND_DATA_BUF_LEN, GFP_KERNEL);
 
        if (!snd_dev->send_data_req_buf) {