diff options
Diffstat (limited to 'drivers/media/rc/ir-spi.c')
-rw-r--r-- | drivers/media/rc/ir-spi.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/media/rc/ir-spi.c b/drivers/media/rc/ir-spi.c index a32a84ae2d0b..7163d5ce2e64 100644 --- a/drivers/media/rc/ir-spi.c +++ b/drivers/media/rc/ir-spi.c | |||
@@ -15,21 +15,11 @@ | |||
15 | 15 | ||
16 | #define IR_SPI_DRIVER_NAME "ir-spi" | 16 | #define IR_SPI_DRIVER_NAME "ir-spi" |
17 | 17 | ||
18 | /* pulse value for different duty cycles */ | ||
19 | #define IR_SPI_PULSE_DC_50 0xff00 | ||
20 | #define IR_SPI_PULSE_DC_60 0xfc00 | ||
21 | #define IR_SPI_PULSE_DC_70 0xf800 | ||
22 | #define IR_SPI_PULSE_DC_75 0xf000 | ||
23 | #define IR_SPI_PULSE_DC_80 0xc000 | ||
24 | #define IR_SPI_PULSE_DC_90 0x8000 | ||
25 | |||
26 | #define IR_SPI_DEFAULT_FREQUENCY 38000 | 18 | #define IR_SPI_DEFAULT_FREQUENCY 38000 |
27 | #define IR_SPI_BIT_PER_WORD 8 | ||
28 | #define IR_SPI_MAX_BUFSIZE 4096 | 19 | #define IR_SPI_MAX_BUFSIZE 4096 |
29 | 20 | ||
30 | struct ir_spi_data { | 21 | struct ir_spi_data { |
31 | u32 freq; | 22 | u32 freq; |
32 | u8 duty_cycle; | ||
33 | bool negated; | 23 | bool negated; |
34 | 24 | ||
35 | u16 tx_buf[IR_SPI_MAX_BUFSIZE]; | 25 | u16 tx_buf[IR_SPI_MAX_BUFSIZE]; |
@@ -105,19 +95,9 @@ static int ir_spi_set_tx_carrier(struct rc_dev *dev, u32 carrier) | |||
105 | static int ir_spi_set_duty_cycle(struct rc_dev *dev, u32 duty_cycle) | 95 | static int ir_spi_set_duty_cycle(struct rc_dev *dev, u32 duty_cycle) |
106 | { | 96 | { |
107 | struct ir_spi_data *idata = dev->priv; | 97 | struct ir_spi_data *idata = dev->priv; |
98 | int bits = (duty_cycle * 15) / 100; | ||
108 | 99 | ||
109 | if (duty_cycle >= 90) | 100 | idata->pulse = GENMASK(bits, 0); |
110 | idata->pulse = IR_SPI_PULSE_DC_90; | ||
111 | else if (duty_cycle >= 80) | ||
112 | idata->pulse = IR_SPI_PULSE_DC_80; | ||
113 | else if (duty_cycle >= 75) | ||
114 | idata->pulse = IR_SPI_PULSE_DC_75; | ||
115 | else if (duty_cycle >= 70) | ||
116 | idata->pulse = IR_SPI_PULSE_DC_70; | ||
117 | else if (duty_cycle >= 60) | ||
118 | idata->pulse = IR_SPI_PULSE_DC_60; | ||
119 | else | ||
120 | idata->pulse = IR_SPI_PULSE_DC_50; | ||
121 | 101 | ||
122 | if (idata->negated) { | 102 | if (idata->negated) { |
123 | idata->pulse = ~idata->pulse; | 103 | idata->pulse = ~idata->pulse; |