Searched refs:pt1 (Results 1 - 5 of 5) sorted by relevance

/linux-4.1.27/drivers/media/pci/pt1/
H A DMakefile1 earth-pt1-objs := pt1.o va1j5jf8007s.o va1j5jf8007t.o
3 obj-$(CONFIG_DVB_PT1) += earth-pt1.o
H A Dpt1.c42 #define DRIVER_NAME "earth-pt1"
73 struct pt1 { struct
90 struct pt1 *pt1; member in struct:pt1_adapter
112 static void pt1_write_reg(struct pt1 *pt1, int reg, u32 data) pt1_write_reg() argument
114 writel(data, pt1->regs + reg * 4); pt1_write_reg()
117 static u32 pt1_read_reg(struct pt1 *pt1, int reg) pt1_read_reg() argument
119 return readl(pt1->regs + reg * 4); pt1_read_reg()
125 static void pt1_increment_table_count(struct pt1 *pt1) pt1_increment_table_count() argument
127 pt1_write_reg(pt1, 0, 0x00000020); pt1_increment_table_count()
130 static void pt1_init_table_count(struct pt1 *pt1) pt1_init_table_count() argument
132 pt1_write_reg(pt1, 0, 0x00000010); pt1_init_table_count()
135 static void pt1_register_tables(struct pt1 *pt1, u32 first_pfn) pt1_register_tables() argument
137 pt1_write_reg(pt1, 5, first_pfn); pt1_register_tables()
138 pt1_write_reg(pt1, 0, 0x0c000040); pt1_register_tables()
141 static void pt1_unregister_tables(struct pt1 *pt1) pt1_unregister_tables() argument
143 pt1_write_reg(pt1, 0, 0x08080000); pt1_unregister_tables()
146 static int pt1_sync(struct pt1 *pt1) pt1_sync() argument
150 if (pt1_read_reg(pt1, 0) & 0x20000000) pt1_sync()
152 pt1_write_reg(pt1, 0, 0x00000008); pt1_sync()
154 dev_err(&pt1->pdev->dev, "could not sync\n"); pt1_sync()
158 static u64 pt1_identify(struct pt1 *pt1) pt1_identify() argument
164 id |= (u64)(pt1_read_reg(pt1, 0) >> 30 & 1) << i; pt1_identify()
165 pt1_write_reg(pt1, 0, 0x00000008); pt1_identify()
170 static int pt1_unlock(struct pt1 *pt1) pt1_unlock() argument
173 pt1_write_reg(pt1, 0, 0x00000008); pt1_unlock()
175 if (pt1_read_reg(pt1, 0) & 0x80000000) pt1_unlock()
179 dev_err(&pt1->pdev->dev, "could not unlock\n"); pt1_unlock()
183 static int pt1_reset_pci(struct pt1 *pt1) pt1_reset_pci() argument
186 pt1_write_reg(pt1, 0, 0x01010000); pt1_reset_pci()
187 pt1_write_reg(pt1, 0, 0x01000000); pt1_reset_pci()
189 if (pt1_read_reg(pt1, 0) & 0x00000001) pt1_reset_pci()
193 dev_err(&pt1->pdev->dev, "could not reset PCI\n"); pt1_reset_pci()
197 static int pt1_reset_ram(struct pt1 *pt1) pt1_reset_ram() argument
200 pt1_write_reg(pt1, 0, 0x02020000); pt1_reset_ram()
201 pt1_write_reg(pt1, 0, 0x02000000); pt1_reset_ram()
203 if (pt1_read_reg(pt1, 0) & 0x00000002) pt1_reset_ram()
207 dev_err(&pt1->pdev->dev, "could not reset RAM\n"); pt1_reset_ram()
211 static int pt1_do_enable_ram(struct pt1 *pt1) pt1_do_enable_ram() argument
215 status = pt1_read_reg(pt1, 0) & 0x00000004; pt1_do_enable_ram()
216 pt1_write_reg(pt1, 0, 0x00000002); pt1_do_enable_ram()
219 if ((pt1_read_reg(pt1, 0) & 0x00000004) != status) pt1_do_enable_ram()
224 dev_err(&pt1->pdev->dev, "could not enable RAM\n"); pt1_do_enable_ram()
228 static int pt1_enable_ram(struct pt1 *pt1) pt1_enable_ram() argument
233 phase = pt1->pdev->device == 0x211a ? 128 : 166; pt1_enable_ram()
235 ret = pt1_do_enable_ram(pt1); pt1_enable_ram()
242 static void pt1_disable_ram(struct pt1 *pt1) pt1_disable_ram() argument
244 pt1_write_reg(pt1, 0, 0x0b0b0000); pt1_disable_ram()
247 static void pt1_set_stream(struct pt1 *pt1, int index, int enabled) pt1_set_stream() argument
249 pt1_write_reg(pt1, 2, 1 << (index + 8) | enabled << index); pt1_set_stream()
252 static void pt1_init_streams(struct pt1 *pt1) pt1_init_streams() argument
256 pt1_set_stream(pt1, i, 0); pt1_init_streams()
259 static int pt1_filter(struct pt1 *pt1, struct pt1_buffer_page *page) pt1_filter() argument
278 adap = pt1->adaps[index]; pt1_filter()
285 printk_ratelimited(KERN_INFO "earth-pt1: device " pt1_filter()
287 pt1->table_index, pt1->buf_index); pt1_filter()
290 printk_ratelimited(KERN_INFO "earth-pt1: data loss" pt1_filter()
316 struct pt1 *pt1; pt1_thread() local
319 pt1 = data; pt1_thread()
325 page = pt1->tables[pt1->table_index].bufs[pt1->buf_index].page; pt1_thread()
326 if (!pt1_filter(pt1, page)) { pt1_thread()
331 if (++pt1->buf_index >= PT1_NR_BUFS) { pt1_thread()
332 pt1_increment_table_count(pt1); pt1_thread()
333 pt1->buf_index = 0; pt1_thread()
334 if (++pt1->table_index >= pt1_nr_tables) pt1_thread()
335 pt1->table_index = 0; pt1_thread()
342 static void pt1_free_page(struct pt1 *pt1, void *page, dma_addr_t addr) pt1_free_page() argument
344 dma_free_coherent(&pt1->pdev->dev, PT1_PAGE_SIZE, page, addr); pt1_free_page()
347 static void *pt1_alloc_page(struct pt1 *pt1, dma_addr_t *addrp, u32 *pfnp) pt1_alloc_page() argument
352 page = dma_alloc_coherent(&pt1->pdev->dev, PT1_PAGE_SIZE, &addr, pt1_alloc_page()
365 static void pt1_cleanup_buffer(struct pt1 *pt1, struct pt1_buffer *buf) pt1_cleanup_buffer() argument
367 pt1_free_page(pt1, buf->page, buf->addr); pt1_cleanup_buffer()
371 pt1_init_buffer(struct pt1 *pt1, struct pt1_buffer *buf, u32 *pfnp) pt1_init_buffer() argument
376 page = pt1_alloc_page(pt1, &addr, pfnp); pt1_init_buffer()
387 static void pt1_cleanup_table(struct pt1 *pt1, struct pt1_table *table) pt1_cleanup_table() argument
392 pt1_cleanup_buffer(pt1, &table->bufs[i]); pt1_cleanup_table()
394 pt1_free_page(pt1, table->page, table->addr); pt1_cleanup_table()
398 pt1_init_table(struct pt1 *pt1, struct pt1_table *table, u32 *pfnp) pt1_init_table() argument
405 page = pt1_alloc_page(pt1, &addr, pfnp); pt1_init_table()
410 ret = pt1_init_buffer(pt1, &table->bufs[i], &buf_pfn); pt1_init_table()
417 pt1_increment_table_count(pt1); pt1_init_table()
424 pt1_cleanup_buffer(pt1, &table->bufs[i]); pt1_init_table()
426 pt1_free_page(pt1, page, addr); pt1_init_table()
430 static void pt1_cleanup_tables(struct pt1 *pt1) pt1_cleanup_tables() argument
435 tables = pt1->tables; pt1_cleanup_tables()
436 pt1_unregister_tables(pt1); pt1_cleanup_tables()
439 pt1_cleanup_table(pt1, &tables[i]); pt1_cleanup_tables()
444 static int pt1_init_tables(struct pt1 *pt1) pt1_init_tables() argument
454 pt1_init_table_count(pt1); pt1_init_tables()
458 ret = pt1_init_table(pt1, &tables[0], &first_pfn); pt1_init_tables()
465 ret = pt1_init_table(pt1, &tables[i], &pfn); pt1_init_tables()
474 pt1_register_tables(pt1, first_pfn); pt1_init_tables()
475 pt1->tables = tables; pt1_init_tables()
480 pt1_cleanup_table(pt1, &tables[i]); pt1_init_tables()
486 static int pt1_start_polling(struct pt1 *pt1) pt1_start_polling() argument
490 mutex_lock(&pt1->lock); pt1_start_polling()
491 if (!pt1->kthread) { pt1_start_polling()
492 pt1->kthread = kthread_run(pt1_thread, pt1, "earth-pt1"); pt1_start_polling()
493 if (IS_ERR(pt1->kthread)) { pt1_start_polling()
494 ret = PTR_ERR(pt1->kthread); pt1_start_polling()
495 pt1->kthread = NULL; pt1_start_polling()
498 mutex_unlock(&pt1->lock); pt1_start_polling()
509 ret = pt1_start_polling(adap->pt1); pt1_start_feed()
512 pt1_set_stream(adap->pt1, adap->index, 1); pt1_start_feed()
517 static void pt1_stop_polling(struct pt1 *pt1) pt1_stop_polling() argument
521 mutex_lock(&pt1->lock); pt1_stop_polling()
523 count += pt1->adaps[i]->users; pt1_stop_polling()
525 if (count == 0 && pt1->kthread) { pt1_stop_polling()
526 kthread_stop(pt1->kthread); pt1_stop_polling()
527 pt1->kthread = NULL; pt1_stop_polling()
529 mutex_unlock(&pt1->lock); pt1_stop_polling()
537 pt1_set_stream(adap->pt1, adap->index, 0); pt1_stop_feed()
538 pt1_stop_polling(adap->pt1); pt1_stop_feed()
544 pt1_update_power(struct pt1 *pt1) pt1_update_power() argument
556 bits = pt1->power | !pt1->reset << 3; pt1_update_power()
557 mutex_lock(&pt1->lock); pt1_update_power()
559 adap = pt1->adaps[i]; pt1_update_power()
574 pt1_write_reg(pt1, 1, bits); pt1_update_power()
575 mutex_unlock(&pt1->lock); pt1_update_power()
584 pt1_update_power(adap->pt1); pt1_set_voltage()
598 pt1_update_power(adap->pt1); pt1_sleep()
612 pt1_update_power(adap->pt1); pt1_wakeup()
634 pt1_alloc_adapter(struct pt1 *pt1) pt1_alloc_adapter() argument
649 adap->pt1 = pt1; pt1_alloc_adapter()
668 &pt1->pdev->dev, adapter_nr); pt1_alloc_adapter()
706 static void pt1_cleanup_adapters(struct pt1 *pt1) pt1_cleanup_adapters() argument
710 pt1_free_adapter(pt1->adaps[i]); pt1_cleanup_adapters()
713 static int pt1_init_adapters(struct pt1 *pt1) pt1_init_adapters() argument
720 adap = pt1_alloc_adapter(pt1); pt1_init_adapters()
727 pt1->adaps[i] = adap; pt1_init_adapters()
733 pt1_free_adapter(pt1->adaps[i]); pt1_init_adapters()
762 static void pt1_cleanup_frontends(struct pt1 *pt1) pt1_cleanup_frontends() argument
766 pt1_cleanup_frontend(pt1->adaps[i]); pt1_cleanup_frontends()
818 static int pt1_init_frontends(struct pt1 *pt1) pt1_init_frontends() argument
829 i2c_adap = &pt1->i2c_adap; pt1_init_frontends()
830 configs = pt1->pdev->device == 0x211a ? pt1_configs : pt2_configs; pt1_init_frontends()
861 ret = pt1_init_frontend(pt1->adaps[j], fe[j]); pt1_init_frontends()
878 static void pt1_i2c_emit(struct pt1 *pt1, int addr, int busy, int read_enable, pt1_i2c_emit() argument
881 pt1_write_reg(pt1, 4, addr << 18 | busy << 13 | read_enable << 12 | pt1_i2c_emit()
885 static void pt1_i2c_write_bit(struct pt1 *pt1, int addr, int *addrp, int data) pt1_i2c_write_bit() argument
887 pt1_i2c_emit(pt1, addr, 1, 0, 0, data, addr + 1); pt1_i2c_write_bit()
888 pt1_i2c_emit(pt1, addr + 1, 1, 0, 1, data, addr + 2); pt1_i2c_write_bit()
889 pt1_i2c_emit(pt1, addr + 2, 1, 0, 0, data, addr + 3); pt1_i2c_write_bit()
893 static void pt1_i2c_read_bit(struct pt1 *pt1, int addr, int *addrp) pt1_i2c_read_bit() argument
895 pt1_i2c_emit(pt1, addr, 1, 0, 0, 1, addr + 1); pt1_i2c_read_bit()
896 pt1_i2c_emit(pt1, addr + 1, 1, 0, 1, 1, addr + 2); pt1_i2c_read_bit()
897 pt1_i2c_emit(pt1, addr + 2, 1, 1, 1, 1, addr + 3); pt1_i2c_read_bit()
898 pt1_i2c_emit(pt1, addr + 3, 1, 0, 0, 1, addr + 4); pt1_i2c_read_bit()
902 static void pt1_i2c_write_byte(struct pt1 *pt1, int addr, int *addrp, int data) pt1_i2c_write_byte() argument
906 pt1_i2c_write_bit(pt1, addr, &addr, data >> (7 - i) & 1); pt1_i2c_write_byte()
907 pt1_i2c_write_bit(pt1, addr, &addr, 1); pt1_i2c_write_byte()
911 static void pt1_i2c_read_byte(struct pt1 *pt1, int addr, int *addrp, int last) pt1_i2c_read_byte() argument
915 pt1_i2c_read_bit(pt1, addr, &addr); pt1_i2c_read_byte()
916 pt1_i2c_write_bit(pt1, addr, &addr, last); pt1_i2c_read_byte()
920 static void pt1_i2c_prepare(struct pt1 *pt1, int addr, int *addrp) pt1_i2c_prepare() argument
922 pt1_i2c_emit(pt1, addr, 1, 0, 1, 1, addr + 1); pt1_i2c_prepare()
923 pt1_i2c_emit(pt1, addr + 1, 1, 0, 1, 0, addr + 2); pt1_i2c_prepare()
924 pt1_i2c_emit(pt1, addr + 2, 1, 0, 0, 0, addr + 3); pt1_i2c_prepare()
929 pt1_i2c_write_msg(struct pt1 *pt1, int addr, int *addrp, struct i2c_msg *msg) pt1_i2c_write_msg() argument
932 pt1_i2c_prepare(pt1, addr, &addr); pt1_i2c_write_msg()
933 pt1_i2c_write_byte(pt1, addr, &addr, msg->addr << 1); pt1_i2c_write_msg()
935 pt1_i2c_write_byte(pt1, addr, &addr, msg->buf[i]); pt1_i2c_write_msg()
940 pt1_i2c_read_msg(struct pt1 *pt1, int addr, int *addrp, struct i2c_msg *msg) pt1_i2c_read_msg() argument
943 pt1_i2c_prepare(pt1, addr, &addr); pt1_i2c_read_msg()
944 pt1_i2c_write_byte(pt1, addr, &addr, msg->addr << 1 | 1); pt1_i2c_read_msg()
946 pt1_i2c_read_byte(pt1, addr, &addr, i == msg->len - 1); pt1_i2c_read_msg()
950 static int pt1_i2c_end(struct pt1 *pt1, int addr) pt1_i2c_end() argument
952 pt1_i2c_emit(pt1, addr, 1, 0, 0, 0, addr + 1); pt1_i2c_end()
953 pt1_i2c_emit(pt1, addr + 1, 1, 0, 1, 0, addr + 2); pt1_i2c_end()
954 pt1_i2c_emit(pt1, addr + 2, 1, 0, 1, 1, 0); pt1_i2c_end()
956 pt1_write_reg(pt1, 0, 0x00000004); pt1_i2c_end()
961 } while (pt1_read_reg(pt1, 0) & 0x00000080); pt1_i2c_end()
965 static void pt1_i2c_begin(struct pt1 *pt1, int *addrp) pt1_i2c_begin() argument
970 pt1_i2c_emit(pt1, addr, 0, 0, 1, 1, addr /* itself */); pt1_i2c_begin()
973 if (!pt1->i2c_running) { pt1_i2c_begin()
974 pt1_i2c_emit(pt1, addr, 1, 0, 1, 1, addr + 1); pt1_i2c_begin()
975 pt1_i2c_emit(pt1, addr + 1, 1, 0, 1, 0, addr + 2); pt1_i2c_begin()
977 pt1->i2c_running = 1; pt1_i2c_begin()
984 struct pt1 *pt1; pt1_i2c_xfer() local
991 pt1 = i2c_get_adapdata(adap); pt1_i2c_xfer()
1010 pt1_i2c_begin(pt1, &addr); pt1_i2c_xfer()
1011 pt1_i2c_write_msg(pt1, addr, &addr, msg); pt1_i2c_xfer()
1012 pt1_i2c_read_msg(pt1, addr, &addr, next_msg); pt1_i2c_xfer()
1013 ret = pt1_i2c_end(pt1, addr); pt1_i2c_xfer()
1017 word = pt1_read_reg(pt1, 2); pt1_i2c_xfer()
1023 pt1_i2c_begin(pt1, &addr); pt1_i2c_xfer()
1024 pt1_i2c_write_msg(pt1, addr, &addr, msg); pt1_i2c_xfer()
1025 ret = pt1_i2c_end(pt1, addr); pt1_i2c_xfer()
1044 static void pt1_i2c_wait(struct pt1 *pt1) pt1_i2c_wait() argument
1048 pt1_i2c_emit(pt1, 0, 0, 0, 1, 1, 0); pt1_i2c_wait()
1051 static void pt1_i2c_init(struct pt1 *pt1) pt1_i2c_init() argument
1055 pt1_i2c_emit(pt1, i, 0, 0, 1, 1, 0); pt1_i2c_init()
1060 struct pt1 *pt1; pt1_remove() local
1063 pt1 = pci_get_drvdata(pdev); pt1_remove()
1064 regs = pt1->regs; pt1_remove()
1066 if (pt1->kthread) pt1_remove()
1067 kthread_stop(pt1->kthread); pt1_remove()
1068 pt1_cleanup_tables(pt1); pt1_remove()
1069 pt1_cleanup_frontends(pt1); pt1_remove()
1070 pt1_disable_ram(pt1); pt1_remove()
1071 pt1->power = 0; pt1_remove()
1072 pt1->reset = 1; pt1_remove()
1073 pt1_update_power(pt1); pt1_remove()
1074 pt1_cleanup_adapters(pt1); pt1_remove()
1075 i2c_del_adapter(&pt1->i2c_adap); pt1_remove()
1076 kfree(pt1); pt1_remove()
1086 struct pt1 *pt1; pt1_probe() local
1109 pt1 = kzalloc(sizeof(struct pt1), GFP_KERNEL); pt1_probe()
1110 if (!pt1) { pt1_probe()
1115 mutex_init(&pt1->lock); pt1_probe()
1116 pt1->pdev = pdev; pt1_probe()
1117 pt1->regs = regs; pt1_probe()
1118 pci_set_drvdata(pdev, pt1); pt1_probe()
1120 ret = pt1_init_adapters(pt1); pt1_probe()
1124 mutex_init(&pt1->lock); pt1_probe()
1126 pt1->power = 0; pt1_probe()
1127 pt1->reset = 1; pt1_probe()
1128 pt1_update_power(pt1); pt1_probe()
1130 i2c_adap = &pt1->i2c_adap; pt1_probe()
1135 i2c_set_adapdata(i2c_adap, pt1); pt1_probe()
1140 pt1_i2c_init(pt1); pt1_probe()
1141 pt1_i2c_wait(pt1); pt1_probe()
1143 ret = pt1_sync(pt1); pt1_probe()
1147 pt1_identify(pt1); pt1_probe()
1149 ret = pt1_unlock(pt1); pt1_probe()
1153 ret = pt1_reset_pci(pt1); pt1_probe()
1157 ret = pt1_reset_ram(pt1); pt1_probe()
1161 ret = pt1_enable_ram(pt1); pt1_probe()
1165 pt1_init_streams(pt1); pt1_probe()
1167 pt1->power = 1; pt1_probe()
1168 pt1_update_power(pt1); pt1_probe()
1171 pt1->reset = 0; pt1_probe()
1172 pt1_update_power(pt1); pt1_probe()
1175 ret = pt1_init_frontends(pt1); pt1_probe()
1179 ret = pt1_init_tables(pt1); pt1_probe()
1186 pt1_cleanup_frontends(pt1); pt1_probe()
1188 pt1_disable_ram(pt1); pt1_probe()
1189 pt1->power = 0; pt1_probe()
1190 pt1->reset = 1; pt1_probe()
1191 pt1_update_power(pt1); pt1_probe()
1195 pt1_cleanup_adapters(pt1); pt1_probe()
1197 kfree(pt1); pt1_probe()
/linux-4.1.27/drivers/media/common/saa7146/
H A Dsaa7146_video.c218 struct saa7146_pgtable *pt1 = &buf->pt[0]; saa7146_pgtable_build() local
255 ptr1 = pt1->cpu; saa7146_pgtable_build()
266 ptr1 = pt1->cpu; saa7146_pgtable_build()
274 pt1->offset = dma->sglist->offset; saa7146_pgtable_build()
275 pt2->offset = pt1->offset+o1; saa7146_pgtable_build()
276 pt3->offset = pt1->offset+o2; saa7146_pgtable_build()
279 ptr1 = pt1->cpu; saa7146_pgtable_build()
288 ptr1 = pt1->cpu; saa7146_pgtable_build()
297 ptr1 = pt1->cpu+m1; saa7146_pgtable_build()
298 fill = pt1->cpu[m1]; saa7146_pgtable_build()
303 ptr1 = pt1->cpu; saa7146_pgtable_build()
/linux-4.1.27/drivers/block/paride/
H A Dpt.c20 The rewinding devices are named /dev/pt0, /dev/pt1, ...
/linux-4.1.27/net/core/
H A Ddev.c419 struct packet_type *pt1; __dev_remove_pack() local
423 list_for_each_entry(pt1, head, list) { list_for_each_entry()
424 if (pt == pt1) { list_for_each_entry()

Completed in 316 milliseconds