* [PATCH 0/2] pwm: Miscellaneous fixes for 64-bit support
@ 2020-06-15 14:16 Thierry Reding
2020-06-15 14:16 ` [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier Thierry Reding
2020-06-15 14:16 ` [PATCH 2/2] pwm: iqs620a: Use 64-bit division Thierry Reding
0 siblings, 2 replies; 12+ messages in thread
From: Thierry Reding @ 2020-06-15 14:16 UTC (permalink / raw)
To: Thierry Reding
Cc: Bartlomiej Zolnierkiewicz, Uwe Kleine-König, Lee Jones,
Guru Das Srinagesh, linux-pwm, linux-fbdev, linux-kernel
Hi,
this contains a couple of fixes for issues that I ran into after
applying Guru's series to convert PWM period and duty-cycle to 64-bit.
Bartlomiej, can you provide an Acked-by on the first patch so that I can
take it through the PWM tree along with the rest of Guru's series?
Thanks,
Thierry
Thierry Reding (2):
video: ssd1307fb: Print PWM period using 64-bit format specifier
pwm: iqs620a: Use 64-bit division
drivers/pwm/pwm-iqs620a.c | 7 ++++---
drivers/video/fbdev/ssd1307fb.c | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
--
2.24.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier
2020-06-15 14:16 [PATCH 0/2] pwm: Miscellaneous fixes for 64-bit support Thierry Reding
@ 2020-06-15 14:16 ` Thierry Reding
2020-06-15 15:18 ` Uwe Kleine-König
` (3 more replies)
2020-06-15 14:16 ` [PATCH 2/2] pwm: iqs620a: Use 64-bit division Thierry Reding
1 sibling, 4 replies; 12+ messages in thread
From: Thierry Reding @ 2020-06-15 14:16 UTC (permalink / raw)
To: Thierry Reding
Cc: Bartlomiej Zolnierkiewicz, Uwe Kleine-König, Lee Jones,
Guru Das Srinagesh, linux-pwm, linux-fbdev, linux-kernel
The PWM core will soon change the duty cycle and period of PWMs to 64
bits to allow for a broader range of values. Use a 64-bit format
specifier to avoid a warning when that change is made.
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
drivers/video/fbdev/ssd1307fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 8e06ba912d60..09425ec317ba 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -312,7 +312,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
/* Enable the PWM */
pwm_enable(par->pwm);
- dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n",
+ dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.\n",
par->pwm->pwm, pwm_get_period(par->pwm));
}
--
2.24.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] pwm: iqs620a: Use 64-bit division
2020-06-15 14:16 [PATCH 0/2] pwm: Miscellaneous fixes for 64-bit support Thierry Reding
2020-06-15 14:16 ` [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier Thierry Reding
@ 2020-06-15 14:16 ` Thierry Reding
2020-06-15 15:16 ` Uwe Kleine-König
2020-06-16 7:06 ` Lee Jones
1 sibling, 2 replies; 12+ messages in thread
From: Thierry Reding @ 2020-06-15 14:16 UTC (permalink / raw)
To: Thierry Reding
Cc: Bartlomiej Zolnierkiewicz, Uwe Kleine-König, Lee Jones,
Guru Das Srinagesh, linux-pwm, linux-fbdev, linux-kernel
The PWM framework is going to change the PWM period and duty cycles to
be 64-bit unsigned integers. To avoid build errors on platforms that do
not natively support 64-bit division, use explicity 64-bit division.
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
drivers/pwm/pwm-iqs620a.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/pwm/pwm-iqs620a.c b/drivers/pwm/pwm-iqs620a.c
index 674f0e238ba0..b2bb27eff623 100644
--- a/drivers/pwm/pwm-iqs620a.c
+++ b/drivers/pwm/pwm-iqs620a.c
@@ -46,7 +46,8 @@ static int iqs620_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
{
struct iqs620_pwm_private *iqs620_pwm;
struct iqs62x_core *iqs62x;
- int duty_scale, ret;
+ u64 duty_scale;
+ int ret;
if (state->polarity != PWM_POLARITY_NORMAL)
return -ENOTSUPP;
@@ -69,7 +70,7 @@ static int iqs620_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
* For lower duty cycles (e.g. 0), the PWM output is simply disabled to
* allow an external pull-down resistor to hold the GPIO3/LTX pin low.
*/
- duty_scale = state->duty_cycle * 256 / IQS620_PWM_PERIOD_NS;
+ duty_scale = div_u64(state->duty_cycle * 256, IQS620_PWM_PERIOD_NS);
mutex_lock(&iqs620_pwm->lock);
@@ -81,7 +82,7 @@ static int iqs620_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
}
if (duty_scale) {
- u8 duty_val = min(duty_scale - 1, 0xFF);
+ u8 duty_val = min_t(u64, duty_scale - 1, 0xff);
ret = regmap_write(iqs62x->regmap, IQS620_PWM_DUTY_CYCLE,
duty_val);
--
2.24.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] pwm: iqs620a: Use 64-bit division
2020-06-15 14:16 ` [PATCH 2/2] pwm: iqs620a: Use 64-bit division Thierry Reding
@ 2020-06-15 15:16 ` Uwe Kleine-König
2020-06-16 7:06 ` Lee Jones
1 sibling, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2020-06-15 15:16 UTC (permalink / raw)
To: Thierry Reding
Cc: Bartlomiej Zolnierkiewicz, Lee Jones, Guru Das Srinagesh,
linux-pwm, linux-fbdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 602 bytes --]
On Mon, Jun 15, 2020 at 04:16:06PM +0200, Thierry Reding wrote:
> The PWM framework is going to change the PWM period and duty cycles to
> be 64-bit unsigned integers. To avoid build errors on platforms that do
> not natively support 64-bit division, use explicity 64-bit division.
>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
LGTM,
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier
2020-06-15 14:16 ` [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier Thierry Reding
@ 2020-06-15 15:18 ` Uwe Kleine-König
2020-06-15 17:19 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2020-06-15 15:18 UTC (permalink / raw)
To: Thierry Reding
Cc: Bartlomiej Zolnierkiewicz, Lee Jones, Guru Das Srinagesh,
linux-pwm, linux-fbdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]
Hello,
On Mon, Jun 15, 2020 at 04:16:05PM +0200, Thierry Reding wrote:
> The PWM core will soon change the duty cycle and period of PWMs to 64
> bits to allow for a broader range of values. Use a 64-bit format
> specifier to avoid a warning when that change is made.
>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
> drivers/video/fbdev/ssd1307fb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
> index 8e06ba912d60..09425ec317ba 100644
> --- a/drivers/video/fbdev/ssd1307fb.c
> +++ b/drivers/video/fbdev/ssd1307fb.c
> @@ -312,7 +312,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
> /* Enable the PWM */
> pwm_enable(par->pwm);
>
> - dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n",
> + dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.\n",
> par->pwm->pwm, pwm_get_period(par->pwm));
I wonder a bit about the driver accessing par->pwm->pwm, but that's
orthogonal to this patch.
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier
2020-06-15 14:16 ` [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier Thierry Reding
2020-06-15 15:18 ` Uwe Kleine-König
@ 2020-06-15 17:19 ` kernel test robot
2020-06-15 17:25 ` kernel test robot
2020-06-17 7:18 ` Geert Uytterhoeven
3 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-06-15 17:19 UTC (permalink / raw)
To: Thierry Reding
Cc: kbuild-all, Bartlomiej Zolnierkiewicz, Uwe Kleine-König,
Lee Jones, Guru Das Srinagesh, linux-pwm, linux-fbdev,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 9716 bytes --]
Hi Thierry,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.8-rc1 next-20200615]
[cannot apply to pwm/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Thierry-Reding/pwm-Miscellaneous-fixes-for-64-bit-support/20200615-221856
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b3a9e3b9622ae10064826dccb4f7a52bd88c7407
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from include/linux/printk.h:404,
from include/linux/kernel.h:15,
from include/asm-generic/bug.h:19,
from arch/sparc/include/asm/bug.h:25,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from arch/sparc/include/asm/current.h:15,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/backlight.h:12,
from drivers/video/fbdev/ssd1307fb.c:8:
drivers/video/fbdev/ssd1307fb.c: In function 'ssd1307fb_init':
>> drivers/video/fbdev/ssd1307fb.c:315:30: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type 'unsigned int' [-Wformat=]
315 | dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
125 | func(&id, ##__VA_ARGS__); | ^~~~~~~~~~~
include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, | ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:2: note: in expansion of macro 'dynamic_dev_dbg'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:23: note: in expansion of macro 'dev_fmt'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/video/fbdev/ssd1307fb.c:315:3: note: in expansion of macro 'dev_dbg'
315 | dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.n",
| ^~~~~~~
drivers/video/fbdev/ssd1307fb.c:315:53: note: format string is defined here
315 | dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.n",
| ~~~^
| |
| long long unsigned int
| %u
vim +315 drivers/video/fbdev/ssd1307fb.c
294
295 static int ssd1307fb_init(struct ssd1307fb_par *par)
296 {
297 struct pwm_state pwmstate;
298 int ret;
299 u32 precharge, dclk, com_invdir, compins;
300
301 if (par->device_info->need_pwm) {
302 par->pwm = pwm_get(&par->client->dev, NULL);
303 if (IS_ERR(par->pwm)) {
304 dev_err(&par->client->dev, "Could not get PWM from device tree!\n");
305 return PTR_ERR(par->pwm);
306 }
307
308 pwm_init_state(par->pwm, &pwmstate);
309 pwm_set_relative_duty_cycle(&pwmstate, 50, 100);
310 pwm_apply_state(par->pwm, &pwmstate);
311
312 /* Enable the PWM */
313 pwm_enable(par->pwm);
314
> 315 dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.\n",
316 par->pwm->pwm, pwm_get_period(par->pwm));
317 }
318
319 /* Set initial contrast */
320 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CONTRAST);
321 if (ret < 0)
322 return ret;
323
324 ret = ssd1307fb_write_cmd(par->client, par->contrast);
325 if (ret < 0)
326 return ret;
327
328 /* Set segment re-map */
329 if (par->seg_remap) {
330 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SEG_REMAP_ON);
331 if (ret < 0)
332 return ret;
333 }
334
335 /* Set COM direction */
336 com_invdir = 0xc0 | par->com_invdir << 3;
337 ret = ssd1307fb_write_cmd(par->client, com_invdir);
338 if (ret < 0)
339 return ret;
340
341 /* Set multiplex ratio value */
342 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_MULTIPLEX_RATIO);
343 if (ret < 0)
344 return ret;
345
346 ret = ssd1307fb_write_cmd(par->client, par->height - 1);
347 if (ret < 0)
348 return ret;
349
350 /* set display offset value */
351 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_DISPLAY_OFFSET);
352 if (ret < 0)
353 return ret;
354
355 ret = ssd1307fb_write_cmd(par->client, par->com_offset);
356 if (ret < 0)
357 return ret;
358
359 /* Set clock frequency */
360 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_CLOCK_FREQ);
361 if (ret < 0)
362 return ret;
363
364 dclk = ((par->dclk_div - 1) & 0xf) | (par->dclk_frq & 0xf) << 4;
365 ret = ssd1307fb_write_cmd(par->client, dclk);
366 if (ret < 0)
367 return ret;
368
369 /* Set Set Area Color Mode ON/OFF & Low Power Display Mode */
370 if (par->area_color_enable || par->low_power) {
371 u32 mode;
372
373 ret = ssd1307fb_write_cmd(par->client,
374 SSD1307FB_SET_AREA_COLOR_MODE);
375 if (ret < 0)
376 return ret;
377
378 mode = (par->area_color_enable ? 0x30 : 0) |
379 (par->low_power ? 5 : 0);
380 ret = ssd1307fb_write_cmd(par->client, mode);
381 if (ret < 0)
382 return ret;
383 }
384
385 /* Set precharge period in number of ticks from the internal clock */
386 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_PRECHARGE_PERIOD);
387 if (ret < 0)
388 return ret;
389
390 precharge = (par->prechargep1 & 0xf) | (par->prechargep2 & 0xf) << 4;
391 ret = ssd1307fb_write_cmd(par->client, precharge);
392 if (ret < 0)
393 return ret;
394
395 /* Set COM pins configuration */
396 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_COM_PINS_CONFIG);
397 if (ret < 0)
398 return ret;
399
400 compins = 0x02 | !par->com_seq << 4 | par->com_lrremap << 5;
401 ret = ssd1307fb_write_cmd(par->client, compins);
402 if (ret < 0)
403 return ret;
404
405 /* Set VCOMH */
406 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_VCOMH);
407 if (ret < 0)
408 return ret;
409
410 ret = ssd1307fb_write_cmd(par->client, par->vcomh);
411 if (ret < 0)
412 return ret;
413
414 /* Turn on the DC-DC Charge Pump */
415 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CHARGE_PUMP);
416 if (ret < 0)
417 return ret;
418
419 ret = ssd1307fb_write_cmd(par->client,
420 BIT(4) | (par->device_info->need_chargepump ? BIT(2) : 0));
421 if (ret < 0)
422 return ret;
423
424 /* Set lookup table */
425 if (par->lookup_table_set) {
426 int i;
427
428 ret = ssd1307fb_write_cmd(par->client,
429 SSD1307FB_SET_LOOKUP_TABLE);
430 if (ret < 0)
431 return ret;
432
433 for (i = 0; i < ARRAY_SIZE(par->lookup_table); ++i) {
434 u8 val = par->lookup_table[i];
435
436 if (val < 31 || val > 63)
437 dev_warn(&par->client->dev,
438 "lookup table index %d value out of range 31 <= %d <= 63\n",
439 i, val);
440 ret = ssd1307fb_write_cmd(par->client, val);
441 if (ret < 0)
442 return ret;
443 }
444 }
445
446 /* Switch to horizontal addressing mode */
447 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_ADDRESS_MODE);
448 if (ret < 0)
449 return ret;
450
451 ret = ssd1307fb_write_cmd(par->client,
452 SSD1307FB_SET_ADDRESS_MODE_HORIZONTAL);
453 if (ret < 0)
454 return ret;
455
456 /* Set column range */
457 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_COL_RANGE);
458 if (ret < 0)
459 return ret;
460
461 ret = ssd1307fb_write_cmd(par->client, 0x0);
462 if (ret < 0)
463 return ret;
464
465 ret = ssd1307fb_write_cmd(par->client, par->width - 1);
466 if (ret < 0)
467 return ret;
468
469 /* Set page range */
470 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_PAGE_RANGE);
471 if (ret < 0)
472 return ret;
473
474 ret = ssd1307fb_write_cmd(par->client, par->page_offset);
475 if (ret < 0)
476 return ret;
477
478 ret = ssd1307fb_write_cmd(par->client,
479 par->page_offset +
480 DIV_ROUND_UP(par->height, 8) - 1);
481 if (ret < 0)
482 return ret;
483
484 /* Clear the screen */
485 ssd1307fb_update_display(par);
486
487 /* Turn on the display */
488 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
489 if (ret < 0)
490 return ret;
491
492 return 0;
493 }
494
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 65622 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier
2020-06-15 14:16 ` [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier Thierry Reding
2020-06-15 15:18 ` Uwe Kleine-König
2020-06-15 17:19 ` kernel test robot
@ 2020-06-15 17:25 ` kernel test robot
2020-06-17 7:18 ` Geert Uytterhoeven
3 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2020-06-15 17:25 UTC (permalink / raw)
To: Thierry Reding
Cc: kbuild-all, Bartlomiej Zolnierkiewicz, Uwe Kleine-König,
Lee Jones, Guru Das Srinagesh, linux-pwm, linux-fbdev,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 9774 bytes --]
Hi Thierry,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.8-rc1 next-20200615]
[cannot apply to pwm/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Thierry-Reding/pwm-Miscellaneous-fixes-for-64-bit-support/20200615-221856
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b3a9e3b9622ae10064826dccb4f7a52bd88c7407
config: h8300-randconfig-r004-20200615 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from include/linux/printk.h:404,
from include/linux/kernel.h:15,
from include/asm-generic/bug.h:19,
from arch/h8300/include/asm/bug.h:8,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/current.h:5,
from ./arch/h8300/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/backlight.h:12,
from drivers/video/fbdev/ssd1307fb.c:8:
drivers/video/fbdev/ssd1307fb.c: In function 'ssd1307fb_init':
>> drivers/video/fbdev/ssd1307fb.c:315:30: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type 'unsigned int' [-Wformat=]
315 | dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
125 | func(&id, ##__VA_ARGS__); | ^~~~~~~~~~~
include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, | ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:2: note: in expansion of macro 'dynamic_dev_dbg'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:115:23: note: in expansion of macro 'dev_fmt'
115 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/video/fbdev/ssd1307fb.c:315:3: note: in expansion of macro 'dev_dbg'
315 | dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.n",
| ^~~~~~~
drivers/video/fbdev/ssd1307fb.c:315:53: note: format string is defined here
315 | dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.n",
| ~~~^
| |
| long long unsigned int
| %u
vim +315 drivers/video/fbdev/ssd1307fb.c
294
295 static int ssd1307fb_init(struct ssd1307fb_par *par)
296 {
297 struct pwm_state pwmstate;
298 int ret;
299 u32 precharge, dclk, com_invdir, compins;
300
301 if (par->device_info->need_pwm) {
302 par->pwm = pwm_get(&par->client->dev, NULL);
303 if (IS_ERR(par->pwm)) {
304 dev_err(&par->client->dev, "Could not get PWM from device tree!\n");
305 return PTR_ERR(par->pwm);
306 }
307
308 pwm_init_state(par->pwm, &pwmstate);
309 pwm_set_relative_duty_cycle(&pwmstate, 50, 100);
310 pwm_apply_state(par->pwm, &pwmstate);
311
312 /* Enable the PWM */
313 pwm_enable(par->pwm);
314
> 315 dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.\n",
316 par->pwm->pwm, pwm_get_period(par->pwm));
317 }
318
319 /* Set initial contrast */
320 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CONTRAST);
321 if (ret < 0)
322 return ret;
323
324 ret = ssd1307fb_write_cmd(par->client, par->contrast);
325 if (ret < 0)
326 return ret;
327
328 /* Set segment re-map */
329 if (par->seg_remap) {
330 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SEG_REMAP_ON);
331 if (ret < 0)
332 return ret;
333 }
334
335 /* Set COM direction */
336 com_invdir = 0xc0 | par->com_invdir << 3;
337 ret = ssd1307fb_write_cmd(par->client, com_invdir);
338 if (ret < 0)
339 return ret;
340
341 /* Set multiplex ratio value */
342 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_MULTIPLEX_RATIO);
343 if (ret < 0)
344 return ret;
345
346 ret = ssd1307fb_write_cmd(par->client, par->height - 1);
347 if (ret < 0)
348 return ret;
349
350 /* set display offset value */
351 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_DISPLAY_OFFSET);
352 if (ret < 0)
353 return ret;
354
355 ret = ssd1307fb_write_cmd(par->client, par->com_offset);
356 if (ret < 0)
357 return ret;
358
359 /* Set clock frequency */
360 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_CLOCK_FREQ);
361 if (ret < 0)
362 return ret;
363
364 dclk = ((par->dclk_div - 1) & 0xf) | (par->dclk_frq & 0xf) << 4;
365 ret = ssd1307fb_write_cmd(par->client, dclk);
366 if (ret < 0)
367 return ret;
368
369 /* Set Set Area Color Mode ON/OFF & Low Power Display Mode */
370 if (par->area_color_enable || par->low_power) {
371 u32 mode;
372
373 ret = ssd1307fb_write_cmd(par->client,
374 SSD1307FB_SET_AREA_COLOR_MODE);
375 if (ret < 0)
376 return ret;
377
378 mode = (par->area_color_enable ? 0x30 : 0) |
379 (par->low_power ? 5 : 0);
380 ret = ssd1307fb_write_cmd(par->client, mode);
381 if (ret < 0)
382 return ret;
383 }
384
385 /* Set precharge period in number of ticks from the internal clock */
386 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_PRECHARGE_PERIOD);
387 if (ret < 0)
388 return ret;
389
390 precharge = (par->prechargep1 & 0xf) | (par->prechargep2 & 0xf) << 4;
391 ret = ssd1307fb_write_cmd(par->client, precharge);
392 if (ret < 0)
393 return ret;
394
395 /* Set COM pins configuration */
396 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_COM_PINS_CONFIG);
397 if (ret < 0)
398 return ret;
399
400 compins = 0x02 | !par->com_seq << 4 | par->com_lrremap << 5;
401 ret = ssd1307fb_write_cmd(par->client, compins);
402 if (ret < 0)
403 return ret;
404
405 /* Set VCOMH */
406 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_VCOMH);
407 if (ret < 0)
408 return ret;
409
410 ret = ssd1307fb_write_cmd(par->client, par->vcomh);
411 if (ret < 0)
412 return ret;
413
414 /* Turn on the DC-DC Charge Pump */
415 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CHARGE_PUMP);
416 if (ret < 0)
417 return ret;
418
419 ret = ssd1307fb_write_cmd(par->client,
420 BIT(4) | (par->device_info->need_chargepump ? BIT(2) : 0));
421 if (ret < 0)
422 return ret;
423
424 /* Set lookup table */
425 if (par->lookup_table_set) {
426 int i;
427
428 ret = ssd1307fb_write_cmd(par->client,
429 SSD1307FB_SET_LOOKUP_TABLE);
430 if (ret < 0)
431 return ret;
432
433 for (i = 0; i < ARRAY_SIZE(par->lookup_table); ++i) {
434 u8 val = par->lookup_table[i];
435
436 if (val < 31 || val > 63)
437 dev_warn(&par->client->dev,
438 "lookup table index %d value out of range 31 <= %d <= 63\n",
439 i, val);
440 ret = ssd1307fb_write_cmd(par->client, val);
441 if (ret < 0)
442 return ret;
443 }
444 }
445
446 /* Switch to horizontal addressing mode */
447 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_ADDRESS_MODE);
448 if (ret < 0)
449 return ret;
450
451 ret = ssd1307fb_write_cmd(par->client,
452 SSD1307FB_SET_ADDRESS_MODE_HORIZONTAL);
453 if (ret < 0)
454 return ret;
455
456 /* Set column range */
457 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_COL_RANGE);
458 if (ret < 0)
459 return ret;
460
461 ret = ssd1307fb_write_cmd(par->client, 0x0);
462 if (ret < 0)
463 return ret;
464
465 ret = ssd1307fb_write_cmd(par->client, par->width - 1);
466 if (ret < 0)
467 return ret;
468
469 /* Set page range */
470 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_PAGE_RANGE);
471 if (ret < 0)
472 return ret;
473
474 ret = ssd1307fb_write_cmd(par->client, par->page_offset);
475 if (ret < 0)
476 return ret;
477
478 ret = ssd1307fb_write_cmd(par->client,
479 par->page_offset +
480 DIV_ROUND_UP(par->height, 8) - 1);
481 if (ret < 0)
482 return ret;
483
484 /* Clear the screen */
485 ssd1307fb_update_display(par);
486
487 /* Turn on the display */
488 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
489 if (ret < 0)
490 return ret;
491
492 return 0;
493 }
494
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20850 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] pwm: iqs620a: Use 64-bit division
2020-06-15 14:16 ` [PATCH 2/2] pwm: iqs620a: Use 64-bit division Thierry Reding
2020-06-15 15:16 ` Uwe Kleine-König
@ 2020-06-16 7:06 ` Lee Jones
1 sibling, 0 replies; 12+ messages in thread
From: Lee Jones @ 2020-06-16 7:06 UTC (permalink / raw)
To: Thierry Reding
Cc: Bartlomiej Zolnierkiewicz, Uwe Kleine-König,
Guru Das Srinagesh, linux-pwm, linux-fbdev, linux-kernel
On Mon, 15 Jun 2020, Thierry Reding wrote:
> The PWM framework is going to change the PWM period and duty cycles to
> be 64-bit unsigned integers. To avoid build errors on platforms that do
> not natively support 64-bit division, use explicity 64-bit division.
>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
> drivers/pwm/pwm-iqs620a.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Acked-by: Lee Jones <lee.jones@linaro.org>
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier
2020-06-15 14:16 ` [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier Thierry Reding
` (2 preceding siblings ...)
2020-06-15 17:25 ` kernel test robot
@ 2020-06-17 7:18 ` Geert Uytterhoeven
2020-06-17 17:30 ` Uwe Kleine-König
2020-06-18 20:05 ` Guru Das Srinagesh
3 siblings, 2 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2020-06-17 7:18 UTC (permalink / raw)
To: Thierry Reding
Cc: Bartlomiej Zolnierkiewicz, Uwe Kleine-König, Lee Jones,
Guru Das Srinagesh, Linux PWM List, Linux Fbdev development list,
Linux Kernel Mailing List
Hi Thierry,
On Mon, Jun 15, 2020 at 4:17 PM Thierry Reding <thierry.reding@gmail.com> wrote:
> The PWM core will soon change the duty cycle and period of PWMs to 64
> bits to allow for a broader range of values. Use a 64-bit format
> specifier to avoid a warning when that change is made.
>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> --- a/drivers/video/fbdev/ssd1307fb.c
> +++ b/drivers/video/fbdev/ssd1307fb.c
> @@ -312,7 +312,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
> /* Enable the PWM */
> pwm_enable(par->pwm);
>
> - dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n",
> + dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.\n",
> par->pwm->pwm, pwm_get_period(par->pwm));
> }
This change must be done together with changing the return type of
pwm_get_period(), else you will get a compiler warning, and will print a
bogus value.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier
2020-06-17 7:18 ` Geert Uytterhoeven
@ 2020-06-17 17:30 ` Uwe Kleine-König
2020-06-18 20:05 ` Guru Das Srinagesh
1 sibling, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2020-06-17 17:30 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Thierry Reding, Bartlomiej Zolnierkiewicz, Lee Jones,
Guru Das Srinagesh, Linux PWM List, Linux Fbdev development list,
Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 1449 bytes --]
On Wed, Jun 17, 2020 at 09:18:34AM +0200, Geert Uytterhoeven wrote:
> Hi Thierry,
>
> On Mon, Jun 15, 2020 at 4:17 PM Thierry Reding <thierry.reding@gmail.com> wrote:
> > The PWM core will soon change the duty cycle and period of PWMs to 64
> > bits to allow for a broader range of values. Use a 64-bit format
> > specifier to avoid a warning when that change is made.
> >
> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
>
> > --- a/drivers/video/fbdev/ssd1307fb.c
> > +++ b/drivers/video/fbdev/ssd1307fb.c
> > @@ -312,7 +312,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
> > /* Enable the PWM */
> > pwm_enable(par->pwm);
> >
> > - dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n",
> > + dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.\n",
> > par->pwm->pwm, pwm_get_period(par->pwm));
> > }
>
> This change must be done together with changing the return type of
> pwm_get_period(), else you will get a compiler warning, and will print a
> bogus value.
Right, or we must change to passing (unsigned long
long)pwm_get_period(par->pwm), then change the prototype and then drop
the cast again.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier
2020-06-17 7:18 ` Geert Uytterhoeven
2020-06-17 17:30 ` Uwe Kleine-König
@ 2020-06-18 20:05 ` Guru Das Srinagesh
2020-06-19 6:46 ` Geert Uytterhoeven
1 sibling, 1 reply; 12+ messages in thread
From: Guru Das Srinagesh @ 2020-06-18 20:05 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Thierry Reding, Bartlomiej Zolnierkiewicz, Uwe Kleine-König,
Lee Jones, Linux PWM List, Linux Fbdev development list,
Linux Kernel Mailing List
On Wed, Jun 17, 2020 at 09:18:34AM +0200, Geert Uytterhoeven wrote:
> Hi Thierry,
>
> On Mon, Jun 15, 2020 at 4:17 PM Thierry Reding <thierry.reding@gmail.com> wrote:
> > The PWM core will soon change the duty cycle and period of PWMs to 64
> > bits to allow for a broader range of values. Use a 64-bit format
> > specifier to avoid a warning when that change is made.
> >
> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
>
> > --- a/drivers/video/fbdev/ssd1307fb.c
> > +++ b/drivers/video/fbdev/ssd1307fb.c
> > @@ -312,7 +312,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
> > /* Enable the PWM */
> > pwm_enable(par->pwm);
> >
> > - dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n",
> > + dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.\n",
> > par->pwm->pwm, pwm_get_period(par->pwm));
> > }
>
> This change must be done together with changing the return type of
> pwm_get_period(), else you will get a compiler warning, and will print a
> bogus value.
Hi Geert,
Yes, this is already being done in the patch series [1] that forms the
base for this specific patch.
[1] https://lore.kernel.org/lkml/64f9ba1c9d6c49a397f12846493707883cee430f.1591136989.git.gurus@codeaurora.org/
Thank you.
Guru Das.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier
2020-06-18 20:05 ` Guru Das Srinagesh
@ 2020-06-19 6:46 ` Geert Uytterhoeven
0 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2020-06-19 6:46 UTC (permalink / raw)
To: Guru Das Srinagesh
Cc: Thierry Reding, Bartlomiej Zolnierkiewicz, Uwe Kleine-König,
Lee Jones, Linux PWM List, Linux Fbdev development list,
Linux Kernel Mailing List
Hi Guru,
On Thu, Jun 18, 2020 at 10:05 PM Guru Das Srinagesh
<gurus@codeaurora.org> wrote:
> On Wed, Jun 17, 2020 at 09:18:34AM +0200, Geert Uytterhoeven wrote:
> > On Mon, Jun 15, 2020 at 4:17 PM Thierry Reding <thierry.reding@gmail.com> wrote:
> > > The PWM core will soon change the duty cycle and period of PWMs to 64
> > > bits to allow for a broader range of values. Use a 64-bit format
> > > specifier to avoid a warning when that change is made.
> > >
> > > Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> >
> > > --- a/drivers/video/fbdev/ssd1307fb.c
> > > +++ b/drivers/video/fbdev/ssd1307fb.c
> > > @@ -312,7 +312,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
> > > /* Enable the PWM */
> > > pwm_enable(par->pwm);
> > >
> > > - dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n",
> > > + dev_dbg(&par->client->dev, "Using PWM%d with a %lluns period.\n",
> > > par->pwm->pwm, pwm_get_period(par->pwm));
> > > }
> >
> > This change must be done together with changing the return type of
> > pwm_get_period(), else you will get a compiler warning, and will print a
> > bogus value.
>
> Hi Geert,
>
> Yes, this is already being done in the patch series [1] that forms the
> base for this specific patch.
>
> [1] https://lore.kernel.org/lkml/64f9ba1c9d6c49a397f12846493707883cee430f.1591136989.git.gurus@codeaurora.org/
IC, but the "will soon" suggested otherwise.
In any case, not combining both into a single patch causes a bisection
regression, regardless of the order in which they are applied.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-06-19 6:47 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 14:16 [PATCH 0/2] pwm: Miscellaneous fixes for 64-bit support Thierry Reding
2020-06-15 14:16 ` [PATCH 1/2] video: ssd1307fb: Print PWM period using 64-bit format specifier Thierry Reding
2020-06-15 15:18 ` Uwe Kleine-König
2020-06-15 17:19 ` kernel test robot
2020-06-15 17:25 ` kernel test robot
2020-06-17 7:18 ` Geert Uytterhoeven
2020-06-17 17:30 ` Uwe Kleine-König
2020-06-18 20:05 ` Guru Das Srinagesh
2020-06-19 6:46 ` Geert Uytterhoeven
2020-06-15 14:16 ` [PATCH 2/2] pwm: iqs620a: Use 64-bit division Thierry Reding
2020-06-15 15:16 ` Uwe Kleine-König
2020-06-16 7:06 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).