Re: [media 2/8] NXP tda2014x & Newport Media nm120/130/131 tuner (PXQ3PE)
Hi Буди, [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.6-rc1 next-20160331] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: x86_64-randconfig-s5-04011138 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 Note: the linux-review/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 HEAD a28878c9675f849df56f4623c33ca431f03e240a builds fine. It only hurts bisectibility. All errors (new ones prefixed by >>): >> make[4]: *** No rule to make target 'drivers/media/tuners/qm1d1c004x.c', >> needed by 'drivers/media/tuners/qm1d1c004x.o'. make[4]: Target '__build' not remade because of errors. --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [media 7/8] PCIE bridge driver for PT3 & PX-Q3PE
Hi Буди, [auto build test WARNING on linuxtv-media/master] [also build test WARNING on v4.6-rc1 next-20160331] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: i386-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/media/pci/ptx/pxq3pe_pci.c: In function 'pxq3pe_remove': drivers/media/pci/ptx/pxq3pe_pci.c:484:3: error: implicit declaration of function 'vfree' [-Werror=implicit-function-declaration] vfree(p->sBuf); ^ drivers/media/pci/ptx/pxq3pe_pci.c: In function 'pxq3pe_probe': drivers/media/pci/ptx/pxq3pe_pci.c:536:14: error: implicit declaration of function 'vzalloc' [-Werror=implicit-function-declaration] p->sBuf = vzalloc(p->sBufSize); ^ >> drivers/media/pci/ptx/pxq3pe_pci.c:536:12: warning: assignment makes pointer >> from integer without a cast [-Wint-conversion] p->sBuf = vzalloc(p->sBufSize); ^ cc1: some warnings being treated as errors vim +536 drivers/media/pci/ptx/pxq3pe_pci.c 478 if (c->dma.dat) 479 pci_free_consistent(card->pdev, c->dma.sz, c->dma.dat, c->dma.adr); 480 for (i = 0; i < card->adapn; i++) { 481 struct ptx_adap *adap = >adap[i]; 482 struct pxq3pe_adap *p = adap->priv; 483 > 484 vfree(p->sBuf); 485 } 486 if (c->bar) 487 pci_iounmap(pdev, c->bar); 488 ptx_unregister_adap(card); 489 } 490 491 static const struct i2c_algorithm pxq3pe_algo = { 492 .functionality = ptx_i2c_func, 493 .master_xfer= pxq3pe_xfr, 494 }; 495 496 static int pxq3pe_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) 497 { 498 struct ptx_subdev_info pxq3pe_subdev_info[] = { 499 {SYS_ISDBT, 0x20, TC90522_MODNAME, 0x10, NM131_MODNAME}, 500 {SYS_ISDBS, 0x22, TC90522_MODNAME, 0x11, TDA2014X_MODNAME}, 501 {SYS_ISDBT, 0x24, TC90522_MODNAME, 0x12, NM131_MODNAME}, 502 {SYS_ISDBS, 0x26, TC90522_MODNAME, 0x13, TDA2014X_MODNAME}, 503 {SYS_ISDBT, 0x28, TC90522_MODNAME, 0x14, NM131_MODNAME}, 504 {SYS_ISDBS, 0x2A, TC90522_MODNAME, 0x15, TDA2014X_MODNAME}, 505 {SYS_ISDBT, 0x2C, TC90522_MODNAME, 0x16, NM131_MODNAME}, 506 {SYS_ISDBS, 0x2E, TC90522_MODNAME, 0x17, TDA2014X_MODNAME}, 507 }; 508 struct ptx_card *card = ptx_alloc(pdev, KBUILD_MODNAME, ARRAY_SIZE(pxq3pe_subdev_info), 509 sizeof(struct pxq3pe_card), sizeof(struct pxq3pe_adap), pxq3pe_lnb); 510 struct pxq3pe_card *c; 511 u8 regctl = 0xA0, 512 i; 513 u16 cfg; 514 int err = !card || pci_read_config_word(pdev, PCI_COMMAND, ); 515 516 if (err) 517 return ptx_abort(pdev, pxq3pe_remove, err, "Memory/PCI error, card=%p", card); 518 c = card->priv; 519 if (!(cfg & PCI_COMMAND_MASTER)) { 520 pci_set_master(pdev); 521 pci_read_config_word(pdev, PCI_COMMAND, ); 522 if (!(cfg & PCI_COMMAND_MASTER)) 523 return ptx_abort(pdev, pxq3pe_remove, -EIO, "Bus Mastering is disabled"); 524 } 525 c->bar = pci_iomap(pdev, 0, 0); 526 if (!c->bar) 527 return ptx_abort(pdev, pxq3pe_remove, -EIO, "I/O map failed"); 528 if (ptx_i2c_add_adapter(card, _algo)) 529 return ptx_abort(pdev, pxq3pe_remove, -EIO, "Cannot add I2C"); 530 531 for (i = 0; i < card->adapn; i++) { 532 struct ptx_adap *adap = >adap[i]; 533 struct pxq3pe_adap *p = adap->priv; 534 535 p->sBufSize = PTX_TS_SIZE * 100 << 9; > 536 p->sBuf = vzalloc(p->sBufSize); 537 if (!p->sBuf) 538 return ptx_abort(pdev, pxq3pe_remove, -ENOMEM, "No memory for stream buffer"); 539 } --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [media 2/8] NXP tda2014x & Newport Media nm120/130/131 tuner (PXQ3PE)
Hi Буди, [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.6-rc1 next-20160331] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: x86_64-randconfig-s0-04011126 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 Note: the linux-review/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 HEAD a28878c9675f849df56f4623c33ca431f03e240a builds fine. It only hurts bisectibility. All errors (new ones prefixed by >>): >> make[4]: *** No rule to make target 'drivers/media/tuners/qm1d1c004x.o', >> needed by 'drivers/media/tuners/built-in.o'. make[4]: Target '__build' not remade because of errors. --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
conflict DD-cine C/T V7 with older dvb-cards
Hello, I recently bought a cine C/T V7 DVB-card from digital devices and I realized some strange behaviour. The older dvb-cards are KNC or Mystique dvb-C cards that work fine for years. When I compile the driver from digital devices, the cine C/T works fine, but the older cards stop with errors. I did a quick search and diff and found out, that digital devices provides a dvb_core aparently incompatible with the dvb_core from kernel. I don't have any idea of kernel or driver hacking. Is anybody out there, who can help with that drama? best regards Reinhard -- 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: [media 7/8] PCIE bridge driver for PT3 & PX-Q3PE
Hi Буди, [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.6-rc1 next-20160331] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/info-are-ma/DVB-driver-for-Earthsoft-PT3-PLEX-PX-Q3PE-ISDB-S-T-PCIE-cards-PX-BCUD-ISDB-S-USB-dongle/20160401-034740 base: git://linuxtv.org/media_tree.git master config: i386-allyesconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): >> drivers/media/pci/ptx/ptx_common.c:187:536: error: 'KBUILD_MODNAME' >> undeclared here (not in a function) >> drivers/media/pci/ptx/ptx_common.c:187:551: error: expected ',' or ';' >> before string constant vim +/KBUILD_MODNAME +187 drivers/media/pci/ptx/ptx_common.c 181 pci_release_regions(card->pdev); 182 pci_set_drvdata(card->pdev, NULL); 183 pci_disable_device(card->pdev); 184 kfree(card); 185 } 186 > 187 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adap_no); 188 int ptx_register_adap(struct ptx_card *card, const struct ptx_subdev_info *info, 189 int (*thread)(void *), int (*dma)(struct ptx_adap *, bool)) 190 { --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH 4/4] mtd: provide helper to prepare buffers for DMA operations
Hi Boris, [auto build test ERROR on spi/for-next] [also build test ERROR on v4.6-rc1 next-20160331] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Boris-Brezillon/scatterlist-sg_table-from-virtual-pointer/20160331-203118 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi for-next config: m32r-m32104ut_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=m32r All error/warnings (new ones prefixed by >>): In file included from include/linux/mtd/super.h:17:0, from fs/romfs/storage.c:13: >> include/linux/mtd/mtd.h:426:10: error: expected ';', ',' or ')' before 'enum' enum dma_data_direction dir) ^ include/linux/mtd/mtd.h: In function 'mtd_unmap_buf': >> include/linux/mtd/mtd.h:434:2: warning: 'return' with a value, in function >> returning void return -ENOTSUPP; ^ fs/romfs/storage.c: At top level: include/linux/mtd/mtd.h:431:13: warning: 'mtd_unmap_buf' defined but not used [-Wunused-function] static void mtd_unmap_buf(struct mtd_info *mtd, struct device *dev, ^ -- In file included from include/linux/mtd/super.h:17:0, from fs/romfs/super.c:72: >> include/linux/mtd/mtd.h:426:10: error: expected ';', ',' or ')' before 'enum' enum dma_data_direction dir) ^ include/linux/mtd/mtd.h: In function 'mtd_unmap_buf': >> include/linux/mtd/mtd.h:434:2: warning: 'return' with a value, in function >> returning void return -ENOTSUPP; ^ fs/romfs/super.c: At top level: include/linux/mtd/mtd.h:431:13: warning: 'mtd_unmap_buf' defined but not used [-Wunused-function] static void mtd_unmap_buf(struct mtd_info *mtd, struct device *dev, ^ vim +426 include/linux/mtd/mtd.h 420 struct sg_table *sgt, enum dma_data_direction dir); 421 #else 422 static inline int mtd_map_buf(struct mtd_info *mtd, struct device *dev, 423struct sg_table *sgt, const void *buf, 424size_t len, 425const struct sg_constraints *constraints > 426enum dma_data_direction dir) 427 { 428 return -ENOTSUPP; 429 } 430 431 static void mtd_unmap_buf(struct mtd_info *mtd, struct device *dev, 432struct sg_table *sgt, enum dma_data_direction dir) 433 { > 434 return -ENOTSUPP; 435 } 436 #endif 437 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
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 Apr 1 04:00:17 CEST 2016 git branch: test git hash: d3f5193019443ef8e556b64f3cd359773c4d377b gcc version:i686-linux-gcc (GCC) 5.3.0 sparse version: v0.5.0-56-g7647c77 smatch version: v0.5.0-3353-gcae47da host hardware: x86_64 host os:4.4.0-164 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-exynos: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-omap1: OK linux-git-arm-pxa: OK linux-git-blackfin-bf561: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.36.4-i686: ERRORS linux-2.6.37.6-i686: ERRORS linux-2.6.38.8-i686: ERRORS linux-2.6.39.4-i686: ERRORS linux-3.0.60-i686: ERRORS linux-3.1.10-i686: ERRORS linux-3.2.37-i686: ERRORS linux-3.3.8-i686: ERRORS linux-3.4.27-i686: ERRORS linux-3.5.7-i686: ERRORS linux-3.6.11-i686: ERRORS linux-3.7.4-i686: ERRORS linux-3.8-i686: ERRORS linux-3.9.2-i686: ERRORS linux-3.10.1-i686: ERRORS linux-3.11.1-i686: ERRORS linux-3.12.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: OK linux-4.1.1-i686: OK linux-4.2-i686: OK linux-4.3-i686: OK linux-4.4-i686: OK linux-4.5-i686: OK linux-4.6-rc1-i686: OK linux-2.6.36.4-x86_64: ERRORS linux-2.6.37.6-x86_64: ERRORS linux-2.6.38.8-x86_64: ERRORS linux-2.6.39.4-x86_64: ERRORS linux-3.0.60-x86_64: ERRORS linux-3.1.10-x86_64: ERRORS linux-3.2.37-x86_64: ERRORS linux-3.3.8-x86_64: ERRORS linux-3.4.27-x86_64: ERRORS linux-3.5.7-x86_64: ERRORS linux-3.6.11-x86_64: ERRORS linux-3.7.4-x86_64: ERRORS linux-3.8-x86_64: ERRORS linux-3.9.2-x86_64: ERRORS linux-3.10.1-x86_64: ERRORS linux-3.11.1-x86_64: ERRORS linux-3.12.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: OK linux-4.1.1-x86_64: OK linux-4.2-x86_64: OK linux-4.3-x86_64: OK linux-4.4-x86_64: OK linux-4.5-x86_64: OK linux-4.6-rc1-x86_64: ERRORS apps: OK spec-git: OK sparse: WARNINGS smatch: ERRORS 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
Re: [PATCHv14 05/18] HID: add HDMI CEC specific keycodes
On Fri, Mar 25, 2016 at 02:10:03PM +0100, Hans Verkuil wrote: > From: Kamil Debski> > Add HDMI CEC specific keycodes to the keycodes definition. > > Signed-off-by: Kamil Debski > Signed-off-by: Hans Verkuil Acked-by: Dmitry Torokhov > --- > include/uapi/linux/input-event-codes.h | 30 ++ > 1 file changed, 30 insertions(+) > > diff --git a/include/uapi/linux/input-event-codes.h > b/include/uapi/linux/input-event-codes.h > index 87cf351..02b7b3a 100644 > --- a/include/uapi/linux/input-event-codes.h > +++ b/include/uapi/linux/input-event-codes.h > @@ -611,6 +611,36 @@ > #define KEY_KBDINPUTASSIST_ACCEPT0x264 > #define KEY_KBDINPUTASSIST_CANCEL0x265 > > +/* Diagonal movement keys */ > +#define KEY_RIGHT_UP 0x266 > +#define KEY_RIGHT_DOWN 0x267 > +#define KEY_LEFT_UP 0x268 > +#define KEY_LEFT_DOWN0x269 > + > +#define KEY_ROOT_MENU0x26a /* Show Device's Root > Menu */ > +#define KEY_MEDIA_TOP_MENU 0x26b /* Show Top Menu of the Media > (e.g. DVD) */ > +#define KEY_NUMERIC_11 0x26c > +#define KEY_NUMERIC_12 0x26d > +/* > + * Toggle Audio Description: refers to an audio service that helps blind and > + * visually impaired consumers understand the action in a program. Note: in > + * some countries this is referred to as "Video Description". > + */ > +#define KEY_AUDIO_DESC 0x26e > +#define KEY_3D_MODE 0x26f > +#define KEY_NEXT_FAVORITE0x270 > +#define KEY_STOP_RECORD 0x271 > +#define KEY_PAUSE_RECORD 0x272 > +#define KEY_VOD 0x273 /* Video on Demand */ > +#define KEY_UNMUTE 0x274 > +#define KEY_FASTREVERSE 0x275 > +#define KEY_SLOWREVERSE 0x276 > +/* > + * Control a data application associated with the currently viewed channel, > + * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) > + */ > +#define KEY_DATA 0x275 > + > #define BTN_TRIGGER_HAPPY0x2c0 > #define BTN_TRIGGER_HAPPY1 0x2c0 > #define BTN_TRIGGER_HAPPY2 0x2c1 > -- > 2.7.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Dmitry -- 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
[media 5/8] MaxLinear MxL301RF ISDB-T tuner
From: Буди Романто, AreMa IncSigned-off-by: Буди Романто, AreMa Inc --- drivers/media/tuners/mxl301rf.c | 220 drivers/media/tuners/mxl301rf.h | 23 + 2 files changed, 243 insertions(+) create mode 100644 drivers/media/tuners/mxl301rf.c create mode 100644 drivers/media/tuners/mxl301rf.h diff --git a/drivers/media/tuners/mxl301rf.c b/drivers/media/tuners/mxl301rf.c new file mode 100644 index 000..916b06f --- /dev/null +++ b/drivers/media/tuners/mxl301rf.c @@ -0,0 +1,220 @@ +/* + Sharp VA4M6JC2103 - Earthsoft PT3 ISDB-T tuner MaxLinear CMOS Hybrid TV MxL301RF + + Copyright (C) Budi Rachmanto, AreMa Inc. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +*/ + +#include "dvb_frontend.h" +#include "mxl301rf.h" + +int mxl301rf_w(struct dvb_frontend *fe, u8 slvadr, const u8 *dat, int len) +{ + struct i2c_client *d = fe->demodulator_priv; + u8 buf[len + 1]; + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0, .buf = buf, .len = len + 1,}, + }; + + buf[0] = slvadr; + memcpy(buf + 1, dat, len); + return i2c_transfer(d->adapter, msg, 1) == 1 ? 0 : -EIO; +} + +int mxl301rf_w_tuner(struct dvb_frontend *fe, const u8 *dat, int len) +{ + u8 buf[len + 1]; + + buf[0] = ((struct i2c_client *)fe->tuner_priv)->addr << 1; + memcpy(buf + 1, dat, len); + return mxl301rf_w(fe, 0xFE, buf, len + 1); +} + +u8 mxl301rf_r(struct dvb_frontend *fe, u8 regadr) +{ + struct i2c_client *d = fe->demodulator_priv, + *t = fe->tuner_priv; + u8 wbuf[] = {0xFB, regadr}, + rbuf[] = {0xFE, (t->addr << 1) | 1, 0}; + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0,.buf= rbuf, .len= 2,}, + {.addr = d->addr, .flags = I2C_M_RD, .buf= rbuf + 2, .len= 1,}, + }; + mxl301rf_w_tuner(fe, wbuf, sizeof(wbuf)); + return t->addr && (i2c_transfer(d->adapter, msg, 2) == 2) ? rbuf[2] : 0; +} + +enum mxl301rf_agc { + MXL301RF_AGC_AUTO, + MXL301RF_AGC_MANUAL, +}; + +int mxl301rf_set_agc(struct dvb_frontend *fe, enum mxl301rf_agc agc) +{ + u8 dat = agc == MXL301RF_AGC_AUTO ? 0x40 : 0x00, + imsrst = 0x01 << 6; + int err = mxl301rf_w(fe, 0x25, , 1); + + dat = 0x4c | (agc == MXL301RF_AGC_AUTO ? 0 : 1); + return err || + mxl301rf_w(fe, 0x23, , 1) || + mxl301rf_w(fe, 0x01, , 1); +} + +int mxl301rf_sleep(struct dvb_frontend *fe) +{ + u8 buf = (1 << 7) | (1 << 4), + dat[] = {0x01, 0x00, 0x13, 0x00}; + int err = mxl301rf_set_agc(fe, MXL301RF_AGC_MANUAL); + + if (err) + return err; + mxl301rf_w_tuner(fe, dat, sizeof(dat)); + return mxl301rf_w(fe, 0x03, , 1); +} + +int mxl301rf_tune(struct dvb_frontend *fe) +{ + struct shf_dvbt { + u32 freq, /* Channel center frequency @ kHz */ + freq_th;/* Offset frequency threshold @ kHz */ + u8 shf_val,/* Spur shift value */ + shf_dir;/* Spur shift direction */ + } shf_dvbt_tab[] = { + { 64500, 500, 0x92, 0x07}, + {191500, 300, 0xe2, 0x07}, + {205500, 500, 0x2c, 0x04}, + {212500, 500, 0x1e, 0x04}, + {226500, 500, 0xd4, 0x07}, + { 99143, 500, 0x9c, 0x07}, + {173143, 500, 0xd4, 0x07}, + {191143, 300, 0xd4, 0x07}, + {207143, 500, 0xce, 0x07}, + {225143, 500, 0xce, 0x07}, + {243143, 500, 0xd4, 0x07}, + {261143, 500, 0xd4, 0x07}, + {291143, 500, 0xd4, 0x07}, + {339143, 500, 0x2c, 0x04}, + {117143, 500, 0x7a, 0x07}, + {135143, 300, 0x7a, 0x07}, + {153143, 500, 0x01, 0x07} + }; + u8 rf_dat[] = { + 0x13, 0x00, /* abort tune */ + 0x3b, 0xc0, + 0x3b, 0x80, + 0x10, 0x95, /* BW */ + 0x1a, 0x05, + 0x61, 0x00, + 0x62, 0xa0, + 0x11, 0x40, /* 2 bytes to store RF */ + 0x12, 0x0e, /* 2 bytes to store RF */ + 0x13, 0x01 /* start tune */ + }; + const u8 idac[] = {
[media 3/8] drop backstabbing drivers
From: Буди Романто, AreMa IncObsoleted & superseded, please read cover letter for details. Signed-off-by: Буди Романто, AreMa Inc --- drivers/media/dvb-frontends/tc90522.c | 840 drivers/media/dvb-frontends/tc90522.h | 42 -- drivers/media/pci/pt3/Kconfig | 10 - drivers/media/pci/pt3/Makefile| 8 - drivers/media/pci/pt3/pt3.c | 874 -- drivers/media/pci/pt3/pt3.h | 186 drivers/media/pci/pt3/pt3_dma.c | 225 - drivers/media/pci/pt3/pt3_i2c.c | 240 -- drivers/media/tuners/mxl301rf.c | 349 -- drivers/media/tuners/mxl301rf.h | 26 - drivers/media/tuners/qm1d1c0042.c | 448 - drivers/media/tuners/qm1d1c0042.h | 37 -- 12 files changed, 3285 deletions(-) delete mode 100644 drivers/media/dvb-frontends/tc90522.c delete mode 100644 drivers/media/dvb-frontends/tc90522.h delete mode 100644 drivers/media/pci/pt3/Kconfig delete mode 100644 drivers/media/pci/pt3/Makefile delete mode 100644 drivers/media/pci/pt3/pt3.c delete mode 100644 drivers/media/pci/pt3/pt3.h delete mode 100644 drivers/media/pci/pt3/pt3_dma.c delete mode 100644 drivers/media/pci/pt3/pt3_i2c.c delete mode 100644 drivers/media/tuners/mxl301rf.c delete mode 100644 drivers/media/tuners/mxl301rf.h delete mode 100644 drivers/media/tuners/qm1d1c0042.c delete mode 100644 drivers/media/tuners/qm1d1c0042.h diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c deleted file mode 100644 index 31cd325..000 --- a/drivers/media/dvb-frontends/tc90522.c +++ /dev/null @@ -1,840 +0,0 @@ -/* - * Toshiba TC90522 Demodulator - * - * Copyright (C) 2014 Akihiro Tsukada - * - * 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 version 2. - * - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* - * NOTICE: - * This driver is incomplete and lacks init/config of the chips, - * as the necessary info is not disclosed. - * It assumes that users of this driver (such as a PCI bridge of - * DTV receiver cards) properly init and configure the chip - * via I2C *before* calling this driver's init() function. - * - * Currently, PT3 driver is the only one that uses this driver, - * and contains init/config code in its firmware. - * Thus some part of the code might be dependent on PT3 specific config. - */ - -#include -#include -#include -#include "dvb_math.h" -#include "tc90522.h" - -#define TC90522_I2C_THRU_REG 0xfe - -#define TC90522_MODULE_IDX(addr) (((u8)(addr) & 0x02U) >> 1) - -struct tc90522_state { - struct tc90522_config cfg; - struct dvb_frontend fe; - struct i2c_client *i2c_client; - struct i2c_adapter tuner_i2c; - - bool lna; -}; - -struct reg_val { - u8 reg; - u8 val; -}; - -static int -reg_write(struct tc90522_state *state, const struct reg_val *regs, int num) -{ - int i, ret; - struct i2c_msg msg; - - ret = 0; - msg.addr = state->i2c_client->addr; - msg.flags = 0; - msg.len = 2; - for (i = 0; i < num; i++) { - msg.buf = (u8 *)[i]; - ret = i2c_transfer(state->i2c_client->adapter, , 1); - if (ret == 0) - ret = -EIO; - if (ret < 0) - return ret; - } - return 0; -} - -static int reg_read(struct tc90522_state *state, u8 reg, u8 *val, u8 len) -{ - struct i2c_msg msgs[2] = { - { - .addr = state->i2c_client->addr, - .flags = 0, - .buf = , - .len = 1, - }, - { - .addr = state->i2c_client->addr, - .flags = I2C_M_RD, - .buf = val, - .len = len, - }, - }; - int ret; - - ret = i2c_transfer(state->i2c_client->adapter, msgs, ARRAY_SIZE(msgs)); - if (ret == ARRAY_SIZE(msgs)) - ret = 0; - else if (ret >= 0) - ret = -EIO; - return ret; -} - -static struct tc90522_state *cfg_to_state(struct tc90522_config *c) -{ - return container_of(c, struct tc90522_state, cfg); -} - - -static int tc90522s_set_tsid(struct dvb_frontend *fe) -{ - struct reg_val set_tsid[] = { - { 0x8f, 00 }, - { 0x90, 00 } - }; - - set_tsid[0].val = (fe->dtv_property_cache.stream_id & 0xff00) >> 8; - set_tsid[1].val =
[media 2/8] NXP tda2014x & Newport Media nm120/130/131 tuner (PXQ3PE)
From: Буди Романто, AreMa IncNXP tda2014x & Newport Media nm120/130/131 tuner drivers for PLEX PX-Q3PE Signed-off-by: Буди Романто, AreMa Inc --- drivers/media/tuners/Kconfig| 21 ++- drivers/media/tuners/Makefile | 4 +- drivers/media/tuners/nm131.c| 248 + drivers/media/tuners/nm131.h| 13 ++ drivers/media/tuners/tda2014x.c | 342 drivers/media/tuners/tda2014x.h | 13 ++ 6 files changed, 637 insertions(+), 4 deletions(-) create mode 100644 drivers/media/tuners/nm131.c create mode 100644 drivers/media/tuners/nm131.h create mode 100644 drivers/media/tuners/tda2014x.c create mode 100644 drivers/media/tuners/tda2014x.h diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig index 05998f0..a7f044b 100644 --- a/drivers/media/tuners/Kconfig +++ b/drivers/media/tuners/Kconfig @@ -271,10 +271,25 @@ config MEDIA_TUNER_MXL301RF help MaxLinear MxL301RF OFDM tuner driver. -config MEDIA_TUNER_QM1D1C0042 - tristate "Sharp QM1D1C0042 tuner" +config MEDIA_TUNER_QM1D1C004X + tristate "Sharp QM1D1C004x tuner" depends on MEDIA_SUPPORT && I2C default m if !MEDIA_SUBDRV_AUTOSELECT help - Sharp QM1D1C0042 trellis coded 8PSK tuner driver. + Sharp trellis coded 8PSK tuner driver. + Supported chips: QM1D1C0042, QM1D1C0045 + +config MEDIA_TUNER_NM131 + tristate "Newport Media tuners NM131, NM130 and NM120" + depends on MEDIA_SUPPORT && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Newport Media NM131, NM130 and NM120 tuner driver. + +config MEDIA_TUNER_TDA2014X + tristate "NXP Semiconductors TDA2014x tuner" + depends on MEDIA_SUPPORT && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + NXP Semiconductor TDA2014x tuner driver. endmenu diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile index 06a9ab6..6a2b52a 100644 --- a/drivers/media/tuners/Makefile +++ b/drivers/media/tuners/Makefile @@ -39,8 +39,10 @@ obj-$(CONFIG_MEDIA_TUNER_FC0013) += fc0013.o obj-$(CONFIG_MEDIA_TUNER_IT913X) += it913x.o obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o -obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o +obj-$(CONFIG_MEDIA_TUNER_QM1D1C004X) += qm1d1c004x.o obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o +obj-$(CONFIG_MEDIA_TUNER_NM131) += nm131.o +obj-$(CONFIG_MEDIA_TUNER_TDA2014X) += tda2014x.o ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends diff --git a/drivers/media/tuners/nm131.c b/drivers/media/tuners/nm131.c new file mode 100644 index 000..817cf96 --- /dev/null +++ b/drivers/media/tuners/nm131.c @@ -0,0 +1,248 @@ +/* + Driver for Newport Media tuners NMI131, NMI130 and NMI120 + + Copyright (C) Budi Rachmanto, AreMa Inc. +*/ + +#include "dvb_frontend.h" +#include "nm131.h" + +bool nm131_w(struct dvb_frontend *fe, u16 slvadr, u32 val, u32 sz) +{ + struct i2c_client *d = fe->demodulator_priv; + u8 buf[] = {0xFE, 0xCE, slvadr >> 8, slvadr & 0xFF, 0, 0, 0, 0}; + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0, .buf = buf, .len = sz + 4,}, + }; + + *(u32 *)(buf + 4) = slvadr == 0x36 ? val & 0x7F : val; + return i2c_transfer(d->adapter, msg, 1) == 1; +} + +bool nm131_w8(struct dvb_frontend *fe, u8 slvadr, u8 dat) +{ + struct i2c_client *d = fe->demodulator_priv; + u8 buf[] = {slvadr, dat}; + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0, .buf = buf, .len = 2,}, + }; + return i2c_transfer(d->adapter, msg, 1) == 1; +} + +bool nm131_r(struct dvb_frontend *fe, u16 slvadr, u8 *dat, u32 sz) +{ + struct i2c_client *d = fe->demodulator_priv; + u8 rcmd[] = {0xFE, 0xCF}, + buf[sz]; + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0, .buf = rcmd, .len = 2,}, + {.addr = d->addr, .flags = I2C_M_RD, .buf = buf, .len = sz,}, + }; + boolret = nm131_w(fe, slvadr, 0, 0) && i2c_transfer(d->adapter, msg, 2) == 2; + + memcpy(dat, buf, sz); + return ret; +} + +int nm131_tune(struct dvb_frontend *fe) +{ + struct vhf_filter_cutoff_codes_t { + u32 Hz; + u8 val8_0x08, + val8_0x09; + } const vhf_filter_cutoff_codes[] = { + {4500, 167, 58},{5500, 151, 57},{6500, 100, 54},{7500, 83, 53}, {8500, 82, 53}, + {9500, 65, 52}, {10500, 64, 52},{11500, 64, 52},{12500, 0, 0} + }; +
[media 1/8] raise adapter number limit
From: Буди Романто, AreMa IncThe current limit is too low for latest cards with 8+ tuners on a single slot, change to 64. Signed-off-by: Буди Романто, AreMa Inc --- drivers/media/dvb-core/dvbdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h index 4aff7bd..950decd 100644 --- a/drivers/media/dvb-core/dvbdev.h +++ b/drivers/media/dvb-core/dvbdev.h @@ -34,7 +34,7 @@ #if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0 #define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS #else - #define DVB_MAX_ADAPTERS 8 + #define DVB_MAX_ADAPTERS 64 #endif #define DVB_UNSET (-1) -- 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
[media 8/8] Support for PLEX PX-BCUD (ISDB-S usb dongle)
From: Буди Романто, AreMa IncSupport for PLEX PX-BCUD (ISDB-S usb dongle) Nagahama's patch simplified... Signed-off-by: Буди Романто, AreMa Inc --- drivers/media/usb/em28xx/Kconfig| 2 + drivers/media/usb/em28xx/em28xx-cards.c | 27 +++ drivers/media/usb/em28xx/em28xx-dvb.c | 79 - drivers/media/usb/em28xx/em28xx.h | 1 + 4 files changed, 107 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/em28xx/Kconfig b/drivers/media/usb/em28xx/Kconfig index e382210..b138939 100644 --- a/drivers/media/usb/em28xx/Kconfig +++ b/drivers/media/usb/em28xx/Kconfig @@ -59,6 +59,8 @@ config VIDEO_EM28XX_DVB select DVB_DRX39XYJ if MEDIA_SUBDRV_AUTOSELECT select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT + select DVB_TC90522 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_QM1D1C004X if MEDIA_SUBDRV_AUTOSELECT ---help--- This adds support for DVB cards based on the Empiatech em28xx chips. diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 930e3e3..772a8f8 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -492,6 +492,20 @@ static struct em28xx_reg_seq terratec_t2_stick_hd[] = { {-1, -1, -1, -1}, }; +static struct em28xx_reg_seq plex_px_bcud[] = { + {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0}, + {0x0d, 0xff, 0xff, 0}, + {EM2874_R50_IR_CONFIG, 0x01, 0xff, 0}, + {EM28XX_R06_I2C_CLK,0x40, 0xff, 0}, + {EM2874_R80_GPIO_P0_CTRL, 0xfd, 0xff, 100}, + {EM28XX_R12_VINENABLE, 0x20, 0x20, 0}, + {0x0d, 0x42, 0xff, 1000}, + {EM2874_R80_GPIO_P0_CTRL, 0xfc, 0xff, 10}, + {EM2874_R80_GPIO_P0_CTRL, 0xfd, 0xff, 10}, + {0x73, 0xfd, 0xff, 100}, + {-1,-1, -1, -1}, +}; + /* * Button definitions */ @@ -2306,6 +2320,17 @@ struct em28xx_board em28xx_boards[] = { .has_dvb = 1, .ir_codes = RC_MAP_TERRATEC_SLIM_2, }, + /* 3275:0085 PLEX PX-BCUD. +* Empia EM28178, TOSHIBA TC90532XBG, Sharp QM1D1C0042 */ + [EM28178_BOARD_PLEX_PX_BCUD] = { + .name = "PLEX PX-BCUD", + .xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ, + .def_i2c_bus = 1, + .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE, + .tuner_type= TUNER_ABSENT, + .tuner_gpio= plex_px_bcud, + .has_dvb = 1, + }, }; EXPORT_SYMBOL_GPL(em28xx_boards); @@ -2495,6 +2520,8 @@ struct usb_device_id em28xx_id_table[] = { .driver_info = EM2861_BOARD_LEADTEK_VC100 }, { USB_DEVICE(0xeb1a, 0x8179), .driver_info = EM28178_BOARD_TERRATEC_T2_STICK_HD }, + { USB_DEVICE(0x3275, 0x0085), + .driver_info = EM28178_BOARD_PLEX_PX_BCUD }, { }, }; MODULE_DEVICE_TABLE(usb, em28xx_id_table); diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index 5d209c7..e6c5a97 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -12,6 +12,10 @@ (c) 2012 Frank Schäfer + (c) 2016 Nagahama Satoshi + Budi Rachmanto, AreMa Inc. + - PLEX PX-BCUD support + Based on cx88-dvb, saa7134-dvb and videobuf-dvb originally written by: (c) 2004, 2005 Chris Pascoe (c) 2004 Gerd Knorr [SuSE Labs] @@ -25,11 +29,10 @@ #include #include +#include "ptx_common.h" #include "em28xx.h" #include -#include #include -#include #include #include "tuner-simple.h" #include @@ -787,6 +790,65 @@ static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe) return 0; } +static void px_bcud_init(struct em28xx *dev) +{ + int i; + struct { + unsigned char r[4]; + int len; + } regs1[] = { + {{ 0x0e, 0x77 }, 2}, + {{ 0x0f, 0x77 }, 2}, + {{ 0x03, 0x90 }, 2}, + }, regs2[] = { + {{ 0x07, 0x01 }, 2}, + {{ 0x08, 0x10 }, 2}, + {{ 0x13, 0x00 }, 2}, + {{ 0x17, 0x00 }, 2}, + {{ 0x03, 0x01 }, 2}, + {{ 0x10, 0xb1 }, 2}, + {{ 0x11, 0x40 }, 2}, + {{ 0x85, 0x7a }, 2}, + {{ 0x87, 0x04 }, 2}, + }; + static struct em28xx_reg_seq gpio[] = { + {EM28XX_R06_I2C_CLK,0x40,
[media 7/8] PCIE bridge driver for PT3 & PX-Q3PE
From: Буди Романто, AreMa IncPCIE bridge driver for PT3 & PX-Q3PE Please read cover letter for details. Signed-off-by: Буди Романто, AreMa Inc --- drivers/media/pci/Kconfig | 2 +- drivers/media/pci/Makefile | 2 +- drivers/media/pci/ptx/Kconfig | 21 ++ drivers/media/pci/ptx/Makefile | 8 + drivers/media/pci/ptx/pt3_pci.c| 425 +++ drivers/media/pci/ptx/ptx_common.c | 252 drivers/media/pci/ptx/ptx_common.h | 74 + drivers/media/pci/ptx/pxq3pe_pci.c | 585 + 8 files changed, 1367 insertions(+), 2 deletions(-) create mode 100644 drivers/media/pci/ptx/Kconfig create mode 100644 drivers/media/pci/ptx/Makefile create mode 100644 drivers/media/pci/ptx/pt3_pci.c create mode 100644 drivers/media/pci/ptx/ptx_common.c create mode 100644 drivers/media/pci/ptx/ptx_common.h create mode 100644 drivers/media/pci/ptx/pxq3pe_pci.c diff --git a/drivers/media/pci/Kconfig b/drivers/media/pci/Kconfig index 48a611b..9d63ad6 100644 --- a/drivers/media/pci/Kconfig +++ b/drivers/media/pci/Kconfig @@ -44,7 +44,7 @@ source "drivers/media/pci/b2c2/Kconfig" source "drivers/media/pci/pluto2/Kconfig" source "drivers/media/pci/dm1105/Kconfig" source "drivers/media/pci/pt1/Kconfig" -source "drivers/media/pci/pt3/Kconfig" +source "drivers/media/pci/ptx/Kconfig" source "drivers/media/pci/mantis/Kconfig" source "drivers/media/pci/ngene/Kconfig" source "drivers/media/pci/ddbridge/Kconfig" diff --git a/drivers/media/pci/Makefile b/drivers/media/pci/Makefile index 5f8aacb..984e37c 100644 --- a/drivers/media/pci/Makefile +++ b/drivers/media/pci/Makefile @@ -7,7 +7,7 @@ obj-y+= ttpci/ \ pluto2/ \ dm1105/ \ pt1/\ - pt3/\ + ptx/\ mantis/ \ ngene/ \ ddbridge/ \ diff --git a/drivers/media/pci/ptx/Kconfig b/drivers/media/pci/ptx/Kconfig new file mode 100644 index 000..792acfe --- /dev/null +++ b/drivers/media/pci/ptx/Kconfig @@ -0,0 +1,21 @@ +config DVB_PT3 + tristate "Earthsoft PT3 cards" + depends on DVB_CORE && PCI && I2C + select DVB_TC90522 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_QM1D1C0042 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_MXL301RF if MEDIA_SUBDRV_AUTOSELECT + help + Support for Earthsoft PT3 ISDB-S/T PCIe cards. + + Say Y or M if you own such a device and want to use it. + +config DVB_PXQ3PE + tristate "PLEX PX-Q3PE cards" + depends on DVB_CORE && PCI && I2C + select DVB_TC90522 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_QM1D1C0042 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_MXL301RF if MEDIA_SUBDRV_AUTOSELECT + help + Support for PLEX PX-Q3PE ISDB-S/T PCIe cards. + + Say Y or M if you own such a device and want to use it. diff --git a/drivers/media/pci/ptx/Makefile b/drivers/media/pci/ptx/Makefile new file mode 100644 index 000..b10ad8a --- /dev/null +++ b/drivers/media/pci/ptx/Makefile @@ -0,0 +1,8 @@ +pt3-objs := pt3_pci.o ptx_common.o +pxq3pe-objs:= pxq3pe_pci.o ptx_common.o + +obj-$(CONFIG_DVB_PT3) += pt3.o +obj-$(CONFIG_DVB_PXQ3PE) += pxq3pe.o + +ccflags-y += -Idrivers/media/dvb-core -Idrivers/media/dvb-frontends -Idrivers/media/tuners + diff --git a/drivers/media/pci/ptx/pt3_pci.c b/drivers/media/pci/ptx/pt3_pci.c new file mode 100644 index 000..07431da --- /dev/null +++ b/drivers/media/pci/ptx/pt3_pci.c @@ -0,0 +1,425 @@ +/* + DVB driver for Earthsoft PT3 ISDB-S/T PCIE bridge Altera Cyclone IV FPGA EP4CGX15BF14C8N + + Copyright (C) Budi Rachmanto, AreMa Inc. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +*/ + +#include "tc90522.h" +#include "qm1d1c004x.h" +#include "mxl301rf.h" +#include "ptx_common.h" + +MODULE_AUTHOR("Budi Rachmanto, AreMa Inc. "); +MODULE_DESCRIPTION("Earthsoft PT3 DVB Driver"); +MODULE_LICENSE("GPL"); + +static struct pci_device_id pt3_id[] = { + {PCI_DEVICE(0x1172, 0x4c15)}, + {}, +}; +MODULE_DEVICE_TABLE(pci, pt3_id); + +enum ePT3 { + PT3_REG_VERSION = 0x00, /* R Version */ + PT3_REG_BUS = 0x04, /* R Bus */ + PT3_REG_SYS_W = 0x08, /* W System */ + PT3_REG_SYS_R = 0x0c, /* R System */ + PT3_REG_I2C_W = 0x10, /* W I2C */ + PT3_REG_I2C_R = 0x14, /* R I2C */ + PT3_REG_RAM_W = 0x18, /* W RAM
[media 6/8] Sharp QM1D1C004x ISDB-S tuner driver for PT3 and PX-BCUD
From: Буди Романто, AreMa IncSigned-off-by: Буди Романто, AreMa Inc --- drivers/media/tuners/qm1d1c004x.c | 242 ++ drivers/media/tuners/qm1d1c004x.h | 23 2 files changed, 265 insertions(+) create mode 100644 drivers/media/tuners/qm1d1c004x.c create mode 100644 drivers/media/tuners/qm1d1c004x.h diff --git a/drivers/media/tuners/qm1d1c004x.c b/drivers/media/tuners/qm1d1c004x.c new file mode 100644 index 000..843cfb2 --- /dev/null +++ b/drivers/media/tuners/qm1d1c004x.c @@ -0,0 +1,242 @@ +/* + Sharp VA4M6JC2103 QM1D1C004x ISDB-S tuner driver + + Copyright (C) Budi Rachmanto, AreMa Inc. + + CHIPVER.CARD + QM1D1C0042 0x48Earthsoft PT3 + QM1D1C0045 0x58 + QM1D1C0045_20x68PLEX PX-BCUD + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +*/ + +#include "dvb_frontend.h" +#include "qm1d1c004x.h" + +struct qm1d1c004x { + u8 reg[32]; +}; + +bool qm1d1c004x_r(struct dvb_frontend *fe, u8 slvadr, u8 *dat) +{ + struct i2c_client *d = fe->demodulator_priv, + *t = fe->tuner_priv; + u8 buf[] = {0xFE, t->addr << 1, slvadr, 0xFE, (t->addr << 1) | 1, 0}; + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0, .buf = buf, .len = 3,}, + {.addr = d->addr, .flags = 0, .buf = buf + 3, .len = 2,}, + {.addr = d->addr, .flags = I2C_M_RD, .buf = buf + 5, .len = 1,}, + }; + boolret = i2c_transfer(d->adapter, msg, 3) == 3; + + *dat = buf[5]; + return ret; +} + +int qm1d1c004x_w(struct dvb_frontend *fe, u8 slvadr, u8 *dat, int len) +{ + struct i2c_client *d = fe->demodulator_priv; + u8 buf[len + 1]; + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0, .buf = buf, .len = len + 1,}, + }; + + buf[0] = slvadr; + memcpy(buf + 1, dat, len); + return i2c_transfer(d->adapter, msg, 1) == 1 ? 0 : -EIO; +} + +int qm1d1c004x_w_tuner(struct dvb_frontend *fe, u8 adr, u8 dat) +{ + struct i2c_client *t = fe->tuner_priv; + struct qm1d1c004x *q = i2c_get_clientdata(t); + u8 buf[] = {t->addr << 1, adr, dat}; + int err = qm1d1c004x_w(fe, 0xFE, buf, 3); + + q->reg[adr] = dat; + return err; +} + +enum qm1d1c004x_agc { + QM1D1C004X_AGC_AUTO, + QM1D1C004X_AGC_MANUAL, +}; + +int qm1d1c004x_set_agc(struct dvb_frontend *fe, enum qm1d1c004x_agc agc) +{ + u8 dat = (agc == QM1D1C004X_AGC_AUTO) ? 0xff : 0x00, + pskmsrst= 0x01; + int err = qm1d1c004x_w(fe, 0x0a, , 1); + + if (err) + return err; + dat = 0xb0 | (agc == QM1D1C004X_AGC_AUTO ? 1 : 0); + err = qm1d1c004x_w(fe, 0x10, , 1); + if (err) + return err; + dat = (agc == QM1D1C004X_AGC_AUTO) ? 0x40 : 0x00; + return (err = qm1d1c004x_w(fe, 0x11, , 1)) ? + err : qm1d1c004x_w(fe, 0x03, , 1); +} + +int qm1d1c004x_sleep(struct dvb_frontend *fe) +{ + u8 buf = 1, + *reg= ((struct qm1d1c004x *)fe->tuner_priv)->reg; + + reg[0x01] &= (~(1 << 3)) & 0xff; + reg[0x01] |= 1 << 0; + reg[0x05] |= 1 << 3; + return qm1d1c004x_set_agc(fe, QM1D1C004X_AGC_MANUAL) || + qm1d1c004x_w_tuner(fe, 0x05, reg[0x05]) || + qm1d1c004x_w_tuner(fe, 0x01, reg[0x01]) || + qm1d1c004x_w(fe, 0x17, , 1); +} + +int qm1d1c004x_wakeup(struct dvb_frontend *fe) +{ + u8 regs[][32] = { + { /* QM1D1C0042 Earthsoft PT3 */ + 0x48, 0x1c, 0xa0, 0x10, 0xbc, 0xc5, 0x20, 0x33, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xf3, 0x00, 0x2a, 0x64, 0xa6, 0x86, 0x8c, 0xcf, 0xb8, 0xf1, 0xa8, 0xf2, 0x89, 0x00, + }, {/* QM1D1C0045 untested! */ + 0x58, 0x1C, 0xC0, 0x10, 0xBC, 0xC1, 0x15, 0x34, 0x06, 0x3e, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, + 0x11, 0xFF, 0xF3, 0x00, 0x3E, 0x25, 0x5C, 0xD6, 0x55, 0x8F, 0x95, 0xF6, 0x36, 0xF2, 0x09, 0x00, + }, {/* QM1D1C0045_2 PLEX PX-BCUD*/ + 0x68, 0x1c, 0xc0, 0x10, 0xbc, 0xc1, 0x11, 0x33, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xf3, 0x00, 0x3f, 0x25, 0x5c, 0xd6, 0x55, 0xcf, 0x95, 0xf6,
[media 4/8] Toshiba TC905xx demodulator for PT3/PX-Q3PE/PX-BCUD
From: Буди Романто, AreMa IncToshiba TC905xx demodulator driver for PT3, PX-Q3PE & PX-BCUD Signed-off-by: Буди Романто, AreMa Inc --- drivers/media/dvb-frontends/tc90522.c | 255 ++ drivers/media/dvb-frontends/tc90522.h | 18 +++ 2 files changed, 273 insertions(+) create mode 100644 drivers/media/dvb-frontends/tc90522.c create mode 100644 drivers/media/dvb-frontends/tc90522.h diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c new file mode 100644 index 000..97007ec --- /dev/null +++ b/drivers/media/dvb-frontends/tc90522.c @@ -0,0 +1,255 @@ +/* + Toshiba TC90522XBG 2ch OFDM(ISDB-T) + 2ch 8PSK(ISDB-S) demodulator + + Copyright (C) Budi Rachmanto, AreMa Inc. + + CHIPCARDS + TC90522XBG Earthsoft PT3, PLEX PX-Q3PE + TC90532 PLEX PX-BCUD + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + */ + +#include +#include "dvb_math.h" +#include "dvb_frontend.h" +#include "tc90522.h" + +bool tc90522_r(struct i2c_client *d, u8 slvadr, u8 *buf, u8 len) +{ + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0, .buf = , .len = 1,}, + {.addr = d->addr, .flags = I2C_M_RD, .buf = buf, .len = len,}, + }; + return i2c_transfer(d->adapter, msg, 2) == 2; +} + +bool tc90522_w(struct i2c_client *d, u8 slvadr, u8 dat) +{ + u8 buf[] = {slvadr, dat}; + struct i2c_msg msg[] = { + {.addr = d->addr, .flags = 0, .buf = buf, .len = 2,}, + }; + return i2c_transfer(d->adapter, msg, 1) == 1; +} + +u64 tc90522_n2int(const u8 *data, u8 n)/* convert n_bytes data from stream (network byte order) to integer */ +{ /* can't use 's ntoh*() as sometimes n = 3,5,... */ + u32 i, val = 0; + + for (i = 0; i < n; i++) { + val <<= 8; + val |= data[i]; + } + return val; +} + +int tc90522_cn_raw(struct dvb_frontend *fe, u16 *raw) /* for DVBv3 compatibility */ +{ + u8 buf[3], + len = fe->dtv_property_cache.delivery_system == SYS_ISDBS ? 2 : 3, + adr = fe->dtv_property_cache.delivery_system == SYS_ISDBS ? 0xbc : 0x8b; + boolok = tc90522_r(fe->demodulator_priv, adr, buf, len); + int cn = tc90522_n2int(buf, len); + + if (!ok) + return -EIO; + *raw = cn; + return cn; +} + +int tc90522_status(struct dvb_frontend *fe, enum fe_status *stat) +{ + enum fe_status *festat = i2c_get_clientdata(fe->demodulator_priv); + struct dtv_frontend_properties *c = >dtv_property_cache; + u16 v16; + s64 raw = tc90522_cn_raw(fe, ), + x, + y; + + s64 cn_s(void) /* @ .0001 dB */ + { + raw -= 3000; + if (raw < 0) + raw = 0; + x = int_sqrt(raw << 20); + y = 16346ll * x - (143410ll << 16); + y = ((x * y) >> 16) + (502590ll << 16); + y = ((x * y) >> 16) - (889770ll << 16); + y = ((x * y) >> 16) + (895650ll << 16); + y = (588570ll << 16) - ((x * y) >> 16); + return y < 0 ? 0 : y >> 16; + } + + s64 cn_t(void) /* @ .0001 dB */ + { + if (!raw) + return 0; + x = (1130911733ll - 10ll * intlog10(raw)) >> 2; + y = (x >> 2) - (x >> 6) + (x >> 8) + (x >> 9) - (x >> 10) + (x >> 11) + (x >> 12) - (16ll << 22); + y = ((x * y) >> 22) + (398ll << 22); + y = ((x * y) >> 22) + (5491ll << 22); + y = ((x * y) >> 22) + (30965ll << 22); + return y >> 22; + } + + c->cnr.len = 1; + c->cnr.stat[0].svalue = fe->dtv_property_cache.delivery_system == SYS_ISDBS ? cn_s() : cn_t(); + c->cnr.stat[0].scale= FE_SCALE_DECIBEL; + *stat = *festat; + return *festat; +} + +int tc90522_get_frontend_algo(struct dvb_frontend *fe) +{ + return DVBFE_ALGO_HW; +} + +int tc90522_tune(struct dvb_frontend *fe, bool retune, u32 mode_flags, u32 *delay, enum fe_status *stat) +{ + u32 fno2kHz(u32 fno) + { + if (fno < 12) + return 1049480 + 38360 * fno; /* BS */ + else if (fno < 24) + return 1613000 + 4 * (fno - 12);/* CS110 right */ + return 1593000 + 4 * (fno - 24);/* CS110 left
[media 0/8] DVB driver for Earthsoft PT3, PLEX PX-Q3PE ISDB-S/T PCIE cards & PX-BCUD ISDB-S USB dongle
From: Буди Романто, AreMa IncDVB driver for Earthsoft PT3, PLEX PX-Q3PE ISDB-S/T PCIE cards & PX-BCUD ISDB-S USB dongle == Status: stable Features: 1. in addition to the real frequency: ISDB-S : freq. channel ID ISDB-T : freq# (I/O# +128), ch#, ch# +64 for CATV 2. in addition to TSID: ISDB-S : slot# Supported Cards & Main components: A. EarthSoft PT3: 1. Altera EP4CGX15BF14C8N : customized FPGA PCI bridge 2. Toshiba TC90522XBG : quad demodulator (2ch OFDM + 2ch 8PSK) 3. SharpVA4M6JC2103 : contains 2 ISDB-S + 2 ISDB-T tuners ISDB-S : Sharp QM1D1C0042 RF-IC, chip ver. 0x48 ISDB-T : MaxLinear CMOS Hybrid TV MxL301RF B. PLEX PX-Q3PE: 1. ASICEN ASV5220 : PCI-E bridge 2. Toshiba TC90522XBG : quad demodulator (2ch OFDM + 2ch 8PSK) 3. NXP Semiconductors TDA20142 : ISDB-S tuner 4. Newport Media NM120 : ISDB-T tuner 5. ASICEN ASIE5606X8 : crypting controller C. PLEX PX-BCUD (ISDB-S USB dongle) 1. EmpiaEM28178 : USB I/F (courtesy of Nagahama Satoshi) 2. Toshiba TC90532 : demodulator (using TC90522 driver) 3. SharpQM1D1C0045_2: ISDB-S RF-IC, chip ver. 0x68 Notes: This is a complex but smartly polished driver package containing 2 (dual head) PCI-E bridge I/F drivers, single demodulator frontend, and 4 (quad tail) tuner drivers, plus, simplified Nagahama's patch for PLEX PX-BCUD (ISDB-S USB dongle). Generic registration related procedures (subdevices, frontend, etc.) summarized in ptx_common.c are very useful also for other DVB drivers, and would be very handy if inserted into the core (e.g. dvb_frontend.c & dvb_frontend.h). For example, currently, the entity of struct dvb_frontend is created sometimes in demodulators, some in tuners, or even in the parent (bridge) drivers. IMHO, this entity should be provided by dvb_core. ptx_register_fe() included in ptx_common.c simplifies the tasks and in fact, significantly reduces coding & kernel size. Also, currently dvb_frontend's .demodulator_priv & .tuner_priv are of type (void *). These should be changed to (struct i2c_client *), IMHO. Private data for demodulator or tuner should be attached under i2c_client, using i2c_set_clientdata() for instance. FILENAMESUPPORTED CHIPS === tc90522.c TC90522XBG, TC90532XBG,... tda2014x.c TDA20142 qm1d1c004x.cQM1D1C0042, QM1D1C0045, QM1D1C0045_2 nm131.c NM131, NM130, NM120 mxl301rf.c MxL301RF pt3_pci.c EP4CGX15BF14C8N pxq3pe_pci.cASV5220 Full package: - URL: https://github.com/knight-rider/ptx Буди Романто, AreMa Inc (8): The current limit is too low for latest cards with 8+ tuners on a single slot, change to 64. NXP tda2014x & Newport Media nm120/130/131 tuner drivers for PLEX PX-Q3PE Obsoleted & superseded, please read cover letter for details. Toshiba TC905xx demodulator driver for PT3, PX-Q3PE & PX-BCUD MaxLinear MxL301RF ISDB-T tuner Sharp QM1D1C004x ISDB-S tuner driver for PT3 and PX-BCUD PCIE bridge driver for PT3 & PX-Q3PE Please read cover letter for details. Support for PLEX PX-BCUD (ISDB-S usb dongle) Nagahama's patch simplified... drivers/media/dvb-core/dvbdev.h | 2 +- drivers/media/dvb-frontends/tc90522.c | 965 +++- drivers/media/dvb-frontends/tc90522.h | 36 +- drivers/media/pci/Kconfig | 2 +- drivers/media/pci/Makefile | 2 +- drivers/media/pci/pt3/Kconfig | 10 - drivers/media/pci/pt3/Makefile | 8 - drivers/media/pci/pt3/pt3.c | 874 - drivers/media/pci/pt3/pt3.h | 186 -- drivers/media/pci/pt3/pt3_dma.c | 225 drivers/media/pci/pt3/pt3_i2c.c | 240 drivers/media/pci/ptx/Kconfig | 21 + drivers/media/pci/ptx/Makefile | 8 + drivers/media/pci/ptx/pt3_pci.c | 425 ++ drivers/media/pci/ptx/ptx_common.c | 252 + drivers/media/pci/ptx/ptx_common.h | 74 +++ drivers/media/pci/ptx/pxq3pe_pci.c | 585 +++ drivers/media/tuners/Kconfig| 21 +- drivers/media/tuners/Makefile | 4 +- drivers/media/tuners/mxl301rf.c | 471 ++-- drivers/media/tuners/mxl301rf.h | 19 +- drivers/media/tuners/nm131.c| 248 drivers/media/tuners/nm131.h| 13 + drivers/media/tuners/qm1d1c0042.c | 448 --- drivers/media/tuners/qm1d1c0042.h | 37 -- drivers/media/tuners/qm1d1c004x.c | 242 drivers/media/tuners/qm1d1c004x.h | 23 + drivers/media/tuners/tda2014x.c | 342 +++ drivers/media/tuners/tda2014x.h | 13 + drivers/media/usb/em28xx/Kconfig
[PATCH 1/2] [media] Revert "[media] sound/usb: Use Media Controller API to share media resources"
Unfortunately, this patch caused several regressions at au0828 and snd-usb-audio, like this one: https://bugzilla.kernel.org/show_bug.cgi?id=115561 It also showed several troubles at the MC core that handles pretty poorly the memory protections and data lifetime management. So, better to revert it and fix the core before reapplying this change. This reverts commit aebb2b89bff0 ("[media] sound/usb: Use Media Controller API to share media resources")' Signed-off-by: Mauro Carvalho Chehab--- sound/usb/Kconfig| 4 - sound/usb/Makefile | 2 - sound/usb/card.c | 14 --- sound/usb/card.h | 3 - sound/usb/media.c| 318 --- sound/usb/media.h| 72 --- sound/usb/mixer.h| 3 - sound/usb/pcm.c | 28 + sound/usb/quirks-table.h | 1 - sound/usb/stream.c | 2 - sound/usb/usbaudio.h | 6 - 11 files changed, 5 insertions(+), 448 deletions(-) delete mode 100644 sound/usb/media.c delete mode 100644 sound/usb/media.h diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig index d14bf411515b..a452ad7cec40 100644 --- a/sound/usb/Kconfig +++ b/sound/usb/Kconfig @@ -15,7 +15,6 @@ config SND_USB_AUDIO select SND_RAWMIDI select SND_PCM select BITREVERSE - select SND_USB_AUDIO_USE_MEDIA_CONTROLLER if MEDIA_CONTROLLER && (MEDIA_SUPPORT=y || MEDIA_SUPPORT=SND_USB_AUDIO) help Say Y here to include support for USB audio and USB MIDI devices. @@ -23,9 +22,6 @@ config SND_USB_AUDIO To compile this driver as a module, choose M here: the module will be called snd-usb-audio. -config SND_USB_AUDIO_USE_MEDIA_CONTROLLER - bool - config SND_USB_UA101 tristate "Edirol UA-101/UA-1000 driver" select SND_PCM diff --git a/sound/usb/Makefile b/sound/usb/Makefile index 8dca3c407f5a..2d2d122b069f 100644 --- a/sound/usb/Makefile +++ b/sound/usb/Makefile @@ -15,8 +15,6 @@ snd-usb-audio-objs := card.o \ quirks.o \ stream.o -snd-usb-audio-$(CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER) += media.o - snd-usbmidi-lib-objs := midi.o # Toplevel Module Dependency diff --git a/sound/usb/card.c b/sound/usb/card.c index 63244bbba8c7..3fc63583a537 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -66,7 +66,6 @@ #include "format.h" #include "power.h" #include "stream.h" -#include "media.h" MODULE_AUTHOR("Takashi Iwai "); MODULE_DESCRIPTION("USB Audio"); @@ -612,11 +611,6 @@ static int usb_audio_probe(struct usb_interface *intf, if (err < 0) goto __error; - if (quirk->media_device) { - /* don't want to fail when media_snd_device_create() fails */ - media_snd_device_create(chip, intf); - } - usb_chip[chip->index] = chip; chip->num_interfaces++; usb_set_intfdata(intf, chip); @@ -673,14 +667,6 @@ static void usb_audio_disconnect(struct usb_interface *intf) list_for_each(p, >midi_list) { snd_usbmidi_disconnect(p); } - /* -* Nice to check quirk && quirk->media_device -* need some special handlings. Doesn't look like -* we have access to quirk here -* Acceses mixer_list - */ - media_snd_device_delete(chip); - /* release mixer resources */ list_for_each_entry(mixer, >mixer_list, list) { snd_usb_mixer_disconnect(mixer); diff --git a/sound/usb/card.h b/sound/usb/card.h index 34a0898e2238..71778ca4b26a 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -105,8 +105,6 @@ struct snd_usb_endpoint { struct list_head list; }; -struct media_ctl; - struct snd_usb_substream { struct snd_usb_stream *stream; struct usb_device *dev; @@ -158,7 +156,6 @@ struct snd_usb_substream { } dsd_dop; bool trigger_tstamp_pending_update; /* trigger timestamp being updated from initial estimate */ - struct media_ctl *media_ctl; }; struct snd_usb_stream { diff --git a/sound/usb/media.c b/sound/usb/media.c deleted file mode 100644 index 93a50d01490c.. --- a/sound/usb/media.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * media.c - Media Controller specific ALSA driver code - * - * Copyright (c) 2016 Shuah Khan - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * This file is released under the GPLv2. - */ - -/* - * This file adds Media Controller support to ALSA driver - * to use the Media Controller API to share tuner with DVB - * and V4L2 drivers that control media device. Media device - * is created based on existing quirks framework. Using this - * approach, the media controller API usage can be added for - * a specific device. -*/
[PATCH 2/2] [media] Revert "[media] media: au0828 change to use Managed Media Controller API"
Extending the lifetime of the media_device struct is not handled well by the core, as it will erase some data from the struct, when media_device_cleanup() is called after unregistering it. While we have a fixup patch for it already, the usage of those new functions are needed only when we share data with other drivers. So, better to revert the changes. This reverts commit 182dde7c5d4c ("[media] media: au0828 change to use Managed Media Controller API") Signed-off-by: Mauro Carvalho Chehab--- drivers/media/usb/au0828/au0828-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index a40958ad8341..cc22b32776ad 100644 --- a/drivers/media/usb/au0828/au0828-core.c +++ b/drivers/media/usb/au0828/au0828-core.c @@ -144,6 +144,7 @@ static void au0828_unregister_media_device(struct au0828_dev *dev) media_device_unregister(dev->media_dev); media_device_cleanup(dev->media_dev); + kfree(dev->media_dev); dev->media_dev = NULL; } #endif @@ -197,7 +198,7 @@ static int au0828_media_device_init(struct au0828_dev *dev, #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *mdev; - mdev = media_device_get_devres(>dev); + mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); if (!mdev) return -ENOMEM; -- 2.5.5 -- 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
Linux 4.6-rc1 Fix for regression introduced in [media] au0828: use v4l2_mc_create_media_graph()
Hi Mauro, This is urgent. I am running sanity tests on Linux 4.6-rc1 and found that your fix to the regression introduced by [media] au0828: use v4l2_mc_create_media_graph() commit - 9822f4173f84cb7c592edb5e1478b7903f69d018 is missing in Linux 4.6-rc1 The link to the regression fix is: https://patchwork.linuxtv.org/patch/33441/ Please include the above fix in your pull request for rc2 thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com -- 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 3/4] spi: use sg_alloc_table_from_buf()
On Thu, Mar 31, 2016 at 02:29:43PM +0200, Boris Brezillon wrote: > Replace custom implementation of sg_alloc_table_from_buf() by a call to > sg_alloc_table_from_buf(). Acked-by: Mark Brownsignature.asc Description: PGP signature
Re: [Intel-gfx] [PATCH] dma-buf: Release module reference on creation failure
On to, 2016-03-31 at 09:35 +0100, Chris Wilson wrote: > If we fail to create the anon file, we need to remember to release the > module reference on the owner. > > Signed-off-by: Chris Wilson> Cc: Sumit Semwal > Cc: Daniel Vetter > Cc: linux-media@vger.kernel.org > Cc: dri-de...@lists.freedesktop.org > Cc: linaro-mm-...@lists.linaro.org > --- > drivers/dma-buf/dma-buf.c | 15 +++ > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c > index 4a2c07ee6677..6f0f0b10a241 100644 > --- a/drivers/dma-buf/dma-buf.c > +++ b/drivers/dma-buf/dma-buf.c > @@ -333,6 +333,7 @@ struct dma_buf *dma_buf_export(const struct > dma_buf_export_info *exp_info) > struct reservation_object *resv = exp_info->resv; > struct file *file; > size_t alloc_size = sizeof(struct dma_buf); > + int ret; > > if (!exp_info->resv) > alloc_size += sizeof(struct reservation_object); > @@ -356,8 +357,8 @@ struct dma_buf *dma_buf_export(const struct > dma_buf_export_info *exp_info) > > dmabuf = kzalloc(alloc_size, GFP_KERNEL); > if (!dmabuf) { > - module_put(exp_info->owner); > - return ERR_PTR(-ENOMEM); > + ret = -ENOMEM; > + goto free_module; > } > > dmabuf->priv = exp_info->priv; > @@ -378,8 +379,8 @@ struct dma_buf *dma_buf_export(const struct > dma_buf_export_info *exp_info) > file = anon_inode_getfile("dmabuf", _buf_fops, dmabuf, > exp_info->flags); > if (IS_ERR(file)) { > - kfree(dmabuf); > - return ERR_CAST(file); > + ret = PTR_ERR(file); > + goto free_dmabuf; > } > > file->f_mode |= FMODE_LSEEK; > @@ -393,6 +394,12 @@ struct dma_buf *dma_buf_export(const struct > dma_buf_export_info *exp_info) > mutex_unlock(_list.lock); > > return dmabuf; > + > +free_dmabuf: > + kfree(dmabuf); > +free_module: > + module_put(exp_info->owner); > + return ERR_PTR(ret); Labels could really be err_dmabuf (/ out_dmabuf). That's more in line with rest of the codebase and kernel coding style: 'An example of a good name could be "out_buffer:" if the goto frees "buffer".' "free_dmabuf" does sound to me like it could also be executed on the normal execution path of the function. Other than that, Reviewed-by: Joonas Lahtinen > } > EXPORT_SYMBOL_GPL(dma_buf_export); > -- Joonas Lahtinen Open Source Technology Center Intel Corporation -- 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 2/4] scatterlist: add sg_alloc_table_from_buf() helper
On Thu, Mar 31, 2016 at 04:45:57PM +0200, Boris Brezillon wrote: > Hi Russell, > > On Thu, 31 Mar 2016 15:14:13 +0100 > Russell King - ARM Linuxwrote: > > > On Thu, Mar 31, 2016 at 02:29:42PM +0200, Boris Brezillon wrote: > > > sg_alloc_table_from_buf() provides an easy solution to create an sg_table > > > from a virtual address pointer. This function takes care of dealing with > > > vmallocated buffers, buffer alignment, or DMA engine limitations (maximum > > > DMA transfer size). > > > > Please note that the DMA API does not take account of coherency of memory > > regions other than non-high/lowmem - there are specific extensions to > > deal with this. > > Ok, you said 'non-high/lowmem', this means vmalloced and kmapped buffers > already fall in this case, right? > > Could you tell me more about those specific extensions? I was slightly confused - the extensions I was thinking of are those listed at the bottom of Documentation/cachetlb.txt, which have nothing to do with DMA. However, it's probably worth reading Documentation/DMA-API-HOWTO.txt to read up on what kinds of memory are considered to be DMA-able in the kernel. > > What this means is that having an API that takes any virtual address > > pointer, converts it to a scatterlist which is then DMA mapped, is > > unsafe. > > Which means some implementations already get this wrong (see > spi_map_buf(), and I'm pretty sure it's not the only one). Quite possible, but that is driver stuff, and driver stuff gets things wrong all the time. :) > > It'll be okay for PIPT and non-aliasing VIPT cache architectures, but > > for other cache architectures this will hide this problem and make > > review harder. > > > > Ok, you lost me. I'll have to do my homework and try to understand what > this means :). P = physical address V = virtual address I = indexed T = tag The tag is held in each cache line. When a location is looked up in the cache, an index is used to locate a set of cache lines and the tag is compared to check which cache line in the set is the correct one (or whether the address even exists in the cache.) How the index and tag are derived varies between cache architectures. PIPT = indexed by physical address, tagged with physical address. Never aliases with itself in the presence of multiple virtual mappings. VIPT = indexed by virtual address, tagged with physical address. If the bits from the virtual address do not overlap the MMU page size, it is also alias free, otherwise aliases can exist, but can be eliminated by "cache colouring" - ensuring that a physical address is always mapped with the same overlapping bits. VIVT = indexed by virtual address, tagged with virtual address. The worst kind of cache, since every different mapping of the same physical address is guaranteed by design to alias with other mappings. There is little cache colouring between different kernel mappings (eg, between lowmem and vmalloc space.) What this means is that, while the DMA API takes care of DMA aliases in the lowmem mappings, an alias-prone VIPT cache will remain incoherent with DMA if it is remapped into vmalloc space, and the mapping happens to have a different cache colour. In other words, this is a data corruption issue. Hence, taking a range of vmalloc() addresses, converting them into a scatterlist, then using the DMA API on the scatterlist _only_ guarantees that the lowmem (and kmap'd highmem mappings) are coherent with DMA. There is no way for the DMA API to know that other mappings exist, and obviously flushing every possible cache line just because a mapping might exist multiplies the expense of the DMA API: not only in terms of time spent running through all the possibilities, which doubles for every aliasing bit of VIPT, but also TLB pressure since you'd have to create a mapping for each alias and tear it back down. VIVT is even worse, since there is no other virtual mapping which is coherent, would need to be known, and each mapping would need to be individually flushed. -- RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- 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 2/4] scatterlist: add sg_alloc_table_from_buf() helper
Hi Russell, On Thu, 31 Mar 2016 15:14:13 +0100 Russell King - ARM Linuxwrote: > On Thu, Mar 31, 2016 at 02:29:42PM +0200, Boris Brezillon wrote: > > sg_alloc_table_from_buf() provides an easy solution to create an sg_table > > from a virtual address pointer. This function takes care of dealing with > > vmallocated buffers, buffer alignment, or DMA engine limitations (maximum > > DMA transfer size). > > Please note that the DMA API does not take account of coherency of memory > regions other than non-high/lowmem - there are specific extensions to > deal with this. Ok, you said 'non-high/lowmem', this means vmalloced and kmapped buffers already fall in this case, right? Could you tell me more about those specific extensions? > > What this means is that having an API that takes any virtual address > pointer, converts it to a scatterlist which is then DMA mapped, is > unsafe. Which means some implementations already get this wrong (see spi_map_buf(), and I'm pretty sure it's not the only one). > > It'll be okay for PIPT and non-aliasing VIPT cache architectures, but > for other cache architectures this will hide this problem and make > review harder. > Ok, you lost me. I'll have to do my homework and try to understand what this means :). Thanks for your valuable inputs. Best Regards, Boris -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- 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 2/4] scatterlist: add sg_alloc_table_from_buf() helper
On Thu, Mar 31, 2016 at 02:29:42PM +0200, Boris Brezillon wrote: > sg_alloc_table_from_buf() provides an easy solution to create an sg_table > from a virtual address pointer. This function takes care of dealing with > vmallocated buffers, buffer alignment, or DMA engine limitations (maximum > DMA transfer size). Please note that the DMA API does not take account of coherency of memory regions other than non-high/lowmem - there are specific extensions to deal with this. What this means is that having an API that takes any virtual address pointer, converts it to a scatterlist which is then DMA mapped, is unsafe. It'll be okay for PIPT and non-aliasing VIPT cache architectures, but for other cache architectures this will hide this problem and make review harder. -- RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
To Your Attention
To Your Attention, On behalf of the board and management of International Monetary Committees it was resolved by the federal executive council and agreed that your Inheritance/Contract Fund valued at $10.5M would be released to you via DIPLOMATIC CHANNEL immediately your attention is received so you are advice to confirm the following information.send your reply to: elderifr...@gmail.com Your Name,=== Address,=== Next of kin.== Your Occupation= A scanned copy of your ID or passport.= Direct TelePhone Number=== Regards Elder Idris Frank Federal Ministry of Finance Email:elderifr...@gmail.com -- 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 4/4] mtd: provide helper to prepare buffers for DMA operations
Some NAND controller drivers are making use of DMA to transfer data from the controller to the buffer passed by the MTD user. Provide a generic mtd_map/unmap_buf() implementation to avoid open coded (and sometime erroneous) implementations. Signed-off-by: Boris Brezillon--- drivers/mtd/mtdcore.c | 66 + include/linux/mtd/mtd.h | 25 +++ 2 files changed, 91 insertions(+) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 3096251..4c20f33 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -1253,6 +1253,72 @@ void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size) } EXPORT_SYMBOL_GPL(mtd_kmalloc_up_to); +#ifdef CONFIG_HAS_DMA +/** + * mtd_map_buf - create an SG table and prepare it for DMA operations + * + * @mtd: mtd device description object pointer + * @dev: device handling the DMA operation + * @buf: buf used to create the SG table + * @len: length of buf + * @constraints: optional constraints to take into account when creating + * the SG table. Can be NULL if no specific constraints + * are required. + * @dir: direction of the DMA operation + * + * This function should be used when an MTD driver wants to do DMA operations + * on a buffer passed by the MTD layer. This functions takes care of + * vmallocated buffer constraints, and return and sg_table that you can safely + * use. + */ +int mtd_map_buf(struct mtd_info *mtd, struct device *dev, + struct sg_table *sgt, const void *buf, size_t len, + const struct sg_constraints *constraints, + enum dma_data_direction dir) +{ + int ret; + + ret = sg_alloc_table_from_buf(sgt, buf, len, constraints, GFP_KERNEL); + if (ret) + return ret; + + ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir); + if (!ret) + ret = -ENOMEM; + + if (ret < 0) { + sg_free_table(sgt); + return ret; + } + + sgt->nents = ret; + + return 0; +} +EXPORT_SYMBOL_GPL(mtd_map_buf); + +/** + * mtd_unmap_buf - unmap an SG table and release its resources + * + * @mtd: mtd device description object pointer + * @dev: device handling the DMA operation + * @sgt: SG table + * @dir: direction of the DMA operation + * + * This function unmaps a previously mapped SG table and release SG table + * resources. Should be called when your DMA operation is done. + */ +void mtd_unmap_buf(struct mtd_info *mtd, struct device *dev, + struct sg_table *sgt, enum dma_data_direction dir) +{ + if (sgt->orig_nents) { + dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir); + sg_free_table(sgt); + } +} +EXPORT_SYMBOL_GPL(mtd_unmap_buf); +#endif /* !CONFIG_HAS_DMA */ + #ifdef CONFIG_PROC_FS /**/ diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 7712721..15cff85 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -410,6 +411,30 @@ extern void register_mtd_user (struct mtd_notifier *new); extern int unregister_mtd_user (struct mtd_notifier *old); void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); +#ifdef CONFIG_HAS_DMA +int mtd_map_buf(struct mtd_info *mtd, struct device *dev, + struct sg_table *sgt, const void *buf, size_t len, + const struct sg_constraints *constraints, + enum dma_data_direction dir); +void mtd_unmap_buf(struct mtd_info *mtd, struct device *dev, + struct sg_table *sgt, enum dma_data_direction dir); +#else +static inline int mtd_map_buf(struct mtd_info *mtd, struct device *dev, + struct sg_table *sgt, const void *buf, + size_t len, + const struct sg_constraints *constraints + enum dma_data_direction dir) +{ + return -ENOTSUPP; +} + +static void mtd_unmap_buf(struct mtd_info *mtd, struct device *dev, + struct sg_table *sgt, enum dma_data_direction dir) +{ + return -ENOTSUPP; +} +#endif + void mtd_erase_callback(struct erase_info *instr); static inline int mtd_is_bitflip(int err) { -- 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 3/4] spi: use sg_alloc_table_from_buf()
Replace custom implementation of sg_alloc_table_from_buf() by a call to sg_alloc_table_from_buf(). Signed-off-by: Boris Brezillon--- drivers/spi/spi.c | 45 + 1 file changed, 5 insertions(+), 40 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index de2f2f9..eed461d 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -705,49 +705,14 @@ static int spi_map_buf(struct spi_master *master, struct device *dev, struct sg_table *sgt, void *buf, size_t len, enum dma_data_direction dir) { - const bool vmalloced_buf = is_vmalloc_addr(buf); - unsigned int max_seg_size = dma_get_max_seg_size(dev); - int desc_len; - int sgs; - struct page *vm_page; - void *sg_buf; - size_t min; - int i, ret; - - if (vmalloced_buf) { - desc_len = min_t(int, max_seg_size, PAGE_SIZE); - sgs = DIV_ROUND_UP(len + offset_in_page(buf), desc_len); - } else { - desc_len = min_t(int, max_seg_size, master->max_dma_len); - sgs = DIV_ROUND_UP(len, desc_len); - } + struct sg_constraints constraints = { }; + int ret; - ret = sg_alloc_table(sgt, sgs, GFP_KERNEL); - if (ret != 0) + constraints.max_segment_size = dma_get_max_seg_size(dev); + ret = sg_alloc_table_from_buf(sgt, buf, len, , GFP_KERNEL); + if (ret) return ret; - for (i = 0; i < sgs; i++) { - - if (vmalloced_buf) { - min = min_t(size_t, - len, desc_len - offset_in_page(buf)); - vm_page = vmalloc_to_page(buf); - if (!vm_page) { - sg_free_table(sgt); - return -ENOMEM; - } - sg_set_page(>sgl[i], vm_page, - min, offset_in_page(buf)); - } else { - min = min_t(size_t, len, desc_len); - sg_buf = buf; - sg_set_buf(>sgl[i], sg_buf, min); - } - - buf += min; - len -= min; - } - ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir); if (!ret) ret = -ENOMEM; -- 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 2/4] scatterlist: add sg_alloc_table_from_buf() helper
sg_alloc_table_from_buf() provides an easy solution to create an sg_table from a virtual address pointer. This function takes care of dealing with vmallocated buffers, buffer alignment, or DMA engine limitations (maximum DMA transfer size). Signed-off-by: Boris Brezillon--- include/linux/scatterlist.h | 24 ++ lib/scatterlist.c | 183 2 files changed, 207 insertions(+) diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 556ec1e..18d1091 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -41,6 +41,27 @@ struct sg_table { unsigned int orig_nents;/* original size of list */ }; +/** + * struct sg_constraints - SG constraints structure + * + * @max_segment_size: maximum segment length. Each SG entry has to be smaller + * than this value. Zero means no constraint. + * @required_alignment: minimum alignment. Is used for both size and pointer + * alignment. If this constraint is not met, the function + * should return -EINVAL. + * @preferred_alignment: preferred alignment. Mainly used to optimize + * throughput when the DMA engine performs better when + * doing aligned accesses. + * + * This structure is here to help sg_alloc_table_from_buf() create the optimal + * SG list based on DMA engine constraints. + */ +struct sg_constraints { + size_t max_segment_size; + size_t required_alignment; + size_t preferred_alignment; +}; + /* * Notes on SG table design. * @@ -265,6 +286,9 @@ int sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, unsigned int n_pages, unsigned long offset, unsigned long size, gfp_t gfp_mask); +int sg_alloc_table_from_buf(struct sg_table *sgt, const void *buf, size_t len, + const struct sg_constraints *constraints, + gfp_t gfp_mask); size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, size_t buflen, off_t skip, bool to_buffer); diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 004fc70..9c9746e 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -433,6 +433,189 @@ int sg_alloc_table_from_pages(struct sg_table *sgt, } EXPORT_SYMBOL(sg_alloc_table_from_pages); +static size_t sg_buf_chunk_len(const void *buf, size_t len, + const struct sg_constraints *cons) +{ + size_t chunk_len = len; + + if (cons->max_segment_size) + chunk_len = min_t(size_t, chunk_len, cons->max_segment_size); + + if (is_vmalloc_addr(buf)) { + unsigned long offset_in_page = offset_in_page(buf); + size_t contig_len = PAGE_SIZE - offset_in_page; + unsigned long phys = vmalloc_to_pfn(buf) - offset_in_page; + const void *contig_ptr = buf + contig_len; + + /* +* Vmalloced buffer might be composed of several physically +* contiguous pages. Avoid extra scattergather entries in +* this case. +*/ + while (contig_len < chunk_len) { + if (phys + PAGE_SIZE != vmalloc_to_pfn(contig_ptr)) + break; + + contig_len += PAGE_SIZE; + contig_ptr += PAGE_SIZE; + phys += PAGE_SIZE; + } + + chunk_len = min_t(size_t, chunk_len, contig_len); + } + + if (!IS_ALIGNED((unsigned long)buf, cons->preferred_alignment)) { + const void *aligned_buf = PTR_ALIGN(buf, + cons->preferred_alignment); + size_t unaligned_len = (unsigned long)(aligned_buf - buf); + + chunk_len = min_t(size_t, chunk_len, unaligned_len); + } else if (chunk_len > cons->preferred_alignment) { + chunk_len &= ~(cons->preferred_alignment - 1); + } + + return chunk_len; +} + +#define sg_for_each_chunk_in_buf(buf, len, chunk_len, constraints) \ + for (chunk_len = sg_buf_chunk_len(buf, len, constraints); \ +len; \ +len -= chunk_len, buf += chunk_len,\ +chunk_len = sg_buf_chunk_len(buf, len, constraints)) + +static int sg_check_constraints(struct sg_constraints *cons, + const void *buf, size_t len) +{ + /* +* We only accept buffers coming from the lowmem, vmalloc and +* highmem regions. +*/ + if (!virt_addr_valid(buf) && !is_vmalloc_addr(buf) && + !is_highmem_addr(buf)) + return -EINVAL; + + if (!cons->required_alignment) +
[PATCH 0/4] scatterlist: sg_table from virtual pointer
Hello, This series has been extracted from another series [1] adding support for DMA operations in a NAND driver. The reason I decided to post those patches separately is because they are touching core stuff, and I'd like to have feedback on these specific aspects. The idea is to provide a generic function creating an sg_table from a virtual pointer and a length. This operation is complicated by the different memory regions exposed in kernel space. For example, you have the lowmem region, which guarantees that buffers are physically contiguous, while the vmalloc region does not. sg_alloc_table_from_buf() detects in which memory region your buffer reside, and takes the appropriate precautions when creating the sg_table. This function also takes an extract parameter, allowing one to specify extra constraints, like the maximum DMA segment size, the required and the preferred alignment. Patch 1 and 2 are implementing sg_alloc_table_from_buf() (patch 1 is needed to properly detect buffers residing in the highmem/kmap area). Patch 3 is making use of sg_alloc_table_from_buf() in the spi_map_buf() function (hopefully, other subsystems/drivers will be able to easily switch to this function too). Patch 4 is implementing what I really need: generic functions to map/unmap a virtual buffer passed through mtd->_read/_write(). I'm not exactly a DMA or MM experts, so that would be great to have feedbacks on this approach. That's why I added so many people in Cc even if they're not directly impacted by those patches. Let me know if you want me to drop/add people from/to the recipient list. Thanks. Best Regards, Boris [1]http://www.spinics.net/lists/arm-kernel/msg493552.html Boris Brezillon (4): mm: add is_highmem_addr() helper scatterlist: add sg_alloc_table_from_buf() helper spi: use sg_alloc_table_from_buf() mtd: provide helper to prepare buffers for DMA operations drivers/mtd/mtdcore.c | 66 drivers/spi/spi.c | 45 ++- include/linux/highmem.h | 13 include/linux/mtd/mtd.h | 25 ++ include/linux/scatterlist.h | 24 ++ lib/scatterlist.c | 183 6 files changed, 316 insertions(+), 40 deletions(-) -- 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 1/4] mm: add is_highmem_addr() helper
Add an helper to check if a virtual address is in the highmem region. Signed-off-by: Boris Brezillon--- include/linux/highmem.h | 13 + 1 file changed, 13 insertions(+) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index bb3f329..13dff37 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -41,6 +41,14 @@ void kmap_flush_unused(void); struct page *kmap_to_page(void *addr); +static inline bool is_highmem_addr(const void *x) +{ + unsigned long vaddr = (unsigned long)x; + + return vaddr >= PKMAP_BASE && + vaddr < ((PKMAP_BASE + LAST_PKMAP) * PAGE_SIZE); +} + #else /* CONFIG_HIGHMEM */ static inline unsigned int nr_free_highpages(void) { return 0; } @@ -50,6 +58,11 @@ static inline struct page *kmap_to_page(void *addr) return virt_to_page(addr); } +static inline bool is_highmem_addr(const void *x) +{ + return false; +} + #define totalhigh_pages 0UL #ifndef ARCH_HAS_KMAP -- 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] dma-buf: Release module reference on creation failure
If we fail to create the anon file, we need to remember to release the module reference on the owner. Signed-off-by: Chris WilsonCc: Sumit Semwal Cc: Daniel Vetter Cc: linux-media@vger.kernel.org Cc: dri-de...@lists.freedesktop.org Cc: linaro-mm-...@lists.linaro.org --- drivers/dma-buf/dma-buf.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 4a2c07ee6677..6f0f0b10a241 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -333,6 +333,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) struct reservation_object *resv = exp_info->resv; struct file *file; size_t alloc_size = sizeof(struct dma_buf); + int ret; if (!exp_info->resv) alloc_size += sizeof(struct reservation_object); @@ -356,8 +357,8 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) dmabuf = kzalloc(alloc_size, GFP_KERNEL); if (!dmabuf) { - module_put(exp_info->owner); - return ERR_PTR(-ENOMEM); + ret = -ENOMEM; + goto free_module; } dmabuf->priv = exp_info->priv; @@ -378,8 +379,8 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) file = anon_inode_getfile("dmabuf", _buf_fops, dmabuf, exp_info->flags); if (IS_ERR(file)) { - kfree(dmabuf); - return ERR_CAST(file); + ret = PTR_ERR(file); + goto free_dmabuf; } file->f_mode |= FMODE_LSEEK; @@ -393,6 +394,12 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) mutex_unlock(_list.lock); return dmabuf; + +free_dmabuf: + kfree(dmabuf); +free_module: + module_put(exp_info->owner); + return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(dma_buf_export); -- 2.8.0.rc3 -- 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
Fwd: Urgent- Quotations Needed
Dear Sir, FYI kindly send us proforma ASAP for the attached purchase order. Thanks Carmen Rodriguez -- 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: [v2,4/7] scatterlist: add sg_alloc_table_from_buf() helper
Hi Vignesh, On Thu, 31 Mar 2016 10:26:59 +0530 Vignesh Rwrote: > Hi, > > On 03/30/2016 09:09 PM, Boris BREZILLON wrote: > > [...] > > > +int sg_alloc_table_from_buf(struct sg_table *sgt, const void *buf, size_t > > len, > > + const struct sg_constraints *constraints, > > + gfp_t gfp_mask) > > +{ > > + struct sg_constraints cons = { }; > > + size_t remaining, chunk_len; > > + const void *sg_buf; > > + int i, ret; > > + > > + if (constraints) > > + cons = *constraints; > > + > > + ret = sg_check_constraints(, buf, len); > > + if (ret) > > + return ret; > > + > > + sg_buf = buf; > > + remaining = len; > > + i = 0; > > + sg_for_each_chunk_in_buf(sg_buf, remaining, chunk_len, ) > > + i++; > > + > > + ret = sg_alloc_table(sgt, i, gfp_mask); > > + if (ret) > > + return ret; > > + > > + sg_buf = buf; > > + remaining = len; > > + i = 0; > > + sg_for_each_chunk_in_buf(sg_buf, remaining, chunk_len, ) { > > + if (is_vmalloc_addr(sg_buf)) { > > + struct page *vm_page; > > + > > + vm_page = vmalloc_to_page(sg_buf); > > + if (!vm_page) { > > + ret = -ENOMEM; > > + goto err_free_table; > > + } > > + > > + sg_set_page(>sgl[i], vm_page, chunk_len, > > + offset_in_page(sg_buf)); > > + } else { > > + sg_set_buf(>sgl[i], sg_buf, chunk_len); > > + } > > + > > If the buf address is in PKMAP_BASE - PAGE_OFFSET-1 region (I have > observed that JFFS2 FS provides buffers in above region to MTD layer), > if CONFIG_DEBUG_SG is set then sg_set_buf() will throw a BUG_ON() as > virt_addr_is_valid() will return false. Is there a sane way to handle > buffers of PKMAP_BASE region with sg_* APIs? > Or, is the function sg_alloc_table_from_buf() not to be used with such > buffers? It should be usable with kmapped buffers too: I'll provide a new version to support that. That makes me realize I'm not checking the virtual address consistency in sg_check_constraints(). Thanks, Boris -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- 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