Skip to content

Commit

Permalink
Input: sx8654 - convert #defined flags to BIT(x)
Browse files Browse the repository at this point in the history
Some of the #defined register values are one-bit flags. Convert them to
use the BIT(x) macro instead of 1 byte hexadecimal values. This improves
readability and clarifies the intent.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Richard Leitner authored and Dmitry Torokhov committed Feb 5, 2019
1 parent 4ec90ac commit e47ff89
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/input/touchscreen/sx8654.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* published by the Free Software Foundation.
*/

#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
Expand All @@ -46,7 +47,7 @@
#define I2C_REG_SOFTRESET 0x3f

#define I2C_REG_SX8650_STAT 0x05
#define SX8650_STAT_CONVIRQ 0x80
#define SX8650_STAT_CONVIRQ BIT(7)

/* commands */
#define CMD_READ_REGISTER 0x40
Expand All @@ -56,17 +57,17 @@
#define SOFTRESET_VALUE 0xde

/* bits for I2C_REG_IRQSRC */
#define IRQ_PENTOUCH_TOUCHCONVDONE 0x08
#define IRQ_PENRELEASE 0x04
#define IRQ_PENTOUCH_TOUCHCONVDONE BIT(3)
#define IRQ_PENRELEASE BIT(2)

/* bits for RegTouch1 */
#define CONDIRQ 0x20
#define RPDNT_100K 0x00
#define FILT_7SA 0x03

/* bits for I2C_REG_CHANMASK */
#define CONV_X 0x80
#define CONV_Y 0x40
#define CONV_X BIT(7)
#define CONV_Y BIT(6)

/* coordinates rate: higher nibble of CTRL0 register */
#define RATE_MANUAL 0x00
Expand Down

0 comments on commit e47ff89

Please sign in to comment.