From patchwork Sun Jun 2 15:17:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Plamen Atanasov X-Patchwork-Id: 13682914 Received: from mx5.mail.bg (mx5.mail.bg [193.201.172.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADF91B66F for ; Sun, 2 Jun 2024 15:17:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.201.172.121 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717341439; cv=none; b=tW3ypm6GFGOf+gDoYPFbtMAUvr2VMDxuFDJEvxM0W4Cy+kMU3+2ux73BHUEol1ddW38XsbQVjK1H9hKLfxgtC4d5NV1XGjHw39gDFCHWpoqIu5oNXbkWhkukI5xdYNyoVhgzRSisgWjotrMlIevrKM1wUFt23j440n2lLAeYATc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717341439; c=relaxed/simple; bh=58hLkQt5Z6pDG2oXJ3MNYEtjr8YHua6WhYP+5Xg2h5k=; h=Message-ID:Date:Subject:From:To:Cc:MIME-Version:Content-Type; b=KRtJGah2OAouHxDLUCE3/XOzJ5ZnvG4g4ffUDBa2SuK9MK4HTAly27s+6h05Z3GY+JzsTbz0UEOZwIhSf8DIXRIPCBu/jRTdncvny2DyCEmKq0Yrju7lYc1ZTK7OoCLAPQ2OCxcPEjecTiJQ4dcp9Ay/z+Vi1vqMG1Ct6GvFLPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mail.bg; spf=pass smtp.mailfrom=mail.bg; dkim=pass (1024-bit key) header.d=mail.bg header.i=@mail.bg header.b=Ca+PgNPW; arc=none smtp.client-ip=193.201.172.121 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mail.bg Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mail.bg Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mail.bg header.i=@mail.bg header.b="Ca+PgNPW" Received: from mail.bg (unknown [10.0.0.24]) by mx5.mail.bg (Postfix) with ESMTPA id 744CC9391D8E; Sun, 2 Jun 2024 18:17:13 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mail.bg; s=default; t=1717341433; bh=58hLkQt5Z6pDG2oXJ3MNYEtjr8YHua6WhYP+5Xg2h5k=; h=Message-ID:Date:Subject:From:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding; b=Ca+PgNPWUutkuV4i5g/1D08cTn7wQ1s2jhEjHrC93UzhQNv5bSVjGwMazwf6HbsqQ mZ0CZrWxjxR5OpKRKx8f54yPQRSSNvqPdHkrED2sJM2DJBF+iwZNu64rJ42ZGztwcp yxzTexqPwRd2cLB0m+qb+k52/YpIAk3Ku9dy2WPM= Message-ID: <85bc1bd641de9ed2bca76258fdf13d7b.mailbg@mail.bg> Date: Sun, 2 Jun 2024 18:17:13 +0300 Subject: [PATCH] media: cx23885: Add analog support for AVerMedia H789-C PCIe card From: Plamen Atanasov To: linux-media@vger.kernel.org Cc: mchehab@kernel.org, hverkuil@xs4all.nl, hdegoede@redhat.com, laurent.pinchart@ideasonboard.com User-Agent: Mail.BG Webmail Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Priority: 3 (Normal) Importance: Normal X-Composed: 2024-06-02T18:17:13+03:00 This card has the following ICs: Hybrid tuner TDA18271, CX23888 PCIe bridge/demodulator/decoder (and DVB-T demodulator AF9013S, which is not within the scope of this patch). It has the following inputs: Tuner, S-Video, Composite (shared with the luma input of S-Video) and Audio L/R RCA. VID:PID is 1461:e139. When the patch is applied and the cx23885 kernel module is built and loaded, the following dmesg can be seen: [ 749.677298] cx23885: cx23885 driver version 0.0.4 loaded [ 749.677554] cx23885: CORE cx23885[0]: subsystem: 1461:e139, board: AVerMedia H789-C [card=63,autodetected] [ 749.831841] cx25840 8-0044: cx23888 A/V decoder found @ 0x88 (cx23885[0]) [ 750.451676] cx25840 8-0044: loaded v4l-cx23885-avcore-01.fw firmware (16382 bytes) [ 750.488064] tuner: 7-0063: Tuner -1 found with type(s) Radio TV. [ 750.488115] tda18271 7-0063: creating new instance [ 750.490153] tda18271: TDA18271HD/C2 detected @ 7-0063 [ 750.805043] cx23885: cx23885[0]: registered device video2 [v4l2] [ 750.805151] cx23885: cx23885[0]: registered device vbi2 [ 750.808682] cx23885: cx23885[0]: alsa: registered ALSA audio device [ 750.808693] cx23885: cx23885_dev_checkrevision() Hardware revision = 0xd0 [ 750.808700] cx23885: cx23885[0]/0: found at 0000:02:00.0, rev: 4, irq: 18, latency: 0, mmio: 0xddc00000 The card has to be defined in cx23885-cards.c (firmware also has to be loaded) and cx23885.h. Moreover, audio routing is configured in cx23885-video.c. Analog tuning, composite, s-video and stereo audio inputs have been successfully tested with PAL B/G. Signed-off-by: Plamen Atanasov --- drivers/media/pci/cx23885/cx23885-cards.c | 30 ++++++++++++++++++++++++++++++ drivers/media/pci/cx23885/cx23885-video.c | 3 ++- drivers/media/pci/cx23885/cx23885.h | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 9244b432055..b1a4cd631cf 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -860,6 +860,31 @@ struct cx23885_board cx23885_boards[] = { .amux = CX25840_AUDIO7, } }, }, + [CX23885_BOARD_AVERMEDIA_H789C] = { + .name = "AVerMedia H789-C", + .porta = CX23885_ANALOG_VIDEO, + .tuner_type = TUNER_NXP_TDA18271, + .tuner_addr = 0x63, /* 0xc0 >> 1 */ + .tuner_bus = 1, + .input = {{ + .type = CX23885_VMUX_TELEVISION, + .vmux = CX25840_VIN7_CH3 | + CX25840_VIN5_CH2 | + CX25840_VIN2_CH1 | + CX25840_DIF_ON, + .amux = CX25840_AUDIO8, + }, { + .type = CX23885_VMUX_COMPOSITE1, + .vmux = CX25840_VIN8_CH1, + .amux = CX25840_AUDIO7, + }, { + .type = CX23885_VMUX_SVIDEO, + .vmux = CX25840_VIN8_CH1 | + CX25840_VIN7_CH3 | + CX25840_SVIDEO_ON, + .amux = CX25840_AUDIO7, + }, }, + }, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -1187,6 +1212,10 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x1461, .subdevice = 0x3100, .card = CX23885_BOARD_AVERMEDIA_CE310B, + }, { + .subvendor = 0x1461, + .subdevice = 0xe139, + .card = CX23885_BOARD_AVERMEDIA_H789C, }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -2413,6 +2442,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_VIEWCAST_260E: case CX23885_BOARD_VIEWCAST_460E: case CX23885_BOARD_AVERMEDIA_CE310B: + case CX23885_BOARD_AVERMEDIA_H789C: dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_bus[2].i2c_adap, "cx25840", 0x88 >> 1, NULL); diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 7d4a409c433..479c0253698 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -261,7 +261,8 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) (dev->board == CX23885_BOARD_AVERMEDIA_HC81R) || (dev->board == CX23885_BOARD_VIEWCAST_260E) || (dev->board == CX23885_BOARD_VIEWCAST_460E) || - (dev->board == CX23885_BOARD_AVERMEDIA_CE310B)) { + (dev->board == CX23885_BOARD_AVERMEDIA_CE310B) || + (dev->board == CX23885_BOARD_AVERMEDIA_H789C)) { /* Configure audio routing */ v4l2_subdev_call(dev->sd_cx25840, audio, s_routing, INPUT(input)->amux, 0, 0); diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index 349462ee2c4..8ba1f306238 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -102,6 +102,7 @@ #define CX23885_BOARD_HAUPPAUGE_QUADHD_DVB_885 60 #define CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC_885 61 #define CX23885_BOARD_AVERMEDIA_CE310B 62 +#define CX23885_BOARD_AVERMEDIA_H789C 63 #define GPIO_0 0x00000001 #define GPIO_1 0x00000002