void __init *wm8994_platform_data(void *info)
{
	struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
	int irq = 0;

	if ((INTEL_MID_BOARD(1, PHONE, MRFL)) ||
		   (INTEL_MID_BOARD(1, TABLET, MRFL)) ||
		   (INTEL_MID_BOARD(1, PHONE, MOFD)) ||
		   (INTEL_MID_BOARD(1, TABLET, MOFD))) {

		platform_add_devices(wm8958_reg_devices,
			ARRAY_SIZE(wm8958_reg_devices));

		irq = wm8994_get_irq_data(&wm8994_pdata, i2c_info,
							"audiocodec_int");
		if (irq < 0)
			return NULL;
	} else if ((SPID_PRODUCT(INTEL, CLVTP, PHONE, RHB)) ||
		   (SPID_PRODUCT(INTEL, CLVT, TABLET, TBD))) {

		platform_add_devices(wm1811a_reg_devices,
			ARRAY_SIZE(wm1811a_reg_devices));

		i2c_info->addr = 0x1a;
	} else {
		pr_err("Not supported....\n");
		return NULL;
	}

	return &wm8994_pdata;
}
static struct intel_mid_otg_pdata *get_otg_platform_data(struct pci_dev *pdev)
{
	struct intel_mid_otg_pdata *pdata = &otg_pdata;

	switch (pdev->device) {
	case PCI_DEVICE_ID_INTEL_MFD_OTG:
		if (INTEL_MID_BOARD(2, TABLET, MFLD, SLP, PRO) ||
			INTEL_MID_BOARD(2, TABLET, MFLD, SLP, ENG))
			pdata->gpio_vbus = 54;

		if (!INTEL_MID_BOARD(2, TABLET, MFLD, RR, PRO) &&
			!INTEL_MID_BOARD(2, TABLET, MFLD, RR, ENG))
			pdata->power_budget = 200;
		break;

	case PCI_DEVICE_ID_INTEL_CLV_OTG:
		pdata->gpio_cs = get_gpio_by_name("usb_otg_phy_cs");
		if (pdata->gpio_cs == -1) {
			pr_err("%s: No gpio pin usb_otg_phy_cs\n", __func__);
			return NULL;
		}
		pdata->gpio_reset = get_gpio_by_name("usb_otg_phy_rst");
		if (pdata->gpio_reset == -1) {
			pr_err("%s: No gpio pin usb_otg_phy_rst\n", __func__);
			return NULL;
		}
		break;

	default:
		break;
	}

