media: cec: replace pin->cur_value by adap->cec_pin_is_high
The current CEC pin value (0 or 1) was part of the cec_pin struct, but that assumes that CEC pin monitoring can only be used with a driver that uses the low-level CEC pin framework. But hardware that has both a high-level API and can monitor the CEC pin at low-level at the same time does not need to depend on the cec pin framework. To support such devices remove the cur_value field from struct cec_pin and add a cec_pin_is_high field to cec_adapter. This also makes it possible to drop the '#ifdef CONFIG_CEC_PIN' in cec-api.c. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
152b0a9a3d
commit
28e11b15b6
@@ -88,10 +88,10 @@ static const struct cec_state states[CEC_PIN_STATES] = {
|
||||
|
||||
static void cec_pin_update(struct cec_pin *pin, bool v, bool force)
|
||||
{
|
||||
if (!force && v == pin->cur_value)
|
||||
if (!force && v == pin->adap->cec_pin_is_high)
|
||||
return;
|
||||
|
||||
pin->cur_value = v;
|
||||
pin->adap->cec_pin_is_high = v;
|
||||
if (atomic_read(&pin->work_pin_events) < CEC_NUM_PIN_EVENTS) {
|
||||
pin->work_pin_is_high[pin->work_pin_events_wr] = v;
|
||||
pin->work_pin_ts[pin->work_pin_events_wr] = ktime_get();
|
||||
@@ -781,7 +781,6 @@ struct cec_adapter *cec_pin_allocate_adapter(const struct cec_pin_ops *pin_ops,
|
||||
if (pin == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
pin->ops = pin_ops;
|
||||
pin->cur_value = true;
|
||||
hrtimer_init(&pin->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
|
||||
pin->timer.function = cec_pin_timer;
|
||||
init_waitqueue_head(&pin->kthread_waitq);
|
||||
|
Reference in New Issue
Block a user