Re: [PATCH v2 3/3] dt-bindings: Add Renesas R-Car FDP1 bindings
On Thu, Jun 30, 2016 at 05:50:30PM +0100, Kieran Bingham wrote: > The FDP1 is a de-interlacing module which converts interlaced video to > progressive video. It is also capable of performing pixel format conversion > between YCbCr/YUV formats and RGB formats. > > Reviewed-by: Laurent Pinchart> Signed-off-by: Kieran Bingham > --- > Changes since v1: > - title fixed > - Interrupts property documented > - version specific compatibles removed as we have a hw version register > - label removed from device node example >* (fdp1 is not referenced by other nodes) > > .../devicetree/bindings/media/renesas,fdp1.txt | 33 > ++ > 1 file changed, 33 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/renesas,fdp1.txt Acked-by: Rob Herring -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/3] dt-bindings: Document Renesas R-Car FCP power-domains usage
On Thu, Jun 30, 2016 at 05:50:29PM +0100, Kieran Bingham wrote: > The power domain must be specified to bring the device out of module > standby. Document this in the bindings provided, so that new additions > are not missed. > > Signed-off-by: Kieran Bingham> --- > Documentation/devicetree/bindings/media/renesas,fcp.txt | 5 + > 1 file changed, 5 insertions(+) Acked-by: Rob Herring -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
cron job: media_tree daily build: 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: Fri Jul 1 04:00:27 CEST 2016 git branch: test git hash: d81295d1bed850335f9f4ccb6b1aa4f6a123d4f0 gcc version:i686-linux-gcc (GCC) 5.3.0 sparse version: v0.5.0-56-g7647c77 smatch version: v0.5.0-3428-gdfe27cf host hardware: x86_64 host os:4.6.0-164 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-exynos: OK linux-git-arm-mtk: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-pxa: 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: OK linux-2.6.37.6-i686: OK linux-2.6.38.8-i686: OK linux-2.6.39.4-i686: OK linux-3.0.60-i686: OK linux-3.1.10-i686: OK linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: OK linux-3.5.7-i686: OK linux-3.6.11-i686: 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.23-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-i686: ERRORS linux-4.1.1-i686: ERRORS linux-4.2-i686: ERRORS linux-4.3-i686: ERRORS linux-4.4-i686: OK linux-4.5-i686: OK linux-4.6-i686: OK linux-4.7-rc1-i686: OK linux-2.6.36.4-x86_64: OK linux-2.6.37.6-x86_64: OK linux-2.6.38.8-x86_64: OK linux-2.6.39.4-x86_64: OK linux-3.0.60-x86_64: OK linux-3.1.10-x86_64: OK linux-3.2.37-x86_64: OK linux-3.3.8-x86_64: OK linux-3.4.27-x86_64: OK linux-3.5.7-x86_64: OK linux-3.6.11-x86_64: 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.23-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-x86_64: ERRORS linux-4.1.1-x86_64: ERRORS linux-4.2-x86_64: ERRORS linux-4.3-x86_64: ERRORS linux-4.4-x86_64: OK linux-4.5-x86_64: OK linux-4.6-x86_64: OK linux-4.7-rc1-x86_64: OK apps: OK spec-git: OK sparse: WARNINGS smatch: WARNINGS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Friday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Friday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [media][cxd2841er] fix compilation warning
function cxd2841er_init_stats should return int value Signed-off-by: Abylay Ospan--- drivers/media/dvb-frontends/cxd2841er.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 8705b0a..22c6836 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -3422,6 +3422,7 @@ static int cxd2841er_init_stats(struct dvb_frontend *fe) p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->post_bit_error.len = 1; p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + return 0; } -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [media][cxd2841er] DVB-C read signal strength added for Sony demod
cxd2841er_read_agc_gain_c added to obtain signal strength. signal strength now relay on AGC value. Signed-off-by: Abylay Ospan--- drivers/media/dvb-frontends/cxd2841er.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index ef6421c..8705b0a 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -1656,6 +1656,21 @@ static int cxd2841er_read_snr_i(struct cxd2841er_priv *priv, u32 *snr) return 0; } +static u16 cxd2841er_read_agc_gain_c(struct cxd2841er_priv *priv, + u8 delsys) +{ + u8 data[2]; + + cxd2841er_write_reg( + priv, I2C_SLVT, 0x00, 0x40); + cxd2841er_read_regs(priv, I2C_SLVT, 0x49, data, 2); + dev_dbg(>i2c->dev, + "%s(): AGC value=%u\n", + __func__, (((u16)data[0] & 0x0F) << 8) | + (u16)(data[1] & 0xFF)); + return u16)data[0] & 0x0F) << 8) | (u16)(data[1] & 0xFF)) << 4; +} + static u16 cxd2841er_read_agc_gain_t_t2(struct cxd2841er_priv *priv, u8 delsys) { @@ -1735,6 +1750,14 @@ static void cxd2841er_read_signal_strength(struct dvb_frontend *fe) dev_dbg(>i2c->dev, "%s()\n", __func__); switch (p->delivery_system) { + case SYS_DVBC_ANNEX_A: + case SYS_DVBC_ANNEX_B: + case SYS_DVBC_ANNEX_C: + strength = 65535 - cxd2841er_read_agc_gain_c( + priv, p->delivery_system); + p->strength.stat[0].scale = FE_SCALE_RELATIVE; + p->strength.stat[0].uvalue = strength; + break; case SYS_DVBT: case SYS_DVBT2: strength = cxd2841er_read_agc_gain_t_t2(priv, -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] cxd2841er: Do some changes at the dvbv5 stats logic
Acked-by: Abylay Ospan2016-06-29 23:34 GMT-04:00 Mauro Carvalho Chehab : > It is a good idea to measure the signal strength while > tuning, as this helps to identify if the antenna is ok. > Also, such measure helps to identify the quality of the > signal. > > Do some changes to enable it before signal lock. While > here, optimize the code to only initialize the stats > length once, and make sure that, just after set_frontend, > any reading for the stats that depends on lock to return > FE_SCALE_NOT_AVAILABLE. > > Signed-off-by: Mauro Carvalho Chehab > --- > drivers/media/dvb-frontends/cxd2841er.c | 45 > - > 1 file changed, 33 insertions(+), 12 deletions(-) > > diff --git a/drivers/media/dvb-frontends/cxd2841er.c > b/drivers/media/dvb-frontends/cxd2841er.c > index d369a7567d18..3d39ae954fe2 100644 > --- a/drivers/media/dvb-frontends/cxd2841er.c > +++ b/drivers/media/dvb-frontends/cxd2841er.c > @@ -2936,31 +2936,25 @@ static int cxd2841er_get_frontend(struct dvb_frontend > *fe, > else if (priv->state == STATE_ACTIVE_TC) > cxd2841er_read_status_tc(fe, ); > > + cxd2841er_read_signal_strength(fe, ); > + p->strength.stat[0].scale = FE_SCALE_RELATIVE; > + p->strength.stat[0].uvalue = strength; > + > if (status & FE_HAS_LOCK) { > - cxd2841er_read_signal_strength(fe, ); > - p->strength.len = 1; > - p->strength.stat[0].scale = FE_SCALE_RELATIVE; > - p->strength.stat[0].uvalue = strength; > cxd2841er_read_snr(fe, ); > - p->cnr.len = 1; > p->cnr.stat[0].scale = FE_SCALE_DECIBEL; > p->cnr.stat[0].svalue = snr; > + > cxd2841er_read_ucblocks(fe, ); > - p->block_error.len = 1; > p->block_error.stat[0].scale = FE_SCALE_COUNTER; > p->block_error.stat[0].uvalue = errors; > + > cxd2841er_read_ber(fe, ); > - p->post_bit_error.len = 1; > p->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; > p->post_bit_error.stat[0].uvalue = ber; > } else { > - p->strength.len = 1; > - p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > - p->cnr.len = 1; > p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > - p->block_error.len = 1; > p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > - p->post_bit_error.len = 1; > p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > } > return 0; > @@ -3021,6 +3015,12 @@ static int cxd2841er_set_frontend_s(struct > dvb_frontend *fe) > __func__, carr_offset); > } > done: > + /* Reset stats */ > + p->strength.stat[0].scale = FE_SCALE_RELATIVE; > + p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > + p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > + p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > + > return ret; > } > > @@ -3382,6 +3382,21 @@ static enum dvbfe_algo cxd2841er_get_algo(struct > dvb_frontend *fe) > return DVBFE_ALGO_HW; > } > > +static int cxd2841er_init_stats(struct dvb_frontend *fe) > +{ > + struct dtv_frontend_properties *p = >dtv_property_cache; > + > + p->strength.len = 1; > + p->strength.stat[0].scale = FE_SCALE_RELATIVE; > + p->cnr.len = 1; > + p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > + p->block_error.len = 1; > + p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > + p->post_bit_error.len = 1; > + p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; > +} > + > + > static int cxd2841er_init_s(struct dvb_frontend *fe) > { > struct cxd2841er_priv *priv = fe->demodulator_priv; > @@ -3403,6 +3418,9 @@ static int cxd2841er_init_s(struct dvb_frontend *fe) > /* SONY_DEMOD_CONFIG_SAT_IFAGCNEG set to 1 */ > cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); > cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xb9, 0x01, 0x01); > + > + cxd2841er_init_stats(fe); > + > return 0; > } > > @@ -3422,6 +3440,9 @@ static int cxd2841er_init_tc(struct dvb_frontend *fe) > /* SONY_DEMOD_CONFIG_PARALLEL_SEL = 1 */ > cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); > cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc4, 0x00, 0x80); > + > + cxd2841er_init_stats(fe); > + > return 0; > } > > -- > 2.7.4 > -- Abylay Ospan, NetUP Inc. http://www.netup.tv -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] cxd2841er: Fix signal strengh for DVB-T/T2 and show it in dBm
Hi Mauro, thanks for update. I have tested now yours two patches and it works. dvbv5-zap shows correlated values depends on attenuation on my modulator. Here is some values i have observed for DVB-T 473Mhz QAM64 8Mhz: dvbv5-zap, Signal= dBm modulator (teleview TVB590), Amplitude dBm -89.46dBmmodulator stopped (no signal) -64.30-57 -62.35-50 -51.40-40 -41.33-30 -38.60-27 Acked-by: Abylay Ospan2016-06-30 18:41 GMT-04:00 Mauro Carvalho Chehab : > The signal strength value is reversed: the bigger the number, > the weaker is the signal. > > Fix the logic and present it in dBm. Please notice that the > dBm measure is actually an estimation, as the ratio is not > fully linear. It also varies with the frequency. > > Yet, the estimation should be good enough for programs like > Kaffeine to indicate when the signal is good or bad. > > Signed-off-by: Mauro Carvalho Chehab > --- > drivers/media/dvb-frontends/cxd2841er.c | 31 ++- > 1 file changed, 18 insertions(+), 13 deletions(-) > > diff --git a/drivers/media/dvb-frontends/cxd2841er.c > b/drivers/media/dvb-frontends/cxd2841er.c > index c1b77a6268d4..c960e8a725cc 100644 > --- a/drivers/media/dvb-frontends/cxd2841er.c > +++ b/drivers/media/dvb-frontends/cxd2841er.c > @@ -1727,32 +1727,39 @@ static int cxd2841er_read_ber(struct dvb_frontend > *fe, u32 *ber) > return 0; > } > > -static int cxd2841er_read_signal_strength(struct dvb_frontend *fe, > - u16 *strength) > +static void cxd2841er_read_signal_strength(struct dvb_frontend *fe) > { > struct dtv_frontend_properties *p = >dtv_property_cache; > struct cxd2841er_priv *priv = fe->demodulator_priv; > + u32 strength; > > dev_dbg(>i2c->dev, "%s()\n", __func__); > switch (p->delivery_system) { > case SYS_DVBT: > case SYS_DVBT2: > - *strength = 65535 - cxd2841er_read_agc_gain_t_t2( > - priv, p->delivery_system); > - break; > + strength = cxd2841er_read_agc_gain_t_t2(priv, > + p->delivery_system); > + p->strength.stat[0].scale = FE_SCALE_DECIBEL; > + /* Formula was empirically determinated @ 410 MHz */ > + p->strength.stat[0].uvalue = ((s32)strength) * 366 / 100 - > 89520; > + break; /* Code moved out of the function */ > case SYS_ISDBT: > - *strength = 65535 - cxd2841er_read_agc_gain_i( > + strength = 65535 - cxd2841er_read_agc_gain_i( > priv, p->delivery_system); > + p->strength.stat[0].scale = FE_SCALE_RELATIVE; > + p->strength.stat[0].uvalue = strength; > break; > case SYS_DVBS: > case SYS_DVBS2: > - *strength = 65535 - cxd2841er_read_agc_gain_s(priv); > + strength = 65535 - cxd2841er_read_agc_gain_s(priv); > + p->strength.stat[0].scale = FE_SCALE_RELATIVE; > + p->strength.stat[0].uvalue = strength; > break; > default: > - *strength = 0; > + p->strength.stat[0].scale = FE_SCALE_RELATIVE; > + p->strength.stat[0].uvalue = 0; > break; > } > - return 0; > } > > static int cxd2841er_read_snr(struct dvb_frontend *fe, u16 *snr) > @@ -2926,7 +2933,7 @@ static int cxd2841er_get_frontend(struct dvb_frontend > *fe, > struct dtv_frontend_properties *p) > { > enum fe_status status = 0; > - u16 strength = 0, snr = 0; > + u16 snr = 0; > u32 errors = 0, ber = 0; > struct cxd2841er_priv *priv = fe->demodulator_priv; > > @@ -2936,9 +2943,7 @@ static int cxd2841er_get_frontend(struct dvb_frontend > *fe, > else if (priv->state == STATE_ACTIVE_TC) > cxd2841er_read_status_tc(fe, ); > > - cxd2841er_read_signal_strength(fe, ); > - p->strength.stat[0].scale = FE_SCALE_RELATIVE; > - p->strength.stat[0].uvalue = strength; > + cxd2841er_read_signal_strength(fe); > > if (status & FE_HAS_LOCK) { > cxd2841er_read_snr(fe, ); > -- > 2.7.4 > -- Abylay Ospan, NetUP Inc. http://www.netup.tv -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/4] dt-bindings: media: meson-ir: Add Meson8b and GXBB compatible strings
On Tue, Jun 28, 2016 at 09:17:59PM +0200, Martin Blumenstingl wrote: > From: Neil Armstrong> > New bindings are needed as the register layout on the newer platforms > is slightly different compared to Meson6b. > > Signed-off-by: Neil Armstrong > Signed-off-by: Martin Blumenstingl > --- > Documentation/devicetree/bindings/media/meson-ir.txt | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) Acked-by: Rob Herring -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] cxd2841er: Fix signal strengh for DVB-T/T2 and show it in dBm
The signal strength value is reversed: the bigger the number, the weaker is the signal. Fix the logic and present it in dBm. Please notice that the dBm measure is actually an estimation, as the ratio is not fully linear. It also varies with the frequency. Yet, the estimation should be good enough for programs like Kaffeine to indicate when the signal is good or bad. Signed-off-by: Mauro Carvalho Chehab--- drivers/media/dvb-frontends/cxd2841er.c | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index c1b77a6268d4..c960e8a725cc 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -1727,32 +1727,39 @@ static int cxd2841er_read_ber(struct dvb_frontend *fe, u32 *ber) return 0; } -static int cxd2841er_read_signal_strength(struct dvb_frontend *fe, - u16 *strength) +static void cxd2841er_read_signal_strength(struct dvb_frontend *fe) { struct dtv_frontend_properties *p = >dtv_property_cache; struct cxd2841er_priv *priv = fe->demodulator_priv; + u32 strength; dev_dbg(>i2c->dev, "%s()\n", __func__); switch (p->delivery_system) { case SYS_DVBT: case SYS_DVBT2: - *strength = 65535 - cxd2841er_read_agc_gain_t_t2( - priv, p->delivery_system); - break; + strength = cxd2841er_read_agc_gain_t_t2(priv, + p->delivery_system); + p->strength.stat[0].scale = FE_SCALE_DECIBEL; + /* Formula was empirically determinated @ 410 MHz */ + p->strength.stat[0].uvalue = ((s32)strength) * 366 / 100 - 89520; + break; /* Code moved out of the function */ case SYS_ISDBT: - *strength = 65535 - cxd2841er_read_agc_gain_i( + strength = 65535 - cxd2841er_read_agc_gain_i( priv, p->delivery_system); + p->strength.stat[0].scale = FE_SCALE_RELATIVE; + p->strength.stat[0].uvalue = strength; break; case SYS_DVBS: case SYS_DVBS2: - *strength = 65535 - cxd2841er_read_agc_gain_s(priv); + strength = 65535 - cxd2841er_read_agc_gain_s(priv); + p->strength.stat[0].scale = FE_SCALE_RELATIVE; + p->strength.stat[0].uvalue = strength; break; default: - *strength = 0; + p->strength.stat[0].scale = FE_SCALE_RELATIVE; + p->strength.stat[0].uvalue = 0; break; } - return 0; } static int cxd2841er_read_snr(struct dvb_frontend *fe, u16 *snr) @@ -2926,7 +2933,7 @@ static int cxd2841er_get_frontend(struct dvb_frontend *fe, struct dtv_frontend_properties *p) { enum fe_status status = 0; - u16 strength = 0, snr = 0; + u16 snr = 0; u32 errors = 0, ber = 0; struct cxd2841er_priv *priv = fe->demodulator_priv; @@ -2936,9 +2943,7 @@ static int cxd2841er_get_frontend(struct dvb_frontend *fe, else if (priv->state == STATE_ACTIVE_TC) cxd2841er_read_status_tc(fe, ); - cxd2841er_read_signal_strength(fe, ); - p->strength.stat[0].scale = FE_SCALE_RELATIVE; - p->strength.stat[0].uvalue = strength; + cxd2841er_read_signal_strength(fe); if (status & FE_HAS_LOCK) { cxd2841er_read_snr(fe, ); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH] media: s5p-mfc - remove vidioc_g_crop
Remove vidioc_g_crop() from s5p-mfc decoder. Without its s_crop counterpart g_crop is not useful. Delete it. Signed-off-by: Shuah Khan--- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 42 1 file changed, 42 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index a01a373..ee7b189 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -766,47 +766,6 @@ static const struct v4l2_ctrl_ops s5p_mfc_dec_ctrl_ops = { .g_volatile_ctrl = s5p_mfc_dec_g_v_ctrl, }; -/* Get cropping information */ -static int vidioc_g_crop(struct file *file, void *priv, - struct v4l2_crop *cr) -{ - struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); - struct s5p_mfc_dev *dev = ctx->dev; - u32 left, right, top, bottom; - - if (ctx->state != MFCINST_HEAD_PARSED && - ctx->state != MFCINST_RUNNING && ctx->state != MFCINST_FINISHING - && ctx->state != MFCINST_FINISHED) { - mfc_err("Cannont set crop\n"); - return -EINVAL; - } - if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) { - left = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_h, ctx); - right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT; - left = left & S5P_FIMV_SHARED_CROP_LEFT_MASK; - top = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_v, ctx); - bottom = top >> S5P_FIMV_SHARED_CROP_BOTTOM_SHIFT; - top = top & S5P_FIMV_SHARED_CROP_TOP_MASK; - cr->c.left = left; - cr->c.top = top; - cr->c.width = ctx->img_width - left - right; - cr->c.height = ctx->img_height - top - bottom; - mfc_debug(2, "Cropping info [h264]: l=%d t=%d " - "w=%d h=%d (r=%d b=%d fw=%d fh=%d\n", left, top, - cr->c.width, cr->c.height, right, bottom, - ctx->buf_width, ctx->buf_height); - } else { - cr->c.left = 0; - cr->c.top = 0; - cr->c.width = ctx->img_width; - cr->c.height = ctx->img_height; - mfc_debug(2, "Cropping info: w=%d h=%d fw=%d " - "fh=%d\n", cr->c.width, cr->c.height, ctx->buf_width, - ctx->buf_height); - } - return 0; -} - static int vidioc_decoder_cmd(struct file *file, void *priv, struct v4l2_decoder_cmd *cmd) { @@ -880,7 +839,6 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = { .vidioc_expbuf = vidioc_expbuf, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, - .vidioc_g_crop = vidioc_g_crop, .vidioc_decoder_cmd = vidioc_decoder_cmd, .vidioc_subscribe_event = vidioc_subscribe_event, .vidioc_unsubscribe_event = v4l2_event_unsubscribe, -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 06/11] Input: atmel_mxt_ts - read touchscreen size
The touchscreen may have a margin where not all the matrix is used. Read the parameters from T9 and T100 and take account of the difference. Note: this does not read the XORIGIN/YORIGIN fields so it assumes that the touchscreen starts at (0,0) Signed-off-by: Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 42 +++- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index bea95a1..d09ecc3 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -103,6 +103,8 @@ struct t7_config { /* MXT_TOUCH_MULTI_T9 field */ #define MXT_T9_CTRL0 +#define MXT_T9_XSIZE 3 +#define MXT_T9_YSIZE 4 #define MXT_T9_ORIENT 9 #define MXT_T9_RANGE 18 @@ -150,7 +152,9 @@ struct t37_debug { #define MXT_T100_CTRL 0 #define MXT_T100_CFG1 1 #define MXT_T100_TCHAUX3 +#define MXT_T100_XSIZE 9 #define MXT_T100_XRANGE13 +#define MXT_T100_YSIZE 20 #define MXT_T100_YRANGE24 #define MXT_T100_CFG_SWITCHXY BIT(5) @@ -259,6 +263,8 @@ struct mxt_data { unsigned int max_x; unsigned int max_y; bool xy_switch; + u8 xsize; + u8 ysize; bool in_bootloader; u16 mem_size; u8 t100_aux_ampl; @@ -1714,6 +1720,18 @@ static int mxt_read_t9_resolution(struct mxt_data *data) return -EINVAL; error = __mxt_read_reg(client, + object->start_address + MXT_T9_XSIZE, + sizeof(data->xsize), >xsize); + if (error) + return error; + + error = __mxt_read_reg(client, + object->start_address + MXT_T9_YSIZE, + sizeof(data->ysize), >ysize); + if (error) + return error; + + error = __mxt_read_reg(client, object->start_address + MXT_T9_RANGE, sizeof(range), ); if (error) @@ -1763,6 +1781,18 @@ static int mxt_read_t100_config(struct mxt_data *data) data->max_y = get_unaligned_le16(_y); + error = __mxt_read_reg(client, + object->start_address + MXT_T100_XSIZE, + sizeof(data->xsize), >xsize); + if (error) + return error; + + error = __mxt_read_reg(client, + object->start_address + MXT_T100_YSIZE, + sizeof(data->ysize), >ysize); + if (error) + return error; + /* read orientation config */ error = __mxt_read_reg(client, object->start_address + MXT_T100_CFG1, @@ -2121,7 +2151,7 @@ static int mxt_convert_debug_pages(struct mxt_data *data, u16 *outbuf) outbuf[i] = mxt_get_debug_value(data, x, y); /* Next value */ - if (++x >= data->info.matrix_xsize) { + if (++x >= data->xsize) { x = 0; y++; } @@ -2276,8 +2306,8 @@ static int mxt_set_input(struct mxt_data *data, unsigned int i) if (i > 0) return -EINVAL; - f->width = data->info.matrix_xsize; - f->height = data->info.matrix_ysize; + f->width = data->xsize; + f->height = data->ysize; f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; f->field = V4L2_FIELD_NONE; f->colorspace = V4L2_COLORSPACE_RAW; @@ -2392,9 +2422,9 @@ static void mxt_debug_init(struct mxt_data *data) dbg->t37_address = object->start_address; /* Calculate size of data and allocate buffer */ - dbg->t37_nodes = data->info.matrix_xsize * data->info.matrix_ysize; - dbg->t37_pages = DIV_ROUND_UP(dbg->t37_nodes * sizeof(u16), - sizeof(dbg->t37_buf->data)); + dbg->t37_nodes = data->xsize * data->ysize; + dbg->t37_pages = DIV_ROUND_UP(data->xsize * data->info.matrix_ysize * + sizeof(u16), sizeof(dbg->t37_buf->data)); dbg->t37_buf = devm_kmalloc_array(>client->dev, dbg->t37_pages, sizeof(struct t37_debug), GFP_KERNEL); -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 10/11] Input: synaptics-rmi4 - add support for F54 diagnostics
Function 54 implements access to various RMI4 diagnostic features. This patch adds support for retrieving this data. It registers a V4L2 device to output the data to user space. Signed-off-by: Nick Dyer--- drivers/input/rmi4/Kconfig | 11 + drivers/input/rmi4/Makefile | 1 + drivers/input/rmi4/rmi_bus.c| 3 + drivers/input/rmi4/rmi_driver.h | 1 + drivers/input/rmi4/rmi_f54.c| 754 5 files changed, 770 insertions(+) create mode 100644 drivers/input/rmi4/rmi_f54.c diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index f73df24..f3418b6 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -61,3 +61,14 @@ config RMI4_F30 Function 30 provides GPIO and LED support for RMI4 devices. This includes support for buttons on TouchPads and ClickPads. + +config RMI4_F54 + bool "RMI4 Function 54 (Analog diagnostics)" + depends on RMI4_CORE + depends on VIDEO_V4L2 + select VIDEOBUF2_VMALLOC + help + Say Y here if you want to add support for RMI4 function 54 + + Function 54 provides access to various diagnostic features in certain + RMI4 touch sensors. diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile index 95c00a7..0bafc85 100644 --- a/drivers/input/rmi4/Makefile +++ b/drivers/input/rmi4/Makefile @@ -7,6 +7,7 @@ rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o +rmi_core-$(CONFIG_RMI4_F54) += rmi_f54.o # Transports obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index b368b05..3aedc65 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -315,6 +315,9 @@ static struct rmi_function_handler *fn_handlers[] = { #ifdef CONFIG_RMI4_F30 _f30_handler, #endif +#ifdef CONFIG_RMI4_F54 + _f54_handler, +#endif }; static void __rmi_unregister_function_handlers(int start_idx) diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index 6e140fa..8dfbebe 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -102,4 +102,5 @@ extern struct rmi_function_handler rmi_f01_handler; extern struct rmi_function_handler rmi_f11_handler; extern struct rmi_function_handler rmi_f12_handler; extern struct rmi_function_handler rmi_f30_handler; +extern struct rmi_function_handler rmi_f54_handler; #endif diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c new file mode 100644 index 000..2361157 --- /dev/null +++ b/drivers/input/rmi4/rmi_f54.c @@ -0,0 +1,754 @@ +/* + * Copyright (c) 2012-2015 Synaptics Incorporated + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "rmi_driver.h" + +#define F54_NAME "rmi4_f54" + +/* F54 data offsets */ +#define F54_REPORT_DATA_OFFSET 3 +#define F54_FIFO_OFFSET 1 +#define F54_NUM_TX_OFFSET 1 +#define F54_NUM_RX_OFFSET 0 + +/* F54 commands */ +#define F54_GET_REPORT 1 +#define F54_FORCE_CAL 2 + +/* Fixed sizes of reports */ +#define F54_QUERY_LEN 27 + +/* F54 capabilities */ +#define F54_CAP_BASELINE (1 << 2) +#define F54_CAP_IMAGE8 (1 << 3) +#define F54_CAP_IMAGE16(1 << 6) + +/** + * enum rmi_f54_report_type - RMI4 F54 report types + * + * @F54_8BIT_IMAGE:Normalized 8-Bit Image Report. The capacitance variance + * from baseline for each pixel. + * + * @F54_16BIT_IMAGE: Normalized 16-Bit Image Report. The capacitance variance + * from baseline for each pixel. + * + * @F54_RAW_16BIT_IMAGE: + * Raw 16-Bit Image Report. The raw capacitance for each + * pixel. + * + * @F54_TRUE_BASELINE: True Baseline Report. The baseline capacitance for each + * pixel. + * + * @F54_FULL_RAW_CAP: Full Raw Capacitance Report. The raw capacitance with + * low reference set to its minimum value and high + * reference set to its maximum value. + * + * @F54_FULL_RAW_CAP_RX_OFFSET_REMOVED: + * Full Raw Capacitance with Receiver Offset Removed + * Report. Set Low reference to its minimum value and high + * references to its maximum value, then report the raw + * capacitance for each pixel. + */ +enum rmi_f54_report_type { + F54_REPORT_NONE = 0, + F54_8BIT_IMAGE = 1, + F54_16BIT_IMAGE = 2, +
[PATCH v6 04/11] Input: atmel_mxt_ts - add support for T37 diagnostic data
Atmel maXTouch devices have a T37 object which can be used to read raw touch deltas from the device. This consists of an array of 16-bit integers, one for each node on the touchscreen matrix. Signed-off-by: Nick Dyer--- drivers/input/touchscreen/Kconfig| 6 ++ drivers/input/touchscreen/atmel_mxt_ts.c | 159 +++ 2 files changed, 165 insertions(+) diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 8ecdc38..da96ecf 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -115,6 +115,12 @@ config TOUCHSCREEN_ATMEL_MXT To compile this driver as a module, choose M here: the module will be called atmel_mxt_ts. +config TOUCHSCREEN_ATMEL_MXT_T37 + bool "Support T37 Diagnostic Data" + depends on TOUCHSCREEN_ATMEL_MXT + help + Say Y here if you want support for the T37 Diagnostic Data object. + config TOUCHSCREEN_AUO_PIXCIR tristate "AUO in-cell touchscreen using Pixcir ICs" depends on I2C diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 5af7907..0048233 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -124,6 +124,19 @@ struct t9_range { #define MXT_COMMS_CTRL 0 #define MXT_COMMS_CMD 1 +/* MXT_DEBUG_DIAGNOSTIC_T37 */ +#define MXT_DIAGNOSTIC_PAGEUP 0x01 +#define MXT_DIAGNOSTIC_DELTAS 0x10 +#define MXT_DIAGNOSTIC_SIZE128 + +struct t37_debug { +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 + u8 mode; + u8 page; + u8 data[MXT_DIAGNOSTIC_SIZE]; +#endif +}; + /* Define for MXT_GEN_COMMAND_T6 */ #define MXT_BOOT_VALUE 0xa5 #define MXT_RESET_VALUE0x01 @@ -205,6 +218,14 @@ struct mxt_object { u8 num_report_ids; } __packed; +struct mxt_dbg { + u16 t37_address; + u16 diag_cmd_address; + struct t37_debug *t37_buf; + unsigned int t37_pages; + unsigned int t37_nodes; +}; + /* Each client has this additional data */ struct mxt_data { struct i2c_client *client; @@ -233,6 +254,7 @@ struct mxt_data { u8 num_touchids; u8 multitouch; struct t7_config t7_cfg; + struct mxt_dbg dbg; /* Cached parameters from object table */ u16 T5_address; @@ -2043,6 +2065,141 @@ recheck: return 0; } +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 +static u16 mxt_get_debug_value(struct mxt_data *data, unsigned int x, + unsigned int y) +{ + struct mxt_dbg *dbg = >dbg; + unsigned int ofs, page; + + ofs = (y + (x * data->info.matrix_ysize)) * sizeof(u16); + page = ofs / MXT_DIAGNOSTIC_SIZE; + ofs %= MXT_DIAGNOSTIC_SIZE; + + return get_unaligned_le16(>t37_buf[page].data[ofs]); +} + +static int mxt_convert_debug_pages(struct mxt_data *data, u16 *outbuf) +{ + struct mxt_dbg *dbg = >dbg; + unsigned int x = 0; + unsigned int y = 0; + unsigned int i; + + for (i = 0; i < dbg->t37_nodes; i++) { + outbuf[i] = mxt_get_debug_value(data, x, y); + + /* Next value */ + if (++x >= data->info.matrix_xsize) { + x = 0; + y++; + } + } + + return 0; +} + +static int mxt_read_diagnostic_debug(struct mxt_data *data, u8 mode, +u16 *outbuf) +{ + struct mxt_dbg *dbg = >dbg; + int retries = 0; + int page; + int ret; + u8 cmd = mode; + struct t37_debug *p; + u8 cmd_poll; + + for (page = 0; page < dbg->t37_pages; page++) { + p = dbg->t37_buf + page; + + ret = mxt_write_reg(data->client, dbg->diag_cmd_address, + cmd); + if (ret) + return ret; + + retries = 0; + msleep(20); +wait_cmd: + /* Read back command byte */ + ret = __mxt_read_reg(data->client, dbg->diag_cmd_address, +sizeof(cmd_poll), _poll); + if (ret) + return ret; + + /* Field is cleared once the command has been processed */ + if (cmd_poll) { + if (retries++ > 100) + return -EINVAL; + + msleep(20); + goto wait_cmd; + } + + /* Read T37 page */ + ret = __mxt_read_reg(data->client, dbg->t37_address, +sizeof(struct t37_debug), p); + if (ret) + return ret; + + if (p->mode != mode || p->page != page) { + dev_err(>client->dev, "T37 page mismatch\n"); + return
[PATCH v6 01/11] Input: atmel_mxt_ts - update MAINTAINERS email address
I'm leaving ITDev, so change to my personal email. My understanding is that someone at Atmel will take this on once their takeover by Microchip has settled down. Signed-off-by: Nick Dyer--- MAINTAINERS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0f148d3..6affed5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2181,9 +2181,9 @@ S:Maintained F: drivers/net/wireless/atmel/atmel* ATMEL MAXTOUCH DRIVER -M: Nick Dyer -T: git git://github.com/atmel-maxtouch/linux.git -S: Supported +M: Nick Dyer +T: git git://github.com/ndyer/linux.git +S: Maintained F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt F: drivers/input/touchscreen/atmel_mxt_ts.c F: include/linux/platform_data/atmel_mxt_ts.h -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 11/11] Input: sur40 - use new V4L2 touch input type
Support both V4L2_TCH_FMT_TU08 and V4L2_PIX_FMT_GREY for backwards compatibility. Note: I have not tested these changes (I have no access to the hardware) so not signing off. --- drivers/input/touchscreen/sur40.c | 121 +++--- 1 file changed, 88 insertions(+), 33 deletions(-) diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index 880c40b..9ba68cf 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c @@ -139,6 +139,27 @@ struct sur40_image_header { #define SUR40_GET_STATE 0xc5 /* 4 bytes state (?) */ #define SUR40_GET_SENSORS 0xb1 /* 8 bytes sensors */ +static const struct v4l2_pix_format sur40_pix_format[] = { + { + .pixelformat = V4L2_TCH_FMT_TU08, + .width = SENSOR_RES_X / 2, + .height = SENSOR_RES_Y / 2, + .field = V4L2_FIELD_NONE, + .colorspace = V4L2_COLORSPACE_SRGB, + .bytesperline = SENSOR_RES_X / 2, + .sizeimage = (SENSOR_RES_X/2) * (SENSOR_RES_Y/2), + }, + { + .pixelformat = V4L2_PIX_FMT_GREY, + .width = SENSOR_RES_X / 2, + .height = SENSOR_RES_Y / 2, + .field = V4L2_FIELD_NONE, + .colorspace = V4L2_COLORSPACE_SRGB, + .bytesperline = SENSOR_RES_X / 2, + .sizeimage = (SENSOR_RES_X/2) * (SENSOR_RES_Y/2), + } +}; + /* master device state */ struct sur40_state { @@ -149,6 +170,7 @@ struct sur40_state { struct v4l2_device v4l2; struct video_device vdev; struct mutex lock; + struct v4l2_pix_format pix_fmt; struct vb2_queue queue; struct vb2_alloc_ctx *alloc_ctx; @@ -170,7 +192,6 @@ struct sur40_buffer { /* forward declarations */ static const struct video_device sur40_video_device; -static const struct v4l2_pix_format sur40_video_format; static const struct vb2_queue sur40_queue; static void sur40_process_video(struct sur40_state *sur40); @@ -421,7 +442,7 @@ static void sur40_process_video(struct sur40_state *sur40) goto err_poll; } - if (le32_to_cpu(img->size) != sur40_video_format.sizeimage) { + if (le32_to_cpu(img->size) != sur40->pix_fmt.sizeimage) { dev_err(sur40->dev, "image size mismatch\n"); goto err_poll; } @@ -432,7 +453,7 @@ static void sur40_process_video(struct sur40_state *sur40) result = usb_sg_init(, sur40->usbdev, usb_rcvbulkpipe(sur40->usbdev, VIDEO_ENDPOINT), 0, - sgt->sgl, sgt->nents, sur40_video_format.sizeimage, 0); + sgt->sgl, sgt->nents, sur40->pix_fmt.sizeimage, 0); if (result < 0) { dev_err(sur40->dev, "error %d in usb_sg_init\n", result); goto err_poll; @@ -593,13 +614,14 @@ static int sur40_probe(struct usb_interface *interface, goto err_unreg_v4l2; } + sur40->pix_fmt = sur40_pix_format[0]; sur40->vdev = sur40_video_device; sur40->vdev.v4l2_dev = >v4l2; sur40->vdev.lock = >lock; sur40->vdev.queue = >queue; video_set_drvdata(>vdev, sur40); - error = video_register_device(>vdev, VFL_TYPE_GRABBER, -1); + error = video_register_device(>vdev, VFL_TYPE_TOUCH, -1); if (error) { dev_err(>dev, "Unable to register video subdevice."); @@ -662,10 +684,10 @@ static int sur40_queue_setup(struct vb2_queue *q, alloc_ctxs[0] = sur40->alloc_ctx; if (*nplanes) - return sizes[0] < sur40_video_format.sizeimage ? -EINVAL : 0; + return sizes[0] < sur40->pix_fmt.sizeimage ? -EINVAL : 0; *nplanes = 1; - sizes[0] = sur40_video_format.sizeimage; + sizes[0] = sur40->pix_fmt.sizeimage; return 0; } @@ -677,7 +699,7 @@ static int sur40_queue_setup(struct vb2_queue *q, static int sur40_buffer_prepare(struct vb2_buffer *vb) { struct sur40_state *sur40 = vb2_get_drv_priv(vb->vb2_queue); - unsigned long size = sur40_video_format.sizeimage; + unsigned long size = sur40->pix_fmt.sizeimage; if (vb2_plane_size(vb, 0) < size) { dev_err(>usbdev->dev, "buffer too small (%lu < %lu)\n", @@ -751,7 +773,7 @@ static int sur40_vidioc_querycap(struct file *file, void *priv, strlcpy(cap->driver, DRIVER_SHORT, sizeof(cap->driver)); strlcpy(cap->card, DRIVER_LONG, sizeof(cap->card)); usb_make_path(sur40->usbdev, cap->bus_info, sizeof(cap->bus_info)); - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | + cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TOUCH | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -763,7 +785,7 @@ static int sur40_vidioc_enum_input(struct file *file, void
[PATCH v6 09/11] Input: atmel_mxt_ts - add support for reference data
There are different datatypes available from a maXTouch chip. Add support to retrieve reference data as well. Signed-off-by: Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 57 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 7c4d937..f75f2ce 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -135,6 +135,7 @@ struct t9_range { /* MXT_DEBUG_DIAGNOSTIC_T37 */ #define MXT_DIAGNOSTIC_PAGEUP 0x01 #define MXT_DIAGNOSTIC_DELTAS 0x10 +#define MXT_DIAGNOSTIC_REFS0x11 #define MXT_DIAGNOSTIC_SIZE128 #define MXT_FAMILY_1386160 @@ -249,6 +250,12 @@ struct mxt_dbg { int input; }; +enum v4l_dbg_inputs { + MXT_V4L_INPUT_DELTAS, + MXT_V4L_INPUT_REFS, + MXT_V4L_INPUT_MAX, +}; + static const struct v4l2_file_operations mxt_video_fops = { .owner = THIS_MODULE, .open = v4l2_fh_open, @@ -2273,6 +2280,7 @@ static void mxt_buffer_queue(struct vb2_buffer *vb) struct mxt_data *data = vb2_get_drv_priv(vb->vb2_queue); u16 *ptr; int ret; + u8 mode; ptr = vb2_plane_vaddr(vb, 0); if (!ptr) { @@ -2280,7 +2288,18 @@ static void mxt_buffer_queue(struct vb2_buffer *vb) goto fault; } - ret = mxt_read_diagnostic_debug(data, MXT_DIAGNOSTIC_DELTAS, ptr); + switch (data->dbg.input) { + case MXT_V4L_INPUT_DELTAS: + default: + mode = MXT_DIAGNOSTIC_DELTAS; + break; + + case MXT_V4L_INPUT_REFS: + mode = MXT_DIAGNOSTIC_REFS; + break; + } + + ret = mxt_read_diagnostic_debug(data, mode, ptr); if (ret) goto fault; @@ -2325,11 +2344,21 @@ static int mxt_vidioc_querycap(struct file *file, void *priv, static int mxt_vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i) { - if (i->index > 0) + if (i->index >= MXT_V4L_INPUT_MAX) return -EINVAL; i->type = V4L2_INPUT_TYPE_TOUCH; - strlcpy(i->name, "Mutual Capacitance Deltas", sizeof(i->name)); + + switch (i->index) { + case MXT_V4L_INPUT_REFS: + strlcpy(i->name, "Mutual Capacitance References", + sizeof(i->name)); + break; + case MXT_V4L_INPUT_DELTAS: + strlcpy(i->name, "Mutual Capacitance Deltas", sizeof(i->name)); + break; + } + return 0; } @@ -2337,12 +2366,16 @@ static int mxt_set_input(struct mxt_data *data, unsigned int i) { struct v4l2_pix_format *f = >dbg.format; - if (i > 0) + if (i >= MXT_V4L_INPUT_MAX) return -EINVAL; + if (i == MXT_V4L_INPUT_DELTAS) + f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + else + f->pixelformat = V4L2_TCH_FMT_TU16; + f->width = data->xy_switch ? data->ysize : data->xsize; f->height = data->xy_switch ? data->xsize : data->ysize; - f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; f->field = V4L2_FIELD_NONE; f->colorspace = V4L2_COLORSPACE_RAW; f->bytesperline = f->width * sizeof(u16); @@ -2383,7 +2416,19 @@ static int mxt_vidioc_enum_fmt(struct file *file, void *priv, if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + switch (fmt->index) { + case 0: + fmt->pixelformat = V4L2_TCH_FMT_TU16; + break; + + case 1: + fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + break; + + default: + return -EINVAL; + } + return 0; } -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 07/11] Input: atmel_mxt_ts - handle diagnostic data orientation
Invert the diagnostic data to match the orientation of the input device. Signed-off-by: Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index d09ecc3..c35fca0 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -125,6 +125,8 @@ struct t9_range { /* MXT_TOUCH_MULTI_T9 orient */ #define MXT_T9_ORIENT_SWITCH (1 << 0) +#define MXT_T9_ORIENT_INVERTX (1 << 1) +#define MXT_T9_ORIENT_INVERTY (1 << 2) /* MXT_SPT_COMMSCONFIG_T18 */ #define MXT_COMMS_CTRL 0 @@ -158,6 +160,8 @@ struct t37_debug { #define MXT_T100_YRANGE24 #define MXT_T100_CFG_SWITCHXY BIT(5) +#define MXT_T100_CFG_INVERTY BIT(6) +#define MXT_T100_CFG_INVERTX BIT(7) #define MXT_T100_TCHAUX_VECT BIT(0) #define MXT_T100_TCHAUX_AMPL BIT(1) @@ -262,6 +266,8 @@ struct mxt_data { unsigned int irq; unsigned int max_x; unsigned int max_y; + bool invertx; + bool inverty; bool xy_switch; u8 xsize; u8 ysize; @@ -1747,6 +1753,8 @@ static int mxt_read_t9_resolution(struct mxt_data *data) return error; data->xy_switch = orient & MXT_T9_ORIENT_SWITCH; + data->invertx = orient & MXT_T9_ORIENT_INVERTX; + data->inverty = orient & MXT_T9_ORIENT_INVERTY; return 0; } @@ -1801,6 +1809,8 @@ static int mxt_read_t100_config(struct mxt_data *data) return error; data->xy_switch = cfg & MXT_T100_CFG_SWITCHXY; + data->invertx = cfg & MXT_T100_CFG_INVERTX; + data->inverty = cfg & MXT_T100_CFG_INVERTY; /* allocate aux bytes */ error = __mxt_read_reg(client, @@ -2145,13 +2155,19 @@ static int mxt_convert_debug_pages(struct mxt_data *data, u16 *outbuf) struct mxt_dbg *dbg = >dbg; unsigned int x = 0; unsigned int y = 0; - unsigned int i; + unsigned int i, rx, ry; for (i = 0; i < dbg->t37_nodes; i++) { - outbuf[i] = mxt_get_debug_value(data, x, y); + /* Handle orientation */ + rx = data->xy_switch ? y : x; + ry = data->xy_switch ? x : y; + rx = data->invertx ? (data->xsize - 1 - rx) : rx; + ry = data->inverty ? (data->ysize - 1 - ry) : ry; + + outbuf[i] = mxt_get_debug_value(data, rx, ry); /* Next value */ - if (++x >= data->xsize) { + if (++x >= (data->xy_switch ? data->ysize : data->xsize)) { x = 0; y++; } @@ -2306,8 +2322,8 @@ static int mxt_set_input(struct mxt_data *data, unsigned int i) if (i > 0) return -EINVAL; - f->width = data->xsize; - f->height = data->ysize; + f->width = data->xy_switch ? data->ysize : data->xsize; + f->height = data->xy_switch ? data->xsize : data->ysize; f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; f->field = V4L2_FIELD_NONE; f->colorspace = V4L2_COLORSPACE_RAW; -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 03/11] [media] DocBook: add support for touch devices
Signed-off-by: Nick Dyer--- Documentation/DocBook/media/v4l/dev-touch.xml | 51 ++ Documentation/DocBook/media/v4l/media-types.xml| 5 ++ .../DocBook/media/v4l/pixfmt-tch-td08.xml | 66 + .../DocBook/media/v4l/pixfmt-tch-td16.xml | 82 ++ .../DocBook/media/v4l/pixfmt-tch-tu08.xml | 66 + .../DocBook/media/v4l/pixfmt-tch-tu16.xml | 81 + Documentation/DocBook/media/v4l/pixfmt.xml | 13 Documentation/DocBook/media/v4l/v4l2.xml | 1 + 8 files changed, 365 insertions(+) create mode 100644 Documentation/DocBook/media/v4l/dev-touch.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-td16.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-tu08.xml create mode 100644 Documentation/DocBook/media/v4l/pixfmt-tch-tu16.xml diff --git a/Documentation/DocBook/media/v4l/dev-touch.xml b/Documentation/DocBook/media/v4l/dev-touch.xml new file mode 100644 index 000..85d492a --- /dev/null +++ b/Documentation/DocBook/media/v4l/dev-touch.xml @@ -0,0 +1,51 @@ +Touch Devices + +Touch devices are accessed through character device special files + named /dev/v4l-touch0 to + /dev/v4l-touch255 with major number 81 and + dynamically allocated minor numbers 0 to 255. + + + Overview + + Sensors may be Optical, or Projected Capacitive touch (PCT). + + Processing is required to analyse the raw data and produce input +events. In some systems, this may be performed on the ASIC and the raw data +is purely a side-channel for diagnostics or tuning. In other systems, the +ASIC is a simple analogue front end device which delivers touch data at +high rate, and any touch processing must be done on the host. + + For capacitive touch sensing, the touchscreen is composed of an array +of horizontal and vertical conductors (alternatively called rows/columns, +X/Y lines, or tx/rx). Mutual Capacitance measured is at the nodes where the +conductors cross. Alternatively, Self Capacitance measures the signal from +each column and row independently. + + A touch input may be determined by comparing the raw capacitance +measurement to a no-touch reference (or "baseline") measurement: + + Delta = Raw - Reference + + The reference measurement takes account of variations in the +capacitance across the touch sensor matrix, for example +manufacturing irregularities, environmental or edge effects. + + + + Querying Capabilities + + Devices supporting the touch interface set the +V4L2_CAP_VIDEO_CAPTURE flag in the +capabilities field of +returned by the ioctl. + + At least one of the read/write or streaming I/O methods must be +supported. + + + + Data Format Negotiation + + A touch device may support any I/O method. + diff --git a/Documentation/DocBook/media/v4l/media-types.xml b/Documentation/DocBook/media/v4l/media-types.xml index 5e3f20f..fb957c7 100644 --- a/Documentation/DocBook/media/v4l/media-types.xml +++ b/Documentation/DocBook/media/v4l/media-types.xml @@ -202,6 +202,11 @@ typically, /dev/swradio? + MEDIA_INTF_T_V4L_TOUCH + Device node interface for Touch device (V4L) + typically, /dev/v4l-touch? + + MEDIA_INTF_T_ALSA_PCM_CAPTURE Device node interface for ALSA PCM Capture typically, /dev/snd/pcmC?D?c diff --git a/Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml b/Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml new file mode 100644 index 000..2483eb0 --- /dev/null +++ b/Documentation/DocBook/media/v4l/pixfmt-tch-td08.xml @@ -0,0 +1,66 @@ + + +V4L2_TCH_FMT_DELTA_TD08 ('TD08') + + + +V4L2_TCH_FMT_DELTA_TD08 +8-bit signed Touch Delta + + +Description + +This format represents delta data from a touch controller + +Delta values may range from -128 to 127. Typically the values + will vary through a small range depending on whether the sensor is + touched or not. The full value may be seen if one of the + touchscreen nodes has a fault or the line is not connected. + + + V4L2_TCH_FMT_DELTA_TD08 4 4 +node matrix + + +Byte Order. +Each cell is one byte. + + + + + + start+0: + D'00 + D'01 + D'02 + D'03 + + + start+4: + D'10 + D'11 + D'12 + D'13 + + + start+8: + D'20 + D'21 + D'22 + D'23 + +
[PATCH v6 08/11] Input: atmel_mxt_ts - add diagnostic data support for mXT1386
The mXT1386 family of chips have a different architecture which splits the diagnostic data into 3 columns. Signed-off-by: Nick Dyer--- drivers/input/touchscreen/atmel_mxt_ts.c | 31 --- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index c35fca0..7c4d937 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -137,6 +137,10 @@ struct t9_range { #define MXT_DIAGNOSTIC_DELTAS 0x10 #define MXT_DIAGNOSTIC_SIZE128 +#define MXT_FAMILY_1386160 +#define MXT1386_COLUMNS3 +#define MXT1386_PAGES_PER_COLUMN 8 + struct t37_debug { #ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 u8 mode; @@ -2140,13 +2144,27 @@ recheck: static u16 mxt_get_debug_value(struct mxt_data *data, unsigned int x, unsigned int y) { + struct mxt_info *info = >info; struct mxt_dbg *dbg = >dbg; unsigned int ofs, page; + unsigned int col = 0; + unsigned int col_width; + + if (info->family_id == MXT_FAMILY_1386) { + col_width = info->matrix_ysize / MXT1386_COLUMNS; + col = y / col_width; + y = y % col_width; + } else { + col_width = info->matrix_ysize; + } - ofs = (y + (x * data->info.matrix_ysize)) * sizeof(u16); + ofs = (y + (x * col_width)) * sizeof(u16); page = ofs / MXT_DIAGNOSTIC_SIZE; ofs %= MXT_DIAGNOSTIC_SIZE; + if (info->family_id == MXT_FAMILY_1386) + page += col * MXT1386_PAGES_PER_COLUMN; + return get_unaligned_le16(>t37_buf[page].data[ofs]); } @@ -2416,6 +2434,7 @@ static const struct video_device mxt_video_device = { static void mxt_debug_init(struct mxt_data *data) { + struct mxt_info *info = >info; struct mxt_dbg *dbg = >dbg; struct mxt_object *object; int error; @@ -2439,8 +2458,14 @@ static void mxt_debug_init(struct mxt_data *data) /* Calculate size of data and allocate buffer */ dbg->t37_nodes = data->xsize * data->ysize; - dbg->t37_pages = DIV_ROUND_UP(data->xsize * data->info.matrix_ysize * - sizeof(u16), sizeof(dbg->t37_buf->data)); + + if (info->family_id == MXT_FAMILY_1386) + dbg->t37_pages = MXT1386_COLUMNS * MXT1386_PAGES_PER_COLUMN; + else + dbg->t37_pages = DIV_ROUND_UP(data->xsize * + data->info.matrix_ysize * + sizeof(u16), + sizeof(dbg->t37_buf->data)); dbg->t37_buf = devm_kmalloc_array(>client->dev, dbg->t37_pages, sizeof(struct t37_debug), GFP_KERNEL); -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 0/11] Output raw touch data via V4L2
This is a series of patches to add output of raw touch diagnostic data via V4L2 to the Atmel maXTouch and Synaptics RMI4 drivers. It's a rewrite of the previous implementation which output via debugfs: it now uses a V4L2 device in a similar way to the sur40 driver. We have a utility which can read the data and display it in a useful format: https://github.com/ndyer/heatmap/commits/heatmap-v4l These patches are also available from https://github.com/ndyer/linux/commits/v4l-touch-2016-06-30 I will also send a patch to update v4l2-compliance. Changes in v6: - Remove BUF_TYPE_TOUCH_CAPTURE, as discussed with Hans V touch devices will use BUF_TYPE_VIDEO_CAPTURE. - Touch devices should now register CAP_VIDEO_CAPTURE: CAP_TOUCH just says that this is a touch device, not a video device, but otherwise it acts the same. - Add some code to v4l_s_fmt() to set sensible default values for fields not used by touch. - Improve naming/doc of RMI4 F54 report types. - Various minor DocBook fixes, and split to separate patch. - Update my email address. - Rework sur40 changes so that PIX_FMT_GREY is supported for backward compatibility. Florian is it possible for you to test? Changes in v5 (Hans Verkuil review): - Update v4l2-core: - Add VFL_TYPE_TOUCH, V4L2_BUF_TYPE_TOUCH_CAPTURE and V4L2_CAP_TOUCH - Change V4L2_INPUT_TYPE_TOUCH_SENSOR to V4L2_INPUT_TYPE_TOUCH - Improve DocBook documentation - Add FMT definitions for touch data - Note this will need the latest version of the heatmap util - Synaptics RMI4 driver: - Remove some less important non full frame report types - Switch report type names to const char * array - Move a static array to inside context struct - Split sur40 changes to a separate commit Changes in v4: - Address nits from the input side in atmel_mxt_ts patches (Dmitry Torokhov) - Add Synaptics RMI4 F54 support patch Changes in v3: - Address V4L2 review comments from Hans Verkuil - Run v4l-compliance and fix all issues - needs minor patch here: https://github.com/ndyer/v4l-utils/commit/cf50469773f Changes in v2: - Split pixfmt changes into separate commit and add DocBook - Introduce VFL_TYPE_TOUCH_SENSOR and /dev/v4l-touch - Remove "single node" support for now, it may be better to treat it as metadata later - Explicitly set VFL_DIR_RX - Fix Kconfig -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 05/11] Input: atmel_mxt_ts - output diagnostic debug via V4L2 device
Register a video device to output T37 diagnostic data. Signed-off-by: Nick Dyer--- drivers/input/touchscreen/Kconfig| 6 +- drivers/input/touchscreen/atmel_mxt_ts.c | 244 +++ 2 files changed, 248 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index da96ecf..7c1c5ec 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -117,9 +117,11 @@ config TOUCHSCREEN_ATMEL_MXT config TOUCHSCREEN_ATMEL_MXT_T37 bool "Support T37 Diagnostic Data" - depends on TOUCHSCREEN_ATMEL_MXT + depends on TOUCHSCREEN_ATMEL_MXT && VIDEO_V4L2 + select VIDEOBUF2_VMALLOC help - Say Y here if you want support for the T37 Diagnostic Data object. + Say Y here if you want support to output data from the T37 + Diagnostic Data object using a V4L device. config TOUCHSCREEN_AUO_PIXCIR tristate "AUO in-cell touchscreen using Pixcir ICs" diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 0048233..bea95a1 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -28,6 +28,10 @@ #include #include #include +#include +#include +#include +#include /* Firmware files */ #define MXT_FW_NAME"maxtouch.fw" @@ -224,6 +228,23 @@ struct mxt_dbg { struct t37_debug *t37_buf; unsigned int t37_pages; unsigned int t37_nodes; + + struct v4l2_device v4l2; + struct v4l2_pix_format format; + struct video_device vdev; + struct vb2_queue queue; + struct mutex lock; + int input; +}; + +static const struct v4l2_file_operations mxt_video_fops = { + .owner = THIS_MODULE, + .open = v4l2_fh_open, + .release = vb2_fop_release, + .unlocked_ioctl = video_ioctl2, + .read = vb2_fop_read, + .mmap = vb2_fop_mmap, + .poll = vb2_fop_poll, }; /* Each client has this additional data */ @@ -279,6 +300,11 @@ struct mxt_data { struct completion crc_completion; }; +struct mxt_vb2_buffer { + struct vb2_buffer vb; + struct list_headlist; +}; + static size_t mxt_obj_size(const struct mxt_object *obj) { return obj->size_minus_one + 1; @@ -1525,6 +1551,11 @@ static void mxt_free_input_device(struct mxt_data *data) static void mxt_free_object_table(struct mxt_data *data) { +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 + video_unregister_device(>dbg.vdev); + v4l2_device_unregister(>dbg.v4l2); +#endif + kfree(data->object_table); data->object_table = NULL; kfree(data->msg_buf); @@ -2157,10 +2188,191 @@ wait_cmd: return mxt_convert_debug_pages(data, outbuf); } +static int mxt_queue_setup(struct vb2_queue *q, + unsigned int *nbuffers, unsigned int *nplanes, + unsigned int sizes[], void *alloc_ctxs[]) +{ + struct mxt_data *data = q->drv_priv; + size_t size = data->dbg.t37_nodes * sizeof(u16); + + if (*nplanes) + return sizes[0] < size ? -EINVAL : 0; + + *nplanes = 1; + sizes[0] = size; + + return 0; +} + +static void mxt_buffer_queue(struct vb2_buffer *vb) +{ + struct mxt_data *data = vb2_get_drv_priv(vb->vb2_queue); + u16 *ptr; + int ret; + + ptr = vb2_plane_vaddr(vb, 0); + if (!ptr) { + dev_err(>client->dev, "Error acquiring frame ptr\n"); + goto fault; + } + + ret = mxt_read_diagnostic_debug(data, MXT_DIAGNOSTIC_DELTAS, ptr); + if (ret) + goto fault; + + vb2_set_plane_payload(vb, 0, data->dbg.t37_nodes * sizeof(u16)); + vb2_buffer_done(vb, VB2_BUF_STATE_DONE); + return; + +fault: + vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); +} + +/* V4L2 structures */ +static const struct vb2_ops mxt_queue_ops = { + .queue_setup= mxt_queue_setup, + .buf_queue = mxt_buffer_queue, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish= vb2_ops_wait_finish, +}; + +static const struct vb2_queue mxt_queue = { + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, + .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ, + .buf_struct_size = sizeof(struct mxt_vb2_buffer), + .ops = _queue_ops, + .mem_ops = _vmalloc_memops, + .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, + .min_buffers_needed = 1, +}; + +static int mxt_vidioc_querycap(struct file *file, void *priv, +struct v4l2_capability *cap) +{ + struct mxt_data *data = video_drvdata(file); + + strlcpy(cap->driver, "atmel_mxt_ts", sizeof(cap->driver)); + strlcpy(cap->card, "atmel_mxt_ts touch", sizeof(cap->card)); + snprintf(cap->bus_info,
[PATCH v6 02/11] [media] v4l2-core: Add support for touch devices
Some touch controllers send out touch data in a similar way to a greyscale frame grabber. Add new device type VFL_TYPE_TOUCH: - This uses a new device prefix v4l-touch for these devices, to stop generic capture software from treating them as webcams. Otherwise, touch is treated similarly to video capture. - Add V4L2_INPUT_TYPE_TOUCH - Add MEDIA_INTF_T_V4L_TOUCH - Add V4L2_CAP_TOUCH to indicate device is a touch device Add formats: - V4L2_TCH_FMT_DELTA_TD16 for signed 16-bit touch deltas - V4L2_TCH_FMT_DELTA_TD08 for signed 16-bit touch deltas - V4L2_TCH_FMT_TU16 for unsigned 16-bit touch data - V4L2_TCH_FMT_TU08 for unsigned 8-bit touch data This support will be used by: - Atmel maXTouch (atmel_mxt_ts) - Synaptics RMI4. - sur40 Signed-off-by: Nick Dyer--- drivers/media/media-entity.c | 2 ++ drivers/media/v4l2-core/v4l2-dev.c | 16 +--- drivers/media/v4l2-core/v4l2-ioctl.c | 36 +++- include/media/v4l2-dev.h | 3 ++- include/uapi/linux/media.h | 1 + include/uapi/linux/videodev2.h | 9 + 6 files changed, 58 insertions(+), 9 deletions(-) diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index d8a2299..9014362 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -65,6 +65,8 @@ static inline const char *intf_type(struct media_interface *intf) return "v4l-subdev"; case MEDIA_INTF_T_V4L_SWRADIO: return "v4l-swradio"; + case MEDIA_INTF_T_V4L_TOUCH: + return "v4l-touch"; case MEDIA_INTF_T_ALSA_PCM_CAPTURE: return "alsa-pcm-capture"; case MEDIA_INTF_T_ALSA_PCM_PLAYBACK: diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 70b559d..21ba9b4 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -527,6 +527,7 @@ static void determine_valid_ioctls(struct video_device *vdev) bool is_vbi = vdev->vfl_type == VFL_TYPE_VBI; bool is_radio = vdev->vfl_type == VFL_TYPE_RADIO; bool is_sdr = vdev->vfl_type == VFL_TYPE_SDR; + bool is_tch = vdev->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vdev->vfl_dir != VFL_DIR_TX; bool is_tx = vdev->vfl_dir != VFL_DIR_RX; @@ -573,7 +574,7 @@ static void determine_valid_ioctls(struct video_device *vdev) if (ops->vidioc_enum_freq_bands || ops->vidioc_g_tuner || ops->vidioc_g_modulator) set_bit(_IOC_NR(VIDIOC_ENUM_FREQ_BANDS), valid_ioctls); - if (is_vid) { + if (is_vid || is_tch) { /* video specific ioctls */ if ((is_rx && (ops->vidioc_enum_fmt_vid_cap || ops->vidioc_enum_fmt_vid_cap_mplane || @@ -662,7 +663,7 @@ static void determine_valid_ioctls(struct video_device *vdev) set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls); } - if (is_vid || is_vbi || is_sdr) { + if (is_vid || is_vbi || is_sdr || is_tch) { /* ioctls valid for video, vbi or sdr */ SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs); SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf); @@ -675,7 +676,7 @@ static void determine_valid_ioctls(struct video_device *vdev) SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff); } - if (is_vid || is_vbi) { + if (is_vid || is_vbi || is_tch) { /* ioctls valid for video or vbi */ if (ops->vidioc_s_std) set_bit(_IOC_NR(VIDIOC_ENUMSTD), valid_ioctls); @@ -751,6 +752,10 @@ static int video_register_media_controller(struct video_device *vdev, int type) intf_type = MEDIA_INTF_T_V4L_SWRADIO; vdev->entity.function = MEDIA_ENT_F_IO_SWRADIO; break; + case VFL_TYPE_TOUCH: + intf_type = MEDIA_INTF_T_V4L_TOUCH; + vdev->entity.function = MEDIA_ENT_F_IO_V4L; + break; case VFL_TYPE_RADIO: intf_type = MEDIA_INTF_T_V4L_RADIO; /* @@ -845,6 +850,8 @@ static int video_register_media_controller(struct video_device *vdev, int type) * %VFL_TYPE_SUBDEV - A subdevice * * %VFL_TYPE_SDR - Software Defined Radio + * + * %VFL_TYPE_TOUCH - A touch sensor */ int __video_register_device(struct video_device *vdev, int type, int nr, int warn_if_nr_in_use, struct module *owner) @@ -888,6 +895,9 @@ int __video_register_device(struct video_device *vdev, int type, int nr, /* Use device name 'swradio' because 'sdr' was already taken. */ name_base = "swradio"; break; + case VFL_TYPE_TOUCH: + name_base = "v4l-touch"; + break; default: printk(KERN_ERR "%s called with unknown type:
[PATCH] v4l2-compliance: Changes to support touch sensors
Signed-off-by: Nick Dyer--- utils/v4l2-compliance/v4l2-compliance.cpp| 48 +++- utils/v4l2-compliance/v4l2-compliance.h | 1 + utils/v4l2-compliance/v4l2-test-input-output.cpp | 4 +- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 48dc8b4..6bd4653 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -55,6 +55,7 @@ enum Option { OptSetRadioDevice = 'r', OptStreaming = 's', OptSetSWRadioDevice = 'S', + OptSetTouchDevice = 't', OptTrace = 'T', OptVerbose = 'v', OptSetVbiDevice = 'V', @@ -105,6 +106,7 @@ static struct option long_options[] = { {"vbi-device", required_argument, 0, OptSetVbiDevice}, {"sdr-device", required_argument, 0, OptSetSWRadioDevice}, {"expbuf-device", required_argument, 0, OptSetExpBufDevice}, + {"touch-device", required_argument, 0, OptSetTouchDevice}, {"help", no_argument, 0, OptHelp}, {"verbose", no_argument, 0, OptVerbose}, {"no-warnings", no_argument, 0, OptNoWarnings}, @@ -134,6 +136,9 @@ static void usage(void) printf(" -S, --sdr-device=\n"); printf(" Use device as the SDR device.\n"); printf(" If starts with a digit, then /dev/swradio is used.\n"); + printf(" -t, --touch-device=\n"); + printf(" Use device as the touch device.\n"); + printf(" If starts with a digit, then /dev/v4l-touch is used.\n"); printf(" -e, --expbuf-device=\n"); printf(" Use device to obtain DMABUF handles.\n"); printf(" If starts with a digit, then /dev/video is used.\n"); @@ -206,6 +211,8 @@ std::string cap2s(unsigned cap) s += "\t\tSDR Capture\n"; if (cap & V4L2_CAP_SDR_OUTPUT) s += "\t\tSDR Output\n"; + if (cap & V4L2_CAP_TOUCH) + s += "\t\tTouch Capture\n"; if (cap & V4L2_CAP_TUNER) s += "\t\tTuner\n"; if (cap & V4L2_CAP_HW_FREQ_SEEK) @@ -673,6 +680,8 @@ int main(int argc, char **argv) struct node radio_node2; struct node sdr_node; struct node sdr_node2; + struct node touch_node; + struct node touch_node2; struct node expbuf_node; /* command args */ @@ -682,6 +691,7 @@ int main(int argc, char **argv) const char *vbi_device = NULL; /* -V device */ const char *radio_device = NULL;/* -r device */ const char *sdr_device = NULL; /* -S device */ + const char *touch_device = NULL;/* -t device */ const char *expbuf_device = NULL; /* --expbuf-device device */ struct v4l2_capability vcap;/* list_cap */ unsigned frame_count = 60; @@ -750,6 +760,15 @@ int main(int argc, char **argv) sdr_device = newdev; } break; + case OptSetTouchDevice: + touch_device = optarg; + if (touch_device[0] >= '0' && touch_device[0] <= '9' && strlen(touch_device) <= 3) { + static char newdev[20]; + + sprintf(newdev, "/dev/v4l-touch%s", touch_device); + touch_device = newdev; + } + break; case OptSetExpBufDevice: expbuf_device = optarg; if (expbuf_device[0] >= '0' && expbuf_device[0] <= '9' && strlen(expbuf_device) <= 3) { @@ -839,7 +858,8 @@ int main(int argc, char **argv) if (v1 == 2 && v2 == 6) kernel_version = v3; - if (!video_device && !vbi_device && !radio_device && !sdr_device) + if (!video_device && !vbi_device && !radio_device && + !sdr_device && !touch_device) video_device = "/dev/video0"; if (video_device) { @@ -886,6 +906,17 @@ int main(int argc, char **argv) } } + if (touch_device) { + touch_node.s_trace(options[OptTrace]); + touch_node.s_direct(direct); + fd = touch_node.open(touch_device, false); + if (fd < 0) { + fprintf(stderr, "Failed to open %s: %s\n", touch_device, + strerror(errno)); + exit(1); + } + } + if (expbuf_device) { expbuf_node.s_trace(options[OptTrace]); expbuf_node.s_direct(true); @@ -913,6 +944,10 @@ int main(int argc, char **argv) node = sdr_node; device = sdr_device;
[PATCH v2 3/3] dt-bindings: Add Renesas R-Car FDP1 bindings
The FDP1 is a de-interlacing module which converts interlaced video to progressive video. It is also capable of performing pixel format conversion between YCbCr/YUV formats and RGB formats. Reviewed-by: Laurent PinchartSigned-off-by: Kieran Bingham --- Changes since v1: - title fixed - Interrupts property documented - version specific compatibles removed as we have a hw version register - label removed from device node example * (fdp1 is not referenced by other nodes) .../devicetree/bindings/media/renesas,fdp1.txt | 33 ++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,fdp1.txt diff --git a/Documentation/devicetree/bindings/media/renesas,fdp1.txt b/Documentation/devicetree/bindings/media/renesas,fdp1.txt new file mode 100644 index ..e6abd2a17e66 --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,fdp1.txt @@ -0,0 +1,33 @@ +Renesas R-Car Fine Display Processor (FDP1) +--- + +The FDP1 is a de-interlacing module which converts interlaced video to +progressive video. It is capable of performing pixel format conversion between +YCbCr/YUV formats and RGB formats. Only YCbCr/YUV formats are supported as +an input to the module. + + - compatible: Must be the following + + - "renesas,fdp1" for generic compatible + + - reg: the register base and size for the device registers + - interrupts : interrupt specifier for the FDP1 instance + - clocks: reference to the functional clock + - renesas,fcp: reference to the FCPF connected to the FDP1 + +Optional properties: + - power-domains : power-domain property defined with a power domain specifier +to respective power domain. + + +Device node example +--- + + fdp1@fe94 { + compatible = "renesas,fdp1"; + reg = <0 0xfe94 0 0x2400>; + interrupts = ; + clocks = < CPG_MOD 119>; + power-domains = < R8A7795_PD_A3VP>; + renesas,fcp = <>; + }; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/3] dt-bindings: Update Renesas R-Car FCP DT binding
The FCP driver can also support the FCPF variant for FDP1 compatible processing. Acked-by: Rob HerringReviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- Documentation/devicetree/bindings/media/renesas,fcp.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt b/Documentation/devicetree/bindings/media/renesas,fcp.txt index 6a12960609d8..271dcfdb5a76 100644 --- a/Documentation/devicetree/bindings/media/renesas,fcp.txt +++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt @@ -7,12 +7,14 @@ conversion of AXI transactions in order to reduce the memory bandwidth. There are three types of FCP: FCP for Codec (FCPC), FCP for VSP (FCPV) and FCP for FDP (FCPF). Their configuration and behaviour depend on the module they -are paired with. These DT bindings currently support the FCPV only. +are paired with. These DT bindings currently support the FCPV and FCPF. - compatible: Must be one or more of the following - "renesas,r8a7795-fcpv" for R8A7795 (R-Car H3) compatible 'FCP for VSP' + - "renesas,r8a7795-fcpf" for R8A7795 (R-Car H3) compatible 'FCP for FDP' - "renesas,fcpv" for generic compatible 'FCP for VSP' + - "renesas,fcpf" for generic compatible 'FCP for FDP' When compatible with the generic version, nodes must list the SoC-specific version corresponding to the platform first, followed by the -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/3] dt-bindings: Document Renesas R-Car FCP power-domains usage
The power domain must be specified to bring the device out of module standby. Document this in the bindings provided, so that new additions are not missed. Signed-off-by: Kieran Bingham--- Documentation/devicetree/bindings/media/renesas,fcp.txt | 5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt b/Documentation/devicetree/bindings/media/renesas,fcp.txt index 271dcfdb5a76..5be21b6411ba 100644 --- a/Documentation/devicetree/bindings/media/renesas,fcp.txt +++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt @@ -23,6 +23,10 @@ are paired with. These DT bindings currently support the FCPV and FCPF. - reg: the register base and size for the device registers - clocks: Reference to the functional clock +Optional properties: + - power-domains : power-domain property defined with a power domain specifier +to respective power domain. + Device node example --- @@ -31,4 +35,5 @@ Device node example compatible = "renesas,r8a7795-fcpv", "renesas,fcpv"; reg = <0 0xfea2f000 0 0x200>; clocks = < CPG_MOD 602>; + power-domains = < R8A7795_PD_A3VP>; }; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/3] dt-bindings: RCar FCP and FDP1 bindings
This updated series, has collected the Acked and Reviewed tags for the FCPF binding addition, and adds documention of the optional power-domain property for the FCP. Finally the FDP1 bindings have been updated following review from Laurent. Specifically, this removes the version specific compatibles as we have a HW version register available to us in the hardware so we can detect at run-time what device version we are running on. Kieran Bingham (3): dt-bindings: Update Renesas R-Car FCP DT binding dt-bindings: Document Renesas R-Car FCP power-domains usage dt-bindings: Add Renesas R-Car FDP1 bindings .../devicetree/bindings/media/renesas,fcp.txt | 9 +- .../devicetree/bindings/media/renesas,fdp1.txt | 33 ++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/media/renesas,fdp1.txt -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/10] dvb_frontend: create a new ops to help returning signals in dB
Hi Steven, Em Thu, 30 Jun 2016 09:48:30 -0400 Steven Tothescreveu: > > add a new ops that will allow tuners to better report the > > dB level of its AGC logic to the demod drivers. As the maximum > > gain may vary from tuner to tuner, we'll be reversing the > > logic here: instead of reporting the gain, let's report the > > attenuation. This way, converting from it to the legacy DVBv3 > > way is trivial. It is also easy to adjust the level of > > the received signal to dBm, as it is just a matter of adding > > an offset at the demod and/or at the bridge driver. > > Mauro, > > Have you verified this work with a detailed spectrum analysis study? > If so then please share. For example, by measuring the I/F out of > various tuners in a mix of use cases, with and without the AGC being > driven by any downstream demodulator? Also, taking into consideration > any external LNA variance. > > I'm concerned that a tuner AGC Gain is a meaningless measurement and > in practice demodulators don't actually care, and tuners don't > implement their gain reporting capabilities correctly at all. > > This feels like a solution to a problem that doesn't exist. The role idea here is to provide a rough estimation about the signal strength, and not to enter into the measurement instrument business. I know that the actual tuner AGC gain is not precise[1]: - it may vary with the frequency; - it may vary with the component variance; - it may vary with modulation parameters; - it may vary with the temperature. Yet, the signal strength is used on some software to detect "weak" signals and skip such transponders. There is such code, for example in Kaffeine since 2009: commit 73a5aae68ab46d761267043c9774289833b79dbc Author: Christoph Pfister Date: Sat Apr 25 13:41:28 2009 + add autoscan support + if ((signal != 0) && (signal < 0x2000)) { + // signal too weak + carry = false; + } The color on Kaffeine's gauge gradient bar also tries to express if the signal level is OK or not, showing only red for weak signals, and becoming green as the signal increases up to a certain level. The strength is also one parameters to estimate the signal quality. The libdvbv5 considers it, when reporting DTV_QUALITY parameter. So, the hole idea here is *not* to provide a precise measure, but to try to use about the same scale on the drivers, whenever possible. Regards, Mauro [1] I would give a 5-stars here for Siano: on the tests I did, the signal strength reported by the siano devices is very precise. Thanks, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL] doc: linux_tv DocBook to reST migration (docs-next)
Hi Mauro, this is the reST migration of the *media* DocBook-XML set [1]. Its based on your: https://git.linuxtv.org/mchehab/experimental.git mchehab/docs-next Since the flat-table patch is not yet in Jon's docs-next and your mchehab/docs-next is one behind Jon', I had to merge these patches. [1] http://mid.gmane.org/20160630071813.05a94...@recife.lan -- Markus -- PS: one week earlier than annonced [1] ... call "Mr. Wolf" ;-) The following changes since commit 4b194975b3173a8c96661aa3c2f2a101021a10fa: Merge pedra:/devel/v4l/patchwork into devel/docs-next (2016-06-24 07:31:30 -0300) are available in the git repository at: https://github.com/return42/linux.git linux_tv_migration for you to fetch changes up to d949b369ea505b6a0f43abe4ec32ce35a9adacd0: doc-rst: linux_tv DocBook to reST migration (docs-next) (2016-06-30 15:18:56 +0200) Jani Nikula (1): Documentation: add meta-documentation for Sphinx and kernel-doc Markus Heiser (3): doc-rst: flat-table directive - initial implementation Merge branch 'docs-next/flat-table' into linux_tv_migration doc-rst: linux_tv DocBook to reST migration (docs-next) Documentation/conf.py | 2 +- Documentation/index.rst | 2 + Documentation/kernel-documentation.rst | 647 +++ Documentation/linux_tv/audio.h.rst | 153 + Documentation/linux_tv/ca.h.rst | 108 + Documentation/linux_tv/conf.py | 221 + Documentation/linux_tv/dmx.h.rst | 173 + Documentation/linux_tv/frontend.h.rst | 620 ++ Documentation/linux_tv/index.rst | 100 + Documentation/linux_tv/media/dvb/FE_DISHNETWORK_SEND_LEGACY_CMD.rst |55 + Documentation/linux_tv/media/dvb/FE_GET_EVENT.rst |89 + Documentation/linux_tv/media/dvb/FE_GET_FRONTEND.rst |77 + Documentation/linux_tv/media/dvb/FE_READ_BER.rst |61 + Documentation/linux_tv/media/dvb/FE_READ_SIGNAL_STRENGTH.rst |64 + Documentation/linux_tv/media/dvb/FE_READ_SNR.rst |61 + Documentation/linux_tv/media/dvb/FE_READ_UNCORRECTED_BLOCKS.rst |66 + Documentation/linux_tv/media/dvb/FE_SET_FRONTEND.rst |84 + Documentation/linux_tv/media/dvb/audio.rst |37 + Documentation/linux_tv/media/dvb/audio_data_types.rst | 187 + Documentation/linux_tv/media/dvb/audio_function_calls.rst | 1308 + Documentation/linux_tv/media/dvb/audio_h.rst |24 + Documentation/linux_tv/media/dvb/ca.rst |29 + Documentation/linux_tv/media/dvb/ca_data_types.rst | 121 + Documentation/linux_tv/media/dvb/ca_function_calls.rst | 541 ++ Documentation/linux_tv/media/dvb/ca_h.rst |24 + Documentation/linux_tv/media/dvb/demux.rst |29 + Documentation/linux_tv/media/dvb/dmx_fcalls.rst | 1013 Documentation/linux_tv/media/dvb/dmx_h.rst |24 + Documentation/linux_tv/media/dvb/dmx_types.rst | 253 + Documentation/linux_tv/media/dvb/dtv-fe-stats.rst |28 + Documentation/linux_tv/media/dvb/dtv-properties.rst |26 + Documentation/linux_tv/media/dvb/dtv-property.rst |42 + Documentation/linux_tv/media/dvb/dtv-stats.rst |29 + Documentation/linux_tv/media/dvb/dvb-fe-read-status.rst |31 + Documentation/linux_tv/media/dvb/dvb-frontend-event.rst |26 + Documentation/linux_tv/media/dvb/dvb-frontend-parameters.rst | 130 + Documentation/linux_tv/media/dvb/dvbapi.rst |95 + Documentation/linux_tv/media/dvb/dvbproperty-006.rst |21 +
Re: [PATCH 08/10] dvb_frontend: create a new ops to help returning signals in dB
> add a new ops that will allow tuners to better report the > dB level of its AGC logic to the demod drivers. As the maximum > gain may vary from tuner to tuner, we'll be reversing the > logic here: instead of reporting the gain, let's report the > attenuation. This way, converting from it to the legacy DVBv3 > way is trivial. It is also easy to adjust the level of > the received signal to dBm, as it is just a matter of adding > an offset at the demod and/or at the bridge driver. Mauro, Have you verified this work with a detailed spectrum analysis study? If so then please share. For example, by measuring the I/F out of various tuners in a mix of use cases, with and without the AGC being driven by any downstream demodulator? Also, taking into consideration any external LNA variance. I'm concerned that a tuner AGC Gain is a meaningless measurement and in practice demodulators don't actually care, and tuners don't implement their gain reporting capabilities correctly at all. This feels like a solution to a problem that doesn't exist. -- Steven Toth - Kernel Labs http://www.kernellabs.com +1.646.355.8490 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] v4l: platform: Add Renesas R-Car FDP1 Driver
Version 2 of the FDP1 driver introduces support for deinterlacing on top of the previous patch which only supported pixel format conversion. The FDP1, (Fine Display Processor) is a de-interlacer device, with capability to convert from various YCbCr/YUV formats to both YCbCr/YUV and RGB formats at the same time as converting interlaced content to progressive. Kieran Bingham (1): v4l: platform: Add Renesas R-Car FDP1 Driver MAINTAINERS|9 + drivers/media/platform/Kconfig | 13 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_fdp1.c | 2395 4 files changed, 2418 insertions(+) create mode 100644 drivers/media/platform/rcar_fdp1.c -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] v4l: platform: Add Renesas R-Car FDP1 Driver
The FDP1 driver performs advanced de-interlacing on a memory 2 memory based video stream, and supports conversion from YCbCr/YUV to RGB pixel formats Signed-off-by: Kieran Bingham--- MAINTAINERS|9 + drivers/media/platform/Kconfig | 13 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_fdp1.c | 2395 4 files changed, 2418 insertions(+) create mode 100644 drivers/media/platform/rcar_fdp1.c diff --git a/MAINTAINERS b/MAINTAINERS index eb5e3b673c1d..985d243ff066 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7331,6 +7331,15 @@ F: Documentation/devicetree/bindings/media/renesas,fcp.txt F: drivers/media/platform/rcar-fcp.c F: include/media/rcar-fcp.h +MEDIA DRIVERS FOR RENESAS - FDP1 +M: Kieran Bingham +L: linux-media@vger.kernel.org +L: linux-renesas-...@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Supported +F: Documentation/devicetree/bindings/media/renesas,fdp1.txt +F: drivers/media/platform/rcar_fdp1.c + MEDIA DRIVERS FOR RENESAS - VSP1 M: Laurent Pinchart L: linux-media@vger.kernel.org diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 0141af8cfdbc..80cdc3b6efa3 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -235,6 +235,19 @@ config VIDEO_SH_VEU Support for the Video Engine Unit (VEU) on SuperH and SH-Mobile SoCs. +config VIDEO_RENESAS_FDP1 + tristate "Renesas Fine Display Processor" + depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA + depends on ARCH_SHMOBILE || COMPILE_TEST + select VIDEOBUF2_DMA_CONTIG + select V4L2_MEM2MEM_DEV + ---help--- + This is a V4L2 driver for the Renesas Fine Display Processor + providing colour space conversion, and de-interlacing features. + + To compile this driver as a module, choose M here: the module + will be called rcar_fdp1. + config VIDEO_RENESAS_JPU tristate "Renesas JPEG Processing Unit" depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index befc4f97057c..0c8a3ae7b6cb 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -47,6 +47,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o +obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o obj-$(CONFIG_VIDEO_RENESAS_VSP1) += vsp1/ diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c new file mode 100644 index ..c7280183262a --- /dev/null +++ b/drivers/media/platform/rcar_fdp1.c @@ -0,0 +1,2395 @@ +/* + * Renesas RCar Fine Display Processor + * + * Video format converter and frame deinterlacer device. + * + * Author: Kieran Bingham, + * Copyright (c) 2016 Renesas Electronics Corporation. + * + * This code is developed and inspired from the vim2m, rcar_jpu, + * m2m-deinterlace, and vsp1 drivers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the + * License, or (at your option) any later version + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static unsigned int debug; +module_param(debug, uint, 0644); +MODULE_PARM_DESC(debug, "activate debug info"); + +/* Min Width/Height/Height-Field */ +#define FDP1_MIN_W 80U +#define FDP1_MIN_H 80U + +#define FDP1_MAX_W 3840U +#define FDP1_MAX_H 2160U + +#define FDP1_MAX_PLANES3U + +/* Flags that indicate a format can be used for capture/output */ +#define FDP1_CAPTURE BIT(0) +#define FDP1_OUTPUTBIT(1) + +#define DRIVER_NAME"rcar_fdp1" + +/* Number of Job's to have available on the processing queue */ +#define FDP1_NUMBER_JOBS 8 +#define FDP1_NUMBER_BUFFERS ((FDP1_NUMBER_JOBS*2)+1) + +#define dprintk(fdp1, fmt, arg...) \ + v4l2_dbg(1, debug, >v4l2_dev, "%s: " fmt, __func__, ## arg) + +/* + * FDP1 registers and bits + */ + +/* FDP1 start register - Imm */ +#define FD1_CTL_CMD0x +#define FD1_CTL_CMD_STRCMD BIT(0) + +/* Sync generator register - Imm */ +#define FD1_CTL_SGCMD 0x0004 +#define FD1_CTL_SGCMD_SGEN BIT(0) + +/* Register set end register - Imm */ +#define FD1_CTL_REGEND 0x0008 +#define
[GIT PULL FOR v4.8] CEC updates
(This supersedes my previous CEC pull request) This adds the missing rc-cec keymap module, two bugfixes, Kconfig fixes from Arnd and it dual-licenses the headers for BSD, just as we do for videodev2.h. I originally thought the rc-cec module was already merged in the cec topic branch, but I later discovered that it wasn't. Regards, Hans The following changes since commit c7169ad5616229b87cabf886bc5f9cbd1fc35a5f: [media] DocBook/media: add CEC documentation (2016-06-28 11:45:24 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git cec-topic2 for you to fetch changes up to 145d64ffd3bc3ab1798d50128c806adf56e81c45: cec: add RC_CORE dependency (2016-06-30 14:41:30 +0200) Arnd Bergmann (3): s5p_cec: mark suspend/resume as __maybe_unused cec: add MEDIA_SUPPORT dependency cec: add RC_CORE dependency Hans Verkuil (3): cec-adap: on reply, restore the tx_status value from the transmit cec.h/cec-funcs.h: add option to use BSD license cec-adap: prevent write to out-of-bounds array index Kamil Debski (1): rc-cec: Add HDMI CEC keymap module drivers/media/rc/keymaps/Makefile | 1 + drivers/media/rc/keymaps/rc-cec.c | 182 + drivers/staging/media/cec/Kconfig | 2 ++ drivers/staging/media/cec/cec-adap.c| 14 +--- drivers/staging/media/s5p-cec/s5p_cec.c | 4 +-- include/linux/cec-funcs.h | 16 + include/linux/cec.h | 16 + 7 files changed, 228 insertions(+), 7 deletions(-) create mode 100644 drivers/media/rc/keymaps/rc-cec.c -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] v4l: ioctl: Clear the v4l2_pix_format_mplane reserved field
Hi Laurent, Thanks - this fixes the issue I saw. On 28/06/16 14:20, Laurent Pinchart wrote: > The S_FMT and TRY_FMT handlers in multiplane mode attempt at clearing > the reserved fields of the v4l2_format structure after the pix_mp > member. However, the reserved fields are inside pix_mp, not after it. > > Signed-off-by: Laurent PinchartTested-by: Kieran Bingham > --- > drivers/media/v4l2-core/v4l2-ioctl.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > Kieran, this should fix the v4l2-compliance failures you saw when not clearing > pix_mp.reserved manually in the FDP1 driver. Could you please test it ? > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c > b/drivers/media/v4l2-core/v4l2-ioctl.c > index 19d3aee3b374..86332072a575 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1508,7 +1508,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, > case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: > if (unlikely(!is_rx || !is_vid || > !ops->vidioc_s_fmt_vid_cap_mplane)) > break; > - CLEAR_AFTER_FIELD(p, fmt.pix_mp); > + CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); > return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg); > case V4L2_BUF_TYPE_VIDEO_OVERLAY: > if (unlikely(!is_rx || !is_vid || > !ops->vidioc_s_fmt_vid_overlay)) > @@ -1536,7 +1536,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, > case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: > if (unlikely(!is_tx || !is_vid || > !ops->vidioc_s_fmt_vid_out_mplane)) > break; > - CLEAR_AFTER_FIELD(p, fmt.pix_mp); > + CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); > return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg); > case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: > if (unlikely(!is_tx || !is_vid || > !ops->vidioc_s_fmt_vid_out_overlay)) > @@ -1598,7 +1598,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, > case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: > if (unlikely(!is_rx || !is_vid || > !ops->vidioc_try_fmt_vid_cap_mplane)) > break; > - CLEAR_AFTER_FIELD(p, fmt.pix_mp); > + CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); > return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg); > case V4L2_BUF_TYPE_VIDEO_OVERLAY: > if (unlikely(!is_rx || !is_vid || > !ops->vidioc_try_fmt_vid_overlay)) > @@ -1626,7 +1626,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, > case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: > if (unlikely(!is_tx || !is_vid || > !ops->vidioc_try_fmt_vid_out_mplane)) > break; > - CLEAR_AFTER_FIELD(p, fmt.pix_mp); > + CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); > return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg); > case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: > if (unlikely(!is_tx || !is_vid || > !ops->vidioc_try_fmt_vid_out_overlay)) > -- Regards Kieran Bingham -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [EXTERNAL] Re: Caspa Driver mt9v032
Could you give me an idea of what you mean in terms of C or from the Linux userspace? Thank you, Matthew Greci 505-280-1921 From: Laurent PinchartSent: Wednesday, June 29, 2016 5:23 PM To: Greci, Matthew J Subject: [EXTERNAL] Re: Caspa Driver mt9v032 Hi Matthew, On Wednesday 29 Jun 2016 14:18:00 Greci, Matthew J wrote: > Hello, > > I am running Poky Yocto on a Gumstix Overo board and I loaded the driver for > the Gumstix Caspa board which is called 'mt9v023'. Running 'modinfo > mt9v032' shows you are the author of mt9v032.ko. > > I was looking for a way to modify the driver source code to fix a yellow > tint/hue from appearing in all the images. I have tied to make adjusts via > ioctl() but it seems to V4L2 capabilities are possible. > > Please let me know if you are still working on this or not and if you can > help or can direct me to someone that can help. I'm not actively working on the mt9v032 driver anymore, but I can still try to help you. I would recommend CC'ing the linux-media@vger.kernel.org mailing list when requesting help from the community, as other developers subscribed to that list might be able to assist you as well. The MT9V032 sensor doesn't seem to have per-component gains, so I'm not sure you would be able to fix the problem through the sensor driver. You could however use the image processing feature of the OMAP3 ISP, and in particular of the preview engine, to set per-channel gains or perform other processing that could fix the problem. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] [media] vsp1: clarify FCP dependency
The newly added FCP support in the vsp1 driver causes a link error when CONFIG_RENESAS_FCP=m, since it's not reachable by built-in code: drivers/media/built-in.o: In function `vsp1_remove': :(.text+0xdeca0): undefined reference to `rcar_fcp_put' drivers/media/built-in.o: In function `vsp1_probe': :(.text+0xdef44): undefined reference to `rcar_fcp_get' We already have a conditional dependency on FCP that requires it for ARM64, so for all others we just have to prevent setting RENESAS_VSP1=y when RENESAS_FCP=m by extending the FCP dependency. Signed-off-by: Arnd BergmannFixes: 94fcdf829793 ("[media] v4l: vsp1: Add FCP support") --- drivers/media/platform/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 9d0a3ffe36d2..8b6ac7d08289 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -265,7 +265,7 @@ config VIDEO_RENESAS_VSP1 tristate "Renesas VSP1 Video Processing Engine" depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA depends on (ARCH_RENESAS && OF) || COMPILE_TEST - depends on !ARM64 || VIDEO_RENESAS_FCP + depends on (!ARM64 && !VIDEO_RENESAS_FCP) || VIDEO_RENESAS_FCP select VIDEOBUF2_DMA_CONTIG ---help--- This is a V4L2 driver for the Renesas VSP1 video processing engine. -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] [media] vsp1: use __maybe_unused for PM handlers
Building without CONFIG_PM results in a harmless warning from slightly incorrect #ifdef guards: drivers/media/platform/vsp1/vsp1_drv.c:525:12: error: 'vsp1_pm_runtime_resume' defined but not used [-Werror=unused-function] drivers/media/platform/vsp1/vsp1_drv.c:516:12: error: 'vsp1_pm_runtime_suspend' defined but not used [-Werror=unused-function] This removes the existing #ifdef and instead marks all four PM functions as __maybe_unused. Signed-off-by: Arnd BergmannFixes: 1e6af546ee66 ("[media] v4l: vsp1: Implement runtime PM support") --- drivers/media/platform/vsp1/vsp1_drv.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index e655639af7e2..0c7fd43d6fb7 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -491,8 +491,7 @@ void vsp1_device_put(struct vsp1_device *vsp1) * Power Management */ -#ifdef CONFIG_PM_SLEEP -static int vsp1_pm_suspend(struct device *dev) +static int __maybe_unused vsp1_pm_suspend(struct device *dev) { struct vsp1_device *vsp1 = dev_get_drvdata(dev); @@ -502,7 +501,7 @@ static int vsp1_pm_suspend(struct device *dev) return 0; } -static int vsp1_pm_resume(struct device *dev) +static int __maybe_unused vsp1_pm_resume(struct device *dev) { struct vsp1_device *vsp1 = dev_get_drvdata(dev); @@ -511,9 +510,8 @@ static int vsp1_pm_resume(struct device *dev) return 0; } -#endif -static int vsp1_pm_runtime_suspend(struct device *dev) +static int __maybe_unused vsp1_pm_runtime_suspend(struct device *dev) { struct vsp1_device *vsp1 = dev_get_drvdata(dev); @@ -522,7 +520,7 @@ static int vsp1_pm_runtime_suspend(struct device *dev) return 0; } -static int vsp1_pm_runtime_resume(struct device *dev) +static int __maybe_unused vsp1_pm_runtime_resume(struct device *dev) { struct vsp1_device *vsp1 = dev_get_drvdata(dev); int ret; -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] cec-adap: prevent write to out-of-bounds array index
CEC_MSG_REPORT_PHYSICAL_ADDR can theoretically be received from an unregistered device, but in that case the code should not attempt to write the received physical address to the phys_addrs array. That would be pointless since there can be multiple unregistered devices that report a physical address. We just ignore those. While at it, improve the dprintk since it would attempt to read from that array as well with the same out-of-bounds problem. Signed-off-by: Hans VerkuilReported-by: Dan Carpenter --- drivers/staging/media/cec/cec-adap.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c index 98bdcf9..307af43 100644 --- a/drivers/staging/media/cec/cec-adap.c +++ b/drivers/staging/media/cec/cec-adap.c @@ -1442,12 +1442,15 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, switch (msg->msg[1]) { /* The following messages are processed but still passed through */ - case CEC_MSG_REPORT_PHYSICAL_ADDR: - adap->phys_addrs[init_laddr] = - (msg->msg[2] << 8) | msg->msg[3]; - dprintk(1, "Reported physical address %04x for logical address %d\n", - adap->phys_addrs[init_laddr], init_laddr); + case CEC_MSG_REPORT_PHYSICAL_ADDR: { + u16 pa = (msg->msg[2] << 8) | msg->msg[3]; + + if (!from_unregistered) + adap->phys_addrs[init_laddr] = pa; + dprintk(1, "Reported physical address %x.%x.%x.%x for logical address %d\n", + cec_phys_addr_exp(pa), init_laddr); break; + } case CEC_MSG_USER_CONTROL_PRESSED: if (!(adap->capabilities & CEC_CAP_RC)) -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] cec.h/cec-funcs.h: add option to use BSD license
Like the videodev2.h and other headers, explicitly allow these headers to be used with the BSD license. Signed-off-by: Hans Verkuil--- include/linux/cec-funcs.h | 16 include/linux/cec.h | 16 2 files changed, 32 insertions(+) diff --git a/include/linux/cec-funcs.h b/include/linux/cec-funcs.h index 8ee1029..19486009 100644 --- a/include/linux/cec-funcs.h +++ b/include/linux/cec-funcs.h @@ -7,6 +7,22 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * + * Alternatively you can redistribute this file under the terms of the + * BSD license as stated below: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in + *the documentation and/or other materials provided with the + *distribution. + * 3. The names of its contributors may not be used to endorse or promote + *products derived from this software without specific prior written + *permission. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND diff --git a/include/linux/cec.h b/include/linux/cec.h index 40924e7..6678afe 100644 --- a/include/linux/cec.h +++ b/include/linux/cec.h @@ -7,6 +7,22 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * + * Alternatively you can redistribute this file under the terms of the + * BSD license as stated below: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in + *the documentation and/or other materials provided with the + *distribution. + * 3. The names of its contributors may not be used to endorse or promote + *products derived from this software without specific prior written + *permission. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] One fix, one license change
Dual license the CEC headers, just as we do for videodev2.h. Also fix an array out-of-bounds bug. Hans Verkuil (2): cec.h/cec-funcs.h: add option to use BSD license cec-adap: prevent write to out-of-bounds array index drivers/staging/media/cec/cec-adap.c | 13 - include/linux/cec-funcs.h| 16 include/linux/cec.h | 16 3 files changed, 40 insertions(+), 5 deletions(-) -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 18/44] [media] dma-mapping: Use unsigned long for dma_attrs
Hello, On 2016-06-30 10:25, Krzysztof Kozlowski wrote: Split out subsystem specific changes for easier reviews. This will be squashed with main commit. Signed-off-by: Krzysztof Kozlowski[for vb2-core] Reviewed-by: Marek Szyprowski Please note that vb2 code is being modified now by Hans Verkuil, who is working on complete removal of allocator contexts from vb2 queue. You can check his patches here: https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=context3 [for bdisp] Acked-by: Fabien Dessenne --- drivers/media/platform/sti/bdisp/bdisp-hw.c| 26 +++--- drivers/media/v4l2-core/videobuf2-dma-contig.c | 30 +++--- drivers/media/v4l2-core/videobuf2-dma-sg.c | 19 include/media/videobuf2-dma-contig.h | 7 ++ 4 files changed, 26 insertions(+), 56 deletions(-) diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c index 052c932ac942..d86ba40eec8d 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-hw.c +++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c @@ -125,14 +125,11 @@ int bdisp_hw_get_and_clear_irq(struct bdisp_dev *bdisp) */ void bdisp_hw_free_nodes(struct bdisp_ctx *ctx) { - if (ctx && ctx->node[0]) { - DEFINE_DMA_ATTRS(attrs); - - dma_set_attr(DMA_ATTR_WRITE_COMBINE, ); + if (ctx && ctx->node[0]) dma_free_attrs(ctx->bdisp_dev->dev, sizeof(struct bdisp_node) * MAX_NB_NODE, - ctx->node[0], ctx->node_paddr[0], ); - } + ctx->node[0], ctx->node_paddr[0], + DMA_ATTR_WRITE_COMBINE); } /** @@ -150,12 +147,10 @@ int bdisp_hw_alloc_nodes(struct bdisp_ctx *ctx) unsigned int i, node_size = sizeof(struct bdisp_node); void *base; dma_addr_t paddr; - DEFINE_DMA_ATTRS(attrs); /* Allocate all the nodes within a single memory page */ - dma_set_attr(DMA_ATTR_WRITE_COMBINE, ); base = dma_alloc_attrs(dev, node_size * MAX_NB_NODE, , - GFP_KERNEL | GFP_DMA, ); + GFP_KERNEL | GFP_DMA, DMA_ATTR_WRITE_COMBINE); if (!base) { dev_err(dev, "%s no mem\n", __func__); return -ENOMEM; @@ -188,13 +183,9 @@ void bdisp_hw_free_filters(struct device *dev) { int size = (BDISP_HF_NB * NB_H_FILTER) + (BDISP_VF_NB * NB_V_FILTER); - if (bdisp_h_filter[0].virt) { - DEFINE_DMA_ATTRS(attrs); - - dma_set_attr(DMA_ATTR_WRITE_COMBINE, ); + if (bdisp_h_filter[0].virt) dma_free_attrs(dev, size, bdisp_h_filter[0].virt, - bdisp_h_filter[0].paddr, ); - } + bdisp_h_filter[0].paddr, DMA_ATTR_WRITE_COMBINE); } /** @@ -211,12 +202,11 @@ int bdisp_hw_alloc_filters(struct device *dev) unsigned int i, size; void *base; dma_addr_t paddr; - DEFINE_DMA_ATTRS(attrs); /* Allocate all the filters within a single memory page */ size = (BDISP_HF_NB * NB_H_FILTER) + (BDISP_VF_NB * NB_V_FILTER); - dma_set_attr(DMA_ATTR_WRITE_COMBINE, ); - base = dma_alloc_attrs(dev, size, , GFP_KERNEL | GFP_DMA, ); + base = dma_alloc_attrs(dev, size, , GFP_KERNEL | GFP_DMA, + DMA_ATTR_WRITE_COMBINE); if (!base) return -ENOMEM; diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 5361197f3e57..8009a582326b 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -23,7 +23,7 @@ struct vb2_dc_conf { struct device *dev; - struct dma_attrsattrs; + unsigned long attrs; }; struct vb2_dc_buf { @@ -32,7 +32,7 @@ struct vb2_dc_buf { unsigned long size; void*cookie; dma_addr_t dma_addr; - struct dma_attrsattrs; + unsigned long attrs; enum dma_data_direction dma_dir; struct sg_table *dma_sgt; struct frame_vector *vec; @@ -135,7 +135,7 @@ static void vb2_dc_put(void *buf_priv) kfree(buf->sgt_base); } dma_free_attrs(buf->dev, buf->size, buf->cookie, buf->dma_addr, - >attrs); + buf->attrs); put_device(buf->dev); kfree(buf); } @@ -153,14 +153,14 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size, buf->attrs = conf->attrs; buf->cookie = dma_alloc_attrs(dev, size, >dma_addr, -
[PATCH v5 18/44] [media] dma-mapping: Use unsigned long for dma_attrs
Split out subsystem specific changes for easier reviews. This will be squashed with main commit. Signed-off-by: Krzysztof Kozlowski[for bdisp] Acked-by: Fabien Dessenne --- drivers/media/platform/sti/bdisp/bdisp-hw.c| 26 +++--- drivers/media/v4l2-core/videobuf2-dma-contig.c | 30 +++--- drivers/media/v4l2-core/videobuf2-dma-sg.c | 19 include/media/videobuf2-dma-contig.h | 7 ++ 4 files changed, 26 insertions(+), 56 deletions(-) diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c index 052c932ac942..d86ba40eec8d 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-hw.c +++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c @@ -125,14 +125,11 @@ int bdisp_hw_get_and_clear_irq(struct bdisp_dev *bdisp) */ void bdisp_hw_free_nodes(struct bdisp_ctx *ctx) { - if (ctx && ctx->node[0]) { - DEFINE_DMA_ATTRS(attrs); - - dma_set_attr(DMA_ATTR_WRITE_COMBINE, ); + if (ctx && ctx->node[0]) dma_free_attrs(ctx->bdisp_dev->dev, sizeof(struct bdisp_node) * MAX_NB_NODE, - ctx->node[0], ctx->node_paddr[0], ); - } + ctx->node[0], ctx->node_paddr[0], + DMA_ATTR_WRITE_COMBINE); } /** @@ -150,12 +147,10 @@ int bdisp_hw_alloc_nodes(struct bdisp_ctx *ctx) unsigned int i, node_size = sizeof(struct bdisp_node); void *base; dma_addr_t paddr; - DEFINE_DMA_ATTRS(attrs); /* Allocate all the nodes within a single memory page */ - dma_set_attr(DMA_ATTR_WRITE_COMBINE, ); base = dma_alloc_attrs(dev, node_size * MAX_NB_NODE, , - GFP_KERNEL | GFP_DMA, ); + GFP_KERNEL | GFP_DMA, DMA_ATTR_WRITE_COMBINE); if (!base) { dev_err(dev, "%s no mem\n", __func__); return -ENOMEM; @@ -188,13 +183,9 @@ void bdisp_hw_free_filters(struct device *dev) { int size = (BDISP_HF_NB * NB_H_FILTER) + (BDISP_VF_NB * NB_V_FILTER); - if (bdisp_h_filter[0].virt) { - DEFINE_DMA_ATTRS(attrs); - - dma_set_attr(DMA_ATTR_WRITE_COMBINE, ); + if (bdisp_h_filter[0].virt) dma_free_attrs(dev, size, bdisp_h_filter[0].virt, - bdisp_h_filter[0].paddr, ); - } + bdisp_h_filter[0].paddr, DMA_ATTR_WRITE_COMBINE); } /** @@ -211,12 +202,11 @@ int bdisp_hw_alloc_filters(struct device *dev) unsigned int i, size; void *base; dma_addr_t paddr; - DEFINE_DMA_ATTRS(attrs); /* Allocate all the filters within a single memory page */ size = (BDISP_HF_NB * NB_H_FILTER) + (BDISP_VF_NB * NB_V_FILTER); - dma_set_attr(DMA_ATTR_WRITE_COMBINE, ); - base = dma_alloc_attrs(dev, size, , GFP_KERNEL | GFP_DMA, ); + base = dma_alloc_attrs(dev, size, , GFP_KERNEL | GFP_DMA, + DMA_ATTR_WRITE_COMBINE); if (!base) return -ENOMEM; diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 5361197f3e57..8009a582326b 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -23,7 +23,7 @@ struct vb2_dc_conf { struct device *dev; - struct dma_attrsattrs; + unsigned long attrs; }; struct vb2_dc_buf { @@ -32,7 +32,7 @@ struct vb2_dc_buf { unsigned long size; void*cookie; dma_addr_t dma_addr; - struct dma_attrsattrs; + unsigned long attrs; enum dma_data_direction dma_dir; struct sg_table *dma_sgt; struct frame_vector *vec; @@ -135,7 +135,7 @@ static void vb2_dc_put(void *buf_priv) kfree(buf->sgt_base); } dma_free_attrs(buf->dev, buf->size, buf->cookie, buf->dma_addr, - >attrs); + buf->attrs); put_device(buf->dev); kfree(buf); } @@ -153,14 +153,14 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size, buf->attrs = conf->attrs; buf->cookie = dma_alloc_attrs(dev, size, >dma_addr, - GFP_KERNEL | gfp_flags, >attrs); + GFP_KERNEL | gfp_flags, buf->attrs); if (!buf->cookie) { dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size); kfree(buf); return ERR_PTR(-ENOMEM); } - if (!dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, >attrs)) + if
[PATCH v5 43/44] dma-mapping: Remove dma_get_attr
After switching DMA attributes to unsigned long it is easier to just compare the bits. Signed-off-by: Krzysztof Kozlowski[for avr32] Acked-by: Hans-Christian Noren Egtvedt [for arc] Acked-by: Vineet Gupta [for arm64 and dma-iommu] Acked-by: Robin Murphy --- Documentation/DMA-API.txt | 4 +-- arch/arc/mm/dma.c | 4 +-- arch/arm/mm/dma-mapping.c | 36 -- arch/arm/xen/mm.c | 4 +-- arch/arm64/mm/dma-mapping.c| 10 +++ arch/avr32/mm/dma-coherent.c | 4 +-- arch/ia64/sn/pci/pci_dma.c | 10 ++- arch/metag/kernel/dma.c| 2 +- arch/mips/mm/dma-default.c | 6 ++--- arch/openrisc/kernel/dma.c | 4 +-- arch/parisc/kernel/pci-dma.c | 2 +- arch/powerpc/platforms/cell/iommu.c| 12 - drivers/gpu/drm/rockchip/rockchip_drm_gem.c| 2 +- drivers/iommu/dma-iommu.c | 2 +- drivers/media/v4l2-core/videobuf2-dma-contig.c | 2 +- include/linux/dma-mapping.h| 10 --- 16 files changed, 47 insertions(+), 67 deletions(-) diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index 24f9688bb98a..1d26eeb6b5f6 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt @@ -422,9 +422,7 @@ void whizco_dma_map_sg_attrs(struct device *dev, dma_addr_t dma_addr, unsigned long attrs) { - int foo = dma_get_attr(DMA_ATTR_FOO, attrs); - - if (foo) + if (attrs & DMA_ATTR_FOO) /* twizzle the frobnozzle */ diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index 3d1f467d1792..74bbe68dce9d 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c @@ -46,7 +46,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size, * (vs. always going to memory - thus are faster) */ if ((is_isa_arcv2() && ioc_exists) || - dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs)) + (attrs & DMA_ATTR_NON_CONSISTENT)) need_coh = 0; /* @@ -95,7 +95,7 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr, struct page *page = virt_to_page(dma_handle); int is_non_coh = 1; - is_non_coh = dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs) || + is_non_coh = (attrs & DMA_ATTR_NON_CONSISTENT) || (is_isa_arcv2() && ioc_exists); if (PageHighMem(page) || !is_non_coh) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index ebb3fde99043..43e03b5293d0 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -126,7 +126,7 @@ static dma_addr_t arm_dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __dma_page_cpu_to_dev(page, offset, size, dir); return pfn_to_dma(dev, page_to_pfn(page)) + offset; } @@ -155,7 +155,7 @@ static dma_addr_t arm_coherent_dma_map_page(struct device *dev, struct page *pag static void arm_dma_unmap_page(struct device *dev, dma_addr_t handle, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0) __dma_page_dev_to_cpu(pfn_to_page(dma_to_pfn(dev, handle)), handle & ~PAGE_MASK, size, dir); } @@ -622,9 +622,9 @@ static void __free_from_contiguous(struct device *dev, struct page *page, static inline pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot) { - prot = dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs) ? - pgprot_writecombine(prot) : - pgprot_dmacoherent(prot); + prot = (attrs & DMA_ATTR_WRITE_COMBINE) ? + pgprot_writecombine(prot) : + pgprot_dmacoherent(prot); return prot; } @@ -744,7 +744,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, .gfp = gfp, .prot = prot, .caller = caller, - .want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs), + .want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0), }; #ifdef CONFIG_DMA_API_DEBUG @@ -887,7 +887,7 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, .size = PAGE_ALIGN(size), .cpu_addr = cpu_addr, .page =
[PATCH v5 00/44] dma-mapping: Use unsigned long for dma_attrs
Hi, This is fifth approach for replacing struct dma_attrs with unsigned long. The main patch (1/44) doing the change is split into many subpatches for easier review (2-42). They should be squashed together when applying. Rebased on v4.7-rc5. For easier testing the patchset is available here: repo: https://github.com/krzk/linux branch: for-next/dma-attrs-const-v5 Changes since v4 1. Collect some acks. Still need more. 2. Minor fixes pointed by Robin Murphy. 3. Applied changes from Bart Van Assche's comment. 4. More tests and builds (using https://www.kernel.org/pub/tools/crosstool/). Changes since v3 1. Collect some acks. 2. Drop wrong patch 1/45 ("powerpc: dma-mapping: Don't hard-code the value of DMA_ATTR_WEAK_ORDERING"). 3. Minor fix pointed out by Michael Ellerman. Changes since v2 1. Follow Christoph Hellwig's comments (don't use BIT add documentation, remove dma_get_attr). Rationale = The dma-mapping core and the implementations do not change the DMA attributes passed by pointer. Thus the pointer can point to const data. However the attributes do not have to be a bitfield. Instead unsigned long will do fine: 1. This is just simpler. Both in terms of reading the code and setting attributes. Instead of initializing local attributes on the stack and passing pointer to it to dma_set_attr(), just set the bits. 2. It brings safeness and checking for const correctness because the attributes are passed by value. Best regards, Krzysztof Krzysztof Kozlowski (44): dma-mapping: Use unsigned long for dma_attrs alpha: dma-mapping: Use unsigned long for dma_attrs arc: dma-mapping: Use unsigned long for dma_attrs ARM: dma-mapping: Use unsigned long for dma_attrs arm64: dma-mapping: Use unsigned long for dma_attrs avr32: dma-mapping: Use unsigned long for dma_attrs blackfin: dma-mapping: Use unsigned long for dma_attrs c6x: dma-mapping: Use unsigned long for dma_attrs cris: dma-mapping: Use unsigned long for dma_attrs frv: dma-mapping: Use unsigned long for dma_attrs drm/exynos: dma-mapping: Use unsigned long for dma_attrs drm/mediatek: dma-mapping: Use unsigned long for dma_attrs drm/msm: dma-mapping: Use unsigned long for dma_attrs drm/nouveau: dma-mapping: Use unsigned long for dma_attrs drm/rockship: dma-mapping: Use unsigned long for dma_attrs infiniband: dma-mapping: Use unsigned long for dma_attrs iommu: dma-mapping: Use unsigned long for dma_attrs [media] dma-mapping: Use unsigned long for dma_attrs xen: dma-mapping: Use unsigned long for dma_attrs swiotlb: dma-mapping: Use unsigned long for dma_attrs powerpc: dma-mapping: Use unsigned long for dma_attrs video: dma-mapping: Use unsigned long for dma_attrs x86: dma-mapping: Use unsigned long for dma_attrs iommu: intel: dma-mapping: Use unsigned long for dma_attrs h8300: dma-mapping: Use unsigned long for dma_attrs hexagon: dma-mapping: Use unsigned long for dma_attrs ia64: dma-mapping: Use unsigned long for dma_attrs m68k: dma-mapping: Use unsigned long for dma_attrs metag: dma-mapping: Use unsigned long for dma_attrs microblaze: dma-mapping: Use unsigned long for dma_attrs mips: dma-mapping: Use unsigned long for dma_attrs mn10300: dma-mapping: Use unsigned long for dma_attrs nios2: dma-mapping: Use unsigned long for dma_attrs openrisc: dma-mapping: Use unsigned long for dma_attrs parisc: dma-mapping: Use unsigned long for dma_attrs misc: mic: dma-mapping: Use unsigned long for dma_attrs s390: dma-mapping: Use unsigned long for dma_attrs sh: dma-mapping: Use unsigned long for dma_attrs sparc: dma-mapping: Use unsigned long for dma_attrs tile: dma-mapping: Use unsigned long for dma_attrs unicore32: dma-mapping: Use unsigned long for dma_attrs xtensa: dma-mapping: Use unsigned long for dma_attrs dma-mapping: Remove dma_get_attr dma-mapping: Document the DMA attributes next to the declaration Documentation/DMA-API.txt | 33 +++--- Documentation/DMA-attributes.txt | 2 +- arch/alpha/include/asm/dma-mapping.h | 2 - arch/alpha/kernel/pci-noop.c | 2 +- arch/alpha/kernel/pci_iommu.c | 12 +- arch/arc/mm/dma.c | 12 +- arch/arm/common/dmabounce.c| 4 +- arch/arm/include/asm/dma-mapping.h | 13 +-- arch/arm/include/asm/xen/page-coherent.h | 16 +-- arch/arm/mm/dma-mapping.c | 117 +-- arch/arm/xen/mm.c | 8 +- arch/arm64/mm/dma-mapping.c| 66 +-- arch/avr32/mm/dma-coherent.c | 12 +- arch/blackfin/kernel/dma-mapping.c | 8 +- arch/c6x/include/asm/dma-mapping.h | 4 +- arch/c6x/kernel/dma.c |
Re: [PATCH] media: s5p-mfc fix vidioc_g_crop() to return crop info.
On 06/30/2016 01:33 AM, Shuah Khan wrote: > Fix vidioc_g_crop() to report crop information irrepective of ctx state. > g_crop is expected to return crop information as long as the passed in > v4l2_crop type field is vV4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE. > > Signed-off-by: Shuah Khan> --- > drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 9 +++-- > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c > b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c > index a01a373..4ace9e1 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c > @@ -774,12 +774,9 @@ static int vidioc_g_crop(struct file *file, void *priv, > struct s5p_mfc_dev *dev = ctx->dev; > u32 left, right, top, bottom; > > - if (ctx->state != MFCINST_HEAD_PARSED && > - ctx->state != MFCINST_RUNNING && ctx->state != MFCINST_FINISHING > - && ctx->state != MFCINST_FINISHED) { > - mfc_err("Cannont set crop\n"); > - return -EINVAL; > - } Well, without this information all you can do is to return a fake rectangle. The decoder needs to have parsed the header to know the size. > + if (cr->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) Actually, this should be V4L2_BUF_TYPE_VIDEO_OUTPUT. See the spec. I actually wonder why there is a g_crop at all since without a s_crop it doesn't provide any useful information. And if it is needed, then g_selection is the right callback since g_crop for output provides the compose rectangle, not the crop rectangle (one of the reasons we introduced g/s_selection). Regards, Hans > + return -EINVAL; > + > if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) { > left = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_h, ctx); > right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT; > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html