Merge remote-tracking branch 'stable/linux-3.0.y' into develop-3.0-jb
[firefly-linux-kernel-4.4.55.git] / drivers / misc / inv_mpu / mldl_print_cfg.c
1 /*
2         $License:
3         Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
4
5         This program is free software; you can redistribute it and/or modify
6         it under the terms of the GNU General Public License as published by
7         the Free Software Foundation; either version 2 of the License, or
8         (at your option) any later version.
9
10         This program is distributed in the hope that it will be useful,
11         but WITHOUT ANY WARRANTY; without even the implied warranty of
12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13         GNU General Public License for more details.
14
15         You should have received a copy of the GNU General Public License
16         along with this program.  If not, see <http://www.gnu.org/licenses/>.
17         $
18  */
19
20 /**
21  *  @addtogroup MLDL
22  *
23  *  @{
24  *      @file   mldl_print_cfg.c
25  *      @brief  The Motion Library Driver Layer.
26  */
27
28 #include <stddef.h>
29 #include "mldl_cfg.h"
30 #include "mlsl.h"
31 #include "linux/mpu.h"
32
33 #include "log.h"
34 #undef MPL_LOG_TAG
35 #define MPL_LOG_TAG "mldl_print_cfg:"
36
37 #undef MPL_LOG_NDEBUG
38 #define MPL_LOG_NDEBUG 0
39
40 void mldl_print_cfg(struct mldl_cfg *mldl_cfg)
41 {
42         struct mpu_gyro_cfg     *mpu_gyro_cfg   = mldl_cfg->mpu_gyro_cfg;
43         struct mpu_offsets      *mpu_offsets    = mldl_cfg->mpu_offsets;
44         struct mpu_chip_info    *mpu_chip_info  = mldl_cfg->mpu_chip_info;
45         struct inv_mpu_cfg      *inv_mpu_cfg    = mldl_cfg->inv_mpu_cfg;
46         struct inv_mpu_state    *inv_mpu_state  = mldl_cfg->inv_mpu_state;
47         struct ext_slave_descr  **slave         = mldl_cfg->slave;
48         struct mpu_platform_data *pdata         = mldl_cfg->pdata;
49         struct ext_slave_platform_data **pdata_slave = mldl_cfg->pdata_slave;
50         int ii;
51
52         /* mpu_gyro_cfg */
53         MPL_LOGI("int_config     = %02x\n", mpu_gyro_cfg->int_config);
54         MPL_LOGI("ext_sync       = %02x\n", mpu_gyro_cfg->ext_sync);
55         MPL_LOGI("full_scale     = %02x\n", mpu_gyro_cfg->full_scale);
56         MPL_LOGI("lpf            = %02x\n", mpu_gyro_cfg->lpf);
57         MPL_LOGI("clk_src        = %02x\n", mpu_gyro_cfg->clk_src);
58         MPL_LOGI("divider        = %02x\n", mpu_gyro_cfg->divider);
59         MPL_LOGI("dmp_enable     = %02x\n", mpu_gyro_cfg->dmp_enable);
60         MPL_LOGI("fifo_enable    = %02x\n", mpu_gyro_cfg->fifo_enable);
61         MPL_LOGI("dmp_cfg1       = %02x\n", mpu_gyro_cfg->dmp_cfg1);
62         MPL_LOGI("dmp_cfg2       = %02x\n", mpu_gyro_cfg->dmp_cfg2);
63         /* mpu_offsets */
64         MPL_LOGV("tc[0]      = %02x\n", mpu_offsets->tc[0]);
65         MPL_LOGV("tc[1]      = %02x\n", mpu_offsets->tc[1]);
66         MPL_LOGV("tc[2]      = %02x\n", mpu_offsets->tc[2]);
67         MPL_LOGV("gyro[0]    = %04x\n", mpu_offsets->gyro[0]);
68         MPL_LOGV("gyro[1]    = %04x\n", mpu_offsets->gyro[1]);
69         MPL_LOGV("gyro[2]    = %04x\n", mpu_offsets->gyro[2]);
70
71         /* mpu_chip_info */
72         MPL_LOGV("addr            = %02x\n", mldl_cfg->mpu_chip_info->addr);
73
74         MPL_LOGV("silicon_revision = %02x\n", mpu_chip_info->silicon_revision);
75         MPL_LOGV("product_revision = %02x\n", mpu_chip_info->product_revision);
76         MPL_LOGV("product_id       = %02x\n", mpu_chip_info->product_id);
77         MPL_LOGV("gyro_sens_trim   = %02x\n", mpu_chip_info->gyro_sens_trim);
78
79         MPL_LOGV("requested_sensors = %04x\n", inv_mpu_cfg->requested_sensors);
80         MPL_LOGV("ignore_system_suspend= %04x\n",
81                 inv_mpu_cfg->ignore_system_suspend);
82         MPL_LOGV("status = %04x\n", inv_mpu_state->status);
83         MPL_LOGV("i2c_slaves_enabled= %04x\n",
84                 inv_mpu_state->i2c_slaves_enabled);
85
86         for (ii = 0; ii < EXT_SLAVE_NUM_TYPES; ii++) {
87                 if (!slave[ii])
88                         continue;
89                 MPL_LOGV("SLAVE %d:\n", ii);
90                 MPL_LOGV("    suspend  = %02x\n", (int)slave[ii]->suspend);
91                 MPL_LOGV("    resume   = %02x\n", (int)slave[ii]->resume);
92                 MPL_LOGV("    read     = %02x\n", (int)slave[ii]->read);
93                 MPL_LOGV("    type     = %02x\n", slave[ii]->type);
94                 MPL_LOGV("    reg      = %02x\n", slave[ii]->read_reg);
95                 MPL_LOGV("    len      = %02x\n", slave[ii]->read_len);
96                 MPL_LOGV("    endian   = %02x\n", slave[ii]->endian);
97                 MPL_LOGV("    range.mantissa= %02x\n",
98                         slave[ii]->range.mantissa);
99                 MPL_LOGV("    range.fraction= %02x\n",
100                         slave[ii]->range.fraction);
101         }
102
103         for (ii = 0; ii < EXT_SLAVE_NUM_TYPES; ii++) {
104                 if (!pdata_slave[ii])
105                         continue;
106                 MPL_LOGV("PDATA_SLAVE[%d]\n", ii);
107                 MPL_LOGV("    irq        = %02x\n", pdata_slave[ii]->irq);
108                 MPL_LOGV("    adapt_num  = %02x\n", pdata_slave[ii]->adapt_num);
109                 MPL_LOGV("    bus        = %02x\n", pdata_slave[ii]->bus);
110                 MPL_LOGV("    address    = %02x\n", pdata_slave[ii]->address);
111                 MPL_LOGV("    orientation=\n"
112                         "                            %2d %2d %2d\n"
113                         "                            %2d %2d %2d\n"
114                         "                            %2d %2d %2d\n",
115                         pdata_slave[ii]->orientation[0],
116                         pdata_slave[ii]->orientation[1],
117                         pdata_slave[ii]->orientation[2],
118                         pdata_slave[ii]->orientation[3],
119                         pdata_slave[ii]->orientation[4],
120                         pdata_slave[ii]->orientation[5],
121                         pdata_slave[ii]->orientation[6],
122                         pdata_slave[ii]->orientation[7],
123                         pdata_slave[ii]->orientation[8]);
124         }
125
126         MPL_LOGV("pdata->int_config         = %02x\n", pdata->int_config);
127         MPL_LOGV("pdata->level_shifter      = %02x\n", pdata->level_shifter);
128         MPL_LOGV("pdata->orientation        =\n"
129                  "                            %2d %2d %2d\n"
130                  "                            %2d %2d %2d\n"
131                  "                            %2d %2d %2d\n",
132                  pdata->orientation[0], pdata->orientation[1],
133                  pdata->orientation[2], pdata->orientation[3],
134                  pdata->orientation[4], pdata->orientation[5],
135                  pdata->orientation[6], pdata->orientation[7],
136                  pdata->orientation[8]);
137 }