Merge "pmic-voter: move to common header location"

This commit is contained in:
Linux Build Service Account 2017-03-21 21:30:27 -07:00 committed by Gerrit - the friendly Code Review server
commit c65465727b
9 changed files with 22 additions and 14 deletions

View file

@ -217,6 +217,7 @@ struct tadc_chip {
struct tadc_chan_data chans[TADC_NUM_CH];
struct completion eoc_complete;
struct mutex write_lock;
struct mutex conv_lock;
};
struct tadc_pt {
@ -482,10 +483,11 @@ static int tadc_do_conversion(struct tadc_chip *chip, u8 channels, s16 *adc)
u8 val[TADC_NUM_CH * 2];
int rc, i;
mutex_lock(&chip->conv_lock);
rc = tadc_read(chip, TADC_MBG_ERR_REG(chip), val, 1);
if (rc < 0) {
pr_err("Couldn't read mbg error status rc=%d\n", rc);
return rc;
goto unlock;
}
if (val[0] != 0) {
@ -496,7 +498,7 @@ static int tadc_do_conversion(struct tadc_chip *chip, u8 channels, s16 *adc)
rc = tadc_write(chip, TADC_CONV_REQ_REG(chip), channels);
if (rc < 0) {
pr_err("Couldn't write conversion request rc=%d\n", rc);
return rc;
goto unlock;
}
timeout = msecs_to_jiffies(CONVERSION_TIMEOUT_MS);
@ -506,25 +508,29 @@ static int tadc_do_conversion(struct tadc_chip *chip, u8 channels, s16 *adc)
rc = tadc_read(chip, TADC_SW_CH_CONV_REG(chip), val, 1);
if (rc < 0) {
pr_err("Couldn't read conversion status rc=%d\n", rc);
return rc;
goto unlock;
}
if (val[0] != channels) {
pr_err("Conversion timed out\n");
return -ETIMEDOUT;
rc = -ETIMEDOUT;
goto unlock;
}
}
rc = tadc_read(chip, TADC_CH1_ADC_LO_REG(chip), val, ARRAY_SIZE(val));
if (rc < 0) {
pr_err("Couldn't read adc channels rc=%d\n", rc);
return rc;
goto unlock;
}
for (i = 0; i < TADC_NUM_CH; i++)
adc[i] = (s16)(val[i * 2] | (u16)val[i * 2 + 1] << 8);
return jiffies_to_msecs(timeout - timeleft);
rc = jiffies_to_msecs(timeout - timeleft);
unlock:
mutex_unlock(&chip->conv_lock);
return rc;
}
static int tadc_read_raw(struct iio_dev *indio_dev,
@ -683,6 +689,7 @@ static int tadc_read_raw(struct iio_dev *indio_dev,
case TADC_DIE_TEMP:
case TADC_DIE_TEMP_THR1:
case TADC_DIE_TEMP_THR2:
case TADC_DIE_TEMP_THR3:
*val = chan_data->scale;
return IIO_VAL_INT;
case TADC_BATT_I:
@ -1017,6 +1024,7 @@ static int tadc_probe(struct platform_device *pdev)
chip->tadc_cmp_base = chip->tadc_base + 0x100;
mutex_init(&chip->write_lock);
mutex_init(&chip->conv_lock);
chip->regmap = dev_get_regmap(chip->dev->parent, NULL);
if (!chip->regmap) {
pr_err("Couldn't get regmap\n");

View file

@ -24,7 +24,7 @@
#include <linux/printk.h>
#include <linux/pm_wakeup.h>
#include <linux/slab.h>
#include "pmic-voter.h"
#include <linux/pmic-voter.h>
#define DRV_MAJOR_VERSION 1
#define DRV_MINOR_VERSION 0

View file

@ -29,7 +29,7 @@
#include <linux/string_helpers.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include "pmic-voter.h"
#include <linux/pmic-voter.h>
#define fg_dbg(chip, reason, fmt, ...) \
do { \

View file

@ -18,7 +18,7 @@
#include <linux/slab.h>
#include <linux/string.h>
#include "pmic-voter.h"
#include <linux/pmic-voter.h>
#define NUM_MAX_CLIENTS 8
#define DEBUG_FORCE_CLIENT "DEBUG_FORCE_CLIENT"

View file

@ -19,7 +19,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/qpnp/qpnp-revid.h>
#include "pmic-voter.h"
#include <linux/pmic-voter.h>
#define QNOVO_REVISION1 0x00
#define QNOVO_REVISION2 0x01

View file

@ -26,7 +26,7 @@
#include "smb-reg.h"
#include "smb-lib.h"
#include "storm-watch.h"
#include "pmic-voter.h"
#include <linux/pmic-voter.h>
#define SMB2_DEFAULT_WPWR_UW 8000000

View file

@ -22,7 +22,7 @@
#include "smb-lib.h"
#include "smb-reg.h"
#include "storm-watch.h"
#include "pmic-voter.h"
#include <linux/pmic-voter.h>
#define smblib_err(chg, fmt, ...) \
pr_err("%s: %s: " fmt, chg->name, \

View file

@ -28,7 +28,7 @@
#include "smb-reg.h"
#include "smb-lib.h"
#include "storm-watch.h"
#include "pmic-voter.h"
#include <linux/pmic-voter.h>
#define SMB138X_DEFAULT_FCC_UA 1000000
#define SMB138X_DEFAULT_ICL_UA 1500000