	return pdata;
}
Example #3
0
void __init *bq24261_platform_data(void *info)
{
	static struct bq24261_plat_data bq24261_pdata;


	bq24261_pdata.irq_map = PMIC_SRAM_INTR_MAP;
	bq24261_pdata.irq_mask = PMIC_EXT_INTR_MASK;
	bq24261_pdata.supplied_to = bq24261_supplied_to;
	bq24261_pdata.num_supplicants = ARRAY_SIZE(bq24261_supplied_to);
	bq24261_pdata.throttle_states = bq24261_throttle_states;
	bq24261_pdata.num_throttle_states = ARRAY_SIZE(bq24261_throttle_states);
	bq24261_pdata.enable_charger = NULL;
#ifdef CONFIG_PMIC_CCSM
	bq24261_pdata.enable_charging = pmic_enable_charging;
	bq24261_pdata.set_inlmt = pmic_set_ilimma;
	bq24261_pdata.set_cc = pmic_set_cc;
	bq24261_pdata.set_cv = pmic_set_cv;
	bq24261_pdata.dump_master_regs = dump_pmic_regs;
	bq24261_pdata.enable_vbus = pmic_enable_vbus;
	/* WA for ShadyCove VBUS removal detect issue */
	if (INTEL_MID_BOARD(1, PHONE, MOFD) ||
		INTEL_MID_BOARD(1, TABLET, MOFD)) {
		bq24261_pdata.handle_low_supply = pmic_handle_low_supply;
	}
#endif
	bq24261_pdata.set_iterm = NULL;
	bq24261_pdata.boost_mode_ma = BOOST_CUR_LIM;

	return &bq24261_pdata;
}
void *bq24232_charger_platform_data(void *info)
{
	bq24232_pdata.name = BQ24232_CHRGR_DEV_NAME;

	bq24232_pdata.chg_rate_temp_gpio = get_gpio_by_name("chg_rate_temp");
	bq24232_pdata.pgood_gpio = get_gpio_by_name("chg_pgood");
	bq24232_pdata.charger_ce_n_gpio = get_gpio_by_name("charger_ce_n");
	bq24232_pdata.enable_charging = bq24232_assert_ce_n;
#if CONFIG_PMIC_CCSM
	if (bq24232_pdata.charger_ce_n_gpio < 0)
		bq24232_pdata.enable_charging = pmic_enable_charging;
	bq24232_pdata.get_charging_status = pmic_get_ext_charging_status;
	bq24232_pdata.enable_vbus = pmic_enable_vbus;
#endif
	bq24232_pdata.bat_temp_profile = bq24232_bat_temp_profile;
	bq24232_pdata.bat_hv_temp_profile = bq24232_bat_highvolt_temp_profile;
	bq24232_pdata.bat_hv_threshold = BQ24232_BAT_HIGH_VOLT_THRESHOLD;
	bq24232_pdata.supplied_to = bq24232_supplied_to;
	bq24232_pdata.num_supplicants = ARRAY_SIZE(bq24232_supplied_to);
	if  (INTEL_MID_BOARD(2, PHONE, MRFL, RBY, PRO) ||
			INTEL_MID_BOARD(2, PHONE, MRFL, RBY, ENG) ||
			INTEL_MID_BOARD(2, PHONE, MRFL, MVN, PRO) ||
			INTEL_MID_BOARD(2, PHONE, MRFL, MVN, ENG))
		bq24232_pdata.wc_direct_support = true;
	else
		bq24232_pdata.wc_direct_support = false;

	bq24232_pdata.bat_temp_offset = BQ24232_BATTERY_TEMP_OFFSET;

	return &bq24232_pdata;
}
void __init *msic_thermal_platform_data(void)
{
	struct platform_device *pdev;

	pdev = platform_device_alloc(MSIC_THERM_DEV_NAME, -1);
	if (!pdev) {
		pr_err("out of memory for SFI platform dev %s\n",
			MSIC_THERM_DEV_NAME);
		return NULL;
	}

	if (platform_device_add(pdev)) {
		pr_err("failed to add thermal platform device\n");
		platform_device_put(pdev);
		return NULL;
	}

	if (INTEL_MID_BOARD(1, PHONE, CLVTP) ||
			(INTEL_MID_BOARD(1, TABLET, CLVT)))
		pdev->dev.platform_data = &pdata[ctp_thermal];
	else if (INTEL_MID_BOARD(2, PHONE, MFLD, LEX, ENG) ||
			(INTEL_MID_BOARD(2, PHONE, MFLD, LEX, PRO)))
		pdev->dev.platform_data = &pdata[lex_thermal];
	else
		pdev->dev.platform_data = &pdata[mfld_thermal];

	register_rpmsg_service("rpmsg_mid_thermal", RPROC_SCU, RP_MSIC_THERMAL);

	return 0;
}
void soc_thrm_device_handler(struct sfi_device_table_entry *pentry,
				struct devs_id *dev)
{
	int ret;
	struct platform_device *pdev;

	pr_info("IPC bus = %d, name = %16.16s, irq = 0x%2x\n",
		pentry->host_num, pentry->name, pentry->irq);

	res.start = pentry->irq;

	pdev = platform_device_register_simple(pentry->name, -1,
					(const struct resource *)&res, 1);
	if (IS_ERR(pdev)) {
		ret = PTR_ERR(pdev);
		pr_err("platform_soc_thermal:pdev_register failed: %d\n", ret);
	}

	if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
			INTEL_MID_BOARD(1, TABLET, MRFL))
		pdev->dev.platform_data = &tng_soc_data;
	else if (INTEL_MID_BOARD(1, PHONE, MOFD) ||
			INTEL_MID_BOARD(1, TABLET, MOFD))
		pdev->dev.platform_data = &ann_mofd_soc_data;
}
static int mdm_ctrl_is_supported_ctp(void)
{
	/* FIXME: Revisit on IFWI update*/
	return INTEL_MID_BOARD(1, PHONE, CLVTP) &&
	       (INTEL_MID_BOARD(2, PHONE, CLVTP, RHB, PRO) ||
		INTEL_MID_BOARD(2, PHONE, CLVTP, RHB, ENG));
}
void max17042_i2c_reset_workaround(void)
{
/* toggle clock pin of I2C to recover devices from abnormal status.
 * currently, only max17042 on I2C needs such workaround */
#if defined(CONFIG_BATTERY_INTEL_MDF)
#define I2C_GPIO_PIN 27
#elif defined(CONFIG_BOARD_CTP)
#define I2C_GPIO_PIN 29
#elif defined(CONFIG_X86_MRFLD)
#define I2C_GPIO_PIN 21
#else
#define I2C_GPIO_PIN 27
#endif
#define I2C0_GPIO_PIN_BYT_CR_V2 79

	int i2c_gpio_pin = I2C_GPIO_PIN;
	if (INTEL_MID_BOARD(3, TABLET, BYT, BLK, PRO, CRV2) ||
		INTEL_MID_BOARD(3, TABLET, BYT, BLK, ENG, CRV2))
		i2c_gpio_pin = I2C0_GPIO_PIN_BYT_CR_V2;
	lnw_gpio_set_alt(i2c_gpio_pin, LNW_GPIO);
	gpio_direction_output(i2c_gpio_pin, 0);
	gpio_set_value(i2c_gpio_pin, 1);
	udelay(10);
	gpio_set_value(i2c_gpio_pin, 0);
	udelay(10);
	lnw_gpio_set_alt(i2c_gpio_pin, LNW_ALT_1);
}
static int get_bcu_config(struct ocd_bcove_config_data *ocd_smip_data)
{
	int i;
	void __iomem *bcu_smip_sram_addr;
	u8 *plat_smip_data;
	unsigned long sram_addr;

	if (!ocd_smip_data)
		return -ENXIO;

	if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
		INTEL_MID_BOARD(1, TABLET, MRFL)) {
		sram_addr = MRFL_SMIP_SRAM_ADDR;
	} else if (INTEL_MID_BOARD(1, PHONE, MOFD) ||
		INTEL_MID_BOARD(1, TABLET, MOFD)) {
		sram_addr = MOFD_SMIP_SRAM_ADDR;
	} else
		return -EINVAL;

	plat_smip_data = (u8 *)ocd_smip_data;
	bcu_smip_sram_addr = ioremap_nocache(sram_addr +
					BCU_SMIP_OFFSET, NUM_SMIP_BYTES);

	for (i = 0; i < NUM_SMIP_BYTES; i++)
		*(plat_smip_data + i) = ioread8(bcu_smip_sram_addr + i);

	return 0;
}
static bool max17042_is_valid_batid(void)
{
	bool ret = true;
#ifdef CONFIG_CHARGER_SMB347
	 if (INTEL_MID_BOARD(3, TABLET, BYT, BLK, PRO, 8PR1) ||
		INTEL_MID_BOARD(3, TABLET, BYT, BLK, ENG, 8PR1))
		ret = smb347_is_valid_batid();
#endif
	return ret;
}
static void *get_pwm_platform_data(void)
{
	if (INTEL_MID_BOARD(1, PHONE, CLVTP) ||
		(INTEL_MID_BOARD(1, TABLET, CLVT))) {
		pr_info("%s, CLV board detected\n", __func__);
		return &pdata[ctp_pwm];
	} else {
		pr_info("%s, MFLD board detected\n", __func__);
		return &pdata[mfld_pwm];
	}
}
void __init *bcove_adc_platform_data(void *info)
{
	struct platform_device *pdev = NULL;
	struct sfi_device_table_entry *entry = info;
	int ret;

	pdev = platform_device_alloc(BCOVE_ADC_DEV_NAME, -1);

	if (!pdev) {
		pr_err("out of memory for SFI platform dev %s\n",
					BCOVE_ADC_DEV_NAME);
		goto out;
	}

	if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
		INTEL_MID_BOARD(1, TABLET, MRFL)) {
		bcove_adc_pdata.channel_num = BCOVE_GPADC_CH_NUM;
		bcove_adc_pdata.intr = GPADC_SRAM_INTR_ADDR;
		bcove_adc_pdata.intr_mask = MBATTEMP | MSYSTEMP | MBATT
			| MVIBATT | MCCTICK;
		bcove_adc_pdata.gpadc_iio_maps = basincove_iio_maps;
		bcove_adc_pdata.gpadc_regmaps = basincove_gpadc_regmaps;
		bcove_adc_pdata.gpadc_regs = &basincove_gpadc_regs;
		bcove_adc_pdata.gpadc_channels = basincove_adc_channels;
	} else if (INTEL_MID_BOARD(1, PHONE, MOFD) ||
		INTEL_MID_BOARD(1, TABLET, MOFD)) {
		bcove_adc_pdata.channel_num = SCOVE_GPADC_CH_NUM;
		bcove_adc_pdata.intr = GPADC_SRAM_INTR_ADDR;
		bcove_adc_pdata.intr_mask = MUSBID | MPEAK | MBATTEMP
			| MSYSTEMP | MBATT | MVIBATT | MGPMEAS | MCCTICK;
		bcove_adc_pdata.gpadc_iio_maps = shadycove_iio_maps;
		bcove_adc_pdata.gpadc_regmaps = shadycove_gpadc_regmaps;
		bcove_adc_pdata.gpadc_regs = &shadycove_gpadc_regs;
		bcove_adc_pdata.gpadc_channels = shadycove_adc_channels;
	}

	pdev->dev.platform_data = &bcove_adc_pdata;

	ret = platform_device_add(pdev);
	if (ret) {
		pr_err("failed to add bcove adc platform device\n");
		platform_device_put(pdev);
		goto out;
	}

	install_irq_resource(pdev, entry->irq);

	register_rpmsg_service("rpmsg_bcove_adc", RPROC_SCU,
				RP_BCOVE_ADC);
out:
	return &bcove_adc_pdata;
}
static int __init regulator_init(void)
{
	if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_CLOVERVIEW)
		return 0;

	if (INTEL_MID_BOARD(2, PHONE, CLVTP, VB, PRO)
	    || INTEL_MID_BOARD(2, PHONE, CLVTP, VB, ENG)
	    || INTEL_MID_BOARD(3, PHONE, CLVTP, RHB, PRO, VVLITE)
	    || INTEL_MID_BOARD(3, PHONE, CLVTP, RHB, ENG, VVLITE)
	    || ((INTEL_MID_BOARD(2, PHONE, CLVTP, RHB, PRO)
		 || INTEL_MID_BOARD(2, PHONE, CLVTP, RHB, ENG))
		&& (SPID_HARDWARE_ID(CLVTP, PHONE, VB, PR1A)
		    || SPID_HARDWARE_ID(CLVTP, PHONE, VB, PR1B)
		    || SPID_HARDWARE_ID(CLVTP, PHONE, VB, PR20))))
		atom_regulator_victoriabay_init();
	else if (INTEL_MID_BOARD(2, PHONE, CLVTP, RHB, PRO)
		 || INTEL_MID_BOARD(2, PHONE, CLVTP, RHB, ENG))
		atom_regulator_redhookbay_init();

	platform_device_register(&vprog2_device);
	platform_device_register(&vemmc1_device); //ASUS_BSP+++
	platform_device_register(&vemmc2_device);
	platform_device_register(&vccsdio_device);

	return 0;
}
static int sst_soc_probe(struct snd_soc_platform *platform)
{
	struct sst_data *ctx = snd_soc_platform_get_drvdata(platform);
	struct soft_platform_id spid;
	int ret = 0;

	memcpy(&spid, ctx->pdata->spid, sizeof(spid));
	pr_debug("Enter:%s\n", __func__);
	if (INTEL_MID_BOARD(1, PHONE, CLVTP) ||
	    INTEL_MID_BOARD(1, TABLET, CLVT) ||
	    INTEL_MID_BOARD(1, TABLET, BYT))
		return sst_platform_clv_init(platform);
	if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
			INTEL_MID_BOARD(1, TABLET, MRFL) ||
			INTEL_MID_BOARD(1, PHONE, MOFD) ||
			INTEL_MID_BOARD(1, TABLET, MOFD)) {
#if IS_BUILTIN(CONFIG_SST_MRFLD_DPCM)
		ret = sst_dsp_init_v2_dpcm(platform);
#else
		ret = sst_dsp_init(platform);
#endif
		if (ret)
			return ret;
		ret = snd_soc_register_effect(platform->card, &effects_ops);
	}
	if (INTEL_MID_BOARD(1, TABLET, CHT)) {
		ret = sst_dsp_init(platform);
		if (ret)
			pr_err("Dsp init failed: %d\n", ret);
	}
	return ret;
}
static int hdmi_i2c_workaround(void)
{
	struct platform_device *pdev;
	struct i2c_gpio_platform_data *pdata;

	/*
	 * Hard code a gpio controller platform device to take over
	 * the two gpio pins used to be controlled by i2c bus 3.
	 * This is to support HDMI EDID extension block read, which
	 * is not supported by the current i2c controller, so we use
	 * GPIO pin the simulate an i2c bus.
	 */

	/* On Merrifield, bus number 8 is used for battery charger.
	 *  use 10 across medfield/ctp/merrifield platforms.
	 */
	pdev = platform_device_alloc(DEVICE_NAME, 10);

	if (!pdev) {
		pr_err("i2c-gpio: failed to alloc platform device\n");
		return -ENOMEM;
	}

	pdata = kzalloc(sizeof(struct i2c_gpio_platform_data), GFP_KERNEL);
	if (!pdata) {
		pr_err("i2c-gpio: failed to alloc platform data\n");
		kfree(pdev);
		return -ENOMEM;
	}
	if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
	    INTEL_MID_BOARD(1, TABLET, MRFL)) {
		/* Pins 17 and 18 are used in Merrifield for HDMI i2c (bus3) */
		pdata->scl_pin = 17;
		pdata->sda_pin = 18;
	} else {
		pdata->scl_pin = 35 + 96;
		pdata->sda_pin = 36 + 96;
	}
	pdata->sda_is_open_drain = 0;
	pdata->scl_is_open_drain = 0;
	pdev->dev.platform_data = pdata;

	platform_device_add(pdev);

	lnw_gpio_set_alt(pdata->sda_pin, LNW_GPIO);
	lnw_gpio_set_alt(pdata->scl_pin, LNW_GPIO);

	return 0;
}
void *bq24192_platform_data(void *info)
{
	static struct bq24192_platform_data platform_data;

	pr_debug("%s:\n", __func__);

	if (INTEL_MID_BOARD(3, TABLET, BYT, BLK, PRO, CRV2) ||
		INTEL_MID_BOARD(3, TABLET, BYT, BLK, ENG, CRV2)) {
		platform_byt_init_chrg_params(&platform_data);
	} else {
		platform_clvp_init_chrg_params(&platform_data);
	}

	return &platform_data;
}
int get_smip_plat_config(int offset)
{
	if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
		INTEL_MID_BOARD(1, TABLET, MRFL) ||
		INTEL_MID_BOARD(1, PHONE, MOFD) ||
		INTEL_MID_BOARD(1, TABLET, MOFD)) {
		if (!is_mapped) {
			smip = ioremap_nocache(MRFL_SMIP_SRAM_ADDR +
				MRFL_PLATFORM_CONFIG_OFFSET, 8);
			is_mapped = true;
		}
		return ioread8(smip + offset);
	}
	return -EINVAL;
}
Example #18
0
/*
 * Checking the SOC type is temporary workaround to enable OV8830
 * on Bodegabay (tangier) platform. Once standard regulator devices
 * (e.g. vprog1, vprog2) and control functions (pmic_avp) are added
 * for the platforms with tangier, then we can revert this change.
 * ([email protected])
 */
static int ov8830_power_ctrl(struct v4l2_subdev *sd, int flag)
{
	int ret = 0;

	/* The camera powering is different on RedHookBay and VictoriaBay
	 * On RHB, vprog1 is at 2.8V and supplies both cameras
	 * On VB, vprog1 supplies the 2nd camera and must not rise over 1.2V
	 * Check if the RHB SW has accidentally been flashed to VB
	 * If yes, don't turn on the regulator. The VB secondary camera will
	 * be permanently damaged by the too high voltage
	 */
	if (INTEL_MID_BOARD(2, PHONE, CLVTP, VB, PRO) ||
	    INTEL_MID_BOARD(2, PHONE, CLVTP, VB, ENG)) {
		printk(KERN_ALERT \
		"Aborted vprog1 enable to protect VictoriaBay 2nd camera HW\n");
		return -ENODEV;
	}

	if (flag) {
		if (!camera_vprog1_on) {
			if (intel_mid_identify_cpu() ==
			   INTEL_MID_CPU_CHIP_TANGIER)
				ret = intel_scu_ipc_msic_vprog1(1);
			else
				ret = regulator_enable(vprog1_reg);
			if (!ret)
				camera_vprog1_on = 1;
			else
				printk(KERN_ALERT "Failed to enable regulator vprog1\n");
			return ret;
		}
	} else {
		if (camera_vprog1_on) {
			if (intel_mid_identify_cpu() ==
			   INTEL_MID_CPU_CHIP_TANGIER)
				ret = intel_scu_ipc_msic_vprog1(0);
			else
				ret = regulator_disable(vprog1_reg);

			if (!ret)
				camera_vprog1_on = 0;
			else
				printk(KERN_ALERT "Failed to disable regulator vprog1\n");
			return ret;
		}
	}
	return ret;
}
void __init camera_init_device(void)
{
	struct camera_device_table *table = NULL;
	int entry_num = 0;
	int i;
	if (INTEL_MID_BOARD(1, TABLET, BYT)) {
		if (spid.hardware_id == BYT_TABLET_BLK_8PR0 ||
		    spid.hardware_id == BYT_TABLET_BLK_8PR1) {
			table = byt_ffrd8_cam_table;
			entry_num = ARRAY_SIZE(byt_ffrd8_cam_table);
		} else if (spid.hardware_id == BYT_TABLET_BLK_CRV2) {
			table = byt_crv2_cam_table;
			entry_num = ARRAY_SIZE(byt_crv2_cam_table);
		} else {
			table = byt_ffrd10_cam_table;
			entry_num = ARRAY_SIZE(byt_ffrd10_cam_table);
		}
	}
	/* For CHT, INTEL_MID_BOARD is not ready at the moment. */
	/* Need to call INTEL_MID_BOARD to indentify CHT. */
#ifdef BOARD_CHT
	table = cht_rvp_cam_table;
	entry_num = ARRAY_SIZE(cht_rvp_cam_table);
#endif
	for (i = 0; i < entry_num; i++, table++) {
		if (table->dev.device_handler)
			table->dev.device_handler(&table->entry,
				&table->dev);
	}
}
static int camera_af_power_ctrl(struct v4l2_subdev *sd, int flag)
{
	if (!INTEL_MID_BOARD(1, TABLET, BYT))
		return gpio_direction_output(camera_af_power_gpio, flag);
	else
		return 0;
}
const struct camera_af_platform_data *camera_get_af_platform_data(void)
{
	static const int GP_CORE = 96;
	static const int GPIO_DEFAULT = GP_CORE + 76;
	static const char gpio_name[] = "CAM_0_AF_EN";
	static const struct camera_af_platform_data platform_data = {
		.power_ctrl = camera_af_power_ctrl
	};
#if 0
	int gpio, r;

	if (!INTEL_MID_BOARD(1, TABLET, BYT) && camera_af_power_gpio == -1) {
		gpio = get_gpio_by_name(gpio_name);
		if (gpio < 0) {
			pr_err("%s: can't find gpio `%s',default\n",
						__func__, gpio_name);
			gpio = GPIO_DEFAULT;
		}
		pr_info("camera pdata: af gpio: %d\n", gpio);
		r = gpio_request(gpio, gpio_name);
		if (r)
			return NULL;
		r = gpio_direction_output(gpio, 0);
		if (r)
			return NULL;
		camera_af_power_gpio = gpio;
	}
	return &platform_data;
#else
	return &platform_data;
#endif
}
static int __init bq27541_platform_init(void)
{
	int soc_int_gpio, soc_int_irq;
	int res;

	soc_int_gpio = get_gpio_by_name("max_fg_alert");

	printk("<AXS> %s: fuegauge interrupt gpio = %d\n", __func__, soc_int_gpio);

	if(soc_int_gpio !=  -ENODEV)
	{
		printk("<AXS> %s:gpio is OK fuegauge interrupt gpio = %d\n", __func__, soc_int_gpio);
		if (!INTEL_MID_BOARD(1, TABLET, BYT))
			soc_int_gpio = soc_int_gpio + INTEL_MID_IRQ_OFFSET;
		
		res = irq_set_irq_wake(soc_int_irq, 1);
		if (res) {
			pr_err("%s: Failed to set irq wake for soc_int: %d\n", __func__, res);
			return 0;
		}
	}

	bq27541_platform_data.soc_int_irq = soc_int_irq;
	//bq27541_platform_data.translate_temp = bq27541_translate_temp;
	res = i2c_register_board_info(BQ27541_I2C_MASTER, 
							&bq27541_i2c_boardinfo, ARRAY_SIZE(bq27541_i2c_boardinfo));
	if(res < 0){
		pr_err("%s: fail register bq27541 i2c device\n");
	}
	
	return 0;
}
static int __init platform_soc_thermal_init(void)
{
	if (INTEL_MID_BOARD(1, TABLET, BYT))
		return byt_soc_thermal_init();

	return 0;
}
Example #24
0
static int wifi_plat_dev_drv_probe_acpi(struct platform_device *pdev)
{
	wifi_adapter_info_t *adapter;
	acpi_handle handle;
	struct acpi_device *adev;
	int irq_num;

	/* Android style wifi platform data device ("bcmdhd_wlan" or "bcm4329_wlan")
	 * is kept for backward compatibility and supports only 1 adapter
	 */
	ASSERT(dhd_wifi_platdata != NULL);
	ASSERT(dhd_wifi_platdata->num_adapters == 1);
	adapter = &dhd_wifi_platdata->adapters[0];
	adapter->wifi_plat_data = (void *)&dhd_wlan_control;

	if (ACPI_HANDLE(&pdev->dev)) {
		handle = ACPI_HANDLE(&pdev->dev);

		/* Dont try to do acpi pm for the wifi module */
		if (!handle || acpi_bus_get_device(handle, &adev))
			DHD_ERROR(("%s: could not get acpi pointer!\n", __FUNCTION__));
		else
			adev->flags.power_manageable = 0;
		irq_num = acpi_get_gpio_by_index(&pdev->dev, 0, NULL);
		DHD_INFO(("%s: Using ACPI table to get IRQ number: %d\n", __FUNCTION__, irq_num));
		if (irq_num < 0) {
			if (INTEL_MID_BOARD(2, TABLET, BYT, BLB, PRO) ||
			    INTEL_MID_BOARD(2, TABLET, BYT, BLB, ENG)) {
				DHD_INFO(("%s: BYT-M hardcoding\n", __FUNCTION__));
				irq_num = acpi_get_gpio("\\_SB.GPO2", 17);
			}
			else {
				DHD_INFO(("%s: BYT-T hardcoding\n", __FUNCTION__));
				irq_num = acpi_get_gpio("\\_SB.GPO2", 15);
			}
		}
	} else {
		DHD_ERROR(("%s: Null ACPI_HANDLE, try legacy probe\n", __FUNCTION__));
		return wifi_plat_dev_drv_probe(pdev);
	}

	adapter->irq_num = irq_num;
	adapter->intr_flags = IRQF_TRIGGER_FALLING;

	wifi_plat_dev_probe_ret = dhd_wifi_platform_load();
	return wifi_plat_dev_probe_ret;
}
static __init int hsu_dev_platform_data(void)
{
	switch (intel_mid_identify_cpu()) {
	case INTEL_MID_CPU_CHIP_CLOVERVIEW:
		platform_hsu_info = &hsu_port_cfgs[hsu_clv][0];
		if (INTEL_MID_BOARD(2, PHONE, CLVTP, VB, PRO))
			hsu_port_gpio_mux =
				&hsu_port_pin_cfgs[hsu_clv][hsu_pid_vtb_pro][0];
		else if (INTEL_MID_BOARD(2, PHONE, CLVTP, VB, ENG))
			hsu_port_gpio_mux =
				&hsu_port_pin_cfgs[hsu_clv][hsu_pid_vtb_eng][0];
		else
			hsu_port_gpio_mux =
				&hsu_port_pin_cfgs[hsu_clv][hsu_pid_rhb][0];
		break;
	case INTEL_MID_CPU_CHIP_VALLEYVIEW2:
		platform_hsu_info = &hsu_port_cfgs[hsu_vlv2][0];
		hsu_port_gpio_mux =
			&hsu_port_pin_cfgs[hsu_vlv2][hsu_pid_def][0];
		break;

	case INTEL_MID_CPU_CHIP_TANGIER:
	case INTEL_MID_CPU_CHIP_ANNIEDALE:
		platform_hsu_info = &hsu_port_cfgs[hsu_tng][0];
		hsu_port_gpio_mux = &hsu_port_pin_cfgs[hsu_tng][hsu_pid_def][0];
		break;

	case INTEL_MID_CPU_CHIP_LINCROFT:
	case INTEL_MID_CPU_CHIP_PENWELL:
	default:
		platform_hsu_info = &hsu_port_cfgs[hsu_pnw][0];
		hsu_port_gpio_mux = &hsu_port_pin_cfgs[hsu_pnw][hsu_pid_def][0];
		break;
	}

	if (platform_hsu_info == NULL)
		return -ENODEV;

	if (hsu_port_gpio_mux == NULL)
		return -ENODEV;

	hsu_register_board_info(platform_hsu_info);
	hsu_platform_clk(intel_mid_identify_cpu());

	return 0;
}
static int __init intel_scu_flis_init(void)
{
	int ret;
	struct platform_device *pdev = NULL;
	static struct intel_scu_flis_platform_data flis_pdata;

	if (INTEL_MID_BOARD(1, PHONE, CLVTP) ||
		INTEL_MID_BOARD(1, TABLET, CLVT)) {
		flis_pdata.pin_t = ctp_pin_table;
		flis_pdata.pin_num = CTP_PIN_NUM;
		flis_pdata.mmio_flis_t = NULL;
		flis_pdata.shim_access = true;
	} else if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
		INTEL_MID_BOARD(1, PHONE, MOFD) ||
		INTEL_MID_BOARD(1, TABLET, MOFD)) {
		flis_pdata.pin_t = NULL;
		flis_pdata.pin_num = TNG_PIN_NUM;
		flis_pdata.flis_base = 0xFF0C0000;
		flis_pdata.flis_len = 0x8000;
		flis_pdata.mmio_flis_t = tng_pin_mmio_flis_table;
	} else {
		/* Runtime flis config is supported on CLV & TNG only */
		return -EINVAL;
	}

	pdev = platform_device_alloc(FLIS_DEVICE_NAME, -1);
	if (!pdev) {
		pr_err("out of memory for platform dev %s\n", FLIS_DEVICE_NAME);
		ret = -EINVAL;
		goto out;
	}

	pdev->dev.platform_data = &flis_pdata;

	ret = platform_device_add(pdev);
	if (ret) {
		pr_err("failed to add flis platform device\n");
		platform_device_put(pdev);
		goto out;
	}

	pr_info("intel_scu_flis platform device created\n");
out:
	return ret;
}
void __init camera_init_device(void)
{
	struct camera_device_table *table = NULL;
	int entry_num = 0;
#ifndef CONFIG_VIDEO_PIXTER
	if (INTEL_MID_BOARD(1, TABLET, BYT)) {
		if (spid.hardware_id == BYT_TABLET_BLK_8PR0 ||
		    spid.hardware_id == BYT_TABLET_BLK_8PR1) {
			table = byt_ffrd8_cam_table;
			entry_num = ARRAY_SIZE(byt_ffrd8_cam_table);
		} else if (spid.hardware_id == BYT_TABLET_BLK_CRV2) {
			table = byt_crv2_cam_table;
			entry_num = ARRAY_SIZE(byt_crv2_cam_table);
		} else {
			table = byt_ffrd10_cam_table;
			entry_num = ARRAY_SIZE(byt_ffrd10_cam_table);
		}
	} else if (INTEL_MID_BOARD(1, TABLET, CHT) ||
		   INTEL_MID_BOARD(1, PHONE, CHT)) {
		int fw_type = m10mo_platform_identify_fw();
		if (fw_type != -1) {
			table = cht_somc_cam_table;
			entry_num = ARRAY_SIZE(cht_somc_cam_table);
			pr_info("M10MO for SOMC is detected.\n");
		} else {
			if (spid.hardware_id == CHT_TABLET_RVP1 ||
			    spid.hardware_id == CHT_TABLET_RVP2 ||
			    spid.hardware_id == CHT_TABLET_RVP3 ||
			    spid.hardware_id == CHT_TABLET_FRD_PR0 ||
			    spid.hardware_id == CHT_TABLET_FRD_PR1 ||
			    spid.hardware_id == CHT_TABLET_FRD_PR2) {
				table = cht_ffd_cam_table;
				entry_num = ARRAY_SIZE(cht_ffd_cam_table);
			} else
				pr_warn("unknown CHT platform variant.\n");
		}
	}
#else
	table = pixter_cam_table;
	entry_num = ARRAY_SIZE(pixter_cam_table);
#endif
	atomisp_register_device_table(entry_num, table);
}
void __init *wm8994_platform_data(void *info)
{
	struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
	int irq = 0, ret = 0;
	struct wm8994_pdata *pdata = &wm8994_pdata;

	if ((INTEL_MID_BOARD(1, PHONE, MRFL)) ||
		   (INTEL_MID_BOARD(1, TABLET, MRFL))) {
		platform_add_devices(wm8958_reg_devices,
				ARRAY_SIZE(wm8958_reg_devices));
		irq = wm8994_get_irq_data(pdata, i2c_info, "audiocodec_int");
		if (irq < 0)
			return NULL;
	} else if ((INTEL_MID_BOARD(1, PHONE, MOFD)) ||
		   (INTEL_MID_BOARD(1, TABLET, MOFD))) {
		platform_add_devices(wm8958_reg_devices,
				ARRAY_SIZE(wm8958_reg_devices));

		/* if it is not VV, then use PR pdata */
		if (!(SPID_PRODUCT(INTEL, MOFD, PHONE, MP))) {
			pdata = &wm8994_mofd_pr_pdata;
			ret = wm8994_fill_mofd_pr_data(pdata);
			if (ret < 0)
				return NULL;
		}

		irq = wm8994_get_irq_data(pdata, i2c_info, "audiocodec_int");
		if (irq < 0)
			return NULL;
	} else if ((SPID_PRODUCT(INTEL, CLVTP, PHONE, RHB)) ||
		   (SPID_PRODUCT(INTEL, CLVT, TABLET, TBD))) {

		platform_add_devices(wm1811a_reg_devices,
			ARRAY_SIZE(wm1811a_reg_devices));

		i2c_info->addr = 0x1a;
	} else {
		pr_err("Not supported....\n");
		return NULL;
	}

	return pdata;
}
static int wm8994_fill_mofd_pr_data(struct wm8994_pdata *pdata)
{
	if (!pdata) {
		pr_err("%s: pdata is NULL\n", __func__);
		return -EINVAL;
	}

	/* Only MOFD v0-PR0 & v1-PR0, utilizes the LDOs */
	if (INTEL_MID_BOARD(3, PHONE, MOFD, V0, PRO, PR0) ||
		INTEL_MID_BOARD(3, PHONE, MOFD, V1, PRO, PR0)) {

		pr_debug("%s: Assign LDOs to MOFD PR0's pdata...\n", __func__);
		pdata->ldo[0].enable = pdata->ldo[1].enable = 0;
		pdata->ldo[0].init_data = &wm8994_ldo1_data;
		pdata->ldo[1].init_data = &wm8994_ldo2_data;
		pdata->ldo_ena_always_driven = 1;
	}

	return 0;
}
int get_smip_plat_config(int offset)
{
	unsigned long sram_addr;

	if (INTEL_MID_BOARD(1, PHONE, MRFL) ||
		INTEL_MID_BOARD(1, TABLET, MRFL)) {
		sram_addr = MRFL_SMIP_SRAM_ADDR;
	} else if (INTEL_MID_BOARD(1, PHONE, MOFD) ||
		INTEL_MID_BOARD(1, TABLET, MOFD)) {
		sram_addr = MOFD_SMIP_SRAM_ADDR;
	} else
		return -EINVAL;

	if (!is_mapped) {
		smip = ioremap_nocache(sram_addr +
				MRFL_PLATFORM_CONFIG_OFFSET, 8);
		is_mapped = true;
	}

	return ioread8(smip + offset);
}