xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/init.c (revision 93b167c13a3afa389eaa1af277e94add976ea43f)
17174beb6SJohannes Berg /******************************************************************************
27174beb6SJohannes Berg  *
37174beb6SJohannes Berg  * This file is provided under a dual BSD/GPLv2 license.  When using or
47174beb6SJohannes Berg  * redistributing this file, you may do so under either license.
57174beb6SJohannes Berg  *
67174beb6SJohannes Berg  * GPL LICENSE SUMMARY
77174beb6SJohannes Berg  *
87174beb6SJohannes Berg  * Copyright(c) 2017 Intel Deutschland GmbH
97174beb6SJohannes Berg  *
107174beb6SJohannes Berg  * This program is free software; you can redistribute it and/or modify
117174beb6SJohannes Berg  * it under the terms of version 2 of the GNU General Public License as
127174beb6SJohannes Berg  * published by the Free Software Foundation.
137174beb6SJohannes Berg  *
147174beb6SJohannes Berg  * This program is distributed in the hope that it will be useful, but
157174beb6SJohannes Berg  * WITHOUT ANY WARRANTY; without even the implied warranty of
167174beb6SJohannes Berg  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
177174beb6SJohannes Berg  * General Public License for more details.
187174beb6SJohannes Berg  *
197174beb6SJohannes Berg  * The full GNU General Public License is included in this distribution
207174beb6SJohannes Berg  * in the file called COPYING.
217174beb6SJohannes Berg  *
227174beb6SJohannes Berg  * Contact Information:
237174beb6SJohannes Berg  *  Intel Linux Wireless <linuxwifi@intel.com>
247174beb6SJohannes Berg  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
257174beb6SJohannes Berg  *
267174beb6SJohannes Berg  * BSD LICENSE
277174beb6SJohannes Berg  *
287174beb6SJohannes Berg  * Copyright(c) 2017 Intel Deutschland GmbH
297174beb6SJohannes Berg  * All rights reserved.
307174beb6SJohannes Berg  *
317174beb6SJohannes Berg  * Redistribution and use in source and binary forms, with or without
327174beb6SJohannes Berg  * modification, are permitted provided that the following conditions
337174beb6SJohannes Berg  * are met:
347174beb6SJohannes Berg  *
357174beb6SJohannes Berg  *  * Redistributions of source code must retain the above copyright
367174beb6SJohannes Berg  *    notice, this list of conditions and the following disclaimer.
377174beb6SJohannes Berg  *  * Redistributions in binary form must reproduce the above copyright
387174beb6SJohannes Berg  *    notice, this list of conditions and the following disclaimer in
397174beb6SJohannes Berg  *    the documentation and/or other materials provided with the
407174beb6SJohannes Berg  *    distribution.
417174beb6SJohannes Berg  *  * Neither the name Intel Corporation nor the names of its
427174beb6SJohannes Berg  *    contributors may be used to endorse or promote products derived
437174beb6SJohannes Berg  *    from this software without specific prior written permission.
447174beb6SJohannes Berg  *
457174beb6SJohannes Berg  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
467174beb6SJohannes Berg  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
477174beb6SJohannes Berg  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
487174beb6SJohannes Berg  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
497174beb6SJohannes Berg  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
507174beb6SJohannes Berg  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
517174beb6SJohannes Berg  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
527174beb6SJohannes Berg  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
537174beb6SJohannes Berg  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
547174beb6SJohannes Berg  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
557174beb6SJohannes Berg  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
567174beb6SJohannes Berg  *
577174beb6SJohannes Berg  *****************************************************************************/
587174beb6SJohannes Berg #include "iwl-drv.h"
597174beb6SJohannes Berg #include "runtime.h"
607174beb6SJohannes Berg #include "dbg.h"
61*93b167c1SMordechay Goodstein #include "debugfs.h"
627174beb6SJohannes Berg 
637174beb6SJohannes Berg void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
647174beb6SJohannes Berg 			const struct iwl_fw *fw,
65*93b167c1SMordechay Goodstein 			const struct iwl_fw_runtime_ops *ops, void *ops_ctx,
66*93b167c1SMordechay Goodstein 			struct dentry *dbgfs_dir)
677174beb6SJohannes Berg {
687174beb6SJohannes Berg 	memset(fwrt, 0, sizeof(*fwrt));
697174beb6SJohannes Berg 	fwrt->trans = trans;
707174beb6SJohannes Berg 	fwrt->fw = fw;
717174beb6SJohannes Berg 	fwrt->dev = trans->dev;
727174beb6SJohannes Berg 	fwrt->dump.conf = FW_DBG_INVALID;
737174beb6SJohannes Berg 	fwrt->ops = ops;
747174beb6SJohannes Berg 	fwrt->ops_ctx = ops_ctx;
757174beb6SJohannes Berg 	INIT_DELAYED_WORK(&fwrt->dump.wk, iwl_fw_error_dump_wk);
76*93b167c1SMordechay Goodstein 	iwl_fwrt_dbgfs_register(fwrt, dbgfs_dir);
777174beb6SJohannes Berg }
787174beb6SJohannes Berg IWL_EXPORT_SYMBOL(iwl_fw_runtime_init);
79*93b167c1SMordechay Goodstein 
80*93b167c1SMordechay Goodstein void iwl_fw_runtime_exit(struct iwl_fw_runtime *fwrt)
81*93b167c1SMordechay Goodstein {
82*93b167c1SMordechay Goodstein 	iwl_fw_cancel_timestamp(fwrt);
83*93b167c1SMordechay Goodstein }
84*93b167c1SMordechay Goodstein IWL_EXPORT_SYMBOL(iwl_fw_runtime_exit);
85