From patchwork Mon Aug 11 19:58:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 25321 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1XGvjo-0005yU-7y; Mon, 11 Aug 2014 21:58:36 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-5) with esmtp id 1XGvjm-0001nw-7u; Mon, 11 Aug 2014 21:58:36 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932229AbaHKT6b (ORCPT + 1 other); Mon, 11 Aug 2014 15:58:31 -0400 Received: from mta-out1.inet.fi ([62.71.2.194]:56420 "EHLO kirsi1.inet.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932220AbaHKT62 (ORCPT ); Mon, 11 Aug 2014 15:58:28 -0400 Received: from devlin.trsqr.net (84.249.202.144) by kirsi1.inet.fi (8.5.142.08) id 53D0A9E8017ADA76; Mon, 11 Aug 2014 22:58:20 +0300 From: Olli Salonen To: olli@cabbala.net Cc: Olli Salonen , Linux Media Mailing List Subject: [PATCH 4/6] cx23885: add i2c client handling into dvb_unregister and state Date: Mon, 11 Aug 2014 22:58:13 +0300 Message-Id: <1407787095-2167-4-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407787095-2167-1-git-send-email-olli.salonen@iki.fi> References: <1407787095-2167-1-git-send-email-olli.salonen@iki.fi> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.8.11.195119 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, SUPERLONG_LINE 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __DATE_TZ_RU 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' Prepare cx23885 driver for handling I2C client that is needed for certain demodulators and tuners (for example Si2168 and Si2157). I2C client for tuner and demod stored in state and unregistering of the I2C devices added into dvb_unregister. Signed-off-by: Olli Salonen Reviewed-by: Antti Palosaari --- drivers/media/pci/cx23885/cx23885-dvb.c | 16 ++++++++++++++++ drivers/media/pci/cx23885/cx23885.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 968fecc..2608155 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -1643,6 +1643,7 @@ int cx23885_dvb_register(struct cx23885_tsport *port) int cx23885_dvb_unregister(struct cx23885_tsport *port) { struct videobuf_dvb_frontend *fe0; + struct i2c_client *client; /* FIXME: in an error condition where the we have * an expected number of frontends (attach problem) @@ -1651,6 +1652,21 @@ int cx23885_dvb_unregister(struct cx23885_tsport *port) * This comment only applies to future boards IF they * implement MFE support. */ + + /* remove I2C client for tuner */ + client = port->i2c_client_tuner; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + + /* remove I2C client for demodulator */ + client = port->i2c_client_demod; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + fe0 = videobuf_dvb_get_frontend(&port->frontends, 1); if (fe0 && fe0->dvb.frontend) videobuf_dvb_unregister_bus(&port->frontends); diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index 0e086c0..1040b3e 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -326,6 +326,9 @@ struct cx23885_tsport { /* Workaround for a temp dvb_frontend that the tuner can attached to */ struct dvb_frontend analog_fe; + struct i2c_client *i2c_client_demod; + struct i2c_client *i2c_client_tuner; + int (*set_frontend)(struct dvb_frontend *fe); };