-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging into the mainline kernel #29
Comments
@jonjonarnearne you are familiar with the process, can you please help? |
Hi, I would love to help, but I don't have time to handle the communication I've started to write down some notes about what have to be done, and I If I haven't posted anything here by tomorow, plase ping me again :) @jonjonarnearne https://github.com/jonjonarnearne you are familiar with — Reply to this email directly, view it on GitHub |
It's been some years since I last did this, but this is what needs to be done as I remember it.
The reason we use the linux-media tree from linuxtv.org instead of the Linus' kernel tree, is that they have all the latest changes for the v4l2 subsystem. Also, if I'm not wrong or something have changed for the last two years, Mauro Carvalho Chehab and/or Hans Verkuil are maintaining that tree, and they are responsible for sending the media-drivers to the mainline kernel. As this is written from memory, I've probably forgotten some steps, and some of this info might be totally wrong. I'll try to find my old hard-drive, and see if I have any notes there about what I did exactly. The one thing I remember is that the process of sending these PATHCES/RFCs are pretty exhausting/time consuming, and one kernel-maintainer told me he could spend several days preparing patches for the kernel. Also, please read: https://www.kernel.org/doc/Documentation/SubmitChecklist https://www.kernel.org/doc/Documentation/SubmittingPatches Please don't hesitate to ask here if you need more help. |
The linux-media maintainers have made comments about what needs to be fixed in the driver. The issues that they have found in the code must be fixed first before doing another attempt to get the driver accepted into the Linux kernel. Mauro's review: https://lkml.org/lkml/2013/10/3/486 |
Short variant comments from Mauro Carvalho Chehab void smi2021_stop_audio(struct smi2021 *smi2021)
{
/*
* HACK: Stop the audio subsystem,
* without this, the pcm middle-layer will hang waiting for more data.
*
* Is there a better way to do this?
*/
smi2021_bootloader.c: 78:79
static const struct firmware *firmware[ARRAY_SIZE(available_fw)];
static int firmwares = -1;
static int smi2021_choose_firmware(struct usb_device *udev)
{
int i, found, id;
for (i = 0; i < ARRAY_SIZE(available_fw); i++) {
found = available_fw[i].found;
id = available_fw[i].id;
if (firmware_version == id && found >= 0) {
dev_info(&udev->dev, "uploading firmware for 0x%x\n",
id);
return smi2021_load_firmware(udev, firmware[found]);
int smi2021_bootloader_probe(struct usb_interface *intf,
const struct usb_device_id *devid)
{
struct usb_device *udev = interface_to_usbdev(intf);
int rc, i;
/* Check what firmwares are available in the system */
for (i = 0; i < ARRAY_SIZE(available_fw); i++) {
dev_info(&udev->dev, "Looking for: %s\n",
available_fw[i].name);
rc = request_firmware(&firmware[firmwares + 1],
available_fw[i].name, &udev->dev);
if (rc == 0) {
firmwares++;
available_fw[i].found = firmwares;
dev_info(&udev->dev, "Found firmware for 0x00%x\n",
available_fw[i].id);
} else if (rc == -ENOENT) {
available_fw[i].found = -1;
} else {
dev_err(&udev->dev,
"request_firmware failed with: %d\n", rc);
goto err_out;
}
static int smi2021_set_mode(struct smi2021 *smi2021, u8 mode)
{
int pipe, rc;
struct mode_ctrl_transfer {
u8 head;
u8 mode;
} *transfer_buf = kzalloc(sizeof(*transfer_buf), GFP_KERNEL);
if (transfer_buf == NULL)
return -ENOMEM;
static u32 smi2021_i2c_functionality(struct i2c_adapter *adap)
{
return I2C_FUNC_SMBUS_EMUL;
}
static struct i2c_algorithm smi2021_algo = {
.master_xfer = smi2021_i2c_xfer,
.functionality = smi2021_i2c_functionality,
};
/* gm7113c_init table overrides */
static enum saa7113_r10_ofts r10_ofts = SAA7113_OFTS_VFLAG_BY_VREF;
static bool r10_vrln = true;
static bool r13_adlsb = true;
/************************************************************************
* *
* DEVICE - PROBE & DISCONNECT *
* *
***********************************************************************/
|
Short variant comments from Hans Verkuil v4l2_device_call_all(&smi2021->v4l2_dev, 0, video, s_routing,
smi2021->vid_inputs[smi2021->cur_input].type, 0, 0);
smi2021_v4l2.c: 92
static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
{
struct smi2021 *smi2021 = video_drvdata(file);
*norm = smi2021->cur_norm;
return 0;
}
static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
{
struct smi2021 *smi2021 = video_drvdata(file);
*i = smi2021->cur_input;
return 0;
}
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
{
struct smi2021 *smi2021 = video_drvdata(file);
if (vb2_is_busy(&smi2021->vb2q))
return -EBUSY;
smi2021->cur_norm = norm;
if (norm & V4L2_STD_525_60)
smi2021->cur_height = SMI2021_NTSC_LINES;
else if (norm & V4L2_STD_625_50)
smi2021->cur_height = SMI2021_PAL_LINES;
else
return -EINVAL;
v4l2_device_call_all(&smi2021->v4l2_dev, 0, core, s_std,
smi2021->cur_norm);
return 0;
}
static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
{
struct smi2021 *smi2021 = video_drvdata(file);
if (i >= smi2021->vid_input_count)
return -EINVAL;
v4l2_device_call_all(&smi2021->v4l2_dev, 0, video, s_routing,
smi2021->vid_inputs[i].type, 0, 0);
smi2021->cur_input = i;
return 0;
} |
I've fixed some (all?) of the issues mentioned here in the current git
source, but it's been a couple of years so i don't remember exactly :)
…On Feb 20, 2018 5:38 PM, "mastervolkov" ***@***.***> wrote:
Short variant comments from Hans Verkuil
https://lkml.org/lkml/2013/10/4/77
1.
v4l2_device_call_all(&smi2021->v4l2_dev, 0, video, s_routing,
smi2021->vid_inputs[smi2021->cur_input].type, 0, 0);
Don't use v4l2_device_call_all for the s_routing op. The meaning of the
s_routing
arguments is subdev specific, so this is one of the very few ops that you
can't
'broadcast' using v4l2_device_call_all. Since you have only one subdev
anyway, I
would suggest replacing v4l2_device_call_all by v4l2_subdev_call.
1.
smi2021_v4l2.c: 92static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
{
struct smi2021 *smi2021 = video_drvdata(file);
Please add an empty line here.
*norm = smi2021->cur_norm;
return 0;
}
static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
{
struct smi2021 *smi2021 = video_drvdata(file);
Ditto.
*i = smi2021->cur_input;
return 0;
}
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
{
struct smi2021 *smi2021 = video_drvdata(file);
Check if the new norm == cur_norm and return 0 if that's the case. Some
apps are known
to set the std again after REQBUFS.
if (vb2_is_busy(&smi2021->vb2q))
return -EBUSY;
smi2021->cur_norm = norm;
if (norm & V4L2_STD_525_60)
smi2021->cur_height = SMI2021_NTSC_LINES;
else if (norm & V4L2_STD_625_50)
smi2021->cur_height = SMI2021_PAL_LINES;
else
return -EINVAL;
v4l2_device_call_all(&smi2021->v4l2_dev, 0, core, s_std,
smi2021->cur_norm);
return 0;
}
static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
{
struct smi2021 *smi2021 = video_drvdata(file);
if (i >= smi2021->vid_input_count)
return -EINVAL;
v4l2_device_call_all(&smi2021->v4l2_dev, 0, video, s_routing,
smi2021->vid_inputs[i].type, 0, 0);
As mentioned before, you can't use v4l2_device_call_all for s_routing.
This must
be handled per sub-device.
smi2021->cur_input = i;
return 0;
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABL2WDqxu3My0x--hbtE_XBLbQ9Cg3mQks5tWvTrgaJpZM4JVx-K>
.
|
Thanks @mastervolkov for copying the messages into this issue. We can check the source code and confirm if there aren't any changes left to do. |
I bought two SMI devices from China and they both don't work. I can't test anything. That sucks. Do capture cards from China ever work? |
This module seems mature enough to be merged into the mainline kernel, we should probably send another email out.
Previous attempt: https://lkml.org/lkml/2013/9/1/148
The text was updated successfully, but these errors were encountered: