/*
 * Fix up regulator consumer data that moves to a different regulator based on
 * the current target.
 */
void __init configure_msm8960_power_grid(void)
{
	static struct rpm_regulator_init_data *rpm_data;
	int i;

	if (machine_is_msm8960_cdp() || cpu_is_msm8960ab()) {
		/* Only modify LVS6 consumers for CDP targets. */
		for (i = 0; i < ARRAY_SIZE(msm_rpm_regulator_init_data); i++) {
			rpm_data = &msm_rpm_regulator_init_data[i];
			if (machine_is_msm8960_cdp() &&
				rpm_data->id == RPM_VREG_ID_PM8921_LVS6) {
				rpm_data->init_data.consumer_supplies
					= vreg_consumers_CDP_LVS6;
				rpm_data->init_data.num_consumer_supplies
					= ARRAY_SIZE(vreg_consumers_CDP_LVS6);
			}
			if (cpu_is_msm8960ab() &&
				rpm_data->id == RPM_VREG_ID_PM8921_S7) {
				rpm_data->init_data.constraints.min_uV =
								1275000;
				rpm_data->init_data.constraints.max_uV =
								1275000;
				rpm_data->init_data.constraints.input_uV =
								1275000;
				rpm_data->default_uV = 1275000;
			}
		}
	}

	if (msm8960_oem_funcs.msm_regulator_init)
		msm8960_oem_funcs.msm_regulator_init(&msm8960_oem_funcs);
}
static int __init iommu_init(void)
{
	int ret;
	if (!msm_soc_version_supports_iommu_v1()) {
		pr_err("IOMMU v1 is not supported on this SoC version.\n");
		return -ENODEV;
	}

	/* Initialize common devs */
	platform_add_devices(msm_iommu_common_devs,
				ARRAY_SIZE(msm_iommu_common_devs));

	/* Initialize soc-specific devs */
	if (cpu_is_msm8x60() || cpu_is_msm8960()) {
		platform_add_devices(msm_iommu_jpegd_devs,
				ARRAY_SIZE(msm_iommu_jpegd_devs));
		platform_add_devices(msm_iommu_gfx2d_devs,
				ARRAY_SIZE(msm_iommu_gfx2d_devs));
	}

	if (soc_class_is_apq8064() || cpu_is_msm8960ab()) {
		platform_add_devices(msm_iommu_jpegd_devs,
				ARRAY_SIZE(msm_iommu_jpegd_devs));
		platform_add_devices(msm_iommu_adreno3xx_gfx_devs,
				ARRAY_SIZE(msm_iommu_adreno3xx_gfx_devs));
	}
	if (soc_class_is_apq8064())
		platform_add_devices(msm_iommu_vcap_devs,
				ARRAY_SIZE(msm_iommu_vcap_devs));

	/* Initialize common ctx_devs */
	ret = platform_add_devices(msm_iommu_common_ctx_devs,
				ARRAY_SIZE(msm_iommu_common_ctx_devs));

	/* Initialize soc-specific ctx_devs */
	if (cpu_is_msm8x60() || cpu_is_msm8960()) {
		platform_add_devices(msm_iommu_jpegd_ctx_devs,
				ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
		platform_add_devices(msm_iommu_gfx2d_ctx_devs,
				ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs));
	}

	if (soc_class_is_apq8064() || cpu_is_msm8960ab()) {
		platform_add_devices(msm_iommu_jpegd_ctx_devs,
				ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));

		platform_add_devices(msm_iommu_adreno3xx_ctx_devs,
				ARRAY_SIZE(msm_iommu_adreno3xx_ctx_devs));
	}
	if (soc_class_is_apq8064())
		platform_add_devices(msm_iommu_vcap_ctx_devs,
			ARRAY_SIZE(msm_iommu_vcap_ctx_devs));

	return 0;
}
void __init msm8960_init_fb(void)
{
	uint32_t soc_platform_version = socinfo_get_version();


	if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3)
		mdp_pdata.mdp_rev = MDP_REV_43;

	if (cpu_is_msm8960ab())
		mdp_pdata.mdp_rev = MDP_REV_44;

	sony_viskan_add_lcd_device();
