dvb/pci/pt1: decompose earth-pt1 into sub drivers
Subsystems (3)
[email protected]
maintainerv2 cover dvb/pci/pt1: decompose earth-pt1 into sub drivers
From: Akihiro Tsukada <[email protected]>
Changes since v1:
- use new style of specifying pll_desc of the terrestrial tuner
Akihiro Tsukada (5):
dvb-frontends/dvb-pll: add tda6651 ISDB-T pll_desc
tuners: add new i2c driver for Sharp qm1d1b0004 ISDB-S tuner
dvb: earth-pt1: decompose pt1 driver into sub drivers
dvb: earth-pt1: add support for suspend/resume
dvb: earth-pt1: replace schedule_timeout with usleep_range
drivers/media/dvb-frontends/dvb-pll.c | 24 ++ drivers/media/dvb-frontends/dvb-pll.h | 2 + drivers/media/pci/pt1/Kconfig | 3 + drivers/media/pci/pt1/Makefile | 3 +- drivers/media/pci/pt1/pt1.c | 470 ++++++++++++++++------ drivers/media/pci/pt1/va1j5jf8007s.c | 732 ---------------------------------- drivers/media/pci/pt1/va1j5jf8007s.h | 42 -- drivers/media/pci/pt1/va1j5jf8007t.c | 532 ------------------------ drivers/media/pci/pt1/va1j5jf8007t.h | 42 -- drivers/media/tuners/Kconfig | 7 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/qm1d1b0004.c | 264 ++++++++++++ drivers/media/tuners/qm1d1b0004.h | 24 ++ 13 files changed, 677 insertions(+), 1469 deletions(-) delete mode 100644 drivers/media/pci/pt1/va1j5jf8007s.c delete mode 100644 drivers/media/pci/pt1/va1j5jf8007s.h delete mode 100644 drivers/media/pci/pt1/va1j5jf8007t.c delete mode 100644 drivers/media/pci/pt1/va1j5jf8007t.h create mode 100644 drivers/media/tuners/qm1d1b0004.c create mode 100644 drivers/media/tuners/qm1d1b0004.h
Signature · 1 line
2.16.3
[email protected]
maintainerPATCH v2 1/5 dvb-frontends/dvb-pll: add tda6651 ISDB-T pll_desc
From: Akihiro Tsukada <[email protected]>
This patch adds a PLL "description" of Philips TDA6651 for ISDB-T. It was extracted from (the former) va1j5jf8007t.c of EarthSoft PT1, thus the desc might include PT1 specific configs.
---
Changes since v1:
- use new style of specifying pll_desc of the tuner
drivers/media/dvb-frontends/dvb-pll.c | 24 ++++++++++++++++++++++++ drivers/media/dvb-frontends/dvb-pll.h | 2 ++ 2 files changed, 26 insertions(+)
drivers/media/dvb-frontends/dvb-pll.c +24 -0
@@ -550,6 +550,28 @@ static const struct dvb_pll_desc dvb_pll_tua6034_friio = { } }; +/* Philips TDA6651 ISDB-T, used in Earthsoft PT1 */ +static const struct dvb_pll_desc dvb_pll_tda665x_earth_pt1 = { + .name ="Philips TDA6651 ISDB-T (EarthSoft PT1)" , + .min =90000000 , + .max =770000000 , + .iffreq =57000000 , + .initdata = (u8 []){5 ,0x0e ,0x7f ,0xc1 ,0x80 ,0x80 }, + .count =10 , + .entries = { + {140000000 ,142857 ,0xc1 ,0x81 }, + {170000000 ,142857 ,0xc1 ,0xa1 }, + {220000000 ,142857 ,0xc1 ,0x62 }, + {330000000 ,142857 ,0xc1 ,0xa2 }, + {402000000 ,142857 ,0xc1 ,0xe2 }, + {450000000 ,142857 ,0xc1 ,0x64 }, + {550000000 ,142857 ,0xc1 ,0x84 }, + {600000000 ,142857 ,0xc1 ,0xa4 }, + {700000000 ,142857 ,0xc1 ,0xc4 }, + {770000000 ,142857 ,0xc1 ,0xe4 }, + } +}; +/* ----------------------------------------------------------- */ static const struct dvb_pll_desc *pll_list[] = {
@@ -574,6 +596,7 @@ static const struct dvb_pll_desc *pll_list[] = { [DVB_PLL_SAMSUNG_TBDU18132] = &dvb_pll_samsung_tbdu18132, [DVB_PLL_SAMSUNG_TBMU24112] = &dvb_pll_samsung_tbmu24112, [DVB_PLL_TUA6034_FRIIO] = &dvb_pll_tua6034_friio, + [DVB_PLL_TDA665X_EARTH_PT1] = &dvb_pll_tda665x_earth_pt1, };/* ----------------------------------------------------------- */
@@ -896,6 +919,7 @@ static const struct i2c_device_id dvb_pll_id[] = { {DVB_PLL_TDEE4_NAME, DVB_PLL_TDEE4}, {DVB_PLL_THOMSON_DTT7520X_NAME, DVB_PLL_THOMSON_DTT7520X}, {DVB_PLL_TUA6034_FRIIO_NAME, DVB_PLL_TUA6034_FRIIO}, + {DVB_PLL_TDA665X_EARTH_PT1_NAME, DVB_PLL_TDA665X_EARTH_PT1}, {} };
drivers/media/dvb-frontends/dvb-pll.h +2 -0
@@ -30,6 +30,7 @@#define DVB_PLL_TDEE4 18#define DVB_PLL_THOMSON_DTT7520X 19#define DVB_PLL_TUA6034_FRIIO 20 +#define DVB_PLL_TDA665X_EARTH_PT1 21#define DVB_PLL_THOMSON_DTT7579_NAME "dtt7579"#define DVB_PLL_THOMSON_DTT759X_NAME "dtt759x"
@@ -51,6 +52,7 @@#define DVB_PLL_TDEE4_NAME "tdee4"#define DVB_PLL_THOMSON_DTT7520X_NAME "dtt7520x"#define DVB_PLL_TUA6034_FRIIO_NAME "tua6034_friio" +#define DVB_PLL_TDA665X_EARTH_PT1_NAME "tda665x_earthpt1"struct dvb_pll_config {struct dvb_frontend *fe;
Signature · 1 line
2.16.3
[email protected]
maintainerPATCH v2 2/5 tuners: add new i2c driver for Sharp qm1d1b0004 ISDB-S tuner
In reply to [email protected]From: Akihiro Tsukada <[email protected]>
The tuner is used in Earthsoft PT1/PT2 DVB boards,
and the driver was extraced from (the former) va1j5jf8007s.c of PT1. it might contain PT1 specific configs.
---
Changes since v1:
- none
drivers/media/tuners/Kconfig | 7 + drivers/media/tuners/Makefile | 1 + drivers/media/tuners/qm1d1b0004.c | 264 ++++++++++++++++++++++++++++++++++++++ drivers/media/tuners/qm1d1b0004.h | 24 ++++ 4 files changed, 296 insertions(+) create mode 100644 drivers/media/tuners/qm1d1b0004.c create mode 100644 drivers/media/tuners/qm1d1b0004.h
drivers/media/tuners/Kconfig +7 -0
@@ -284,4 +284,11 @@ config MEDIA_TUNER_QM1D1C0042 default m if !MEDIA_SUBDRV_AUTOSELECT help Sharp QM1D1C0042 trellis coded 8PSK tuner driver. + +config MEDIA_TUNER_QM1D1B0004 + tristate "Sharp QM1D1B0004 tuner" + depends on MEDIA_SUPPORT && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Sharp QM1D1B0004 ISDB-S tuner driver. endmenu
drivers/media/tuners/Makefile +1 -0
@@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o +obj-$(CONFIG_MEDIA_TUNER_QM1D1B0004) += qm1d1b0004.o obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o obj-$(CONFIG_MEDIA_TUNER_TDA18250) += tda18250.o
drivers/media/tuners/qm1d1b0004.c new file +264 -0
264 lines not on this page · raw message
drivers/media/tuners/qm1d1b0004.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Sharp QM1D1B0004 satellite tuner +* +* Copyright (C) 2014 Akihiro Tsukada <[email protected]> +*/ + +#ifndef QM1D1B0004_H +#define QM1D1B0004_H + +#include <media/dvb_frontend.h> + +struct qm1d1b0004_config { +struct dvb_frontend *fe; + +u32 lpf_freq;/* LPF frequency[kHz]. Default: symbol rate */ +bool half_step;/* use PLL frequency step of 500Hz istead of 1000Hz */ +}; + +/* special values indicating to use the default in qm1d1b0004_config */ +#define QM1D1B0004_CFG_PLL_DFLT 0 +#define QM1D1B0004_CFG_LPF_DFLT 0 + +#endif
Signature · 1 line
2.16.3
[email protected]
maintainerPATCH v2 3/5 dvb: earth-pt1: decompose pt1 driver into sub drivers
In reply to [email protected]From: Akihiro Tsukada <[email protected]>
earth-pt1 was a monolithic module and included demod/tuner drivers. This patch removes those FE parts and attach demod/tuner i2c drivers.
---
Changes since v1:
- use i2c_board_info.name to specify pll_desc of the tuner
drivers/media/pci/pt1/Kconfig | 3 + drivers/media/pci/pt1/Makefile | 3 +- drivers/media/pci/pt1/pt1.c | 329 +++++++++++----- drivers/media/pci/pt1/va1j5jf8007s.c | 732 ----------------------------------- drivers/media/pci/pt1/va1j5jf8007s.h | 42 -- drivers/media/pci/pt1/va1j5jf8007t.c | 532 ------------------------- drivers/media/pci/pt1/va1j5jf8007t.h | 42 -- 7 files changed, 227 insertions(+), 1456 deletions(-) delete mode 100644 drivers/media/pci/pt1/va1j5jf8007s.c delete mode 100644 drivers/media/pci/pt1/va1j5jf8007s.h delete mode 100644 drivers/media/pci/pt1/va1j5jf8007t.c delete mode 100644 drivers/media/pci/pt1/va1j5jf8007t.h
drivers/media/pci/pt1/Kconfig +3 -0
@@ -1,6 +1,9 @@ config DVB_PT1 tristate "PT1 cards" depends on DVB_CORE && PCI && I2C + select DVB_TC90522 if MEDIA_SUBDRV_AUTOSELECT + select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_QM1D1B0004 if MEDIA_SUBDRV_AUTOSELECT help Support for Earthsoft PT1 PCI cards.
drivers/media/pci/pt1/Makefile +2 -1
@@ -1,5 +1,6 @@ -earth-pt1-objs := pt1.o va1j5jf8007s.o va1j5jf8007t.o +earth-pt1-objs := pt1.o obj-$(CONFIG_DVB_PT1) += earth-pt1.o ccflags-y += -Idrivers/media/dvb-frontends +ccflags-y += -Idrivers/media/tuners
drivers/media/pci/pt1/pt1.c +222 -107
414 lines not on this page · raw message
drivers/media/pci/pt1/va1j5jf8007s.c deleted +0 -732
732 lines not on this page · raw message
drivers/media/pci/pt1/va1j5jf8007s.h deleted +0 -42
42 lines not on this page · raw message
drivers/media/pci/pt1/va1j5jf8007t.c deleted +0 -532
532 lines not on this page · raw message
drivers/media/pci/pt1/va1j5jf8007t.h deleted +0 -42
42 lines not on this page · raw message
Signature · 1 line
2.16.3
[email protected]
maintainerPATCH v2 4/5 dvb: earth-pt1: add support for suspend/resume
In reply to [email protected]From: Akihiro Tsukada <[email protected]>
Without this patch, re-loading of the module was required after resume.
---
Changes since v1:
- none
drivers/media/pci/pt1/pt1.c | 107 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-)
drivers/media/pci/pt1/pt1.c +105 -2
@@ -461,12 +461,18 @@ static int pt1_thread(void *data) {struct pt1 *pt1;struct pt1_buffer_page *page; +bool was_frozen; pt1 = data;set_freezable (); -while (!kthread_should_stop ()) { -try_to_freeze (); +while (!kthread_freezable_should_stop (&was_frozen)) { +if (was_frozen) { +int i; + +for (i =0 ; i <PT1_NR_ADAPS ; i++) +pt1_set_stream (pt1, i, !!pt1->adaps[i]->users); + } page = pt1->tables[pt1->table_index].bufs[pt1->buf_index].page;if (!pt1_filter (pt1, page)) {
@@ -1165,6 +1171,98 @@ static void pt1_i2c_init(struct pt1 *pt1)pt1_i2c_emit (pt1, i,0 ,0 ,1 ,1 ,0 ); } +#ifdef CONFIG_PM_SLEEP + +static int pt1_suspend (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct pt1 *pt1 =pci_get_drvdata (pdev); + +pt1_init_streams (pt1); +pt1_disable_ram (pt1); + pt1->power =0 ; + pt1->reset =1 ; +pt1_update_power (pt1); +return 0 ; +} + +static int pt1_resume (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct pt1 *pt1 =pci_get_drvdata (pdev); +int ret; +int i; + + pt1->power =0 ; + pt1->reset =1 ; +pt1_update_power (pt1); + +pt1_i2c_init (pt1); +pt1_i2c_wait (pt1); + + ret =pt1_sync (pt1); +if (ret <0 ) + goto resume_err; + +pt1_identify (pt1); + + ret =pt1_unlock (pt1); +if (ret <0 ) + goto resume_err; + + ret =pt1_reset_pci (pt1); +if (ret <0 ) + goto resume_err; + + ret =pt1_reset_ram (pt1); +if (ret <0 ) + goto resume_err; + + ret =pt1_enable_ram (pt1); +if (ret <0 ) + goto resume_err; + +pt1_init_streams (pt1); + + pt1->power =1 ; +pt1_update_power (pt1); +msleep (20 ); + + pt1->reset =0 ; +pt1_update_power (pt1); +usleep_range (1000 ,2000 ); + +for (i =0 ; i <PT1_NR_ADAPS ; i++) +dvb_frontend_reinitialise (pt1->adaps[i]->fe); + +pt1_init_table_count (pt1); +for (i =0 ; i < pt1_nr_tables; i++) { +int j; + +for (j =0 ; j <PT1_NR_BUFS ; j++) + pt1->tables[i].bufs[j].page->upackets[PT1_NR_UPACKETS -1 ] + =0 ; +pt1_increment_table_count (pt1); + } +pt1_register_tables (pt1, pt1->tables[0 ].addr >>PT1_PAGE_SHIFT ); + + pt1->table_index =0 ; + pt1->buf_index =0 ; +for (i =0 ; i <PT1_NR_ADAPS ; i++) { + pt1->adaps[i]->upacket_count =0 ; + pt1->adaps[i]->packet_count =0 ; + pt1->adaps[i]->st_count =-1 ; + } + +return 0 ; + +resume_err: +dev_info (&pt1->pdev->dev,"failed to resume PT1/PT2." ); +return 0 ;/* resume anyway */ +} + +#endif /* CONFIG_PM_SLEEP */ +static void pt1_remove (struct pci_dev *pdev) {struct pt1 *pt1;
@@ -1325,11 +1423,16 @@ static const struct pci_device_id pt1_id_table[] = { };MODULE_DEVICE_TABLE (pci, pt1_id_table); +static SIMPLE_DEV_PM_OPS(pt1_pm_ops, pt1_suspend, pt1_resume); +static struct pci_driver pt1_driver = { .name =DRIVER_NAME , .probe = pt1_probe, .remove = pt1_remove, .id_table = pt1_id_table, +#if CONFIG_PM_SLEEP + .driver.pm = &pt1_pm_ops, +#endif };module_pci_driver (pt1_driver);
Signature · 1 line
2.16.3
[email protected]
maintainerPATCH v2 5/5 dvb: earth-pt1: replace schedule_timeout with usleep_range
In reply to [email protected]From: Akihiro Tsukada <[email protected]>
As described in Document/timers/timers-howto.txt, hrtimer-based delay should be used for small sleeps.
---
Changes since v1:
- none
drivers/media/pci/pt1/pt1.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-)
drivers/media/pci/pt1/pt1.c +23 -11
@@ -18,7 +18,10 @@*/ #include <linux/kernel.h> +#include <linux/sched.h> #include <linux/sched/signal.h> +#include <linux/hrtimer.h> +#include <linux/delay.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/vmalloc.h>
@@ -321,7 +324,7 @@ static int pt1_unlock(struct pt1 *pt1)for (i =0 ; i <3 ; i++) {if (pt1_read_reg (pt1,0 ) &0x80000000 )return 0 ; -schedule_timeout_uninterruptible ((HZ +999 ) /1000 ); +usleep_range (1000 ,2000 ); }dev_err (&pt1->pdev->dev,"could not unlock\n" );return -EIO ;
@@ -335,7 +338,7 @@ static int pt1_reset_pci(struct pt1 *pt1)for (i =0 ; i <10 ; i++) {if (pt1_read_reg (pt1,0 ) &0x00000001 )return 0 ; -schedule_timeout_uninterruptible ((HZ +999 ) /1000 ); +usleep_range (1000 ,2000 ); }dev_err (&pt1->pdev->dev,"could not reset PCI\n" );return -EIO ;
@@ -349,7 +352,7 @@ static int pt1_reset_ram(struct pt1 *pt1)for (i =0 ; i <10 ; i++) {if (pt1_read_reg (pt1,0 ) &0x00000002 )return 0 ; -schedule_timeout_uninterruptible ((HZ +999 ) /1000 ); +usleep_range (1000 ,2000 ); }dev_err (&pt1->pdev->dev,"could not reset RAM\n" );return -EIO ;
@@ -366,7 +369,7 @@ static int pt1_do_enable_ram(struct pt1 *pt1)if ((pt1_read_reg (pt1,0 ) &0x00000004 ) != status)return 0 ; } -schedule_timeout_uninterruptible ((HZ +999 ) /1000 ); +usleep_range (1000 ,2000 ); }dev_err (&pt1->pdev->dev,"could not enable RAM\n" );return -EIO ;
@@ -376,7 +379,7 @@ static int pt1_enable_ram(struct pt1 *pt1) {int i, ret;int phase; -schedule_timeout_uninterruptible ((HZ +999 ) /1000 ); +usleep_range (1000 ,2000 ); phase = pt1->pdev->device ==0x211a ?128 :166 ;for (i =0 ; i < phase; i++) { ret =pt1_do_enable_ram (pt1);
@@ -463,6 +466,9 @@ static int pt1_thread(void *data)struct pt1_buffer_page *page;bool was_frozen; +#define PT1_FETCH_DELAY 10 +#define PT1_FETCH_DELAY_DELTA 2 + pt1 = data;set_freezable ();
@@ -476,7 +482,13 @@ static int pt1_thread(void *data) page = pt1->tables[pt1->table_index].bufs[pt1->buf_index].page;if (!pt1_filter (pt1, page)) { -schedule_timeout_interruptible ((HZ +999 ) /1000 ); +ktime_t delay; + + delay =PT1_FETCH_DELAY *NSEC_PER_MSEC ; +set_current_state (TASK_INTERRUPTIBLE ); +schedule_hrtimeout_range (&delay, +PT1_FETCH_DELAY_DELTA *NSEC_PER_MSEC , +HRTIMER_MODE_REL );continue ; }
@@ -712,7 +724,7 @@ pt1_update_power(struct pt1 *pt1) adap = pt1->adaps[i];switch (adap->voltage) {case SEC_VOLTAGE_13 :/* actually 11V */ - bits |=1 <<1 ; + bits |=1 <<2 ;break ;case SEC_VOLTAGE_18 :/* actually 15V */ bits |=1 <<1 |1 <<2 ;
@@ -766,7 +778,7 @@ static int pt1_wakeup(struct dvb_frontend *fe) adap = container_of(fe->dvb, struct pt1_adapter, adap); adap->sleep =0 ;pt1_update_power (adap->pt1); -schedule_timeout_uninterruptible ((HZ +999 ) /1000 ); +usleep_range (1000 ,2000 ); ret =config_demod (adap->demod_i2c_client, adap->pt1->fe_clk);if (ret ==0 && adap->orig_init)
@@ -1073,7 +1085,7 @@ static int pt1_i2c_end(struct pt1 *pt1, int addr)do {if (signal_pending (current))return -EINTR ; -schedule_timeout_interruptible ((HZ +999 ) /1000 ); +usleep_range (1000 ,2000 ); }while (pt1_read_reg (pt1,0 ) &0x00000080 );return 0 ; }
@@ -1376,11 +1388,11 @@ static int pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pt1->power =1 ;pt1_update_power (pt1); -schedule_timeout_uninterruptible ((HZ +49 ) /50 ); +msleep (20 ); pt1->reset =0 ;pt1_update_power (pt1); -schedule_timeout_uninterruptible ((HZ +999 ) /1000 ); +usleep_range (1000 ,2000 ); ret =pt1_init_frontends (pt1);if (ret <0 )
Signature · 1 line
2.16.3