PX-S1UR 対応 / M1UR,S1URのコード整理

This commit is contained in:
techmadot
2023-08-14 13:45:52 +09:00
parent d1e72f6506
commit e0562da5d4
9 changed files with 2350 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ PLEX社の[Webサイト](http://plex-net.co.jp)にて配布されている公式
- PX-MLT5PE
- PX-MLT8PE
- PX-M1UR
- PX-S1UR
- e-Better
@@ -122,6 +123,13 @@ gcc, make, カーネルソース/ヘッダ, dkmsがインストールされて
すべてのチューナーにおいて、ISDB-TとISDB-Sのどちらも受信可能です。
##### PLEX PX-S1URを接続した場合
$ ls /dev/pxs1urvideo*
/dev/pxs1urvideo0
すべてのチューナーにおいて、ISDB-TとISDB-Sのどちらも受信可能です。
##### e-Better DTV02-1T1S-U/DTV02A-1T1S-Uを接続した場合

View File

@@ -39,4 +39,4 @@ ccflags-y += -DITEDTV_BUS_USE_WORKQUEUE
endif
obj-m := px4_drv.o
px4_drv-y := driver_module.o ptx_chrdev.o px4_usb.o px4_usb_params.o px4_device.o px4_device_params.o px4_mldev.o pxmlt_device.o isdb2056_device.o it930x.o itedtv_bus.o tc90522.o r850.o rt710.o cxd2856er.o cxd2858er.o ringbuffer.o
px4_drv-y := driver_module.o ptx_chrdev.o px4_usb.o px4_usb_params.o px4_device.o px4_device_params.o px4_mldev.o pxmlt_device.o isdb2056_device.o it930x.o itedtv_bus.o tc90522.o r850.o rt710.o cxd2856er.o cxd2858er.o ringbuffer.o s1ur_device.o m1ur_device.o

1089
driver/m1ur_device.c Normal file

File diff suppressed because it is too large Load Diff

49
driver/m1ur_device.h Normal file
View File

@@ -0,0 +1,49 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* PTX driver definitions for PLEX PX-M1UR device (m1ur_device.h)
*
* Copyright (c) 2023 techma.
*/
#ifndef __M1UR_DEVICE_H__
#define __M1UR_DEVICE_H__
#include <linux/atomic.h>
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/completion.h>
#include <linux/device.h>
#include "ptx_chrdev.h"
#include "it930x.h"
#include "tc90522.h"
#include "r850.h"
#include "rt710.h"
#define M1UR_CHRDEV_NUM 1
struct m1ur_chrdev {
struct ptx_chrdev *chrdev;
struct tc90522_demod tc90522_t;
struct tc90522_demod tc90522_s;
struct r850_tuner r850;
struct rt710_tuner rt710;
};
struct m1ur_device {
struct kref kref;
atomic_t available;
struct device *dev;
struct completion *quit_completion;
struct ptx_chrdev_group *chrdev_group;
struct m1ur_chrdev chrdevm1ur;
struct it930x_bridge it930x;
void *stream_ctx;
};
int m1ur_device_init(struct m1ur_device *m1ur, struct device *dev,
struct ptx_chrdev_context *chrdev_ctx,
struct completion *quit_completion);
void m1ur_device_term(struct m1ur_device *m1ur);
#endif

View File

@@ -23,6 +23,8 @@
#include "px4_device.h"
#include "pxmlt_device.h"
#include "isdb2056_device.h"
#include "s1ur_device.h"
#include "m1ur_device.h"
#ifndef PX4_USB_MAX_DEVICE
#define PX4_USB_MAX_DEVICE 16
@@ -54,6 +56,12 @@
#endif
#define PXM1UR_USB_MAX_CHRDEV (PXM1UR_USB_MAX_DEVICE * ISDB2056_CHRDEV_NUM)
#ifndef PXS1UR_USB_MAX_DEVICE
#define PXS1UR_USB_MAX_DEVICE 64
#endif
#define PXS1UR_USB_MAX_CHRDEV (PXS1UR_USB_MAX_DEVICE * ISDB2056_CHRDEV_NUM)
struct px4_usb_context {
enum px4_usb_device_type type;
struct completion quit_completion;
@@ -61,10 +69,12 @@ struct px4_usb_context {
struct px4_device px4;
struct pxmlt_device pxmlt;
struct isdb2056_device isdb2056;
struct s1ur_device s1ur;
struct m1ur_device m1ur;
} ctx;
};
static struct ptx_chrdev_context *px4_usb_chrdev_ctx[7];
static struct ptx_chrdev_context *px4_usb_chrdev_ctx[MAX_USB_DEVICE_TYPE];
static int px4_usb_init_bridge(struct device *dev, struct usb_device *usb_dev,
struct it930x_bridge *it930x)
@@ -201,10 +211,23 @@ static int px4_usb_probe(struct usb_interface *intf,
break;
ctx->type = PXM1UR_USB_DEVICE;
ret = isdb2056_device_init(&ctx->ctx.isdb2056, dev,
ret = m1ur_device_init(&ctx->ctx.m1ur, dev,
px4_usb_chrdev_ctx[PXM1UR_USB_DEVICE],
&ctx->quit_completion);
break;
case USB_PID_PX_S1UR:
ret = px4_usb_init_bridge(dev, usb_dev,
&ctx->ctx.s1ur.it930x);
if (ret)
break;
ctx->type = PXS1UR_USB_DEVICE;
ret = s1ur_device_init(&ctx->ctx.s1ur, dev,
px4_usb_chrdev_ctx[PXS1UR_USB_DEVICE],
&ctx->quit_completion);
break;
default:
ret = -EINVAL;
@@ -265,7 +288,12 @@ static void px4_usb_disconnect(struct usb_interface *intf)
break;
case PXM1UR_USB_DEVICE:
isdb2056_device_term(&ctx->ctx.isdb2056);
m1ur_device_term(&ctx->ctx.m1ur);
wait_for_completion(&ctx->quit_completion);
break;
case PXS1UR_USB_DEVICE:
s1ur_device_term(&ctx->ctx.s1ur);
wait_for_completion(&ctx->quit_completion);
break;
@@ -306,6 +334,7 @@ static const struct usb_device_id px4_usb_ids[] = {
{ USB_DEVICE(0x0511, USB_PID_DIGIBEST_ISDB2056) },
{ USB_DEVICE(0x0511, USB_PID_DIGIBEST_ISDB6014_4TS) },
{ USB_DEVICE(0x0511, USB_PID_PX_M1UR) },
{ USB_DEVICE(0x0511, USB_PID_PX_S1UR) },
{ 0 }
};
@@ -380,6 +409,14 @@ int px4_usb_register()
goto fail_pxm1ur;
}
ret = ptx_chrdev_context_create("pxs1ur", "pxs1urvideo",
PXS1UR_USB_MAX_CHRDEV,
&px4_usb_chrdev_ctx[PXS1UR_USB_DEVICE]);
if (ret) {
pr_err("px4_usb_register: ptx_chrdev_context_create(\"pxs1ur\") failed.\n");
goto fail_pxs1ur;
}
ret = usb_register(&px4_usb_driver);
if (ret) {
pr_err("px4_usb_register: usb_register() failed.\n");
@@ -391,6 +428,9 @@ int px4_usb_register()
fail_usb:
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[ISDB6014_4TS_USB_DEVICE]);
fail_pxs1ur:
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[PXS1UR_USB_DEVICE]);
fail_pxm1ur:
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[PXM1UR_USB_DEVICE]);
@@ -413,6 +453,7 @@ fail:
void px4_usb_unregister()
{
usb_deregister(&px4_usb_driver);
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]);
ptx_chrdev_context_destroy(px4_usb_chrdev_ctx[ISDB2056_USB_DEVICE]);

