linux/drivers/media/rc/meson-ir.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for Amlogic Meson IR remote receiver
 *
 * Copyright (C) 2014 Beniamino Galvani <[email protected]>
 */

#include <linux/device.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/bitfield.h>
#include <linux/regmap.h>

#include <media/rc-core.h>

#define DRIVER_NAME

#define IR_DEC_LDR_ACTIVE
#define IR_DEC_LDR_ACTIVE_MAX
#define IR_DEC_LDR_ACTIVE_MIN
#define IR_DEC_LDR_IDLE
#define IR_DEC_LDR_IDLE_MAX
#define IR_DEC_LDR_IDLE_MIN
#define IR_DEC_LDR_REPEAT
#define IR_DEC_LDR_REPEAT_MAX
#define IR_DEC_LDR_REPEAT_MIN
#define IR_DEC_BIT_0
#define IR_DEC_BIT_0_MAX
#define IR_DEC_BIT_0_MIN
#define IR_DEC_REG0
#define IR_DEC_REG0_FILTER
#define IR_DEC_REG0_FRAME_TIME_MAX
#define IR_DEC_REG0_BASE_TIME
#define IR_DEC_FRAME
#define IR_DEC_STATUS
#define IR_DEC_STATUS_BIT_1_ENABLE
#define IR_DEC_STATUS_BIT_1_MAX
#define IR_DEC_STATUS_BIT_1_MIN
#define IR_DEC_STATUS_PULSE
#define IR_DEC_STATUS_BUSY
#define IR_DEC_STATUS_FRAME_STATUS
#define IR_DEC_REG1
#define IR_DEC_REG1_TIME_IV
#define IR_DEC_REG1_FRAME_LEN
#define IR_DEC_REG1_ENABLE
#define IR_DEC_REG1_HOLD_CODE
#define IR_DEC_REG1_IRQSEL
#define IR_DEC_REG1_RESET
/* Meson 6b uses REG1 to configure IR mode */
#define IR_DEC_REG1_MODE

/* The following registers are only available on Meson 8b and newer */
#define IR_DEC_REG2
#define IR_DEC_REG2_TICK_MODE
#define IR_DEC_REG2_REPEAT_COUNTER
#define IR_DEC_REG2_REPEAT_TIME
#define IR_DEC_REG2_COMPARE_FRAME
#define IR_DEC_REG2_BIT_ORDER
/* Meson 8b / GXBB use REG2 to configure IR mode */
#define IR_DEC_REG2_MODE
#define IR_DEC_DURATN2
#define IR_DEC_DURATN2_MAX
#define IR_DEC_DURATN2_MIN
#define IR_DEC_DURATN3
#define IR_DEC_DURATN3_MAX
#define IR_DEC_DURATN3_MIN
#define IR_DEC_FRAME1

#define FRAME_MSB_FIRST
#define FRAME_LSB_FIRST

#define DEC_MODE_NEC
#define DEC_MODE_RAW
#define DEC_MODE_RC6
#define DEC_MODE_XMP
#define DEC_MODE_UNKNOW

#define DEC_STATUS_VALID
#define DEC_STATUS_DATA_CODE_ERR
#define DEC_STATUS_CUSTOM_CODE_ERR
#define DEC_STATUS_REPEAT

#define IRQSEL_DEC_MODE
#define IRQSEL_RISE_FALL
#define IRQSEL_FALL
#define IRQSEL_RISE

#define MESON_RAW_TRATE
#define MESON_HW_TRATE

/**
 * struct meson_ir_protocol - describe IR Protocol parameter
 *
 * @hw_protocol: select IR Protocol from IR Controller
 * @repeat_counter_enable: enable frame-to-frame time counter, it should work
 *                         with @repeat_compare_enable to detect the repeat frame
 * @repeat_check_enable: enable repeat time check for repeat detection
 * @repeat_compare_enable: enable to compare frame for repeat frame detection.
 *                         Some IR Protocol send the same data as repeat frame.
 *                         In this case, it should work with
 *                         @repeat_counter_enable to detect the repeat frame.
 * @bit_order: bit order, LSB or MSB
 * @bit1_match_enable: enable to check bit 1
 * @hold_code_enable: hold frame code in register IR_DEC_FRAME1, the new one
 *                    frame code will not be store in IR_DEC_FRAME1.
 *                    until IR_DEC_FRAME1 has been read
 * @count_tick_mode: increasing time unit of frame-to-frame time counter.
 *                   0 = 100us, 1 = 10us
 * @code_length: length (N-1) of data frame
 * @frame_time_max: max time for whole frame. Unit: MESON_HW_TRATE
 * @leader_active_max: max time for NEC/RC6 leader active part. Unit: MESON_HW_TRATE
 * @leader_active_min: min time for NEC/RC6 leader active part. Unit: MESON_HW_TRATE
 * @leader_idle_max: max time for NEC/RC6 leader idle part. Unit: MESON_HW_TRATE
 * @leader_idle_min: min time for NEC/RC6 leader idle part. Unit: MESON_HW_TRATE
 * @repeat_leader_max: max time for NEC repeat leader idle part. Unit: MESON_HW_TRATE
 * @repeat_leader_min: min time for NEC repeat leader idle part. Unit: MESON_HW_TRATE
 * @bit0_max: max time for NEC Logic '0', half of RC6 trailer bit, XMP Logic '00'
 * @bit0_min: min time for NEC Logic '0', half of RC6 trailer bit, XMP Logic '00'
 * @bit1_max: max time for NEC Logic '1', whole of RC6 trailer bit, XMP Logic '01'
 * @bit1_min: min time for NEC Logic '1', whole of RC6 trailer bit, XMP Logic '01'
 * @duration2_max: max time for half of RC6 normal bit, XMP Logic '10'
 * @duration2_min: min time for half of RC6 normal bit, XMP Logic '10'
 * @duration3_max: max time for whole of RC6 normal bit, XMP Logic '11'
 * @duration3_min: min time for whole of RC6 normal bit, XMP Logic '11'
 */

struct meson_ir_protocol {};

struct meson_ir_param {};

struct meson_ir {};

static struct regmap_config meson_ir_regmap_config =;

static const struct meson_ir_protocol protocol_timings[] =;

static void meson_ir_nec_handler(struct meson_ir *ir)
{}

static void meson_ir_hw_handler(struct meson_ir *ir)
{}

static irqreturn_t meson_ir_irq(int irqno, void *dev_id)
{}

static int meson_ir_hw_decoder_init(struct rc_dev *dev, u64 *rc_type)
{}

static void meson_ir_sw_decoder_init(struct rc_dev *dev)
{}

static int meson_ir_probe(struct platform_device *pdev)
{}

static void meson_ir_remove(struct platform_device *pdev)
{}

static void meson_ir_shutdown(struct platform_device *pdev)
{}

static __maybe_unused int meson_ir_resume(struct device *dev)
{}

static __maybe_unused int meson_ir_suspend(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(meson_ir_pm_ops, meson_ir_suspend, meson_ir_resume);

static const struct meson_ir_param meson6_ir_param =;

static const struct meson_ir_param meson8b_ir_param =;

static const struct meson_ir_param meson_s4_ir_param =;

static const struct of_device_id meson_ir_match[] =;
MODULE_DEVICE_TABLE(of, meson_ir_match);

static struct platform_driver meson_ir_driver =;

module_platform_driver();

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