debug.c (cb54b53adae70701bdd77d848cea4b9b39b61cf9) | debug.c (4eba10cc8086e3dde09f00e44b43ff4f8624d527) |
---|---|
1/* 2 * Copyright (c) 2008-2011 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 307 unchanged lines hidden (view full) --- 316static const struct file_operations fops_ant_diversity = { 317 .read = read_file_ant_diversity, 318 .write = write_file_ant_diversity, 319 .open = simple_open, 320 .owner = THIS_MODULE, 321 .llseek = default_llseek, 322}; 323 | 1/* 2 * Copyright (c) 2008-2011 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 307 unchanged lines hidden (view full) --- 316static const struct file_operations fops_ant_diversity = { 317 .read = read_file_ant_diversity, 318 .write = write_file_ant_diversity, 319 .open = simple_open, 320 .owner = THIS_MODULE, 321 .llseek = default_llseek, 322}; 323 |
324static ssize_t read_file_antenna_diversity(struct file *file, 325 char __user *user_buf, 326 size_t count, loff_t *ppos) 327{ 328 struct ath_softc *sc = file->private_data; 329 struct ath_hw *ah = sc->sc_ah; 330 struct ath9k_hw_capabilities *pCap = &ah->caps; 331 struct ath_antenna_stats *as_main = &sc->debug.stats.ant_stats[ANT_MAIN]; 332 struct ath_antenna_stats *as_alt = &sc->debug.stats.ant_stats[ANT_ALT]; 333 unsigned int len = 0, size = 1024; 334 ssize_t retval = 0; 335 char *buf; 336 337 buf = kzalloc(size, GFP_KERNEL); 338 if (buf == NULL) 339 return -ENOMEM; 340 341 if (!(pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)) { 342 len += snprintf(buf + len, size - len, "%s\n", 343 "Antenna Diversity Combining is disabled"); 344 goto exit; 345 } 346 347 len += snprintf(buf + len, size - len, "%30s%15s\n", 348 "MAIN", "ALT"); 349 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 350 "RECV CNT", 351 as_main->recv_cnt, 352 as_alt->recv_cnt); 353 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 354 "LNA1", 355 as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1], 356 as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1]); 357 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 358 "LNA2", 359 as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA2], 360 as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA2]); 361 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 362 "LNA1 + LNA2", 363 as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2], 364 as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2]); 365 len += snprintf(buf + len, size - len, "%-15s%15d%15d\n", 366 "LNA1 - LNA2", 367 as_main->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2], 368 as_alt->lna_config_cnt[ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2]); 369exit: 370 if (len > size) 371 len = size; 372 373 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); 374 kfree(buf); 375 376 return retval; 377} 378 379static const struct file_operations fops_antenna_diversity = { 380 .read = read_file_antenna_diversity, 381 .open = simple_open, 382 .owner = THIS_MODULE, 383 .llseek = default_llseek, 384}; 385 |
|
324static ssize_t read_file_dma(struct file *file, char __user *user_buf, 325 size_t count, loff_t *ppos) 326{ 327 struct ath_softc *sc = file->private_data; 328 struct ath_hw *ah = sc->sc_ah; 329 char *buf; 330 int retval; 331 unsigned int len = 0; --- 1479 unchanged lines hidden (view full) --- 1811 sc->debug.debugfs_phy, sc, 1812 &fops_spectral_fft_period); 1813 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, 1814 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); 1815 debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, 1816 sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); 1817 debugfs_create_file("diversity", S_IRUSR | S_IWUSR, 1818 sc->debug.debugfs_phy, sc, &fops_ant_diversity); | 386static ssize_t read_file_dma(struct file *file, char __user *user_buf, 387 size_t count, loff_t *ppos) 388{ 389 struct ath_softc *sc = file->private_data; 390 struct ath_hw *ah = sc->sc_ah; 391 char *buf; 392 int retval; 393 unsigned int len = 0; --- 1479 unchanged lines hidden (view full) --- 1873 sc->debug.debugfs_phy, sc, 1874 &fops_spectral_fft_period); 1875 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, 1876 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); 1877 debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, 1878 sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); 1879 debugfs_create_file("diversity", S_IRUSR | S_IWUSR, 1880 sc->debug.debugfs_phy, sc, &fops_ant_diversity); |
1881 debugfs_create_file("antenna_diversity", S_IRUSR, 1882 sc->debug.debugfs_phy, sc, &fops_antenna_diversity); |
|
1819#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT 1820 debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, 1821 &fops_btcoex); 1822#endif 1823 return 0; 1824} | 1883#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT 1884 debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, 1885 &fops_btcoex); 1886#endif 1887 return 0; 1888} |