1 // SPDX-License-Identifier: ISC 2 3 #include "mt7615.h" 4 5 static int 6 mt7615_radar_pattern_set(void *data, u64 val) 7 { 8 struct mt7615_dev *dev = data; 9 10 return mt7615_mcu_rdd_send_pattern(dev); 11 } 12 13 DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_pattern, NULL, 14 mt7615_radar_pattern_set, "%lld\n"); 15 16 static int 17 mt7615_scs_set(void *data, u64 val) 18 { 19 struct mt7615_dev *dev = data; 20 21 mt7615_mac_set_scs(dev, val); 22 23 return 0; 24 } 25 26 static int 27 mt7615_scs_get(void *data, u64 *val) 28 { 29 struct mt7615_dev *dev = data; 30 31 *val = dev->scs_en; 32 33 return 0; 34 } 35 36 DEFINE_DEBUGFS_ATTRIBUTE(fops_scs, mt7615_scs_get, 37 mt7615_scs_set, "%lld\n"); 38 39 static int 40 mt7615_radio_read(struct seq_file *s, void *data) 41 { 42 struct mt7615_dev *dev = dev_get_drvdata(s->private); 43 44 seq_printf(s, "Sensitivity: ofdm=%d cck=%d\n", 45 dev->ofdm_sensitivity, dev->cck_sensitivity); 46 seq_printf(s, "False CCA: ofdm=%d cck=%d\n", 47 dev->false_cca_ofdm, dev->false_cca_cck); 48 49 return 0; 50 } 51 52 static int mt7615_read_temperature(struct seq_file *s, void *data) 53 { 54 struct mt7615_dev *dev = dev_get_drvdata(s->private); 55 int temp; 56 57 /* cpu */ 58 temp = mt7615_mcu_get_temperature(dev, 0); 59 seq_printf(s, "Temperature: %d\n", temp); 60 61 return 0; 62 } 63 64 int mt7615_init_debugfs(struct mt7615_dev *dev) 65 { 66 struct dentry *dir; 67 68 dir = mt76_register_debugfs(&dev->mt76); 69 if (!dir) 70 return -ENOMEM; 71 72 debugfs_create_file("scs", 0600, dir, dev, &fops_scs); 73 debugfs_create_devm_seqfile(dev->mt76.dev, "radio", dir, 74 mt7615_radio_read); 75 debugfs_create_u32("dfs_hw_pattern", 0400, dir, &dev->hw_pattern); 76 /* test pattern knobs */ 77 debugfs_create_u8("pattern_len", 0600, dir, 78 &dev->radar_pattern.n_pulses); 79 debugfs_create_u32("pulse_period", 0600, dir, 80 &dev->radar_pattern.period); 81 debugfs_create_u16("pulse_width", 0600, dir, 82 &dev->radar_pattern.width); 83 debugfs_create_u16("pulse_power", 0600, dir, 84 &dev->radar_pattern.power); 85 debugfs_create_file("radar_trigger", 0200, dir, dev, 86 &fops_radar_pattern); 87 debugfs_create_devm_seqfile(dev->mt76.dev, "temperature", dir, 88 mt7615_read_temperature); 89 90 return 0; 91 } 92