18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * w1_smem.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <asm/types.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/kernel.h> 118c2ecf20Sopenharmony_ci#include <linux/module.h> 128c2ecf20Sopenharmony_ci#include <linux/moduleparam.h> 138c2ecf20Sopenharmony_ci#include <linux/device.h> 148c2ecf20Sopenharmony_ci#include <linux/types.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/w1.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define W1_FAMILY_SMEM_01 0x01 198c2ecf20Sopenharmony_ci#define W1_FAMILY_SMEM_81 0x81 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistatic struct w1_family w1_smem_family_01 = { 228c2ecf20Sopenharmony_ci .fid = W1_FAMILY_SMEM_01, 238c2ecf20Sopenharmony_ci}; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistatic struct w1_family w1_smem_family_81 = { 268c2ecf20Sopenharmony_ci .fid = W1_FAMILY_SMEM_81, 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistatic int __init w1_smem_init(void) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci int err; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci err = w1_register_family(&w1_smem_family_01); 348c2ecf20Sopenharmony_ci if (err) 358c2ecf20Sopenharmony_ci return err; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci err = w1_register_family(&w1_smem_family_81); 388c2ecf20Sopenharmony_ci if (err) { 398c2ecf20Sopenharmony_ci w1_unregister_family(&w1_smem_family_01); 408c2ecf20Sopenharmony_ci return err; 418c2ecf20Sopenharmony_ci } 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci return 0; 448c2ecf20Sopenharmony_ci} 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cistatic void __exit w1_smem_fini(void) 478c2ecf20Sopenharmony_ci{ 488c2ecf20Sopenharmony_ci w1_unregister_family(&w1_smem_family_01); 498c2ecf20Sopenharmony_ci w1_unregister_family(&w1_smem_family_81); 508c2ecf20Sopenharmony_ci} 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_cimodule_init(w1_smem_init); 538c2ecf20Sopenharmony_cimodule_exit(w1_smem_fini); 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciMODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); 568c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); 578c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 588c2ecf20Sopenharmony_ciMODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_SMEM_01)); 598c2ecf20Sopenharmony_ciMODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_SMEM_81)); 60