Skip to contentSkip to conversation

staging: fbtft: replace udelay with usleep_range

PATCH In review Christos Kollintzas 2 participants 3 messages Jul 9, 2022 – Jul 10, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: fbtft: replace udelay with usleep_range

Adhere to Linux kernel coding style.

Reported by checkpatch:

CHECK: usleep_range is preferred over udelay

---
 drivers/staging/fbtft/fb_upd161704.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/fbtft/fb_upd161704.c +9 -9
index c680160d6380..eeafbab4ace1 100644
@@ -32,27 +32,27 @@ static int init_display(struct fbtft_par *par)
 
 	/* oscillator start */
 	write_reg(par, 0x003A, 0x0001);	/*Oscillator 0: stop, 1: operation */
-	udelay(100);
+	usleep_range(100, 110);
 
 	/* y-setting */
 	write_reg(par, 0x0024, 0x007B);	/* amplitude setting */
-	udelay(10);
+	usleep_range(10, 15);
 	write_reg(par, 0x0025, 0x003B);	/* amplitude setting */
 	write_reg(par, 0x0026, 0x0034);	/* amplitude setting */
-	udelay(10);
+	usleep_range(10, 15);
 	write_reg(par, 0x0027, 0x0004);	/* amplitude setting */
 	write_reg(par, 0x0052, 0x0025);	/* circuit setting 1 */
-	udelay(10);
+	usleep_range(10, 15);
 	write_reg(par, 0x0053, 0x0033);	/* circuit setting 2 */
 	write_reg(par, 0x0061, 0x001C);	/* adjustment V10 positive polarity */
-	udelay(10);
+	usleep_range(10, 15);
 	write_reg(par, 0x0062, 0x002C);	/* adjustment V9 negative polarity */
 	write_reg(par, 0x0063, 0x0022);	/* adjustment V34 positive polarity */
-	udelay(10);
+	usleep_range(10, 15);
 	write_reg(par, 0x0064, 0x0027);	/* adjustment V31 negative polarity */
-	udelay(10);
+	usleep_range(10, 15);
 	write_reg(par, 0x0065, 0x0014);	/* adjustment V61 negative polarity */
-	udelay(10);
+	usleep_range(10, 15);
 	write_reg(par, 0x0066, 0x0010);	/* adjustment V61 negative polarity */
 
 	/* Basical clock for 1 line (BASECOUNT[7:0]) number specified */
@@ -60,7 +60,7 @@ static int init_display(struct fbtft_par *par)
 
 	/* Power supply setting */
 	write_reg(par, 0x0019, 0x0000);	/* DC/DC output setting */
-	udelay(200);
+	usleep_range(200, 210);
 	write_reg(par, 0x001A, 0x1000);	/* DC/DC frequency setting */
 	write_reg(par, 0x001B, 0x0023);	/* DC/DC rising setting */
 	write_reg(par, 0x001C, 0x0C01);	/* Regulator voltage setting */
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 16 lines · Christos Kollintzas

Adhere to Linux kernel coding style.

Reported by checkpatch:

CHECK: usleep_range is preferred over udelay

---
 drivers/staging/fbtft/fb_upd161704.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/fbtft/fb_upd161704.c +0 -0
index c680160d6380..eeafbab4ace1 100644

drivers/staging/fbtft/fb_upd161704.c static int init_display(struct fbtft_par *par) · line 35

Quoted 5 lines
drivers/staging/fbtft/fb_upd161704.c +1 -1
@@ -32,27 +32,27 @@ static int init_display(struct fbtft_par *par)
 
 	/* oscillator start */
 	write_reg(par, 0x003A, 0x0001);	/*Oscillator 0: stop, 1: operation */
-	udelay(100);
+	usleep_range(100, 110);

When doing these types of changes, you really need access to the hardware involved in order to be able to properly test it.

Especially for this type of function which is trying to do timing changes which the hardware requires.

Did you test this on the real hardware and did it work properly?

thanks,

greg k-h

#2 lore raw
Quoted 26 lines · Greg KH
Quoted 16 lines · Christos Kollintzas

Adhere to Linux kernel coding style.

Reported by checkpatch:

CHECK: usleep_range is preferred over udelay

---
 drivers/staging/fbtft/fb_upd161704.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/fbtft/fb_upd161704.c +0 -0
index c680160d6380..eeafbab4ace1 100644

drivers/staging/fbtft/fb_upd161704.c static int init_display(struct fbtft_par *par) · line 35

Quoted 5 lines
drivers/staging/fbtft/fb_upd161704.c +1 -1
@@ -32,27 +32,27 @@ static int init_display(struct fbtft_par *par)
 
 	/* oscillator start */
 	write_reg(par, 0x003A, 0x0001);	/*Oscillator 0: stop, 1: operation */
-	udelay(100);
+	usleep_range(100, 110);

When doing these types of changes, you really need access to the hardware involved in order to be able to properly test it.

Quoted 8 lines

Especially for this type of function which is trying to do timing changes which the hardware requires.

Did you test this on the real hardware and did it work properly?

thanks,

greg k-h

I did not.

I will try to find the hardware and send a patch that is properly tested.

thanks,

Christos Kollintzas