Merge tag 'v4.4-rc2'
[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_LOGV("int_config     = %02x\n", mpu_gyro_cfg->int_config);
54         MPL_LOGV("ext_sync       = %02x\n", mpu_gyro_cfg->ext_sync);
55         MPL_LOGV("full_scale     = %02x\n", mpu_gyro_cfg->full_scale);
56         MPL_LOGV("lpf            = %02x\n", mpu_gyro_cfg->lpf);
57         MPL_LOGV("clk_src        = %02x\n", mpu_gyro_cfg->clk_src);
58         MPL_LOGV("divider        = %02x\n", mpu_gyro_cfg->divider);
59         MPL_LOGV("dmp_enable     = %02x\n", mpu_gyro_cfg->dmp_enable);
60         MPL_LOGV("fifo_enable    = %02x\n", mpu_gyro_cfg->fifo_enable);
61         MPL_LOGV("dmp_cfg1       = %02x\n", mpu_gyro_cfg->dmp_cfg1);
62         MPL_LOGV("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         MPL_LOGV("accel_sens_trim  = %02x\n", mpu_chip_info->accel_sens_trim);
79
80         MPL_LOGV("requested_sensors = %04x\n", inv_mpu_cfg->requested_sensors);
81         MPL_LOGV("ignore_system_suspend= %04x\n",
82                 inv_mpu_cfg->ignore_system_suspend);
83         MPL_LOGV("status = %04x\n", inv_mpu_state->status);
84         MPL_LOGV("i2c_slaves_enabled= %04x\n",
85                 inv_mpu_state->i2c_slaves_enabled);
86
87         for (ii = 0; ii < EXT_SLAVE_NUM_TYPES; ii++) {
88                 if (!slave[ii])
89                         continue;
90                 MPL_LOGV("SLAVE %d:\n", ii);
91                 MPL_LOGV("    suspend  = %pf\n", slave[ii]->suspend);
92                 MPL_LOGV("    resume   = %pf\n", slave[ii]->resume);
93                 MPL_LOGV("    read     = %pf\n", slave[ii]->read);
94                 MPL_LOGV("    type     = %02x\n", slave[ii]->type);
95                 MPL_LOGV("    reg      = %02x\n", slave[ii]->read_reg);
96                 MPL_LOGV("    len      = %02x\n", slave[ii]->read_len);
97                 MPL_LOGV("    endian   = %02x\n", slave[ii]->endian);
98                 MPL_LOGV("    range.mantissa= %02x\n",
99                         slave[ii]->range.mantissa);
100                 MPL_LOGV("    range.fraction= %02x\n",
101                         slave[ii]->range.fraction);
102         }
103
104         for (ii = 0; ii < EXT_SLAVE_NUM_TYPES; ii++) {
105                 if (!pdata_slave[ii])
106                         continue;
107                 MPL_LOGV("PDATA_SLAVE[%d]\n", ii);
108                 MPL_LOGV("    irq        = %02x\n", pdata_slave[ii]->irq);
109                 MPL_LOGV("    adapt_num  = %02x\n", pdata_slave[ii]->adapt_num);
110                 MPL_LOGV("    bus        = %02x\n", pdata_slave[ii]->bus);
111                 MPL_LOGV("    address    = %02x\n", pdata_slave[ii]->address);
112                 MPL_LOGV("    orientation=\n"
113                         "                            %2d %2d %2d\n"
114                         "                            %2d %2d %2d\n"
115                         "                            %2d %2d %2d\n",
116                         pdata_slave[ii]->orientation[0],
117                         pdata_slave[ii]->orientation[1],
118                         pdata_slave[ii]->orientation[2],
119                         pdata_slave[ii]->orientation[3],
120                         pdata_slave[ii]->orientation[4],
121                         pdata_slave[ii]->orientation[5],
122                         pdata_slave[ii]->orientation[6],
123                         pdata_slave[ii]->orientation[7],
124                         pdata_slave[ii]->orientation[8]);
125         }
126
127         MPL_LOGV("pdata->int_config         = %02x\n", pdata->int_config);
128         MPL_LOGV("pdata->level_shifter      = %02x\n", pdata->level_shifter);
129         MPL_LOGV("pdata->orientation        =\n"
130                  "                            %2d %2d %2d\n"
131                  "                            %2d %2d %2d\n"
132                  "                            %2d %2d %2d\n",
133                  pdata->orientation[0], pdata->orientation[1],
134                  pdata->orientation[2], pdata->orientation[3],
135                  pdata->orientation[4], pdata->orientation[5],
136                  pdata->orientation[6], pdata->orientation[7],
137                  pdata->orientation[8]);
138 }