浏览代码

Input: ad714x - fix threshold and completion interrupt masks

Fix two issues in the threshold and completion interrupt mask and unmask
functions. According to the AD714x datasheets the highest stage completion
interrupt should be enabled. Fix mask computation.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Tested-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Michael Hennerich 14 年之前
父节点
当前提交
e223cc7e96
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      drivers/input/misc/ad714x.c

+ 4 - 4
drivers/input/misc/ad714x.c

@@ -158,10 +158,10 @@ static void ad714x_use_com_int(struct ad714x_chip *ad714x,
 	unsigned short data;
 	unsigned short data;
 	unsigned short mask;
 	unsigned short mask;
 
 
-	mask = ((1 << (end_stage + 1)) - 1) - (1 << start_stage);
+	mask = ((1 << (end_stage + 1)) - 1) - ((1 << start_stage) - 1);
 
 
 	ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data);
 	ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data);
-	data |= 1 << start_stage;
+	data |= 1 << end_stage;
 	ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data);
 	ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data);
 
 
 	ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data);
 	ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data);
@@ -175,10 +175,10 @@ static void ad714x_use_thr_int(struct ad714x_chip *ad714x,
 	unsigned short data;
 	unsigned short data;
 	unsigned short mask;
 	unsigned short mask;
 
 
-	mask = ((1 << (end_stage + 1)) - 1) - (1 << start_stage);
+	mask = ((1 << (end_stage + 1)) - 1) - ((1 << start_stage) - 1);
 
 
 	ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data);
 	ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data);
-	data &= ~(1 << start_stage);
+	data &= ~(1 << end_stage);
 	ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data);
 	ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data);
 
 
 	ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data);
 	ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data);