hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/media/i2c/nvp6158_drv/nvp6158_dev.c
....@@ -83,7 +83,7 @@
8383 }
8484
8585 static int nvp6158_restore(struct himedia_device* pdev)
86
-{
86
+{
8787 printk(KERN_ALERT "%s %d\n", __FUNCTION__, __LINE__);
8888 return 0;
8989 }
....@@ -91,7 +91,7 @@
9191
9292 static const struct file_operations nvp6158_fops = {
9393 .owner = THIS_MODULE,
94
- .unlocked_ioctl = nvp6158_native_ioctl,
94
+ .unlocked_ioctl = nvp6158_native_ioctl,
9595 .open = nvp6158_open,
9696 .release = nvp6158_close,
9797 };
....@@ -122,25 +122,21 @@
122122 unsigned char ch = 0;
123123
124124 memset(&s_nvp6158_vfmts, 0, sizeof(NVP6158_INFORMATION_S));
125
-
126
- while(!kthread_should_stop())
127
- {
125
+
126
+ while(!kthread_should_stop()) {
128127 #if 1 //standard rutine of a process
129128 down(&nvp6158_lock);
130129 ch = ch % (nvp6158_cnt*4);
131130 nvp6158_getvideoloss();
132
- if(nvp6158_chip_id[0]==NVP6158C_R0_ID || nvp6158_chip_id[0]==NVP6158_R0_ID)
133
- {
131
+ if(nvp6158_chip_id[0]==NVP6158C_R0_ID || nvp6158_chip_id[0]==NVP6158_R0_ID) {
134132 nvp6158_video_fmt_det(ch, &s_nvp6158_vfmts);
135133 curfmt = s_nvp6158_vfmts.curvideofmt[ch];
136134 prefmt = s_nvp6158_vfmts.prevideofmt[ch];
137135 chvloss = s_nvp6158_vfmts.curvideoloss[ch];
138136 //printk(">>>>>>%s CH[%d] chvloss = %d curfmt = %x prefmt = %x\n", __func__, ch, chvloss, curfmt, prefmt);
139137
140
- if(chvloss == 0x00)
141
- {
142
- if(nvp6158_ch_mode_status[ch] != prefmt)
143
- {
138
+ if(chvloss == 0x00) {
139
+ if(nvp6158_ch_mode_status[ch] != prefmt) {
144140 nvp6158_set_chnmode(ch, curfmt);
145141 nvp6158_set_portmode(0, ch%4, NVP6158_OUTMODE_1MUX_FHD, ch%4);
146142 s_eq_info.Ch = ch%4;
....@@ -148,32 +144,26 @@
148144 s_eq_info.FmtDef = curfmt;
149145 nvp6158_get_eq_dist(&s_eq_info);
150146 s_nvp6158_vfmts.prevideofmt[ch] = curfmt;
151
- printk(">>>>>>%s CH[%d] s_eq_info.distance = %d\n", __func__, ch, s_eq_info.distance);
147
+ printk(">>>>>>%s CH[%d] s_eq_info.distance = %d\n",
148
+ __func__, ch, s_eq_info.distance);
152149 nvp6158_set_equalizer(&s_eq_info);
153150
154151 }
155
- }
156
- else
157
- {
158
- if(nvp6158_ch_mode_status[ch] != NC_VIVO_CH_FORMATDEF_UNKNOWN)
159
- {
152
+ } else {
153
+ if(nvp6158_ch_mode_status[ch] != NC_VIVO_CH_FORMATDEF_UNKNOWN) {
160154 nvp6158_set_chnmode(ch, NC_VIVO_CH_FORMATDEF_UNKNOWN);
161155 nvp6158_set_portmode(0, ch%4, NVP6158_OUTMODE_1MUX_FHD, ch%4);
162156 }
163
- }
164
- }
165
- else
166
- {
157
+ }
158
+ } else {
167159 nvp6168_video_fmt_det(ch, &s_nvp6158_vfmts);
168160 curfmt = s_nvp6158_vfmts.curvideofmt[ch];
169161 prefmt = s_nvp6158_vfmts.prevideofmt[ch];
170162 chvloss = s_nvp6158_vfmts.curvideoloss[ch];
171163 //printk(">>>>>>%s CH[%d] chvloss = %d curfmt = %x prefmt = %x nvp6158_ch_mode_status[%d]=%x\n", __func__, ch, chvloss, curfmt, prefmt, ch, nvp6158_ch_mode_status[ch]);
172
-
173
- if(chvloss == 0x00)
174
- {
175
- if(nvp6158_ch_mode_status[ch] != prefmt)
176
- {
164
+
165
+ if(chvloss == 0x00) {
166
+ if(nvp6158_ch_mode_status[ch] != prefmt) {
177167 nvp6168_set_chnmode(ch, curfmt);
178168 nvp6158_set_portmode(0, ch%4, NVP6158_OUTMODE_1MUX_FHD, ch%4);
179169 s_eq_info.Ch = ch%4;
....@@ -184,16 +174,13 @@
184174 printk(">>>>>>%s CH[%d] s_eq_info.distance = %d\n", __func__, ch, s_eq_info.distance);
185175 nvp6168_set_equalizer(&s_eq_info);
186176 }
187
- }
188
- else
189
- {
190
- if(nvp6158_ch_mode_status[ch] != NC_VIVO_CH_FORMATDEF_UNKNOWN)
191
- {
177
+ } else {
178
+ if(nvp6158_ch_mode_status[ch] != NC_VIVO_CH_FORMATDEF_UNKNOWN) {
192179 nvp6168_set_chnmode(ch, NC_VIVO_CH_FORMATDEF_UNKNOWN);
193180 nvp6158_set_portmode(0, ch%4, NVP6158_OUTMODE_1MUX_FHD, ch%4);
194181 }
195
- }
196
- }
182
+ }
183
+ }
197184 ch ++;
198185 up(&nvp6158_lock);
199186 #endif
....@@ -234,23 +221,21 @@
234221 int ret = 0;
235222 //char entry[20];
236223 #ifdef CONFIG_HISI_SNAPSHOT_BOOT
237
- snprintf(s_stNvp6158Device.devfs_name, sizeof(s_stNvp6158Device.devfs_name), DEV_NAME);
238
- s_stNvp6158Device.minor = HIMEDIA_DYNAMIC_MINOR;
239
- s_stNvp6158Device.fops = &nvp6158_fops;
240
- s_stNvp6158Device.drvops = &stNvp6158DrvOps;
241
- s_stNvp6158Device.owner = THIS_MODULE;
224
+ snprintf(s_stNvp6158Device.devfs_name, sizeof(s_stNvp6158Device.devfs_name), DEV_NAME);
225
+ s_stNvp6158Device.minor = HIMEDIA_DYNAMIC_MINOR;
226
+ s_stNvp6158Device.fops = &nvp6158_fops;
227
+ s_stNvp6158Device.drvops = &stNvp6158DrvOps;
228
+ s_stNvp6158Device.owner = THIS_MODULE;
242229
243
- ret = himedia_register(&s_stNvp6158Device);
244
- if (ret)
245
- {
246
- printk(0, "could not register nvp6158_dev device");
247
- return -1;
248
- }
230
+ ret = himedia_register(&s_stNvp6158Device);
231
+ if (ret) {
232
+ printk(0, "could not register nvp6158_dev device");
233
+ return -1;
234
+ }
249235 #else
250236 ret = misc_register(&nvp6158_dev);
251
- if (ret)
252
- {
253
- printk("ERROR: could not register nvp6158_dev devices:%#x \n",ret);
237
+ if (ret) {
238
+ printk("ERROR: could not register nvp6158_dev devices:%#x \n",ret);
254239 return -1;
255240 }
256241 #endif
....@@ -258,8 +243,7 @@
258243 #ifdef STREAM_ON_DEFLAULT
259244 //printk("NVP6158/68(C) ex Driver %s COMPILE TIME[%s %s]\n", NVP6158_DRIVER_VER, __DATE__,__TIME__);
260245 nvp6158_init(I2C_1);
261
- if (ret)
262
- {
246
+ if (ret) {
263247 printk(KERN_ERR "ERROR: jaguar1 init failed\n");
264248 return -1;
265249 }
....@@ -267,18 +251,17 @@
267251 nvp6158_video_decoder_init();
268252 /* initialize Audio
269253 * recmaster, pbmaster, ch_num, samplerate, bits */
270
- if(nvp6158_chip_id[0]==NVP6158C_R0_ID || nvp6158_chip_id[0]==NVP6158_R0_ID)
271
- nvp6158_audio_init(1,0,16,0,0);
254
+ if(nvp6158_chip_id[0] == NVP6158C_R0_ID || nvp6158_chip_id[0] == NVP6158_R0_ID)
255
+ nvp6158_audio_init(1, 0, 16, 0, 0);
272256 else
273
- nvp6168_audio_init(1,0,16,0,0);
257
+ nvp6168_audio_init(1, 0, 16, 0, 0);
274258 //VDO_1/2 enable, VCLK_x ebable
275259 gpio_i2c_write(0x60, 0xFF, 0x01);
276260 gpio_i2c_write(0x60, 0xCA, 0x66);
277261 up(&nvp6158_lock);
278262
279263 /* create kernel thread for EQ, But Now not used. */
280
- if(nvp6158_kthread == 1)
281
- {
264
+ if(nvp6158_kthread == 1) {
282265 nvp6158_kt = kthread_create(nvp6158_kernel_thread, NULL, "nvp6158_kt");
283266 if(!IS_ERR(nvp6158_kt))
284267 wake_up_process(nvp6158_kt);
....@@ -309,7 +292,7 @@
309292 himedia_unregister(&s_stNvp6158Device);
310293 #else
311294 misc_deregister(&nvp6158_dev);
312
-#endif
295
+#endif
313296 nvp6158_i2c_client_exit();
314297 //printk("NVP6158(C) ex Driver %s COMPILE TIME[%s %s] removed\n", NVP6158_DRIVER_VER, __DATE__,__TIME__);
315298 }