aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/ene_ir.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/rc/ene_ir.c')
-rw-r--r--drivers/media/rc/ene_ir.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index 80b3c319f698..1ac49139158d 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -446,27 +446,27 @@ static void ene_rx_setup(struct ene_device *dev)
446 446
447select_timeout: 447select_timeout:
448 if (dev->rx_fan_input_inuse) { 448 if (dev->rx_fan_input_inuse) {
449 dev->rdev->rx_resolution = MS_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN); 449 dev->rdev->rx_resolution = US_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN);
450 450
451 /* Fan input doesn't support timeouts, it just ends the 451 /* Fan input doesn't support timeouts, it just ends the
452 input with a maximum sample */ 452 input with a maximum sample */
453 dev->rdev->min_timeout = dev->rdev->max_timeout = 453 dev->rdev->min_timeout = dev->rdev->max_timeout =
454 MS_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK * 454 US_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK *
455 ENE_FW_SAMPLE_PERIOD_FAN); 455 ENE_FW_SAMPLE_PERIOD_FAN);
456 } else { 456 } else {
457 dev->rdev->rx_resolution = MS_TO_NS(sample_period); 457 dev->rdev->rx_resolution = US_TO_NS(sample_period);
458 458
459 /* Theoreticly timeout is unlimited, but we cap it 459 /* Theoreticly timeout is unlimited, but we cap it
460 * because it was seen that on one device, it 460 * because it was seen that on one device, it
461 * would stop sending spaces after around 250 msec. 461 * would stop sending spaces after around 250 msec.
462 * Besides, this is close to 2^32 anyway and timeout is u32. 462 * Besides, this is close to 2^32 anyway and timeout is u32.
463 */ 463 */
464 dev->rdev->min_timeout = MS_TO_NS(127 * sample_period); 464 dev->rdev->min_timeout = US_TO_NS(127 * sample_period);
465 dev->rdev->max_timeout = MS_TO_NS(200000); 465 dev->rdev->max_timeout = US_TO_NS(200000);
466 } 466 }
467 467
468 if (dev->hw_learning_and_tx_capable) 468 if (dev->hw_learning_and_tx_capable)
469 dev->rdev->tx_resolution = MS_TO_NS(sample_period); 469 dev->rdev->tx_resolution = US_TO_NS(sample_period);
470 470
471 if (dev->rdev->timeout > dev->rdev->max_timeout) 471 if (dev->rdev->timeout > dev->rdev->max_timeout)
472 dev->rdev->timeout = dev->rdev->max_timeout; 472 dev->rdev->timeout = dev->rdev->max_timeout;
@@ -801,7 +801,7 @@ static irqreturn_t ene_isr(int irq, void *data)
801 801
802 dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space"); 802 dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space");
803 803
804 ev.duration = MS_TO_NS(hw_sample); 804 ev.duration = US_TO_NS(hw_sample);
805 ev.pulse = pulse; 805 ev.pulse = pulse;
806 ir_raw_event_store_with_filter(dev->rdev, &ev); 806 ir_raw_event_store_with_filter(dev->rdev, &ev);
807 } 807 }
@@ -821,7 +821,7 @@ static void ene_setup_default_settings(struct ene_device *dev)
821 dev->learning_mode_enabled = learning_mode_force; 821 dev->learning_mode_enabled = learning_mode_force;
822 822
823 /* Set reasonable default timeout */ 823 /* Set reasonable default timeout */
824 dev->rdev->timeout = MS_TO_NS(150000); 824 dev->rdev->timeout = US_TO_NS(150000);
825} 825}
826 826
827/* Upload all hardware settings at once. Used at load and resume time */ 827/* Upload all hardware settings at once. Used at load and resume time */
@@ -1004,6 +1004,10 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1004 /* validate resources */ 1004 /* validate resources */
1005 error = -ENODEV; 1005 error = -ENODEV;
1006 1006
1007 /* init these to -1, as 0 is valid for both */
1008 dev->hw_io = -1;
1009 dev->irq = -1;
1010
1007 if (!pnp_port_valid(pnp_dev, 0) || 1011 if (!pnp_port_valid(pnp_dev, 0) ||
1008 pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) 1012 pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE)
1009 goto error; 1013 goto error;
@@ -1072,6 +1076,8 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1072 rdev->input_name = "ENE eHome Infrared Remote Transceiver"; 1076 rdev->input_name = "ENE eHome Infrared Remote Transceiver";
1073 } 1077 }
1074 1078
1079 dev->rdev = rdev;
1080
1075 ene_rx_setup_hw_buffer(dev); 1081 ene_rx_setup_hw_buffer(dev);
1076 ene_setup_default_settings(dev); 1082 ene_setup_default_settings(dev);
1077 ene_setup_hw_settings(dev); 1083 ene_setup_hw_settings(dev);
@@ -1083,7 +1089,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1083 if (error < 0) 1089 if (error < 0)
1084 goto error; 1090 goto error;
1085 1091
1086 dev->rdev = rdev;
1087 ene_notice("driver has been succesfully loaded"); 1092 ene_notice("driver has been succesfully loaded");
1088 return 0; 1093 return 0;
1089error: 1094error: