struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = ®, .len = 1 };
+ dprintk(FE_DEBUG, 1, "write reg %02X", reg);
err = i2c_transfer(i2c, &msg, 1);
if (err < 0)
goto exit;
if (err < 0)
goto exit;
+ isl6423->reg_3 = reg_3;
+ isl6423->reg_4 = reg_4;
+
return 0;
exit:
dprintk(FE_ERROR, 1, "I/O error <%d>", err);
enum fe_sec_voltage voltage)
{
struct isl6423_dev *isl6423 = (struct isl6423_dev *) fe->sec_priv;
+ u8 reg_3 = isl6423->reg_3;
u8 reg_4 = isl6423->reg_4;
int err = 0;
- /* SR4H = 0, SR4M = 1, SR4L = 1 */
- reg_4 = 0x03 << 5;
-
switch (voltage) {
case SEC_VOLTAGE_OFF:
/* EN = 0 */
/* EN = 1, VSPEN = 1, VTOP = 0, VBOT = 0 */
reg_4 |= (1 << 4);
reg_4 &= ~0x3;
+ reg_3 |= (1 << 3);
break;
case SEC_VOLTAGE_18:
reg_4 |= (1 << 4);
reg_4 |= 0x2;
reg_4 &= ~0x1;
+ reg_3 |= (1 << 3);
break;
default:
break;
}
+ err = isl6423_write(isl6423, reg_3);
+ if (err < 0)
+ goto exit;
+
err = isl6423_write(isl6423, reg_4);
if (err < 0)
goto exit;
+ isl6423->reg_3 = reg_3;
+ isl6423->reg_4 = reg_4;
+
return 0;
exit:
dprintk(FE_ERROR, 1, "I/O error <%d>", err);
const struct isl6423_config *config = isl6423->config;
int err = 0;
- /* SR3H = 0, SR3M = 1, SR3L = 0 */
- reg_3 = 0x02 << 5;
-
switch (config->current_max) {
case SEC_CURRENT_275m:
/* 275mA */
switch (config->curlim) {
case SEC_CURRENT_LIM_ON:
- /* DCL = 1 */
- reg_3 |= 0x10;
+ /* DCL = 0 */
+ reg_3 &= ~0x10;
break;
case SEC_CURRENT_LIM_OFF:
- /* DCL = 0 */
- reg_3 &= ~0x10;
+ /* DCL = 1 */
+ reg_3 |= 0x10;
break;
}
if (err < 0)
goto exit;
+ isl6423->reg_3 = reg_3;
+
return 0;
exit:
dprintk(FE_ERROR, 1, "I/O error <%d>", err);
isl6423->i2c = i2c;
fe->sec_priv = isl6423;
+ /* SR3H = 0, SR3M = 1, SR3L = 0 */
+ isl6423->reg_3 = 0x02 << 5;
+ /* SR4H = 0, SR4M = 1, SR4L = 1 */
+ isl6423->reg_4 = 0x03 << 5;
+
if (isl6423_set_current(fe))
goto exit;