intel_sst: ASoC: sst_platform: fix the changes required for asoc driver interface...
authorVinod Koul <vinod.koul@intel.com>
Thu, 6 Oct 2011 15:18:20 +0000 (16:18 +0100)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 21:16:12 +0000 (13:16 -0800)
This patch changes the sst driver not to call the old sound card ops during
playback and other operations

Change-Id: If399630e12c8bfd75dbc8a938918a93eacccb2cc
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/staging/intel_sst/intel_sst.h
drivers/staging/intel_sst/intel_sst_app_interface.c
drivers/staging/intel_sst/intel_sst_drv_interface.c
drivers/staging/intel_sst/intel_sst_stream_encoded.c
sound/soc/mid-x86/sst_platform.c

index 00e058d..249f916 100644 (file)
@@ -92,27 +92,6 @@ struct snd_pmic_ops {
        int lineout_dev_id, line_out_names_cnt;
        int prev_lineout_dev_id;
        bool jack_interrupt_status;
-       int (*set_input_dev) (u8 value);
-       int (*set_output_dev) (u8 value);
-       int (*set_lineout_dev) (u8 value);
-       int (*set_mute) (int dev_id, u8 value);
-       int (*get_mute) (int dev_id, u8 *value);
-
-       int (*set_vol) (int dev_id, int value);
-       int (*get_vol) (int dev_id, int *value);
-
-       int (*init_card) (void);
-       int (*set_pcm_audio_params)
-               (int sfreq, int word_size , int num_channel);
-       int (*set_pcm_voice_params) (void);
-       int (*set_voice_port) (int status);
-       int (*set_audio_port) (int status);
-
-       int (*power_up_pmic_pb) (unsigned int port);
-       int (*power_up_pmic_cp) (unsigned int port);
-       int (*power_down_pmic_pb) (unsigned int device);
-       int (*power_down_pmic_cp) (unsigned int device);
-       int (*power_down_pmic) (void);
        void (*pmic_irq_cb) (void *cb_data, u8 value);
        void (*pmic_irq_enable)(void *data);
        int (*pmic_jack_enable) (void);
@@ -140,10 +119,8 @@ struct intel_sst_pcm_control {
        int (*close) (unsigned int str_id);
 };
 struct intel_sst_card_ops {
-       char *module_name;
        unsigned int  vendor_id;
        struct intel_sst_pcm_control *pcm_control;
-       struct snd_pmic_ops *scard_ops;
 };
 
 /* modified for generic access */
index 93b41a2..3f4d4bd 100644 (file)
@@ -1079,11 +1079,6 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
                                sfreq = str_param.sparams.uc.pcm_params.sfreq;
                                word_size = str_param.sparams.uc.pcm_params.pcm_wd_sz;
                                num_channel = str_param.sparams.uc.pcm_params.num_chan;
-                               if (str_param.ops == STREAM_OPS_CAPTURE) {
-                                       sst_drv_ctx->scard_ops->\
-                                       set_pcm_audio_params(sfreq,
-                                               word_size, num_channel);
-                               }
                        }
                }
                break;
index 84c094a..f99b720 100644 (file)
@@ -167,25 +167,10 @@ void free_stream_context(unsigned int str_id)
                if (sst_free_stream(str_id))
                        sst_clean_stream(&sst_drv_ctx->streams[str_id]);
                if (stream->ops == STREAM_OPS_PLAYBACK ||
-                               stream->ops == STREAM_OPS_PLAYBACK_DRM) {
+                               stream->ops == STREAM_OPS_PLAYBACK_DRM)
                        sst_drv_ctx->pb_streams--;
-                       if (sst_drv_ctx->pci_id == SST_MFLD_PCI_ID)
-                               sst_drv_ctx->scard_ops->power_down_pmic_pb(
-                                               stream->device);
-                       else {
-                               if (sst_drv_ctx->pb_streams == 0)
-                                       sst_drv_ctx->scard_ops->
-                                       power_down_pmic_pb(stream->device);
-                       }
-               } else if (stream->ops == STREAM_OPS_CAPTURE) {
+               else if (stream->ops == STREAM_OPS_CAPTURE)
                        sst_drv_ctx->cp_streams--;
-                       if (sst_drv_ctx->cp_streams == 0)
-                               sst_drv_ctx->scard_ops->power_down_pmic_cp(
-                                               stream->device);
-               }
-               if (sst_drv_ctx->pb_streams == 0
-                               && sst_drv_ctx->cp_streams == 0)
-                       sst_drv_ctx->scard_ops->power_down_pmic();
        }
 }
 
@@ -324,21 +309,10 @@ int sst_get_stream(struct snd_sst_params *str_param)
        /* power on the analog, if reqd */
        if (str_param->ops == STREAM_OPS_PLAYBACK ||
                        str_param->ops == STREAM_OPS_PLAYBACK_DRM) {
-               if (sst_drv_ctx->pci_id == SST_MRST_PCI_ID)
-                       sst_drv_ctx->scard_ops->power_up_pmic_pb(
-                                       sst_drv_ctx->pmic_port_instance);
-               else {
-                       sst_drv_ctx->scard_ops->power_up_pmic_pb(
-                                                       str_info->device);
-                       sst_drv_ctx->scard_ops->set_pcm_audio_params(
-                               str_info->sfreq, sst_get_wdsize(str_param), 2);
-               }
                /*Only if the playback is MP3 - Send a message*/
                sst_drv_ctx->pb_streams++;
        } else if (str_param->ops == STREAM_OPS_CAPTURE) {
 
-               sst_drv_ctx->scard_ops->power_up_pmic_cp(
-                               sst_drv_ctx->pmic_port_instance);
                /*Send a messageif not sent already*/
                sst_drv_ctx->cp_streams++;
        }
