Source
dev_warn(dev, "max8952,ramp-speed property not specified, defaulting to 32mV/us\n");
/*
* max8952.c - Voltage and current regulation for the Maxim 8952
*
* Copyright (C) 2010 Samsung Electronics
* MyungJoo Ham <myungjoo.ham@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Registers */
enum {
MAX8952_REG_MODE0,
MAX8952_REG_MODE1,
MAX8952_REG_MODE2,
MAX8952_REG_MODE3,
MAX8952_REG_CONTROL,
MAX8952_REG_SYNC,
MAX8952_REG_RAMP,
MAX8952_REG_CHIP_ID1,
MAX8952_REG_CHIP_ID2,
};
struct max8952_data {
struct i2c_client *client;
struct max8952_platform_data *pdata;
bool vid0;
bool vid1;
};
static int max8952_read_reg(struct max8952_data *max8952, u8 reg)
{
int ret = i2c_smbus_read_byte_data(max8952->client, reg);
if (ret > 0)
ret &= 0xff;
return ret;
}
static int max8952_write_reg(struct max8952_data *max8952,
u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(max8952->client, reg, value);
}
static int max8952_list_voltage(struct regulator_dev *rdev,
unsigned int selector)
{
struct max8952_data *max8952 = rdev_get_drvdata(rdev);
if (rdev_get_id(rdev) != 0)
return -EINVAL;
return (max8952->pdata->dvs_mode[selector] * 10 + 770) * 1000;
}
static int max8952_get_voltage_sel(struct regulator_dev *rdev)
{
struct max8952_data *max8952 = rdev_get_drvdata(rdev);
u8 vid = 0;
if (max8952->vid0)
vid += 1;
if (max8952->vid1)