DTV03A-1TU(ISDBT2071)製造ロット2022-11月以降のLinux対応

WinUSB版同様チャンネル変更後はエラーやドロップを多量に含む不安定なTSが出力される。録画用途での使用は厳しい。
This commit is contained in:
hendecarows
2025-05-11 00:44:05 +09:00
parent d6baacdcbc
commit 51134d6d74
6 changed files with 224 additions and 344 deletions

View File

@@ -9,6 +9,7 @@ ISDB2056_USB_MAX_DEVICE := 0
ISDB6014_4TS_USB_MAX_DEVICE := 0
PXM1UR_USB_MAX_DEVICE := 0
PXS1UR_USB_MAX_DEVICE := 0
ISDBT2071_USB_MAX_DEVICE := 0
PSB_DEBUG := 0
ITEDTV_BUS_USE_WORKQUEUE := 0
@@ -39,6 +40,9 @@ endif
ifneq ($(PXS1UR_USB_MAX_DEVICE),0)
ccflags-y += -DPXS1UR_USB_MAX_DEVICE=$(PXS1UR_USB_MAX_DEVICE)
endif
ifneq ($(ISDBT2071_USB_MAX_DEVICE),0)
ccflags-y += -DISDBT2071_USB_MAX_DEVICE=$(ISDBT2071_USB_MAX_DEVICE)
endif
ifneq ($(PSB_DEBUG),0)
ccflags-y += -DPSB_DEBUG
endif

View File

@@ -61,6 +61,11 @@
#endif
#define PXS1UR_USB_MAX_CHRDEV (PXS1UR_USB_MAX_DEVICE * S1UR_CHRDEV_NUM)
#ifndef ISDBT2071_USB_MAX_DEVICE
#define ISDBT2071_USB_MAX_DEVICE 64
#endif
#define ISDBT2071_USB_MAX_CHRDEV (ISDBT2071_USB_MAX_DEVICE * ISDBT2071_CHRDEV_NUM)
struct px4_usb_context {
enum px4_usb_device_type type;
@@ -236,9 +241,22 @@ static int px4_usb_probe(struct usb_interface *intf,
ctx->type = PXS1UR_USB_DEVICE;
ret = s1ur_device_init(&ctx->ctx.s1ur, dev,
PXS1UR_MODEL,
px4_usb_chrdev_ctx[PXS1UR_USB_DEVICE],
&ctx->quit_completion);
break;
case USB_PID_DIGIBEST_ISDBT2071:
ret = px4_usb_init_bridge(dev, usb_dev,
&ctx->ctx.s1ur.it930x);
if (ret)
break;
ctx->type = ISDBT2071_USB_DEVICE;
ret = s1ur_device_init(&ctx->ctx.s1ur, dev,
ISDBT2071_MODEL,
px4_usb_chrdev_ctx[ISDBT2071_USB_DEVICE],
&ctx->quit_completion);
break;
default:
@@ -305,6 +323,7 @@ static void px4_usb_disconnect(struct usb_interface *intf)
break;
case PXS1UR_USB_DEVICE:
case ISDBT2071_USB_DEVICE:
s1ur_device_term(&ctx->ctx.s1ur);
wait_for_completion(&ctx->quit_completion);
break;
@@ -348,6 +367,7 @@ static const struct usb_device_id px4_usb_ids[] = {
{ USB_DEVICE(0x0511, USB_PID_DIGIBEST_ISDB6014_4TS) },
{ USB_DEVICE(0x0511, USB_PID_PX_M1UR) },
{ USB_DEVICE(0x0511, USB_PID_PX_S1UR) },
{ USB_DEVICE(0x0511, USB_PID_DIGIBEST_ISDBT2071) },
{ 0 }
};
@@ -373,6 +393,7 @@ int px4_usb_register()
pr_debug("px4_usb_register: ISDB6014_4TS_USB_MAX_DEVICE: %d\n", ISDB6014_4TS_USB_MAX_DEVICE);
pr_debug("px4_usb_register: PXM1UR_USB_MAX_DEVICE: %d\n", PXM1UR_USB_MAX_DEVICE);
pr_debug("px4_usb_register: PXS1UR_USB_MAX_DEVICE: %d\n", PXS1UR_USB_MAX_DEVICE);
pr_debug("px4_usb_register: ISDBT2071_USB_MAX_DEVICE: %d\n", ISDBT2071_USB_MAX_DEVICE);
memset(&px4_usb_chrdev_ctx, 0, sizeof(px4_usb_chrdev_ctx));
@@ -432,6 +453,14 @@ int px4_usb_register()
goto fail_pxs1ur;
}
ret = ptx_chrdev_context_create("isdbt2071", "isdbt2071video",
ISDBT2071_USB_MAX_CHRDEV,
&px4_usb_chrdev_ctx[ISDBT2071_USB_DEVICE]);
if (ret) {
pr_err("px4_usb_register: ptx_chrdev_context_create(\"isdbt2071\") failed.\n");
goto fail_isdbt2071;
}
ret = usb_register(&px4_usb_driver);
if (ret) {
pr_err("px4_usb_register: usb_register() failed.\n");
@@ -441,14 +470,17 @@ int px4_usb_register()
return 0;
fail_usb:
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[ISDB6014_4TS_USB_DEVICE]);
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[ISDBT2071_USB_DEVICE]);
fail_pxs1ur:
fail_isdbt2071:
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[PXS1UR_USB_DEVICE]);
fail_pxm1ur:
fail_pxs1ur:
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[PXM1UR_USB_DEVICE]);
fail_pxm1ur:
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[ISDB6014_4TS_USB_DEVICE]);
fail_isdb6014:
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[ISDB2056_USB_DEVICE]);
@@ -468,6 +500,7 @@ fail:
void px4_usb_unregister()
{
usb_deregister(&px4_usb_driver);
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[ISDBT2071_USB_DEVICE]);
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[PXS1UR_USB_DEVICE]);
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[PXM1UR_USB_DEVICE]);
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[ISDB6014_4TS_USB_DEVICE]);

