Re: [PATCH v3 2/2] media: rc: remove ir-rx51 in favour of generic pwm-ir-tx

2018-08-13 Thread Sean Young
On Fri, Jul 13, 2018 at 05:38:25PM +0300, Ivaylo Dimitrov wrote:
> Hi,
> 
> On 13.07.2018 15:22, Sean Young wrote:
> > The ir-rx51 is a pwm-based TX driver specific to the N900. This can be
> > handled entirely by the generic pwm-ir-tx driver.
> > 
> > Note that the suspend code in the ir-rx51 driver is unnecessary, since
> > during transmit, the process is not in interruptable sleep. The process
> > is not put to sleep until the transmit completes.
> > 
> > Compile tested only.
> > 
> 
> I would like to see this being tested on a real HW, however I am on a
> holiday for the next week so won't be able to test till I am back.
> 
> @Pali - do you have n900 with fremantle, upstream kernel and pierogi to test
> pwm-ir-tx on it?

It would be nice to have this verified on real hardware, if possible. If
not, I would like to merge this anyway. If there are any problems we can
always later patch any problem in pwm-ir-tx for the n900.


Sean


Re: [PATCH v3 2/2] media: rc: remove ir-rx51 in favour of generic pwm-ir-tx

2018-07-15 Thread Pali Rohár
On Friday 13 July 2018 17:38:25 Ivaylo Dimitrov wrote:
> Hi,
> 
> On 13.07.2018 15:22, Sean Young wrote:
> > The ir-rx51 is a pwm-based TX driver specific to the N900. This can be
> > handled entirely by the generic pwm-ir-tx driver.
> > 
> > Note that the suspend code in the ir-rx51 driver is unnecessary, since
> > during transmit, the process is not in interruptable sleep. The process
> > is not put to sleep until the transmit completes.
> > 
> > Compile tested only.
> > 
> 
> I would like to see this being tested on a real HW, however I am on a
> holiday for the next week so won't be able to test till I am back.
> 
> @Pali - do you have n900 with fremantle, upstream kernel and pierogi to test
> pwm-ir-tx on it?

Hi! Currently on my N900 with Maemo Fremantle is 2.6.28 and 3.12
kernels. And 3.12 is a far away from current upstream kernel.

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: PGP signature


Re: [PATCH v3 2/2] media: rc: remove ir-rx51 in favour of generic pwm-ir-tx

2018-07-13 Thread Ivaylo Dimitrov

Hi,

On 13.07.2018 15:22, Sean Young wrote:

The ir-rx51 is a pwm-based TX driver specific to the N900. This can be
handled entirely by the generic pwm-ir-tx driver.

Note that the suspend code in the ir-rx51 driver is unnecessary, since
during transmit, the process is not in interruptable sleep. The process
is not put to sleep until the transmit completes.

Compile tested only.



I would like to see this being tested on a real HW, however I am on a 
holiday for the next week so won't be able to test till I am back.


@Pali - do you have n900 with fremantle, upstream kernel and pierogi to 
test pwm-ir-tx on it?


Ivo


[PATCH v3 2/2] media: rc: remove ir-rx51 in favour of generic pwm-ir-tx

2018-07-13 Thread Sean Young
The ir-rx51 is a pwm-based TX driver specific to the N900. This can be
handled entirely by the generic pwm-ir-tx driver.

Note that the suspend code in the ir-rx51 driver is unnecessary, since
during transmit, the process is not in interruptable sleep. The process
is not put to sleep until the transmit completes.

Compile tested only.

Cc: Ivaylo Dimitrov 
Cc: Pali Rohár 
Cc: Pavel Machek 
Cc: Timo Kokkonen 
Cc: Tony Lindgren 
Signed-off-by: Sean Young 
---
 arch/arm/configs/omap2plus_defconfig |   1 -
 drivers/media/rc/Kconfig |  10 -
 drivers/media/rc/Makefile|   1 -
 drivers/media/rc/ir-rx51.c   | 305 ---
 4 files changed, 317 deletions(-)
 delete mode 100644 drivers/media/rc/ir-rx51.c

diff --git a/arch/arm/configs/omap2plus_defconfig 
b/arch/arm/configs/omap2plus_defconfig
index 6491419b1dad..1ce489a250e0 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -325,7 +325,6 @@ CONFIG_RC_CORE=m
 CONFIG_LIRC=y
 CONFIG_RC_DEVICES=y
 CONFIG_IR_SPI=m
-CONFIG_IR_RX51=m
 CONFIG_IR_GPIO_TX=m
 CONFIG_IR_PWM_TX=m
 CONFIG_MEDIA_SUPPORT=m
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 1021c08a9ba4..3817127bd240 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -377,16 +377,6 @@ config IR_TTUSBIR
   To compile this driver as a module, choose M here: the module will
   be called ttusbir.
 
-config IR_RX51
-   tristate "Nokia N900 IR transmitter diode"
-   depends on (OMAP_DM_TIMER && PWM_OMAP_DMTIMER && ARCH_OMAP2PLUS || 
COMPILE_TEST) && RC_CORE
-   ---help---
-  Say Y or M here if you want to enable support for the IR
-  transmitter diode built in the Nokia N900 (RX51) device.
-
-  The driver uses omap DM timers for generating the carrier
-  wave and pulses.
-
 source "drivers/media/rc/img-ir/Kconfig"
 
 config RC_LOOPBACK
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index e0340d043fe8..124a823555bc 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -29,7 +29,6 @@ obj-$(CONFIG_IR_MESON) += meson-ir.o
 obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o
 obj-$(CONFIG_IR_ENE) += ene_ir.o
 obj-$(CONFIG_IR_REDRAT3) += redrat3.o
-obj-$(CONFIG_IR_RX51) += ir-rx51.o
 obj-$(CONFIG_IR_SPI) += ir-spi.o
 obj-$(CONFIG_IR_STREAMZAP) += streamzap.o
 obj-$(CONFIG_IR_WINBOND_CIR) += winbond-cir.o
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
deleted file mode 100644
index 8a93f7468622..
--- a/drivers/media/rc/ir-rx51.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- *  Copyright (C) 2008 Nokia Corporation
- *
- *  Based on lirc_serial.c
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#define WBUF_LEN 256
-
-struct ir_rx51 {
-   struct rc_dev *rcdev;
-   struct pwm_device *pwm;
-   struct hrtimer timer;
-   struct device*dev;
-   wait_queue_head_t wqueue;
-
-   unsigned intfreq;   /* carrier frequency */
-   unsigned intduty_cycle; /* carrier duty cycle */
-   int wbuf[WBUF_LEN];
-   int wbuf_index;
-   unsigned long   device_is_open;
-};
-
-static inline void ir_rx51_on(struct ir_rx51 *ir_rx51)
-{
-   pwm_enable(ir_rx51->pwm);
-}
-
-static inline void ir_rx51_off(struct ir_rx51 *ir_rx51)
-{
-   pwm_disable(ir_rx51->pwm);
-}
-
-static int init_timing_params(struct ir_rx51 *ir_rx51)
-{
-   struct pwm_device *pwm = ir_rx51->pwm;
-   int duty, period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, ir_rx51->freq);
-
-   duty = DIV_ROUND_CLOSEST(ir_rx51->duty_cycle * period, 100);
-
-   pwm_config(pwm, duty, period);
-
-   return 0;
-}
-
-static enum hrtimer_restart ir_rx51_timer_cb(struct hrtimer *timer)
-{
-   struct ir_rx51 *ir_rx51 = container_of(timer, struct ir_rx51, timer);
-   ktime_t now;
-
-   if (ir_rx51->wbuf_index < 0) {
-   dev_err_ratelimited(ir_rx51->dev,
-   "BUG wbuf_index has value of %i\n",
-   ir_rx51->wbuf_index);
-   goto end;
-   }
-
-   /*
-* If we happen to hit an odd latency spike, loop through the
-* pulses until we catch up.
-*/
-   do {
-   u64 ns;
-
-   if (ir_rx51->wbuf_index >= WBUF_LEN)
-   goto end