From: Antti Palosaari <crope@iki.fi>
To: Olli Salonen <olli.salonen@iki.fi>, linux-media@vger.kernel.org
Subject: Re: [PATCH 4/4] cxusb: Add read_mac_address for TT CT2-4400 and CT2-4650
Date: Sun, 10 Aug 2014 01:54:26 +0300 [thread overview]
Message-ID: <53E6A6A2.7070309@iki.fi> (raw)
In-Reply-To: <1407481598-24598-4-git-send-email-olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
your code is easy to read!
Antti
On 08/08/2014 10:06 AM, Olli Salonen wrote:
> Read MAC address from the EEPROM.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/usb/dvb-usb/cxusb.c | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
> index c3a44c7..6abfd6b 100644
> --- a/drivers/media/usb/dvb-usb/cxusb.c
> +++ b/drivers/media/usb/dvb-usb/cxusb.c
> @@ -673,6 +673,41 @@ static struct rc_map_table rc_map_d680_dmb_table[] = {
> { 0x0025, KEY_POWER },
> };
>
> +static int cxusb_tt_ct2_4400_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
> +{
> + u8 wbuf[2];
> + u8 rbuf[6];
> + int ret;
> + struct i2c_msg msg[] = {
> + {
> + .addr = 0x51,
> + .flags = 0,
> + .buf = wbuf,
> + .len = 2,
> + }, {
> + .addr = 0x51,
> + .flags = I2C_M_RD,
> + .buf = rbuf,
> + .len = 6,
> + }
> + };
> +
> + wbuf[0] = 0x1e;
> + wbuf[1] = 0x00;
> + ret = cxusb_i2c_xfer(&d->i2c_adap, msg, 2);
> +
> + if (ret == 2) {
> + memcpy(mac, rbuf, 6);
> + return 0;
> + } else {
> + if (ret < 0)
> + return ret;
> + else
> + return -EIO;
> + }
> + }
> +}
> +
> static int cxusb_tt_ct2_4650_ci_ctrl(void *priv, u8 read, int addr,
> u8 data, int *mem)
> {
> @@ -2315,6 +2350,8 @@ static struct dvb_usb_device_properties cxusb_tt_ct2_4400_properties = {
> .size_of_priv = sizeof(struct cxusb_state),
>
> .num_adapters = 1,
> + .read_mac_address = cxusb_tt_ct2_4400_read_mac_address,
> +
> .adapter = {
> {
> .num_frontends = 1,
>
--
http://palosaari.fi/
next prev parent reply other threads:[~2014-08-09 22:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-08 7:06 [PATCHv2 1/4] sp2: Add I2C driver for CIMaX SP2 common interface module Olli Salonen
2014-08-08 7:06 ` [PATCHv2 2/4] Add USB ID for TechnoTrend TT-connect CT2-4650 CI Olli Salonen
2014-08-09 22:47 ` Antti Palosaari
2014-08-08 7:06 ` [PATCHv2 3/4] cxusb: Add support " Olli Salonen
2014-08-09 22:51 ` Antti Palosaari
2014-08-08 7:06 ` [PATCH 4/4] cxusb: Add read_mac_address for TT CT2-4400 and CT2-4650 Olli Salonen
2014-08-09 22:54 ` Antti Palosaari [this message]
2014-08-09 22:47 ` [PATCHv2 1/4] sp2: Add I2C driver for CIMaX SP2 common interface module Antti Palosaari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53E6A6A2.7070309@iki.fi \
--to=crope@iki.fi \
--cc=linux-media@vger.kernel.org \
--cc=olli.salonen@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.