#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	platform_device_register(&hdmi_msm_device);
#endif
	platform_device_register(&msm_fb_device);
#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
	platform_device_register(&wfd_device);
#endif
	msm_fb_register_device("mdp", &mdp_pdata);
#ifdef CONFIG_FB_MSM_MIPI_DSI_VENDOR_DET
	if (sony_viskan_is_dric_det() == LCD_VENDOR_SAMSUNG)
		mipi_dsi_pdata.dsi_power_save = s6d6aa0_lcd_power;
	else
		mipi_dsi_pdata.dsi_power_save = r63306_lcd_power;
#endif /* CONFIG_FB_MSM_MIPI_DSI_VENDOR_DET */
	msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
#ifdef CONFIG_MSM_BUS_SCALING
	msm_fb_register_device("dtv", &dtv_pdata);
#endif
}
示例#4
0
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 (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
	    cpu_is_apq8064() || cpu_is_msm8627() || cpu_is_msm8960ab() ||
						cpu_is_apq8064ab()) {
		val = 0xA4;
		reg += 0x14;
		timeout = 512;
	} else {
		return -ENOSYS;
	}

	writel_relaxed(val, reg);
	mb();
	udelay(timeout);

	return 0;
}
void __init msm8960_init_fb(void)
{
    uint32_t soc_platform_version = socinfo_get_version();


    if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3)
        mdp_pdata.mdp_rev = MDP_REV_43;

    if (cpu_is_msm8960ab())
        mdp_pdata.mdp_rev = MDP_REV_44;

#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
    platform_device_register(&wfd_device);
#endif

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
    platform_device_register(&hdmi_msm_device);
#endif
    mipi_dsi_panel_add_device();
    platform_device_register(&msm_fb_device);
    msm_fb_register_device("mdp", &mdp_pdata);
    msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
#ifdef CONFIG_MSM_BUS_SCALING
    msm_fb_register_device("dtv", &dtv_pdata);
#endif
}
void __init msm8960_init_fb(void)
{
	if (cpu_is_msm8960ab())
		mdp_pdata.mdp_rev = MDP_REV_44;

	platform_device_register(&msm_fb_device);

#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
	platform_device_register(&wfd_panel_device);
	platform_device_register(&wfd_device);
#endif

	platform_device_register(&mipi_dsi_novatek_panel_device);
	platform_device_register(&mipi_dsi_orise_panel_device);

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	platform_device_register(&hdmi_msm_device);
#endif

	if (machine_is_msm8960_liquid())
		platform_device_register(&mipi_dsi2lvds_bridge_device);
	else
		platform_device_register(&mipi_dsi_toshiba_panel_device);

	msm_fb_register_device("mdp", &mdp_pdata);
	msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
#ifdef CONFIG_MSM_BUS_SCALING
	msm_fb_register_device("dtv", &dtv_pdata);
#endif
}
示例#7
0
static void __exit iommu_exit(void)
{
    int i;

    /* Common ctx_devs */
    for (i = 0; i < ARRAY_SIZE(msm_iommu_common_ctx_devs); i++)
        platform_device_unregister(msm_iommu_common_ctx_devs[i]);

    /* Common devs. */
    for (i = 0; i < ARRAY_SIZE(msm_iommu_common_devs); ++i)
        platform_device_unregister(msm_iommu_common_devs[i]);

    if (cpu_is_msm8x60() || cpu_is_msm8960()) {
        for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs); i++)
            platform_device_unregister(msm_iommu_gfx2d_ctx_devs[i]);

        for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs); i++)
            platform_device_unregister(msm_iommu_jpegd_ctx_devs[i]);

        for (i = 0; i < ARRAY_SIZE(msm_iommu_gfx2d_devs); i++)
            platform_device_unregister(msm_iommu_gfx2d_devs[i]);

        for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
            platform_device_unregister(msm_iommu_jpegd_devs[i]);
    }
    if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
        for (i = 0; i < ARRAY_SIZE(msm_iommu_vcap_ctx_devs); i++)
            platform_device_unregister(msm_iommu_vcap_ctx_devs[i]);
    }

    if (cpu_is_apq8064() || cpu_is_msm8960ab() || cpu_is_apq8064ab()) {
        for (i = 0; i < ARRAY_SIZE(msm_iommu_adreno3xx_ctx_devs);
                i++)
            platform_device_unregister(
                msm_iommu_adreno3xx_ctx_devs[i]);

        for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_ctx_devs);
                i++)
            platform_device_unregister(
                msm_iommu_jpegd_ctx_devs[i]);

        if (cpu_is_apq8064() || cpu_is_apq8064ab()) {
            for (i = 0; i < ARRAY_SIZE(msm_iommu_vcap_devs);
                    i++)
                platform_device_unregister(
                    msm_iommu_vcap_devs[i]);
        }

        for (i = 0; i < ARRAY_SIZE(msm_iommu_adreno3xx_gfx_devs);
                i++)
            platform_device_unregister(
                msm_iommu_adreno3xx_gfx_devs[i]);

        for (i = 0; i < ARRAY_SIZE(msm_iommu_jpegd_devs); i++)
            platform_device_unregister(msm_iommu_jpegd_devs[i]);
    }

    platform_device_unregister(&msm_root_iommu_dev);
}
示例#8
0
static void __exit msm8960_audio_exit(void)
{
	if (!cpu_is_msm8960() && !cpu_is_msm8960ab()) {
		pr_debug("%s: Not the right machine type\n", __func__);
		return ;
	}
	msm8960_free_headset_mic_gpios();
	platform_device_unregister(msm8960_snd_device);
	platform_device_unregister(msm8960_snd_tabla1x_device);
	kfree(mbhc_cfg.calibration);
	mutex_destroy(&cdc_mclk_mutex);
}
void __init msm8960_init_fb(void)
{
	uint32_t soc_platform_version = socinfo_get_version();

	if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3)
		mdp_pdata.mdp_rev = MDP_REV_43;

	if (cpu_is_msm8960ab())
		mdp_pdata.mdp_rev = MDP_REV_44;

	platform_device_register(&msm_fb_device);