View File

@@ -21,6 +21,8 @@
#define USB_PID_DIGIBEST_ISDB2056 0x004b
#define USB_PID_DIGIBEST_ISDB6014_4TS 0x0254
#define USB_PID_PX_M1UR 0x0854
#define USB_PID_PX_S1UR 0x0855
enum px4_usb_device_type {
UNKNOWN_USB_DEVICE = 0,
@@ -30,6 +32,9 @@ enum px4_usb_device_type {
ISDB2056_USB_DEVICE,
ISDB6014_4TS_USB_DEVICE,
PXM1UR_USB_DEVICE,
PXS1UR_USB_DEVICE,
//----
MAX_USB_DEVICE_TYPE,
};
int px4_usb_register(void);

1105
driver/s1ur_device.c Normal file

File diff suppressed because it is too large Load Diff

48
driver/s1ur_device.h Normal file
View File

@@ -0,0 +1,48 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* PTX driver definitions for PLEX PX-S1UR device (s1ur_device.h)
*
* Copyright (c) 2023 techma.
*/
#ifndef __S1UR_DEVICE_H__
#define __S1UR_DEVICE_H__
#include <linux/atomic.h>
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/completion.h>
#include <linux/device.h>
#include "ptx_chrdev.h"
#include "it930x.h"
#include "tc90522.h"
#include "r850.h"
#define S1UR_CHRDEV_NUM 1
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;
struct completion *quit_completion;
struct ptx_chrdev_group *chrdev_group;
struct s1ur_chrdev chrdevs1ur;
struct it930x_bridge it930x;
void *stream_ctx;
};
int s1ur_device_init(struct s1ur_device *s1ur, struct device *dev,
struct ptx_chrdev_context *chrdev_ctx,
struct completion *quit_completion);
void s1ur_device_term(struct s1ur_device *s1ur);
#endif

View File

@@ -4,3 +4,4 @@ KERNEL=="pxmlt8video*", GROUP="video", MODE="0664"
KERNEL=="isdb2056video*", GROUP="video", MODE="0664"
KERNEL=="isdb6014video*", GROUP="video", MODE="0644"
KERNEL=="pxm1urvideo*", GROUP="video", MODE="0644"
KERNEL=="pxs1urvideo*", GROUP="video", MODE="0644"