From bcb63314e2c23f1ed622418b65f9409512659c73 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 28 Oct 2016 09:31:20 -0200 Subject: [media] media: Drop FSF's postal address from the source code files Drop the FSF's postal address from the source code files that typically contain mostly the license text. Of the 628 removed instances, 578 are outdated. The patch has been created with the following command without manual edits: git grep -l "675 Mass Ave\|59 Temple Place\|51 Franklin St" -- \ drivers/media/ include/media|while read i; do i=$i perl -e ' open(F,"< $ENV{i}"); $a=join("", ); $a =~ s/[ \t]*\*\n.*You should.*\n.*along with.*\n.*(\n.*USA.*$)?\n//m && $a =~ s/(^.*)Or, (point your browser to) /$1To obtain the license, $2\n$1/m; close(F); open(F, "> $ENV{i}"); print F $a; close(F);'; done Signed-off-by: Sakari Ailus --- drivers/media/usb/dvb-usb-v2/af9015.c | 4 ---- drivers/media/usb/dvb-usb-v2/af9015.h | 4 ---- drivers/media/usb/dvb-usb-v2/anysee.c | 4 ---- drivers/media/usb/dvb-usb-v2/anysee.h | 4 ---- drivers/media/usb/dvb-usb-v2/au6610.c | 4 ---- drivers/media/usb/dvb-usb-v2/au6610.h | 4 ---- drivers/media/usb/dvb-usb-v2/ce6230.c | 4 ---- drivers/media/usb/dvb-usb-v2/ce6230.h | 4 ---- drivers/media/usb/dvb-usb-v2/dvbsky.c | 4 ---- drivers/media/usb/dvb-usb-v2/ec168.c | 4 ---- drivers/media/usb/dvb-usb-v2/ec168.h | 4 ---- drivers/media/usb/dvb-usb-v2/lmedm04.c | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.c | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.h | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.h | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-phy.h | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-reg.h | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c | 4 ---- drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h | 4 ---- 23 files changed, 92 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/af9015.c b/drivers/media/usb/dvb-usb-v2/af9015.c index 29011dfabb11..caa1e6101f58 100644 --- a/drivers/media/usb/dvb-usb-v2/af9015.c +++ b/drivers/media/usb/dvb-usb-v2/af9015.c @@ -15,10 +15,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * */ #include "af9015.h" diff --git a/drivers/media/usb/dvb-usb-v2/af9015.h b/drivers/media/usb/dvb-usb-v2/af9015.h index 1db1bb0d57bc..2dd9231a8ece 100644 --- a/drivers/media/usb/dvb-usb-v2/af9015.h +++ b/drivers/media/usb/dvb-usb-v2/af9015.h @@ -15,10 +15,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * */ #ifndef AF9015_H diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c index ae917c042a52..6795c0c609b1 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.c +++ b/drivers/media/usb/dvb-usb-v2/anysee.c @@ -13,10 +13,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * * TODO: * - add smart card reader support for Conditional Access (CA) * diff --git a/drivers/media/usb/dvb-usb-v2/anysee.h b/drivers/media/usb/dvb-usb-v2/anysee.h index 3ca2bca4ebaf..393e2fce2aed 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.h +++ b/drivers/media/usb/dvb-usb-v2/anysee.h @@ -13,10 +13,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * * TODO: * - add smart card reader support for Conditional Access (CA) * diff --git a/drivers/media/usb/dvb-usb-v2/au6610.c b/drivers/media/usb/dvb-usb-v2/au6610.c index ae6a671b7fd5..6ee01cb64ca5 100644 --- a/drivers/media/usb/dvb-usb-v2/au6610.c +++ b/drivers/media/usb/dvb-usb-v2/au6610.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "au6610.h" diff --git a/drivers/media/usb/dvb-usb-v2/au6610.h b/drivers/media/usb/dvb-usb-v2/au6610.h index ea337bfc00b1..aacfcc6fa0f5 100644 --- a/drivers/media/usb/dvb-usb-v2/au6610.h +++ b/drivers/media/usb/dvb-usb-v2/au6610.h @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef AU6610_H diff --git a/drivers/media/usb/dvb-usb-v2/ce6230.c b/drivers/media/usb/dvb-usb-v2/ce6230.c index f67b14bc32e3..e596031a708d 100644 --- a/drivers/media/usb/dvb-usb-v2/ce6230.c +++ b/drivers/media/usb/dvb-usb-v2/ce6230.c @@ -13,10 +13,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * */ #include "ce6230.h" diff --git a/drivers/media/usb/dvb-usb-v2/ce6230.h b/drivers/media/usb/dvb-usb-v2/ce6230.h index 299e57e3390b..b25b3b938e49 100644 --- a/drivers/media/usb/dvb-usb-v2/ce6230.h +++ b/drivers/media/usb/dvb-usb-v2/ce6230.h @@ -13,10 +13,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * */ #ifndef CE6230_H diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c index 0636eac37bbb..5730760e4e93 100644 --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "dvb_usb.h" diff --git a/drivers/media/usb/dvb-usb-v2/ec168.c b/drivers/media/usb/dvb-usb-v2/ec168.c index 0c2b377704ff..1db8aeef3655 100644 --- a/drivers/media/usb/dvb-usb-v2/ec168.c +++ b/drivers/media/usb/dvb-usb-v2/ec168.c @@ -13,10 +13,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * */ #include "ec168.h" diff --git a/drivers/media/usb/dvb-usb-v2/ec168.h b/drivers/media/usb/dvb-usb-v2/ec168.h index 615a6569421f..704955bcaa10 100644 --- a/drivers/media/usb/dvb-usb-v2/ec168.h +++ b/drivers/media/usb/dvb-usb-v2/ec168.h @@ -13,10 +13,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * */ #ifndef EC168_H diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 5fea02672685..c2aff953cd7a 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -48,10 +48,6 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * * * see Documentation/dvb/README.dvb-usb for more information * diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c index 639e156e0c1b..f0ed37da73d4 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "mxl111sf-demod.h" diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h index e6eae9d88e9f..9cb4972ce7a3 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.h @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MXL111SF_DEMOD_H__ diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.c index 2180c13a6dcc..c66861c9342b 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "mxl111sf-gpio.h" diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.h index 16fa4d4daf88..af2c7bc8f301 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-gpio.h @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _DVB_USB_MXL111SF_GPIO_H_ diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c index 6427137a09ef..ffb49c28b15a 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "mxl111sf-i2c.h" diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.h index c486fe02f018..28877c7a8175 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.h @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _DVB_USB_MXL111SF_I2C_H_ diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c index 5b0191178f9f..ffb6e7c72f57 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "mxl111sf-phy.h" diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.h index 25aa4a1ea755..0a61e8a56584 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-phy.h @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _DVB_USB_MXL111SF_PHY_H_ diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-reg.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-reg.h index 1f4bfbcdbabb..ad3f806dcc7a 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-reg.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-reg.h @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _DVB_USB_MXL111SF_REG_H_ diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c index f84bef6034dc..240d736bf1bb 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "mxl111sf-tuner.h" diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h index e96d9a444ed1..11ea07a73271 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.h @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __MXL111SF_TUNER_H__ -- cgit v1.2.3 From 8c34b5c4c82e060de0d8bbf26b978c68bffe5a18 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Sat, 3 Dec 2016 08:55:56 -0200 Subject: [media] rc: raw IR drivers cannot handle cec, unknown or other MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit unknown and other are for IR protocols for which we have no decoder, so the raw IR drivers have no chance of generating them. cec is not an IR protocol. Signed-off-by: Sean Young Cc: Jiri Kosina Cc: Benjamin Tissoires Cc: Bruno Prémont Signed-off-by: Mauro Carvalho Chehab --- drivers/hid/hid-picolcd_cir.c | 2 +- drivers/media/common/siano/smsir.c | 2 +- drivers/media/pci/cx23885/cx23885-input.c | 14 +++++++------- drivers/media/rc/ene_ir.c | 2 +- drivers/media/rc/fintek-cir.c | 2 +- drivers/media/rc/gpio-ir-recv.c | 2 +- drivers/media/rc/igorplugusb.c | 4 ++-- drivers/media/rc/iguanair.c | 2 +- drivers/media/rc/ir-hix5hd2.c | 2 +- drivers/media/rc/ite-cir.c | 2 +- drivers/media/rc/mceusb.c | 2 +- drivers/media/rc/meson-ir.c | 2 +- drivers/media/rc/nuvoton-cir.c | 2 +- drivers/media/rc/rc-loopback.c | 2 +- drivers/media/rc/redrat3.c | 2 +- drivers/media/rc/serial_ir.c | 2 +- drivers/media/rc/st_rc.c | 2 +- drivers/media/rc/streamzap.c | 2 +- drivers/media/rc/sunxi-cir.c | 2 +- drivers/media/rc/ttusbir.c | 2 +- drivers/media/rc/winbond-cir.c | 2 +- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +- drivers/media/usb/dvb-usb/technisat-usb2.c | 2 +- include/media/rc-map.h | 10 ++++++++++ 24 files changed, 40 insertions(+), 30 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/hid/hid-picolcd_cir.c b/drivers/hid/hid-picolcd_cir.c index 96286510f42e..90add97cc54d 100644 --- a/drivers/hid/hid-picolcd_cir.c +++ b/drivers/hid/hid-picolcd_cir.c @@ -114,7 +114,7 @@ int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report) rdev->priv = data; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protocols = RC_BIT_ALL; + rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->open = picolcd_cir_open; rdev->close = picolcd_cir_close; rdev->input_name = data->hdev->name; diff --git a/drivers/media/common/siano/smsir.c b/drivers/media/common/siano/smsir.c index 41f2a3939979..480d8bf3d26a 100644 --- a/drivers/media/common/siano/smsir.c +++ b/drivers/media/common/siano/smsir.c @@ -87,7 +87,7 @@ int sms_ir_init(struct smscore_device_t *coredev) dev->priv = coredev; dev->driver_type = RC_DRIVER_IR_RAW; - dev->allowed_protocols = RC_BIT_ALL; + dev->allowed_protocols = RC_BIT_ALL_IR_DECODER; dev->map_name = sms_get_board(board_id)->rc_codes; dev->driver_name = MODULE_NAME; diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c index 1f092febdbd1..2d4e703b6893 100644 --- a/drivers/media/pci/cx23885/cx23885-input.c +++ b/drivers/media/pci/cx23885/cx23885-input.c @@ -286,28 +286,28 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1250: /* Integrated CX2388[58] IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = RC_BIT_ALL; + allowed_protos = RC_BIT_ALL_IR_DECODER; /* The grey Hauppauge RC-5 remote */ rc_map = RC_MAP_HAUPPAUGE; break; case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = RC_BIT_ALL; + allowed_protos = RC_BIT_ALL_IR_DECODER; /* The grey Terratec remote with orange buttons */ rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS; break; case CX23885_BOARD_TEVII_S470: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = RC_BIT_ALL; + allowed_protos = RC_BIT_ALL_IR_DECODER; /* A guess at the remote */ rc_map = RC_MAP_TEVII_NEC; break; case CX23885_BOARD_MYGICA_X8507: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = RC_BIT_ALL; + allowed_protos = RC_BIT_ALL_IR_DECODER; /* A guess at the remote */ rc_map = RC_MAP_TOTAL_MEDIA_IN_HAND_02; break; @@ -315,7 +315,7 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_TBS_6981: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = RC_BIT_ALL; + allowed_protos = RC_BIT_ALL_IR_DECODER; /* A guess at the remote */ rc_map = RC_MAP_TBS_NEC; break; @@ -327,13 +327,13 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_T982: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = RC_BIT_ALL; + allowed_protos = RC_BIT_ALL_IR_DECODER; rc_map = RC_MAP_DVBSKY; break; case CX23885_BOARD_TT_CT2_4500_CI: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = RC_BIT_ALL; + allowed_protos = RC_BIT_ALL_IR_DECODER; rc_map = RC_MAP_TT_1500; break; default: diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index ce3cb81902ca..fbfefb7a5f7d 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -1054,7 +1054,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) learning_mode_force = false; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protocols = RC_BIT_ALL; + rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->priv = dev; rdev->open = ene_open; rdev->close = ene_close; diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index 308efec57cc1..b391b2f8ab79 100644 --- a/drivers/media/rc/fintek-cir.c +++ b/drivers/media/rc/fintek-cir.c @@ -530,7 +530,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id /* Set up the rc device */ rdev->priv = fintek; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protocols = RC_BIT_ALL; + rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->open = fintek_open; rdev->close = fintek_close; rdev->input_name = FINTEK_DESCRIPTION; diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index 5b63b1f15cb1..0b5aec4b9c9d 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c @@ -165,7 +165,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) if (pdata->allowed_protos) rcdev->allowed_protocols = pdata->allowed_protos; else - rcdev->allowed_protocols = RC_BIT_ALL; + rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY; gpio_dev->rcdev = rcdev; diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c index 5cf983be07a2..4c4827c3408b 100644 --- a/drivers/media/rc/igorplugusb.c +++ b/drivers/media/rc/igorplugusb.c @@ -203,8 +203,8 @@ static int igorplugusb_probe(struct usb_interface *intf, * This device can only store 36 pulses + spaces, which is not enough * for the NEC protocol and many others. */ - rc->allowed_protocols = RC_BIT_ALL & ~(RC_BIT_NEC | RC_BIT_NECX | - RC_BIT_NEC32 | RC_BIT_RC6_6A_20 | + rc->allowed_protocols = RC_BIT_ALL_IR_DECODER & ~(RC_BIT_NEC | + RC_BIT_NECX | RC_BIT_NEC32 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SONY20 | RC_BIT_MCE_KBD | RC_BIT_SANYO); diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index 9554585df8b8..75e1dfb1be26 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c @@ -491,7 +491,7 @@ static int iguanair_probe(struct usb_interface *intf, usb_to_input_id(ir->udev, &rc->input_id); rc->dev.parent = &intf->dev; rc->driver_type = RC_DRIVER_IR_RAW; - rc->allowed_protocols = RC_BIT_ALL; + rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->priv = ir; rc->open = iguanair_open; rc->close = iguanair_close; diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c index d26907e684dc..d95056ad26dc 100644 --- a/drivers/media/rc/ir-hix5hd2.c +++ b/drivers/media/rc/ir-hix5hd2.c @@ -243,7 +243,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev) priv->rate = clk_get_rate(priv->clock); rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protocols = RC_BIT_ALL; + rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->priv = priv; rdev->open = hix5hd2_ir_open; rdev->close = hix5hd2_ir_close; diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index b955a79608e0..3bffc169b31e 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c @@ -1557,7 +1557,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id /* set up ir-core props */ rdev->priv = itdev; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protocols = RC_BIT_ALL; + rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->open = ite_open; rdev->close = ite_close; rdev->s_idle = ite_s_idle; diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index b814ead58e0e..85b220435ff5 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1198,7 +1198,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) rc->dev.parent = dev; rc->priv = ir; rc->driver_type = RC_DRIVER_IR_RAW; - rc->allowed_protocols = RC_BIT_ALL; + rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->timeout = MS_TO_NS(100); if (!ir->flags.no_tx) { rc->s_tx_mask = mceusb_set_tx_mask; diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c index 7eb3f4f1ddcd..3e96e6f1b0c5 100644 --- a/drivers/media/rc/meson-ir.c +++ b/drivers/media/rc/meson-ir.c @@ -145,7 +145,7 @@ static int meson_ir_probe(struct platform_device *pdev) ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY; ir->rc->dev.parent = dev; ir->rc->driver_type = RC_DRIVER_IR_RAW; - ir->rc->allowed_protocols = RC_BIT_ALL; + ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; ir->rc->rx_resolution = US_TO_NS(MESON_TRATE); ir->rc->timeout = MS_TO_NS(200); ir->rc->driver_name = DRIVER_NAME; diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 0f7e2b4d3bee..77c05145c04e 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -1057,7 +1057,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) /* Set up the rc device */ rdev->priv = nvt; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protocols = RC_BIT_ALL; + rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->open = nvt_open; rdev->close = nvt_close; rdev->tx_ir = nvt_tx_ir; diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 698927b3b039..06dd97d4b7cd 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -191,7 +191,7 @@ static int __init loop_init(void) rc->map_name = RC_MAP_EMPTY; rc->priv = &loopdev; rc->driver_type = RC_DRIVER_IR_RAW; - rc->allowed_protocols = RC_BIT_ALL; + rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->timeout = 100 * 1000 * 1000; /* 100 ms */ rc->min_timeout = 1; rc->max_timeout = UINT_MAX; diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 06bea6c00620..4ab0ea02a309 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -957,7 +957,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3) rc->dev.parent = dev; rc->priv = rr3; rc->driver_type = RC_DRIVER_IR_RAW; - rc->allowed_protocols = RC_BIT_ALL; + rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->min_timeout = MS_TO_NS(RR3_RX_MIN_TIMEOUT); rc->max_timeout = MS_TO_NS(RR3_RX_MAX_TIMEOUT); rc->timeout = US_TO_NS(redrat3_get_timeout(rr3)); diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c index 2cb6471641bd..408594ea896c 100644 --- a/drivers/media/rc/serial_ir.c +++ b/drivers/media/rc/serial_ir.c @@ -797,7 +797,7 @@ static int __init serial_ir_init_module(void) rcdev->close = serial_ir_close; rcdev->dev.parent = &serial_ir.pdev->dev; rcdev->driver_type = RC_DRIVER_IR_RAW; - rcdev->allowed_protocols = RC_BIT_ALL; + rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rcdev->driver_name = KBUILD_MODNAME; rcdev->map_name = RC_MAP_RC6_MCE; rcdev->min_timeout = 1; diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c index 1fa0c9d1c508..80a46e7a779f 100644 --- a/drivers/media/rc/st_rc.c +++ b/drivers/media/rc/st_rc.c @@ -291,7 +291,7 @@ static int st_rc_probe(struct platform_device *pdev) st_rc_hardware_init(rc_dev); rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protocols = RC_BIT_ALL; + rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; /* rx sampling rate is 10Mhz */ rdev->rx_resolution = 100; rdev->timeout = US_TO_NS(MAX_SYMB_TIME); diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index 26f6076ae584..f6391dd6e29f 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -305,7 +305,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz) rdev->dev.parent = dev; rdev->priv = sz; rdev->driver_type = RC_DRIVER_IR_RAW; - rdev->allowed_protocols = RC_BIT_ALL; + rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->driver_name = DRIVER_NAME; rdev->map_name = RC_MAP_STREAMZAP; diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c index eaadc081760a..42bca8d7b451 100644 --- a/drivers/media/rc/sunxi-cir.c +++ b/drivers/media/rc/sunxi-cir.c @@ -230,7 +230,7 @@ static int sunxi_ir_probe(struct platform_device *pdev) ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY; ir->rc->dev.parent = dev; ir->rc->driver_type = RC_DRIVER_IR_RAW; - ir->rc->allowed_protocols = RC_BIT_ALL; + ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; ir->rc->rx_resolution = SUNXI_IR_SAMPLE; ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT); ir->rc->driver_name = SUNXI_IR_DEV; diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c index bc7c091d6572..cf70e0403294 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c @@ -314,7 +314,7 @@ static int ttusbir_probe(struct usb_interface *intf, usb_to_input_id(tt->udev, &rc->input_id); rc->dev.parent = &intf->dev; rc->driver_type = RC_DRIVER_IR_RAW; - rc->allowed_protocols = RC_BIT_ALL; + rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->priv = tt; rc->driver_name = DRIVER_NAME; rc->map_name = RC_MAP_TT_1500; diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 38eae9ebef6a..068e81a78125 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -1085,7 +1085,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) data->dev->dev.parent = &device->dev; data->dev->timeout = MS_TO_NS(100); data->dev->rx_resolution = US_TO_NS(2); - data->dev->allowed_protocols = RC_BIT_ALL; + data->dev->allowed_protocols = RC_BIT_ALL_IR_DECODER; data->dev->allowed_wakeup_protocols = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | RC_BIT_RC5 | RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index c583c638e468..e16ca07acf1d 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c @@ -1778,7 +1778,7 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d, /* load empty to enable rc */ if (!rc->map_name) rc->map_name = RC_MAP_EMPTY; - rc->allowed_protos = RC_BIT_ALL; + rc->allowed_protos = RC_BIT_ALL_IR_DECODER; rc->driver_type = RC_DRIVER_IR_RAW; rc->query = rtl2832u_rc_query; rc->interval = 200; diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c index 134e7436d56b..9f7dd1afcb15 100644 --- a/drivers/media/usb/dvb-usb/technisat-usb2.c +++ b/drivers/media/usb/dvb-usb/technisat-usb2.c @@ -749,7 +749,7 @@ static struct dvb_usb_device_properties technisat_usb2_devices = { .rc_codes = RC_MAP_TECHNISAT_USB2, .module_name = "technisat-usb2", .rc_query = technisat_usb2_rc_query, - .allowed_protos = RC_BIT_ALL, + .allowed_protos = RC_BIT_ALL_IR_DECODER, .driver_type = RC_DRIVER_IR_RAW, } }; diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 4bd091414551..40f36b8f762a 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -95,6 +95,16 @@ enum rc_type { RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \ RC_BIT_XMP | RC_BIT_CEC) +/* All rc protocols for which we have decoders */ +#define RC_BIT_ALL_IR_DECODER \ + (RC_BIT_RC5 | RC_BIT_RC5X_20 | RC_BIT_RC5_SZ | \ + RC_BIT_JVC | \ + RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ + RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | \ + RC_BIT_SANYO | RC_BIT_MCE_KBD | RC_BIT_RC6_0 | \ + RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ + RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \ + RC_BIT_XMP) #define RC_SCANCODE_UNKNOWN(x) (x) -- cgit v1.2.3 From 0f7499fddb153a333dff3c1dc4280c178b9b5a80 Mon Sep 17 00:00:00 2001 From: Andi Shyti Date: Fri, 16 Dec 2016 06:50:58 -0200 Subject: [media] rc-main: assign driver type during allocation The driver type can be assigned immediately when an RC device requests to the framework to allocate the device. This is an 'enum rc_driver_type' data type and specifies whether the device is a raw receiver or scancode receiver. The type will be given as parameter to the rc_allocate_device device. Change accordingly all the drivers calling rc_allocate_device() so that the device type is specified during the rc device allocation. Whenever the device type is not specified, it will be set as RC_DRIVER_SCANCODE which was the default '0' value. Suggested-by: Sean Young Signed-off-by: Andi Shyti Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/hid/hid-picolcd_cir.c | 3 +-- drivers/media/cec/cec-core.c | 3 +-- drivers/media/common/siano/smsir.c | 3 +-- drivers/media/i2c/ir-kbd-i2c.c | 2 +- drivers/media/pci/bt8xx/bttv-input.c | 2 +- drivers/media/pci/cx23885/cx23885-input.c | 11 +---------- drivers/media/pci/cx88/cx88-input.c | 3 +-- drivers/media/pci/dm1105/dm1105.c | 3 +-- drivers/media/pci/mantis/mantis_input.c | 2 +- drivers/media/pci/saa7134/saa7134-input.c | 2 +- drivers/media/pci/smipcie/smipcie-ir.c | 3 +-- drivers/media/pci/ttpci/budget-ci.c | 2 +- drivers/media/rc/ati_remote.c | 3 +-- drivers/media/rc/ene_ir.c | 3 +-- drivers/media/rc/fintek-cir.c | 3 +-- drivers/media/rc/gpio-ir-recv.c | 3 +-- drivers/media/rc/igorplugusb.c | 3 +-- drivers/media/rc/iguanair.c | 3 +-- drivers/media/rc/img-ir/img-ir-hw.c | 2 +- drivers/media/rc/img-ir/img-ir-raw.c | 3 +-- drivers/media/rc/imon.c | 3 +-- drivers/media/rc/ir-hix5hd2.c | 3 +-- drivers/media/rc/ite-cir.c | 3 +-- drivers/media/rc/mceusb.c | 3 +-- drivers/media/rc/meson-ir.c | 3 +-- drivers/media/rc/nuvoton-cir.c | 3 +-- drivers/media/rc/rc-loopback.c | 3 +-- drivers/media/rc/rc-main.c | 9 ++++++--- drivers/media/rc/redrat3.c | 3 +-- drivers/media/rc/serial_ir.c | 3 +-- drivers/media/rc/st_rc.c | 3 +-- drivers/media/rc/streamzap.c | 3 +-- drivers/media/rc/sunxi-cir.c | 3 +-- drivers/media/rc/ttusbir.c | 3 +-- drivers/media/rc/winbond-cir.c | 3 +-- drivers/media/usb/au0828/au0828-input.c | 3 +-- drivers/media/usb/cx231xx/cx231xx-input.c | 2 +- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 3 +-- drivers/media/usb/dvb-usb/dvb-usb-remote.c | 3 +-- drivers/media/usb/em28xx/em28xx-input.c | 2 +- drivers/media/usb/tm6000/tm6000-input.c | 3 +-- include/media/rc-core.h | 6 ++++-- 42 files changed, 50 insertions(+), 85 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/hid/hid-picolcd_cir.c b/drivers/hid/hid-picolcd_cir.c index 90add97cc54d..8ffbb6f65a65 100644 --- a/drivers/hid/hid-picolcd_cir.c +++ b/drivers/hid/hid-picolcd_cir.c @@ -108,12 +108,11 @@ int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report) struct rc_dev *rdev; int ret = 0; - rdev = rc_allocate_device(); + rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rdev) return -ENOMEM; rdev->priv = data; - rdev->driver_type = RC_DRIVER_IR_RAW; rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->open = picolcd_cir_open; rdev->close = picolcd_cir_close; diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c index aca3ab83a8a1..37217e205040 100644 --- a/drivers/media/cec/cec-core.c +++ b/drivers/media/cec/cec-core.c @@ -239,7 +239,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, #if IS_REACHABLE(CONFIG_RC_CORE) /* Prepare the RC input device */ - adap->rc = rc_allocate_device(); + adap->rc = rc_allocate_device(RC_DRIVER_SCANCODE); if (!adap->rc) { pr_err("cec-%s: failed to allocate memory for rc_dev\n", name); @@ -259,7 +259,6 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, adap->rc->input_id.vendor = 0; adap->rc->input_id.product = 0; adap->rc->input_id.version = 1; - adap->rc->driver_type = RC_DRIVER_SCANCODE; adap->rc->driver_name = CEC_NAME; adap->rc->allowed_protocols = RC_BIT_CEC; adap->rc->priv = adap; diff --git a/drivers/media/common/siano/smsir.c b/drivers/media/common/siano/smsir.c index 480d8bf3d26a..7c898b06d85c 100644 --- a/drivers/media/common/siano/smsir.c +++ b/drivers/media/common/siano/smsir.c @@ -58,7 +58,7 @@ int sms_ir_init(struct smscore_device_t *coredev) struct rc_dev *dev; pr_debug("Allocating rc device\n"); - dev = rc_allocate_device(); + dev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!dev) return -ENOMEM; @@ -86,7 +86,6 @@ int sms_ir_init(struct smscore_device_t *coredev) #endif dev->priv = coredev; - dev->driver_type = RC_DRIVER_IR_RAW; dev->allowed_protocols = RC_BIT_ALL_IR_DECODER; dev->map_name = sms_get_board(board_id)->rc_codes; dev->driver_name = MODULE_NAME; diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index b2f39a2c0b6d..cee7fd9cf08b 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c @@ -424,7 +424,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) * If platform_data doesn't specify rc_dev, initialize it * internally */ - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_SCANCODE); if (!rc) return -ENOMEM; } diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c index 57d26a78d410..2fd07a8afcd2 100644 --- a/drivers/media/pci/bt8xx/bttv-input.c +++ b/drivers/media/pci/bt8xx/bttv-input.c @@ -420,7 +420,7 @@ int bttv_input_init(struct bttv *btv) return -ENODEV; ir = kzalloc(sizeof(*ir),GFP_KERNEL); - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_SCANCODE); if (!ir || !rc) goto err_out_free; diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c index 2d4e703b6893..4367cb3162b6 100644 --- a/drivers/media/pci/cx23885/cx23885-input.c +++ b/drivers/media/pci/cx23885/cx23885-input.c @@ -267,7 +267,6 @@ int cx23885_input_init(struct cx23885_dev *dev) struct cx23885_kernel_ir *kernel_ir; struct rc_dev *rc; char *rc_map; - enum rc_driver_type driver_type; u64 allowed_protos; int ret; @@ -285,28 +284,24 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1290: case CX23885_BOARD_HAUPPAUGE_HVR1250: /* Integrated CX2388[58] IR controller */ - driver_type = RC_DRIVER_IR_RAW; allowed_protos = RC_BIT_ALL_IR_DECODER; /* The grey Hauppauge RC-5 remote */ rc_map = RC_MAP_HAUPPAUGE; break; case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: /* Integrated CX23885 IR controller */ - driver_type = RC_DRIVER_IR_RAW; allowed_protos = RC_BIT_ALL_IR_DECODER; /* The grey Terratec remote with orange buttons */ rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS; break; case CX23885_BOARD_TEVII_S470: /* Integrated CX23885 IR controller */ - driver_type = RC_DRIVER_IR_RAW; allowed_protos = RC_BIT_ALL_IR_DECODER; /* A guess at the remote */ rc_map = RC_MAP_TEVII_NEC; break; case CX23885_BOARD_MYGICA_X8507: /* Integrated CX23885 IR controller */ - driver_type = RC_DRIVER_IR_RAW; allowed_protos = RC_BIT_ALL_IR_DECODER; /* A guess at the remote */ rc_map = RC_MAP_TOTAL_MEDIA_IN_HAND_02; @@ -314,7 +309,6 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_TBS_6980: case CX23885_BOARD_TBS_6981: /* Integrated CX23885 IR controller */ - driver_type = RC_DRIVER_IR_RAW; allowed_protos = RC_BIT_ALL_IR_DECODER; /* A guess at the remote */ rc_map = RC_MAP_TBS_NEC; @@ -326,13 +320,11 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_DVBSKY_S952: case CX23885_BOARD_DVBSKY_T982: /* Integrated CX23885 IR controller */ - driver_type = RC_DRIVER_IR_RAW; allowed_protos = RC_BIT_ALL_IR_DECODER; rc_map = RC_MAP_DVBSKY; break; case CX23885_BOARD_TT_CT2_4500_CI: /* Integrated CX23885 IR controller */ - driver_type = RC_DRIVER_IR_RAW; allowed_protos = RC_BIT_ALL_IR_DECODER; rc_map = RC_MAP_TT_1500; break; @@ -352,7 +344,7 @@ int cx23885_input_init(struct cx23885_dev *dev) pci_name(dev->pci)); /* input device */ - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rc) { ret = -ENOMEM; goto err_out_free; @@ -371,7 +363,6 @@ int cx23885_input_init(struct cx23885_dev *dev) rc->input_id.product = dev->pci->device; } rc->dev.parent = &dev->pci->dev; - rc->driver_type = driver_type; rc->allowed_protocols = allowed_protos; rc->priv = kernel_ir; rc->open = cx23885_input_ir_open; diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c index c7b3cb406499..01f2e472a2a0 100644 --- a/drivers/media/pci/cx88/cx88-input.c +++ b/drivers/media/pci/cx88/cx88-input.c @@ -274,7 +274,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) */ ir = kzalloc(sizeof(*ir), GFP_KERNEL); - dev = rc_allocate_device(); + dev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir || !dev) goto err_out_free; @@ -484,7 +484,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) dev->scancode_mask = hardware_mask; if (ir->sampling) { - dev->driver_type = RC_DRIVER_IR_RAW; dev->timeout = 10 * 1000 * 1000; /* 10 ms */ } else { dev->driver_type = RC_DRIVER_SCANCODE; diff --git a/drivers/media/pci/dm1105/dm1105.c b/drivers/media/pci/dm1105/dm1105.c index 28dc1f8f1a5a..a7724b78fbb4 100644 --- a/drivers/media/pci/dm1105/dm1105.c +++ b/drivers/media/pci/dm1105/dm1105.c @@ -739,7 +739,7 @@ static int dm1105_ir_init(struct dm1105_dev *dm1105) struct rc_dev *dev; int err = -ENOMEM; - dev = rc_allocate_device(); + dev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!dev) return -ENOMEM; @@ -748,7 +748,6 @@ static int dm1105_ir_init(struct dm1105_dev *dm1105) dev->driver_name = MODULE_NAME; dev->map_name = RC_MAP_DM1105_NEC; - dev->driver_type = RC_DRIVER_SCANCODE; dev->input_name = "DVB on-card IR receiver"; dev->input_phys = dm1105->ir.input_phys; dev->input_id.bustype = BUS_PCI; diff --git a/drivers/media/pci/mantis/mantis_input.c b/drivers/media/pci/mantis/mantis_input.c index 7f7f1d4d7bb1..50d10cb7d49d 100644 --- a/drivers/media/pci/mantis/mantis_input.c +++ b/drivers/media/pci/mantis/mantis_input.c @@ -39,7 +39,7 @@ int mantis_input_init(struct mantis_pci *mantis) struct rc_dev *dev; int err; - dev = rc_allocate_device(); + dev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!dev) { dprintk(MANTIS_ERROR, 1, "Remote device allocation failed"); err = -ENOMEM; diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c index 91b883765ce4..78849c19f68a 100644 --- a/drivers/media/pci/saa7134/saa7134-input.c +++ b/drivers/media/pci/saa7134/saa7134-input.c @@ -842,7 +842,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) } ir = kzalloc(sizeof(*ir), GFP_KERNEL); - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_SCANCODE); if (!ir || !rc) { err = -ENOMEM; goto err_out_free; diff --git a/drivers/media/pci/smipcie/smipcie-ir.c b/drivers/media/pci/smipcie/smipcie-ir.c index 826c7c75e64d..d2730c3fdbae 100644 --- a/drivers/media/pci/smipcie/smipcie-ir.c +++ b/drivers/media/pci/smipcie/smipcie-ir.c @@ -183,7 +183,7 @@ int smi_ir_init(struct smi_dev *dev) struct rc_dev *rc_dev; struct smi_rc *ir = &dev->ir; - rc_dev = rc_allocate_device(); + rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!rc_dev) return -ENOMEM; @@ -202,7 +202,6 @@ int smi_ir_init(struct smi_dev *dev) rc_dev->input_id.product = dev->pci_dev->subsystem_device; rc_dev->dev.parent = &dev->pci_dev->dev; - rc_dev->driver_type = RC_DRIVER_SCANCODE; rc_dev->map_name = dev->info->rc_map; ir->rc_dev = rc_dev; diff --git a/drivers/media/pci/ttpci/budget-ci.c b/drivers/media/pci/ttpci/budget-ci.c index 919d275b9712..68355484ba7d 100644 --- a/drivers/media/pci/ttpci/budget-ci.c +++ b/drivers/media/pci/ttpci/budget-ci.c @@ -174,7 +174,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) struct rc_dev *dev; int error; - dev = rc_allocate_device(); + dev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!dev) { printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); return -ENOMEM; diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 2f6699e7adcd..9cf3e69de16a 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c @@ -760,7 +760,6 @@ static void ati_remote_rc_init(struct ati_remote *ati_remote) struct rc_dev *rdev = ati_remote->rdev; rdev->priv = ati_remote; - rdev->driver_type = RC_DRIVER_SCANCODE; rdev->allowed_protocols = RC_BIT_OTHER; rdev->driver_name = "ati_remote"; @@ -847,7 +846,7 @@ static int ati_remote_probe(struct usb_interface *interface, } ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL); - rc_dev = rc_allocate_device(); + rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!ati_remote || !rc_dev) goto exit_free_dev_rdev; diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index fbfefb7a5f7d..60da963f40dc 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -1007,7 +1007,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) /* allocate memory */ dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); - rdev = rc_allocate_device(); + rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!dev || !rdev) goto exit_free_dev_rdev; @@ -1053,7 +1053,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) if (!dev->hw_learning_and_tx_capable) learning_mode_force = false; - rdev->driver_type = RC_DRIVER_IR_RAW; rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->priv = dev; rdev->open = ene_open; diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index b391b2f8ab79..0d3562712f27 100644 --- a/drivers/media/rc/fintek-cir.c +++ b/drivers/media/rc/fintek-cir.c @@ -487,7 +487,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id return ret; /* input device for IR remote (and tx) */ - rdev = rc_allocate_device(); + rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rdev) goto exit_free_dev_rdev; @@ -529,7 +529,6 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id /* Set up the rc device */ rdev->priv = fintek; - rdev->driver_type = RC_DRIVER_IR_RAW; rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->open = fintek_open; rdev->close = fintek_close; diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index 0b5aec4b9c9d..4a4895e4d599 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c @@ -143,14 +143,13 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) if (!gpio_dev) return -ENOMEM; - rcdev = rc_allocate_device(); + rcdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rcdev) { rc = -ENOMEM; goto err_allocate_device; } rcdev->priv = gpio_dev; - rcdev->driver_type = RC_DRIVER_IR_RAW; rcdev->input_name = GPIO_IR_DEVICE_NAME; rcdev->input_phys = GPIO_IR_DEVICE_NAME "/input0"; rcdev->input_id.bustype = BUS_HOST; diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c index 4c4827c3408b..0f0ed4ea4d06 100644 --- a/drivers/media/rc/igorplugusb.c +++ b/drivers/media/rc/igorplugusb.c @@ -190,7 +190,7 @@ static int igorplugusb_probe(struct usb_interface *intf, usb_make_path(udev, ir->phys, sizeof(ir->phys)); - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rc) goto fail; @@ -198,7 +198,6 @@ static int igorplugusb_probe(struct usb_interface *intf, rc->input_phys = ir->phys; usb_to_input_id(udev, &rc->input_id); rc->dev.parent = &intf->dev; - rc->driver_type = RC_DRIVER_IR_RAW; /* * This device can only store 36 pulses + spaces, which is not enough * for the NEC protocol and many others. diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index 75e1dfb1be26..ccf24fd7ec1b 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c @@ -427,7 +427,7 @@ static int iguanair_probe(struct usb_interface *intf, struct usb_host_interface *idesc; ir = kzalloc(sizeof(*ir), GFP_KERNEL); - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir || !rc) { ret = -ENOMEM; goto out; @@ -490,7 +490,6 @@ static int iguanair_probe(struct usb_interface *intf, rc->input_phys = ir->phys; usb_to_input_id(ir->udev, &rc->input_id); rc->dev.parent = &intf->dev; - rc->driver_type = RC_DRIVER_IR_RAW; rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->priv = ir; rc->open = iguanair_open; diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c index 8e2b64135c39..431d33b36fb0 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.c +++ b/drivers/media/rc/img-ir/img-ir-hw.c @@ -1078,7 +1078,7 @@ int img_ir_probe_hw(struct img_ir_priv *priv) } /* Allocate hardware decoder */ - hw->rdev = rdev = rc_allocate_device(); + hw->rdev = rdev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!rdev) { dev_err(priv->dev, "cannot allocate input device\n"); error = -ENOMEM; diff --git a/drivers/media/rc/img-ir/img-ir-raw.c b/drivers/media/rc/img-ir/img-ir-raw.c index 33f37ed87ad2..8d2f8e2006e7 100644 --- a/drivers/media/rc/img-ir/img-ir-raw.c +++ b/drivers/media/rc/img-ir/img-ir-raw.c @@ -110,7 +110,7 @@ int img_ir_probe_raw(struct img_ir_priv *priv) setup_timer(&raw->timer, img_ir_echo_timer, (unsigned long)priv); /* Allocate raw decoder */ - raw->rdev = rdev = rc_allocate_device(); + raw->rdev = rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rdev) { dev_err(priv->dev, "cannot allocate raw input device\n"); return -ENOMEM; @@ -118,7 +118,6 @@ int img_ir_probe_raw(struct img_ir_priv *priv) rdev->priv = priv; rdev->map_name = RC_MAP_EMPTY; rdev->input_name = "IMG Infrared Decoder Raw"; - rdev->driver_type = RC_DRIVER_IR_RAW; /* Register raw decoder */ error = rc_register_device(rdev); diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 31ffc6a7b2eb..ef1f33e962b6 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1935,7 +1935,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88 }; - rdev = rc_allocate_device(); + rdev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!rdev) { dev_err(ictx->dev, "remote control dev allocation failed\n"); goto out; @@ -1953,7 +1953,6 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) rdev->dev.parent = ictx->dev; rdev->priv = ictx; - rdev->driver_type = RC_DRIVER_SCANCODE; rdev->allowed_protocols = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */ rdev->change_protocol = imon_ir_change_protocol; rdev->driver_name = MOD_NAME; diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c index d95056ad26dc..50951f686852 100644 --- a/drivers/media/rc/ir-hix5hd2.c +++ b/drivers/media/rc/ir-hix5hd2.c @@ -229,7 +229,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev) return priv->irq; } - rdev = rc_allocate_device(); + rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rdev) return -ENOMEM; @@ -242,7 +242,6 @@ static int hix5hd2_ir_probe(struct platform_device *pdev) clk_prepare_enable(priv->clock); priv->rate = clk_get_rate(priv->clock); - rdev->driver_type = RC_DRIVER_IR_RAW; rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->priv = priv; rdev->open = hix5hd2_ir_open; diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index 3bffc169b31e..e9e4befbbebb 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c @@ -1465,7 +1465,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id return ret; /* input device for IR remote (and tx) */ - rdev = rc_allocate_device(); + rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rdev) goto exit_free_dev_rdev; itdev->rdev = rdev; @@ -1556,7 +1556,6 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id /* set up ir-core props */ rdev->priv = itdev; - rdev->driver_type = RC_DRIVER_IR_RAW; rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->open = ite_open; rdev->close = ite_close; diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 85b220435ff5..238d8eaf7d94 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1177,7 +1177,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) struct rc_dev *rc; int ret; - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rc) { dev_err(dev, "remote dev allocation failed"); goto out; @@ -1197,7 +1197,6 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) usb_to_input_id(ir->usbdev, &rc->input_id); rc->dev.parent = dev; rc->priv = ir; - rc->driver_type = RC_DRIVER_IR_RAW; rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->timeout = MS_TO_NS(100); if (!ir->flags.no_tx) { diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c index 3e96e6f1b0c5..5576dbd6b1a4 100644 --- a/drivers/media/rc/meson-ir.c +++ b/drivers/media/rc/meson-ir.c @@ -131,7 +131,7 @@ static int meson_ir_probe(struct platform_device *pdev) return ir->irq; } - ir->rc = rc_allocate_device(); + ir->rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir->rc) { dev_err(dev, "failed to allocate rc device\n"); return -ENOMEM; @@ -144,7 +144,6 @@ static int meson_ir_probe(struct platform_device *pdev) map_name = of_get_property(node, "linux,rc-map-name", NULL); ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY; ir->rc->dev.parent = dev; - ir->rc->driver_type = RC_DRIVER_IR_RAW; ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; ir->rc->rx_resolution = US_TO_NS(MESON_TRATE); ir->rc->timeout = MS_TO_NS(200); diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index a849eed43d41..b109f8246b96 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -1062,7 +1062,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) return -ENOMEM; /* input device for IR remote (and tx) */ - nvt->rdev = devm_rc_allocate_device(&pdev->dev); + nvt->rdev = devm_rc_allocate_device(&pdev->dev, RC_DRIVER_IR_RAW); if (!nvt->rdev) return -ENOMEM; rdev = nvt->rdev; @@ -1125,7 +1125,6 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) /* Set up the rc device */ rdev->priv = nvt; - rdev->driver_type = RC_DRIVER_IR_RAW; rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->allowed_wakeup_protocols = RC_BIT_ALL_IR_ENCODER; rdev->encode_wakeup = true; diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 294c0fdbc5a9..62195af24fbe 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -213,7 +213,7 @@ static int __init loop_init(void) struct rc_dev *rc; int ret; - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rc) { printk(KERN_ERR DRIVER_NAME ": rc_dev allocation failed\n"); return -ENOMEM; @@ -226,7 +226,6 @@ static int __init loop_init(void) rc->driver_name = DRIVER_NAME; rc->map_name = RC_MAP_EMPTY; rc->priv = &loopdev; - rc->driver_type = RC_DRIVER_IR_RAW; rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->allowed_wakeup_protocols = RC_BIT_ALL_IR_ENCODER; rc->encode_wakeup = true; diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index d7a1d8cbdf04..aae9f1fc4254 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1577,7 +1577,7 @@ static struct device_type rc_dev_type = { .uevent = rc_dev_uevent, }; -struct rc_dev *rc_allocate_device(void) +struct rc_dev *rc_allocate_device(enum rc_driver_type type) { struct rc_dev *dev; @@ -1604,6 +1604,8 @@ struct rc_dev *rc_allocate_device(void) dev->dev.class = &rc_class; device_initialize(&dev->dev); + dev->driver_type = type; + __module_get(THIS_MODULE); return dev; } @@ -1630,7 +1632,8 @@ static void devm_rc_alloc_release(struct device *dev, void *res) rc_free_device(*(struct rc_dev **)res); } -struct rc_dev *devm_rc_allocate_device(struct device *dev) +struct rc_dev *devm_rc_allocate_device(struct device *dev, + enum rc_driver_type type) { struct rc_dev **dr, *rc; @@ -1638,7 +1641,7 @@ struct rc_dev *devm_rc_allocate_device(struct device *dev) if (!dr) return NULL; - rc = rc_allocate_device(); + rc = rc_allocate_device(type); if (!rc) { devres_free(dr); return NULL; diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 4ab0ea02a309..56d43be2756b 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -941,7 +941,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3) int ret; u16 prod = le16_to_cpu(rr3->udev->descriptor.idProduct); - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rc) return NULL; @@ -956,7 +956,6 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3) usb_to_input_id(rr3->udev, &rc->input_id); rc->dev.parent = dev; rc->priv = rr3; - rc->driver_type = RC_DRIVER_IR_RAW; rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->min_timeout = MS_TO_NS(RR3_RX_MIN_TIMEOUT); rc->max_timeout = MS_TO_NS(RR3_RX_MAX_TIMEOUT); diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c index 408594ea896c..923fb2299553 100644 --- a/drivers/media/rc/serial_ir.c +++ b/drivers/media/rc/serial_ir.c @@ -757,7 +757,7 @@ static int __init serial_ir_init_module(void) if (result) return result; - rcdev = devm_rc_allocate_device(&serial_ir.pdev->dev); + rcdev = devm_rc_allocate_device(&serial_ir.pdev->dev, RC_DRIVER_IR_RAW); if (!rcdev) { result = -ENOMEM; goto serial_cleanup; @@ -796,7 +796,6 @@ static int __init serial_ir_init_module(void) rcdev->open = serial_ir_open; rcdev->close = serial_ir_close; rcdev->dev.parent = &serial_ir.pdev->dev; - rcdev->driver_type = RC_DRIVER_IR_RAW; rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rcdev->driver_name = KBUILD_MODNAME; rcdev->map_name = RC_MAP_RC6_MCE; diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c index 80a46e7a779f..f0d7190e3919 100644 --- a/drivers/media/rc/st_rc.c +++ b/drivers/media/rc/st_rc.c @@ -235,7 +235,7 @@ static int st_rc_probe(struct platform_device *pdev) if (!rc_dev) return -ENOMEM; - rdev = rc_allocate_device(); + rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rdev) return -ENOMEM; @@ -290,7 +290,6 @@ static int st_rc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, rc_dev); st_rc_hardware_init(rc_dev); - rdev->driver_type = RC_DRIVER_IR_RAW; rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; /* rx sampling rate is 10Mhz */ rdev->rx_resolution = 100; diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index f6391dd6e29f..b09c45abb5f3 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -287,7 +287,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz) struct device *dev = sz->dev; int ret; - rdev = rc_allocate_device(); + rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!rdev) { dev_err(dev, "remote dev allocation failed\n"); goto out; @@ -304,7 +304,6 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz) usb_to_input_id(sz->usbdev, &rdev->input_id); rdev->dev.parent = dev; rdev->priv = sz; - rdev->driver_type = RC_DRIVER_IR_RAW; rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; rdev->driver_name = DRIVER_NAME; rdev->map_name = RC_MAP_STREAMZAP; diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c index 42bca8d7b451..25b006167810 100644 --- a/drivers/media/rc/sunxi-cir.c +++ b/drivers/media/rc/sunxi-cir.c @@ -212,7 +212,7 @@ static int sunxi_ir_probe(struct platform_device *pdev) goto exit_clkdisable_clk; } - ir->rc = rc_allocate_device(); + ir->rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir->rc) { dev_err(dev, "failed to allocate device\n"); ret = -ENOMEM; @@ -229,7 +229,6 @@ static int sunxi_ir_probe(struct platform_device *pdev) ir->map_name = of_get_property(dn, "linux,rc-map-name", NULL); ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY; ir->rc->dev.parent = dev; - ir->rc->driver_type = RC_DRIVER_IR_RAW; ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; ir->rc->rx_resolution = SUNXI_IR_SAMPLE; ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT); diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c index cf70e0403294..23be7702e2df 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c @@ -201,7 +201,7 @@ static int ttusbir_probe(struct usb_interface *intf, int altsetting = -1; tt = kzalloc(sizeof(*tt), GFP_KERNEL); - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!tt || !rc) { ret = -ENOMEM; goto out; @@ -313,7 +313,6 @@ static int ttusbir_probe(struct usb_interface *intf, rc->input_phys = tt->phys; usb_to_input_id(tt->udev, &rc->input_id); rc->dev.parent = &intf->dev; - rc->driver_type = RC_DRIVER_IR_RAW; rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; rc->priv = tt; rc->driver_name = DRIVER_NAME; diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 068e81a78125..dc1c8305ad23 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -1061,13 +1061,12 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) if (err) goto exit_free_data; - data->dev = rc_allocate_device(); + data->dev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!data->dev) { err = -ENOMEM; goto exit_unregister_led; } - data->dev->driver_type = RC_DRIVER_IR_RAW; data->dev->driver_name = DRVNAME; data->dev->input_name = WBCIR_NAME; data->dev->input_phys = "wbcir/cir0"; diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c index 1e66e7828d8f..9ec919c68482 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -298,7 +298,7 @@ int au0828_rc_register(struct au0828_dev *dev) return -ENODEV; ir = kzalloc(sizeof(*ir), GFP_KERNEL); - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir || !rc) goto error; @@ -343,7 +343,6 @@ int au0828_rc_register(struct au0828_dev *dev) rc->input_id.product = le16_to_cpu(dev->usbdev->descriptor.idProduct); rc->dev.parent = &dev->usbdev->dev; rc->driver_name = "au0828-input"; - rc->driver_type = RC_DRIVER_IR_RAW; rc->allowed_protocols = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | RC_BIT_RC5; diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c index 15d8d1b5f05c..6e80f3c573f3 100644 --- a/drivers/media/usb/cx231xx/cx231xx-input.c +++ b/drivers/media/usb/cx231xx/cx231xx-input.c @@ -72,7 +72,7 @@ int cx231xx_ir_init(struct cx231xx *dev) memset(&info, 0, sizeof(struct i2c_board_info)); memset(&dev->init_data, 0, sizeof(dev->init_data)); - dev->init_data.rc_dev = rc_allocate_device(); + dev->init_data.rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!dev->init_data.rc_dev) return -ENOMEM; diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index a8e6624fbe83..298c91a6f1f9 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c @@ -147,7 +147,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d) if (!d->rc.map_name) return 0; - dev = rc_allocate_device(); + dev = rc_allocate_device(d->rc.driver_type); if (!dev) { ret = -ENOMEM; goto err; @@ -162,7 +162,6 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d) /* TODO: likely RC-core should took const char * */ dev->driver_name = (char *) d->props->driver_name; dev->map_name = d->rc.map_name; - dev->driver_type = d->rc.driver_type; dev->allowed_protocols = d->rc.allowed_protos; dev->change_protocol = d->rc.change_protocol; dev->priv = d; diff --git a/drivers/media/usb/dvb-usb/dvb-usb-remote.c b/drivers/media/usb/dvb-usb/dvb-usb-remote.c index c259f9e43542..059ded59208e 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/usb/dvb-usb/dvb-usb-remote.c @@ -265,7 +265,7 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d) int err, rc_interval; struct rc_dev *dev; - dev = rc_allocate_device(); + dev = rc_allocate_device(d->props.rc.core.driver_type); if (!dev) return -ENOMEM; @@ -273,7 +273,6 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d) dev->map_name = d->props.rc.core.rc_codes; dev->change_protocol = d->props.rc.core.change_protocol; dev->allowed_protocols = d->props.rc.core.allowed_protos; - dev->driver_type = d->props.rc.core.driver_type; usb_to_input_id(d->udev, &dev->input_id); dev->input_name = "IR-receiver inside an USB DVB receiver"; dev->input_phys = d->rc_phys; diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index d1ba2c470645..eba75736e654 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c @@ -722,7 +722,7 @@ static int em28xx_ir_init(struct em28xx *dev) ir = kzalloc(sizeof(*ir), GFP_KERNEL); if (!ir) return -ENOMEM; - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_SCANCODE); if (!rc) goto error; diff --git a/drivers/media/usb/tm6000/tm6000-input.c b/drivers/media/usb/tm6000/tm6000-input.c index 83d59456680a..ef0dbd9c95f3 100644 --- a/drivers/media/usb/tm6000/tm6000-input.c +++ b/drivers/media/usb/tm6000/tm6000-input.c @@ -425,7 +425,7 @@ int tm6000_ir_init(struct tm6000_core *dev) return 0; ir = kzalloc(sizeof(*ir), GFP_ATOMIC); - rc = rc_allocate_device(); + rc = rc_allocate_device(RC_DRIVER_SCANCODE); if (!ir || !rc) goto out; @@ -452,7 +452,6 @@ int tm6000_ir_init(struct tm6000_core *dev) ir->polling = 50; INIT_DELAYED_WORK(&ir->work, tm6000_ir_handle_key); } - rc->driver_type = RC_DRIVER_SCANCODE; snprintf(ir->name, sizeof(ir->name), "tm5600/60x0 IR (%s)", dev->name); diff --git a/include/media/rc-core.h b/include/media/rc-core.h index cf9fabcee33e..8c2252686955 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -203,17 +203,19 @@ struct rc_dev { /** * rc_allocate_device - Allocates a RC device * + * @rc_driver_type: specifies the type of the RC output to be allocated * returns a pointer to struct rc_dev. */ -struct rc_dev *rc_allocate_device(void); +struct rc_dev *rc_allocate_device(enum rc_driver_type); /** * devm_rc_allocate_device - Managed RC device allocation * * @dev: pointer to struct device + * @rc_driver_type: specifies the type of the RC output to be allocated * returns a pointer to struct rc_dev. */ -struct rc_dev *devm_rc_allocate_device(struct device *dev); +struct rc_dev *devm_rc_allocate_device(struct device *dev, enum rc_driver_type); /** * rc_free_device - Frees a RC device -- cgit v1.2.3 From 09bfd96ca32638596be95e43a3b981b96f9b5b30 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Fri, 4 Nov 2016 20:43:49 -0200 Subject: [media] af9035: read and store whole eeprom Read eeprom content to chip state and read values there when needed. Also debug dump eeprom content. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/af9035.c | 126 +++++++++++++++------------------- drivers/media/usb/dvb-usb-v2/af9035.h | 5 +- 2 files changed, 60 insertions(+), 71 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index c673726d9b70..61dac6a837ca 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -496,7 +496,8 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) { struct state *state = d_to_priv(d); struct usb_interface *intf = d->intf; - int ret, ts_mode_invalid; + int ret, i, ts_mode_invalid; + unsigned int utmp, eeprom_addr; u8 tmp; u8 wbuf[1] = { 1 }; u8 rbuf[4]; @@ -518,25 +519,48 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) state->prechip_version, state->chip_version, state->chip_type); if (state->chip_type == 0x9135) { - if (state->chip_version == 0x02) + if (state->chip_version == 0x02) { *name = AF9035_FIRMWARE_IT9135_V2; - else + utmp = 0x00461d; + } else { *name = AF9035_FIRMWARE_IT9135_V1; - state->eeprom_addr = EEPROM_BASE_IT9135; + utmp = 0x00461b; + } + + /* Check if eeprom exists */ + ret = af9035_rd_reg(d, utmp, &tmp); + if (ret < 0) + goto err; + + if (tmp == 0x00) { + dev_dbg(&intf->dev, "no eeprom\n"); + state->no_eeprom = true; + goto check_firmware_status; + } + + eeprom_addr = EEPROM_BASE_IT9135; } else if (state->chip_type == 0x9306) { *name = AF9035_FIRMWARE_IT9303; - state->eeprom_addr = EEPROM_BASE_IT9135; + state->no_eeprom = true; + goto check_firmware_status; } else { *name = AF9035_FIRMWARE_AF9035; - state->eeprom_addr = EEPROM_BASE_AF9035; + eeprom_addr = EEPROM_BASE_AF9035; + } + + /* Read and store eeprom */ + for (i = 0; i < 256; i += 32) { + ret = af9035_rd_regs(d, eeprom_addr + i, &state->eeprom[i], 32); + if (ret < 0) + goto err; } + dev_dbg(&intf->dev, "eeprom dump:\n"); + for (i = 0; i < 256; i += 16) + dev_dbg(&intf->dev, "%*ph\n", 16, &state->eeprom[i]); /* check for dual tuner mode */ - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); - if (ret < 0) - goto err; - + tmp = state->eeprom[EEPROM_TS_MODE]; ts_mode_invalid = 0; switch (tmp) { case 0: @@ -560,7 +584,7 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) if (ts_mode_invalid) dev_info(&intf->dev, "ts mode=%d not supported, defaulting to single tuner mode!", tmp); - +check_firmware_status: ret = af9035_ctrl_msg(d, &req); if (ret < 0) goto err; @@ -750,11 +774,7 @@ static int af9035_download_firmware(struct dvb_usb_device *d, goto err; /* tell the slave I2C address */ - ret = af9035_rd_reg(d, - state->eeprom_addr + EEPROM_2ND_DEMOD_ADDR, - &tmp); - if (ret < 0) - goto err; + tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR]; /* use default I2C address if eeprom has no address set */ if (!tmp) @@ -819,7 +839,7 @@ static int af9035_read_config(struct dvb_usb_device *d) struct state *state = d_to_priv(d); int ret, i; u8 tmp; - u16 tmp16, addr; + u16 tmp16; /* demod I2C "address" */ state->af9033_i2c_addr[0] = 0x38; @@ -837,20 +857,16 @@ static int af9035_read_config(struct dvb_usb_device *d) if (state->chip_version == 0x02) { state->af9033_config[0].tuner = AF9033_TUNER_IT9135_60; state->af9033_config[1].tuner = AF9033_TUNER_IT9135_60; - tmp16 = 0x00461d; /* eeprom memory mapped location */ } else { state->af9033_config[0].tuner = AF9033_TUNER_IT9135_38; state->af9033_config[1].tuner = AF9033_TUNER_IT9135_38; - tmp16 = 0x00461b; /* eeprom memory mapped location */ } - /* check if eeprom exists */ - ret = af9035_rd_reg(d, tmp16, &tmp); - if (ret < 0) - goto err; + if (state->no_eeprom) { + /* Remote controller to NEC polling by default */ + state->ir_mode = 0x05; + state->ir_type = 0x00; - if (tmp == 0x00) { - dev_dbg(&intf->dev, "no eeprom\n"); goto skip_eeprom; } } else if (state->chip_type == 0x9306) { @@ -861,29 +877,24 @@ static int af9035_read_config(struct dvb_usb_device *d) return 0; } + /* Remote controller */ + state->ir_mode = state->eeprom[EEPROM_IR_MODE]; + state->ir_type = state->eeprom[EEPROM_IR_TYPE]; if (state->dual_mode) { /* read 2nd demodulator I2C address */ - ret = af9035_rd_reg(d, - state->eeprom_addr + EEPROM_2ND_DEMOD_ADDR, - &tmp); - if (ret < 0) - goto err; - + tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR]; if (tmp) state->af9033_i2c_addr[1] = tmp; dev_dbg(&intf->dev, "2nd demod I2C addr=%02x\n", tmp); } - addr = state->eeprom_addr; - for (i = 0; i < state->dual_mode + 1; i++) { - /* tuner */ - ret = af9035_rd_reg(d, addr + EEPROM_1_TUNER_ID, &tmp); - if (ret < 0) - goto err; + unsigned int eeprom_offset = 0; + /* tuner */ + tmp = state->eeprom[EEPROM_1_TUNER_ID + eeprom_offset]; dev_dbg(&intf->dev, "[%d]tuner=%02x\n", i, tmp); /* tuner sanity check */ @@ -956,21 +967,13 @@ static int af9035_read_config(struct dvb_usb_device *d) } /* tuner IF frequency */ - ret = af9035_rd_reg(d, addr + EEPROM_1_IF_L, &tmp); - if (ret < 0) - goto err; - - tmp16 = tmp; - - ret = af9035_rd_reg(d, addr + EEPROM_1_IF_H, &tmp); - if (ret < 0) - goto err; - + tmp = state->eeprom[EEPROM_1_IF_L + eeprom_offset]; + tmp16 = tmp << 0; + tmp = state->eeprom[EEPROM_1_IF_H + eeprom_offset]; tmp16 |= tmp << 8; - dev_dbg(&intf->dev, "[%d]IF=%d\n", i, tmp16); - addr += 0x10; /* shift for the 2nd tuner params */ + eeprom_offset += 0x10; /* shift for the 2nd tuner params */ } skip_eeprom: @@ -1872,25 +1875,13 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) { struct state *state = d_to_priv(d); struct usb_interface *intf = d->intf; - int ret; - u8 tmp; - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_IR_MODE, &tmp); - if (ret < 0) - goto err; - - dev_dbg(&intf->dev, "ir_mode=%02x\n", tmp); + dev_dbg(&intf->dev, "ir_mode=%02x ir_type=%02x\n", + state->ir_mode, state->ir_type); /* don't activate rc if in HID mode or if not available */ - if (tmp == 5) { - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_IR_TYPE, - &tmp); - if (ret < 0) - goto err; - - dev_dbg(&intf->dev, "ir_type=%02x\n", tmp); - - switch (tmp) { + if (state->ir_mode == 0x05) { + switch (state->ir_type) { case 0: /* NEC */ default: rc->allowed_protos = RC_BIT_NEC | RC_BIT_NECX | @@ -1910,11 +1901,6 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) } return 0; - -err: - dev_dbg(&intf->dev, "failed=%d\n", ret); - - return ret; } #else #define af9035_get_rc_config NULL diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h index 1f83c9218ad0..89a08a4eac2e 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.h +++ b/drivers/media/usb/dvb-usb-v2/af9035.h @@ -61,9 +61,12 @@ struct state { u8 prechip_version; u8 chip_version; u16 chip_type; + u8 eeprom[256]; + bool no_eeprom; + u8 ir_mode; + u8 ir_type; u8 dual_mode:1; u8 no_read:1; - u16 eeprom_addr; u8 af9033_i2c_addr[2]; struct af9033_config af9033_config[2]; struct af9033_ops ops; -- cgit v1.2.3 From 35ef193b2aa35e404c08d0c9ad010cf171a88cbd Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 7 Nov 2016 01:14:23 -0200 Subject: [media] af9035: register it9133 tuner using platform binding it913x tuner driver is changed to platform model so we need bind it using platform_device_register_data(). Also remove hacks from I2C adapter where fake tuner driver address (addr >> 1) were used as those are no longer needed. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/af9035.c | 124 ++++++++++++++++------------------ drivers/media/usb/dvb-usb-v2/af9035.h | 2 + 2 files changed, 62 insertions(+), 64 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 61dac6a837ca..a6ecd52b5917 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -335,14 +335,12 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, /* TODO: correct limits > 40 */ ret = -EOPNOTSUPP; } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || - (msg[0].addr == state->af9033_i2c_addr[1]) || - (state->chip_type == 0x9135)) { + (msg[0].addr == state->af9033_i2c_addr[1])) { /* demod access via firmware interface */ u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | msg[0].buf[2]; - if (msg[0].addr == state->af9033_i2c_addr[1] || - msg[0].addr == (state->af9033_i2c_addr[1] >> 1)) + if (msg[0].addr == state->af9033_i2c_addr[1]) reg |= 0x100000; ret = af9035_rd_regs(d, reg, &msg[1].buf[0], @@ -396,14 +394,12 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, /* TODO: correct limits > 40 */ ret = -EOPNOTSUPP; } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || - (msg[0].addr == state->af9033_i2c_addr[1]) || - (state->chip_type == 0x9135)) { + (msg[0].addr == state->af9033_i2c_addr[1])) { /* demod access via firmware interface */ u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | msg[0].buf[2]; - if (msg[0].addr == state->af9033_i2c_addr[1] || - msg[0].addr == (state->af9033_i2c_addr[1] >> 1)) + if (msg[0].addr == state->af9033_i2c_addr[1]) reg |= 0x100000; ret = af9035_wr_regs(d, reg, &msg[0].buf[3], @@ -1250,30 +1246,11 @@ static int af9035_frontend_detach(struct dvb_usb_adapter *adap) struct state *state = adap_to_priv(adap); struct dvb_usb_device *d = adap_to_d(adap); struct usb_interface *intf = d->intf; - int demod2; dev_dbg(&intf->dev, "adap->id=%d\n", adap->id); - /* - * For dual tuner devices we have to resolve 2nd demod client, as there - * is two different kind of tuner drivers; one is using I2C binding - * and the other is using DVB attach/detach binding. - */ - switch (state->af9033_config[adap->id].tuner) { - case AF9033_TUNER_IT9135_38: - case AF9033_TUNER_IT9135_51: - case AF9033_TUNER_IT9135_52: - case AF9033_TUNER_IT9135_60: - case AF9033_TUNER_IT9135_61: - case AF9033_TUNER_IT9135_62: - demod2 = 2; - break; - default: - demod2 = 1; - } - if (adap->id == 1) { - if (state->i2c_client[demod2]) + if (state->i2c_client[1]) af9035_del_i2c_dev(d); } else if (adap->id == 0) { if (state->i2c_client[0]) @@ -1513,50 +1490,58 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) case AF9033_TUNER_IT9135_38: case AF9033_TUNER_IT9135_51: case AF9033_TUNER_IT9135_52: - { - struct it913x_config it913x_config = { - .fe = adap->fe[0], - .chip_ver = 1, - }; - - if (state->dual_mode) { - if (adap->id == 0) - it913x_config.role = IT913X_ROLE_DUAL_MASTER; - else - it913x_config.role = IT913X_ROLE_DUAL_SLAVE; - } - - ret = af9035_add_i2c_dev(d, "it913x", - state->af9033_i2c_addr[adap->id] >> 1, - &it913x_config, &d->i2c_adap); - if (ret) - goto err; - - fe = adap->fe[0]; - break; - } case AF9033_TUNER_IT9135_60: case AF9033_TUNER_IT9135_61: case AF9033_TUNER_IT9135_62: { - struct it913x_config it913x_config = { + struct platform_device *pdev; + struct it913x_platform_data it913x_pdata = { + .regmap = state->af9033_config[adap->id].regmap, .fe = adap->fe[0], - .chip_ver = 2, }; + switch (state->af9033_config[adap->id].tuner) { + case AF9033_TUNER_IT9135_38: + case AF9033_TUNER_IT9135_51: + case AF9033_TUNER_IT9135_52: + it913x_pdata.chip_ver = 1; + break; + case AF9033_TUNER_IT9135_60: + case AF9033_TUNER_IT9135_61: + case AF9033_TUNER_IT9135_62: + it913x_pdata.chip_ver = 2; + break; + default: + ret = -ENODEV; + goto err; + } + if (state->dual_mode) { if (adap->id == 0) - it913x_config.role = IT913X_ROLE_DUAL_MASTER; + it913x_pdata.role = IT913X_ROLE_DUAL_MASTER; else - it913x_config.role = IT913X_ROLE_DUAL_SLAVE; + it913x_pdata.role = IT913X_ROLE_DUAL_SLAVE; + } else { + it913x_pdata.role = IT913X_ROLE_SINGLE; } - ret = af9035_add_i2c_dev(d, "it913x", - state->af9033_i2c_addr[adap->id] >> 1, - &it913x_config, &d->i2c_adap); - if (ret) + request_module("%s", "it913x"); + pdev = platform_device_register_data(&d->intf->dev, + "it913x", + PLATFORM_DEVID_AUTO, + &it913x_pdata, + sizeof(it913x_pdata)); + if (IS_ERR(pdev) || !pdev->dev.driver) { + ret = -ENODEV; + goto err; + } + if (!try_module_get(pdev->dev.driver->owner)) { + platform_device_unregister(pdev); + ret = -ENODEV; goto err; + } + state->platform_device_tuner[adap->id] = pdev; fe = adap->fe[0]; break; } @@ -1678,12 +1663,6 @@ static int af9035_tuner_detach(struct dvb_usb_adapter *adap) switch (state->af9033_config[adap->id].tuner) { case AF9033_TUNER_TUA9001: case AF9033_TUNER_FC2580: - case AF9033_TUNER_IT9135_38: - case AF9033_TUNER_IT9135_51: - case AF9033_TUNER_IT9135_52: - case AF9033_TUNER_IT9135_60: - case AF9033_TUNER_IT9135_61: - case AF9033_TUNER_IT9135_62: if (adap->id == 1) { if (state->i2c_client[3]) af9035_del_i2c_dev(d); @@ -1691,6 +1670,23 @@ static int af9035_tuner_detach(struct dvb_usb_adapter *adap) if (state->i2c_client[1]) af9035_del_i2c_dev(d); } + break; + case AF9033_TUNER_IT9135_38: + case AF9033_TUNER_IT9135_51: + case AF9033_TUNER_IT9135_52: + case AF9033_TUNER_IT9135_60: + case AF9033_TUNER_IT9135_61: + case AF9033_TUNER_IT9135_62: + { + struct platform_device *pdev; + + pdev = state->platform_device_tuner[adap->id]; + if (pdev) { + module_put(pdev->dev.driver->owner); + platform_device_unregister(pdev); + } + break; + } } return 0; diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h index 89a08a4eac2e..a76e6bf0ab1e 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.h +++ b/drivers/media/usb/dvb-usb-v2/af9035.h @@ -22,6 +22,7 @@ #ifndef AF9035_H #define AF9035_H +#include #include "dvb_usb.h" #include "af9033.h" #include "tua9001.h" @@ -73,6 +74,7 @@ struct state { #define AF9035_I2C_CLIENT_MAX 4 struct i2c_client *i2c_client[AF9035_I2C_CLIENT_MAX]; struct i2c_adapter *i2c_adapter_demod; + struct platform_device *platform_device_tuner[2]; }; static const u32 clock_lut_af9035[] = { -- cgit v1.2.3 From 8efb34b280401acdaad19b6f1920af09d2628334 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Thu, 10 Nov 2016 01:24:50 -0200 Subject: [media] it913x: add chip device ids for binding Driver supports 2 different device versions, AX and BX. Use device IDs to pass chip version information to driver. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/tuners/it913x.c | 11 ++++++++++- drivers/media/tuners/it913x.h | 5 ----- drivers/media/usb/dvb-usb-v2/af9035.c | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/tuners/it913x.c b/drivers/media/tuners/it913x.c index 39998066a347..27e5bc1c3cb5 100644 --- a/drivers/media/tuners/it913x.c +++ b/drivers/media/tuners/it913x.c @@ -390,6 +390,7 @@ static int it913x_probe(struct platform_device *pdev) struct it913x_platform_data *pdata = pdev->dev.platform_data; struct dvb_frontend *fe = pdata->fe; struct it913x_dev *dev; + const struct platform_device_id *id = platform_get_device_id(pdev); int ret; char *chip_ver_str; @@ -403,7 +404,7 @@ static int it913x_probe(struct platform_device *pdev) dev->pdev = pdev; dev->regmap = pdata->regmap; dev->fe = pdata->fe; - dev->chip_ver = pdata->chip_ver; + dev->chip_ver = id->driver_data; dev->role = pdata->role; fe->tuner_priv = dev; @@ -441,6 +442,13 @@ static int it913x_remove(struct platform_device *pdev) return 0; } +static const struct platform_device_id it913x_id_table[] = { + {"it9133ax-tuner", 1}, + {"it9133bx-tuner", 2}, + {}, +}; +MODULE_DEVICE_TABLE(platform, it913x_id_table); + static struct platform_driver it913x_driver = { .driver = { .name = "it913x", @@ -448,6 +456,7 @@ static struct platform_driver it913x_driver = { }, .probe = it913x_probe, .remove = it913x_remove, + .id_table = it913x_id_table, }; module_platform_driver(it913x_driver); diff --git a/drivers/media/tuners/it913x.h b/drivers/media/tuners/it913x.h index 9fb8e028176d..226f657228fb 100644 --- a/drivers/media/tuners/it913x.h +++ b/drivers/media/tuners/it913x.h @@ -25,21 +25,16 @@ * struct it913x_platform_data - Platform data for the it913x driver * @regmap: af9033 demod driver regmap. * @dvb_frontend: af9033 demod driver DVB frontend. - * @chip_ver: Used chip version. 1=IT9133 AX, 2=IT9133 BX. * @role: Chip role, single or dual configuration. */ struct it913x_platform_data { struct regmap *regmap; struct dvb_frontend *fe; - unsigned int chip_ver:2; #define IT913X_ROLE_SINGLE 0 #define IT913X_ROLE_DUAL_MASTER 1 #define IT913X_ROLE_DUAL_SLAVE 2 unsigned int role:2; }; -/* Backwards compatibility */ -#define it913x_config it913x_platform_data - #endif diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index a6ecd52b5917..cb8204387d64 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1495,6 +1495,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) case AF9033_TUNER_IT9135_62: { struct platform_device *pdev; + const char *name; struct it913x_platform_data it913x_pdata = { .regmap = state->af9033_config[adap->id].regmap, .fe = adap->fe[0], @@ -1504,12 +1505,12 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) case AF9033_TUNER_IT9135_38: case AF9033_TUNER_IT9135_51: case AF9033_TUNER_IT9135_52: - it913x_pdata.chip_ver = 1; + name = "it9133ax-tuner"; break; case AF9033_TUNER_IT9135_60: case AF9033_TUNER_IT9135_61: case AF9033_TUNER_IT9135_62: - it913x_pdata.chip_ver = 2; + name = "it9133bx-tuner"; break; default: ret = -ENODEV; @@ -1526,8 +1527,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) } request_module("%s", "it913x"); - pdev = platform_device_register_data(&d->intf->dev, - "it913x", + pdev = platform_device_register_data(&d->intf->dev, name, PLATFORM_DEVID_AUTO, &it913x_pdata, sizeof(it913x_pdata)); -- cgit v1.2.3 From a71e479c132a084d49246908808ba96c33e59226 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 7 Nov 2016 02:01:03 -0200 Subject: [media] af9035: correct demod i2c addresses Chip uses so called 8-bit i2c addresses, but on bus there is of course correct 7-bit addresses with rw bit as lsb - verified with oscilloscope. Lets still use correct addresses in driver. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/af9035.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index cb8204387d64..4df9486e19b9 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -772,9 +772,9 @@ static int af9035_download_firmware(struct dvb_usb_device *d, /* tell the slave I2C address */ tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR]; - /* use default I2C address if eeprom has no address set */ + /* Use default I2C address if eeprom has no address set */ if (!tmp) - tmp = 0x3a; + tmp = 0x1d << 1; /* 8-bit format used by chip */ if ((state->chip_type == 0x9135) || (state->chip_type == 0x9306)) { @@ -837,9 +837,9 @@ static int af9035_read_config(struct dvb_usb_device *d) u8 tmp; u16 tmp16; - /* demod I2C "address" */ - state->af9033_i2c_addr[0] = 0x38; - state->af9033_i2c_addr[1] = 0x3a; + /* Demod I2C address */ + state->af9033_i2c_addr[0] = 0x1c; + state->af9033_i2c_addr[1] = 0x1d; state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB; @@ -878,12 +878,13 @@ static int af9035_read_config(struct dvb_usb_device *d) state->ir_type = state->eeprom[EEPROM_IR_TYPE]; if (state->dual_mode) { - /* read 2nd demodulator I2C address */ + /* Read 2nd demodulator I2C address. 8-bit format on eeprom */ tmp = state->eeprom[EEPROM_2ND_DEMOD_ADDR]; if (tmp) - state->af9033_i2c_addr[1] = tmp; + state->af9033_i2c_addr[1] = tmp >> 1; - dev_dbg(&intf->dev, "2nd demod I2C addr=%02x\n", tmp); + dev_dbg(&intf->dev, "2nd demod I2C addr=%02x\n", + state->af9033_i2c_addr[1]); } for (i = 0; i < state->dual_mode + 1; i++) { -- cgit v1.2.3 From 992b39872b800babcee278bb2b4b7a2d503ba984 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Thu, 23 Jul 2015 18:53:41 -0300 Subject: [media] 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 Signed-off-by: Mauro Carvalho Chehab --- 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 | 294 ++++++++++++++++++++++++++++++++++ 4 files changed, 306 insertions(+) create mode 100644 drivers/media/usb/dvb-usb-v2/zd1301.c (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index 779f4224b63e..55acd11dc052 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_774 0x7a69 #define USB_VID_EVOLUTEPC 0x1e59 diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 524533d3eb29..0e4944b2b0f4 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -156,3 +156,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 f10d4df0eae5..969f68e55265 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 000000000000..563e50c6a327 --- /dev/null +++ b/drivers/media/usb/dvb-usb-v2/zd1301.c @@ -0,0 +1,294 @@ +/* + * 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 "dvb_usb.h" +#include "zd1301_demod.h" +#include "mt2060.h" +#include +#include + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +struct zd1301_dev { + #define BUF_LEN 8 + u8 buf[BUF_LEN]; /* bulk USB control message */ + struct zd1301_demod_platform_data demod_pdata; + struct mt2060_platform_data mt2060_pdata; + struct platform_device *platform_device_demod; + struct i2c_client *i2c_client_tuner; +}; + +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(&d->usb_mutex); + + memcpy(&dev->buf, wbuf, wlen); + + dev_dbg(&intf->dev, ">>> %*ph\n", wlen, dev->buf); + + ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev, 0x04), dev->buf, + wlen, &actual_length, 1000); + if (ret) { + dev_err(&intf->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, &actual_length, 1000); + if (ret) { + dev_err(&intf->dev, + "2nd usb_bulk_msg() failed %d\n", ret); + goto err_mutex_unlock; + } + + dev_dbg(&intf->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(&intf->dev, "repeating reply message\n"); + + ret = usb_bulk_msg(d->udev, + usb_rcvbulkpipe(d->udev, 0x83), + dev->buf, rlen, &actual_length, + 1000); + if (ret) { + dev_err(&intf->dev, + "3rd usb_bulk_msg() failed %d\n", ret); + goto err_mutex_unlock; + } + + dev_dbg(&intf->dev, + "<<< %*ph\n", actual_length, dev->buf); + } + + memcpy(rbuf, dev->buf, rlen); + } + +err_mutex_unlock: + mutex_unlock(&d->usb_mutex); + return ret; +} + +static int zd1301_demod_wreg(void *reg_priv, u16 reg, u8 val) +{ + struct dvb_usb_device *d = reg_priv; + struct usb_interface *intf = d->intf; + int ret; + u8 buf[7] = {0x07, 0x00, 0x03, 0x01, + (reg >> 0) & 0xff, (reg >> 8) & 0xff, val}; + + ret = zd1301_ctrl_msg(d, buf, 7, NULL, 0); + if (ret) + goto err; + + return 0; +err: + dev_dbg(&intf->dev, "failed=%d\n", ret); + return ret; +} + +static int zd1301_demod_rreg(void *reg_priv, u16 reg, u8 *val) +{ + struct dvb_usb_device *d = reg_priv; + struct usb_interface *intf = d->intf; + int ret; + u8 buf[7] = {0x07, 0x00, 0x04, 0x01, + (reg >> 0) & 0xff, (reg >> 8) & 0xff, 0}; + + ret = zd1301_ctrl_msg(d, buf, 7, buf, 7); + if (ret) + goto err; + + *val = buf[6]; + + return 0; +err: + dev_dbg(&intf->dev, "failed=%d\n", ret); + return ret; +} + +static int zd1301_frontend_attach(struct dvb_usb_adapter *adap) +{ + struct dvb_usb_device *d = adap_to_d(adap); + struct zd1301_dev *dev = adap_to_priv(adap); + struct usb_interface *intf = d->intf; + struct platform_device *pdev; + struct i2c_client *client; + struct i2c_board_info board_info; + struct i2c_adapter *adapter; + struct dvb_frontend *frontend; + int ret; + + dev_dbg(&intf->dev, "\n"); + + /* Add platform demod */ + dev->demod_pdata.reg_priv = d; + dev->demod_pdata.reg_read = zd1301_demod_rreg; + dev->demod_pdata.reg_write = zd1301_demod_wreg; + request_module("%s", "zd1301_demod"); + pdev = platform_device_register_data(&intf->dev, + "zd1301_demod", + PLATFORM_DEVID_AUTO, + &dev->demod_pdata, + sizeof(dev->demod_pdata)); + if (IS_ERR(pdev)) { + ret = PTR_ERR(pdev); + goto err; + } + if (!pdev->dev.driver) { + ret = -ENODEV; + goto err; + } + if (!try_module_get(pdev->dev.driver->owner)) { + ret = -ENODEV; + goto err_platform_device_unregister; + } + + adapter = zd1301_demod_get_i2c_adapter(pdev); + frontend = zd1301_demod_get_dvb_frontend(pdev); + + /* Add I2C tuner */ + dev->mt2060_pdata.i2c_write_max = 9; + dev->mt2060_pdata.dvb_frontend = frontend; + memset(&board_info, 0, sizeof(board_info)); + strlcpy(board_info.type, "mt2060", I2C_NAME_SIZE); + board_info.addr = 0x60; + board_info.platform_data = &dev->mt2060_pdata; + request_module("%s", "mt2060"); + client = i2c_new_device(adapter, &board_info); + if (!client || !client->dev.driver) { + ret = -ENODEV; + goto err_module_put_demod; + } + if (!try_module_get(client->dev.driver->owner)) { + ret = -ENODEV; + goto err_i2c_unregister_device; + } + + dev->platform_device_demod = pdev; + dev->i2c_client_tuner = client; + adap->fe[0] = frontend; + + return 0; +err_i2c_unregister_device: + i2c_unregister_device(client); +err_module_put_demod: + module_put(pdev->dev.driver->owner); +err_platform_device_unregister: + platform_device_unregister(pdev); +err: + dev_dbg(&intf->dev, "failed=%d\n", ret); + return ret; +} + +static int zd1301_frontend_detach(struct dvb_usb_adapter *adap) +{ + struct dvb_usb_device *d = adap_to_d(adap); + struct zd1301_dev *dev = d_to_priv(d); + struct usb_interface *intf = d->intf; + struct platform_device *pdev; + struct i2c_client *client; + + dev_dbg(&intf->dev, "\n"); + + client = dev->i2c_client_tuner; + pdev = dev->platform_device_demod; + + /* Remove I2C tuner */ + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + + /* Remove platform demod */ + if (pdev) { + module_put(pdev->dev.driver->owner); + platform_device_unregister(pdev); + } + + return 0; +} + +static int zd1301_streaming_ctrl(struct dvb_frontend *fe, int onoff) +{ + struct dvb_usb_device *d = fe_to_d(fe); + struct usb_interface *intf = d->intf; + int ret; + u8 buf[3] = {0x03, 0x00, onoff ? 0x07 : 0x08}; + + dev_dbg(&intf->dev, "onoff=%d\n", onoff); + + ret = zd1301_ctrl_msg(d, buf, 3, NULL, 0); + if (ret) + goto err; + + return 0; +err: + dev_dbg(&intf->dev, "failed=%d\n", ret); + return ret; +} + +static const struct dvb_usb_device_properties zd1301_props = { + .driver_name = KBUILD_MODNAME, + .owner = THIS_MODULE, + .adapter_nr = adapter_nr, + .size_of_priv = sizeof(struct zd1301_dev), + + .frontend_attach = zd1301_frontend_attach, + .frontend_detach = zd1301_frontend_detach, + .streaming_ctrl = zd1301_streaming_ctrl, + + .num_adapters = 1, + .adapter = { + { + .stream = DVB_USB_STREAM_BULK(0x81, 6, 21 * 188), + }, + }, +}; + +static const struct usb_device_id zd1301_id_table[] = { + {DVB_USB_DEVICE(USB_VID_ZYDAS, 0x13a1, &zd1301_props, + "ZyDAS ZD1301 reference design", NULL)}, + {} +}; +MODULE_DEVICE_TABLE(usb, zd1301_id_table); + +/* Usb specific object needed to register this driver with the usb subsystem */ +static struct usb_driver zd1301_usb_driver = { + .name = KBUILD_MODNAME, + .id_table = zd1301_id_table, + .probe = dvb_usbv2_probe, + .disconnect = dvb_usbv2_disconnect, + .suspend = dvb_usbv2_suspend, + .resume = dvb_usbv2_resume, + .reset_resume = dvb_usbv2_reset_resume, + .no_dynamic_id = 1, + .soft_unbind = 1, +}; +module_usb_driver(zd1301_usb_driver); + +MODULE_AUTHOR("Antti Palosaari "); +MODULE_DESCRIPTION("ZyDAS ZD1301 driver"); +MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 3a3402d3180cc8aea65de52a8897701b5828a928 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 30 Nov 2016 19:39:09 -0200 Subject: [media] lmedm04: use %phN for hex dump Using the %ph printf extension for hex dumps like this makes the generated code quite a bit smaller. Signed-off-by: Rasmus Villemoes Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index c2aff953cd7a..360cb62ee21d 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -95,9 +95,7 @@ static int dvb_usb_lme2510_debug; } while (0) #define deb_info(level, args...) lme_debug(dvb_usb_lme2510_debug, level, args) #define debug_data_snipet(level, name, p) \ - deb_info(level, name" (%02x%02x%02x%02x%02x%02x%02x%02x)", \ - *p, *(p+1), *(p+2), *(p+3), *(p+4), \ - *(p+5), *(p+6), *(p+7)); + deb_info(level, name" (%8phN)", p); #define info(args...) pr_info(DVB_USB_LOG_PREFIX": "args) module_param_named(debug, dvb_usb_lme2510_debug, int, 0644); -- cgit v1.2.3 From 75759e31e6e7f38625510a89fe580374a75db9f4 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 30 Nov 2016 19:39:10 -0200 Subject: [media] lmedm04: change some static variables to automatic ibuf and rbuf in lme2510_int_response are always assigned to before they are read, and their addresses do not escape the function, so they have no reason to be static. Signed-off-by: Rasmus Villemoes Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 360cb62ee21d..5a327676e235 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -309,7 +309,7 @@ static void lme2510_int_response(struct urb *lme_urb) { struct dvb_usb_adapter *adap = lme_urb->context; struct lme2510_state *st = adap_to_priv(adap); - static u8 *ibuf, *rbuf; + u8 *ibuf, *rbuf; int i = 0, offset; u32 key; u8 signal_lock = 0; -- cgit v1.2.3 From bfe17178a8240c008484c43cf9e018d43ff9a990 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 30 Nov 2016 19:39:11 -0200 Subject: [media] lmedm04: make some string arrays static It takes more .text to initialize these on the stack than they occupy in .rodata, so just make them static const. Signed-off-by: Rasmus Villemoes Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 5a327676e235..66833b61321a 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -996,8 +996,9 @@ static int lme_name(struct dvb_usb_adapter *adap) struct dvb_usb_device *d = adap_to_d(adap); struct lme2510_state *st = adap_to_priv(adap); const char *desc = d->name; - char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395", - " SHARP:BS2F7HZ0194", " RS2000"}; + static const char * const fe_name[] = { + "", " LG TDQY-P001F", " SHARP:BS2F7HZ7395", + " SHARP:BS2F7HZ0194", " RS2000"}; char *name = adap->fe[0]->ops.info.name; strlcpy(name, desc, 128); @@ -1118,7 +1119,7 @@ static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap_to_d(adap); struct lme2510_state *st = adap_to_priv(adap); - char *tun_msg[] = {"", "TDA8263", "IX2505V", "DVB_PLL_OPERA", "RS2000"}; + static const char * const tun_msg[] = {"", "TDA8263", "IX2505V", "DVB_PLL_OPERA", "RS2000"}; int ret = 0; switch (st->tuner_config) { -- cgit v1.2.3 From 974eadf1fc4f9bd0e9da686e7ba6c3e4e708fc45 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 30 Nov 2016 19:39:12 -0200 Subject: [media] lmedm04: make lme2510_powerup a little smaller gcc isn't smart enough to realize it can share most of the argument buildup and the actual function call between the two branches, so help it a little. Signed-off-by: Rasmus Villemoes Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 66833b61321a..924adfdb660d 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -1173,10 +1173,7 @@ static int lme2510_powerup(struct dvb_usb_device *d, int onoff) mutex_lock(&d->i2c_mutex); - if (onoff) - ret = lme2510_usb_talk(d, lnb_on, len, rbuf, rlen); - else - ret = lme2510_usb_talk(d, lnb_off, len, rbuf, rlen); + ret = lme2510_usb_talk(d, onoff ? lnb_on : lnb_off, len, rbuf, rlen); st->i2c_talk_onoff = 1; -- cgit v1.2.3 From 005145378c9ad7575a01b6ce1ba118fb427f583a Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 2 Feb 2017 12:36:01 -0200 Subject: [media] dvb-usb-v2: avoid use-after-free I ran into a stack frame size warning because of the on-stack copy of the USB device structure: drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_disconnect': drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:1029:1: error: the frame size of 1104 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Copying a device structure like this is wrong for a number of other reasons too aside from the possible stack overflow. One of them is that the dev_info() call will print the name of the device later, but AFAICT we have only copied a pointer to the name earlier and the actual name has been freed by the time it gets printed. This removes the on-stack copy of the device and instead copies the device name using kstrdup(). I'm ignoring the possible failure here as both printk() and kfree() are able to deal with NULL pointers. Signed-off-by: Arnd Bergmann Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index 298c91a6f1f9..955fb0d07507 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c @@ -1012,8 +1012,8 @@ EXPORT_SYMBOL(dvb_usbv2_probe); void dvb_usbv2_disconnect(struct usb_interface *intf) { struct dvb_usb_device *d = usb_get_intfdata(intf); - const char *name = d->name; - struct device dev = d->udev->dev; + const char *devname = kstrdup(dev_name(&d->udev->dev), GFP_KERNEL); + const char *drvname = d->name; dev_dbg(&d->udev->dev, "%s: bInterfaceNumber=%d\n", __func__, intf->cur_altsetting->desc.bInterfaceNumber); @@ -1023,8 +1023,9 @@ void dvb_usbv2_disconnect(struct usb_interface *intf) dvb_usbv2_exit(d); - dev_info(&dev, "%s: '%s' successfully deinitialized and disconnected\n", - KBUILD_MODNAME, name); + pr_info("%s: '%s:%s' successfully deinitialized and disconnected\n", + KBUILD_MODNAME, drvname, devname); + kfree(devname); } EXPORT_SYMBOL(dvb_usbv2_disconnect); -- cgit v1.2.3 From 0d1270df836fe9f5cc7e8001b7372ca4fa3f00f6 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 7 Feb 2017 11:01:41 -0200 Subject: [media] zd1301: fix building interface driver without demodulator If the USB driver is enabled but the demodulator is not, we get a link error: ERROR: "zd1301_demod_get_dvb_frontend" [drivers/media/usb/dvb-usb-v2/zd1301.ko] undefined! ERROR: "zd1301_demod_get_i2c_adapter" [drivers/media/usb/dvb-usb-v2/zd1301.ko] undefined! Such a configuration obviously makes no sense, but we should not fail the build. This tries to mimic what we have for other drivers by turning the build failure into a runtime failure. Alternatively we could use an unconditional 'select' or 'depends on' to enforce a sane configuration. Fixes: 47d65372b3b6 ("[media] zd1301_demod: ZyDAS ZD1301 DVB-T demodulator driver") Fixes: 992b39872b80 ("[media] zd1301: ZyDAS ZD1301 DVB USB interface driver") Signed-off-by: Arnd Bergmann Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/zd1301_demod.h | 18 ++++++++++++++++++ drivers/media/usb/dvb-usb-v2/zd1301.c | 4 ++++ 2 files changed, 22 insertions(+) (limited to 'drivers/media/usb/dvb-usb-v2') diff --git a/drivers/media/dvb-frontends/zd1301_demod.h b/drivers/media/dvb-frontends/zd1301_demod.h index 78a3122e4942..ceb2e05e873c 100644 --- a/drivers/media/dvb-frontends/zd1301_demod.h +++ b/drivers/media/dvb-frontends/zd1301_demod.h @@ -34,6 +34,7 @@ struct zd1301_demod_platform_data { int (*reg_write)(void *, u16, u8); }; +#if IS_REACHABLE(CONFIG_DVB_ZD1301_DEMOD) /** * zd1301_demod_get_dvb_frontend() - Get pointer to DVB frontend * @pdev: Pointer to platform device @@ -52,4 +53,21 @@ struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *); struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *); +#else + +static inline struct dvb_frontend *zd1301_demod_get_dvb_frontend(struct platform_device *dev) +{ + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); + + return NULL; +} +static inline struct i2c_adapter *zd1301_demod_get_i2c_adapter(struct platform_device *dev) +{ + printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); + + return NULL; +} + +#endif + #endif /* ZD1301_DEMOD_H */ diff --git a/drivers/media/usb/dvb-usb-v2/zd1301.c b/drivers/media/usb/dvb-usb-v2/zd1301.c index 563e50c6a327..d1eb4b7bc051 100644 --- a/drivers/media/usb/dvb-usb-v2/zd1301.c +++ b/drivers/media/usb/dvb-usb-v2/zd1301.c @@ -168,6 +168,10 @@ static int zd1301_frontend_attach(struct dvb_usb_adapter *adap) adapter = zd1301_demod_get_i2c_adapter(pdev); frontend = zd1301_demod_get_dvb_frontend(pdev); + if (!adapter || !frontend) { + ret = -ENODEV; + goto err_module_put_demod; + } /* Add I2C tuner */ dev->mt2060_pdata.i2c_write_max = 9; -- cgit v1.2.3