#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
	platform_device_register(&wfd_panel_device);
	platform_device_register(&wfd_device);
#endif

	if (machine_is_msm8960_sim())
		platform_device_register(&mipi_dsi_simulator_panel_device);

	if (machine_is_msm8960_rumi3())
		platform_device_register(&mipi_dsi_renesas_panel_device);

	if (!machine_is_msm8960_sim() && !machine_is_msm8960_rumi3()) {
		platform_device_register(&mipi_dsi_novatek_panel_device);
		platform_device_register(&mipi_dsi_orise_panel_device);

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
		platform_device_register(&hdmi_msm_device);
#endif
	}

	if (machine_is_msm8960_liquid())
		platform_device_register(&mipi_dsi2lvds_bridge_device);
	else
		platform_device_register(&mipi_dsi_toshiba_panel_device);

	if (machine_is_msm8x60_rumi3()) {
		msm_fb_register_device("mdp", NULL);
		mipi_dsi_pdata.target_type = 1;
	} else
		msm_fb_register_device("mdp", &mdp_pdata);
	msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
#ifdef CONFIG_MSM_BUS_SCALING
	msm_fb_register_device("dtv", &dtv_pdata);
#endif
}
示例#10
0
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 (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
	    cpu_is_apq8064() || cpu_is_msm8627() || cpu_is_msm8960ab())
		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;
}
示例#11
0
void __init msm8960_init_fb(void)
{
	uint32_t soc_platform_version = socinfo_get_version();


	if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3)
		mdp_pdata.mdp_rev = MDP_REV_43;

	if (cpu_is_msm8960ab())
		mdp_pdata.mdp_rev = MDP_REV_44;

	platform_device_register(&msm_fb_device);

#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
	platform_device_register(&wfd_panel_device);
	platform_device_register(&wfd_device);
#endif

	platform_device_register(&mipi_dsi_novatek_panel_device);
	platform_device_register(&mipi_dsi_orise_panel_device);

#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	platform_device_register(&hdmi_msm_device);
#endif

	if (machine_is_msm8960_liquid())
		platform_device_register(&mipi_dsi2lvds_bridge_device);
	else
		platform_device_register(&mipi_dsi_toshiba_panel_device);

	msm_fb_register_device("mdp", &mdp_pdata);
	msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
	msm_fb_register_device("dtv", &dtv_pdata);
#endif
}
示例#12
0
static int __init iommu_init(void)
{
    int ret;
    if (!msm_soc_version_supports_iommu_v1()) {
        pr_err("IOMMU v1 is not supported on this SoC version.\n");
        return -ENODEV;
    }

    ret = platform_device_register(&msm_root_iommu_dev);
    if (ret != 0) {
        pr_err("Failed to register root IOMMU device!\n");
        goto failure;
    }

    /* Initialize common devs */
    platform_add_devices(msm_iommu_common_devs,
                         ARRAY_SIZE(msm_iommu_common_devs));

    /* Initialize soc-specific devs */
    if (cpu_is_msm8x60() || cpu_is_msm8960()) {
        platform_add_devices(msm_iommu_jpegd_devs,
                             ARRAY_SIZE(msm_iommu_jpegd_devs));
        platform_add_devices(msm_iommu_gfx2d_devs,
                             ARRAY_SIZE(msm_iommu_gfx2d_devs));
    }

    if (cpu_is_apq8064() || cpu_is_msm8960ab() || cpu_is_apq8064ab()) {
        platform_add_devices(msm_iommu_jpegd_devs,
                             ARRAY_SIZE(msm_iommu_jpegd_devs));
        platform_add_devices(msm_iommu_adreno3xx_gfx_devs,
                             ARRAY_SIZE(msm_iommu_adreno3xx_gfx_devs));
    }
    if (cpu_is_apq8064() || cpu_is_apq8064ab())
        platform_add_devices(msm_iommu_vcap_devs,
                             ARRAY_SIZE(msm_iommu_vcap_devs));

    /* Initialize common ctx_devs */
    ret = platform_add_devices(msm_iommu_common_ctx_devs,
                               ARRAY_SIZE(msm_iommu_common_ctx_devs));

    /* Initialize soc-specific ctx_devs */
    if (cpu_is_msm8x60() || cpu_is_msm8960()) {
        platform_add_devices(msm_iommu_jpegd_ctx_devs,
                             ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));
        platform_add_devices(msm_iommu_gfx2d_ctx_devs,
                             ARRAY_SIZE(msm_iommu_gfx2d_ctx_devs));
    }

    if (cpu_is_apq8064() || cpu_is_msm8960ab() || cpu_is_apq8064ab()) {
        platform_add_devices(msm_iommu_jpegd_ctx_devs,
                             ARRAY_SIZE(msm_iommu_jpegd_ctx_devs));

        platform_add_devices(msm_iommu_adreno3xx_ctx_devs,
                             ARRAY_SIZE(msm_iommu_adreno3xx_ctx_devs));
    }
    if (cpu_is_apq8064() || cpu_is_apq8064ab())
        platform_add_devices(msm_iommu_vcap_ctx_devs,
                             ARRAY_SIZE(msm_iommu_vcap_ctx_devs));

    return 0;

