Re: [PATCH 3/3] [media] uvcvideo: skip non-extension unit controls on Oculus Rift Sensors
Hi Laurent, Am Montag, den 17.07.2017, 05:25 +0300 schrieb Laurent Pinchart: > Hi Philipp, > > On Saturday 15 Jul 2017 15:13:45 Philipp Zabel wrote: > > Am Samstag, den 15.07.2017, 12:54 +0300 schrieb Laurent Pinchart: > > > On Friday 14 Jul 2017 22:14:24 Philipp Zabel wrote: > > > > The Oculus Rift Sensors (DK2 and CV1) allow to configure their > > > > sensor > > > > chips directly via I2C commands using extension unit controls. > > > > The > > > > processing and camera unit controls do not function at all. > > > > > > Do the processing and camera units they report controls that > > > don't work > > > when exercised ? Who in a sane state of mind could have designed > > > such a > > > terrible product ? > > > > Yes. Without this patch I get a bunch of controls that have no > > effect > > whatsoever. > > > > > If I understand you correctly, this device requires userspace > > > code that > > > knows how to program the sensor (and possibly other chips). If > > > that's > > > the case, is there an open-source implementation of that code > > > publicly > > > available ? > > > > Well, it's all still a bit in the experimentation phase. We have an > > implementation to set up the DK2 camera for synchronised exposure > > triggered by the Rift DK2 HMD and to read the calibration data from > > flash, here: > > > > https://github.com/pH5/ouvrt/blob/master/src/esp570.c > > https://github.com/pH5/ouvrt/blob/master/src/mt9v034.c > > > > And an even more rough version to set up the CV1 camera for > > synchronised exposure triggered by the Rift CV1 HMD here: > > > > https://github.com/OpenHMD/OpenHMD-RiftPlayground/blob/master/src/m > > ain.c > > > > The latter is using libusb, as it needs the variable length SPI > > data > > control. > > > > Do you think adding a pseudo i2c driver for the eSP570/eSP770u > > webcam > > controllers and then exposing the sensor chips as V4L2 subdevices > > could > > be a good idea? We already have a sensor driver for the MT9V034 in > > the > > DK2 USB camera. > > Yes, I think a device-specific driver would make sense, especially if > we can > implement support for the sensor as a standalone V4L2 subdev driver. > The > device only fakes UVC compatibility :-( When you say standalone driver, do you mean I can reuse uvcvideo device/stream/chain handling, and just replace the control handling? I'll try this, but it isn't a straightforward as I initially thought. For example, the mt9v032 subdev driver expects to have control over power during probe and s_power. But in this case power is controlled by UVC streaming. I'd either have to modify the subdev driver to support a passive mode or fake the chip id register reads in the i2c adapter driver to make mt9v032 probe at all. Do you have any further comments on the first two patches? regards Philipp
Re: [ragnatech:media-tree 2075/2144] drivers/media/dvb-frontends/stv0910.c:1185:2-8: preceding lock on line 1176 (fwd)
Hello Jula, Am 24.07.2017 um 07:02 schrieb Julia Lawall: Is a lock release needed before line 1185? Is the !enable in line 1189 correct? If the code is correct as is, perhaps it could be good to add some comments. Yes, it's needed because the I2C gate is shared for the two tuner chips attached to it (one dual-demod chip -> two tuners/SECs) and the bus access needs to be protected to not accidentally interfere when accessing both tuners in parallel. I'll think about proper comments there. Thanks, Daniel -- Forwarded message -- Date: Mon, 24 Jul 2017 12:55:30 +0800 From: kbuild test robotTo: kbu...@01.org Cc: Julia Lawall Subject: [ragnatech:media-tree 2075/2144] drivers/media/dvb-frontends/stv0910.c:1185:2-8: preceding lock on line 1176 CC: kbuild-...@01.org TO: Daniel Scheller CC: Mauro Carvalho Chehab CC: linux-media@vger.kernel.org tree: git://git.ragnatech.se/linux media-tree head: 0e50e84a11f4854e9a7e3b7f4443ffb99e6be292 commit: cd21b334943719f880e707eb91895fc916a88000 [2075/2144] media: dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver :: branch date: 3 days ago :: commit date: 4 days ago drivers/media/dvb-frontends/stv0910.c:1185:2-8: preceding lock on line 1176 git remote add ragnatech git://git.ragnatech.se/linux git remote update ragnatech git checkout cd21b334943719f880e707eb91895fc916a88000 vim +1185 drivers/media/dvb-frontends/stv0910.c cd21b334 Daniel Scheller 2017-07-03 1168 cd21b334 Daniel Scheller 2017-07-03 1169 cd21b334 Daniel Scheller 2017-07-03 1170 static int gate_ctrl(struct dvb_frontend *fe, int enable) cd21b334 Daniel Scheller 2017-07-03 1171 { cd21b334 Daniel Scheller 2017-07-03 1172 struct stv *state = fe->demodulator_priv; cd21b334 Daniel Scheller 2017-07-03 1173 u8 i2crpt = state->i2crpt & ~0x86; cd21b334 Daniel Scheller 2017-07-03 1174 cd21b334 Daniel Scheller 2017-07-03 1175 if (enable) cd21b334 Daniel Scheller 2017-07-03 @1176 mutex_lock(>base->i2c_lock); cd21b334 Daniel Scheller 2017-07-03 1177 cd21b334 Daniel Scheller 2017-07-03 1178 if (enable) cd21b334 Daniel Scheller 2017-07-03 1179 i2crpt |= 0x80; cd21b334 Daniel Scheller 2017-07-03 1180 else cd21b334 Daniel Scheller 2017-07-03 1181 i2crpt |= 0x02; cd21b334 Daniel Scheller 2017-07-03 1182 cd21b334 Daniel Scheller 2017-07-03 1183 if (write_reg(state, state->nr ? RSTV0910_P2_I2CRPT : cd21b334 Daniel Scheller 2017-07-03 1184 RSTV0910_P1_I2CRPT, i2crpt) < 0) cd21b334 Daniel Scheller 2017-07-03 @1185 return -EIO; cd21b334 Daniel Scheller 2017-07-03 1186 cd21b334 Daniel Scheller 2017-07-03 1187 state->i2crpt = i2crpt; cd21b334 Daniel Scheller 2017-07-03 1188 cd21b334 Daniel Scheller 2017-07-03 1189 if (!enable) cd21b334 Daniel Scheller 2017-07-03 1190 mutex_unlock(>base->i2c_lock); cd21b334 Daniel Scheller 2017-07-03 1191 return 0; cd21b334 Daniel Scheller 2017-07-03 1192 } cd21b334 Daniel Scheller 2017-07-03 1193 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation Best regards, Daniel Scheller -- https://github.com/herrnst
Re: [Patch v5 11/12] [media] s5p-mfc: Add support for HEVC encoder
On Thu, 2017-07-20 at 15:32 +0200, Hans Verkuil wrote: > On 19/06/17 07:10, Smitha T Murthy wrote: > > Add HEVC encoder support and necessary registers, V4L2 CIDs, > > and hevc encoder parameters > > > > Signed-off-by: Smitha T Murthy> > --- > > drivers/media/platform/s5p-mfc/regs-mfc-v10.h | 28 +- > > drivers/media/platform/s5p-mfc/s5p_mfc.c| 1 + > > drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c | 3 + > > drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 53 ++- > > drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 521 > > > > drivers/media/platform/s5p-mfc/s5p_mfc_opr.h| 8 + > > drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 168 > > drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h | 8 + > > 8 files changed, 788 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h > > b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h > > index 6754477..7065b9d 100644 > > --- a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h > > +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h > > @@ -20,13 +20,35 @@ > > #define S5P_FIMV_MFC_STATE_V10 0x7124 > > #define S5P_FIMV_D_STATIC_BUFFER_ADDR_V10 0xF570 > > #define S5P_FIMV_D_STATIC_BUFFER_SIZE_V10 0xF574 > > +#define S5P_FIMV_E_NUM_T_LAYER_V10 0xFBAC > > +#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER0_V10 0xFBB0 > > +#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER1_V10 0xFBB4 > > +#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER2_V10 0xFBB8 > > +#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER3_V10 0xFBBC > > +#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER4_V10 0xFBC0 > > +#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER5_V10 0xFBC4 > > +#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER6_V10 0xFBC8 > > +#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER0_V100xFD18 > > +#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER1_V100xFD1C > > +#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER2_V100xFD20 > > +#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER3_V100xFD24 > > +#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER4_V100xFD28 > > +#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER5_V100xFD2C > > +#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER6_V100xFD30 > > +#define S5P_FIMV_E_HEVC_OPTIONS_V100xFDD4 > > +#define S5P_FIMV_E_HEVC_REFRESH_PERIOD_V10 0xFDD8 > > +#define S5P_FIMV_E_HEVC_CHROMA_QP_OFFSET_V10 0xFDDC > > +#define S5P_FIMV_E_HEVC_LF_BETA_OFFSET_DIV2_V100xFDE0 > > +#define S5P_FIMV_E_HEVC_LF_TC_OFFSET_DIV2_V10 0xFDE4 > > +#define S5P_FIMV_E_HEVC_NAL_CONTROL_V100xFDE8 > > > > /* MFCv10 Context buffer sizes */ > > #define MFC_CTX_BUF_SIZE_V10 (30 * SZ_1K) > > #define MFC_H264_DEC_CTX_BUF_SIZE_V10 (2 * SZ_1M) > > #define MFC_OTHER_DEC_CTX_BUF_SIZE_V10 (20 * SZ_1K) > > #define MFC_H264_ENC_CTX_BUF_SIZE_V10 (100 * SZ_1K) > > -#define MFC_OTHER_ENC_CTX_BUF_SIZE_V10 (15 * SZ_1K) > > +#define MFC_HEVC_ENC_CTX_BUF_SIZE_V10 (30 * SZ_1K) > > +#define MFC_OTHER_ENC_CTX_BUF_SIZE_V10 (15 * SZ_1K) > > > > /* MFCv10 variant defines */ > > #define MAX_FW_SIZE_V10(SZ_1M) > > @@ -58,5 +80,9 @@ > > #define ENC_V100_VP8_ME_SIZE(x, y) \ > > ENC_V100_BASE_SIZE(x, y) > > > > +#define ENC_V100_HEVC_ME_SIZE(x, y)\ > > + (((x + 3) * (y + 3) * 32) \ > > ++ ((y * 128) + 1280) * DIV_ROUND_UP(x, 4)) > > + > > #endif /*_REGS_MFC_V10_H*/ > > > > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c > > b/drivers/media/platform/s5p-mfc/s5p_mfc.c > > index efc36b0..742c2b7 100644 > > --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c > > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c > > @@ -1621,6 +1621,7 @@ static struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = { > > .h264_dec_ctx = MFC_H264_DEC_CTX_BUF_SIZE_V10, > > .other_dec_ctx = MFC_OTHER_DEC_CTX_BUF_SIZE_V10, > > .h264_enc_ctx = MFC_H264_ENC_CTX_BUF_SIZE_V10, > > + .hevc_enc_ctx = MFC_HEVC_ENC_CTX_BUF_SIZE_V10, > > .other_enc_ctx = MFC_OTHER_ENC_CTX_BUF_SIZE_V10, > > }; > > > > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c > > b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c > > index 102b47e..7521fce 100644 > > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c > > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c > > @@ -122,6 +122,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx > > *ctx) > > case S5P_MFC_CODEC_VP8_ENC: > > codec_type = S5P_FIMV_CODEC_VP8_ENC_V7; > > break; > > + case S5P_MFC_CODEC_HEVC_ENC: > > + codec_type = S5P_FIMV_CODEC_HEVC_ENC; > > + break; > > default: > > codec_type = S5P_FIMV_CODEC_NONE_V6; > > } > > diff --git
[ragnatech:media-tree 2075/2144] drivers/media/dvb-frontends/stv0910.c:1185:2-8: preceding lock on line 1176 (fwd)
Is a lock release needed before line 1185? Is the !enable in line 1189 correct? If the code is correct as is, perhaps it could be good to add some comments. julia -- Forwarded message -- Date: Mon, 24 Jul 2017 12:55:30 +0800 From: kbuild test robotTo: kbu...@01.org Cc: Julia Lawall Subject: [ragnatech:media-tree 2075/2144] drivers/media/dvb-frontends/stv0910.c:1185:2-8: preceding lock on line 1176 CC: kbuild-...@01.org TO: Daniel Scheller CC: Mauro Carvalho Chehab CC: linux-media@vger.kernel.org tree: git://git.ragnatech.se/linux media-tree head: 0e50e84a11f4854e9a7e3b7f4443ffb99e6be292 commit: cd21b334943719f880e707eb91895fc916a88000 [2075/2144] media: dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver :: branch date: 3 days ago :: commit date: 4 days ago >> drivers/media/dvb-frontends/stv0910.c:1185:2-8: preceding lock on line 1176 git remote add ragnatech git://git.ragnatech.se/linux git remote update ragnatech git checkout cd21b334943719f880e707eb91895fc916a88000 vim +1185 drivers/media/dvb-frontends/stv0910.c cd21b334 Daniel Scheller 2017-07-03 1168 cd21b334 Daniel Scheller 2017-07-03 1169 cd21b334 Daniel Scheller 2017-07-03 1170 static int gate_ctrl(struct dvb_frontend *fe, int enable) cd21b334 Daniel Scheller 2017-07-03 1171 { cd21b334 Daniel Scheller 2017-07-03 1172 struct stv *state = fe->demodulator_priv; cd21b334 Daniel Scheller 2017-07-03 1173 u8 i2crpt = state->i2crpt & ~0x86; cd21b334 Daniel Scheller 2017-07-03 1174 cd21b334 Daniel Scheller 2017-07-03 1175 if (enable) cd21b334 Daniel Scheller 2017-07-03 @1176 mutex_lock(>base->i2c_lock); cd21b334 Daniel Scheller 2017-07-03 1177 cd21b334 Daniel Scheller 2017-07-03 1178 if (enable) cd21b334 Daniel Scheller 2017-07-03 1179 i2crpt |= 0x80; cd21b334 Daniel Scheller 2017-07-03 1180 else cd21b334 Daniel Scheller 2017-07-03 1181 i2crpt |= 0x02; cd21b334 Daniel Scheller 2017-07-03 1182 cd21b334 Daniel Scheller 2017-07-03 1183 if (write_reg(state, state->nr ? RSTV0910_P2_I2CRPT : cd21b334 Daniel Scheller 2017-07-03 1184 RSTV0910_P1_I2CRPT, i2crpt) < 0) cd21b334 Daniel Scheller 2017-07-03 @1185 return -EIO; cd21b334 Daniel Scheller 2017-07-03 1186 cd21b334 Daniel Scheller 2017-07-03 1187 state->i2crpt = i2crpt; cd21b334 Daniel Scheller 2017-07-03 1188 cd21b334 Daniel Scheller 2017-07-03 1189 if (!enable) cd21b334 Daniel Scheller 2017-07-03 1190 mutex_unlock(>base->i2c_lock); cd21b334 Daniel Scheller 2017-07-03 1191 return 0; cd21b334 Daniel Scheller 2017-07-03 1192 } cd21b334 Daniel Scheller 2017-07-03 1193 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [Patch v5 10/12] [media] v4l2: Add v4l2 control IDs for HEVC encoder
On Thu, 2017-07-20 at 15:13 +0200, Hans Verkuil wrote: > On 19/06/17 07:10, Smitha T Murthy wrote: > > Add v4l2 controls for HEVC encoder > > > > Signed-off-by: Smitha T Murthy> > Reviewed-by: Andrzej Hajda > > --- > > drivers/media/v4l2-core/v4l2-ctrls.c | 103 > > +++ > > include/uapi/linux/v4l2-controls.h | 84 > > 2 files changed, 187 insertions(+) > > > > diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c > > b/drivers/media/v4l2-core/v4l2-ctrls.c > > index ec42872..6a7e732 100644 > > --- a/drivers/media/v4l2-core/v4l2-ctrls.c > > +++ b/drivers/media/v4l2-core/v4l2-ctrls.c > > @@ -479,6 +479,51 @@ const char * const *v4l2_ctrl_get_menu(u32 id) > > NULL, > > }; > > > > + static const char * const hevc_profile[] = { > > + "Main", > > + "Main Still Picture", > > + NULL, > > + }; > > + static const char * const hevc_level[] = { > > + "1", > > + "2", > > + "2.1", > > + "3", > > + "3.1", > > + "4", > > + "4.1", > > + "5", > > + "5.1", > > + "5.2", > > + "6", > > + "6.1", > > + "6.2", > > + NULL, > > + }; > > + static const char * const hevc_hierarchial_coding_type[] = { > > + "B", > > + "P", > > + NULL, > > + }; > > + static const char * const hevc_refresh_type[] = { > > + "None", > > + "CRA", > > + "IDR", > > + NULL, > > + }; > > + static const char * const hevc_size_of_length_field[] = { > > + "0", > > + "1", > > + "2", > > + "4", > > + NULL, > > + }; > > + static const char * const hevc_tier_flag[] = { > > + "Main", > > + "High", > > + NULL, > > + }; > > + > > > > switch (id) { > > case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: > > @@ -574,6 +619,18 @@ const char * const *v4l2_ctrl_get_menu(u32 id) > > return dv_it_content_type; > > case V4L2_CID_DETECT_MD_MODE: > > return detect_md_mode; > > + case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE: > > + return hevc_profile; > > + case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: > > + return hevc_level; > > + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE: > > + return hevc_hierarchial_coding_type; > > + case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE: > > + return hevc_refresh_type; > > + case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD: > > + return hevc_size_of_length_field; > > + case V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG: > > + return hevc_tier_flag; > > > > default: > > return NULL; > > @@ -775,6 +832,46 @@ const char *v4l2_ctrl_get_name(u32 id) > > case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return "VPX > > P-Frame QP Value"; > > case V4L2_CID_MPEG_VIDEO_VPX_PROFILE: return "VPX > > Profile"; > > > > + /* HEVC controls */ > > + case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP: return "HEVC > > I-Frame QP Value"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP: return "HEVC > > P-Frame QP Value"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP: return "HEVC > > B-Frame QP Value"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP: return "HEVC > > Minimum QP Value"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP: return "HEVC > > Maximum QP Value"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE: return "HEVC > > Profile"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:return "HEVC > > Level"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG:return "HEVC > > Tier_flag"; > > "HEVC Tier Flag" > I will correct this. > > + case V4L2_CID_MPEG_VIDEO_HEVC_FRAME_RATE_RESOLUTION:return "HEVC > > Frame Rate Resolution"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH: return "HEVC > > Maximum Coding Unit Depth"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE: return "HEVC > > Refresh Type"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED: return "HEVC > > Constant Intra Prediction"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU: return "HEVC > > Lossless Encoding"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT:return "HEVC > > Wavefront"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_LF: return "HEVC > > Loop Filter"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_LF_SLICE_BOUNDARY:return "HEVC LF > > Across Slice Boundary"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_QP: return "HEVC QP > > Values"; > > + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE: return "HEVC > > Hierarchical Coding Type"; > > +
Re: [Patch v5 05/12] [media] videodev2.h: Add v4l2 definition for HEVC
On Thu, 2017-07-20 at 15:07 +0200, Hans Verkuil wrote: > On 19/06/17 07:10, Smitha T Murthy wrote: > > Add V4L2 definition for HEVC compressed format > > > > Signed-off-by: Smitha T Murthy> > Reviewed-by: Andrzej Hajda > > --- > > include/uapi/linux/videodev2.h | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > > index 2b8feb8..488de3d 100644 > > --- a/include/uapi/linux/videodev2.h > > +++ b/include/uapi/linux/videodev2.h > > @@ -629,6 +629,7 @@ struct v4l2_pix_format { > > #define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE > > 421M Annex L compliant stream */ > > #define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */ > > #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ > > +#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC */ > > Change the comment to: /* HEVC aka H.265 */ > > After that you can add my: > > Acked-by: Hans Verkuil > > Regards, > > Hans > I will make the change. Thanks for the review. Regards, Smitha > > > > /* Vendor-specific formats */ > > #define V4L2_PIX_FMT_CPIA1v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV > > */ > > > > >
Re: [Patch v5 06/12] [media] v4l2-ioctl: add HEVC format description
On Thu, 2017-07-20 at 15:07 +0200, Hans Verkuil wrote: > On 19/06/17 07:10, Smitha T Murthy wrote: > > HEVC is a video coding format > > > > Signed-off-by: Smitha T Murthy> > --- > > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c > > b/drivers/media/v4l2-core/v4l2-ioctl.c > > index e5a2187..4f6f8d9 100644 > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > > @@ -1257,6 +1257,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > > case V4L2_PIX_FMT_VC1_ANNEX_L: descr = "VC-1 (SMPTE 412M Annex > > L)"; break; > > case V4L2_PIX_FMT_VP8: descr = "VP8"; break; > > case V4L2_PIX_FMT_VP9: descr = "VP9"; break; > > + case V4L2_PIX_FMT_HEVC: descr = "HEVC"; break; > > Add a little comment at the end of the line: /* aka H.265 */ > > After that you can add my: > > Acked-by: Hans Verkuil > > Regards, > > Hans > Ok I will make the change. Thanks for the review. Regards, Smitha > > case V4L2_PIX_FMT_CPIA1:descr = "GSPCA CPiA YUV"; break; > > case V4L2_PIX_FMT_WNVA: descr = "WNVA"; break; > > case V4L2_PIX_FMT_SN9C10X: descr = "GSPCA SN9C10X"; break; > > > > >
cron job: media_tree daily build: ERRORS
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: Mon Jul 24 05:00:15 CEST 2017 media-tree git hash:0e50e84a11f4854e9a7e3b7f4443ffb99e6be292 media_build git hash: bc1db0a204a87da86349ea5e64ae0d65e945609d v4l-utils git hash: 5649bf5343fb7c32f909f92ec07c1bf5b77ff869 gcc version:i686-linux-gcc (GCC) 7.1.0 sparse version: v0.5.0 smatch version: v0.5.0-3553-g78b2ea6 host hardware: x86_64 host os:4.11.0-164 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-multi: WARNINGS linux-git-arm-pxa: OK linux-git-arm-stm32: OK linux-git-blackfin-bf561: 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.36.4-i686: ERRORS linux-2.6.37.6-i686: ERRORS linux-2.6.38.8-i686: ERRORS linux-2.6.39.4-i686: ERRORS linux-3.0.60-i686: ERRORS linux-3.1.10-i686: ERRORS linux-3.2.37-i686: ERRORS linux-3.3.8-i686: ERRORS linux-3.4.27-i686: ERRORS linux-3.5.7-i686: ERRORS linux-3.6.11-i686: ERRORS linux-3.7.4-i686: ERRORS linux-3.8-i686: ERRORS linux-3.9.2-i686: ERRORS linux-3.10.1-i686: ERRORS linux-3.11.1-i686: ERRORS linux-3.12.67-i686: ERRORS linux-3.13.11-i686: ERRORS linux-3.14.9-i686: ERRORS linux-3.15.2-i686: ERRORS linux-3.16.7-i686: ERRORS linux-3.17.8-i686: ERRORS linux-3.18.7-i686: ERRORS linux-3.19-i686: ERRORS linux-4.0.9-i686: ERRORS linux-4.1.33-i686: ERRORS linux-4.2.8-i686: ERRORS linux-4.3.6-i686: ERRORS linux-4.4.22-i686: ERRORS linux-4.5.7-i686: ERRORS linux-4.6.7-i686: ERRORS linux-4.7.5-i686: ERRORS linux-4.8-i686: ERRORS linux-4.9.26-i686: ERRORS linux-4.10.14-i686: ERRORS linux-4.11-i686: ERRORS linux-4.12.1-i686: ERRORS linux-2.6.36.4-x86_64: ERRORS linux-2.6.37.6-x86_64: ERRORS linux-2.6.38.8-x86_64: ERRORS linux-2.6.39.4-x86_64: ERRORS linux-3.0.60-x86_64: ERRORS linux-3.1.10-x86_64: ERRORS linux-3.2.37-x86_64: ERRORS linux-3.3.8-x86_64: ERRORS linux-3.4.27-x86_64: ERRORS linux-3.5.7-x86_64: ERRORS linux-3.6.11-x86_64: ERRORS linux-3.7.4-x86_64: ERRORS linux-3.8-x86_64: ERRORS linux-3.9.2-x86_64: ERRORS linux-3.10.1-x86_64: ERRORS linux-3.11.1-x86_64: ERRORS linux-3.12.67-x86_64: ERRORS linux-3.13.11-x86_64: ERRORS linux-3.14.9-x86_64: ERRORS linux-3.15.2-x86_64: ERRORS linux-3.16.7-x86_64: ERRORS linux-3.17.8-x86_64: ERRORS linux-3.18.7-x86_64: ERRORS linux-3.19-x86_64: ERRORS linux-4.0.9-x86_64: ERRORS linux-4.1.33-x86_64: ERRORS linux-4.2.8-x86_64: ERRORS linux-4.3.6-x86_64: ERRORS linux-4.4.22-x86_64: ERRORS linux-4.5.7-x86_64: ERRORS linux-4.6.7-x86_64: ERRORS linux-4.7.5-x86_64: ERRORS linux-4.8-x86_64: ERRORS linux-4.9.26-x86_64: ERRORS linux-4.10.14-x86_64: ERRORS linux-4.11-x86_64: ERRORS linux-4.12.1-x86_64: ERRORS apps: WARNINGS spec-git: OK sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/index.html
[PATCH 2/3][resend] media: ti-vpe: cal: use of_graph_get_remote_endpoint()
From: Kuninori MorimotoNow, we can use of_graph_get_remote_endpoint(). Let's use it. Signed-off-by: Kuninori Morimoto Reviewed-by: Sylwester Nawrocki Acked-by: Benoit Parrot --- based on 4c9c3d595f1bad021cc126d20879df4016801736 ("of_graph: add of_graph_get_remote_endpoint()") drivers/media/platform/ti-vpe/cal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index 177faa3..0c7ddf8 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -1702,7 +1702,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, int inst) asd->match_type = V4L2_ASYNC_MATCH_FWNODE; asd->match.fwnode.fwnode = of_fwnode_handle(sensor_node); - remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0); + remote_ep = of_graph_get_remote_endpoint(ep_node); if (!remote_ep) { ctx_dbg(3, ctx, "can't get remote-endpoint\n"); goto cleanup_exit; -- 1.9.1
[PATCH 2/3][resend] media: ti-vpe: cal: use of_graph_get_remote_endpoint()
From: Kuninori MorimotoNow, we can use of_graph_get_remote_endpoint(). Let's use it. Signed-off-by: Kuninori Morimoto Reviewed-by: Sylwester Nawrocki Acked-by: Benoit Parrot --- based on 4c9c3d595f1bad021cc126d20879df4016801736 ("of_graph: add of_graph_get_remote_endpoint()") drivers/media/platform/ti-vpe/cal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index 177faa3..0c7ddf8 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -1702,7 +1702,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, int inst) asd->match_type = V4L2_ASYNC_MATCH_FWNODE; asd->match.fwnode.fwnode = of_fwnode_handle(sensor_node); - remote_ep = of_parse_phandle(ep_node, "remote-endpoint", 0); + remote_ep = of_graph_get_remote_endpoint(ep_node); if (!remote_ep) { ctx_dbg(3, ctx, "can't get remote-endpoint\n"); goto cleanup_exit; -- 1.9.1
Quick Loans
Loan Offer at 3%, Feel Free to REPLY back to us for more info.
Re: [PATCH] dvb_frontend: initialize variable s with FE_NONE instead of 0
Hi Colin, [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.13-rc1 next-20170721] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Colin-King/dvb_frontend-initialize-variable-s-with-FE_NONE-instead-of-0/20170724-063439 base: git://linuxtv.org/media_tree.git master config: i386-randconfig-x019-201730 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/media/dvb-core/dvb_frontend.c: In function 'dvb_frontend_swzigzag': >> drivers/media/dvb-core/dvb_frontend.c:463:21: error: 'FE_NONE' undeclared >> (first use in this function) enum fe_status s = FE_NONE; ^~~ drivers/media/dvb-core/dvb_frontend.c:463:21: note: each undeclared identifier is reported only once for each function it appears in vim +/FE_NONE +463 drivers/media/dvb-core/dvb_frontend.c 460 461 static void dvb_frontend_swzigzag(struct dvb_frontend *fe) 462 { > 463 enum fe_status s = FE_NONE; 464 int retval = 0; 465 struct dvb_frontend_private *fepriv = fe->frontend_priv; 466 struct dtv_frontend_properties *c = >dtv_property_cache, tmp; 467 468 /* if we've got no parameters, just keep idling */ 469 if (fepriv->state & FESTATE_IDLE) { 470 fepriv->delay = 3*HZ; 471 fepriv->quality = 0; 472 return; 473 } 474 475 /* in SCAN mode, we just set the frontend when asked and leave it alone */ 476 if (fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT) { 477 if (fepriv->state & FESTATE_RETUNE) { 478 tmp = *c; 479 if (fe->ops.set_frontend) 480 retval = fe->ops.set_frontend(fe); 481 *c = tmp; 482 if (retval < 0) 483 fepriv->state = FESTATE_ERROR; 484 else 485 fepriv->state = FESTATE_TUNED; 486 } 487 fepriv->delay = 3*HZ; 488 fepriv->quality = 0; 489 return; 490 } 491 492 /* get the frontend status */ 493 if (fepriv->state & FESTATE_RETUNE) { 494 s = 0; 495 } else { 496 if (fe->ops.read_status) 497 fe->ops.read_status(fe, ); 498 if (s != fepriv->status) { 499 dvb_frontend_add_event(fe, s); 500 fepriv->status = s; 501 } 502 } 503 504 /* if we're not tuned, and we have a lock, move to the TUNED state */ 505 if ((fepriv->state & FESTATE_WAITFORLOCK) && (s & FE_HAS_LOCK)) { 506 dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); 507 fepriv->state = FESTATE_TUNED; 508 509 /* if we're tuned, then we have determined the correct inversion */ 510 if ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) && 511 (c->inversion == INVERSION_AUTO)) { 512 c->inversion = fepriv->inversion; 513 } 514 return; 515 } 516 517 /* if we are tuned already, check we're still locked */ 518 if (fepriv->state & FESTATE_TUNED) { 519 dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); 520 521 /* we're tuned, and the lock is still good... */ 522 if (s & FE_HAS_LOCK) { 523 return; 524 } else { /* if we _WERE_ tuned, but now don't have a lock */ 525 fepriv->state = FESTATE_ZIGZAG_FAST; 526 fepriv->started_auto_step = fepriv->auto_step; 527 fepriv->check_wrapped = 0; 528 } 529 } 530 531 /* don't actually do anything if we're in the LOSTLOCK state, 532 * the frontend is set to FE_CAN_RECOVER, and the max_drift is 0 */ 533 if ((fepriv->state & FESTATE_LOSTLOCK) && 534 (fe->ops.info.caps & FE_CAN_RECOVER) && (fepriv->max_drift == 0)) { 535 dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); 536 return; 537 } 538 539 /* don't do anything if we're in the DISEQC state, since this 540 * might be
Fw: [PATCH RESEND 00/14] ddbridge: bump to ddbridge-0.9.29
Manfred kindly asked me to forward his message to the list as he received a bounce from vger.kernel.org on this. Beginn der weitergeleiteten Nachricht: Datum: Sun, 23 Jul 2017 22:10:02 +0200 Von: Manfred_KnickAn: Daniel Scheller , linux-media@vger.kernel.org, mche...@kernel.org, mche...@s-opensource.com Cc: r.sco...@clear.net.nz, jas...@anw.at, d_sping...@freenet.de, r...@metzlerbros.de Betreff: Re: [PATCH RESEND 00/14] ddbridge: bump to ddbridge-0.9.29 Am 23.07.2017 um 20:16 schrieb Daniel Scheller: > From: Daniel Scheller > > Preferrably for Linux 4.14 (to get things done). > > Resend reasons (resend since no real changes went in): > * rebased on latest mediatree-master wrt > commit 618e8aac3d7c ("media: ddbridge: constify i2c_algorithm structure") > * build error in ddbridge-core.c fixed wrt > commit dcda9b04713c ("mm, tree wide: replace __GFP_REPEAT by > __GFP_RETRY_MAYFAIL with more useful semantic") > * useless return removed from void calc_con() > * UTF8 in ddbridge-regs.h removed > * Tested-by's added to commit messages > > ... Tested-by: Manfred Knick I initially got involved into this by finding out about Daniel's Gentoo overlay carrying ddbridge-sources, which installs the gentoo kernel sources with these exact patches ontop. The first version I tried was with kernel 4.9 which had an older revision of the patchset, and am now up at version 4.12.3, having the patches posted here ontop of a stable kernel version. Air-borne TV in Munich, Germany is DVB-T2 _only_ since March 29, 2017. +1: The pach set is working to my perfect satisfaction: Displaying channels works flawlessly with VLC and Kaffeine. For recording I exploit Kaffeine's comfortable graphical user interface. media-video/kaffeine-:5 (latest git) media-video/vlc-2.2.6-r1:0/5-8 I am grateful for Daniels support, always quick and friendly, to help me get up and running in the beginning, as well as his cooperation and very fast reaction lately: Integrating into cxd2841er in . . . sys-kernel/ddbridge-sources-4.12.0 ( CONFIG_DVB_CXD2841ER ) resulted in failure of scanning for channels within Kaffeine. Daniel's patch [1] fixed the underlying deeper problem: . . . changing from DVB-T to DVB-T2 without stopping the frontend, . . . the demod operation mode isn't re-setup (Mauro was on CC). It was immediately integrated (amongst other improvements) by Daniel into . . . sys-kernel/ddbridge-sources-4.12.{1,2,3} delivering the services mentioned above as solid as expected. Many "Thanks!" to Daniel - and to the reviewers. +1: for integrating this cleaned-up structure into mainline This rescues users of DD HW from being enslaved by DD's "one big undocumented blob for everything" "only our HW counts" "exclude all other media hw" attitude. Personally, I want a clean HW driver *only*, and disgust being forced into installing an inscrutable "Octopus" network compulsorily just for being able to use a tiny bit of HW locally. Regards, Manfred [1] . . . [ https://github.com/herrnst/dddvb-linux-kernel/commit/ . . .ca17298941f3a6aafa1f625535cc2eab041187be ] # POSTSCRIPTUM: # I would be happy tp provide any additional information as needed. # uname -a Linux sid 4.12.3-ddbridge #1 SMP Sun Jul 23 00:12:41 CEST 2017 x86_64 Intel(R) Xeon(R) CPU E3-1276 v3 @ 3.60GHz GenuineIntel GNU/Linux # grep -i cxd2841er /usr/src/linux/.config CONFIG_DVB_CXD2841ER=y # dmesg | grep -i cxd284 [2.343582] ddbridge :03:00.0: Port 0: Link 0, Link Port 0 (TAB 1): DUAL DVB-C2T2 CXD2843 [2.361510] i2c i2c-8: cxd2841er_attach(): I2C adapter c9000cf05800 SLVX addr 6e SLVT addr 6c [2.362781] i2c i2c-8: cxd2841er_attach(): attaching CXD2843ER DVB-C/C2/T/T2 frontend [2.363818] i2c i2c-8: cxd2841er_attach(): chip ID 0xa4 OK. [2.366675] ddbridge :03:00.0: DVB: registering adapter 0 frontend 0 (Sony CXD2843ER DVB-T/T2/C/C2 demodulator)... [2.367928] i2c i2c-8: cxd2841er_attach(): I2C adapter c9000cf05800 SLVX addr 6f SLVT addr 6d [2.369280] i2c i2c-8: cxd2841er_attach(): attaching CXD2843ER DVB-C/C2/T/T2 frontend [2.370364] i2c i2c-8: cxd2841er_attach(): chip ID 0xa4 OK. [2.373132] ddbridge :03:00.0: DVB: registering adapter 1 frontend 0 (Sony CXD2843ER DVB-T/T2/C/C2 demodulator)... [2.374416] i2c i2c-9: cxd2841er_attach(): I2C adapter c9000cf05c30 SLVX addr 6e SLVT addr 6c [2.376374] i2c i2c-9: cxd2841er_attach(): attaching CXD2843ER DVB-C/C2/T/T2 frontend [2.377481] i2c i2c-9: cxd2841er_attach(): chip ID 0xa4 OK. [2.381931] ddbridge :03:00.0: DVB: registering adapter 2 frontend 0 (Sony CXD2843ER DVB-T/T2/C/C2 demodulator)... [2.383230] i2c i2c-9:
?
> Did you receive my previous mail ? When and what time can i call you?
[PATCH RESEND 06/14] [media] ddbridge: split off hardware definitions and mappings
From: Daniel SchellerFurther cleanup of ddbridge-core and ddbridge-main, and moves all such hw definitions into one single place, making things easier to maintain. Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/Makefile| 4 +- drivers/media/pci/ddbridge/ddbridge-core.c | 68 --- drivers/media/pci/ddbridge/ddbridge-hw.c | 299 + drivers/media/pci/ddbridge/ddbridge-hw.h | 52 + drivers/media/pci/ddbridge/ddbridge-main.c | 217 + drivers/media/pci/ddbridge/ddbridge.h | 1 - 6 files changed, 354 insertions(+), 287 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-hw.c create mode 100644 drivers/media/pci/ddbridge/ddbridge-hw.h diff --git a/drivers/media/pci/ddbridge/Makefile b/drivers/media/pci/ddbridge/Makefile index 0a7caa95a3b6..c4d8d6261243 100644 --- a/drivers/media/pci/ddbridge/Makefile +++ b/drivers/media/pci/ddbridge/Makefile @@ -2,8 +2,8 @@ # Makefile for the ddbridge device driver # -ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-i2c.o \ - ddbridge-irq.o +ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-hw.o \ + ddbridge-i2c.o ddbridge-irq.o obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index d46a81b2f80b..374d095565dc 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -66,74 +66,6 @@ static struct ddb *ddbs[DDB_MAX_ADAPTER]; // // -static struct ddb_regset octopus_input = { - .base = 0x200, - .num = 0x08, - .size = 0x10, -}; - -static struct ddb_regset octopus_output = { - .base = 0x280, - .num = 0x08, - .size = 0x10, -}; - -static struct ddb_regset octopus_idma = { - .base = 0x300, - .num = 0x08, - .size = 0x10, -}; - -static struct ddb_regset octopus_idma_buf = { - .base = 0x2000, - .num = 0x08, - .size = 0x100, -}; - -static struct ddb_regset octopus_odma = { - .base = 0x380, - .num = 0x04, - .size = 0x10, -}; - -static struct ddb_regset octopus_odma_buf = { - .base = 0x2800, - .num = 0x04, - .size = 0x100, -}; - -static struct ddb_regset octopus_i2c = { - .base = 0x80, - .num = 0x04, - .size = 0x20, -}; - -static struct ddb_regset octopus_i2c_buf = { - .base = 0x1000, - .num = 0x04, - .size = 0x200, -}; - -// - -struct ddb_regmap octopus_map = { - .irq_base_i2c = 0, - .irq_base_idma = 8, - .irq_base_odma = 16, - .i2c = _i2c, - .i2c_buf = _i2c_buf, - .idma = _idma, - .idma_buf = _idma_buf, - .odma = _odma, - .odma_buf = _odma_buf, - .input = _input, - .output = _output, -}; - -// -// -// - static void ddb_set_dma_table(struct ddb_io *io) { struct ddb *dev = io->port->dev; diff --git a/drivers/media/pci/ddbridge/ddbridge-hw.c b/drivers/media/pci/ddbridge/ddbridge-hw.c new file mode 100644 index ..e35b41e8d860 --- /dev/null +++ b/drivers/media/pci/ddbridge/ddbridge-hw.c @@ -0,0 +1,299 @@ +/* + * ddbridge-hw.c: Digital Devices bridge hardware maps + * + * Copyright (C) 2010-2017 Digital Devices GmbH + * Ralph Metzler + * Marcus Metzler + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 only, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * 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. + * + */ + +#include "ddbridge.h" + +/**/ + +static struct ddb_regset octopus_input = { + .base = 0x200, + .num = 0x08, + .size = 0x10, +}; + +static struct ddb_regset octopus_output = { + .base = 0x280, + .num = 0x08, + .size = 0x10, +}; + +static struct ddb_regset
[PATCH RESEND 07/14] [media] ddbridge: check pointers before dereferencing
From: Daniel SchellerFixes two warnings reported by smatch: drivers/media/pci/ddbridge/ddbridge-core.c:240 ddb_redirect() warn: variable dereferenced before check 'idev' (see line 238) drivers/media/pci/ddbridge/ddbridge-core.c:240 ddb_redirect() warn: variable dereferenced before check 'pdev' (see line 238) Fixed by moving the existing checks up before accessing members. Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/ddbridge-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 374d095565dc..72f4cd3de2b8 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -169,10 +169,10 @@ static int ddb_redirect(u32 i, u32 p) struct ddb *pdev = ddbs[(p >> 4) & 0x3f]; struct ddb_port *port; - if (!idev->has_dma || !pdev->has_dma) - return -EINVAL; if (!idev || !pdev) return -EINVAL; + if (!idev->has_dma || !pdev->has_dma) + return -EINVAL; port = >port[p & 0x0f]; if (!port->output) -- 2.13.0
[PATCH RESEND 08/14] [media] ddbridge: only register frontends in fe2 if fe is not NULL
From: Daniel SchellerSmatch reported: drivers/media/pci/ddbridge/ddbridge-core.c:1602 dvb_input_attach() error: we previously assumed 'dvb->fe' could be null (see line 1595) dvb->fe2 will ever only be populated when dvb->fe is set. So only handle registration of dvb->fe2 when dvb->fe got set beforehand by moving the registration into the "if (dvb->fe)" conditional. Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/ddbridge-core.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 72f4cd3de2b8..1e5c420e4717 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -1505,23 +1505,25 @@ static int dvb_input_attach(struct ddb_input *input) return 0; } dvb->attached = 0x30; + if (dvb->fe) { if (dvb_register_frontend(adap, dvb->fe) < 0) return -ENODEV; + + if (dvb->fe2) { + if (dvb_register_frontend(adap, dvb->fe2) < 0) + return -ENODEV; + dvb->fe2->tuner_priv = dvb->fe->tuner_priv; + memcpy(>fe2->ops.tuner_ops, + >fe->ops.tuner_ops, + sizeof(struct dvb_tuner_ops)); + } } - if (dvb->fe2) { - if (dvb_register_frontend(adap, dvb->fe2) < 0) - return -ENODEV; - dvb->fe2->tuner_priv = dvb->fe->tuner_priv; - memcpy(>fe2->ops.tuner_ops, - >fe->ops.tuner_ops, - sizeof(struct dvb_tuner_ops)); - } + dvb->attached = 0x31; return 0; } - static int port_has_encti(struct ddb_port *port) { struct device *dev = port->dev->dev; -- 2.13.0
[PATCH RESEND 09/14] [media] ddbridge: fix possible buffer overflow in ddb_ports_init()
From: Daniel SchellerReport from smatch: drivers/media/pci/ddbridge/ddbridge-core.c:2659 ddb_ports_init() error: buffer overflow 'dev->port' 32 <= u32max Fix by making sure "p" is greater than zero before checking for "dev->port[].type == DDB_CI_EXTERNAL_XO2". Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/ddbridge-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 1e5c420e4717..5f8f77c74339 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -2550,7 +2550,7 @@ void ddb_ports_init(struct ddb *dev) port->dvb[0].adap = >adap[2 * p]; port->dvb[1].adap = >adap[2 * p + 1]; - if ((port->class == DDB_PORT_NONE) && i && + if ((port->class == DDB_PORT_NONE) && i && p > 0 && dev->port[p - 1].type == DDB_CI_EXTERNAL_XO2) { port->class = DDB_PORT_CI; port->type = DDB_CI_EXTERNAL_XO2_B; -- 2.13.0
[PATCH RESEND 11/14] [media] ddbridge: fix impossible condition warning
From: Daniel SchellerSmatch and gcc complained: drivers/media/pci/ddbridge/ddbridge-core.c:3491 bpsnr_show() warn: impossible condition '(snr[0] == 255) => ((-128)-127 == 255)' drivers/media/pci/ddbridge/ddbridge-core.c: In function ‘bpsnr_show’: drivers/media/pci/ddbridge/ddbridge-core.c:3491:13: warning: comparison is always false due to limited range of data type [-Wtype-limits] Fix this by changing the type of snr to unsigned char. Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/ddbridge-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 2479cb70743e..e3119351b9a1 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -3250,7 +3250,7 @@ static ssize_t bpsnr_show(struct device *device, struct device_attribute *attr, char *buf) { struct ddb *dev = dev_get_drvdata(device); - char snr[32]; + unsigned char snr[32]; if (!dev->i2c_num) return 0; -- 2.13.0
[PATCH RESEND 05/14] [media] ddbridge: split off IRQ handling
From: Daniel SchellerThis not only helps keep the ddbridge-core tidy, but also gets rid of defined-but-unused-function warnings which might be triggered depending of CONFIG_PCI_MSI, without having to clutter the code with #ifdef'ery. Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/Makefile| 3 +- drivers/media/pci/ddbridge/ddbridge-core.c | 130 --- drivers/media/pci/ddbridge/ddbridge-irq.c | 161 + drivers/media/pci/ddbridge/ddbridge.h | 12 +-- 4 files changed, 168 insertions(+), 138 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-irq.c diff --git a/drivers/media/pci/ddbridge/Makefile b/drivers/media/pci/ddbridge/Makefile index fe8ff0c681ad..0a7caa95a3b6 100644 --- a/drivers/media/pci/ddbridge/Makefile +++ b/drivers/media/pci/ddbridge/Makefile @@ -2,7 +2,8 @@ # Makefile for the ddbridge device driver # -ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-i2c.o +ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-i2c.o \ + ddbridge-irq.o obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 66da4918cd74..d46a81b2f80b 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -2690,136 +2690,6 @@ void ddb_ports_release(struct ddb *dev) // // -#define IRQ_HANDLE(_nr) \ - do { if ((s & (1UL << ((_nr) & 0x1f))) && dev->handler[0][_nr]) \ - dev->handler[0][_nr](dev->handler_data[0][_nr]); } \ - while (0) - -#define IRQ_HANDLE_BYTE(_n) { \ - if (s & (0x00ff << ((_n) & 0x1f))) { \ - IRQ_HANDLE(0 + (_n)); \ - IRQ_HANDLE(1 + (_n)); \ - IRQ_HANDLE(2 + (_n)); \ - IRQ_HANDLE(3 + (_n)); \ - IRQ_HANDLE(4 + (_n)); \ - IRQ_HANDLE(5 + (_n)); \ - IRQ_HANDLE(6 + (_n)); \ - IRQ_HANDLE(7 + (_n)); \ - } \ - } - -static void irq_handle_msg(struct ddb *dev, u32 s) -{ - dev->i2c_irq++; - IRQ_HANDLE(0); - IRQ_HANDLE(1); - IRQ_HANDLE(2); - IRQ_HANDLE(3); -} - -static void irq_handle_io(struct ddb *dev, u32 s) -{ - dev->ts_irq++; - if ((s & 0x00f0)) { - IRQ_HANDLE(4); - IRQ_HANDLE(5); - IRQ_HANDLE(6); - IRQ_HANDLE(7); - } - if ((s & 0xff00)) { - IRQ_HANDLE(8); - IRQ_HANDLE(9); - IRQ_HANDLE(10); - IRQ_HANDLE(11); - IRQ_HANDLE(12); - IRQ_HANDLE(13); - IRQ_HANDLE(14); - IRQ_HANDLE(15); - } - if ((s & 0x00ff)) { - IRQ_HANDLE(16); - IRQ_HANDLE(17); - IRQ_HANDLE(18); - IRQ_HANDLE(19); - IRQ_HANDLE(20); - IRQ_HANDLE(21); - IRQ_HANDLE(22); - IRQ_HANDLE(23); - } - if ((s & 0xff00)) { - IRQ_HANDLE(24); - IRQ_HANDLE(25); - IRQ_HANDLE(26); - IRQ_HANDLE(27); - IRQ_HANDLE(28); - IRQ_HANDLE(29); - IRQ_HANDLE(30); - IRQ_HANDLE(31); - } -} - -#ifdef DDB_USE_MSI_IRQHANDLERS -irqreturn_t irq_handler0(int irq, void *dev_id) -{ - struct ddb *dev = (struct ddb *) dev_id; - u32 s = ddbreadl(dev, INTERRUPT_STATUS); - - do { - if (s & 0x8000) - return IRQ_NONE; - if (!(s & 0xf00)) - return IRQ_NONE; - ddbwritel(dev, s & 0xf00, INTERRUPT_ACK); - irq_handle_io(dev, s); - } while ((s = ddbreadl(dev, INTERRUPT_STATUS))); - - return IRQ_HANDLED; -} - -irqreturn_t irq_handler1(int irq, void *dev_id) -{ - struct ddb *dev = (struct ddb *) dev_id; - u32 s = ddbreadl(dev, INTERRUPT_STATUS); - - do { - if (s & 0x8000) - return IRQ_NONE; - if (!(s & 0xf)) - return IRQ_NONE; - ddbwritel(dev, s & 0xf, INTERRUPT_ACK); - irq_handle_msg(dev, s); - } while ((s = ddbreadl(dev, INTERRUPT_STATUS))); - - return IRQ_HANDLED; -} -#endif - -irqreturn_t irq_handler(int irq, void *dev_id) -{ - struct ddb *dev = (struct ddb *) dev_id; - u32 s = ddbreadl(dev, INTERRUPT_STATUS); -
[PATCH RESEND 10/14] [media] ddbridge: remove unreachable code
From: Daniel Scheller>From smatch: drivers/media/pci/ddbridge/ddbridge-core.c:3490 snr_store() info: ignoring unreachable code. In fact, the function immediately returns zero, so remove it and update ddb_attrs_snr[] to not reference it anymore. Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/ddbridge-core.c | 27 --- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 5f8f77c74339..2479cb70743e 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -3235,25 +3235,6 @@ static ssize_t snr_show(struct device *device, return sprintf(buf, "%s\n", snr); } - -static ssize_t snr_store(struct device *device, struct device_attribute *attr, -const char *buf, size_t count) -{ - struct ddb *dev = dev_get_drvdata(device); - int num = attr->attr.name[3] - 0x30; - u8 snr[34] = { 0x01, 0x00 }; - - return 0; /* NOE: remove completely? */ - if (count > 31) - return -EINVAL; - if (dev->port[num].type >= DDB_TUNER_XO2) - return -EINVAL; - memcpy(snr + 2, buf, count); - i2c_write(>i2c[num].adap, 0x57, snr, 34); - i2c_write(>i2c[num].adap, 0x50, snr, 34); - return count; -} - static ssize_t bsnr_show(struct device *device, struct device_attribute *attr, char *buf) { @@ -3393,10 +3374,10 @@ static struct device_attribute ddb_attrs_fan[] = { }; static struct device_attribute ddb_attrs_snr[] = { - __ATTR(snr0, 0664, snr_show, snr_store), - __ATTR(snr1, 0664, snr_show, snr_store), - __ATTR(snr2, 0664, snr_show, snr_store), - __ATTR(snr3, 0664, snr_show, snr_store), + __ATTR_MRO(snr0, snr_show), + __ATTR_MRO(snr1, snr_show), + __ATTR_MRO(snr2, snr_show), + __ATTR_MRO(snr3, snr_show), }; static struct device_attribute ddb_attrs_ctemp[] = { -- 2.13.0
[PATCH RESEND 13/14] [media] ddbridge: Kconfig option to control the MSI modparam default
From: Daniel SchellerIt is known that MSI interrupts - while working quite well so far - can still cause issues on some hardware platforms (causing I2C timeouts due to unhandled interrupts). The msi variable/option is set to 1 by default. So, add a Kconfig option prefixed with "EXPERIMENTAL" that will control the default value of that modparam, defaulting to off for a better user experience and (guaranteed) stable operation "per default". Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/Kconfig | 15 +++ drivers/media/pci/ddbridge/ddbridge-main.c | 11 +-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/ddbridge/Kconfig b/drivers/media/pci/ddbridge/Kconfig index c79a58fa5fc3..1330b2ecc72a 100644 --- a/drivers/media/pci/ddbridge/Kconfig +++ b/drivers/media/pci/ddbridge/Kconfig @@ -26,3 +26,18 @@ config DVB_DDBRIDGE - CineS2 V7/V7A and DuoFlex S2 V4 (ST STV0910-based) Say Y if you own such a card and want to use it. + +config DVB_DDBRIDGE_MSIENABLE + bool "Enable Message Signaled Interrupts (MSI) per default (EXPERIMENTAL)" + depends on DVB_DDBRIDGE + depends on PCI_MSI + default n + ---help--- + Use PCI MSI (Message Signaled Interrupts) per default. Enabling this + might lead to I2C errors originating from the bridge in conjunction + with certain SATA controllers, requiring a reload of the ddbridge + module. MSI can still be disabled by passing msi=0 as option, as + this will just change the msi option default value. + + If you're unsure, concerned about stability and don't want to pass + module options in case of troubles, say N. diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c index fa4f663c5acb..83643bc21d09 100644 --- a/drivers/media/pci/ddbridge/ddbridge-main.c +++ b/drivers/media/pci/ddbridge/ddbridge-main.c @@ -46,10 +46,17 @@ MODULE_PARM_DESC(adapter_alloc, "0-one adapter per io, 1-one per tab with io, 2-one per tab, 3-one for all"); #ifdef CONFIG_PCI_MSI +#ifdef CONFIG_DVB_DDBRIDGE_MSIENABLE int msi = 1; +#else +int msi; +#endif module_param(msi, int, 0444); -MODULE_PARM_DESC(msi, -" Control MSI interrupts: 0-disable, 1-enable (default)"); +#ifdef CONFIG_DVB_DDBRIDGE_MSIENABLE +MODULE_PARM_DESC(msi, "Control MSI interrupts: 0-disable, 1-enable (default)"); +#else +MODULE_PARM_DESC(msi, "Control MSI interrupts: 0-disable (default), 1-enable"); +#endif #endif int ci_bitrate = 7; -- 2.13.0
[PATCH RESEND 01/14] [media] ddbridge: move/reorder functions
From: Daniel SchellerThe functions in ddbridge-core.c have been moved to different positions in newer versions of the dddvb vendor driver package (most notably in version 0.9.9b). Perform the same code move to keep the diff of the upcoming code bump simpler. Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/ddbridge-core.c | 660 ++--- 1 file changed, 327 insertions(+), 333 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index ec41804d78c7..d6dcc42ff222 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -404,43 +404,6 @@ static void ddb_buffers_free(struct ddb *dev) } } -static void ddb_input_start(struct ddb_input *input) -{ - struct ddb *dev = input->port->dev; - - spin_lock_irq(>lock); - input->cbuf = 0; - input->coff = 0; - - /* reset */ - ddbwritel(0, TS_INPUT_CONTROL(input->nr)); - ddbwritel(2, TS_INPUT_CONTROL(input->nr)); - ddbwritel(0, TS_INPUT_CONTROL(input->nr)); - - ddbwritel((1 << 16) | - (input->dma_buf_num << 11) | - (input->dma_buf_size >> 7), - DMA_BUFFER_SIZE(input->nr)); - ddbwritel(0, DMA_BUFFER_ACK(input->nr)); - - ddbwritel(1, DMA_BASE_WRITE); - ddbwritel(3, DMA_BUFFER_CONTROL(input->nr)); - ddbwritel(9, TS_INPUT_CONTROL(input->nr)); - input->running = 1; - spin_unlock_irq(>lock); -} - -static void ddb_input_stop(struct ddb_input *input) -{ - struct ddb *dev = input->port->dev; - - spin_lock_irq(>lock); - ddbwritel(0, TS_INPUT_CONTROL(input->nr)); - ddbwritel(0, DMA_BUFFER_CONTROL(input->nr)); - input->running = 0; - spin_unlock_irq(>lock); -} - static void ddb_output_start(struct ddb_output *output) { struct ddb *dev = output->port->dev; @@ -477,6 +440,43 @@ static void ddb_output_stop(struct ddb_output *output) spin_unlock_irq(>lock); } +static void ddb_input_stop(struct ddb_input *input) +{ + struct ddb *dev = input->port->dev; + + spin_lock_irq(>lock); + ddbwritel(0, TS_INPUT_CONTROL(input->nr)); + ddbwritel(0, DMA_BUFFER_CONTROL(input->nr)); + input->running = 0; + spin_unlock_irq(>lock); +} + +static void ddb_input_start(struct ddb_input *input) +{ + struct ddb *dev = input->port->dev; + + spin_lock_irq(>lock); + input->cbuf = 0; + input->coff = 0; + + /* reset */ + ddbwritel(0, TS_INPUT_CONTROL(input->nr)); + ddbwritel(2, TS_INPUT_CONTROL(input->nr)); + ddbwritel(0, TS_INPUT_CONTROL(input->nr)); + + ddbwritel((1 << 16) | + (input->dma_buf_num << 11) | + (input->dma_buf_size >> 7), + DMA_BUFFER_SIZE(input->nr)); + ddbwritel(0, DMA_BUFFER_ACK(input->nr)); + + ddbwritel(1, DMA_BASE_WRITE); + ddbwritel(3, DMA_BUFFER_CONTROL(input->nr)); + ddbwritel(9, TS_INPUT_CONTROL(input->nr)); + input->running = 1; + spin_unlock_irq(>lock); +} + static u32 ddb_output_free(struct ddb_output *output) { u32 idx, off, stat = output->stat; @@ -595,7 +595,98 @@ static ssize_t ddb_input_read(struct ddb_input *input, __user u8 *buf, size_t co return count; } -/**/ +// +// + +static ssize_t ts_write(struct file *file, const __user char *buf, + size_t count, loff_t *ppos) +{ + struct dvb_device *dvbdev = file->private_data; + struct ddb_output *output = dvbdev->priv; + size_t left = count; + int stat; + + while (left) { + if (ddb_output_free(output) < 188) { + if (file->f_flags & O_NONBLOCK) + break; + if (wait_event_interruptible( + output->wq, ddb_output_free(output) >= 188) < 0) + break; + } + stat = ddb_output_write(output, buf, left); + if (stat < 0) + break; + buf += stat; + left -= stat; + } + return (left == count) ? -EAGAIN : (count - left); +} + +static ssize_t ts_read(struct file *file, __user char *buf, + size_t count, loff_t *ppos) +{ + struct dvb_device *dvbdev = file->private_data; + struct ddb_output *output = dvbdev->priv; + struct
[PATCH RESEND 02/14] [media] ddbridge: split code into multiple files
From: Daniel SchellerAs of 0.9.9b, the ddbridge code has been split from one single file (ddbridge-core.c) into multiple files, with the purpose of taking care of different topics, and to be able to reuse code in different kernel modules (ddbridge.ko and octonet.ko). This applies the same code split, with a notable difference: In the vendor package, the split was done by moving all code parts into separate files, and in the "main" code files (ddbridge.c and octonet.c), a simple "#include ddbridge-core.c" was done. In this patch, the same split (codewise) is done, but all resulting .c/.o files will be handled by the makefile, with proper prototyping of all shared functions done in ddbridge.h. Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/Makefile| 2 +- drivers/media/pci/ddbridge/ddbridge-core.c | 588 + drivers/media/pci/ddbridge/ddbridge-i2c.c | 231 drivers/media/pci/ddbridge/ddbridge-main.c | 388 +++ drivers/media/pci/ddbridge/ddbridge.h | 49 +++ 5 files changed, 681 insertions(+), 577 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-i2c.c create mode 100644 drivers/media/pci/ddbridge/ddbridge-main.c diff --git a/drivers/media/pci/ddbridge/Makefile b/drivers/media/pci/ddbridge/Makefile index 7446c8b677b5..fe8ff0c681ad 100644 --- a/drivers/media/pci/ddbridge/Makefile +++ b/drivers/media/pci/ddbridge/Makefile @@ -2,7 +2,7 @@ # Makefile for the ddbridge device driver # -ddbridge-objs := ddbridge-core.o +ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-i2c.o obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index d6dcc42ff222..ccbc9f41b10e 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -32,8 +32,8 @@ #include #include #include -#include "ddbridge.h" +#include "ddbridge.h" #include "ddbridge-regs.h" #include "tda18271c2dd.h" @@ -49,227 +49,8 @@ #include "stv6111.h" #include "lnbh25.h" -static int xo2_speed = 2; -module_param(xo2_speed, int, 0444); -MODULE_PARM_DESC(xo2_speed, "default transfer speed for xo2 based duoflex, 0=55,1=75,2=90,3=104 MBit/s, default=2, use attribute to change for individual cards"); - -static int stv0910_single; -module_param(stv0910_single, int, 0444); -MODULE_PARM_DESC(stv0910_single, "use stv0910 cards as single demods"); - DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); -/* MSI had problems with lost interrupts, fixed but needs testing */ -#undef CONFIG_PCI_MSI - -/**/ - -static int i2c_io(struct i2c_adapter *adapter, u8 adr, - u8 *wbuf, u32 wlen, u8 *rbuf, u32 rlen) -{ - struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, - .buf = wbuf, .len = wlen }, - {.addr = adr, .flags = I2C_M_RD, - .buf = rbuf, .len = rlen } }; - return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; -} - -static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len) -{ - struct i2c_msg msg = {.addr = adr, .flags = 0, - .buf = data, .len = len}; - - return (i2c_transfer(adap, , 1) == 1) ? 0 : -1; -} - -static int i2c_read(struct i2c_adapter *adapter, u8 adr, u8 *val) -{ - struct i2c_msg msgs[1] = {{.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = 1 } }; - return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1; -} - -static int i2c_read_regs(struct i2c_adapter *adapter, -u8 adr, u8 reg, u8 *val, u8 len) -{ - struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, - .buf = , .len = 1 }, - {.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = len } }; - return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; -} - -static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, u8 reg, u8 *val) -{ - return i2c_read_regs(adapter, adr, reg, val, 1); -} - -static int i2c_read_reg16(struct i2c_adapter *adapter, u8 adr, - u16 reg, u8 *val) -{ - u8 msg[2] = {reg>>8, reg&0xff}; - struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, - .buf = msg, .len = 2}, - {.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = 1} }; - return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; -} - -static
[PATCH RESEND 12/14] [media] ddbridge: fix dereference before check
From: Daniel SchellerBoth ts_release() and ts_open() can use "output" before check (smatch): drivers/media/pci/ddbridge/ddbridge-core.c:816 ts_release() warn: variable dereferenced before check 'output' (see line 809) drivers/media/pci/ddbridge/ddbridge-core.c:836 ts_open() warn: variable dereferenced before check 'output' (see line 828) Fix by performing checks on those pointers. Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/ddbridge-core.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index e3119351b9a1..98ead4ee8d2f 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -737,8 +737,13 @@ static unsigned int ts_poll(struct file *file, poll_table *wait) static int ts_release(struct inode *inode, struct file *file) { struct dvb_device *dvbdev = file->private_data; - struct ddb_output *output = dvbdev->priv; - struct ddb_input *input = output->port->input[0]; + struct ddb_output *output = NULL; + struct ddb_input *input = NULL; + + if (dvbdev) { + output = dvbdev->priv; + input = output->port->input[0]; + } if ((file->f_flags & O_ACCMODE) == O_RDONLY) { if (!input) @@ -756,8 +761,13 @@ static int ts_open(struct inode *inode, struct file *file) { int err; struct dvb_device *dvbdev = file->private_data; - struct ddb_output *output = dvbdev->priv; - struct ddb_input *input = output->port->input[0]; + struct ddb_output *output = NULL; + struct ddb_input *input = NULL; + + if (dvbdev) { + output = dvbdev->priv; + input = output->port->input[0]; + } if ((file->f_flags & O_ACCMODE) == O_RDONLY) { if (!input) -- 2.13.0
[PATCH RESEND 14/14] [media] MAINTAINERS: add entry for ddbridge
From: Daniel SchellerSigned-off-by: Daniel Scheller --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9826a918d37a..f25f26b5d9f6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8428,6 +8428,14 @@ T: git git://linuxtv.org/media_tree.git S: Maintained F: drivers/media/dvb-frontends/stv6111* +MEDIA DRIVERS FOR DIGITAL DEVICES PCIE DEVICES +M: Daniel Scheller +L: linux-media@vger.kernel.org +W: https://linuxtv.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: drivers/media/pci/ddbridge/* + MEDIA INPUT INFRASTRUCTURE (V4L/DVB) M: Mauro Carvalho Chehab M: Mauro Carvalho Chehab -- 2.13.0
[PATCH RESEND 04/14] [media] ddbridge: split I/O related functions off from ddbridge.h
From: Daniel SchellerWhile it seems valid that headers can carry simple oneline static inline annotated functions, move them into their own header file to have the overall code more readable. Also, keep them as header (and don't put in a separate object) and static inline to help the compiler avoid generating function calls. (Thanks to Jasmin J. for valuable input on this!) Cc: Jasmin J. Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Tested-by: Jasmin Jessich Tested-by: Dietmar Spingler Tested-by: Manfred Knick --- drivers/media/pci/ddbridge/ddbridge-core.c | 1 + drivers/media/pci/ddbridge/ddbridge-i2c.c | 1 + drivers/media/pci/ddbridge/ddbridge-io.h | 71 ++ drivers/media/pci/ddbridge/ddbridge-main.c | 1 + drivers/media/pci/ddbridge/ddbridge.h | 43 -- 5 files changed, 74 insertions(+), 43 deletions(-) create mode 100644 drivers/media/pci/ddbridge/ddbridge-io.h diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index d12deba635bd..66da4918cd74 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -36,6 +36,7 @@ #include "ddbridge.h" #include "ddbridge-regs.h" +#include "ddbridge-io.h" #include "tda18271c2dd.h" #include "stv6110x.h" diff --git a/drivers/media/pci/ddbridge/ddbridge-i2c.c b/drivers/media/pci/ddbridge/ddbridge-i2c.c index 540bbd211c19..3d0aefe05cec 100644 --- a/drivers/media/pci/ddbridge/ddbridge-i2c.c +++ b/drivers/media/pci/ddbridge/ddbridge-i2c.c @@ -32,6 +32,7 @@ #include "ddbridge.h" #include "ddbridge-regs.h" +#include "ddbridge-io.h" /**/ diff --git a/drivers/media/pci/ddbridge/ddbridge-io.h b/drivers/media/pci/ddbridge/ddbridge-io.h new file mode 100644 index ..ce92e9484075 --- /dev/null +++ b/drivers/media/pci/ddbridge/ddbridge-io.h @@ -0,0 +1,71 @@ +/* + * ddbridge-io.h: Digital Devices bridge I/O inline functions + * + * Copyright (C) 2010-2017 Digital Devices GmbH + * Ralph Metzler + * Marcus Metzler + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 only, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * 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. + * + */ + +#ifndef __DDBRIDGE_IO_H__ +#define __DDBRIDGE_IO_H__ + +#include + +#include "ddbridge.h" + +/**/ + +static inline u32 ddblreadl(struct ddb_link *link, u32 adr) +{ + return readl((char *) (link->dev->regs + (adr))); +} + +static inline void ddblwritel(struct ddb_link *link, u32 val, u32 adr) +{ + writel(val, (char *) (link->dev->regs + (adr))); +} + +static inline u32 ddbreadl(struct ddb *dev, u32 adr) +{ + return readl((char *) (dev->regs + (adr))); +} + +static inline void ddbwritel(struct ddb *dev, u32 val, u32 adr) +{ + writel(val, (char *) (dev->regs + (adr))); +} + +static inline void ddbcpyto(struct ddb *dev, u32 adr, void *src, long count) +{ + return memcpy_toio((char *) (dev->regs + adr), src, count); +} + +static inline void ddbcpyfrom(struct ddb *dev, void *dst, u32 adr, long count) +{ + return memcpy_fromio(dst, (char *) (dev->regs + adr), count); +} + +static inline u32 safe_ddbreadl(struct ddb *dev, u32 adr) +{ + u32 val = ddbreadl(dev, adr); + + /* (ddb)readl returns (uint)-1 (all bits set) on failure, catch that */ + if (val == ~0) { + dev_err(>pdev->dev, "ddbreadl failure, adr=%08x\n", adr); + return 0; + } + + return val; +} + +#endif /* __DDBRIDGE_IO_H__ */ diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c index 8262979b6257..de9da6077ec6 100644 --- a/drivers/media/pci/ddbridge/ddbridge-main.c +++ b/drivers/media/pci/ddbridge/ddbridge-main.c @@ -34,6 +34,7 @@ #include "ddbridge.h" #include "ddbridge-regs.h" +#include "ddbridge-io.h" // /* module parameters */ diff --git a/drivers/media/pci/ddbridge/ddbridge.h b/drivers/media/pci/ddbridge/ddbridge.h index 7fe5820a78ff..fa471481a572 100644 --- a/drivers/media/pci/ddbridge/ddbridge.h +++ b/drivers/media/pci/ddbridge/ddbridge.h @@ -353,49 +353,6 @@ struct ddb { u8 tsbuf[TS_CAPTURE_LEN]; };
[PATCH RESEND 00/14] ddbridge: bump to ddbridge-0.9.29
From: Daniel SchellerPreferrably for Linux 4.14 (to get things done). Resend reasons (resend since no real changes went in): * rebased on latest mediatree-master wrt commit 618e8aac3d7c ("media: ddbridge: constify i2c_algorithm structure") * build error in ddbridge-core.c fixed wrt commit dcda9b04713c ("mm, tree wide: replace __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semantic") * useless return removed from void calc_con() * UTF8 in ddbridge-regs.h removed * Tested-by's added to commit messages Since the STV0910 patches are merged, the dependency is resolved. Mauro/Media maintainers, this updates drivers/media/pci/ddbridge to the very latest code that DD carry in their vendor driver package as of version 0.9.29, in the "once, the big-bang-way is ok" way as discussed at [2] (compared to the incremental, awkward to do variant since that involves dissecting all available release archives and having to - try to - build proper commits out of this, which will always be inaccurate; a start was done at [3], however - and please understand - I definitely don't want to continue doing that...) In patch 14, I add myself to MAINTAINERS. This means I will care about getting driver updates as they're released by DD into mainline, starting from this (0.9.29) version, which is definitely doable in an incremental way. So, I'll make sure the in-kernel driver won't bit-rot again, and it will receive new hardware support as it becomes available in a timely manner. While the driver code bump looks massive, judging from the diff, there's mostly a whole lot of refactoring and restructuring of variables, port/ link management and all such stuff in it. Feature-wise, this is most notable: - Support for all (PCIe) CI (single/duo) cards and Flex addons - Support for MSI (Message Signaled Interrupts), though disabled by default since there were still reports of problems with this - TS Loopback support (set up ports to behave as if a CI is connected, without decryption of course) - As mentioned: Heavy code reordering, and split up into multiple files Stripped functionality compared to dddvb: - DVB-C modulator card support removed (requires DVB core API) - OctoNET SAT>IP server/box support removed (requires API aswell) - with this, GT link support was removed (only on OctoNET hardware) - MaxS8 4/8 DVB-S/S2 card support (temporarily) removed (requires an additional Demod driver; subject for another, later, series) A note on the patches: The bump starts by aligning the code "order-wise" to the updated driver, to keep the diff a bit cleaner. Next, the code split is applied, without actually changing any functionality. Compared to upstream, this isn't done by moving functions into different C files and then do an include on them, but we're handling them with the Makefile, building separate objects, and having proper prototypes in ddbridge.h. After the code bump, further split up is applied to increase readability and maintainability (also, for the MaxS8 support, there will be another object with another ~400 LoC, which originally lives in ddbridge-core aswell). Then, all issues found by W=1 and smatch are resolved, one by one. This is kept separate since those fixes will be proposed for upstream inclusion. The last thing is the addition of the MSI default Kconfig options which will mainly inform users that there's something that might(!) cause issues but is still being worked on - the default is "off" to provide a proper OotB experience. To distinguish from the original unchanged vendor driver, "-integrated" is suffixed to the version code. Note on checkpatch: First two patches are solely code-moving, so checkpatch will complain on them. With the ddbridge code bump, all non-strict style issues are resolved. "--strict" checking will receive another round of patches afterwards. Yes, you will hate me for this large code drop, but at least we sort-of discussed this beforehand, and we have to start *somewhere*. Thanks in advance for reviewing and (optimally) getting this merged and getting the DD driver dilemma solved hopefully once and for all. [1] http://www.spinics.net/lists/linux-media/msg117946.html [2] http://www.spinics.net/lists/linux-media/msg117358.html [3] https://github.com/herrnst/dddvb-linux-kernel/compare/4226861...mediatree/master-ddbupdate Daniel Scheller (14): [media] ddbridge: move/reorder functions [media] ddbridge: split code into multiple files [media] ddbridge: bump ddbridge code to version 0.9.29 [media] ddbridge: split I/O related functions off from ddbridge.h [media] ddbridge: split off IRQ handling [media] ddbridge: split off hardware definitions and mappings [media] ddbridge: check pointers before dereferencing [media] ddbridge: only register frontends in fe2 if fe is not NULL [media] ddbridge: fix possible buffer overflow in ddb_ports_init() [media] ddbridge: remove unreachable code [media] ddbridge: fix impossible
[PATCH] staging: imx: fix non-static declarations
Add static keywords to fix this kind of sparse warnings: warning: symbol 'imx_t_vcm_timing' was not declared. Should it be static? Signed-off-by: JB Van Puyvelde--- drivers/staging/media/atomisp/i2c/imx/imx.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/imx/imx.c b/drivers/staging/media/atomisp/i2c/imx/imx.c index 408a7b945153..fb32cb2f2dd1 100644 --- a/drivers/staging/media/atomisp/i2c/imx/imx.c +++ b/drivers/staging/media/atomisp/i2c/imx/imx.c @@ -1084,7 +1084,7 @@ static int imx_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val) return 0; } -int imx_vcm_power_up(struct v4l2_subdev *sd) +static int imx_vcm_power_up(struct v4l2_subdev *sd) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->power_up) @@ -1092,7 +1092,7 @@ int imx_vcm_power_up(struct v4l2_subdev *sd) return 0; } -int imx_vcm_power_down(struct v4l2_subdev *sd) +static int imx_vcm_power_down(struct v4l2_subdev *sd) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->power_down) @@ -1100,7 +1100,7 @@ int imx_vcm_power_down(struct v4l2_subdev *sd) return 0; } -int imx_vcm_init(struct v4l2_subdev *sd) +static int imx_vcm_init(struct v4l2_subdev *sd) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->init) @@ -1108,7 +1108,7 @@ int imx_vcm_init(struct v4l2_subdev *sd) return 0; } -int imx_t_focus_vcm(struct v4l2_subdev *sd, u16 val) +static int imx_t_focus_vcm(struct v4l2_subdev *sd, u16 val) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->t_focus_vcm) @@ -1116,14 +1116,15 @@ int imx_t_focus_vcm(struct v4l2_subdev *sd, u16 val) return 0; } -int imx_t_focus_abs(struct v4l2_subdev *sd, s32 value) +static int imx_t_focus_abs(struct v4l2_subdev *sd, s32 value) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->t_focus_abs) return dev->vcm_driver->t_focus_abs(sd, value); return 0; } -int imx_t_focus_rel(struct v4l2_subdev *sd, s32 value) + +static int imx_t_focus_rel(struct v4l2_subdev *sd, s32 value) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->t_focus_rel) @@ -1131,7 +1132,7 @@ int imx_t_focus_rel(struct v4l2_subdev *sd, s32 value) return 0; } -int imx_q_focus_status(struct v4l2_subdev *sd, s32 *value) +static int imx_q_focus_status(struct v4l2_subdev *sd, s32 *value) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->q_focus_status) @@ -1139,7 +1140,7 @@ int imx_q_focus_status(struct v4l2_subdev *sd, s32 *value) return 0; } -int imx_q_focus_abs(struct v4l2_subdev *sd, s32 *value) +static int imx_q_focus_abs(struct v4l2_subdev *sd, s32 *value) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->q_focus_abs) @@ -1147,7 +1148,7 @@ int imx_q_focus_abs(struct v4l2_subdev *sd, s32 *value) return 0; } -int imx_t_vcm_slew(struct v4l2_subdev *sd, s32 value) +static int imx_t_vcm_slew(struct v4l2_subdev *sd, s32 value) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->t_vcm_slew) @@ -1155,7 +1156,7 @@ int imx_t_vcm_slew(struct v4l2_subdev *sd, s32 value) return 0; } -int imx_t_vcm_timing(struct v4l2_subdev *sd, s32 value) +static int imx_t_vcm_timing(struct v4l2_subdev *sd, s32 value) { struct imx_device *dev = to_imx_sensor(sd); if (dev->vcm_driver && dev->vcm_driver->t_vcm_timing) @@ -2105,8 +2106,7 @@ imx_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *param) return 0; } -int -imx_g_frame_interval(struct v4l2_subdev *sd, +static int imx_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *interval) { struct imx_device *dev = to_imx_sensor(sd); -- 2.11.0
Re: [PATCH 0/7] stv0910/stv6111 updates
Hello! I tested this patch series with: DD Cine S2 V6 DD Duoflex CI (single) DD Duoflex S2 V4 (stv0910/stv6111) VDR 2.3.8, ddci2 Plugin 1.5.0 The SAT cables were connected to the DD DuoFlex S2 V4 card and VDR was instructed to use this device only. I checked the signal values with VDR and dvb-fe-tool and both showed the same values than before (without the patches). I did a recording of ORF I (Austrian TV) and was also watching ZDF (German TV) simultaneously. All worked as expected! With this eMail I add my Tested-by: Jasmin Jessichfor this series. BR, Jasmin
[PATCH] [media] dvb-frontends/cxd2841er: update moddesc wrt new chip support
From: Daniel SchellerSince the driver now recognizes and supports more chip variants, reflect this fact in the module description accordingly. Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/cxd2841er.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 0ab1fc845927..48ee9bc00c06 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -3999,6 +3999,6 @@ static struct dvb_frontend_ops cxd2841er_t_c_ops = { .get_frontend_algo = cxd2841er_get_algo }; -MODULE_DESCRIPTION("Sony CXD2841ER/CXD2854ER DVB-C/C2/T/T2/S/S2 demodulator driver"); +MODULE_DESCRIPTION("Sony CXD2837/38/41/43/54ER DVB-C/C2/T/T2/S/S2 demodulator driver"); MODULE_AUTHOR("Sergey Kozlov , Abylay Ospan "); MODULE_LICENSE("GPL"); -- 2.13.0
Re: [PATCH 00/14] ddbridge: bump to ddbridge-0.9.29
Am Sun, 9 Jul 2017 21:42:07 +0200 schrieb Daniel Scheller: > From: Daniel Scheller > > Preferrably for Linux 4.14 (to get things done). > > [...] > > Mauro/Media maintainers, this updates drivers/media/pci/ddbridge to > the very latest code that DD carry in their vendor driver package as > of version 0.9.29, in the "once, the big-bang-way is ok" way as > discussed at [2] (compared to the incremental, awkward to do variant > since that involves dissecting all available release archives and > having to - try to - build proper commits out of this, which will > always be inaccurate; a start was done at [3], however - and please > understand - I definitely don't want to continue doing that...) > > [...] Feedback from "Dietmar Spingler ", a very valuable tester, who has a huge share of getting the mainline patches going, but isn't subscribed to the list, so posting in behalf of him (added in Cc aswell): "Running the patches on two Gentoo systems equipped with DD hardware parts on current kernel versions: * Digital Devices MaxS8 * Digital Devices MaxA8 * Digital Devices Octopus V3 Bridge, with a DuoFlex S2v4 and a DuoFlex CT2 attached * 2x Digital Devices CI Duo PCIe Bridges Several CAMs are in use to decrypt DVB-S(2) and DVB-T2 channels. Running current VDR and minisatip on the userspace side. Everything running without issues, even with all tuners active in parallel." Best regards, Daniel Scheller -- https://github.com/herrnst
[PATCH 1/3] build: Add compat code for pm_runtime_get_if_in_use
From: Jasmin JessichSigned-off-by: Jasmin Jessich --- v4l/compat.h | 15 +++ v4l/scripts/make_config_compat.pl | 1 + 2 files changed, 16 insertions(+) diff --git a/v4l/compat.h b/v4l/compat.h index e565292..b5b0846 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -2084,4 +2084,19 @@ static inline void *skb_put_data(struct sk_buff *skb, const void *data, } #endif +#ifdef NEED_PM_RUNTIME_GET +static inline int pm_runtime_get_if_in_use(struct device *dev) +{ + unsigned long flags; + int retval; + + spin_lock_irqsave(>power.lock, flags); + retval = dev->power.disable_depth > 0 ? -EINVAL : + dev->power.runtime_status == RPM_ACTIVE + && atomic_inc_not_zero(>power.usage_count); + spin_unlock_irqrestore(>power.lock, flags); + return retval; +} +#endif + #endif /* _COMPAT_H */ diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl index 5ac59ab..be278aa 100644 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -700,6 +700,7 @@ sub check_other_dependencies() check_files_for_func("to_of_node", "NEED_TO_OF_NODE", "include/linux/of.h"); check_files_for_func("is_of_node", "NEED_IS_OF_NODE", "include/linux/of.h"); check_files_for_func("skb_put_data", "NEED_SKB_PUT_DATA", "include/linux/skbuff.h"); + check_files_for_func("pm_runtime_get_if_in_use", "NEED_PM_RUNTIME_GET", "include/linux/pm_runtime.h"); # For tests for uapi-dependent logic check_files_for_func_uapi("usb_endpoint_maxp", "NEED_USB_ENDPOINT_MAXP", "usb/ch9.h"); -- 2.7.4
[PATCH 2/3] build: Disable VIDEO_OV5670 for Kernels older that 3.17
From: Jasmin JessichSigned-off-by: Jasmin Jessich --- v4l/versions.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/v4l/versions.txt b/v4l/versions.txt index ae4a14f..1dd9a2b 100644 --- a/v4l/versions.txt +++ b/v4l/versions.txt @@ -68,6 +68,7 @@ VIDEO_ADV7180 VIDEO_ET8EK8 VIDEO_OV2640 VIDEO_OV7670 +VIDEO_OV5670 [3.15.0] # needs reset_control_get_optional -- 2.7.4
[PATCH 0/3] fix compile for kernel 3.13
From: Jasmin JessichThis series fixed compilation errors for older kernels. I have tested it with Kernel 3.13 and Daniel with Kernel 4.12. I disabled VIDEO_OV5670 for all kernels older than 3.17, but I am not 100% sure if the required change to compile it was really implemented in that version (checked only the revision history). This series requires "Add compat code for skb_put_data" from Matthias Schwarzott to be applied first (see https://www.mail-archive.com/linux-media@vger.kernel.org/msg116145.html ) Daniel Scheller (1): build: fix up build w/kernels <=4.12 by reverting 4.13 patches Jasmin Jessich (2): build: Add compat code for pm_runtime_get_if_in_use build: Disable VIDEO_OV5670 for Kernels older that 3.17 backports/backports.txt| 3 + .../v4.12_revert_solo6x10_copykerneluser.patch | 71 ++ v4l/compat.h | 15 + v4l/scripts/make_config_compat.pl | 1 + v4l/versions.txt | 1 + 5 files changed, 91 insertions(+) create mode 100644 backports/v4.12_revert_solo6x10_copykerneluser.patch -- 2.7.4
[PATCH 3/3] build: fix up build w/kernels <=4.12 by reverting 4.13 patches
From: Daniel SchellerSigned-off-by: Daniel Scheller Signed-off-by: Jasmin Jessich --- backports/backports.txt| 3 + .../v4.12_revert_solo6x10_copykerneluser.patch | 71 ++ 2 files changed, 74 insertions(+) create mode 100644 backports/v4.12_revert_solo6x10_copykerneluser.patch diff --git a/backports/backports.txt b/backports/backports.txt index 9803f76..873b2f5 100644 --- a/backports/backports.txt +++ b/backports/backports.txt @@ -26,6 +26,9 @@ add pr_fmt.patch add debug.patch add drx39xxj.patch +[4.12.255] +add v4.12_revert_solo6x10_copykerneluser.patch + [4.10.255] add v4.10_sched_signal.patch add v4.10_fault_page.patch diff --git a/backports/v4.12_revert_solo6x10_copykerneluser.patch b/backports/v4.12_revert_solo6x10_copykerneluser.patch new file mode 100644 index 000..2ccb9d8 --- /dev/null +++ b/backports/v4.12_revert_solo6x10_copykerneluser.patch @@ -0,0 +1,71 @@ +commit bbf3d164ec2723f090533c14ec1dc166eaca46f8 +Author: Daniel Scheller +Date: Fri Jul 21 20:41:49 2017 +0200 + +Revert "[media] solo6x10: Convert to the new PCM ops" + +This reverts commit 1facf21e8b903524b34f09c39a7d27b4b71a07f7. + +diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c +index 3ca947092775..36e93540bb49 100644 +--- a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c +@@ -223,9 +223,9 @@ static snd_pcm_uframes_t snd_solo_pcm_pointer(struct snd_pcm_substream *ss) + return idx * G723_FRAMES_PER_PAGE; + } + +-static int __snd_solo_pcm_copy(struct snd_pcm_substream *ss, +- unsigned long pos, void *dst, +- unsigned long count, bool in_kernel) ++static int snd_solo_pcm_copy(struct snd_pcm_substream *ss, int channel, ++ snd_pcm_uframes_t pos, void __user *dst, ++ snd_pcm_uframes_t count) + { + struct solo_snd_pcm *solo_pcm = snd_pcm_substream_chip(ss); + struct solo_dev *solo_dev = solo_pcm->solo_dev; +@@ -242,31 +242,16 @@ static int __snd_solo_pcm_copy(struct snd_pcm_substream *ss, + if (err) + return err; + +- if (in_kernel) +- memcpy(dst, solo_pcm->g723_buf, G723_PERIOD_BYTES); +- else if (copy_to_user((void __user *)dst, +-solo_pcm->g723_buf, G723_PERIOD_BYTES)) ++ err = copy_to_user(dst + (i * G723_PERIOD_BYTES), ++ solo_pcm->g723_buf, G723_PERIOD_BYTES); ++ ++ if (err) + return -EFAULT; +- dst += G723_PERIOD_BYTES; + } + + return 0; + } + +-static int snd_solo_pcm_copy_user(struct snd_pcm_substream *ss, int channel, +-unsigned long pos, void __user *dst, +-unsigned long count) +-{ +- return __snd_solo_pcm_copy(ss, pos, (void *)dst, count, false); +-} +- +-static int snd_solo_pcm_copy_kernel(struct snd_pcm_substream *ss, int channel, +- unsigned long pos, void *dst, +- unsigned long count) +-{ +- return __snd_solo_pcm_copy(ss, pos, dst, count, true); +-} +- + static const struct snd_pcm_ops snd_solo_pcm_ops = { + .open = snd_solo_pcm_open, + .close = snd_solo_pcm_close, +@@ -276,8 +261,7 @@ static const struct snd_pcm_ops snd_solo_pcm_ops = { + .prepare = snd_solo_pcm_prepare, + .trigger = snd_solo_pcm_trigger, + .pointer = snd_solo_pcm_pointer, +- .copy_user = snd_solo_pcm_copy_user, +- .copy_kernel = snd_solo_pcm_copy_kernel, ++ .copy = snd_solo_pcm_copy, + }; + + static int snd_solo_capture_volume_info(struct snd_kcontrol *kcontrol, -- 2.7.4
Re: [PATCH v3 2/4] i2c: add docs to clarify DMA handling
On Tue, 18 Jul 2017 12:23:37 +0200 Wolfram Sangwrote: > Signed-off-by: Wolfram Sang Is this material not perhaps better placed in the sphinx docs? Up to you of course as your subsystem ;) Text is good though. Acked-by: Jonathan Cameron > --- > Changes since v2: > > * documentation updates. Hopefully better wording now > > Documentation/i2c/DMA-considerations | 38 > > 1 file changed, 38 insertions(+) > create mode 100644 Documentation/i2c/DMA-considerations > > diff --git a/Documentation/i2c/DMA-considerations > b/Documentation/i2c/DMA-considerations > new file mode 100644 > index 00..e46c24d65c8556 > --- /dev/null > +++ b/Documentation/i2c/DMA-considerations > @@ -0,0 +1,38 @@ > +Linux I2C and DMA > +- > + > +Given that I2C is a low-speed bus where largely small messages are > transferred, > +it is not considered a prime user of DMA access. At this time of writing, > only > +10% of I2C bus master drivers have DMA support implemented. And the vast > +majority of transactions are so small that setting up DMA for it will likely > +add more overhead than a plain PIO transfer. > + > +Therefore, it is *not* mandatory that the buffer of an I2C message is DMA > safe. > +It does not seem reasonable to apply additional burdens when the feature is > so > +rarely used. However, it is recommended to use a DMA-safe buffer if your > +message size is likely applicable for DMA. Most drivers have this threshold > +around 8 bytes. As of today, this is mostly an educated guess, however. > + > +To support this scenario, drivers wishing to implement DMA can use helper > +functions from the I2C core. One checks if a message is DMA capable in terms > of > +size and memory type. It can optionally also create a bounce buffer: > + > + i2c_check_msg_for_dma(msg, threshold, _buf); > + > +The bounce buffer handling from the core is generic and simple. It will > always > +allocate a new bounce buffer. If you want a more sophisticated handling (e.g. > +reusing pre-allocated buffers), you can leave the pointer to the bounce > buffer > +empty and implement your own handling based on the return value of the above > +function. > + > +The other helper function releases the bounce buffer. It ensures data is > copied > +back to the message: > + > + i2c_release_dma_bounce_buf(msg, bounce_buf); > + > +Please check the in-kernel documentation for details. The i2c-sh_mobile > driver > +can be used as a reference example. > + > +If you plan to use DMA with I2C (or with any other bus, actually) make sure > you > +have CONFIG_DMA_API_DEBUG enabled during development. It can help you find > +various issues which can be complex to debug otherwise.
Re: [PATCH v3 1/4] i2c: add helpers to ease DMA handling
On Tue, 18 Jul 2017 12:23:36 +0200 Wolfram Sangwrote: > One helper checks if DMA is suitable and optionally creates a bounce > buffer, if not. The other function returns the bounce buffer and makes > sure the data is properly copied back to the message. > > Signed-off-by: Wolfram Sang My knowledge of the exact requirements for dma on all platforms isn't all that good. Mostly it's based around the assumption that if one forces a heap allocation and makes sure nothing else is in the cacheline all is good. I like the basic idea of this patch set a lot btw! Jonathan > --- > Changes since v2: > > * rebased to v4.13-rc1 > * helper functions are not inlined anymore but moved to i2c core > * __must_check has been added to the buffer check helper > * the release function has been renamed to contain 'dma' as well > > drivers/i2c/i2c-core-base.c | 68 > + > include/linux/i2c.h | 5 > 2 files changed, 73 insertions(+) > > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c > index c89dac7fd2e7b7..7326a9d2e4eb69 100644 > --- a/drivers/i2c/i2c-core-base.c > +++ b/drivers/i2c/i2c-core-base.c > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -44,6 +45,7 @@ > #include > #include > #include > +#include > #include > > #include "i2c-core.h" > @@ -2240,6 +2242,72 @@ void i2c_put_adapter(struct i2c_adapter *adap) > } > EXPORT_SYMBOL(i2c_put_adapter); > > +/** > + * i2c_check_msg_for_dma() - check if a message is suitable for DMA > + * @msg: the message to be checked > + * @threshold: the amount of byte from which using DMA makes sense > + * @ptr_for_bounce_buf: if not NULL, a bounce buffer will be attached to this > + * ptr, if needed. The bounce buffer must be freed by the > + * caller using i2c_release_dma_bounce_buf(). > + * > + * Return: -ERANGE if message is smaller than threshold > + * -EFAULT if message buffer is not DMA capable and no bounce buffer > + * was requested > + * -ENOMEM if a bounce buffer could not be created > + * 0 if message is suitable for DMA > + * > + * The return value must be checked. > + * > + * Note: This function should only be called from process context! It uses > + * helper functions which work on the 'current' task. > + */ > +int i2c_check_msg_for_dma(struct i2c_msg *msg, unsigned int threshold, > + u8 **ptr_for_bounce_buf) > +{ > + if (ptr_for_bounce_buf) > + *ptr_for_bounce_buf = NULL; > + > + if (msg->len < threshold) > + return -ERANGE; > + > + if (!virt_addr_valid(msg->buf) || object_is_on_stack(msg->buf)) { > + pr_debug("msg buffer to 0x%04x is not DMA safe%s\n", msg->addr, > + ptr_for_bounce_buf ? ", trying bounce buffer" : ""); > + if (ptr_for_bounce_buf) { > + if (msg->flags & I2C_M_RD) > + *ptr_for_bounce_buf = kzalloc(msg->len, > GFP_KERNEL); > + else > + *ptr_for_bounce_buf = kmemdup(msg->buf, > msg->len, > + GFP_KERNEL); > + if (!*ptr_for_bounce_buf) > + return -ENOMEM; > + } else { > + return -EFAULT; > + } > + } I'm trying to get my head around whether this is a sufficient set of conditions for a dma safe buffer and I'm not sure it is. We go to a lot of effort with SPI buffers to ensure they are in their own cache lines. Do we not need to do the same here? The issue would be the classic case of embedding a buffer inside a larger structure which is on the stack. Need the magic of __cacheline_aligned to force it into it's own line for devices with dma-incoherent caches. DMA-API-HOWTO.txt (not read that for a while at it is a rather good at describing this stuff these days!) So that one is easy enough to check by checking if it is cache line aligned, but what do you do to know there is nothing much after it? Not sure there is a way around this short of auditing i2c drivers to change any that do this. > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(i2c_check_msg_for_dma); > + > +/** > + * i2c_release_bounce_buf - copy data back from bounce buffer and release it > + * @msg: the message to be copied back to > + * @bounce_buf: the bounce buffer obtained from i2c_check_msg_for_dma(). > + * May be NULL. > + */ > +void i2c_release_dma_bounce_buf(struct i2c_msg *msg, u8 *bounce_buf) > +{ > + if (!bounce_buf) > + return; > + > + if (msg->flags & I2C_M_RD) > + memcpy(msg->buf, bounce_buf, msg->len); > + > + kfree(bounce_buf); > +} > +EXPORT_SYMBOL_GPL(i2c_release_bounce_buf); > +
Re: [PATCH] [media] ddbridge: constify i2c_algorithm structure
Am Mon, 10 Jul 2017 17:12:27 +0200 schrieb Daniel Scheller: > From: Daniel Scheller > > Original patch and issue identified by Gustavo A. R. Silva > via [1] using Coccinelle. While at it, even > mark the struct static again since it isn't referenced anywhere else. > > [1] http://www.spinics.net/lists/linux-media/msg118221.html > > Cc: Gustavo A. R. Silva > Signed-off-by: Daniel Scheller > --- > drivers/media/pci/ddbridge/ddbridge-i2c.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/pci/ddbridge/ddbridge-i2c.c > b/drivers/media/pci/ddbridge/ddbridge-i2c.c index > 22b2543da4ca..3d0aefe05cec 100644 --- > a/drivers/media/pci/ddbridge/ddbridge-i2c.c +++ > b/drivers/media/pci/ddbridge/ddbridge-i2c.c @@ -212,7 +212,7 @@ > static u32 ddb_i2c_functionality(struct i2c_adapter *adap) return > I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; } > > -struct i2c_algorithm ddb_i2c_algo = { > +static const struct i2c_algorithm ddb_i2c_algo = { > .master_xfer = ddb_i2c_master_xfer, > .functionality = ddb_i2c_functionality, > }; This one can be marked "Obsolete" in patchwork. Original ddbridge patches have since been rebased (will re-send soonish), with this change included. Best regards, Daniel Scheller -- https://github.com/herrnst
[PATCH 3/7] [media] dvb-frontends/stv0910: further coding style cleanup
From: Daniel SchellerFixes up all remainders reported by "checkpatch.pl --strict" Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv0910.c | 93 +-- drivers/media/dvb-frontends/stv0910.h | 4 +- 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index bbe609143497..8dc767a118a0 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -71,7 +71,7 @@ static inline u32 muldiv32(u32 a, u32 b, u32 c) tmp64 = (u64)a * (u64)b; do_div(tmp64, c); - return (u32) tmp64; + return (u32)tmp64; } struct stv_base { @@ -79,8 +79,8 @@ struct stv_base { u8 adr; struct i2c_adapter *i2c; - struct mutex i2c_lock; - struct mutex reg_lock; + struct mutex i2c_lock; /* shared I2C access protect */ + struct mutex reg_lock; /* shared register write protect */ int count; u32 extclk; @@ -146,8 +146,8 @@ static inline int i2c_write(struct i2c_adapter *adap, u8 adr, if (i2c_transfer(adap, , 1) != 1) { dev_warn(>dev, "i2c write error ([%02x] %04x: %02x)\n", - adr, (data[0] << 8) | data[1], - (len > 2 ? data[2] : 0)); +adr, (data[0] << 8) | data[1], +(len > 2 ? data[2] : 0)); return -EREMOTEIO; } return 0; @@ -166,7 +166,7 @@ static int write_reg(struct stv *state, u16 reg, u8 val) } static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr, -u16 reg, u8 *val, int count) + u16 reg, u8 *val, int count) { u8 msg[2] = {reg >> 8, reg & 0xff}; struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, @@ -176,7 +176,7 @@ static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr, if (i2c_transfer(adapter, msgs, 2) != 2) { dev_warn(>dev, "i2c read error ([%02x] %04x)\n", - adr, reg); +adr, reg); return -EREMOTEIO; } return 0; @@ -185,7 +185,7 @@ static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr, static int read_reg(struct stv *state, u16 reg, u8 *val) { return i2c_read_regs16(state->base->i2c, state->base->adr, - reg, val, 1); + reg, val, 1); } static int read_regs(struct stv *state, u16 reg, u8 *val, int len) @@ -473,16 +473,16 @@ static int get_cur_symbol_rate(struct stv *state, u32 *p_symbol_rate) read_reg(state, RSTV0910_P2_TMGREG1 + state->regoff, _offs1); read_reg(state, RSTV0910_P2_TMGREG0 + state->regoff, _offs0); - symbol_rate = ((u32) symb_freq3 << 24) | ((u32) symb_freq2 << 16) | - ((u32) symb_freq1 << 8) | (u32) symb_freq0; - timing_offset = ((u32) tim_offs2 << 16) | ((u32) tim_offs1 << 8) | - (u32) tim_offs0; + symbol_rate = ((u32)symb_freq3 << 24) | ((u32)symb_freq2 << 16) | + ((u32)symb_freq1 << 8) | (u32)symb_freq0; + timing_offset = ((u32)tim_offs2 << 16) | ((u32)tim_offs1 << 8) | + (u32)tim_offs0; - if ((timing_offset & (1<<23)) != 0) + if ((timing_offset & (1 << 23)) != 0) timing_offset |= 0xFF00; /* Sign extent */ - symbol_rate = (u32) (((u64) symbol_rate * state->base->mclk) >> 32); - timing_offset = (s32) (((s64) symbol_rate * (s64) timing_offset) >> 29); + symbol_rate = (u32)(((u64)symbol_rate * state->base->mclk) >> 32); + timing_offset = (s32)(((s64)symbol_rate * (s64)timing_offset) >> 29); *p_symbol_rate = symbol_rate + timing_offset; @@ -498,9 +498,9 @@ static int get_signal_parameters(struct stv *state) if (state->receive_mode == RCVMODE_DVBS2) { read_reg(state, RSTV0910_P2_DMDMODCOD + state->regoff, ); - state->mod_cod = (enum fe_stv0910_mod_cod) ((tmp & 0x7c) >> 2); + state->mod_cod = (enum fe_stv0910_mod_cod)((tmp & 0x7c) >> 2); state->pilots = (tmp & 0x01) != 0; - state->fectype = (enum dvbs2_fectype) ((tmp & 0x02) >> 1); + state->fectype = (enum dvbs2_fectype)((tmp & 0x02) >> 1); } else if (state->receive_mode == RCVMODE_DVBS) { read_reg(state, RSTV0910_P2_VITCURPUN + state->regoff, ); @@ -586,7 +586,7 @@ static int tracking_optimization(struct stv *state) } static s32 table_lookup(struct slookup *table, - int table_size, u32 reg_value) + int table_size, u32 reg_value) { s32 value; int imin = 0; @@ -595,15 +595,15 @@ static s32
[PATCH 6/7] [media] dvb-frontends/stv6111: cosmetics: comments fixup, misc
From: Daniel SchellerSigned-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv6111.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/media/dvb-frontends/stv6111.c b/drivers/media/dvb-frontends/stv6111.c index 91e24ba44c30..c4db5e6c18af 100644 --- a/drivers/media/dvb-frontends/stv6111.c +++ b/drivers/media/dvb-frontends/stv6111.c @@ -42,7 +42,7 @@ struct slookup { }; static struct slookup lnagain_nf_lookup[] = { - /*Gain *100dB*/ /*Reg*/ + /* Gain *100dB // Reg */ { 2572, 0 }, { 2575, 1 }, { 2580, 2 }, @@ -78,7 +78,7 @@ static struct slookup lnagain_nf_lookup[] = { }; static struct slookup lnagain_iip3_lookup[] = { - /*Gain *100dB*/ /*reg*/ + /* Gain *100dB // reg */ { 1548, 0 }, { 1552, 1 }, { 1569, 2 }, @@ -114,7 +114,7 @@ static struct slookup lnagain_iip3_lookup[] = { }; static struct slookup gain_rfagc_lookup[] = { - /*Gain *100dB*/ /*reg*/ + /* Gain *100dB // reg */ { 4870, 0x3000 }, { 4850, 0x3C00 }, { 4800, 0x4500 }, @@ -174,7 +174,7 @@ static struct slookup gain_rfagc_lookup[] = { * a different BB_MAG setting) */ static struct slookup gain_channel_agc_nf_lookup[] = { - /*Gain *100dB*/ /*reg*/ + /* Gain *100dB // reg */ { 7082, 0x3000 }, { 7052, 0x4000 }, { 7007, 0x4600 }, @@ -233,7 +233,7 @@ static struct slookup gain_channel_agc_nf_lookup[] = { }; static struct slookup gain_channel_agc_iip3_lookup[] = { - /*Gain *100dB*/ /*reg*/ + /* Gain *100dB // reg */ { 7070, 0x3000 }, { 7028, 0x4000 }, { 7019, 0x4600 }, @@ -483,7 +483,7 @@ static int set_lof(struct stv *state, u32 local_frequency, u32 cutoff_frequency) else icp = 7; - state->reg[0x02] |= 0x80; /* LNA IIP3 Mode */ + state->reg[0x02] |= 0x80; /* LNA IIP3 Mode */ state->reg[0x03] = (state->reg[0x03] & ~0x80) | (psel << 7); state->reg[0x04] = (div & 0xFF); @@ -503,7 +503,7 @@ static int set_lof(struct stv *state, u32 local_frequency, u32 cutoff_frequency) read_reg(state, 0x03, ); if (tmp & 0x10) { - state->reg[0x02] &= ~0x80; /* LNA NF Mode */ + state->reg[0x02] &= ~0x80; /* LNA NF Mode */ write_regs(state, 2, 1); } read_reg(state, 0x08, ); @@ -636,15 +636,15 @@ static int get_rf_strength(struct dvb_frontend *fe, u16 *st) static struct dvb_tuner_ops tuner_ops = { .info = { - .name = "STV6111", - .frequency_min = 95, - .frequency_max = 215, - .frequency_step = 0 + .name = "STV6111", + .frequency_min = 95, + .frequency_max = 215, + .frequency_step = 0 }, - .set_params= set_params, - .release = release, - .get_rf_strength = get_rf_strength, - .set_bandwidth = set_bandwidth, + .set_params = set_params, + .release= release, + .get_rf_strength= get_rf_strength, + .set_bandwidth = set_bandwidth, }; struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe, -- 2.13.0
[PATCH 5/7] [media] dvb-frontends/stv6111: coding style cleanup
From: Daniel SchellerFix up all remainders reported by checkpatch-strict. Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv6111.c | 38 --- drivers/media/dvb-frontends/stv6111.h | 7 --- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/drivers/media/dvb-frontends/stv6111.c b/drivers/media/dvb-frontends/stv6111.c index ce5b5ff936d5..91e24ba44c30 100644 --- a/drivers/media/dvb-frontends/stv6111.c +++ b/drivers/media/dvb-frontends/stv6111.c @@ -298,7 +298,7 @@ static inline u32 muldiv32(u32 a, u32 b, u32 c) tmp64 = (u64)a * (u64)b; do_div(tmp64, c); - return (u32) tmp64; + return (u32)tmp64; } static int i2c_read(struct i2c_adapter *adap, @@ -429,10 +429,10 @@ static int set_bandwidth(struct dvb_frontend *fe, u32 cutoff_frequency) index = 6; if (index > 50) index = 50; - if ((state->reg[0x08] & ~0xFC) == ((index-6) << 2)) + if ((state->reg[0x08] & ~0xFC) == ((index - 6) << 2)) return 0; - state->reg[0x08] = (state->reg[0x08] & ~0xFC) | ((index-6) << 2); + state->reg[0x08] = (state->reg[0x08] & ~0xFC) | ((index - 6) << 2); state->reg[0x09] = (state->reg[0x09] & ~0x0C) | 0x08; if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); @@ -542,12 +542,12 @@ static s32 table_lookup(struct slookup *table, int table_size, u16 reg_value) int i; /* Assumes Table[0].RegValue < Table[imax].RegValue */ - if (reg_value <= table[0].reg_value) + if (reg_value <= table[0].reg_value) { gain = table[0].value; - else if (reg_value >= table[imax].reg_value) + } else if (reg_value >= table[imax].reg_value) { gain = table[imax].value; - else { - while (imax-imin > 1) { + } else { + while ((imax - imin) > 1) { i = (imax + imin) / 2; if ((table[imin].reg_value <= reg_value) && (reg_value <= table[i].reg_value)) @@ -558,9 +558,9 @@ static s32 table_lookup(struct slookup *table, int table_size, u16 reg_value) reg_diff = table[imax].reg_value - table[imin].reg_value; gain = table[imin].value; if (reg_diff != 0) - gain += ((s32) (reg_value - table[imin].reg_value) * + gain += ((s32)(reg_value - table[imin].reg_value) * (s32)(table[imax].value - - table[imin].value))/(reg_diff); + - table[imin].value)) / reg_diff; } return gain; } @@ -587,27 +587,33 @@ static int get_rf_strength(struct dvb_frontend *fe, u16 *st) if ((state->reg[0x02] & 0x80) == 0) /* NF */ gain = table_lookup(lnagain_nf_lookup, - ARRAY_SIZE(lnagain_nf_lookup), reg & 0x1F); + ARRAY_SIZE(lnagain_nf_lookup), + reg & 0x1F); else /* IIP3 */ gain = table_lookup(lnagain_iip3_lookup, - ARRAY_SIZE(lnagain_iip3_lookup), reg & 0x1F); + ARRAY_SIZE(lnagain_iip3_lookup), + reg & 0x1F); gain += table_lookup(gain_rfagc_lookup, - ARRAY_SIZE(gain_rfagc_lookup), rfagc); +ARRAY_SIZE(gain_rfagc_lookup), rfagc); + gain -= 2400; } else { /* Channel Mode */ if ((state->reg[0x02] & 0x80) == 0) { /* NF */ - gain = table_lookup(gain_channel_agc_nf_lookup, + gain = table_lookup( + gain_channel_agc_nf_lookup, ARRAY_SIZE(gain_channel_agc_nf_lookup), rfagc); + gain += 600; } else { /* IIP3 */ - gain = table_lookup(gain_channel_agc_iip3_lookup, + gain = table_lookup( + gain_channel_agc_iip3_lookup, ARRAY_SIZE(gain_channel_agc_iip3_lookup), - rfagc); + rfagc); } } @@ -647,7 +653,7 @@ struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe, struct stv *state; int stat; - state = kzalloc(sizeof(struct stv), GFP_KERNEL); + state = kzalloc(sizeof(*state), GFP_KERNEL); if (!state) return NULL; state->adr = adr; diff --git
[PATCH 7/7] [media] dvb-frontends/stv{0910,6111}: constify tables
From: Daniel SchellerMark lookup tables and fe_ops things const so the compiler can put them into .rodata. While at it, improve name and identifier strings (moddesc, fe_ops). Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv0910.c | 24 drivers/media/dvb-frontends/stv6111.c | 19 ++- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index e2162fa8cad6..a2648dd91a57 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -207,7 +207,7 @@ static int write_shared_reg(struct stv *state, u16 reg, u8 mask, u8 val) return status; } -static struct slookup s1_sn_lookup[] = { +static const struct slookup s1_sn_lookup[] = { { 0,9242 }, /* C/N= 0dB */ { 5,9105 }, /* C/N= 0.5dB */ { 10,8950 }, /* C/N= 1.0dB */ @@ -264,7 +264,7 @@ static struct slookup s1_sn_lookup[] = { { 510,425 } /* C/N=51.0dB */ }; -static struct slookup s2_sn_lookup[] = { +static const struct slookup s2_sn_lookup[] = { { -30, 13950 }, /* C/N=-2.5dB */ { -25, 13580 }, /* C/N=-2.5dB */ { -20, 13150 }, /* C/N=-2.0dB */ @@ -327,7 +327,7 @@ static struct slookup s2_sn_lookup[] = { { 510,463 }, /* C/N=51.0dB */ }; -static struct slookup padc_lookup[] = { +static const struct slookup padc_lookup[] = { {0, 118000 }, /* PADC= +0dBm */ { -100, 93600 }, /* PADC= -1dBm */ { -200, 74500 }, /* PADC= -2dBm */ @@ -349,7 +349,7 @@ static struct slookup padc_lookup[] = { /* * Tracking carrier loop carrier QPSK 1/4 to 8PSK 9/10 long Frame */ -static u8 s2car_loop[] = { +static const u8 s2car_loop[] = { /* * Modcod 2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff * 20MPon 20MPoff 30MPon 30MPoff @@ -587,7 +587,7 @@ static int tracking_optimization(struct stv *state) return 0; } -static s32 table_lookup(struct slookup *table, +static s32 table_lookup(const struct slookup *table, int table_size, u32 reg_value) { s32 value; @@ -629,7 +629,7 @@ static int get_signal_to_noise(struct stv *state, s32 *signal_to_noise) u8 data1; u16 data; int n_lookup; - struct slookup *lookup; + const struct slookup *lookup; *signal_to_noise = 0; @@ -693,7 +693,7 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator, static u32 dvbs2_nbch(enum dvbs2_mod_cod mod_cod, enum dvbs2_fectype fectype) { - static u32 nbch[][2] = { + static const u32 nbch[][2] = { {0, 0}, /* DUMMY_PLF */ {16200, 3240}, /* QPSK_1_4, */ {21600, 5400}, /* QPSK_1_3, */ @@ -953,7 +953,7 @@ static int set_vth_default(struct stv *state) static int set_vth(struct stv *state) { - static struct slookup vthlookup_table[] = { + static const struct slookup vthlookup_table[] = { {250, 8780}, /* C/N= 1.5dB */ {100, 7405}, /* C/N= 4.5dB */ {40,6330}, /* C/N= 6.5dB */ @@ -1515,7 +1515,7 @@ static int get_frontend(struct dvb_frontend *fe, if (state->receive_mode == RCVMODE_DVBS2) { u32 mc; - enum fe_modulation modcod2mod[0x20] = { + const enum fe_modulation modcod2mod[0x20] = { QPSK, QPSK, QPSK, QPSK, QPSK, QPSK, QPSK, QPSK, QPSK, QPSK, QPSK, QPSK, @@ -1525,7 +1525,7 @@ static int get_frontend(struct dvb_frontend *fe, APSK_32, APSK_32, APSK_32, APSK_32, APSK_32, }; - enum fe_code_rate modcod2fec[0x20] = { + const enum fe_code_rate modcod2fec[0x20] = { FEC_NONE, FEC_NONE, FEC_NONE, FEC_2_5, FEC_1_2, FEC_3_5, FEC_2_3, FEC_3_4, FEC_4_5, FEC_5_6, FEC_8_9, FEC_9_10, @@ -1673,10 +1673,10 @@ static int sleep(struct dvb_frontend *fe) return 0; } -static struct dvb_frontend_ops stv0910_ops = { +static const struct dvb_frontend_ops stv0910_ops = { .delsys = { SYS_DVBS, SYS_DVBS2, SYS_DSS }, .info = { - .name = "STV0910", + .name = "ST STV0910", .frequency_min = 95, .frequency_max = 215, .frequency_stepsize = 0, diff --git a/drivers/media/dvb-frontends/stv6111.c b/drivers/media/dvb-frontends/stv6111.c index c4db5e6c18af..9a59fa318207 100644 ---
[PATCH 2/7] [media] dvb-frontends/stv0910: implement diseqc_send_burst
From: Daniel SchellerThis implements the diseqc_send_burst frontend op to support sending mini-DISEQC bursts. Picked up from dddvb's driver package where this specific block was disabled via #if 0/#endif, but is still working according to feedback from upstream, so add it. Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv0910.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 4084c142f1e4..bbe609143497 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -1638,6 +1638,27 @@ static int send_master_cmd(struct dvb_frontend *fe, return 0; } +static int send_burst(struct dvb_frontend *fe, enum fe_sec_mini_cmd burst) +{ + struct stv *state = fe->demodulator_priv; + u16 offs = state->nr ? 0x40 : 0; + u8 value; + + if (burst == SEC_MINI_A) { + write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3F); + value = 0x00; + } else { + write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3E); + value = 0xFF; + } + wait_dis(state, 0x40, 0x00); + write_reg(state, RSTV0910_P1_DISTXFIFO + offs, value); + write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3A); + wait_dis(state, 0x20, 0x20); + + return 0; +} + static int sleep(struct dvb_frontend *fe) { struct stv *state = fe->demodulator_priv; @@ -1673,6 +1694,7 @@ static struct dvb_frontend_ops stv0910_ops = { .set_tone = set_tone, .diseqc_send_master_cmd = send_master_cmd, + .diseqc_send_burst = send_burst, }; static struct stv_base *match_base(struct i2c_adapter *i2c, u8 adr) -- 2.13.0
[PATCH 1/7] [media] dvb-frontends/stv0910: fix STR assignment, remove unneeded var
From: Daniel SchellerAccording to the documentation, FE_SCALE_DECIBEL values should be assigned to .svalue and not .uvalue, so let's do this. While at it, remove the unneeded strength var from read_signal_strength(). Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv0910.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index bae1da3fdb2d..4084c142f1e4 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -1321,7 +1321,6 @@ static void read_signal_strength(struct dvb_frontend *fe) { struct stv *state = fe->demodulator_priv; struct dtv_frontend_properties *p = >fe.dtv_property_cache; - s64 strength; u8 reg[2]; u16 agc; s32 padc, power = 0; @@ -1341,10 +1340,8 @@ static void read_signal_strength(struct dvb_frontend *fe) padc = table_lookup(padc_lookup, ARRAY_SIZE(padc_lookup), power) + 352; - strength = (padc - agc); - p->strength.stat[0].scale = FE_SCALE_DECIBEL; - p->strength.stat[0].uvalue = strength; + p->strength.stat[0].svalue = (padc - agc); } static int read_status(struct dvb_frontend *fe, enum fe_status *status) -- 2.13.0
[PATCH 0/7] stv0910/stv6111 updates
From: Daniel SchellerSeveral, mostly cosmetic updates and fixes to these two new drivers, and one additional functionality: - Make both drivers 99% checkpatch-strict clean. stv0910_regs.h still has "CHECK: 'VALIDE' may be misspelled - perhaps 'VALID'?", which is left as-is intentionally (unclear if this really is a typo, or wanted or documented in vendor specs) - Fixup comments (block comment format, c++-style comments, whitespace etc) - Const'ify all tables - Better identifier strings - Signal strength assignment fixed and unneeded var removed (uvalue vs svalue) - Support/Implement the disecq_send_burst fe_op Based on https://patchwork.linuxtv.org/patch/42702/ and thus requires that one to be merged beforehand, else this series conflicts in patch 4/7. Build and runtime tested. Daniel Scheller (7): [media] dvb-frontends/stv0910: fix STR assignment, remove unneeded var [media] dvb-frontends/stv0910: implement diseqc_send_burst [media] dvb-frontends/stv0910: further coding style cleanup [media] dvb-frontends/stv0910: cosmetics: fixup comments, misc [media] dvb-frontends/stv6111: coding style cleanup [media] dvb-frontends/stv6111: cosmetics: comments fixup, misc [media] dvb-frontends/stv{0910,6111}: constify tables drivers/media/dvb-frontends/stv0910.c | 543 drivers/media/dvb-frontends/stv0910.h |4 +- drivers/media/dvb-frontends/stv0910_regs.h | 1953 ++-- drivers/media/dvb-frontends/stv6111.c | 85 +- drivers/media/dvb-frontends/stv6111.h |7 +- 5 files changed, 1313 insertions(+), 1279 deletions(-) -- 2.13.0
[PATCH] Add compat code for skb_put_data
Signed-off-by: Matthias Schwarzott--- v4l/compat.h | 12 v4l/scripts/make_config_compat.pl | 1 + 2 files changed, 13 insertions(+) diff --git a/v4l/compat.h b/v4l/compat.h index 47e2694..e565292 100644 --- a/v4l/compat.h +++ b/v4l/compat.h @@ -2072,4 +2072,16 @@ static inline bool is_of_node(struct fwnode_handle *fwnode) } #endif +#ifdef NEED_SKB_PUT_DATA +static inline void *skb_put_data(struct sk_buff *skb, const void *data, + unsigned int len) +{ +void *tmp = skb_put(skb, len); + +memcpy(tmp, data, len); + +return tmp; +} +#endif + #endif /* _COMPAT_H */ diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl index d186cb4..5ac59ab 100644 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -699,6 +699,7 @@ sub check_other_dependencies() check_files_for_func("of_fwnode_handle", "NEED_FWNODE", "include/linux/of.h"); check_files_for_func("to_of_node", "NEED_TO_OF_NODE", "include/linux/of.h"); check_files_for_func("is_of_node", "NEED_IS_OF_NODE", "include/linux/of.h"); + check_files_for_func("skb_put_data", "NEED_SKB_PUT_DATA", "include/linux/skbuff.h"); # For tests for uapi-dependent logic check_files_for_func_uapi("usb_endpoint_maxp", "NEED_USB_ENDPOINT_MAXP", "usb/ch9.h"); -- 2.13.3
Re: [RFC 08/19] arm: dts: omap3: N9/N950: Add AS3645A camera flash
On Tue 2017-07-18 22:03:50, Sakari Ailus wrote: > From: Sakari Ailus> > Add the as3645a flash controller to the DT source as well as the flash > property with the as3645a device phandle to the sensor DT node. > > Signed-off-by: Sakari Ailus > Reviewed-by: Sebastian Reichel Acked-by: Pavel Machek