Skip to content

Commit

Permalink
Merge tag 'mfd-fixes-4.15' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/lee/mfd

Pull MDF bugfixes from Lee Jones:

  - Fix message timing issues and report correct state when an error
    occurs in cros_ec_spi

  - Reorder enums used for Power Management in rtsx_pci

  - Use correct OF helper for obtaining child nodes in twl4030-audio and
    twl6040

* tag 'mfd-fixes-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
  mfd: Fix RTS5227 (and others) powermanagement
  mfd: cros ec: spi: Fix "in progress" error signaling
  mfd: twl6040: Fix child-node lookup
  mfd: twl4030-audio: Fix sibling-node lookup
  mfd: cros ec: spi: Don't send first message too soon
  • Loading branch information
Linus Torvalds committed Dec 20, 2017
2 parents a5f89a5 + b860b41 commit 444fec1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 35 deletions.
53 changes: 25 additions & 28 deletions drivers/mfd/cros_ec_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ static int cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev,
u8 *ptr;
u8 *rx_buf;
u8 sum;
u8 rx_byte;
int ret = 0, final_ret;

len = cros_ec_prepare_tx(ec_dev, ec_msg);
Expand Down Expand Up @@ -421,25 +422,22 @@ static int cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev,
if (!ret) {
/* Verify that EC can process command */
for (i = 0; i < len; i++) {
switch (rx_buf[i]) {
case EC_SPI_PAST_END:
case EC_SPI_RX_BAD_DATA:
case EC_SPI_NOT_READY:
ret = -EAGAIN;
ec_msg->result = EC_RES_IN_PROGRESS;
default:
rx_byte = rx_buf[i];
if (rx_byte == EC_SPI_PAST_END ||
rx_byte == EC_SPI_RX_BAD_DATA ||
rx_byte == EC_SPI_NOT_READY) {
ret = -EREMOTEIO;
break;
}
if (ret)
break;
}
if (!ret)
ret = cros_ec_spi_receive_packet(ec_dev,
ec_msg->insize + sizeof(*response));
} else {
dev_err(ec_dev->dev, "spi transfer failed: %d\n", ret);
}

if (!ret)
ret = cros_ec_spi_receive_packet(ec_dev,
ec_msg->insize + sizeof(*response));
else
dev_err(ec_dev->dev, "spi transfer failed: %d\n", ret);

final_ret = terminate_request(ec_dev);

spi_bus_unlock(ec_spi->spi->master);
Expand Down Expand Up @@ -508,6 +506,7 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev,
int i, len;
u8 *ptr;
u8 *rx_buf;
u8 rx_byte;
int sum;
int ret = 0, final_ret;

Expand Down Expand Up @@ -544,25 +543,22 @@ static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev,
if (!ret) {
/* Verify that EC can process command */
for (i = 0; i < len; i++) {
switch (rx_buf[i]) {
case EC_SPI_PAST_END:
case EC_SPI_RX_BAD_DATA:
case EC_SPI_NOT_READY:
ret = -EAGAIN;
ec_msg->result = EC_RES_IN_PROGRESS;
default:
rx_byte = rx_buf[i];
if (rx_byte == EC_SPI_PAST_END ||
rx_byte == EC_SPI_RX_BAD_DATA ||
rx_byte == EC_SPI_NOT_READY) {
ret = -EREMOTEIO;
break;
}
if (ret)
break;
}
if (!ret)
ret = cros_ec_spi_receive_response(ec_dev,
ec_msg->insize + EC_MSG_TX_PROTO_BYTES);
} else {
dev_err(ec_dev->dev, "spi transfer failed: %d\n", ret);
}

if (!ret)
ret = cros_ec_spi_receive_response(ec_dev,
ec_msg->insize + EC_MSG_TX_PROTO_BYTES);
else
dev_err(ec_dev->dev, "spi transfer failed: %d\n", ret);

final_ret = terminate_request(ec_dev);

spi_bus_unlock(ec_spi->spi->master);
Expand Down Expand Up @@ -667,6 +663,7 @@ static int cros_ec_spi_probe(struct spi_device *spi)
sizeof(struct ec_response_get_protocol_info);
ec_dev->dout_size = sizeof(struct ec_host_request);

ec_spi->last_transfer_ns = ktime_get_ns();

err = cros_ec_register(ec_dev);
if (err) {
Expand Down
9 changes: 7 additions & 2 deletions drivers/mfd/twl4030-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,18 @@ unsigned int twl4030_audio_get_mclk(void)
EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);

static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
struct device_node *node)
struct device_node *parent)
{
struct device_node *node;

if (pdata && pdata->codec)
return true;

if (of_find_node_by_name(node, "codec"))
node = of_get_child_by_name(parent, "codec");
if (node) {
of_node_put(node);
return true;
}

return false;
}
Expand Down
12 changes: 8 additions & 4 deletions drivers/mfd/twl6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,16 @@ static struct reg_sequence twl6040_patch[] = {
};


static bool twl6040_has_vibra(struct device_node *node)
static bool twl6040_has_vibra(struct device_node *parent)
{
#ifdef CONFIG_OF
if (of_find_node_by_name(node, "vibra"))
struct device_node *node;

node = of_get_child_by_name(parent, "vibra");
if (node) {
of_node_put(node);
return true;
#endif
}

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion include/linux/mfd/rtsx_pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -915,10 +915,10 @@ enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
#define LTR_L1SS_PWR_GATE_CHECK_CARD_EN BIT(6)

enum dev_aspm_mode {
DEV_ASPM_DISABLE = 0,
DEV_ASPM_DYNAMIC,
DEV_ASPM_BACKDOOR,
DEV_ASPM_STATIC,
DEV_ASPM_DISABLE,
};

/*
Expand Down

0 comments on commit 444fec1

Please sign in to comment.