comparison driver/pt1_pci.c @ 86:015481a6a900

clean up a bit.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 19 Jan 2010 06:33:08 +0900
parents cfb2da5ee428
children c6311b6efd9c
comparison
equal deleted inserted replaced
85:28ba9315a30c 86:015481a6a900
135 wait_queue_head_t wait_q ; // for poll on reading 135 wait_queue_head_t wait_q ; // for poll on reading
136 }; 136 };
137 137
138 // I2Cアドレス(video0, 1 = ISDB-S) (video2, 3 = ISDB-T) 138 // I2Cアドレス(video0, 1 = ISDB-S) (video2, 3 = ISDB-T)
139 int i2c_address[MAX_CHANNEL] = {T0_ISDB_S, T1_ISDB_S, T0_ISDB_T, T1_ISDB_T}; 139 int i2c_address[MAX_CHANNEL] = {T0_ISDB_S, T1_ISDB_S, T0_ISDB_T, T1_ISDB_T};
140 int real_chanel[MAX_CHANNEL] = {0, 2, 1, 3}; 140 int real_channel[MAX_CHANNEL] = {0, 2, 1, 3};
141 int channeltype[MAX_CHANNEL] = {CHANNEL_TYPE_ISDB_S, CHANNEL_TYPE_ISDB_S, 141 int channeltype[MAX_CHANNEL] = {CHANNEL_TYPE_ISDB_S, CHANNEL_TYPE_ISDB_S,
142 CHANNEL_TYPE_ISDB_T, CHANNEL_TYPE_ISDB_T}; 142 CHANNEL_TYPE_ISDB_T, CHANNEL_TYPE_ISDB_T};
143 143
144 static PT1_DEVICE *device[MAX_PCI_DEVICE]; 144 static PT1_DEVICE *device[MAX_PCI_DEVICE];
145 static struct class *pt1video_class; 145 static struct class *pt1video_class;
221 //チャネル情報不正 221 //チャネル情報不正
222 if(dma_channel > MAX_CHANNEL){ 222 if(dma_channel > MAX_CHANNEL){
223 printk(KERN_ERR "DMA Channel Number Error(%d)\n", dma_channel); 223 printk(KERN_ERR "DMA Channel Number Error(%d)\n", dma_channel);
224 continue ; 224 continue ;
225 } 225 }
226 chno = real_chanel[(((micro.packet.head >> 5) & 0x07) - 1)]; 226 chno = real_channel[(((micro.packet.head >> 5) & 0x07) - 1)];
227 packet_pos = ((micro.packet.head >> 2) & 0x07); 227 packet_pos = ((micro.packet.head >> 2) & 0x07);
228 channel = dev_conf->channel[chno] ; 228 channel = dev_conf->channel[chno] ;
229 // エラーチェック 229 // エラーチェック
230 if((micro.packet.head & MICROPACKET_ERROR)){ 230 if((micro.packet.head & MICROPACKET_ERROR)){
231 val = readl(dev_conf->regs); 231 val = readl(dev_conf->regs);
309 } 309 }
310 } 310 }
311 311
312 // 頻度を落す(4Kで起動させる) 312 // 頻度を落す(4Kで起動させる)
313 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ 313 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){
314 channel = dev_conf->channel[real_chanel[lp]] ; 314 channel = dev_conf->channel[real_channel[lp]] ;
315 if((channel->size >= DMA_SIZE) && (channel->valid == TRUE)){ 315 if((channel->size >= DMA_SIZE) && (channel->valid == TRUE)){
316 wake_up(&channel->wait_q); 316 wake_up(&channel->wait_q);
317 } 317 }
318 } 318 }
319 } 319 }
505 SetStream(channel->ptr->regs, channel->channel, FALSE); 505 SetStream(channel->ptr->regs, channel->channel, FALSE);
506 return 0 ; 506 return 0 ;
507 case GET_SIGNAL_STRENGTH: 507 case GET_SIGNAL_STRENGTH:
508 switch(channel->type){ 508 switch(channel->type){
509 case CHANNEL_TYPE_ISDB_S: 509 case CHANNEL_TYPE_ISDB_S:
510 { 510 signal = isdb_s_read_signal_strength(channel->ptr->regs,
511 signal = isdb_s_read_signal_strength(channel->ptr->regs, 511 &channel->ptr->lock,
512 &channel->ptr->lock, 512 channel->address);
513 channel->address);
514 }
515 break ; 513 break ;
516 case CHANNEL_TYPE_ISDB_T: 514 case CHANNEL_TYPE_ISDB_T:
517 // calc C/N
518 signal = isdb_t_read_signal_strength(channel->ptr->regs, 515 signal = isdb_t_read_signal_strength(channel->ptr->regs,
519 &channel->ptr->lock, channel->address); 516 &channel->ptr->lock, channel->address);
520 break ; 517 break ;
521 } 518 }
522 dummy = copy_to_user(arg, &signal, sizeof(int)); 519 dummy = copy_to_user(arg, &signal, sizeof(int));
772 channel->minor = MINOR(dev_conf->dev) + lp ; 769 channel->minor = MINOR(dev_conf->dev) + lp ;
773 // 対象のI2Cデバイス 770 // 対象のI2Cデバイス
774 channel->address = i2c_address[lp] ; 771 channel->address = i2c_address[lp] ;
775 channel->type = channeltype[lp] ; 772 channel->type = channeltype[lp] ;
776 // 実際のチューナ番号 773 // 実際のチューナ番号
777 channel->channel = real_chanel[lp] ; 774 channel->channel = real_channel[lp] ;
778 channel->ptr = dev_conf ; 775 channel->ptr = dev_conf ;
779 channel->size = 0 ; 776 channel->size = 0 ;
780 dev_conf->channel[lp] = channel ; 777 dev_conf->channel[lp] = channel ;
781 778
782 init_waitqueue_head(&channel->wait_q); 779 init_waitqueue_head(&channel->wait_q);