Commit 77845293 authored by Imre Deak's avatar Imre Deak Committed by Juha Yrjola

CBUS: Retu: add atomic set and clear register bits function

Signed-off-by: default avatarImre Deak <imre.deak@solidboot.com>
Signed-off-by: default avatarJuha Yrjola <juha.yrjola@solidboot.com>
parent d2db44bd
...@@ -91,6 +91,19 @@ void retu_write_reg(int reg, u16 val) ...@@ -91,6 +91,19 @@ void retu_write_reg(int reg, u16 val)
cbus_write_reg(cbus_host, RETU_ID, reg, val); cbus_write_reg(cbus_host, RETU_ID, reg, val);
} }
void retu_set_clear_reg_bits(int reg, u16 set, u16 clear)
{
unsigned long flags;
u16 w;
spin_lock_irqsave(&retu_lock, flags);
w = retu_read_reg(reg);
w &= ~clear;
w |= set;
retu_write_reg(reg, w);
spin_unlock_irqrestore(&retu_lock, flags);
}
#define ADC_MAX_CHAN_NUMBER 13 #define ADC_MAX_CHAN_NUMBER 13
int retu_read_adc(int channel) int retu_read_adc(int channel)
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
int retu_read_reg(int reg); int retu_read_reg(int reg);
void retu_write_reg(int reg, u16 val); void retu_write_reg(int reg, u16 val);
void retu_set_clear_reg_bits(int reg, u16 set, u16 clear);
int retu_read_adc(int channel); int retu_read_adc(int channel);
int retu_request_irq(int id, void *irq_handler, unsigned long arg, char *name); int retu_request_irq(int id, void *irq_handler, unsigned long arg, char *name);
void retu_free_irq(int id); void retu_free_irq(int id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment