diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2017-10-31 09:55:09 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-03-22 08:00:27 -0400 |
commit | 0ee492ad54d779e901133fcf381389e6d1067db6 (patch) | |
tree | e2ced7a40adcb03aad14e5a4f821fc9a108d6912 | |
parent | 6902c88a4635360a4e0edfb1800bfa938b9119c4 (diff) | |
download | linux-stable-0ee492ad54d779e901133fcf381389e6d1067db6.tar.gz linux-stable-0ee492ad54d779e901133fcf381389e6d1067db6.tar.bz2 linux-stable-0ee492ad54d779e901133fcf381389e6d1067db6.zip |
media: cec-pin: create cec_pin_start_timer() function
This function will be needed for injecting a custom pulse.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/cec/cec-pin-priv.h | 2 | ||||
-rw-r--r-- | drivers/media/cec/cec-pin.c | 21 |
2 files changed, 15 insertions, 8 deletions
diff --git a/drivers/media/cec/cec-pin-priv.h b/drivers/media/cec/cec-pin-priv.h index cf41c4236efd..4571a0001a9d 100644 --- a/drivers/media/cec/cec-pin-priv.h +++ b/drivers/media/cec/cec-pin-priv.h @@ -118,4 +118,6 @@ struct cec_pin { u32 timer_sum_overrun; }; +void cec_pin_start_timer(struct cec_pin *pin); + #endif diff --git a/drivers/media/cec/cec-pin.c b/drivers/media/cec/cec-pin.c index 8e834b9f72c6..67d6ea9f56b6 100644 --- a/drivers/media/cec/cec-pin.c +++ b/drivers/media/cec/cec-pin.c @@ -680,6 +680,18 @@ static int cec_pin_adap_log_addr(struct cec_adapter *adap, u8 log_addr) return 0; } +void cec_pin_start_timer(struct cec_pin *pin) +{ + if (pin->state != CEC_ST_RX_IRQ) + return; + + atomic_set(&pin->work_irq_change, CEC_PIN_IRQ_UNCHANGED); + pin->ops->disable_irq(pin->adap); + cec_pin_high(pin); + cec_pin_to_idle(pin); + hrtimer_start(&pin->timer, ns_to_ktime(0), HRTIMER_MODE_REL); +} + static int cec_pin_adap_transmit(struct cec_adapter *adap, u8 attempts, u32 signal_free_time, struct cec_msg *msg) { @@ -689,14 +701,7 @@ static int cec_pin_adap_transmit(struct cec_adapter *adap, u8 attempts, pin->tx_msg = *msg; pin->work_tx_status = 0; pin->tx_bit = 0; - if (pin->state == CEC_ST_RX_IRQ) { - atomic_set(&pin->work_irq_change, CEC_PIN_IRQ_UNCHANGED); - pin->ops->disable_irq(adap); - cec_pin_high(pin); - cec_pin_to_idle(pin); - hrtimer_start(&pin->timer, ns_to_ktime(0), - HRTIMER_MODE_REL); - } + cec_pin_start_timer(pin); return 0; } |