int msm_spm_turn_on_cpu_rail(unsigned int cpu) { uint32_t val = 0; uint32_t timeout = 0; void *reg = NULL; void *saw_bases[] = { 0, MSM_SAW1_BASE, MSM_SAW2_BASE, MSM_SAW3_BASE }; if (cpu == 0 || cpu >= num_possible_cpus()) return -EINVAL; reg = saw_bases[cpu]; if (soc_class_is_msm8960() || soc_class_is_msm8930() || soc_class_is_apq8064()) { val = 0xA4; reg += 0x14; timeout = 512; } else { return -ENOSYS; } writel_relaxed(val, reg); mb(); udelay(timeout); return 0; }
static void __exit msm8930_audio_exit(void) { if (!soc_class_is_msm8930()) { pr_err("%s: Not the right machine type\n", __func__); return ; } msm8930_free_headset_mic_gpios(); platform_device_unregister(msm8930_snd_device); kfree(mbhc_cfg.calibration); }
/* * This will return TRUE for targets which support apps as master. * Thus, SW DLOAD and Mode Reset are supported on apps processor. * This applies to 8960 and newer targets. */ int chk_apps_master(void) { if (driver->use_device_tree) return 1; else if (soc_class_is_msm8960() || soc_class_is_msm8930() || soc_class_is_apq8064() || cpu_is_msm9615()) return 1; else return 0; }
static int __init msm8930_audio_init(void) { int ret; if (!soc_class_is_msm8930()) { pr_err("%s: Not the right machine type\n", __func__); return -ENODEV ; } mbhc_cfg.calibration = def_sitar_mbhc_cal(); if (!mbhc_cfg.calibration) { pr_err("Calibration data allocation failed\n"); return -ENOMEM; } msm8930_snd_device = platform_device_alloc("soc-audio", 0); if (!msm8930_snd_device) { pr_err("Platform device allocation failed\n"); kfree(mbhc_cfg.calibration); return -ENOMEM; } platform_set_drvdata(msm8930_snd_device, &snd_soc_card_msm8930); ret = platform_device_add(msm8930_snd_device); if (ret) { platform_device_put(msm8930_snd_device); kfree(mbhc_cfg.calibration); return ret; } if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) us_euro_gpio = GPIO_HS_US_EURO_SEL_GPIO_SGLTE; else us_euro_gpio = GPIO_HS_US_EURO_SEL_GPIO; if (msm8930_configure_headset_mic_gpios()) pr_err("%s Fail to configure headset mic gpios\n", __func__); atomic_set(&auxpcm_rsc_ref, 0); mutex_init(&cdc_mclk_mutex); return ret; }
static int release_secondary(unsigned int cpu) { BUG_ON(cpu >= get_core_count()); if (cpu_is_msm8x60()) return scorpion_release_secondary(); if (machine_is_msm8974_sim()) return krait_release_secondary_sim(0xf9088000, cpu); if (soc_class_is_msm8960() || soc_class_is_msm8930() || soc_class_is_apq8064()) return krait_release_secondary(0x02088000, cpu); if (cpu_is_msm8974()) return krait_release_secondary_p3(0xf9088000, cpu); WARN(1, "unknown CPU case in release_secondary\n"); return -EINVAL; }
static int __init msm8930_audio_init(void) { int ret; if (!soc_class_is_msm8930()) { pr_err("%s: Not the right machine type\n", __func__); return -ENODEV ; } mbhc_cfg.calibration = def_sitar_mbhc_cal(); if (!mbhc_cfg.calibration) { pr_err("Calibration data allocation failed\n"); return -ENOMEM; } msm8930_snd_device = platform_device_alloc("soc-audio", 0); if (!msm8930_snd_device) { pr_err("Platform device allocation failed\n"); kfree(mbhc_cfg.calibration); return -ENOMEM; } platform_set_drvdata(msm8930_snd_device, &snd_soc_card_msm8930); ret = platform_device_add(msm8930_snd_device); if (ret) { platform_device_put(msm8930_snd_device); kfree(mbhc_cfg.calibration); return ret; } if (msm8930_configure_headset_mic_gpios()) { pr_err("%s Fail to configure headset mic gpios\n", __func__); msm8930_headset_gpios_configured = 0; } else msm8930_headset_gpios_configured = 1; atomic_set(&auxpcm_rsc_ref, 0); mutex_init(&cdc_mclk_mutex); return ret; }
/* ZTE_Audio_LCX_130325, lichaoxia, 2013-03-25, end */ static int msm8930_configure_headset_mic_gpios(void) { int ret; /* ZTE_Audio_LCX_130325, lichaoxia, 2013-03-25, start */ #if defined(CONFIG_US_EURO_SWITCH) struct pm_gpio param = { .direction = PM_GPIO_DIR_OUT, .output_buffer = PM_GPIO_OUT_BUF_CMOS, .output_value = 1, .pull = PM_GPIO_PULL_NO, .vin_sel = PM_GPIO_VIN_S4, .out_strength = PM_GPIO_STRENGTH_MED, .function = PM_GPIO_FUNC_NORMAL, }; ret = gpio_request(us_euro_sel_gpio, "US_EURO_SWITCH"); if (ret) { pr_err("%s: Failed to request gpio %d\n", __func__, us_euro_sel_gpio); return ret; } ret = pm8xxx_gpio_config(us_euro_sel_gpio, ¶m); if (ret) pr_err("%s: Failed to configure gpio %d\n", __func__, us_euro_sel_gpio); else gpio_direction_output(us_euro_sel_gpio, 0); #else if (!us_euro_gpio) return 0; ret = gpio_request(80, "US_EURO_SWITCH"); if (ret) { pr_err("%s: Failed to request gpio 80\n", __func__); return ret; } ret = gpio_direction_output(80, 0); if (ret) { pr_err("%s: Unable to set direction\n", __func__); gpio_free(80); return ret; } #endif /* ZTE_Audio_LCX_130325, lichaoxia, 2013-03-25, end */ msm8930_useuro_gpio_requested = 1; return 0; } static void msm8930_free_headset_mic_gpios(void) { if (msm8930_useuro_gpio_requested) { /* ZTE_Audio_LCX_130325, lichaoxia, 2013-03-25, start */ #if defined(CONFIG_US_EURO_SWITCH) gpio_free(us_euro_sel_gpio); #else gpio_free(80); #endif /* ZTE_Audio_LCX_130325, lichaoxia, 2013-03-25, end */ msm8930_useuro_gpio_requested = 0; } } static int __init msm8930_audio_init(void) { int ret; if (!soc_class_is_msm8930()) { pr_err("%s: Not the right machine type\n", __func__); return -ENODEV ; } mbhc_cfg.calibration = def_sitar_mbhc_cal(); if (!mbhc_cfg.calibration) { pr_err("Calibration data allocation failed\n"); return -ENOMEM; } msm8930_snd_device = platform_device_alloc("soc-audio", 0); if (!msm8930_snd_device) { pr_err("Platform device allocation failed\n"); kfree(mbhc_cfg.calibration); return -ENOMEM; } platform_set_drvdata(msm8930_snd_device, &snd_soc_card_msm8930); ret = platform_device_add(msm8930_snd_device); if (ret) { platform_device_put(msm8930_snd_device); kfree(mbhc_cfg.calibration); return ret; } if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) us_euro_gpio = GPIO_HS_US_EURO_SEL_GPIO_SGLTE; else us_euro_gpio = GPIO_HS_US_EURO_SEL_GPIO; if (msm8930_configure_headset_mic_gpios()) pr_err("%s Fail to configure headset mic gpios\n", __func__); atomic_set(&auxpcm_rsc_ref, 0); mutex_init(&cdc_mclk_mutex); return ret; }