cron job: media_tree daily build: OK
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Sun May 22 04:00:28 CEST 2016 git branch: test git hash: bc2b80ee3490651904f121eac1c8fb7652d48253 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.5.0-264 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: OK linux-2.6.37.6-i686: OK linux-2.6.38.8-i686: OK linux-2.6.39.4-i686: OK linux-3.0.60-i686: OK linux-3.1.10-i686: OK linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: OK linux-3.5.7-i686: OK linux-3.6.11-i686: OK linux-3.7.4-i686: OK linux-3.8-i686: OK linux-3.9.2-i686: OK linux-3.10.1-i686: OK linux-3.11.1-i686: OK linux-3.12.23-i686: OK linux-3.13.11-i686: OK linux-3.14.9-i686: OK linux-3.15.2-i686: OK linux-3.16.7-i686: OK linux-3.17.8-i686: OK linux-3.18.7-i686: OK linux-3.19-i686: OK 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-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: OK linux-3.7.4-x86_64: OK linux-3.8-x86_64: OK linux-3.9.2-x86_64: OK linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: OK linux-3.12.23-x86_64: OK linux-3.13.11-x86_64: OK linux-3.14.9-x86_64: OK linux-3.15.2-x86_64: OK linux-3.16.7-x86_64: OK linux-3.17.8-x86_64: OK linux-3.18.7-x86_64: OK linux-3.19-x86_64: OK 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-x86_64: OK apps: OK spec-git: OK sparse: WARNINGS smatch: WARNINGS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Sunday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Sunday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv2 4/6] MAINTAINERS: add zd1301_demod driver
DVB-T demodulator driver for ZyDAS ZD1301 chip. Signed-off-by: Antti Palosaari--- MAINTAINERS | 9 + 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 090bec2..a4ae460 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12391,6 +12391,15 @@ L: zd1211-d...@lists.sourceforge.net (subscribers-only) S: Maintained F: drivers/net/wireless/zydas/zd1211rw/ +ZD1301_DEMOD MEDIA DRIVER +M: Antti Palosaari +L: linux-media@vger.kernel.org +W: https://linuxtv.org/ +W: http://palosaari.fi/linux/ +Q: https://patchwork.linuxtv.org/project/linux-media/list/ +S: Maintained +F: drivers/media/dvb-frontends/zd1301_demod* + ZPOOL COMPRESSED PAGE STORAGE API M: Dan Streetman L: linux...@kvack.org -- http://palosaari.fi/ -- 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
[PATCHv2 6/6] MAINTAINERS: add zd1301 DVB USB interface driver
DVB USB interface driver for ZyDAS ZD1301 chip. Signed-off-by: Antti Palosaari--- MAINTAINERS | 9 + 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a4ae460..d2559e1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12400,6 +12400,15 @@ Q: https://patchwork.linuxtv.org/project/linux-media/list/ S: Maintained F: drivers/media/dvb-frontends/zd1301_demod* +ZD1301 MEDIA DRIVER +M: Antti Palosaari +L: linux-media@vger.kernel.org +W: https://linuxtv.org/ +W: http://palosaari.fi/linux/ +Q: https://patchwork.linuxtv.org/project/linux-media/list/ +S: Maintained +F: drivers/media/usb/dvb-usb-v2/zd1301* + ZPOOL COMPRESSED PAGE STORAGE API M: Dan Streetman L: linux...@kvack.org -- http://palosaari.fi/ -- 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
[PATCHv2 2/6] mt2060: add param to split long i2c writes
Add configuration parameter to split long i2c writes as some I2C adapters cannot write 10 bytes used as a one go. Signed-off-by: Antti Palosaari--- drivers/media/tuners/mt2060.c | 21 + drivers/media/tuners/mt2060.h | 3 +++ drivers/media/tuners/mt2060_priv.h | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/media/tuners/mt2060.c b/drivers/media/tuners/mt2060.c index aa8280a..6e16a9f 100644 --- a/drivers/media/tuners/mt2060.c +++ b/drivers/media/tuners/mt2060.c @@ -71,13 +71,24 @@ static int mt2060_writereg(struct mt2060_priv *priv, u8 reg, u8 val) // Writes a set of consecutive registers static int mt2060_writeregs(struct mt2060_priv *priv,u8 *buf, u8 len) { + int rem, val_len; + u8 xfer_buf[16]; struct i2c_msg msg = { - .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = len + .addr = priv->cfg->i2c_address, .flags = 0, .buf = xfer_buf }; - if (i2c_transfer(priv->i2c, , 1) != 1) { - printk(KERN_WARNING "mt2060 I2C write failed (len=%i)\n",(int)len); - return -EREMOTEIO; + + for (rem = len - 1; rem > 0; rem -= priv->i2c_max_regs) { + val_len = min_t(int, rem, priv->i2c_max_regs); + msg.len = 1 + val_len; + xfer_buf[0] = buf[0] + len - 1 - rem; + memcpy(_buf[1], [1 + len - 1 - rem], val_len); + + if (i2c_transfer(priv->i2c, , 1) != 1) { + printk(KERN_WARNING "mt2060 I2C write failed (len=%i)\n", val_len); + return -EREMOTEIO; + } } + return 0; } @@ -370,6 +381,7 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter priv->cfg = cfg; priv->i2c = i2c; priv->if1_freq = if1; + priv->i2c_max_regs = ~0; if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); /* open i2c_gate */ @@ -427,6 +439,7 @@ static int mt2060_probe(struct i2c_client *client, dev->i2c = client->adapter; dev->if1_freq = pdata->if1 ? pdata->if1 : 1220; dev->client = client; + dev->i2c_max_regs = pdata->i2c_write_max ? pdata->i2c_write_max - 1 : ~0; ret = mt2060_readreg(dev, REG_PART_REV, _id); if (ret) { diff --git a/drivers/media/tuners/mt2060.h b/drivers/media/tuners/mt2060.h index 05c0d55..f0572ac 100644 --- a/drivers/media/tuners/mt2060.h +++ b/drivers/media/tuners/mt2060.h @@ -34,12 +34,15 @@ struct i2c_adapter; * struct mt2060_platform_data - Platform data for the mt2060 driver * @clock_out: Clock output setting. 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1. * @if1: First IF used [MHz]. 0 defaults to 1220. + * @i2c_write_max: Maximum number of bytes I2C adapter can write at once. + * 0 defaults to maximum. * @dvb_frontend: DVB frontend. */ struct mt2060_platform_data { u8 clock_out; u16 if1; + unsigned int i2c_write_max:5; struct dvb_frontend *dvb_frontend; }; diff --git a/drivers/media/tuners/mt2060_priv.h b/drivers/media/tuners/mt2060_priv.h index dfc4a06..f0fdb83 100644 --- a/drivers/media/tuners/mt2060_priv.h +++ b/drivers/media/tuners/mt2060_priv.h @@ -98,6 +98,7 @@ struct mt2060_priv { struct i2c_client *client; struct mt2060_config config; + u8 i2c_max_regs; u32 frequency; u16 if1_freq; u8 fmfreq; -- http://palosaari.fi/ -- 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
[PATCHv2 5/6] zd1301: ZyDAS ZD1301 DVB USB interface driver
ZyDAS ZD1301 is chip having USB interface and DVB-T demodulator integrated. This driver is for USB interface part. Device has USB ID 0ace:13a1. Used tuner is MT2060. Signed-off-by: Antti Palosaari--- drivers/media/dvb-core/dvb-usb-ids.h | 1 + drivers/media/usb/dvb-usb-v2/Kconfig | 8 + drivers/media/usb/dvb-usb-v2/Makefile | 3 + drivers/media/usb/dvb-usb-v2/zd1301.c | 281 ++ drivers/media/usb/dvb-usb-v2/zd1301.h | 36 + 5 files changed, 329 insertions(+) create mode 100644 drivers/media/usb/dvb-usb-v2/zd1301.c create mode 100644 drivers/media/usb/dvb-usb-v2/zd1301.h diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index a7a4674..7c73086 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h @@ -73,6 +73,7 @@ #define USB_VID_GIGABYTE 0x1044 #define USB_VID_YUAN 0x1164 #define USB_VID_XTENSIONS 0x1ae7 +#define USB_VID_ZYDAS 0x0ace #define USB_VID_HUMAX_COEX 0x10b9 #define USB_VID_7740x7a69 #define USB_VID_EVOLUTEPC 0x1e59 diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 3dc8ef0..c279183 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -151,3 +151,11 @@ config DVB_USB_DVBSKY select DVB_SP2 if MEDIA_SUBDRV_AUTOSELECT help Say Y here to support the USB receivers from DVBSky. + +config DVB_USB_ZD1301 + tristate "ZyDAS ZD1301" + depends on DVB_USB_V2 + select DVB_ZD1301_DEMOD if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT + help + Say Y here to support the ZyDAS ZD1301 DVB USB receiver. diff --git a/drivers/media/usb/dvb-usb-v2/Makefile b/drivers/media/usb/dvb-usb-v2/Makefile index f10d4df..969f68e 100644 --- a/drivers/media/usb/dvb-usb-v2/Makefile +++ b/drivers/media/usb/dvb-usb-v2/Makefile @@ -40,6 +40,9 @@ obj-$(CONFIG_DVB_USB_RTL28XXU) += dvb-usb-rtl28xxu.o dvb-usb-dvbsky-objs := dvbsky.o obj-$(CONFIG_DVB_USB_DVBSKY) += dvb-usb-dvbsky.o +dvb-usb-zd1301-objs := zd1301.o +obj-$(CONFIG_DVB_USB_ZD1301) += zd1301.o + ccflags-y += -I$(srctree)/drivers/media/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb-frontends ccflags-y += -I$(srctree)/drivers/media/tuners diff --git a/drivers/media/usb/dvb-usb-v2/zd1301.c b/drivers/media/usb/dvb-usb-v2/zd1301.c new file mode 100644 index 000..677563b --- /dev/null +++ b/drivers/media/usb/dvb-usb-v2/zd1301.c @@ -0,0 +1,281 @@ +/* + * ZyDAS ZD1301 driver (USB interface) + * + * Copyright (C) 2015 Antti Palosaari + * + *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. + * + *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 "zd1301.h" + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +static int zd1301_ctrl_msg(struct dvb_usb_device *d, const u8 *wbuf, + unsigned int wlen, u8 *rbuf, unsigned int rlen) +{ + struct zd1301_dev *dev = d_to_priv(d); + struct usb_interface *intf = d->intf; + int ret, actual_length; + + mutex_lock(>usb_mutex); + + memcpy(>buf, wbuf, wlen); + + dev_dbg(>dev, ">>> %*ph\n", wlen, dev->buf); + + ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev, 0x04), dev->buf, + wlen, _length, 1000); + if (ret) { + dev_err(>dev, "1st usb_bulk_msg() failed %d\n", ret); + goto err_mutex_unlock; + } + + if (rlen) { + ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 0x83), + dev->buf, rlen, _length, 1000); + if (ret) { + dev_err(>dev, + "2nd usb_bulk_msg() failed %d\n", ret); + goto err_mutex_unlock; + } + + dev_dbg(>dev, "<<< %*ph\n", actual_length, dev->buf); + + if (actual_length != rlen) { + /* +* Chip replies often with 3 byte len stub. On that case +* we have to query new reply. +*/ + dev_dbg(>dev, "repeating reply message\n"); + + ret = usb_bulk_msg(d->udev, + usb_rcvbulkpipe(d->udev, 0x83), +
[PATCHv2 3/6] zd1301_demod: ZyDAS ZD1301 DVB-T demodulator driver
ZyDAS ZD1301 is chip having USB interface and DVB-T demodulator integrated. This driver is for demodulator part. Driver is very reduced, just basic demodulator functionality, no statistics at all. It registers as a platform driver to driver core. Signed-off-by: Antti Palosaari--- drivers/media/dvb-frontends/Kconfig| 7 + drivers/media/dvb-frontends/Makefile | 1 + drivers/media/dvb-frontends/zd1301_demod.c | 550 + drivers/media/dvb-frontends/zd1301_demod.h | 55 +++ 4 files changed, 613 insertions(+) create mode 100644 drivers/media/dvb-frontends/zd1301_demod.c create mode 100644 drivers/media/dvb-frontends/zd1301_demod.h diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index a82f77c..539b18a 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig @@ -503,6 +503,13 @@ config DVB_AS102_FE depends on DVB_CORE default DVB_AS102 +config DVB_ZD1301_DEMOD + tristate "ZyDAS ZD1301" + depends on DVB_CORE && I2C + default m if !MEDIA_SUBDRV_AUTOSELECT + help + Say Y when you want to support this frontend. + comment "DVB-C (cable) frontends" depends on DVB_CORE diff --git a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile index eb7191f..c3779bb 100644 --- a/drivers/media/dvb-frontends/Makefile +++ b/drivers/media/dvb-frontends/Makefile @@ -123,3 +123,4 @@ obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o obj-$(CONFIG_DVB_TC90522) += tc90522.o obj-$(CONFIG_DVB_HORUS3A) += horus3a.o obj-$(CONFIG_DVB_ASCOT2E) += ascot2e.o +obj-$(CONFIG_DVB_ZD1301_DEMOD) += zd1301_demod.o diff --git a/drivers/media/dvb-frontends/zd1301_demod.c b/drivers/media/dvb-frontends/zd1301_demod.c new file mode 100644 index 000..1b1f8d5 --- /dev/null +++ b/drivers/media/dvb-frontends/zd1301_demod.c @@ -0,0 +1,550 @@ +/* + * ZyDAS ZD1301 driver (demodulator) + * + * Copyright (C) 2015 Antti Palosaari + * + *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. + * + *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 "zd1301_demod.h" + +static u8 zd1301_demod_gain = 0x38; +module_param_named(gain, zd1301_demod_gain, byte, 0644); +MODULE_PARM_DESC(gain, "gain (value: 0x00 - 0x70, default: 0x38)"); + +struct zd1301_demod_dev { + struct platform_device *pdev; + struct dvb_frontend frontend; + struct i2c_adapter adapter; + u8 gain; +}; + +static int zd1301_demod_wreg(struct zd1301_demod_dev *dev, u16 reg, u8 val) +{ + struct platform_device *pdev = dev->pdev; + struct zd1301_demod_platform_data *pdata = pdev->dev.platform_data; + + return pdata->reg_write(pdata->reg_priv, reg, val); +} + +static int zd1301_demod_rreg(struct zd1301_demod_dev *dev, u16 reg, u8 *val) +{ + struct platform_device *pdev = dev->pdev; + struct zd1301_demod_platform_data *pdata = pdev->dev.platform_data; + + return pdata->reg_read(pdata->reg_priv, reg, val); +} + +static int zd1301_demod_set_frontend(struct dvb_frontend *fe) +{ + struct zd1301_demod_dev *dev = fe->demodulator_priv; + struct platform_device *pdev = dev->pdev; + struct dtv_frontend_properties *c = >dtv_property_cache; + int ret; + u32 if_frequency; + u8 r6a50_val; + + dev_dbg(>dev, "frequency=%u bandwidth_hz=%u\n", + c->frequency, c->bandwidth_hz); + + /* Program tuner */ + if (fe->ops.tuner_ops.set_params) { + ret = fe->ops.tuner_ops.set_params(fe); + if (ret) + goto err; + } + + if (fe->ops.tuner_ops.get_if_frequency) { + ret = fe->ops.tuner_ops.get_if_frequency(fe, _frequency); + if (ret) + goto err; + + dev_dbg(>dev, "if_frequency=%u\n", if_frequency); + + if (if_frequency != 3615) + if (ret) + goto err; + } + + switch (c->bandwidth_hz) { + case 600: + r6a50_val = 0x78; + break; + case 700: + r6a50_val = 0x68; + break; + case 800: + r6a50_val = 0x58; + break; + default: + ret = -EINVAL; + goto err; + } + + ret = zd1301_demod_wreg(dev, 0x6a60, 0x11); + if (ret) + goto err; + ret = zd1301_demod_wreg(dev, 0x6a47, 0x46); + if (ret) +
[PATCHv2 1/6] mt2060: add i2c bindings
Add proper i2c driver model bindings. Signed-off-by: Antti Palosaari--- drivers/media/tuners/mt2060.c | 83 ++ drivers/media/tuners/mt2060.h | 20 + drivers/media/tuners/mt2060_priv.h | 2 + 3 files changed, 105 insertions(+) diff --git a/drivers/media/tuners/mt2060.c b/drivers/media/tuners/mt2060.c index b87b254..aa8280a 100644 --- a/drivers/media/tuners/mt2060.c +++ b/drivers/media/tuners/mt2060.c @@ -397,6 +397,89 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter } EXPORT_SYMBOL(mt2060_attach); +static int mt2060_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct mt2060_platform_data *pdata = client->dev.platform_data; + struct dvb_frontend *fe; + struct mt2060_priv *dev; + int ret; + u8 chip_id; + + dev_dbg(>dev, "\n"); + + if (!pdata) { + dev_err(>dev, "Cannot proceed without platform data\n"); + ret = -EINVAL; + goto err; + } + + dev = devm_kzalloc(>dev, sizeof(*dev), GFP_KERNEL); + if (!dev) { + ret = -ENOMEM; + goto err; + } + + fe = pdata->dvb_frontend; + dev->config.i2c_address = client->addr; + dev->config.clock_out = pdata->clock_out; + dev->cfg = >config; + dev->i2c = client->adapter; + dev->if1_freq = pdata->if1 ? pdata->if1 : 1220; + dev->client = client; + + ret = mt2060_readreg(dev, REG_PART_REV, _id); + if (ret) { + ret = -ENODEV; + goto err; + } + + dev_dbg(>dev, "chip id=%02x\n", chip_id); + + if (chip_id != PART_REV) { + ret = -ENODEV; + goto err; + } + + dev_info(>dev, "Microtune MT2060 successfully identified\n"); + memcpy(>ops.tuner_ops, _tuner_ops, sizeof(fe->ops.tuner_ops)); + fe->ops.tuner_ops.release = NULL; + fe->tuner_priv = dev; + i2c_set_clientdata(client, dev); + + mt2060_calibrate(dev); + + return 0; +err: + dev_dbg(>dev, "failed=%d\n", ret); + return ret; +} + +static int mt2060_remove(struct i2c_client *client) +{ + dev_dbg(>dev, "\n"); + + return 0; +} + +static const struct i2c_device_id mt2060_id_table[] = { + {"mt2060", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, mt2060_id_table); + +static struct i2c_driver mt2060_driver = { + .driver = { + .name = "mt2060", + .suppress_bind_attrs = true, + }, + .probe = mt2060_probe, + .remove = mt2060_remove, + .id_table = mt2060_id_table, +}; + +module_i2c_driver(mt2060_driver); + MODULE_AUTHOR("Olivier DANET"); MODULE_DESCRIPTION("Microtune MT2060 silicon tuner driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/tuners/mt2060.h b/drivers/media/tuners/mt2060.h index 6efed35..05c0d55 100644 --- a/drivers/media/tuners/mt2060.h +++ b/drivers/media/tuners/mt2060.h @@ -25,6 +25,26 @@ struct dvb_frontend; struct i2c_adapter; +/* + * I2C address + * 0x60, ... + */ + +/** + * struct mt2060_platform_data - Platform data for the mt2060 driver + * @clock_out: Clock output setting. 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1. + * @if1: First IF used [MHz]. 0 defaults to 1220. + * @dvb_frontend: DVB frontend. + */ + +struct mt2060_platform_data { + u8 clock_out; + u16 if1; + struct dvb_frontend *dvb_frontend; +}; + + +/* configuration struct for mt2060_attach() */ struct mt2060_config { u8 i2c_address; u8 clock_out; /* 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1 */ diff --git a/drivers/media/tuners/mt2060_priv.h b/drivers/media/tuners/mt2060_priv.h index 2b60de6..dfc4a06 100644 --- a/drivers/media/tuners/mt2060_priv.h +++ b/drivers/media/tuners/mt2060_priv.h @@ -95,6 +95,8 @@ struct mt2060_priv { struct mt2060_config *cfg; struct i2c_adapter *i2c; + struct i2c_client *client; + struct mt2060_config config; u32 frequency; u16 if1_freq; -- http://palosaari.fi/ -- 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] rtl2832: add support for slave ts pid filter
On 05/21/2016 10:38 PM, Benjamin Larsson wrote: The rtl2832 demod has 2 sets of PID filters. This patch enables the filter support when using a slave demod. Ignore this patch for now. MvH Benjamin Larsson -- 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] rtl2832: add support for slave ts pid filter
The rtl2832 demod has 2 sets of PID filters. This patch enables the filter support when using a slave demod. Signed-off-by: Benjamin Larsson--- drivers/media/dvb-frontends/rtl2832.c | 21 ++--- drivers/media/dvb-frontends/rtl2832_priv.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index 7c96f76..fe771b9 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -409,6 +409,7 @@ static int rtl2832_init(struct dvb_frontend *fe) c->post_bit_count.len = 1; c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; dev->sleeping = false; + dev->slave_ts = 0; return 0; err: @@ -1124,10 +1125,16 @@ static int rtl2832_pid_filter_ctrl(struct dvb_frontend *fe, int onoff) else u8tmp = 0x00; - ret = rtl2832_update_bits(client, 0x061, 0xc0, u8tmp); + if (dev->slave_ts) { + ret = rtl2832_update_bits(client, 0x021, 0xc0, u8tmp); + } else { + ret = rtl2832_update_bits(client, 0x061, 0xc0, u8tmp); + } if (ret) goto err; + dev->slave_ts = 1; + return 0; err: dev_dbg(>dev, "failed=%d\n", ret); @@ -1159,14 +1166,22 @@ static int rtl2832_pid_filter(struct dvb_frontend *fe, u8 index, u16 pid, buf[1] = (dev->filters >> 8) & 0xff; buf[2] = (dev->filters >> 16) & 0xff; buf[3] = (dev->filters >> 24) & 0xff; - ret = rtl2832_bulk_write(client, 0x062, buf, 4); + + if (dev->slave_ts) + ret = rtl2832_bulk_write(client, 0x022, buf, 4); + else + ret = rtl2832_bulk_write(client, 0x062, buf, 4); if (ret) goto err; /* add PID */ buf[0] = (pid >> 8) & 0xff; buf[1] = (pid >> 0) & 0xff; - ret = rtl2832_bulk_write(client, 0x066 + 2 * index, buf, 2); + + if (dev->slave_ts) + ret = rtl2832_bulk_write(client, 0x026 + 2 * index, buf, 2); + else + ret = rtl2832_bulk_write(client, 0x066 + 2 * index, buf, 2); if (ret) goto err; diff --git a/drivers/media/dvb-frontends/rtl2832_priv.h b/drivers/media/dvb-frontends/rtl2832_priv.h index 6b875f4..561f8ab 100644 --- a/drivers/media/dvb-frontends/rtl2832_priv.h +++ b/drivers/media/dvb-frontends/rtl2832_priv.h @@ -45,6 +45,7 @@ struct rtl2832_dev { bool sleeping; struct delayed_work i2c_gate_work; unsigned long filters; /* PID filter */ + unsigned long slave_ts; }; struct rtl2832_reg_entry { -- 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
Re: DVBSky T330 DVB-C regression Linux 4.1.12 to 4.3
> Antti Palosaarihat am 21. Mai 2016 um 02:16 geschrieben: > > Reason is that silicon vendor has changed firmware API somewhere between > 4.0.11 and 4.0.19 so that newer firmwares will put device to full sleep > which causes even device firmware lost. > > Fix is here, and I hope I can push it to 4.8 - it will took about half > year from this day until it is on mainline (it is not regression so I > cannot send it to older kernels and for 4.7 it is too late). Before that > just use 4.0.11 firmware. > > https://git.linuxtv.org/anttip/media_tree.git/commit/?h=mygica=cfd6ab8e840815eb54eb777c9f64807022ba922c > Thank you for the fix. I can confirm that it works with 4.0.11 and 4.0.19 firmware. Let's hope that you can push it at least to 4.8. Kind regards, Rolf -- 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: use vma_pages().
Replace explicit computation of vma page count by a call to vma_pages() Signed-off-by: Muhammad Falak R Wani--- drivers/dma-buf/dma-buf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 4a2c07e..b0317ec 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -90,7 +90,7 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma) dmabuf = file->private_data; /* check for overflowing the buffer's size */ - if (vma->vm_pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) > + if (vma->vm_pgoff + vma_pages(vma) > dmabuf->size >> PAGE_SHIFT) return -EINVAL; @@ -723,11 +723,11 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma, return -EINVAL; /* check for offset overflow */ - if (pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) < pgoff) + if (pgoff + vma_pages(vma) < pgoff) return -EOVERFLOW; /* check for overflowing the buffer's size */ - if (pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) > + if (pgoff + vma_pages(vma) > dmabuf->size >> PAGE_SHIFT) return -EINVAL; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3] support for AD5820 camera auto-focus coil
Hi, On 21.05.2016 13:56, Pavel Machek wrote: This adds support for AD5820 autofocus coil, found for example in Nokia N900 smartphone. Signed-off-by: Pavel Machek--- v2: simple cleanups, fix error paths, simplify probe v3: more cleanups, remove printk, add include diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 993dc50..77313a1 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -279,6 +279,13 @@ config VIDEO_ML86V7667 To compile this driver as a module, choose M here: the module will be called ml86v7667. +config VIDEO_AD5820 + tristate "AD5820 lens voice coil support" + depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + ---help--- + This is a driver for the AD5820 camera lens voice coil. + It is used for example in Nokia N900 (RX-51). + config VIDEO_SAA7110 tristate "Philips SAA7110 video decoder" depends on VIDEO_V4L2 && I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 94f2c99..34434ae 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -19,6 +20,7 @@ obj-$(CONFIG_VIDEO_SAA717X) += saa717x.o obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o +obj-$(CONFIG_VIDEO_AD5820) += ad5820.o obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o obj-$(CONFIG_VIDEO_ADV7180) += adv7180.o diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c new file mode 100644 index 000..7725829 --- /dev/null +++ b/drivers/media/i2c/ad5820.c @@ -0,0 +1,416 @@ +/* + * drivers/media/i2c/ad5820.c + * + * AD5820 DAC driver for camera voice coil focus. + * + * Copyright (C) 2008 Nokia Corporation + * Copyright (C) 2007 Texas Instruments + * Copyright (C) 2016 Pavel Machek + * + * Contact: Tuukka Toivonen + * Sakari Ailus + * + * Based on af_d88.c by Texas Instruments. + * + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + At least on my machine checkpatch.pl complains about FSF address. +#include +#include +#include +#include +#include +#include Doesn't seem to get used. +#include +#include +#include + +#include +#include + +#define CODE_TO_RAMP_US(s) ((s) == 0 ? 0 : (1 << ((s) - 1)) * 50) +#define RAMP_US_TO_CODE(c) fls(((c) + ((c)>>1)) / 50) + +/** + * @brief I2C write using i2c_transfer(). + * @param coil - the driver data structure + * @param data - register value to be written + * @returns nonnegative on success, negative if failed + */ +static int ad5820_write(struct ad5820_device *coil, u16 data) +{ + struct i2c_client *client = v4l2_get_subdevdata(>subdev); + struct i2c_msg msg; + int r; + + if (!client->adapter) + return -ENODEV; + + data = cpu_to_be16(data); + msg.addr = client->addr; + msg.flags = 0; + msg.len = 2; + msg.buf = (u8 *) + + r = i2c_transfer(client->adapter, , 1); + if (r < 0) { + dev_err(>dev, "write failed, error %d\n", r); + return r; + } + + return 0; +} + +/* + * Calculate status word and write it to the device based on current + * values of V4L2 controls. It is assumed that the stored V4L2 control + * values are properly limited and rounded. + */ +static int ad5820_update_hw(struct ad5820_device *coil) +{ + u16 status; + + status = RAMP_US_TO_CODE(coil->focus_ramp_time); + status |= coil->focus_ramp_mode + ? AD5820_RAMP_MODE_64_16 : AD5820_RAMP_MODE_LINEAR; + status |= coil->focus_absolute << AD5820_DAC_SHIFT; + + if (coil->standby) + status |= AD5820_POWER_DOWN; + + return ad5820_write(coil, status); +} + +/* + * Power handling + */ +static int ad5820_power_off(struct ad5820_device *coil, int standby) +{ + int ret = 0; + + /* +* Go to standby first as real power off my be denied by the hardware +* (single power line control for both coil and sensor). +*/ + if (standby) { + coil->standby = 1; + ret = ad5820_update_hw(coil); + } + + ret |= regulator_disable(coil->vana); + + return ret; +} + +static int ad5820_power_on(struct ad5820_device *coil, int
[PATCH 0004/1529] Fix typo
Signed-off-by: Andrea Gelmini--- Documentation/DocBook/media/v4l/lirc_device_interface.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/lirc_device_interface.xml b/Documentation/DocBook/media/v4l/lirc_device_interface.xml index 34cada2..725b221 100644 --- a/Documentation/DocBook/media/v4l/lirc_device_interface.xml +++ b/Documentation/DocBook/media/v4l/lirc_device_interface.xml @@ -114,7 +114,7 @@ on working with the default settings initially. Some receiver have maximum resolution which is defined by internal sample rate or data format limitations. E.g. it's common that signals can only be reported in 50 microsecond steps. This integer value is used by - lircd to automatically adjust the aeps tolerance value in the lircd + lircd to automatically adjust the steps tolerance value in the lircd config file. -- 2.8.2.534.g1f66975 -- 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 0003/1529] Fix typo
Signed-off-by: Andrea Gelmini--- Documentation/DocBook/media/v4l/fdl-appendix.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/fdl-appendix.xml b/Documentation/DocBook/media/v4l/fdl-appendix.xml index ae22394..71299a3 100644 --- a/Documentation/DocBook/media/v4l/fdl-appendix.xml +++ b/Documentation/DocBook/media/v4l/fdl-appendix.xml @@ -526,7 +526,7 @@ You may extract a single document from such a collection, and - dispbibute it individually under this License, provided you + distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. -- 2.8.2.534.g1f66975 -- 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 0002/1529] Fix typo
Signed-off-by: Andrea Gelmini--- Documentation/DocBook/media/v4l/controls.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index e2e5484..dc3ef53 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -4615,7 +4615,7 @@ manually or automatically if set to zero. Unit, range and step are driver-specif sample rate in each spatial dimension. See , clause A.1.1. for more details. The V4L2_CID_JPEG_CHROMA_SUBSAMPLING control determines how - Cb and Cr components are downsampled after coverting an input image + Cb and Cr components are downsampled after converting an input image from RGB to Y'CbCr color space. -- 2.8.2.534.g1f66975 -- 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
[PATCHv3] support for AD5820 camera auto-focus coil
This adds support for AD5820 autofocus coil, found for example in Nokia N900 smartphone. Signed-off-by: Pavel Machek--- v2: simple cleanups, fix error paths, simplify probe v3: more cleanups, remove printk, add include diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 993dc50..77313a1 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -279,6 +279,13 @@ config VIDEO_ML86V7667 To compile this driver as a module, choose M here: the module will be called ml86v7667. +config VIDEO_AD5820 + tristate "AD5820 lens voice coil support" + depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + ---help--- + This is a driver for the AD5820 camera lens voice coil. + It is used for example in Nokia N900 (RX-51). + config VIDEO_SAA7110 tristate "Philips SAA7110 video decoder" depends on VIDEO_V4L2 && I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 94f2c99..34434ae 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -19,6 +20,7 @@ obj-$(CONFIG_VIDEO_SAA717X) += saa717x.o obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o +obj-$(CONFIG_VIDEO_AD5820) += ad5820.o obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o obj-$(CONFIG_VIDEO_ADV7180) += adv7180.o diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c new file mode 100644 index 000..7725829 --- /dev/null +++ b/drivers/media/i2c/ad5820.c @@ -0,0 +1,416 @@ +/* + * drivers/media/i2c/ad5820.c + * + * AD5820 DAC driver for camera voice coil focus. + * + * Copyright (C) 2008 Nokia Corporation + * Copyright (C) 2007 Texas Instruments + * Copyright (C) 2016 Pavel Machek + * + * Contact: Tuukka Toivonen + * Sakari Ailus + * + * Based on af_d88.c by Texas Instruments. + * + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define CODE_TO_RAMP_US(s) ((s) == 0 ? 0 : (1 << ((s) - 1)) * 50) +#define RAMP_US_TO_CODE(c) fls(((c) + ((c)>>1)) / 50) + +/** + * @brief I2C write using i2c_transfer(). + * @param coil - the driver data structure + * @param data - register value to be written + * @returns nonnegative on success, negative if failed + */ +static int ad5820_write(struct ad5820_device *coil, u16 data) +{ + struct i2c_client *client = v4l2_get_subdevdata(>subdev); + struct i2c_msg msg; + int r; + + if (!client->adapter) + return -ENODEV; + + data = cpu_to_be16(data); + msg.addr = client->addr; + msg.flags = 0; + msg.len = 2; + msg.buf = (u8 *) + + r = i2c_transfer(client->adapter, , 1); + if (r < 0) { + dev_err(>dev, "write failed, error %d\n", r); + return r; + } + + return 0; +} + +/* + * Calculate status word and write it to the device based on current + * values of V4L2 controls. It is assumed that the stored V4L2 control + * values are properly limited and rounded. + */ +static int ad5820_update_hw(struct ad5820_device *coil) +{ + u16 status; + + status = RAMP_US_TO_CODE(coil->focus_ramp_time); + status |= coil->focus_ramp_mode + ? AD5820_RAMP_MODE_64_16 : AD5820_RAMP_MODE_LINEAR; + status |= coil->focus_absolute << AD5820_DAC_SHIFT; + + if (coil->standby) + status |= AD5820_POWER_DOWN; + + return ad5820_write(coil, status); +} + +/* + * Power handling + */ +static int ad5820_power_off(struct ad5820_device *coil, int standby) +{ + int ret = 0; + + /* +* Go to standby first as real power off my be denied by the hardware +* (single power line control for both coil and sensor). +*/ + if (standby) { + coil->standby = 1; + ret = ad5820_update_hw(coil); + } + + ret |= regulator_disable(coil->vana); + + return ret; +} + +static int ad5820_power_on(struct ad5820_device *coil, int restore) +{ + int ret; + + printk("ad5820_power_on: 1\n"); + ret = regulator_enable(coil->vana); + if (ret < 0) + return
Re: [PATCHv2] support for AD5820 camera auto-focus coil
Hi, On 21.05.2016 08:43, Pavel Machek wrote: This adds support for AD5820 autofocus coil, found for example in Nokia N900 smartphone. Signed-off-by: Pavel Machek--- v2: simple cleanups, fix error paths, simplify probe I think it is ready. Please apply :-). diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 993dc50..77313a1 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -279,6 +279,13 @@ config VIDEO_ML86V7667 To compile this driver as a module, choose M here: the module will be called ml86v7667. +config VIDEO_AD5820 + tristate "AD5820 lens voice coil support" + depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + ---help--- + This is a driver for the AD5820 camera lens voice coil. + It is used for example in Nokia N900 (RX-51). + config VIDEO_SAA7110 tristate "Philips SAA7110 video decoder" depends on VIDEO_V4L2 && I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 94f2c99..34434ae 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -19,6 +20,7 @@ obj-$(CONFIG_VIDEO_SAA717X) += saa717x.o obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o +obj-$(CONFIG_VIDEO_AD5820) += ad5820.o obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o obj-$(CONFIG_VIDEO_ADV7180) += adv7180.o diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c new file mode 100644 index 000..7725829 --- /dev/null +++ b/drivers/media/i2c/ad5820.c @@ -0,0 +1,416 @@ +/* + * drivers/media/i2c/ad5820.c + * + * AD5820 DAC driver for camera voice coil focus. + * + * Copyright (C) 2008 Nokia Corporation + * Copyright (C) 2007 Texas Instruments + * Copyright (C) 2016 Pavel Machek + * + * Contact: Tuukka Toivonen + * Sakari Ailus + * + * Based on af_d88.c by Texas Instruments. + * + * 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. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + Remove FSF address from the above. +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include drivers/media/i2c/ad5820.c:40:26: fatal error: media/ad5820.h: No such file or directory +#include + +#define CODE_TO_RAMP_US(s) ((s) == 0 ? 0 : (1 << ((s) - 1)) * 50) +#define RAMP_US_TO_CODE(c) fls(((c) + ((c)>>1)) / 50) + +/** + * @brief I2C write using i2c_transfer(). + * @param coil - the driver data structure + * @param data - register value to be written + * @returns nonnegative on success, negative if failed + */ +static int ad5820_write(struct ad5820_device *coil, u16 data) +{ + struct i2c_client *client = v4l2_get_subdevdata(>subdev); + struct i2c_msg msg; + int r; + + if (!client->adapter) + return -ENODEV; + + data = cpu_to_be16(data); + msg.addr = client->addr; + msg.flags = 0; + msg.len = 2; + msg.buf = (u8 *) + + r = i2c_transfer(client->adapter, , 1); + if (r < 0) { + dev_err(>dev, "write failed, error %d\n", r); + return r; + } + + return 0; +} + +/* + * Calculate status word and write it to the device based on current + * values of V4L2 controls. It is assumed that the stored V4L2 control + * values are properly limited and rounded. + */ +static int ad5820_update_hw(struct ad5820_device *coil) +{ + u16 status; + + status = RAMP_US_TO_CODE(coil->focus_ramp_time); + status |= coil->focus_ramp_mode + ? AD5820_RAMP_MODE_64_16 : AD5820_RAMP_MODE_LINEAR; + status |= coil->focus_absolute << AD5820_DAC_SHIFT; + + if (coil->standby) + status |= AD5820_POWER_DOWN; + + return ad5820_write(coil, status); +} + +/* + * Power handling + */ +static int ad5820_power_off(struct ad5820_device *coil, int standby) +{ + int ret = 0; + + /* +* Go to standby first as real power off my be denied by the hardware +* (single power line control for both coil and sensor). +*/ + if (standby) { + coil->standby = 1; + ret = ad5820_update_hw(coil); + } + + ret |= regulator_disable(coil->vana); + + return ret; +} + +static int ad5820_power_on(struct