22 Sep, 2016
2 commits
-
Use new style attach.
Signed-off-by: Matthias Schwarzott
Signed-off-by: Mauro Carvalho Chehab -
cx231xx does not yet support attaching new-style i2c_client DVB demod
drivers. Add necessary code base on tuner support for i2c_client.Signed-off-by: Matthias Schwarzott
Signed-off-by: Mauro Carvalho Chehab
20 Sep, 2016
2 commits
-
These i2c_algorithm structures are only stored in the alg field of an
i2c_adapter structure, which is declared as const. This declare the
structures as const as well.The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)//
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.alg = &i@p;@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct i2c_algorithm i = { ... };
//Signed-off-by: Julia Lawall
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
Check for snd_pcm_ops structures that are only stored in the ops field of a
snd_soc_platform_driver structure or passed as the third argument to
snd_pcm_set_ops. The corresponding field or parameter is declared const,
so snd_pcm_ops structures that have this property can be declared as const
also.The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)//
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_pcm_ops i@p = { ... };@ok1@
identifier r.i;
struct snd_soc_platform_driver e;
position p;
@@
e.ops = &i@p;@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
snd_pcm_set_ops(e1, e2, &i@p)@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_pcm_ops e;
@@
e@i@p@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct snd_pcm_ops i = { ... };
//Signed-off-by: Julia Lawall
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab
06 Sep, 2016
7 commits
-
Without this patch, a bug is issued when the module is removed:
[ 1417.425863] cx231xx 1-3.1.4:1.1: Cx231xx dvb Extension removed
[ 1417.571923] BUG: unable to handle kernel paging request at ffffffffc081a024
[ 1417.571962] IP: [] string+0x24/0x80
[ 1417.571987] PGD 1c09067 PUD 1c0b067 PMD 88e653067 PTE 0
[ 1417.572013] Oops: 0000 [#1] SMP
[ 1417.572026] Modules linked in: mb86a20s dvb_core cx231xx_alsa ir_kbd_i2c(-) tda18271 tea5767 tuner cx25840 cx231xx i2c_mux videobuf_vmalloc tveeprom cx2341x videobuf_core rc_core v4l2_common videodev media bnep usblp fuse xt_CHECKSUM iptable_mangle tun ebtable_filter ebtables ip6table_filter ip6_tables xt_physdev br_netfilter bridge nf_log_ipv4 nf_log_common xt_LOG xt_conntrack ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack cpufreq_stats vfat fat snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel snd_hda_intel snd_hda_codec kvm snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm irqbypass crct10dif_pclmul iTCO_wdt crc32_pclmul nfsd hci_uart iTCO_vendor_support
[ 1417.572317] snd_timer ghash_clmulni_intel btbcm intel_cstate btqca snd intel_uncore btintel intel_rapl_perf mei_me bluetooth mei shpchp soundcore pcspkr i2c_i801 auth_rpcgss wmi acpi_als kfifo_buf nfs_acl industrialio rfkill lockd pinctrl_sunrisepoint pinctrl_intel tpm_tis tpm intel_lpss_acpi intel_lpss acpi_pad grace sunrpc binfmt_misc hid_logitech_hidpp hid_logitech_dj 8021q garp stp llc mrp i915 i2c_algo_bit drm_kms_helper drm e1000e sdhci_pci sdhci mmc_core crc32c_intel ptp pps_core video i2c_hid fjes analog gameport joydev [last unloaded: rc_pixelview_002t]
[ 1417.572487] CPU: 4 PID: 24493 Comm: rmmod Tainted: G W 4.7.0+ #2
[ 1417.572504] Hardware name: /NUC6i7KYB, BIOS KYSKLi70.86A.0041.2016.0817.1130 08/17/2016
[ 1417.572526] task: ffff880894b81e80 ti: ffff880896bdc000 task.ti: ffff880896bdc000
[ 1417.572544] RIP: 0010:[] [] string+0x24/0x80
[ 1417.572564] RSP: 0018:ffff880896bdfbe8 EFLAGS: 00010286
[ 1417.572577] RAX: ffffffffc081a025 RBX: ffff8808935aa15c RCX: ffff0a00ffffff04
[ 1417.572594] RDX: ffffffffc081a024 RSI: ffffffffffffffff RDI: ffff8808935aa15c
[ 1417.572610] RBP: ffff880896bdfbe8 R08: fffffffffffffffe R09: ffff8808935aa91c
[ 1417.572628] R10: ffffffffc07b85d6 R11: 0000000000000000 R12: ffff8808935aa91c
[ 1417.572644] R13: 00000000000007c5 R14: ffffffffc07b85dd R15: ffffffffc07b85dd
[ 1417.572662] FS: 00007f5a5392d700(0000) GS:ffff8808bed00000(0000) knlGS:0000000000000000
[ 1417.572681] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1417.572705] CR2: ffffffffc081a024 CR3: 0000000897188000 CR4: 00000000003406e0
[ 1417.572735] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1417.572761] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 1417.572778] Stack:
[ 1417.572785] ffff880896bdfc48 ffffffff813dcf77 0000000000000005 ffff8808935aa157
[ 1417.572806] ffff880896bdfc58 ffff0a00ffffff04 000000009d27375e ffff8808935aa000
[ 1417.572829] 0000000000000800 ffff880896182800 0000000000000000 ffff88089e898ae0
[ 1417.572850] Call Trace:
[ 1417.572860] [] vsnprintf+0x2d7/0x500
[ 1417.572873] [] add_uevent_var+0x82/0x120
[ 1417.572890] [] rc_dev_uevent+0x2d/0x60 [rc_core]
[ 1417.572907] [] dev_uevent+0xd9/0x2d0
[ 1417.572921] [] kobject_uevent_env+0x2d9/0x4f0
[ 1417.572938] [] kobject_uevent+0xb/0x10
[ 1417.572954] [] device_del+0x18f/0x260
[ 1417.572974] [] ? kobject_put+0x27/0x50
[ 1417.572998] [] rc_unregister_device+0x75/0xb0 [rc_core]
[ 1417.573028] [] ir_remove+0x23/0x30 [ir_kbd_i2c]
[ 1417.573055] [] i2c_device_remove+0x58/0xb0
[ 1417.573078] [] __device_release_driver+0xa1/0x160
[ 1417.573102] [] driver_detach+0xa6/0xb0
[ 1417.573122] [] bus_remove_driver+0x55/0xd0
[ 1417.573146] [] driver_unregister+0x2c/0x50
[ 1417.573168] [] i2c_del_driver+0x22/0x50
[ 1417.573194] [] ir_kbd_driver_exit+0x10/0x46c [ir_kbd_i2c]
[ 1417.573227] [] SyS_delete_module+0x1b8/0x220
[ 1417.573254] [] entry_SYSCALL_64_fastpath+0x1a/0xa4
[ 1417.573279] Code: eb e9 76 ff ff ff 90 55 49 89 f1 48 89 ce 48 c1 fe 30 48 81 fa ff 0f 00 00 48 89 e5 4c 8d 46 ff 76 40 48 85 f6 74 4e 48 8d 42 01 b6 12 84 d2 74 43 49 01 c0 31 f6 eb 0c 48 83 c0 01 0f b6 50
[ 1417.573437] RIP [] string+0x24/0x80
[ 1417.573455] RSP
[ 1417.573465] CR2: ffffffffc081a024
[ 1417.580053] ---[ end trace 4ca9e2eced326a62 ]---Signed-off-by: Mauro Carvalho Chehab
-
The driver should not ignore errors while registering the I2C
bus, as this device can't even minimally work without the buses,
as it uses those buses internally to talk with the several IP
blocks inside the chip.Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab -
The cx231xx_get_i2c_adap() function should return the I2C
adapter that will be used to talk with a device. It should never
be NULL, as otherwise the driver will try to dereference a
null pointer.We might instead fix the callers, but if this condition
ever happens, it is really a driver bug, because i2c_port
should always be a value from enum CX231XX_I2C_MASTER_PORT.Found when checking the code due to this bug:
[ 39.769021] BUG: unable to handle kernel NULL pointer dereference at 0000000000000002
[ 39.769105] IP: [] i2c_master_send+0x13/0x70Signed-off-by: Mauro Carvalho Chehab
-
The number of the cx231xx REQ for GPIO register set/get are wrong.
They should follow what's there at cx231xx-pcb-cfg.h.Noticed while checking the cx231xx parser at the v4l-utils.
Signed-off-by: Mauro Carvalho Chehab
-
If something bad happens when switching between digital
and analog mode, prints an error and outputs the returned code.Signed-off-by: Mauro Carvalho Chehab
-
This device uses GPIOs: 28 to switch between analog and
digital modes: on digital mode, it should be set to 1.The code that sets it on analog mode is OK, but it misses
the logic that sets it on digital mode.Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab -
The cx231xx_set_agc_analog_digital_mux_select() callers
expect it to return 0 or an error. Returning a positive value
makes the first attempt to switch between analog/digital to fail.Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab
24 Aug, 2016
3 commits
-
kmalloc will print enough information in case of failure.
Signed-off-by: Wolfram Sang
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
kmalloc will print enough information in case of failure.
Signed-off-by: Wolfram Sang
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
kmalloc will print enough information in case of failure.
Signed-off-by: Wolfram Sang
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab
06 Aug, 2016
1 commit
-
Sometimes, the USB pipe could enter into a stalled state,
and may need a reset to rework.Add such logic.
[mchehab@osg.samsung.com: ported from Android's source:
https://android.googlesource.com/kernel/x86_64/+/3a322adc0084fd277b43070712c7dc0dc9245435%5E%21]Signed-off-by: Terry Heo
Signed-off-by: Mauro Carvalho Chehab
12 Jul, 2016
1 commit
-
This op is deprecated and should not be used anymore.
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab
20 May, 2016
1 commit
-
Pull i2c updates from Wolfram Sang:
- Peter Rosin did some major rework on the locking of i2c muxes by
seperating parent-locked muxes and mux-locked muxes.This avoids deadlocks/workarounds when the mux itself needs i2c
commands for muxing. And as a side-effect, other workarounds in the
media layer could be eliminated. Also, Peter stepped up as the i2c
mux maintainer and will keep an eye on these changes.- major updates to the octeon driver
- add a helper to the core to generate the address+rw_bit octal and
make drivers use it- quite a bunch of driver updates
* 'i2c/for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (84 commits)
i2c: rcar: add DMA support
i2c: st: Implement bus clear
i2c: only check scl functions when using generic recovery
i2c: algo-bit: declare i2c_bit_quirk_no_clk_stretch as static
i2c: tegra: disable clock before returning error
[media] rtl2832: regmap is aware of lockdep, drop local locking hack
[media] rtl2832_sdr: get rid of empty regmap wrappers
[media] rtl2832: change the i2c gate to be mux-locked
[media] si2168: change the i2c gate to be mux-locked
iio: imu: inv_mpu6050: change the i2c gate to be mux-locked
i2c: mux: document i2c muxes and elaborate on parent-/mux-locked muxes
i2c: mux: relax locking of the top i2c adapter during mux-locked muxing
i2c: muxes always lock the parent adapter
i2c: allow adapter drivers to override the adapter locking
i2c: uniphier: add "\n" at the end of error log
i2c: mv64xxx: remove CONFIG_HAVE_CLK conditionals
i2c: mv64xxx: use clk_{prepare_enable,disable_unprepare}
i2c: mv64xxx: handle probe deferral for the clock
i2c: mv64xxx: enable the driver on ARCH_MVEBU
i2c: octeon: Add workaround for broken irqs on CN3860
...
25 Apr, 2016
1 commit
-
We print an uninitialized "actlen" variable on the error path.
Signed-off-by: Dan Carpenter
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab
22 Apr, 2016
1 commit
-
Allocate an explicit i2c mux core to handle parent and child adapters
etc. Update the select op to be in terms of the i2c mux core instead
of the child adapter.Tested-by: Antti Palosaari
Signed-off-by: Peter Rosin
Signed-off-by: Wolfram Sang
14 Apr, 2016
2 commits
-
Instead of returning -1, return valid error codes.
Signed-off-by: Mauro Carvalho Chehab
-
When we returned on error we missed freeing p_current_fw and p_buffer.
Signed-off-by: Sudip Mukherjee
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab
23 Feb, 2016
2 commits
-
Right now, media_device_pci_init and media_device_usb_init does
media_device allocation internaly. That preents its usage when
the media_device struct is embedded on some other structure.Move memory allocation outside it, to make it more generic.
Signed-off-by: Mauro Carvalho Chehab
-
Those ancillary functions could be called even when compiled
without V4L2 support, as warned by ktest build robot:All errors (new ones prefixed by >>):
>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb/dvb-usb.ko] undefined!
>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb-v2/dvb_usb_v2.ko] undefined!
>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/au0828/au0828.ko] undefined!Also, there's nothing there that are specific to V4L2. So, move
those ancillary functions to MC core.No functional changes. Just function rename.
Signed-off-by: Mauro Carvalho Chehab
16 Feb, 2016
5 commits
-
This macro is not used inside the driver. get rid of it.
Acked-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
We need to add connectors to the cx231xx graph.
Signed-off-by: Mauro Carvalho Chehab
-
As si2157 doesn't use the subdev, but has instead a binding
logic that doesn't have any core framework, we need to manually
pass the media_device struct via platform data on every place
it is called.This fixes support for HVR-955Q when MC is enabled.
Signed-off-by: Mauro Carvalho Chehab
-
Instead of having its own routine, use the one defined at the
core, as it is generic enough to handle the cx231xx usecases.Signed-off-by: Mauro Carvalho Chehab
-
Except for the usbuvc driver (with has an embedded media_device
struct on it), the other drivers have a pointer to media_device.On those drivers, replace their own implementation for the core
one. That warrants that those subdev drivers will fill the
media_device info the same way.Signed-off-by: Mauro Carvalho Chehab
01 Feb, 2016
3 commits
-
dma_area needs to be freed when the device is closed.
Based on em23xx-audio.c
Signed-off-by: Jean-Baptiste Theou
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
Since kmalloc can be failed in memory pressure,
if not properly handled, NULL dereference can be happendSigned-off-by: Insu Yun
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
The output of a tuner is not only IF frequencies. They may also
output audio on some of its pins, and may even be a zero-IF tuner,
with outputs a baseband. So, rename the PAD name to make it
clearer and add a proper documentation about that at tuner.h.No functional changes.
Signed-off-by: Mauro Carvalho Chehab
11 Jan, 2016
9 commits
-
Several pure digital TV devices have a frontend with the tuner
integrated on it. Add the RF connector when dvb_create_media_graph()
is called on such devices.Tested with siano and dvb_usb_mxl111sf drivers.
Signed-off-by: Mauro Carvalho Chehab
-
There are now two new warnings:
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_media_device_register':
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:433:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
media_device_register(adap->dvb_adap.mdev);
^
drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 'dvb_usb_media_device_register':
drivers/media/usb/dvb-usb/dvb-usb-dvb.c:128:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result]
media_device_register(adap->dvb_adap.mdev);
^Those are because the drivers are not properly checking if the
media device init and register were succeeded.Fix it.
Signed-off-by: Mauro Carvalho Chehab
-
The media device node is registered and so made visible to user-space
before entities are registered and links created which means that the
media graph obtained by user-space could be only partially enumerated
if that happens too early before all the graph has been created.To avoid this race condition, split the media init and registration
in separate functions and only register the media device node when
all the pending subdevices have been registered, either explicitly
by the driver or asynchronously using v4l2_async_register_subdev().The media_device_register() had a check for drivers not filling dev
and model fields but all drivers in mainline set them and not doing
it will be a driver bug so change the function return to void and
add a BUG_ON() for dev being NULL instead.Also, add a media_device_cleanup() function that will destroy the
graph_mutex that is initialized in media_device_init().[mchehab@osg.samsung.com: Fix compilation if !CONFIG_MEDIA_CONTROLLER
and remove two warnings added by this changeset]
Suggested-by: Sakari Ailus
Signed-off-by: Javier Martinez Canillas
Acked-by: Sakari Ailus
Signed-off-by: Mauro Carvalho Chehab -
With the MC next gen rework, what's left for media_entity_init()
is to just initialize the PADs. However, certain devices, like
a FLASH led/light doesn't have any input or output PAD.So, there's no reason why calling media_entity_init() would be
mandatory. Also, despite its name, what this function actually
does is to initialize the PADs data. So, rename it to
media_entity_pads_init() in order to reflect that.The media entity actual init happens during entity register,
at media_device_register_entity(). We should move init of
num_links and num_backlinks to it.Signed-off-by: Mauro Carvalho Chehab
-
Rename the userspace types from MEDIA_ENT_T_ to MEDIA_ENT_F_
and add the backward compatibility bits.The changes at the .c files was generated by the following
coccinelle script:@@
@@
-MEDIA_ENT_T_UNKNOWN
+MEDIA_ENT_F_UNKNOWN
@@
@@
-MEDIA_ENT_T_DVB_BASE
+MEDIA_ENT_F_DVB_BASE
@@
@@
-MEDIA_ENT_T_V4L2_BASE
+MEDIA_ENT_F_V4L2_BASE
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_BASE
+MEDIA_ENT_F_V4L2_SUBDEV_BASE
@@
@@
-MEDIA_ENT_T_CONNECTOR_BASE
+MEDIA_ENT_F_CONNECTOR_BASE
@@
@@
-MEDIA_ENT_T_V4L2_VIDEO
+MEDIA_ENT_F_IO_V4L
@@
@@
-MEDIA_ENT_T_V4L2_VBI
+MEDIA_ENT_F_IO_VBI
@@
@@
-MEDIA_ENT_T_V4L2_SWRADIO
+MEDIA_ENT_F_IO_SWRADIO
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN
+MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN
@@
@@
-MEDIA_ENT_T_CONN_RF
+MEDIA_ENT_F_CONN_RF
@@
@@
-MEDIA_ENT_T_CONN_SVIDEO
+MEDIA_ENT_F_CONN_SVIDEO
@@
@@
-MEDIA_ENT_T_CONN_COMPOSITE
+MEDIA_ENT_F_CONN_COMPOSITE
@@
@@
-MEDIA_ENT_T_CONN_TEST
+MEDIA_ENT_F_CONN_TEST
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_SENSOR
+MEDIA_ENT_F_CAM_SENSOR
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_FLASH
+MEDIA_ENT_F_FLASH
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_LENS
+MEDIA_ENT_F_LENS
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_DECODER
+MEDIA_ENT_F_ATV_DECODER
@@
@@
-MEDIA_ENT_T_V4L2_SUBDEV_TUNER
+MEDIA_ENT_F_TUNER
@@
@@
-MEDIA_ENT_T_DVB_DEMOD
+MEDIA_ENT_F_DTV_DEMOD
@@
@@
-MEDIA_ENT_T_DVB_DEMUX
+MEDIA_ENT_F_TS_DEMUX
@@
@@
-MEDIA_ENT_T_DVB_TSOUT
+MEDIA_ENT_F_IO_DTV
@@
@@
-MEDIA_ENT_T_DVB_CA
+MEDIA_ENT_F_DTV_CA
@@
@@
-MEDIA_ENT_T_DVB_NET_DECAP
+MEDIA_ENT_F_DTV_NET_DECAPSigned-off-by: Mauro Carvalho Chehab
-
Entities should have one or more functions. Calling it as a
type proofed to not be correct, as an entity could eventually
have more than one type.So, rename the field as function.
Please notice that this patch doesn't extend support for
multiple function entities. Such change will happen when
we have real case drivers using it.No functional changes.
Acked-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
If the graph creation fails, don't register the device.
Acked-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
If media controller is enabled and mdev is filled, it should
ensure that the media graph will be properly initialized.Enforce that.
Acked-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab -
Tuners actually have at least one connector on its input.
Add a PAD to connect it.
Acked-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab