Пример #1
0
static int __devinit max8893_pmic_probe(struct i2c_client *client,
				const struct i2c_device_id *i2c_id)
{
	struct regulator_dev **rdev;
	struct max8893_platform_data *pdata = client->dev.platform_data;
	struct max8893_data *max8893;
	int i = 0, id, ret;	
	int gpio_value=0;

	DBG("func =%s :: Start!!!\n",__func__);

	if (!pdata)
		return -EINVAL;

	max8893 = kzalloc(sizeof(struct max8893_data), GFP_KERNEL);
	if (!max8893)
		return -ENOMEM;

	max8893->rdev = kzalloc(sizeof(struct regulator_dev *) * (pdata->num_regulators + 1), GFP_KERNEL);
	if (!max8893->rdev) {
		kfree(max8893);
		return -ENOMEM;
	}

	max8893->client = client;
	max8893->dev = &client->dev;
	mutex_init(&max8893->mutex);

	max8893_client=client;

	max8893->num_regulators = pdata->num_regulators;
	for (i = 0; i < pdata->num_regulators; i++) {

		DBG("regulator_register called for ldo=%d\n",pdata->regulators[i].id);
		id = pdata->regulators[i].id - MAX8893_LDO1;

		max8893->rdev[i] = regulator_register(&regulators_8893[id],
			max8893->dev, pdata->regulators[i].initdata, max8893);

		ret = IS_ERR(max8893->rdev[i]);
		if (ret)
			dev_err(max8893->dev, "regulator init failed\n");
	}

	rdev = max8893->rdev;

	max8893_i2c_read(client, MAX8893_REG_ONOFF, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_DISCHARGE, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_LSTIME, (u8 *) &ret);
 	max8893_i2c_read(client, MAX8893_REG_DVSRAMP, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_BUCK, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_LDO1, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_LDO2, (u8 *) &ret);
 	max8893_i2c_read(client, MAX8893_REG_LDO3, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_LDO4, (u8 *) &ret);
 	max8893_i2c_read(client, MAX8893_REG_LDO5, (u8 *) &ret);  
   
	i2c_set_clientdata(client, max8893);
	client_8893data_p = max8893; // store 8893 client data to be used later

	DBG("func =%s :: End!!!\n",__func__);
 
	return 0;
}
Пример #2
0
static int __devinit max8893_pmic_probe(struct i2c_client *client,
				const struct i2c_device_id *i2c_id)
{
	struct regulator_dev **rdev;
	struct max8893_platform_data *pdata = client->dev.platform_data;
	struct max8893_data *max8893;
	int i = 0, id, ret;	
	int gpio_value=0;

	DBG("func =%s :: Start!!!\n",__func__);

	if (!pdata)
		return -EINVAL;

	max8893 = kzalloc(sizeof(struct max8893_data), GFP_KERNEL);
	if (!max8893)
		return -ENOMEM;

	max8893->rdev = kzalloc(sizeof(struct regulator_dev *) * (pdata->num_regulators + 1), GFP_KERNEL);
	if (!max8893->rdev) {
		kfree(max8893);
		return -ENOMEM;
	}

	max8893->client = client;
	max8893->dev = &client->dev;
	mutex_init(&max8893->mutex);

	max8893_client=client;

	max8893->num_regulators = pdata->num_regulators;
	for (i = 0; i < pdata->num_regulators; i++) {

		DBG("regulator_register called for ldo=%d\n",pdata->regulators[i].id);
		id = pdata->regulators[i].id - MAX8893_LDO1;

		max8893->rdev[i] = regulator_register(&regulators_8893[id],
			max8893->dev, pdata->regulators[i].initdata, max8893);

		ret = IS_ERR(max8893->rdev[i]);
		if (ret)
			dev_err(max8893->dev, "regulator init failed\n");
	}

	rdev = max8893->rdev;

	max8893_i2c_read(client, MAX8893_REG_ONOFF, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_DISCHARGE, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_LSTIME, (u8 *) &ret);
 	max8893_i2c_read(client, MAX8893_REG_DVSRAMP, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_BUCK, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_LDO1, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_LDO2, (u8 *) &ret);
 	max8893_i2c_read(client, MAX8893_REG_LDO3, (u8 *) &ret);
	max8893_i2c_read(client, MAX8893_REG_LDO4, (u8 *) &ret);
 	max8893_i2c_read(client, MAX8893_REG_LDO5, (u8 *) &ret);  
   
	i2c_set_clientdata(client, max8893);
	client_8893data_p = max8893; // store 8893 client data to be used later

	DBG("func =%s :: End!!!\n",__func__);
 
//temp code 
	//NAGSM_Android_SEL_Kernel_Aakash_20101005
//	mass_mem_cfg_gpio();

//	mass_mem_ldo_en(1);
	//NAGSM_Android_SEL_Kernel_Aakash_20101005
//

/****
 sii9234 and fsa9480 driver uses this flag 
 	- to check max8893 status and configure power for sii9234
	- initialize sii9234 
****/
#if defined(CONFIG_S5PC110_DEMPSEY_BOARD)
	max8893_i2cprobe_status = 1;
//[NAGSM_Android_HDLNC_SJW_20101228 : LDO1,2 disable i2c register	
	mass_mem_ldo_en(0);
#endif 
	return 0;
}