Re: [PATCH] [media] gspca/touptek: Fix a few CodingStyle issues
Hi, On 01/29/2015 09:25 PM, Mauro Carvalho Chehab wrote: Checkpatch complained about a few issues, like FSF address. Also, multi-line comments are not following the Kernel CodingStyle. While not too late, let's fix those issues. Cc: John McMaster johndmcmas...@gmail.com Cc: Hans de Goede hdego...@redhat.com Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com Looks good, thanks for fixing this up, and sorry for missing this. Acked-by: Hans de Goede hdego...@redhat.com Regards, Hans diff --git a/drivers/media/usb/gspca/touptek.c b/drivers/media/usb/gspca/touptek.c index 8b7c01e4b772..7bac6bc96063 100644 --- a/drivers/media/usb/gspca/touptek.c +++ b/drivers/media/usb/gspca/touptek.c @@ -17,10 +17,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include gspca.h @@ -32,80 +28,80 @@ MODULE_DESCRIPTION(ToupTek UCMOS / Amscope MU microscope camera driver); MODULE_LICENSE(GPL); /* -Exposure reg is linear with exposure time -Exposure (sec), E (reg) -0.000400, 0x0002 -0.001000, 0x0005 -0.005000, 0x0019 -0.02, 0x0064 -0.08, 0x0190 -0.40, 0x07D0 -1.00, 0x1388 -2.00, 0x2710 - -Three gain stages -0x1000: master channel enable bit -0x007F: low gain bits -0x0080: medium gain bit -0x0100: high gain bit -gain = enable * (1 + regH) * (1 + regM) * z * regL - -Gain implementation -Want to do something similar to mt9v011.c's set_balance - -Gain does not vary with resolution (checked 640x480 vs 1600x1200) - -Constant derivation: - -Raw data: -Gain, GTOP, B, R, GBOT -1.00, 0x105C, 0x1068, 0x10C8, 0x105C -1.20, 0x106E, 0x107E, 0x10D6, 0x106E -1.40, 0x10C0, 0x10CA, 0x10E5, 0x10C0 -1.60, 0x10C9, 0x10D4, 0x10F3, 0x10C9 -1.80, 0x10D2, 0x10DE, 0x11C1, 0x10D2 -2.00, 0x10DC, 0x10E9, 0x11C8, 0x10DC -2.20, 0x10E5, 0x10F3, 0x11CF, 0x10E5 -2.40, 0x10EE, 0x10FE, 0x11D7, 0x10EE -2.60, 0x10F7, 0x11C4, 0x11DE, 0x10F7 -2.80, 0x11C0, 0x11CA, 0x11E5, 0x11C0 -3.00, 0x11C5, 0x11CF, 0x11ED, 0x11C5 - -zR = 0.0069605943152454778 - about 3/431 = 0.0069605568445475635 -zB = 0.0095695970695970703 - about 6/627 = 0.0095693779904306216 -zG = 0.010889328063241107 - about 6/551 = 0.010889292196007259 -about 10 bits for constant + 7 bits for value = at least 17 bit intermediate -with 32 bit ints should be fine for overflow etc -Essentially gains are in range 0-0x001FF - -However, V4L expects a main gain channel + R and B balance -To keep things simple for now saturate the values of balance is too high/low -This isn't really ideal but easy way to fit the Linux model - -Converted using gain model turns out to be quite linear: -Gain, GTOP, B, R, GBOT -1.00, 92, 104, 144, 92 -1.20, 110, 126, 172, 110 -1.40, 128, 148, 202, 128 -1.60, 146, 168, 230, 146 -1.80, 164, 188, 260, 164 -2.00, 184, 210, 288, 184 -2.20, 202, 230, 316, 202 -2.40, 220, 252, 348, 220 -2.60, 238, 272, 376, 238 -2.80, 256, 296, 404, 256 -3.00, 276, 316, 436, 276 - -Maximum gain is 0x7FF * 2 * 2 = 0x1FFC (8188) -or about 13 effective bits of gain -The highest the commercial driver goes in my setup 436 -However, because could *maybe* damage circuits -limit the gain until have a reason to go higher -Solution: gain clipped and warning emitted -*/ + * Exposure reg is linear with exposure time + * Exposure (sec), E (reg) + * 0.000400, 0x0002 + * 0.001000, 0x0005 + * 0.005000, 0x0019 + * 0.02, 0x0064 + * 0.08, 0x0190 + * 0.40, 0x07D0 + * 1.00, 0x1388 + * 2.00, 0x2710 + * + * Three gain stages + * 0x1000: master channel enable bit + * 0x007F: low gain bits + * 0x0080: medium gain bit + * 0x0100: high gain bit + * gain = enable * (1 + regH) * (1 + regM) * z * regL + * + * Gain implementation + * Want to do something similar to mt9v011.c's set_balance + * + * Gain does not vary with resolution (checked 640x480 vs 1600x1200) + * + * Constant derivation: + * + * Raw data: + * Gain, GTOP, B, R, GBOT + * 1.00, 0x105C, 0x1068, 0x10C8, 0x105C + * 1.20, 0x106E, 0x107E, 0x10D6, 0x106E + * 1.40, 0x10C0, 0x10CA, 0x10E5, 0x10C0 + * 1.60, 0x10C9, 0x10D4, 0x10F3, 0x10C9 + * 1.80, 0x10D2, 0x10DE, 0x11C1, 0x10D2 + * 2.00, 0x10DC, 0x10E9, 0x11C8, 0x10DC + * 2.20, 0x10E5, 0x10F3, 0x11CF, 0x10E5 + * 2.40, 0x10EE, 0x10FE, 0x11D7, 0x10EE + * 2.60, 0x10F7, 0x11C4, 0x11DE, 0x10F7 + * 2.80, 0x11C0, 0x11CA, 0x11E5, 0x11C0 + * 3.00, 0x11C5, 0x11CF, 0x11ED, 0x11C5 + * + * zR = 0.0069605943152454778 + * about 3/431 = 0.0069605568445475635 + * zB = 0.0095695970695970703 + * about 6/627
Re: [PULL patches for 3.20]: New gspca touptek driver, gspca fixes and sunxi-cir driver improvments
Hi, On 01/29/2015 09:36 PM, Mauro Carvalho Chehab wrote: Em Thu, 15 Jan 2015 11:52:14 +0100 Hans de Goede hdego...@redhat.com escreveu: Hi Mauro, Note this pull-req superseeds my previous pull-req for 3.20 . Hmm... I ended by applying the previous pull request. I was unable to see what's new on this one. Please check if everything went fine. I used the same branch for both, so everything went fine. Thanks, Hans Thanks! Mauro Please pull from my tree for a new gspca touptek driver, various gspca fixes and some sunxi-cir driver improvments. The following changes since commit 99f3cd52aee21091ce62442285a68873e3be833f: [media] vb2-vmalloc: Protect DMA-specific code by #ifdef CONFIG_HAS_DMA (2014-12-23 16:28:09 -0200) are available in the git repository at: git://linuxtv.org/hgoede/gspca.git media-for_v3.20 for you to fetch changes up to e6a734195e2fbd9386aa58fe8931dd30c013f23e: gspca: Fix underflow in vidioc_s_parm() (2015-01-15 11:46:17 +0100) Antonio Ospite (1): gspca_stv06xx: enable button found on some Quickcam Express variant Hans Verkuil (1): pwc: fix WARN_ON Hans de Goede (3): rc: sunxi-cir: Add support for an optional reset controller rc: sunxi-cir: Add support for the larger fifo found on sun5i and sun6i gspca: Fix underflow in vidioc_s_parm() Joe Howse (1): gspca: Add high-speed modes for PS3 Eye camera John McMaster (1): gspca_touptek: Add support for ToupTek UCMOS series USB cameras .../devicetree/bindings/media/sunxi-ir.txt | 4 +- drivers/media/rc/sunxi-cir.c | 46 +- drivers/media/usb/gspca/Kconfig| 10 + drivers/media/usb/gspca/Makefile | 2 + drivers/media/usb/gspca/gspca.c| 2 +- drivers/media/usb/gspca/ov534.c| 10 +- drivers/media/usb/gspca/stv06xx/stv06xx.c | 4 +- drivers/media/usb/gspca/touptek.c | 732 + drivers/media/usb/pwc/pwc-if.c | 12 +- 9 files changed, 800 insertions(+), 22 deletions(-) create mode 100644 drivers/media/usb/gspca/touptek.c Thanks Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [media] ir-hix5hd2: remove writel/readl_relaxed define
Commit 9439eb3ab9d1ec (asm-generic: io: implement relaxed accessor macros as conditional wrappers) has added {read,write}{b,w,l,q}_relaxed to include/asm-generic/io.h Signed-off-by: Zhangfei Gao zhangfei@linaro.org --- drivers/media/rc/ir-hix5hd2.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c index b0df62961c14..58ec5986274e 100644 --- a/drivers/media/rc/ir-hix5hd2.c +++ b/drivers/media/rc/ir-hix5hd2.c @@ -16,14 +16,6 @@ #include linux/regmap.h #include media/rc-core.h -/* Allow the driver to compile on all architectures */ -#ifndef writel_relaxed -# define writel_relaxed writel -#endif -#ifndef readl_relaxed -# define readl_relaxed readl -#endif - #define IR_ENABLE 0x00 #define IR_CONFIG 0x04 #define CNT_LEADS 0x08 -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4] [media] Add LVDS RGB media bus formats
On Wed, Jan 28, 2015 at 05:55:06PM +0100, Philipp Zabel wrote: + paraOn LVDS buses, usually each sample is transferred serialized in + seven time slots per pixel clock, on three (18-bit) or four (24-bit) + differential data pairs at the same time. The remaining bits are used for + control signals as defined by SPWG/PSWG/VESA or JEIDA standards. + The 24-bit RGB format serialized in seven time slots on four lanes using + JEIDA defined bit mapping will be named + constantMEDIA_BUS_FMT_RGB888_1X7X3_JEIDA/constant, for example. + /para Hi Philipp, Should that example be MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA instead of 1X7X3? Regards, Steve -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: TBS6981/vb2-cx23885 kernel oops
On 29 January 2015 at 07:17, Hans Verkuil hverk...@xs4all.nl wrote: On 01/28/2015 01:01 PM, Nick Burrett wrote: The following are 3 samples of kernel messages that I am getting on a fairly regular basis, which seem to have started occurring since the cx23885 vb2 conversion. I am using the https://github.com/ljalves/linux_media tree from 16 Jan 2015 That's too old. You need to upgrade as you need the version that has this important fix: https://github.com/ljalves/linux_media/commit/6cf11ee6300f38b7cfc43af9b7be2afaa5e05869 After upgrading, please try again and let me know the results. My understanding is that this fixes the crashes, but that there are still 'UNBALANCED' reports and 'mpeg_risc op error' messages. Unfortunately, I seem unable to reproduce this, so the more information I get about this, the better it is. After upgrading and running for 3 days, the only remaining error I have is the 'mpeg risc op' error, which occurs infrequently. If I manage to find any way of reproducing it, then I'll let you know. Previously the BUG errors were appearing several times per day. Regards, Nick Regards, Hans I have a TBS6985 and a TBS6981 card present in the machine. The TBS6985 is working fine. The kernel messages are triggered by VDR's idle scanning which it done using the TBS6981. [16795.690383] BUG: Bad page state in process vb2-cx23885[0] pfn:36bd1 [16795.690387] page:eadaf440 count:-1 mapcount:0 mapping: (null) index:0x0 [16795.690389] flags: 0x100() [16795.690390] page dumped because: nonzero _count [16795.690391] Modules linked in: rfcomm bluetooth iptable_mangle xt_DSCP ip_tables x_tables ir_jvc_decoder(OE) ir_lirc_codec(OE) lirc_dev(OE) ir_xmp_decoder(OE) ir_sony_decoder(OE) ir_sanyo_decoder(OE) ir_sharp_decoder(OE) ir_rc6_decoder(OE) ir_rc5_decoder(OE) ir_nec_decoder(OE) ir_mce_kbd_decoder(OE) rc_tbs_nec(OE) cx25840(OE) binfmt_misc rc_dib0700_rc5(OE) dib7000p(OE) cx23885(OE) altera_ci(OE) tda18271(OE) altera_stapl(OE) snd_hda_codec_hdmi videobuf2_dvb(OE) tveeprom(OE) snd_hda_codec_realtek av201x(OE) intel_rapl cx2341x(OE) x86_pkg_temp_thermal intel_powerclamp videobuf2_dma_sg(OE) videobuf2_memops(OE) coretemp videobuf2_core(OE) kvm snd_hda_codec_generic v4l2_common(OE) snd_hda_intel snd_hda_controller snd_hda_codec videodev(OE) crct10dif_pclmul crc32_pclmul saa716x_budget(OE) ghash_clmulni_intel snd_hwdep media(OE) snd_pcm i915 aesni_intel dvb_usb_dib0700(OE) tas2101(OE) aes_x86_64 dib9000(OE) dib7000m(OE) dib0090(OE) dib0070(OE) [16795.690421] vb2: counters for queue 880227c55828: UNBALANCED! [16795.690422] cxd2820r(OE) dib3000mc(OE) lrw video [16795.690425] vb2: setup: 1 start_streaming: 1 stop_streaming: 1 [16795.690426] vb2: wait_prepare: 10464 wait_finish: 10465 [16795.690427] vb2: counters for queue 880227c55828, buffer 31: UNBALANCED! [16795.690429] vb2: buf_init: 1 buf_cleanup: 1 buf_prepare: 109 buf_finish: 110 [16795.690429] vb2: buf_queue: 109 buf_done: 109 [16795.690430] vb2: alloc: 1 put: 1 prepare: 109 finish: 109 mmap: 0 [16795.690431] vb2: get_userptr: 0 put_userptr: 0 [16795.690432] vb2: attach_dmabuf: 0 detach_dmabuf: 0 map_dmabuf: 0 unmap_dmabuf: 0 [16795.690433] vb2: get_dmabuf: 0 num_users: 0 vaddr: 110 cookie: 110 [16795.690434] gpio_ich drm_kms_helper snd_seq_midi snd_seq_midi_event snd_rawmidi gf128mul dibx000_common(OE) mb86a16(OE) snd_seq glue_helper snd_seq_device lp cx24117(OE) mei_me snd_timer dvb_usb(OE) drm ablk_helper rc_core(OE) parport saa716x_core(OE) lpc_ich snd mei dvb_core(OE) soundcore i2c_algo_bit i2c_mux serio_raw cryptd mac_hid psmouse ahci r8169 libahci mii [16795.690452] CPU: 1 PID: 16771 Comm: vb2-cx23885[0] Tainted: G OE 3.18.1-ickle75+ #1 [16795.690453] Hardware name: Shuttle SH67H3/FH67, BIOS 4.6.4 03/22/2011 [16795.690454] 81aad259 880231493a48 817781fd [16795.690456] eadaf440 880231493a78 81774bcc eadaf440 [16795.690458] 0141 0200 88023fdf4780 880231493b68 [16795.690459] Call Trace: [16795.690465] [] dump_stack+0x46/0x58 [16795.690468] [] bad_page.part.50+0xe0/0xfe [16795.690471] [] get_page_from_freelist+0x873/0x9e0 [16795.690474] [] ? select_idle_sibling+0x2b/0x120 [16795.690498] [] __alloc_pages_nodemask+0x15f/0xa50 [16795.690501] [] ? try_to_wake_up+0x1e4/0x330 [16795.690505] [] dma_generic_alloc_coherent+0xa4/0x160 [16795.690508] [] x86_swiotlb_alloc_coherent+0x21/0x50 [16795.690513] [] cx23885_risc_databuffer+0xb2/0x170 [cx23885] [16795.690519] [] ? dvb_dmx_swfilter_section_copy_dump+0x1f1/0x250 [dvb_core] [16795.690522] [] cx23885_buf_prepare+0x7f/0xd0 [cx23885] [16795.690526] [] buffer_prepare+0x19/0x20 [cx23885] [16795.690529] [] __buf_prepare+0x27e/0x390 [videobuf2_core] [16795.690532] [] vb2_internal_qbuf+0x7b/0x240 [videobuf2_core] [16795.690535] [] vb2_thread+0x10e/0x480 [videobuf2_core] [16795.690538] [] ?
[PATCH v3 0/2] V4L2: add CCF support to v4l2_clk
Hi, A v3 of a CCF support for v4l2_clk. Comments addressed. Thanks Guennadi -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/2] V4L: remove clock name from v4l2_clk API
All uses of the v4l2_clk API so far only register one clock with a fixed name. This allows us to get rid of it, which also will make CCF and DT integration easier. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- v3: .id field removed from the struct. Since CCF clocks won't be added to the V4L2 clock list at all in patch 2 in this series, no clock ID comparison is needed in v4l2_clk_find() either. drivers/media/platform/soc_camera/soc_camera.c | 6 ++--- drivers/media/usb/em28xx/em28xx-camera.c | 2 +- drivers/media/v4l2-core/v4l2-clk.c | 33 ++ include/media/v4l2-clk.h | 8 +++ 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4be2a1..ce192b6 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1380,7 +1380,7 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, snprintf(clk_name, sizeof(clk_name), %d-%04x, shd-i2c_adapter_id, shd-board_info-addr); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1561,7 +1561,7 @@ static int scan_async_group(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), %d-%04x, sasd-asd.match.i2c.adapter_id, sasd-asd.match.i2c.address); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; @@ -1666,7 +1666,7 @@ static int soc_of_bind(struct soc_camera_host *ici, snprintf(clk_name, sizeof(clk_name), of-%s, of_node_full_name(remote)); - icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, mclk, icd); + icd-clk = v4l2_clk_register(soc_camera_clk_ops, clk_name, icd); if (IS_ERR(icd-clk)) { ret = PTR_ERR(icd-clk); goto eclkreg; diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 7be661f..a4b22c2 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -330,7 +330,7 @@ int em28xx_init_camera(struct em28xx *dev) v4l2_clk_name_i2c(clk_name, sizeof(clk_name), i2c_adapter_id(adap), client-addr); - v4l2-clk = v4l2_clk_register_fixed(clk_name, mclk, -EINVAL); + v4l2-clk = v4l2_clk_register_fixed(clk_name, -EINVAL); if (IS_ERR(v4l2-clk)) return PTR_ERR(v4l2-clk); diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c index e18cc04..3ff0b00 100644 --- a/drivers/media/v4l2-core/v4l2-clk.c +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -23,17 +23,13 @@ static DEFINE_MUTEX(clk_lock); static LIST_HEAD(clk_list); -static struct v4l2_clk *v4l2_clk_find(const char *dev_id, const char *id) +static struct v4l2_clk *v4l2_clk_find(const char *dev_id) { struct v4l2_clk *clk; - list_for_each_entry(clk, clk_list, list) { - if (strcmp(dev_id, clk-dev_id)) - continue; - - if (!id || !clk-id || !strcmp(clk-id, id)) + list_for_each_entry(clk, clk_list, list) + if (!strcmp(dev_id, clk-dev_id)) return clk; - } return ERR_PTR(-ENODEV); } @@ -43,7 +39,7 @@ struct v4l2_clk *v4l2_clk_get(struct device *dev, const char *id) struct v4l2_clk *clk; mutex_lock(clk_lock); - clk = v4l2_clk_find(dev_name(dev), id); + clk = v4l2_clk_find(dev_name(dev)); if (!IS_ERR(clk)) atomic_inc(clk-use_count); @@ -127,8 +123,8 @@ void v4l2_clk_disable(struct v4l2_clk *clk) mutex_lock(clk-lock); enable = --clk-enable; - if (WARN(enable 0, Unbalanced %s() on %s:%s!\n, __func__, -clk-dev_id, clk-id)) + if (WARN(enable 0, Unbalanced %s() on %s!\n, __func__, +clk-dev_id)) clk-enable++; else if (!enable clk-ops-disable) clk-ops-disable(clk); @@ -181,7 +177,7 @@ EXPORT_SYMBOL(v4l2_clk_set_rate); struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops, const char *dev_id, - const char *id, void *priv) + void *priv) { struct v4l2_clk *clk; int ret; @@ -193,9 +189,8 @@ struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops, if (!clk) return
Re: [PATCH 6/8] WmT: adv7604 driver compatibility
Hi Wills, Thanks for the patch. First and foremost, the title of the patch is wrong. This patch does more than just adding some adv7604 compatibility. It's adding pad-level API to soc-camera. This is just a rough review. I'm not an expert in media-controller / pad-level API, I hope someone with a better knowledge of those areas will help me reviewing this. Another general comment: it has been discussed since a long time, whether a wrapper wouldn't be desired to enable a seamless use of both subdev drivers using and not using the pad-level API. Maybe it's the right time now?.. On Thu, 29 Jan 2015, William Towle wrote: Add 'struct media_pad pad' member and suitable glue code, so that soc_camera/rcar_vin can become agnostic to whether an old or new- style driver (wrt pad API use) can sit underneath This version has been reworked to include appropriate constant and datatype names for kernel v3.18 --- drivers/media/platform/soc_camera/soc_camera.c | 148 +++- drivers/media/platform/soc_camera/soc_scale_crop.c | 43 +- include/media/soc_camera.h |1 + 3 files changed, 182 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index f4be2a1..efc20bf 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -37,8 +37,11 @@ #include media/v4l2-ioctl.h #include media/v4l2-dev.h #include media/v4l2-of.h +#if 0 #include media/videobuf-core.h #include media/videobuf2-core.h +#endif No. These headers are needed even if the code can be compiled without them. +#include media/v4l2-mediabus.h Well, maybe. This header is included indirectly via soc_mediabus.h, but yes, as I just said above, headers, whose defines, structs etc. are used, should be encluded directly. Further, you'll need more headers, e.g. media-entity.h, maybe some more. /* Default to VGA resolution */ #define DEFAULT_WIDTH640 @@ -453,6 +456,98 @@ static int soc_camera_expbuf(struct file *file, void *priv, return vb2_expbuf(icd-vb2_vidq, p); } +static int soc_camera_init_user_formats_pad(struct soc_camera_device *icd, int src_pad_idx) +{ + struct v4l2_subdev *sd= soc_camera_to_subdev(icd); + struct soc_camera_host *ici = to_soc_camera_host(icd-parent); + struct v4l2_subdev_mbus_code_enum code; + int fmts= 0, raw_fmts, i, ret; Please, run this patch through checkpatch.pl. It will tell you to add a Signed-off-by line, (hopefully) to add spaces before = in multiple places, to place braces correctly, to not use C++-style comments etc. Only feel free to ignore 80-character warnings. + + code.pad= src_pad_idx; + code.index= 0; + + // subdev_has_op - enum_mbus_code vs enum_mbus_fmt + if (v4l2_subdev_has_op(sd, pad, enum_mbus_code)) { This function is called only once below and only after the above test has already returned success. Looks like you don't need it here again and the below else branch can be dropped completely? + while (!v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, code)) + code.index++; + } else { + u32 pixcode; + + while (!v4l2_subdev_call(sd, video, enum_mbus_fmt, code.index, pixcode)) + { + code.code= pixcode; + code.index++; + } + } + raw_fmts= code.index; + + if (!ici-ops-get_formats) { + /* + * Fallback mode - the host will have to serve all + * sensor-provided formats one-to-one to the user + */ + fmts = raw_fmts; + } + else { + /* + * First pass - only count formats this host-sensor + * configuration can provide + */ + for (i = 0; i raw_fmts; i++) { + int ret = ici-ops-get_formats(icd, i, NULL); + if (ret 0) + return ret; + fmts += ret; + } + } + + if (!fmts) + return -ENXIO; + + icd-user_formats = + vmalloc(fmts * sizeof(struct soc_camera_format_xlate)); + if (!icd-user_formats) + return -ENOMEM; + + dev_dbg(icd-pdev, Found %d supported formats.\n, fmts); + + /* Second pass - actually fill data formats */ + fmts = 0; + for (i = 0; i raw_fmts; i++) { + if (!ici-ops-get_formats) { + code.index= i; + // subdev_has_op - enum_mbus_code vs enum_mbus_fmt + if (v4l2_subdev_has_op(sd, pad, enum_mbus_code)) { Same test again?? Or am I missing something? If indeed these tests are redundant, after you remove them this function will become very similar to
[PATCH v3 2/2] V4L: add CCF support to the v4l2_clk API
V4L2 clocks, e.g. used by camera sensors for their master clock, do not have to be supplied by a different V4L2 driver, they can also be supplied by an independent source. In this case the standart kernel clock API should be used to handle such clocks. This patch adds support for such cases. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- v3: 1. return -EPROBE_DEFER if it's returned by clk_get() 2. handle the case of disabled CCF in kernel configuration 3. use clk_prepare_enable() and clk_unprepare_disable() drivers/media/v4l2-core/v4l2-clk.c | 48 +++--- include/media/v4l2-clk.h | 2 ++ 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-clk.c b/drivers/media/v4l2-core/v4l2-clk.c index 3ff0b00..9f8cb20 100644 --- a/drivers/media/v4l2-core/v4l2-clk.c +++ b/drivers/media/v4l2-core/v4l2-clk.c @@ -9,6 +9,7 @@ */ #include linux/atomic.h +#include linux/clk.h #include linux/device.h #include linux/errno.h #include linux/list.h @@ -37,6 +38,21 @@ static struct v4l2_clk *v4l2_clk_find(const char *dev_id) struct v4l2_clk *v4l2_clk_get(struct device *dev, const char *id) { struct v4l2_clk *clk; + struct clk *ccf_clk = clk_get(dev, id); + + if (PTR_ERR(ccf_clk) == -EPROBE_DEFER) + return ERR_PTR(-EPROBE_DEFER); + + if (!IS_ERR_OR_NULL(ccf_clk)) { + clk = kzalloc(sizeof(struct v4l2_clk), GFP_KERNEL); + if (!clk) { + clk_put(ccf_clk); + return ERR_PTR(-ENOMEM); + } + clk-clk = ccf_clk; + + return clk; + } mutex_lock(clk_lock); clk = v4l2_clk_find(dev_name(dev)); @@ -56,6 +72,12 @@ void v4l2_clk_put(struct v4l2_clk *clk) if (IS_ERR(clk)) return; + if (clk-clk) { + clk_put(clk-clk); + kfree(clk); + return; + } + mutex_lock(clk_lock); list_for_each_entry(tmp, clk_list, list) @@ -93,8 +115,12 @@ static void v4l2_clk_unlock_driver(struct v4l2_clk *clk) int v4l2_clk_enable(struct v4l2_clk *clk) { - int ret = v4l2_clk_lock_driver(clk); + int ret; + if (clk-clk) + return clk_prepare_enable(clk-clk); + + ret = v4l2_clk_lock_driver(clk); if (ret 0) return ret; @@ -120,6 +146,9 @@ void v4l2_clk_disable(struct v4l2_clk *clk) { int enable; + if (clk-clk) + return clk_disable_unprepare(clk-clk); + mutex_lock(clk-lock); enable = --clk-enable; @@ -137,8 +166,12 @@ EXPORT_SYMBOL(v4l2_clk_disable); unsigned long v4l2_clk_get_rate(struct v4l2_clk *clk) { - int ret = v4l2_clk_lock_driver(clk); + int ret; + + if (clk-clk) + return clk_get_rate(clk-clk); + ret = v4l2_clk_lock_driver(clk); if (ret 0) return ret; @@ -157,7 +190,16 @@ EXPORT_SYMBOL(v4l2_clk_get_rate); int v4l2_clk_set_rate(struct v4l2_clk *clk, unsigned long rate) { - int ret = v4l2_clk_lock_driver(clk); + int ret; + + if (clk-clk) { + long r = clk_round_rate(clk-clk, rate); + if (r 0) + return r; + return clk_set_rate(clk-clk, r); + } + + ret = v4l2_clk_lock_driver(clk); if (ret 0) return ret; diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h index 928045f..3ef6e3d 100644 --- a/include/media/v4l2-clk.h +++ b/include/media/v4l2-clk.h @@ -22,6 +22,7 @@ struct module; struct device; +struct clk; struct v4l2_clk { struct list_head list; const struct v4l2_clk_ops *ops; @@ -29,6 +30,7 @@ struct v4l2_clk { int enable; struct mutex lock; /* Protect the enable count */ atomic_t use_count; + struct clk *clk; void *priv; }; -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
cron job: media_tree daily build: OK
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Sun Feb 1 04:00:15 CET 2015 git branch: test git hash: a5f43c18fceb2b96ec9fddb4348f5282a71cf2b0 gcc version:i686-linux-gcc (GCC) 4.9.1 sparse version: v0.5.0-41-g6c2d743 smatch version: 0.4.1-3153-g7d56ab3 host hardware: x86_64 host os:3.18.0-1.slh.1-amd64 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-exynos: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-omap1: OK linux-git-arm-pxa: OK linux-git-blackfin: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.32.27-i686: OK linux-2.6.33.7-i686: OK linux-2.6.34.7-i686: OK linux-2.6.35.9-i686: OK linux-2.6.36.4-i686: OK linux-2.6.37.6-i686: OK linux-2.6.38.8-i686: OK linux-2.6.39.4-i686: OK linux-3.0.60-i686: OK linux-3.1.10-i686: OK linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: OK linux-3.5.7-i686: OK linux-3.6.11-i686: OK linux-3.7.4-i686: OK linux-3.8-i686: OK linux-3.9.2-i686: OK linux-3.10.1-i686: OK linux-3.11.1-i686: OK linux-3.12.23-i686: OK linux-3.13.11-i686: OK linux-3.14.9-i686: OK linux-3.15.2-i686: OK linux-3.16-i686: OK linux-3.17.8-i686: OK linux-3.18-i686: OK linux-3.19-rc4-i686: OK linux-2.6.32.27-x86_64: OK linux-2.6.33.7-x86_64: OK linux-2.6.34.7-x86_64: OK linux-2.6.35.9-x86_64: OK linux-2.6.36.4-x86_64: OK linux-2.6.37.6-x86_64: OK linux-2.6.38.8-x86_64: OK linux-2.6.39.4-x86_64: OK linux-3.0.60-x86_64: OK linux-3.1.10-x86_64: OK linux-3.2.37-x86_64: OK linux-3.3.8-x86_64: OK linux-3.4.27-x86_64: OK linux-3.5.7-x86_64: OK linux-3.6.11-x86_64: OK linux-3.7.4-x86_64: OK linux-3.8-x86_64: OK linux-3.9.2-x86_64: OK linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: OK linux-3.12.23-x86_64: OK linux-3.13.11-x86_64: OK linux-3.14.9-x86_64: OK linux-3.15.2-x86_64: OK linux-3.16-x86_64: OK linux-3.17.8-x86_64: OK linux-3.18-x86_64: OK linux-3.19-rc4-x86_64: OK apps: OK spec-git: OK sparse: WARNINGS smatch: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Sunday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Sunday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html