#define MESON_RAW_TRATE 10 /* us */ #define MESON_HW_TRATE 20 /* us */
/** * 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'
*/
/* Hold frame data until register was read */
regmap_update_bits(ir->reg, IR_DEC_REG1, IR_DEC_REG1_HOLD_CODE,
timings->hold_code_enable ?
IR_DEC_REG1_HOLD_CODE : 0);
/* Bit order */
regmap_update_bits(ir->reg, IR_DEC_REG2, IR_DEC_REG2_BIT_ORDER,
timings->bit_order ? IR_DEC_REG2_BIT_ORDER : 0);
/* * Some protocols transmit the same data frame as repeat frame * when the key is pressing. In this case, it could be detected as * repeat frame if the repeat checker was enabled.
*/
regmap_update_bits(ir->reg, IR_DEC_REG2, IR_DEC_REG2_REPEAT_COUNTER,
timings->repeat_counter_enable ?
IR_DEC_REG2_REPEAT_COUNTER : 0);
regmap_update_bits(ir->reg, IR_DEC_REG2, IR_DEC_REG2_REPEAT_TIME,
timings->repeat_check_enable ?
IR_DEC_REG2_REPEAT_TIME : 0);
regmap_update_bits(ir->reg, IR_DEC_REG2, IR_DEC_REG2_COMPARE_FRAME,
timings->repeat_compare_enable ?
IR_DEC_REG2_COMPARE_FRAME : 0);
/* * FRAME_TIME_MAX should be larger than the time between * data frame and repeat frame
*/
regval = FIELD_PREP(IR_DEC_REG0_FRAME_TIME_MAX,
timings->frame_time_max);
regmap_update_bits(ir->reg, IR_DEC_REG0, IR_DEC_REG0_FRAME_TIME_MAX,
regval);
/* Length(N-1) of data frame */
regval = FIELD_PREP(IR_DEC_REG1_FRAME_LEN, timings->code_length - 1);
regmap_update_bits(ir->reg, IR_DEC_REG1, IR_DEC_REG1_FRAME_LEN, regval);
/* Time for leader active part */
regval = FIELD_PREP(IR_DEC_LDR_ACTIVE_MAX,
timings->leader_active_max) |
FIELD_PREP(IR_DEC_LDR_ACTIVE_MIN,
timings->leader_active_min);
regmap_update_bits(ir->reg, IR_DEC_LDR_ACTIVE, IR_DEC_LDR_ACTIVE_MAX |
IR_DEC_LDR_ACTIVE_MIN, regval);
/* Time for leader idle part */
regval = FIELD_PREP(IR_DEC_LDR_IDLE_MAX, timings->leader_idle_max) |
FIELD_PREP(IR_DEC_LDR_IDLE_MIN, timings->leader_idle_min);
regmap_update_bits(ir->reg, IR_DEC_LDR_IDLE,
IR_DEC_LDR_IDLE_MAX | IR_DEC_LDR_IDLE_MIN, regval);
/* Time for repeat leader idle part */
regval = FIELD_PREP(IR_DEC_LDR_REPEAT_MAX, timings->repeat_leader_max) |
FIELD_PREP(IR_DEC_LDR_REPEAT_MIN, timings->repeat_leader_min);
regmap_update_bits(ir->reg, IR_DEC_LDR_REPEAT, IR_DEC_LDR_REPEAT_MAX |
IR_DEC_LDR_REPEAT_MIN, regval);
/* * NEC: Time for logic '0' * RC6: Time for half of trailer bit
*/
regval = FIELD_PREP(IR_DEC_BIT_0_MAX, timings->bit0_max) |
FIELD_PREP(IR_DEC_BIT_0_MIN, timings->bit0_min);
regmap_update_bits(ir->reg, IR_DEC_BIT_0,
IR_DEC_BIT_0_MAX | IR_DEC_BIT_0_MIN, regval);
/* * NEC: Time for logic '1' * RC6: Time for whole of trailer bit
*/
regval = FIELD_PREP(IR_DEC_STATUS_BIT_1_MAX, timings->bit1_max) |
FIELD_PREP(IR_DEC_STATUS_BIT_1_MIN, timings->bit1_min);
regmap_update_bits(ir->reg, IR_DEC_STATUS, IR_DEC_STATUS_BIT_1_MAX |
IR_DEC_STATUS_BIT_1_MIN, regval);
/* Enable to match logic '1' */
regmap_update_bits(ir->reg, IR_DEC_STATUS, IR_DEC_STATUS_BIT_1_ENABLE,
timings->bit1_match_enable ?
IR_DEC_STATUS_BIT_1_ENABLE : 0);
/* * NEC: Unused * RC6: Time for halt of logic 0/1
*/
regval = FIELD_PREP(IR_DEC_DURATN2_MAX, timings->duration2_max) |
FIELD_PREP(IR_DEC_DURATN2_MIN, timings->duration2_min);
regmap_update_bits(ir->reg, IR_DEC_DURATN2,
IR_DEC_DURATN2_MAX | IR_DEC_DURATN2_MIN, regval);
/* * Set operation mode to NEC/hardware decoding to give * bootloader a chance to power the system back on
*/ if (of_device_is_compatible(node, "amlogic,meson6-ir"))
regmap_update_bits(ir->reg, IR_DEC_REG1, IR_DEC_REG1_MODE,
FIELD_PREP(IR_DEC_REG1_MODE, DEC_MODE_NEC)); else
regmap_update_bits(ir->reg, IR_DEC_REG2, IR_DEC_REG2_MODE,
FIELD_PREP(IR_DEC_REG2_MODE, DEC_MODE_NEC));
/* Set rate to default value */
regmap_update_bits(ir->reg, IR_DEC_REG0, IR_DEC_REG0_BASE_TIME,
FIELD_PREP(IR_DEC_REG0_BASE_TIME,
MESON_HW_TRATE - 1));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.