failure:
    return ret;
}
示例#13
0
文件: hdmi.c 项目: 383530895/linux
static int hdmi_bind(struct device *dev, struct device *master, void *data)
{
	struct drm_device *drm = dev_get_drvdata(master);
	struct msm_drm_private *priv = drm->dev_private;
	static struct hdmi_platform_config config = {};
	struct hdmi *hdmi;
#ifdef CONFIG_OF
	struct device_node *of_node = dev->of_node;

	if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) {
		static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"};
		static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"};
		static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"};
		static unsigned long hpd_clk_freq[] = {0, 19200000, 0};
		static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"};
		config.phy_init      = hdmi_phy_8x74_init;
		config.hpd_reg_names = hpd_reg_names;
		config.hpd_reg_cnt   = ARRAY_SIZE(hpd_reg_names);
		config.pwr_reg_names = pwr_reg_names;
		config.pwr_reg_cnt   = ARRAY_SIZE(pwr_reg_names);
		config.hpd_clk_names = hpd_clk_names;
		config.hpd_freq      = hpd_clk_freq;
		config.hpd_clk_cnt   = ARRAY_SIZE(hpd_clk_names);
		config.pwr_clk_names = pwr_clk_names;
		config.pwr_clk_cnt   = ARRAY_SIZE(pwr_clk_names);
	} else if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8960")) {
		static const char *hpd_clk_names[] = {"core_clk", "master_iface_clk", "slave_iface_clk"};
		static const char *hpd_reg_names[] = {"core-vdda", "hdmi-mux"};
		config.phy_init      = hdmi_phy_8960_init;
		config.hpd_reg_names = hpd_reg_names;
		config.hpd_reg_cnt   = ARRAY_SIZE(hpd_reg_names);
		config.hpd_clk_names = hpd_clk_names;
		config.hpd_clk_cnt   = ARRAY_SIZE(hpd_clk_names);
	} else if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8660")) {
		config.phy_init      = hdmi_phy_8x60_init;
	} else {
		dev_err(dev, "unknown phy: %s\n", of_node->name);
	}

	config.mmio_name     = "core_physical";
	config.ddc_clk_gpio  = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-clk");
	config.ddc_data_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-data");
	config.hpd_gpio      = get_gpio(dev, of_node, "qcom,hdmi-tx-hpd");
	config.mux_en_gpio   = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-en");
	config.mux_sel_gpio  = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-sel");
	config.mux_lpm_gpio  = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-lpm");

#else
	static const char *hpd_clk_names[] = {
			"core_clk", "master_iface_clk", "slave_iface_clk",
	};
	if (cpu_is_apq8064()) {
		static const char *hpd_reg_names[] = {"8921_hdmi_mvs"};
		config.phy_init      = hdmi_phy_8960_init;
		config.mmio_name     = "hdmi_msm_hdmi_addr";
		config.hpd_reg_names = hpd_reg_names;
		config.hpd_reg_cnt   = ARRAY_SIZE(hpd_reg_names);
		config.hpd_clk_names = hpd_clk_names;
		config.hpd_clk_cnt   = ARRAY_SIZE(hpd_clk_names);
		config.ddc_clk_gpio  = 70;
		config.ddc_data_gpio = 71;
		config.hpd_gpio      = 72;
		config.mux_en_gpio   = -1;
		config.mux_sel_gpio  = -1;
	} else if (cpu_is_msm8960() || cpu_is_msm8960ab()) {
		static const char *hpd_reg_names[] = {"8921_hdmi_mvs"};
		config.phy_init      = hdmi_phy_8960_init;
		config.mmio_name     = "hdmi_msm_hdmi_addr";
		config.hpd_reg_names = hpd_reg_names;
		config.hpd_reg_cnt   = ARRAY_SIZE(hpd_reg_names);
		config.hpd_clk_names = hpd_clk_names;
		config.hpd_clk_cnt   = ARRAY_SIZE(hpd_clk_names);
		config.ddc_clk_gpio  = 100;
		config.ddc_data_gpio = 101;
		config.hpd_gpio      = 102;
		config.mux_en_gpio   = -1;
		config.mux_sel_gpio  = -1;
	} else if (cpu_is_msm8x60()) {
		static const char *hpd_reg_names[] = {
				"8901_hdmi_mvs", "8901_mpp0"
		};
		config.phy_init      = hdmi_phy_8x60_init;
		config.mmio_name     = "hdmi_msm_hdmi_addr";
		config.hpd_reg_names = hpd_reg_names;
		config.hpd_reg_cnt   = ARRAY_SIZE(hpd_reg_names);
		config.hpd_clk_names = hpd_clk_names;
		config.hpd_clk_cnt   = ARRAY_SIZE(hpd_clk_names);
		config.ddc_clk_gpio  = 170;
		config.ddc_data_gpio = 171;
		config.hpd_gpio      = 172;
		config.mux_en_gpio   = -1;
		config.mux_sel_gpio  = -1;
	}
#endif
	dev->platform_data = &config;
	hdmi = hdmi_init(to_platform_device(dev));
	if (IS_ERR(hdmi))
		return PTR_ERR(hdmi);
	priv->hdmi = hdmi;
	return 0;
}
示例#14
0
static int msm8960_configure_headset_mic_gpios(void)
{
	int ret;
	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(PM8921_GPIO_PM_TO_SYS(23), "AV_SWITCH");
	if (ret) {
		pr_err("%s: Failed to request gpio %d\n", __func__,
			PM8921_GPIO_PM_TO_SYS(23));
		return ret;
	}

	ret = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(23), &param);
	if (ret)
		pr_err("%s: Failed to configure gpio %d\n", __func__,
			PM8921_GPIO_PM_TO_SYS(23));
	else
		gpio_direction_output(PM8921_GPIO_PM_TO_SYS(23), 0);

	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);
		gpio_free(PM8921_GPIO_PM_TO_SYS(23));
		return ret;
	}
	ret = pm8xxx_gpio_config(us_euro_sel_gpio, &param);
	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);

	return 0;
}
static void msm8960_free_headset_mic_gpios(void)
{
	if (msm8960_headset_gpios_configured) {
		gpio_free(PM8921_GPIO_PM_TO_SYS(23));
		gpio_free(us_euro_sel_gpio);
	}
}