View File

@@ -23,6 +23,7 @@
#define USB_PID_DIGIBEST_ISDB6014_4TS 0x0254
#define USB_PID_PX_M1UR 0x0854
#define USB_PID_PX_S1UR 0x0855
#define USB_PID_DIGIBEST_ISDBT2071 0x0052
enum px4_usb_device_type {
@@ -34,6 +35,7 @@ enum px4_usb_device_type {
ISDB6014_4TS_USB_DEVICE,
PXM1UR_USB_DEVICE,
PXS1UR_USB_DEVICE,
ISDBT2071_USB_DEVICE,
//----
MAX_USB_DEVICE_TYPE,
};

View File

@@ -1,8 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* PTX driver for Digibest PLEX PX-S1UR device (s1ur_device.c)
* and Digibest ISDBT2071 (DTV03A-1TU) device
*
* Copyright (c) 2023 techma.
* 2025 hendecarows
*/
#include "print_format.h"
@@ -71,12 +73,21 @@ static int s1ur_backend_init(struct s1ur_device *s1ur)
return ret;
}
ret = tc90522_init(&chrdevs1ur->tc90522_s);
if (ret) {
dev_err(s1ur->dev,
"s1ur_backend_init: tc90522_init() (s) failed. (ret: %d)\n",
ret);
return ret;
switch (s1ur->s1ur_model) {
case PXS1UR_MODEL:
default:
ret = tc90522_init(&chrdevs1ur->tc90522_s);
if (ret) {
dev_err(s1ur->dev,
"s1ur_backend_init: tc90522_init() (s) failed. (ret: %d)\n",
ret);
return ret;
}
break;
case ISDBT2071_MODEL:
tc90522_term(&chrdevs1ur->tc90522_s);
break;
}
ret = r850_init(&chrdevs1ur->r850);
@@ -87,15 +98,6 @@ static int s1ur_backend_init(struct s1ur_device *s1ur)
return ret;
}
#if 0
ret = rt710_init(&chrdevs1ur->rt710);
if (ret) {
dev_err(s1ur->dev,
"s1ur_backend_init: rt710_init() failed. (ret: %d)\n",
ret);
return ret;
}
#endif
return 0;
}
@@ -104,9 +106,6 @@ static int s1ur_backend_term(struct s1ur_device *s1ur)
struct s1ur_chrdev *chrdevs1ur = &s1ur->chrdevs1ur;
r850_term(&chrdevs1ur->r850);
#if 0
rt710_term(&chrdevs1ur->rt710);
#endif
tc90522_term(&chrdevs1ur->tc90522_t);
tc90522_term(&chrdevs1ur->tc90522_s);
@@ -201,7 +200,7 @@ static int s1ur_chrdev_init(struct ptx_chrdev *chrdev)
{
dev_dbg(chrdev->parent->dev, "s1ur_chrdev_init\n");
chrdev->params.system = PTX_UNSPECIFIED_SYSTEM;
chrdev->params.system = PTX_ISDB_T_SYSTEM;
return 0;
}
@@ -211,7 +210,7 @@ static int s1ur_chrdev_term(struct ptx_chrdev *chrdev)
return 0;
}
static struct tc90522_regbuf tc_init_t[] = {
static struct tc90522_regbuf tc_init_s1ur[] = {
{ 0xb0, NULL, { 0xa0 } },
{ 0xb2, NULL, { 0x3d } },
{ 0xb3, NULL, { 0x25 } },
@@ -222,12 +221,25 @@ static struct tc90522_regbuf tc_init_t[] = {
{ 0xb8, NULL, { 0xc0 } },
};
#if 0
static struct tc90522_regbuf tc_init_s[] = {
static struct tc90522_regbuf tc_init_isdbt2071t[] = {
{ 0x04, NULL, { 0x00 } },
{ 0x10, NULL, { 0x00 } },
{ 0x11, NULL, { 0x2d } },
{ 0x12, NULL, { 0x02 } },
{ 0x13, NULL, { 0x62 } },
{ 0x14, NULL, { 0x60 } },
{ 0x15, NULL, { 0x00 } },
{ 0x1d, NULL, { 0x00 } },
{ 0x16, NULL, { 0x00 } },
{ 0x1d, NULL, { 0x05 } },
{ 0x1e, NULL, { 0x15 } },
{ 0x1f, NULL, { 0x40 } },
{ 0x30, NULL, { 0x20 } },
{ 0x31, NULL, { 0x0b } },
{ 0x32, NULL, { 0x8f } },
{ 0x34, NULL, { 0x0f } },
{ 0x38, NULL, { 0x01 } },
{ 0x39, NULL, { 0x1c } },
};
#endif
static int s1ur_chrdev_open(struct ptx_chrdev *chrdev)
{
@@ -259,9 +271,18 @@ static int s1ur_chrdev_open(struct ptx_chrdev *chrdev)
}
/* Initialization for ISDB-T */
switch (s1ur->s1ur_model) {
case PXS1UR_MODEL:
default:
ret = tc90522_write_multiple_regs(&chrdevs1ur->tc90522_t,
tc_init_s1ur, ARRAY_SIZE(tc_init_s1ur));
break;
ret = tc90522_write_multiple_regs(&chrdevs1ur->tc90522_t,
tc_init_t, ARRAY_SIZE(tc_init_t));
case ISDBT2071_MODEL:
ret = tc90522_write_multiple_regs(&chrdevs1ur->tc90522_t,
tc_init_isdbt2071t, ARRAY_SIZE(tc_init_isdbt2071t));
break;
}
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_open %u: tc90522_write_multiple_regs(tc_init_t) failed. (ret: %d)\n",
@@ -278,8 +299,8 @@ static int s1ur_chrdev_open(struct ptx_chrdev *chrdev)
return ret;
}
/* sleep */
ret = tc90522_sleep_t(&chrdevs1ur->tc90522_t, true);
/* wake up */
ret = tc90522_sleep_t(&chrdevs1ur->tc90522_t, false);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_open %u: tc90522_sleep_t(true) failed. (ret: %d)\n",
@@ -287,6 +308,14 @@ static int s1ur_chrdev_open(struct ptx_chrdev *chrdev)
return ret;
}
ret = r850_wakeup(&chrdevs1ur->r850);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: r850_wakeup() failed. (ret: %d)\n",
chrdev_group->id, ret);
return ret;
}
sys.system = R850_SYSTEM_ISDB_T;
sys.bandwidth = R850_BANDWIDTH_6M;
sys.if_freq = 4063;
@@ -299,36 +328,32 @@ static int s1ur_chrdev_open(struct ptx_chrdev *chrdev)
return ret;
}
#if 0
/* Initialization for ISDB-S */
switch (s1ur->s1ur_model) {
case PXS1UR_MODEL:
default:
/* disable ts pins */
ret = tc90522_enable_ts_pins_s(&chrdevs1ur->tc90522_s, false);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_open %u: tc90522_enable_ts_pins_s(false) failed. (ret: %d)\n",
chrdev_group->id, ret);
return ret;
}
ret = tc90522_write_multiple_regs(&chrdevs1ur->tc90522_s,
tc_init_s, ARRAY_SIZE(tc_init_s));
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_open %u: tc90522_write_multiple_regs(tc_init_s) failed. (ret: %d)\n",
chrdev_group->id, ret);
return ret;
/* sleep */
ret = tc90522_sleep_s(&chrdevs1ur->tc90522_s, true);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_open %u: tc90522_sleep_s(true) failed. (ret: %d)\n",
chrdev_group->id, ret);
return ret;
}
break;
case ISDBT2071_MODEL:
break;
}
/* disable ts pins */
ret = tc90522_enable_ts_pins_s(&chrdevs1ur->tc90522_s, false);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_open %u: tc90522_enable_ts_pins_s(false) failed. (ret: %d)\n",
chrdev_group->id, ret);
return ret;
}
/* sleep */
ret = tc90522_sleep_s(&chrdevs1ur->tc90522_s, true);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_open %u: tc90522_sleep_s(true) failed. (ret: %d)\n",
chrdev_group->id, ret);
return ret;
}
#endif
kref_get(&s1ur->kref);
return 0;
@@ -371,7 +396,6 @@ static int s1ur_chrdev_tune(struct ptx_chrdev *chrdev,
struct s1ur_device,
chrdevs1ur);
bool tuner_locked;
/* s32 ss; */
dev_dbg(s1ur->dev,
"s1ur_chrdev_tune %u\n", chrdev_group->id);
@@ -390,50 +414,58 @@ static int s1ur_chrdev_tune(struct ptx_chrdev *chrdev,
break;
}
ret = tc90522_sleep_s(&chrdevs1ur->tc90522_s, true);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: tc90522_sleep_s(true) failed. (ret: %d)\n",
chrdev_group->id, ret);
switch (s1ur->s1ur_model) {
case PXS1UR_MODEL:
default:
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x0e, 0x77);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x0f, 0x10);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x71, 0x20);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x76, 0x0c);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x1f, 0x30);
if (ret)
break;
break;
case ISDBT2071_MODEL:
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x76, 0x03);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x77, 0x01);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x3b, 0x10);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x3c, 0x10);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x3d, 0x24);
if (ret)
break;
break;
}
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x0e, 0x77);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x0f, 0x10);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x71, 0x20);
if (ret)
break;
ret = tc90522_sleep_t(&chrdevs1ur->tc90522_t, false);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: tc90522_sleep_t(false) failed. (ret: %d)\n",
chrdev_group->id, ret);
break;
}
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x76, 0x0c);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x1f, 0x30);
if (ret)
break;
ret = r850_wakeup(&chrdevs1ur->r850);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: r850_wakeup() failed. (ret: %d)\n",
chrdev_group->id, ret);
break;
}
ret = r850_set_frequency(&chrdevs1ur->r850, params->freq);
if (ret) {
dev_err(s1ur->dev,
@@ -478,124 +510,31 @@ static int s1ur_chrdev_tune(struct ptx_chrdev *chrdev,
break;
}
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x71, 0x01);
if (ret)
switch (s1ur->s1ur_model) {
case PXS1UR_MODEL:
default:
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x71, 0x01);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x72, 0x25);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x75, 0x00);
if (ret)
break;
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x72, 0x25);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x75, 0x00);
if (ret)
case ISDBT2071_MODEL:
break;
}
msleep(100);
break;
#if 0
case PTX_ISDB_S_SYSTEM:
ret = tc90522_set_agc_s(&chrdevs1ur->tc90522_s, false);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: tc90522_set_agc_s(false) failed. (ret: %d)\n",
chrdev_group->id, ret);
break;
}
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x0e, 0x11);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x0f, 0x70);
if (ret)
break;
ret = tc90522_sleep_t(&chrdevs1ur->tc90522_t, true);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: tc90522_sleep_t(true) failed. (ret: %d)\n",
chrdev_group->id, ret);
break;
}
ret = tc90522_write_reg(&chrdevs1ur->tc90522_s, 0x07, 0x77);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_s, 0x08, 0x10);
if (ret)
break;
ret = tc90522_sleep_s(&chrdevs1ur->tc90522_s, false);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: tc90522_sleep_s(false) failed. (ret: %d)\n",
chrdev_group->id, ret);
break;
}
ret = tc90522_write_reg(&chrdevs1ur->tc90522_s, 0x04, 0x02);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_s, 0x8e, 0x02);
if (ret)
break;
ret = tc90522_write_reg(&chrdevs1ur->tc90522_t, 0x1f, 0x20);
if (ret)
break;
ret = rt710_set_params(&chrdevs1ur->rt710,
params->freq, 28860, 4);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: rt710_set_params(%u, 28860, 4) failed. (ret: %d)\n",
chrdev_group->id, params->freq, ret);
break;
}
i = 50;
while (i--) {
ret = rt710_is_pll_locked(&chrdevs1ur->rt710,
&tuner_locked);
if (!ret && tuner_locked)
break;
msleep(10);
}
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: rt710_is_pll_locked() failed. (ret: %d)\n",
chrdev_group->id, ret);
break;
} else if (!tuner_locked) {
/* PLL error */
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: PLL is NOT locked.\n",
chrdev_group->id);
ret = -EAGAIN;
break;
}
rt710_get_rf_signal_strength(&chrdevs1ur->rt710, &ss);
dev_dbg(s1ur->dev,
"s1ur_chrdev_tune %u: PLL is locked. count: %d, signal strength: %d.%03ddBm\n",
chrdev_group->id, i, ss / 1000, -ss % 1000);
ret = tc90522_set_agc_s(&chrdevs1ur->tc90522_s, true);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_tune %u: tc90522_set_agc_s(true) failed. (ret: %d)\n",
chrdev_group->id, ret);
break;
}
break;
#endif
default:
ret = -EINVAL;
break;
@@ -614,12 +553,7 @@ static int s1ur_chrdev_check_lock(struct ptx_chrdev *chrdev, bool *locked)
ret = tc90522_is_signal_locked_t(&chrdevs1ur->tc90522_t,
locked);
break;
#if 0
case PTX_ISDB_S_SYSTEM:
ret = tc90522_is_signal_locked_s(&chrdevs1ur->tc90522_s,
locked);
break;
#endif
default:
ret = -EINVAL;
break;
@@ -628,75 +562,6 @@ static int s1ur_chrdev_check_lock(struct ptx_chrdev *chrdev, bool *locked)
return ret;
}
static int s1ur_chrdev_set_stream_id(struct ptx_chrdev *chrdev,
u16 stream_id)
{
int ret = 0, i;
struct ptx_chrdev_group *chrdev_group = chrdev->parent;
struct s1ur_chrdev *chrdevs1ur = chrdev->priv;
struct s1ur_device *s1ur = container_of(chrdevs1ur,
struct s1ur_device,
chrdevs1ur);
struct tc90522_demod *tc90522_s = &chrdevs1ur->tc90522_s;
u16 tsid, tsid2;
dev_dbg(s1ur->dev,
"s1ur_chrdev_set_stream_id %u\n", chrdev_group->id);
if (chrdev->current_system != PTX_ISDB_S_SYSTEM)
return -EINVAL;
if (stream_id < 12) {
i = 100;
while (i--) {
ret = tc90522_tmcc_get_tsid_s(tc90522_s,
stream_id, &tsid);
if ((!ret && tsid) || ret == -EINVAL)
break;
msleep(10);
}
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_set_stream_id_s %u: tc90522_tmcc_get_tsid_s() failed. (ret: %d)\n",
chrdev_group->id, ret);
return ret;
}
if (!tsid) {
ret = -EAGAIN;
return ret;
}
} else {
tsid = stream_id;
}
ret = tc90522_set_tsid_s(tc90522_s, tsid);
if (ret) {
dev_err(s1ur->dev,
"s1ur_chrdev_set_stream_id_s %u: tc90522_set_tsid_s(0x%x) failed. (ret: %d)\n",
chrdev_group->id, tsid, ret);
return ret;
}
/* check slot */
i = 100;
while(i--) {
ret = tc90522_get_tsid_s(tc90522_s, &tsid2);
if (!ret && tsid2 == tsid)
break;
msleep(10);
}
if (tsid2 != tsid)
ret = -EAGAIN;
return ret;
}
static int s1ur_chrdev_start_capture(struct ptx_chrdev *chrdev)
{
int ret = 0;
@@ -730,18 +595,8 @@ static int s1ur_chrdev_start_capture(struct ptx_chrdev *chrdev)
break;
#if 0
case PTX_ISDB_S_SYSTEM:
ret = tc90522_enable_ts_pins_s(&chrdevs1ur->tc90522_s, true);
if (ret)
dev_err(s1ur->dev,
"s1ur_chrdev_start_capture %u: tc90522_enable_ts_pins_s(true) failed. (ret: %d)\n",
chrdev_group->id, ret);
break;
#endif
default:
ret = -EINVAL;
break;
}
@@ -770,13 +625,8 @@ fail_tc:
tc90522_enable_ts_pins_t(&chrdevs1ur->tc90522_t, false);
break;
#if 0
case PTX_ISDB_S_SYSTEM:
tc90522_enable_ts_pins_s(&chrdevs1ur->tc90522_s, false);
break;
#endif
default:
ret = -EINVAL;
break;
}
@@ -805,11 +655,6 @@ static int s1ur_chrdev_stop_capture(struct ptx_chrdev *chrdev)
tc90522_enable_ts_pins_t(&chrdevs1ur->tc90522_t, false);
break;
#if 0
case PTX_ISDB_S_SYSTEM:
tc90522_enable_ts_pins_s(&chrdevs1ur->tc90522_s, false);
break;
#endif
default:
break;
}
@@ -833,11 +678,6 @@ static int s1ur_chrdev_read_cnr_raw(struct ptx_chrdev *chrdev, u32 *value)
ret = tc90522_get_cndat_t(&chrdevs1ur->tc90522_t, value);
break;
#if 0
case PTX_ISDB_S_SYSTEM:
ret = tc90522_get_cn_s(&chrdevs1ur->tc90522_s, (u16 *)value);
break;
#endif
default:
ret = -EINVAL;
break;
@@ -853,7 +693,7 @@ static struct ptx_chrdev_operations s1ur_chrdev_ops = {
.release = s1ur_chrdev_release,
.tune = s1ur_chrdev_tune,
.check_lock = s1ur_chrdev_check_lock,
.set_stream_id = s1ur_chrdev_set_stream_id,
.set_stream_id = NULL,
.set_lnb_voltage = NULL,
.set_capture = s1ur_chrdev_set_capture,
.read_signal_strength = NULL,
@@ -881,7 +721,7 @@ static int s1ur_device_load_config(struct s1ur_device *s1ur,
return ret;
}
chrdev_config->system_cap = PTX_ISDB_T_SYSTEM | PTX_ISDB_S_SYSTEM;
chrdev_config->system_cap = PTX_ISDB_T_SYSTEM;
input->enable = true;
input->is_parallel = false;
@@ -911,31 +751,34 @@ static int s1ur_device_load_config(struct s1ur_device *s1ur,
chrdevs1ur->r850.config.no_imr_calibration = true;
chrdevs1ur->r850.config.no_lpf_calibration = true;
#if 0
chrdevs1ur->rt710.dev = dev;
chrdevs1ur->rt710.i2c = &chrdevs1ur->tc90522_s.i2c_master;
chrdevs1ur->rt710.i2c_addr = 0x7a;
chrdevs1ur->rt710.config.xtal = 24000;
chrdevs1ur->rt710.config.loop_through = false;
chrdevs1ur->rt710.config.clock_out = false;
chrdevs1ur->rt710.config.signal_output_mode = RT710_SIGNAL_OUTPUT_DIFFERENTIAL;
chrdevs1ur->rt710.config.agc_mode = RT710_AGC_POSITIVE;
chrdevs1ur->rt710.config.vga_atten_mode = RT710_VGA_ATTEN_OFF;
chrdevs1ur->rt710.config.fine_gain = RT710_FINE_GAIN_3DB;
chrdevs1ur->rt710.config.scan_mode = RT710_SCAN_MANUAL;
#endif
switch(s1ur->s1ur_model) {
case PXS1UR_MODEL:
default:
for (i = 1; i < 5; i++) {
it930x->config.input[i].enable = false;
it930x->config.input[i].port_number = i;
}
break;
for (i = 1; i < 5; i++) {
it930x->config.input[i].enable = false;
it930x->config.input[i].port_number = i;
case ISDBT2071_MODEL:
input->port_number = 4;
input->i2c_addr = 0x18;
chrdevs1ur->tc90522_t.i2c_addr = 0x18;
for (i = 1; i < 5; i++) {
it930x->config.input[i].enable = false;
it930x->config.input[i].port_number = i - 1;
}
break;
}
return 0;
}
int s1ur_device_init(struct s1ur_device *s1ur, struct device *dev,
struct ptx_chrdev_context *chrdev_ctx,
struct completion *quit_completion)
enum s1ur_model s1ur_model,
struct ptx_chrdev_context *chrdev_ctx,
struct completion *quit_completion)
{
int ret = 0;
struct it930x_bridge *it930x;
@@ -954,6 +797,7 @@ int s1ur_device_init(struct s1ur_device *s1ur, struct device *dev,
kref_init(&s1ur->kref);
s1ur->dev = dev;
s1ur->s1ur_model = s1ur_model;
s1ur->quit_completion = quit_completion;
stream_ctx = kzalloc(sizeof(*stream_ctx), GFP_KERNEL);
@@ -1015,17 +859,6 @@ int s1ur_device_init(struct s1ur_device *s1ur, struct device *dev,
if (ret)
goto fail_device;
#if 0
ret = it930x_set_gpio_mode(it930x, 11, IT930X_GPIO_OUT, true);
if (ret)
goto fail_device;
/* LNB power supply: off */
ret = it930x_write_gpio(it930x, 11, false);
if (ret)
goto fail_device;
#endif
if (px4_device_params.discard_null_packets) {
struct it930x_pid_filter filter;

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* PTX driver definitions for PLEX PX-S1UR device (s1ur_device.h)
* PTX driver definitions for PLEX PX-S1UR and DIGIBEST ISDBT2071 (DTV03A-1TU) devices (s1ur_device.h)
*
* Copyright (c) 2023 techma.
*/
@@ -20,19 +20,25 @@
#include "r850.h"
#define S1UR_CHRDEV_NUM 1
#define ISDBT2071_CHRDEV_NUM 1
enum s1ur_model {
PXS1UR_MODEL = 0,
ISDBT2071_MODEL,
};
struct s1ur_chrdev {
struct ptx_chrdev *chrdev;
struct tc90522_demod tc90522_t;
struct tc90522_demod tc90522_s;
struct r850_tuner r850;
/*struct rt710_tuner rt710;*/
};
struct s1ur_device {
struct kref kref;
atomic_t available;
struct device *dev;
enum s1ur_model s1ur_model;
struct completion *quit_completion;
struct ptx_chrdev_group *chrdev_group;
struct s1ur_chrdev chrdevs1ur;
@@ -41,8 +47,9 @@ struct s1ur_device {
};
int s1ur_device_init(struct s1ur_device *s1ur, struct device *dev,
struct ptx_chrdev_context *chrdev_ctx,
struct completion *quit_completion);
enum s1ur_model s1ur_model,
struct ptx_chrdev_context *chrdev_ctx,
struct completion *quit_completion);
void s1ur_device_term(struct s1ur_device *s1ur);
#endif

View File

@@ -5,6 +5,7 @@ KERNEL=="isdb2056video*", GROUP="video", MODE="0664"
KERNEL=="isdb6014video*", GROUP="video", MODE="0664"
KERNEL=="pxm1urvideo*", GROUP="video", MODE="0664"
KERNEL=="pxs1urvideo*", GROUP="video", MODE="0664"
KERNEL=="isdbt2071video*", GROUP="video", MODE="0664"
# Digibest 製チューナーに常に USB 電源を供給し、チューナーが不安定にならないようにする
SUBSYSTEM=="usb", ATTRS{idVendor}=="0511", ACTION=="add", TEST=="power/control", ATTR{power/control}="on"