3 * Copyright (c) 2010-2015 Samsung Electronics Co., Ltd.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
14 #error SIM_SLOT_PIN should be have a value. but not defined.
17 static int check_simslot_count(struct seq_file *m, void *v)
21 int support_number_of_simslot;
22 support_number_of_simslot = DUAL_SIM;
23 pr_info("SIM_SLOT_COUNT = %d\n", support_number_of_simslot);
25 int retval, support_number_of_simslot;
26 retval = gpio_request(SIM_SLOT_PIN, "SIM_SLOT_PIN");
28 pr_err("%s:Failed to reqeust GPIO, code = %d.\n",
30 support_number_of_simslot = retval;
32 retval = gpio_direction_input(SIM_SLOT_PIN);
35 pr_err("%s:Failed to set direction of GPIO, code = %d.\n",
37 support_number_of_simslot = retval;
39 retval = gpio_get_value(SIM_SLOT_PIN);
41 /* This codes are implemented assumption that count
42 of GPIO about simslot is only one on H/W schematic.
43 You may change this codes if count of GPIO about
46 case SINGLE_SIM_VALUE:
47 support_number_of_simslot = SINGLE_SIM;
48 pr_info("\n SIM_SLOT_PIN gpio %d : Single Sim mode \n", SIM_SLOT_PIN);
51 support_number_of_simslot = DUAL_SIM;
52 pr_info("\n SIM_SLOT_PIN gpio %d : Dual Sim mode \n", SIM_SLOT_PIN);
55 support_number_of_simslot = -1;
59 gpio_free(SIM_SLOT_PIN);
62 if (support_number_of_simslot < 0) {
63 pr_err("******* Make a forced kernel panic because can't check simslot count******\n");
64 panic("kernel panic");
67 seq_printf(m, "%u\n", support_number_of_simslot);
73 static int check_simslot_count_open(struct inode *inode, struct file *file)
75 return single_open(file, check_simslot_count, NULL);
78 static const struct file_operations check_simslot_count_fops = {
79 .open = check_simslot_count_open,
82 .release = single_release,
85 static int __init simslot_count_init(void)
88 if (!proc_create("simslot_count", 0, NULL, &check_simslot_count_fops)) {
89 pr_err("***** Make a forced kernel panic because can't make a simslot_count file node ******\n");
90 panic("kernel panic");
96 late_initcall(simslot_count_init);