Skip to content

Commit 6868e35

Browse files
rpardiniclaude
andcommitted
auxdisplay: vk2c21: drive brightness in SEG mode, not VLCD-output mode
Writing IVASET in VLCD-output mode (0x10..0x1F) has no visible effect on the R58X-Pro: the board ties the VLCD pin to VDD through an external resistor, so the chip's internal driver is overpowered by the external circuit and the bias voltage stays where the resistor sets it. Move the IVA-on range to 0x30..0x3F (SEG mode). In that mode the chip ignores the VLCD pin entirely and generates the bias voltage internally, so the 16 brightness levels actually take effect. Signed-off-by: Ricardo Pardini <ricardo@pardini.net> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0744008 commit 6868e35

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

drivers/auxdisplay/lcd-vk2c21.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,18 @@
4444
#define VK2C21_IVA_DEFAULT 0x0F /* VLCD selected, IVA off, R1 (external VR) */
4545

4646
/*
47-
* IVA on, VLCD-output mode: 16 internal bias-voltage levels.
48-
* 0x10 = level 0 = 1.000 x VDD (highest contrast / "brightest")
49-
* 0x1F = level 15 = 0.529 x VDD (lowest contrast / "dimmest")
47+
* IVA on, SEG mode: 16 internal bias-voltage levels.
48+
* 0x30 = level 0 = 1.000 x VDD (highest contrast / "brightest")
49+
* 0x3F = level 15 = 0.529 x VDD (lowest contrast / "dimmest")
50+
* SEG mode (vs. VLCD-output mode at 0x10..0x1F) is used because the R58X-Pro
51+
* has an external resistor on the VLCD pin: in VLCD-output mode the external
52+
* resistor dominates the chip's internal driver and the brightness register
53+
* has no visible effect. SEG mode tells the chip to ignore the VLCD pin and
54+
* generate the bias voltage purely internally.
5055
* Userspace brightness is inverted (0 = dimmest, 15 = brightest) so that
5156
* higher numbers look brighter, matching the usual convention.
5257
*/
53-
#define VK2C21_IVA_VLCD_ON_BASE 0x10
58+
#define VK2C21_IVA_ON_BASE 0x30
5459
#define VK2C21_BRIGHTNESS_MAX 15
5560
#define VK2C21_BRIGHTNESS_DEFAULT (-1) /* IVA off, external VR in use */
5661

@@ -453,8 +458,8 @@ static ssize_t brightness_store(struct device *dev,
453458
return ret;
454459
if (level < 0 || level > VK2C21_BRIGHTNESS_MAX)
455460
return -EINVAL;
456-
/* Invert: userspace 15 = brightest = IVA level 0 = 0x10 */
457-
iva = VK2C21_IVA_VLCD_ON_BASE + (VK2C21_BRIGHTNESS_MAX - level);
461+
/* Invert: userspace 15 = brightest = IVA level 0 = 0x30 */
462+
iva = VK2C21_IVA_ON_BASE + (VK2C21_BRIGHTNESS_MAX - level);
458463
}
459464

460465
mutex_lock(&d->lock);

0 commit comments

Comments
 (0)