pinctrl: qcom: spmi-mpp: Set drive-strength for sink function
Write drive-strength setting into SINK_CTL register to make sink function work. Change-Id: I0b6e273b846a8e07c5b36d03a20edddfd895e9c0 Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
This commit is contained in:
parent
cc54c7c347
commit
f090e5b7cc
1 changed files with 18 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2014, 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -88,6 +88,10 @@
|
|||
#define PMIC_MPP_REG_AIN_ROUTE_SHIFT 0
|
||||
#define PMIC_MPP_REG_AIN_ROUTE_MASK 0x7
|
||||
|
||||
/* PMIC_MPP_REG_SINK_CTL */
|
||||
#define PMIC_MPP_REG_CURRENT_SINK_MASK 0x7
|
||||
#define MPP_CURRENT_SINK_MA_STEP_SIZE 5
|
||||
|
||||
#define PMIC_MPP_MODE_DIGITAL_INPUT 0
|
||||
#define PMIC_MPP_MODE_DIGITAL_OUTPUT 1
|
||||
#define PMIC_MPP_MODE_DIGITAL_BIDIR 2
|
||||
|
@ -458,7 +462,7 @@ static int pmic_mpp_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
|
|||
pad->dtest = arg;
|
||||
break;
|
||||
case PIN_CONFIG_DRIVE_STRENGTH:
|
||||
arg = pad->drive_strength;
|
||||
pad->drive_strength = arg;
|
||||
break;
|
||||
case PMIC_MPP_CONF_AMUX_ROUTE:
|
||||
if (arg >= PMIC_MPP_AMUX_ROUTE_ABUS4)
|
||||
|
@ -498,6 +502,16 @@ static int pmic_mpp_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
val = 0;
|
||||
if (pad->drive_strength >= MPP_CURRENT_SINK_MA_STEP_SIZE)
|
||||
val = DIV_ROUND_UP(pad->drive_strength,
|
||||
MPP_CURRENT_SINK_MA_STEP_SIZE) - 1;
|
||||
|
||||
val &= PMIC_MPP_REG_CURRENT_SINK_MASK;
|
||||
ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_SINK_CTL, val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = pmic_mpp_write_mode_ctl(state, pad);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -771,7 +785,8 @@ static int pmic_mpp_populate(struct pmic_mpp_state *state,
|
|||
if (val < 0)
|
||||
return val;
|
||||
|
||||
pad->drive_strength = val;
|
||||
val &= PMIC_MPP_REG_CURRENT_SINK_MASK;
|
||||
pad->drive_strength = (val + 1) * MPP_CURRENT_SINK_MA_STEP_SIZE;
|
||||
|
||||
val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AOUT_CTL);
|
||||
if (val < 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue