linux/drivers/media/rc/st_rc.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2013 STMicroelectronics Limited
 * Author: Srinivas Kandagatla <[email protected]>
 */
#include <linux/kernel.h>
#include <linux/clk.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <media/rc-core.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm_wakeirq.h>

struct st_rc_device {};

/* Registers */
#define IRB_SAMPLE_RATE_COMM
#define IRB_CLOCK_SEL
#define IRB_CLOCK_SEL_STATUS
/* IRB IR/UHF receiver registers */
#define IRB_RX_ON
#define IRB_RX_SYS
#define IRB_RX_INT_EN
#define IRB_RX_INT_STATUS
#define IRB_RX_EN
#define IRB_MAX_SYM_PERIOD
#define IRB_RX_INT_CLEAR
#define IRB_RX_STATUS
#define IRB_RX_NOISE_SUPPR
#define IRB_RX_POLARITY_INV

/*
 * IRQ set: Enable full FIFO                 1  -> bit  3;
 *          Enable overrun IRQ               1  -> bit  2;
 *          Enable last symbol IRQ           1  -> bit  1:
 *          Enable RX interrupt              1  -> bit  0;
 */
#define IRB_RX_INTS
#define IRB_RX_OVERRUN_INT
 /* maximum symbol period (microsecs),timeout to detect end of symbol train */
#define MAX_SYMB_TIME
#define IRB_SAMPLE_FREQ
#define IRB_FIFO_NOT_EMPTY
#define IRB_OVERFLOW
#define IRB_TIMEOUT
#define IR_ST_NAME

static void st_rc_send_lirc_timeout(struct rc_dev *rdev)
{}

/*
 * RX graphical example to better understand the difference between ST IR block
 * output and standard definition used by LIRC (and most of the world!)
 *
 *           mark                                     mark
 *      |-IRB_RX_ON-|                            |-IRB_RX_ON-|
 *      ___  ___  ___                            ___  ___  ___             _
 *      | |  | |  | |                            | |  | |  | |             |
 *      | |  | |  | |         space 0            | |  | |  | |   space 1   |
 * _____| |__| |__| |____________________________| |__| |__| |_____________|
 *
 *      |--------------- IRB_RX_SYS -------------|------ IRB_RX_SYS -------|
 *
 *      |------------- encoding bit 0 -----------|---- encoding bit 1 -----|
 *
 * ST hardware returns mark (IRB_RX_ON) and total symbol time (IRB_RX_SYS), so
 * convert to standard mark/space we have to calculate space=(IRB_RX_SYS-mark)
 * The mark time represents the amount of time the carrier (usually 36-40kHz)
 * is detected.The above examples shows Pulse Width Modulation encoding where
 * bit 0 is represented by space>mark.
 */

static irqreturn_t st_rc_rx_interrupt(int irq, void *data)
{}

static int st_rc_hardware_init(struct st_rc_device *dev)
{}

static void st_rc_remove(struct platform_device *pdev)
{}

static int st_rc_open(struct rc_dev *rdev)
{}

static void st_rc_close(struct rc_dev *rdev)
{}

static int st_rc_probe(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int st_rc_suspend(struct device *dev)
{}

static int st_rc_resume(struct device *dev)
{}

#endif

static SIMPLE_DEV_PM_OPS(st_rc_pm_ops, st_rc_suspend, st_rc_resume);

#ifdef CONFIG_OF
static const struct of_device_id st_rc_match[] =;

MODULE_DEVICE_TABLE(of, st_rc_match);
#endif

static struct platform_driver st_rc_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();