* [PATCH 0/3] staging: sm750fb: Clean up helpers and fix DAC power-off handling
@ 2026-11-14 10:02 Ali Köse
2026-11-14 10:02 ` [PATCH 1/3] staging: sm750fb: Replace set_DAC macro with a static function Ali Köse
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ali Köse @ 2026-11-14 10:02 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang
Cc: gregkh, rppt, linux-fbdev, linux-staging, linux-kernel
This series replaces the set_DAC macro with a local static function,
corrects the DAC power-off bit handling, and removes an empty software
I2C acknowledgement helper and its ineffective parameter.
The first and third patches preserve existing behavior. The second
patch maps the extracted 0/1 DAC state to bit 20 rather than OR-ing it
into bit 0 of MISC_CTRL.
Based on staging-next at 6628e7d4c6b (Linux 7.4-rc1).
Validation:
- All SM750 driver objects compiled and linked into sm750fb.o with W=1,
CONFIG_FB=y, CONFIG_STAGING=y, and CONFIG_FB_SM750=m.
- A standalone mocked-register test checked 72 DAC state and register
preservation cases: 36 failed before the fix and none failed afterward.
- checkpatch.pl reported no errors or warnings.
- git diff --check passed.
Hardware testing was not performed.
Ali Köse (3):
staging: sm750fb: Replace set_DAC macro with a static function
staging: sm750fb: Fix DAC power-off bit handling
staging: sm750fb: Remove empty software I2C acknowledgement helper
drivers/staging/sm750fb/ddk750_display.c | 9 ++++++++-
drivers/staging/sm750fb/ddk750_power.h | 5 -----
drivers/staging/sm750fb/ddk750_swi2c.c | 19 ++-----------------
3 files changed, 10 insertions(+), 23 deletions(-)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] staging: sm750fb: Replace set_DAC macro with a static function
2026-11-14 10:02 [PATCH 0/3] staging: sm750fb: Clean up helpers and fix DAC power-off handling Ali Köse
@ 2026-11-14 10:02 ` Ali Köse
2026-11-14 10:02 ` [PATCH 2/3] staging: sm750fb: Fix DAC power-off bit handling Ali Köse
2026-11-14 10:02 ` [PATCH 3/3] staging: sm750fb: Remove empty software I2C acknowledgement helper Ali Köse
2 siblings, 0 replies; 4+ messages in thread
From: Ali Köse @ 2026-11-14 10:02 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang
Cc: gregkh, rppt, linux-fbdev, linux-staging, linux-kernel
Replace the set_DAC macro with a static function named set_dac().
The helper has only one caller, so keep it local to ddk750_display.c
and remove the macro from ddk750_power.h.
This provides parameter type checking and follows kernel naming
conventions without changing the register operation.
Signed-off-by: Ali Köse <shroot1337@gmail.com>
---
drivers/staging/sm750fb/ddk750_display.c | 8 +++++++-
drivers/staging/sm750fb/ddk750_power.h | 5 -----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c
index 4e390541a507..d619e00fd88e 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -4,6 +4,12 @@
#include "ddk750_display.h"
#include "ddk750_power.h"
+static void set_dac(unsigned int off)
+{
+ poke32(MISC_CTRL,
+ (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | off);
+}
+
static void set_display_control(int ctrl, int disp_state)
{
/* state != 0 means turn on both timing & plane en_bit */
@@ -151,7 +157,7 @@ void ddk750_set_logical_disp_out(enum disp_output output)
}
if (output & DAC_USAGE)
- set_DAC((output & DAC_MASK) >> DAC_OFFSET);
+ set_dac((output & DAC_MASK) >> DAC_OFFSET);
if (output & DPMS_USAGE)
ddk750_set_dpms((output & DPMS_MASK) >> DPMS_OFFSET);
diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h
index 0c4ab2120385..61f8608e59de 100644
--- a/drivers/staging/sm750fb/ddk750_power.h
+++ b/drivers/staging/sm750fb/ddk750_power.h
@@ -9,11 +9,6 @@ enum dpms {
CRT_DPMS_OFF = 0x3,
};
-#define set_DAC(off) { \
- poke32(MISC_CTRL, \
- (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | (off)); \
-}
-
void ddk750_set_dpms(enum dpms state);
void sm750_set_power_mode(unsigned int mode);
void sm750_set_current_gate(unsigned int gate);
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] staging: sm750fb: Fix DAC power-off bit handling
2026-11-14 10:02 [PATCH 0/3] staging: sm750fb: Clean up helpers and fix DAC power-off handling Ali Köse
2026-11-14 10:02 ` [PATCH 1/3] staging: sm750fb: Replace set_DAC macro with a static function Ali Köse
@ 2026-11-14 10:02 ` Ali Köse
2026-11-14 10:02 ` [PATCH 3/3] staging: sm750fb: Remove empty software I2C acknowledgement helper Ali Köse
2 siblings, 0 replies; 4+ messages in thread
From: Ali Köse @ 2026-11-14 10:02 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang
Cc: gregkh, rppt, linux-fbdev, linux-staging, linux-kernel
The DAC state extracted by ddk750_set_logical_disp_out() is either
0 or 1, but MISC_CTRL_DAC_POWER_OFF occupies bit 20. OR-ing the
extracted value directly into MISC_CTRL therefore clears the DAC
power-off bit and, when off is requested, sets bit 0 instead.
Translate the state into MISC_CTRL_DAC_POWER_OFF before updating
the register, preserving unrelated bits.
Fixes: 5372350be30a ("staging: sm750fb: use BIT macro for MISC_CTRL single-bit fields")
Signed-off-by: Ali Köse <shroot1337@gmail.com>
---
drivers/staging/sm750fb/ddk750_display.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/sm750fb/ddk750_display.c b/drivers/staging/sm750fb/ddk750_display.c
index d619e00fd88e..dbbdbe08ad38 100644
--- a/drivers/staging/sm750fb/ddk750_display.c
+++ b/drivers/staging/sm750fb/ddk750_display.c
@@ -7,7 +7,8 @@
static void set_dac(unsigned int off)
{
poke32(MISC_CTRL,
- (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | off);
+ (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) |
+ (off ? MISC_CTRL_DAC_POWER_OFF : 0));
}
static void set_display_control(int ctrl, int disp_state)
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] staging: sm750fb: Remove empty software I2C acknowledgement helper
2026-11-14 10:02 [PATCH 0/3] staging: sm750fb: Clean up helpers and fix DAC power-off handling Ali Köse
2026-11-14 10:02 ` [PATCH 1/3] staging: sm750fb: Replace set_DAC macro with a static function Ali Köse
2026-11-14 10:02 ` [PATCH 2/3] staging: sm750fb: Fix DAC power-off bit handling Ali Köse
@ 2026-11-14 10:02 ` Ali Köse
2 siblings, 0 replies; 4+ messages in thread
From: Ali Köse @ 2026-11-14 10:02 UTC (permalink / raw)
To: sudipm.mukherjee, teddy.wang
Cc: gregkh, rppt, linux-fbdev, linux-staging, linux-kernel
sw_i2c_ack() contains only a return statement, so calling it has
no effect. Remove the empty helper and the ack parameter from
sw_i2c_read_byte(), along with the parameter documentation.
Update the only caller to use the parameterless helper. The GPIO
operations and existing I2C bus behavior remain unchanged.
Signed-off-by: Ali Köse <shroot1337@gmail.com>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index e63f3b00ec4c..54ce355e535f 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -201,14 +201,6 @@ static unsigned char sw_i2c_read_sda(void)
return 0;
}
-/*
- * This function sends ACK signal
- */
-static void sw_i2c_ack(void)
-{
- return; /* Single byte read is ok without it. */
-}
-
/*
* This function sends the start command to the slave device
*/
@@ -300,14 +292,10 @@ static long sw_i2c_write_byte(unsigned char data)
/*
* This function reads one byte from the slave device
*
- * Parameters:
- * ack - Flag to indicate either to send the acknowledge
- * message to the slave device or not
- *
* Return Value:
* One byte data read from the Slave device
*/
-static unsigned char sw_i2c_read_byte(unsigned char ack)
+static unsigned char sw_i2c_read_byte(void)
{
int i;
unsigned char data = 0;
@@ -326,9 +314,6 @@ static unsigned char sw_i2c_read_byte(unsigned char ack)
data |= (sw_i2c_read_sda() << i);
}
- if (ack)
- sw_i2c_ack();
-
/* Set the SCL Low and SDA High */
sw_i2c_scl(0);
sw_i2c_sda(1);
@@ -458,7 +443,7 @@ unsigned char sm750_sw_i2c_read_reg(unsigned char addr, unsigned char reg)
/* Get the bus again and get the data from the device read address */
sw_i2c_start();
sw_i2c_write_byte(addr + 1);
- data = sw_i2c_read_byte(1);
+ data = sw_i2c_read_byte();
/* Stop swI2C and release the bus */
sw_i2c_stop();
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-14 10:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-14 10:02 [PATCH 0/3] staging: sm750fb: Clean up helpers and fix DAC power-off handling Ali Köse
2026-11-14 10:02 ` [PATCH 1/3] staging: sm750fb: Replace set_DAC macro with a static function Ali Köse
2026-11-14 10:02 ` [PATCH 2/3] staging: sm750fb: Fix DAC power-off bit handling Ali Köse
2026-11-14 10:02 ` [PATCH 3/3] staging: sm750fb: Remove empty software I2C acknowledgement helper Ali Köse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®