@@ -588,39 +562,20 @@ struct intel_sst_card_ops sst_pmic_ops = {
  */
 int register_sst_card(struct intel_sst_card_ops *card)
 {
+       pr_debug("sst: driver register card %p\n", sst_drv_ctx);
        if (!sst_drv_ctx) {
                pr_err("No SST driver register card reject\n");
                return -ENODEV;
        }
 
-       if (!card || !card->module_name) {
+       if (!card) {
                pr_err("Null Pointer Passed\n");
                return -EINVAL;
        }
-       if (sst_drv_ctx->pmic_state == SND_MAD_UN_INIT) {
-               /* register this driver */
-               if ((strncmp(SST_CARD_NAMES, card->module_name,
-                               strlen(SST_CARD_NAMES))) == 0) {
-                       sst_drv_ctx->pmic_vendor = card->vendor_id;
-                       sst_drv_ctx->scard_ops =  card->scard_ops;
-                       sst_pmic_ops.module_name = card->module_name;
-                       sst_drv_ctx->pmic_state = SND_MAD_INIT_DONE;
-                       sst_drv_ctx->rx_time_slot_status = 0; /*default AMIC*/
-                       card->pcm_control = sst_pmic_ops.pcm_control;
-                       return 0;
-               } else {
-                       pr_err("strcmp fail %s\n", card->module_name);
-                       return -EINVAL;
-               }
-
-       } else {
-               /* already registered a driver */
-               pr_err("Repeat for registration..denied\n");
-               return -EBADRQC;
-       }
-       /* The ASoC code doesn't set scard_ops */
-       if (sst_drv_ctx->scard_ops)
-               sst_drv_ctx->scard_ops->card_status = SND_CARD_UN_INIT;
+       sst_drv_ctx->pmic_vendor = card->vendor_id;
+       sst_drv_ctx->pmic_state = SND_MAD_INIT_DONE;
+       sst_drv_ctx->rx_time_slot_status = 0; /*default AMIC*/
+       card->pcm_control = sst_pmic_ops.pcm_control;
        return 0;
 }
 EXPORT_SYMBOL_GPL(register_sst_card);
@@ -636,9 +591,7 @@ void unregister_sst_card(struct intel_sst_card_ops *card)
 {
        if (sst_pmic_ops.pcm_control == card->pcm_control) {
                /* unreg */
-               sst_pmic_ops.module_name = "";
                sst_drv_ctx->pmic_state = SND_MAD_UN_INIT;
-               pr_debug("Unregistered %s\n", card->module_name);
        }
        return;
 }
index 2be58c5..f221161 100644 (file)
@@ -307,20 +307,6 @@ int sst_set_mute(struct snd_sst_mute *set_mute)
 
 int sst_prepare_target(struct snd_sst_slot_info *slot)
 {
-       if (slot->target_device == SND_SST_TARGET_PMIC
-               && slot->device_instance == 1) {
-                       /*music mode*/
-                       if (sst_drv_ctx->pmic_port_instance == 0)
-                               sst_drv_ctx->scard_ops->set_voice_port(
-                                       DEACTIVATE);
-       } else if ((slot->target_device == SND_SST_TARGET_PMIC ||
-                       slot->target_device == SND_SST_TARGET_MODEM) &&
-                       slot->device_instance == 0) {
-                               /*voip mode where pcm0 is active*/
-                               if (sst_drv_ctx->pmic_port_instance == 1)
-                                       sst_drv_ctx->scard_ops->set_audio_port(
-                                               DEACTIVATE);
-       }
        return 0;
 }
 
@@ -330,24 +316,11 @@ int sst_activate_target(struct snd_sst_slot_info *slot)
                slot->device_instance == 1) {
                        /*music mode*/
                        sst_drv_ctx->pmic_port_instance = 1;
-                       sst_drv_ctx->scard_ops->set_audio_port(ACTIVATE);
-                       sst_drv_ctx->scard_ops->set_pcm_audio_params(
-                               slot->pcm_params.sfreq,
-                               slot->pcm_params.pcm_wd_sz,
-                               slot->pcm_params.num_chan);
-                       if (sst_drv_ctx->pb_streams)
-                               sst_drv_ctx->scard_ops->power_up_pmic_pb(1);
-                       if (sst_drv_ctx->cp_streams)
-                               sst_drv_ctx->scard_ops->power_up_pmic_cp(1);
        } else if ((slot->target_device == SND_SST_TARGET_PMIC ||
                        slot->target_device == SND_SST_TARGET_MODEM) &&
                        slot->device_instance == 0) {
                                /*voip mode where pcm0 is active*/
                                sst_drv_ctx->pmic_port_instance = 0;
-                               sst_drv_ctx->scard_ops->set_voice_port(
-                                       ACTIVATE);
-                               sst_drv_ctx->scard_ops->power_up_pmic_pb(0);
-                               /*sst_drv_ctx->scard_ops->power_up_pmic_cp(0);*/
        }
        return 0;
 }
@@ -497,9 +470,6 @@ int sst_target_device_select(struct snd_sst_target_device *target)
                                prepare_count++;
                }
        }
-       if (target->devices[0].action == SND_SST_PORT_PREPARE &&
-               prepare_count == 0)
-                       sst_drv_ctx->scard_ops->power_down_pmic();
 
        return retval;
 }
@@ -1071,7 +1041,6 @@ int sst_decode(int str_id, struct snd_sst_dbufs *dbufs)
        struct snd_sst_decode_info dec_info;
        unsigned long long input_bytes, output_bytes;
 
-       sst_drv_ctx->scard_ops->power_down_pmic();
        pr_debug("Powering_down_PMIC...\n");
 
        retval = sst_validate_strid(str_id);
index 3e78260..a8c950c 100644 (file)
@@ -249,7 +249,6 @@ static int sst_platform_open(struct snd_pcm_substream *substream)
                return -ENOMEM;
        }
        stream->sstdrv_ops->vendor_id = MSIC_VENDOR_ID;
-       stream->sstdrv_ops->module_name = SST_CARD_NAMES;
        /* registering with SST driver to get access to SST APIs to use */
        ret_val = register_sst_card(stream->sstdrv_ops);
        if (ret_val) {