static int __init msm8960_audio_init(void)
{
	int ret;

	if (!cpu_is_msm8960() && !cpu_is_msm8960ab()) {
		pr_debug("%s: Not the right machine type\n", __func__);
		return -ENODEV ;
	}

	mbhc_cfg.calibration = def_tabla_mbhc_cal();
	if (!mbhc_cfg.calibration) {
		pr_err("Calibration data allocation failed\n");
		return -ENOMEM;
	}

	msm8960_snd_device = platform_device_alloc("soc-audio", 0);
	if (!msm8960_snd_device) {
		pr_err("Platform device allocation failed\n");
		kfree(mbhc_cfg.calibration);
		return -ENOMEM;
	}

	memcpy(msm8960_dai, msm8960_dai_common, sizeof(msm8960_dai_common));
	memcpy(msm8960_dai + ARRAY_SIZE(msm8960_dai_common),
		msm8960_dai_delta_tabla2x, sizeof(msm8960_dai_delta_tabla2x));

	platform_set_drvdata(msm8960_snd_device, &snd_soc_card_msm8960);
	ret = platform_device_add(msm8960_snd_device);
	if (ret) {
		platform_device_put(msm8960_snd_device);
		kfree(mbhc_cfg.calibration);
		return ret;
	}

	msm8960_snd_tabla1x_device = platform_device_alloc("soc-audio", 1);
	if (!msm8960_snd_tabla1x_device) {
		pr_err("Platform device allocation failed\n");
		kfree(mbhc_cfg.calibration);
		return -ENOMEM;
	}

	memcpy(msm8960_tabla1x_dai, msm8960_dai_common,
		sizeof(msm8960_dai_common));
	memcpy(msm8960_tabla1x_dai + ARRAY_SIZE(msm8960_dai_common),
		msm8960_dai_delta_tabla1x, sizeof(msm8960_dai_delta_tabla1x));

	platform_set_drvdata(msm8960_snd_tabla1x_device,
		&snd_soc_tabla1x_card_msm8960);
	ret = platform_device_add(msm8960_snd_tabla1x_device);
	if (ret) {
		platform_device_put(msm8960_snd_tabla1x_device);
		kfree(mbhc_cfg.calibration);
		return ret;
	}

	if (cpu_is_msm8960()) {
		if (msm8960_configure_headset_mic_gpios()) {
			pr_err("%s Fail to configure headset mic gpios\n",
								__func__);
			msm8960_headset_gpios_configured = 0;
		} else
			msm8960_headset_gpios_configured = 1;
	} else {
		msm8960_headset_gpios_configured = 0;
		pr_debug("%s headset GPIO 23 and 35 not configured msm960ab",
								__func__);
	}

	mutex_init(&cdc_mclk_mutex);
	return ret;

}
示例#15
0
文件: hdmi.c 项目: guanhe0/kernel
static int hdmi_bind(struct device *dev, struct device *master, void *data)
{
	struct drm_device *drm = dev_get_drvdata(master);
	struct msm_drm_private *priv = drm->dev_private;
	static struct hdmi_platform_config *hdmi_cfg;
	struct hdmi *hdmi;
#ifdef CONFIG_OF
	struct device_node *of_node = dev->of_node;
	const struct of_device_id *match;

	match = of_match_node(dt_match, of_node);
	if (match && match->data) {
		hdmi_cfg = (struct hdmi_platform_config *)match->data;
		DBG("hdmi phy: %s", match->compatible);
	} else {
		dev_err(dev, "unknown phy: %s\n", of_node->name);
		return -ENXIO;
	}

	hdmi_cfg->mmio_name     = "core_physical";
	hdmi_cfg->qfprom_mmio_name = "qfprom_physical";
	hdmi_cfg->ddc_clk_gpio  = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-clk");
	hdmi_cfg->ddc_data_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-data");
	hdmi_cfg->hpd_gpio      = get_gpio(dev, of_node, "qcom,hdmi-tx-hpd");
	hdmi_cfg->mux_en_gpio   = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-en");
	hdmi_cfg->mux_sel_gpio  = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-sel");
	hdmi_cfg->mux_lpm_gpio  = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-lpm");

#else
	static struct hdmi_platform_config config = {};
	static const char *hpd_clk_names[] = {
			"core_clk", "master_iface_clk", "slave_iface_clk",
	};
	if (cpu_is_apq8064()) {
		static const char *hpd_reg_names[] = {"8921_hdmi_mvs"};
		config.phy_init      = hdmi_phy_8960_init;
		config.hpd_reg_names = hpd_reg_names;
		config.hpd_reg_cnt   = ARRAY_SIZE(hpd_reg_names);
		config.hpd_clk_names = hpd_clk_names;
		config.hpd_clk_cnt   = ARRAY_SIZE(hpd_clk_names);
		config.ddc_clk_gpio  = 70;
		config.ddc_data_gpio = 71;
		config.hpd_gpio      = 72;
		config.mux_en_gpio   = -1;
		config.mux_sel_gpio  = -1;
	} else if (cpu_is_msm8960() || cpu_is_msm8960ab()) {
		static const char *hpd_reg_names[] = {"8921_hdmi_mvs"};
		config.phy_init      = hdmi_phy_8960_init;
		config.hpd_reg_names = hpd_reg_names;
		config.hpd_reg_cnt   = ARRAY_SIZE(hpd_reg_names);
		config.hpd_clk_names = hpd_clk_names;
		config.hpd_clk_cnt   = ARRAY_SIZE(hpd_clk_names);
		config.ddc_clk_gpio  = 100;
		config.ddc_data_gpio = 101;
		config.hpd_gpio      = 102;
		config.mux_en_gpio   = -1;
		config.mux_sel_gpio  = -1;
	} else if (cpu_is_msm8x60()) {
		static const char *hpd_reg_names[] = {
				"8901_hdmi_mvs", "8901_mpp0"
		};
		config.phy_init      = hdmi_phy_8x60_init;
		config.hpd_reg_names = hpd_reg_names;
		config.hpd_reg_cnt   = ARRAY_SIZE(hpd_reg_names);
		config.hpd_clk_names = hpd_clk_names;
		config.hpd_clk_cnt   = ARRAY_SIZE(hpd_clk_names);
		config.ddc_clk_gpio  = 170;
		config.ddc_data_gpio = 171;
		config.hpd_gpio      = 172;
		config.mux_en_gpio   = -1;
		config.mux_sel_gpio  = -1;
	}
	config.mmio_name     = "hdmi_msm_hdmi_addr";
	config.qfprom_mmio_name = "hdmi_msm_qfprom_addr";

	hdmi_cfg = &config;
#endif
	dev->platform_data = hdmi_cfg;

	hdmi = hdmi_init(to_platform_device(dev));
	if (IS_ERR(hdmi))
		return PTR_ERR(hdmi);
	priv->hdmi = hdmi;
	msm_hdmi_register_audio_driver(hdmi, dev);

	return 0;
}