Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232223
b: refs/heads/master
c: 5aad724
h: refs/heads/master
i:
  232221: 66e65df
  232219: 5844f25
  232215: 0b25301
  232207: 35ca21c
  232191: 75fb186
v: v3
  • Loading branch information
Jarod Wilson authored and Mauro Carvalho Chehab committed Jan 19, 2011
1 parent 3e4444f commit 6a39f10
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ad77eb57b45f81ac3e12077d19e5f121c4cff6d
refs/heads/master: 5aad724280b9f8ffff3a55311ef0ba35ebb4099a
16 changes: 8 additions & 8 deletions trunk/drivers/media/rc/ene_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,27 +446,27 @@ static void ene_rx_setup(struct ene_device *dev)

select_timeout:
if (dev->rx_fan_input_inuse) {
dev->rdev->rx_resolution = MS_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN);
dev->rdev->rx_resolution = US_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN);

/* Fan input doesn't support timeouts, it just ends the
input with a maximum sample */
dev->rdev->min_timeout = dev->rdev->max_timeout =
MS_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK *
US_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK *
ENE_FW_SAMPLE_PERIOD_FAN);
} else {
dev->rdev->rx_resolution = MS_TO_NS(sample_period);
dev->rdev->rx_resolution = US_TO_NS(sample_period);

/* Theoreticly timeout is unlimited, but we cap it
* because it was seen that on one device, it
* would stop sending spaces after around 250 msec.
* Besides, this is close to 2^32 anyway and timeout is u32.
*/
dev->rdev->min_timeout = MS_TO_NS(127 * sample_period);
dev->rdev->max_timeout = MS_TO_NS(200000);
dev->rdev->min_timeout = US_TO_NS(127 * sample_period);
dev->rdev->max_timeout = US_TO_NS(200000);
}

if (dev->hw_learning_and_tx_capable)
dev->rdev->tx_resolution = MS_TO_NS(sample_period);
dev->rdev->tx_resolution = US_TO_NS(sample_period);

if (dev->rdev->timeout > dev->rdev->max_timeout)
dev->rdev->timeout = dev->rdev->max_timeout;
Expand Down Expand Up @@ -801,7 +801,7 @@ static irqreturn_t ene_isr(int irq, void *data)

dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space");

ev.duration = MS_TO_NS(hw_sample);
ev.duration = US_TO_NS(hw_sample);
ev.pulse = pulse;
ir_raw_event_store_with_filter(dev->rdev, &ev);
}
Expand All @@ -821,7 +821,7 @@ static void ene_setup_default_settings(struct ene_device *dev)
dev->learning_mode_enabled = learning_mode_force;

/* Set reasonable default timeout */
dev->rdev->timeout = MS_TO_NS(150000);
dev->rdev->timeout = US_TO_NS(150000);
}

/* Upload all hardware settings at once. Used at load and resume time */
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/media/rc/ene_ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@
#define dbg_verbose(format, ...) __dbg(2, format, ## __VA_ARGS__)
#define dbg_regs(format, ...) __dbg(3, format, ## __VA_ARGS__)

#define MS_TO_NS(msec) ((msec) * 1000)

struct ene_device {
struct pnp_dev *pnp_dev;
struct rc_dev *rdev;
Expand Down
7 changes: 3 additions & 4 deletions trunk/drivers/media/rc/mceusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#define USB_BUFLEN 32 /* USB reception buffer length */
#define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */
#define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */
#define MS_TO_NS(msec) ((msec) * 1000)

/* MCE constants */
#define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */
Expand Down Expand Up @@ -817,7 +816,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index)
switch (ir->buf_in[index]) {
/* 2-byte return value commands */
case MCE_CMD_S_TIMEOUT:
ir->rc->timeout = MS_TO_NS((hi << 8 | lo) / 2);
ir->rc->timeout = MS_TO_US((hi << 8 | lo) / 2);
break;

/* 1-byte return value commands */
Expand Down Expand Up @@ -858,7 +857,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
ir->rem--;
rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0);
rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK)
* MS_TO_NS(MCE_TIME_UNIT);
* MS_TO_US(MCE_TIME_UNIT);

dev_dbg(ir->dev, "Storing %s with duration %d\n",
rawir.pulse ? "pulse" : "space",
Expand Down Expand Up @@ -1061,7 +1060,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
rc->priv = ir;
rc->driver_type = RC_DRIVER_IR_RAW;
rc->allowed_protos = RC_TYPE_ALL;
rc->timeout = MS_TO_NS(1000);
rc->timeout = MS_TO_US(1000);
if (!ir->flags.no_tx) {
rc->s_tx_mask = mceusb_set_tx_mask;
rc->s_tx_carrier = mceusb_set_tx_carrier;
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/media/rc-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ static inline void init_ir_raw_event(struct ir_raw_event *ev)
}

#define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */
#define US_TO_NS(usec) ((usec) * 1000)
#define MS_TO_US(msec) ((msec) * 1000)
#define MS_TO_NS(msec) ((msec) * 1000 * 1000)

void ir_raw_event_handle(struct rc_dev *dev);
int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev);
Expand Down

0 comments on commit 6a39f10

Please sign in to comment.